Skip to content

Commit

Permalink
Fix signAndSendTransactionAsync interface
Browse files Browse the repository at this point in the history
  • Loading branch information
gtsonevv committed Nov 19, 2024
1 parent 3f94ddf commit 0e33136
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/core/docs/api/wallet.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<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).

**Description**

Expand All @@ -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: {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/docs/guides/custom-wallets.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const MyWallet: WalletBehaviourFactory<BrowserWallet> = ({
// 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 }) {
Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/lib/wallet/wallet.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Uint8Array>;
/**
* 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.
Expand Down Expand Up @@ -332,7 +334,7 @@ export type BrowserWalletBehaviour = Modify<
): Promise<FinalExecutionOutcome | void>;
signAndSendTransactionAsync(
params: BrowserWalletSignAndSendTransactionParams
): Uint8Array | void;
): Promise<Uint8Array | void>;
signAndSendTransactions(
params: BrowserWalletSignAndSendTransactionsParams
): Promise<void>;
Expand Down

0 comments on commit 0e33136

Please sign in to comment.