Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion website/docs/guides/walletconnect.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,10 @@ WizardConnect covers transaction signing only. For arbitrary message signing, us

Send the request to your WizardConnect dapp client. Its `signTransaction` method takes the `transaction` and `inputPaths` and returns the signed transaction.

WizardConnect sends requests over its relay as plain JSON, which cannot hold the `bigint` and `Uint8Array` fields of the `WcTransactionObject`. Passing the object as-is throws `TypeError: Do not know how to serialize a BigInt`. Encode the transaction object with libauth's `stringify` first, as with BCH WalletConnect.

```ts
import { stringify } from "@bitauth/libauth";
import { type WcTransactionObject } from "cashscript";

interface SignTransactionRequest {
Expand All @@ -280,7 +283,10 @@ async function signWizardTransaction(
request: SignTransactionRequest,
): Promise<string | undefined> {
try {
const result = await dappConnectionManager.signTransaction(request);
const result = await dappConnectionManager.signTransaction({
transaction: JSON.parse(stringify(request.transaction)),
inputPaths: request.inputPaths,
});
return result.signedTransaction;
} catch (error) {
return undefined;
Expand Down
Loading