Skip to content

Commit

Permalink
reordering
Browse files Browse the repository at this point in the history
  • Loading branch information
0xproflupin committed Feb 2, 2024
1 parent 157f431 commit 65755db
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
28 changes: 14 additions & 14 deletions packages/core/base/src/signer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,6 @@ export abstract class BaseSignerWalletAdapter<Name extends string = string>
extends BaseWalletAdapter<Name>
implements SignerWalletAdapter<Name>
{
async signAndSendAllTransactions(
transactions: TransactionOrVersionedTransaction<this['supportedTransactionVersions']>[],
connection: Connection,
options: SignAndSendTransactionOptions = {}
): Promise<(TransactionSignature | WalletSignAndSendAllTransactionsError)[]> {
const results = await Promise.allSettled(
transactions.map((transaction) => this.signAndSendTransaction(transaction, connection, options))
);
return results.map((result) => {
if (result.status === 'fulfilled') return result.value;
return new WalletSignAndSendAllTransactionsError(result.reason);
});
}

async signAndSendTransaction(
transaction: TransactionOrVersionedTransaction<this['supportedTransactionVersions']>,
connection: Connection,
Expand Down Expand Up @@ -107,6 +93,20 @@ export abstract class BaseSignerWalletAdapter<Name extends string = string>
}
}

async signAndSendAllTransactions(
transactions: TransactionOrVersionedTransaction<this['supportedTransactionVersions']>[],
connection: Connection,
options: SignAndSendTransactionOptions = {}
): Promise<(TransactionSignature | WalletSignAndSendAllTransactionsError)[]> {
const results = await Promise.allSettled(
transactions.map((transaction) => this.signAndSendTransaction(transaction, connection, options))
);
return results.map((result) => {
if (result.status === 'fulfilled') return result.value;
return new WalletSignAndSendAllTransactionsError(result.reason);
});
}

abstract signTransaction<T extends TransactionOrVersionedTransaction<this['supportedTransactionVersions']>>(
transaction: T
): Promise<T>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Button } from '@mui/material';
import { useConnection, useWallet } from '@solana/wallet-adapter-react';
import type { TransactionSignature } from '@solana/web3.js';
import { PublicKey, Transaction, TransactionInstruction } from '@solana/web3.js';
import type { FC } from 'react';
import React, { useCallback } from 'react';
Expand All @@ -15,7 +14,7 @@ export const SignAndSendAllTransactions: FC = () => {
const onClick = useCallback(async () => {
try {
if (!publicKey) throw new Error('Wallet not connected!');
if (!signAndSendAllTransactions) throw new Error('Wallet does not supoport signAndSendAllTransactions!');
if (!signAndSendAllTransactions) throw new Error('Wallet does not support signAndSendAllTransactions!');

const {
context: { slot: minContextSlot },
Expand Down

0 comments on commit 65755db

Please sign in to comment.