From 0e33136aa4da3bf0758d31f1f51e7cfdca960e85 Mon Sep 17 00:00:00 2001 From: Georgi Tsonev Date: Tue, 19 Nov 2024 15:33:34 +0200 Subject: [PATCH] Fix signAndSendTransactionAsync interface --- packages/core/docs/api/wallet.md | 4 ++-- packages/core/docs/guides/custom-wallets.md | 2 +- packages/core/src/lib/wallet/wallet.types.ts | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/core/docs/api/wallet.md b/packages/core/docs/api/wallet.md index d182efd22..65e1fa5a4 100644 --- a/packages/core/docs/api/wallet.md +++ b/packages/core/docs/api/wallet.md @@ -275,7 +275,7 @@ Signs one or more NEAR Actions before sending to the network. The user must be s **Returns** -- `Uint8Array | void`: Browser wallets won't return the transaction outcome as they may need to redirect for signing. More details on this can be found [here](https://docs.near.org/api/rpc/transactions#send-transaction-await). +- `Promise`: Browser wallets won't return the transaction outcome as they may need to redirect for signing. More details on this can be found [here](https://docs.near.org/api/rpc/transactions#send-transaction-await). **Description** @@ -288,7 +288,7 @@ Signs one or more NEAR Actions before sending to the network. The user must be s ```ts (async () => { const wallet = await selector.wallet("sender"); - const txHash = wallet.signAndSendTransactionAsync({ + const txHash = await wallet.signAndSendTransactionAsync({ actions: [{ type: "FunctionCall", params: { diff --git a/packages/core/docs/guides/custom-wallets.md b/packages/core/docs/guides/custom-wallets.md index d88da4b49..6d8d310c9 100644 --- a/packages/core/docs/guides/custom-wallets.md +++ b/packages/core/docs/guides/custom-wallets.md @@ -62,7 +62,7 @@ const MyWallet: WalletBehaviourFactory = ({ // Sign a list of NEAR Actions before sending via an RPC endpoint. // An RPC provider is injected to make this process easier and configured based on options.network. - return provider.sendTransaction(signedTx); + return provider.sendTransactionAsync(signedTx); }, async signAndSendTransactions({ transactions }) { diff --git a/packages/core/src/lib/wallet/wallet.types.ts b/packages/core/src/lib/wallet/wallet.types.ts index 496e6b4b0..4d513f27a 100644 --- a/packages/core/src/lib/wallet/wallet.types.ts +++ b/packages/core/src/lib/wallet/wallet.types.ts @@ -221,7 +221,9 @@ interface BaseWalletBehaviour { * Signs one or more NEAR Actions before sending to the network. * The user must be signed in to call this method as there's at least charges for gas spent. */ - signAndSendTransactionAsync(params: SignAndSendTransactionParams): Uint8Array; + signAndSendTransactionAsync( + params: SignAndSendTransactionParams + ): Promise; /** * Signs one or more transactions before sending to the network. * The user must be signed in to call this method as there's at least charges for gas spent. @@ -332,7 +334,7 @@ export type BrowserWalletBehaviour = Modify< ): Promise; signAndSendTransactionAsync( params: BrowserWalletSignAndSendTransactionParams - ): Uint8Array | void; + ): Promise; signAndSendTransactions( params: BrowserWalletSignAndSendTransactionsParams ): Promise;