23 lines
555 B
TypeScript
23 lines
555 B
TypeScript
import { Wallet } from '@project-serum/anchor'
|
|
import { Keypair, PublicKey, Transaction } from '@solana/web3.js'
|
|
|
|
export default class EmptyWallet implements Wallet {
|
|
constructor(readonly payer: Keypair) {}
|
|
|
|
async signTransaction(tx: Transaction): Promise<Transaction> {
|
|
tx.partialSign(this.payer)
|
|
return tx
|
|
}
|
|
|
|
async signAllTransactions(txs: Transaction[]): Promise<Transaction[]> {
|
|
return txs.map((t) => {
|
|
t.partialSign(this.payer)
|
|
return t
|
|
})
|
|
}
|
|
|
|
get publicKey(): PublicKey {
|
|
return this.payer.publicKey
|
|
}
|
|
}
|