Skip to content

Commit 8b8e5f3

Browse files
authored
WalletLink: add getter/setter for default wallet (#4505)
### Description <!-- Provide a clear and concise description of your changes and their purpose --> ### Changes <!-- List the specific changes made in this PR, for example: - Added/modified feature X - Fixed bug in component Y - Refactored module Z - Updated documentation --> ### Checklist - [ ] Tests added where required - [ ] Documentation updated where applicable - [ ] Changes adhere to the repository's contribution guidelines
1 parent dd02b90 commit 8b8e5f3

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

packages/web3/src/wallet-link/WalletLink.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { WalletAlreadyLinkedError, WalletNotLinkedError } from '../types/error-t
55
import { BaseChainConfig } from '../utils/web3Env'
66
import { IWalletLinkShim } from './WalletLinkShim'
77
import { createEip712LinkedWalletdData } from '../eip-712/EIP-712'
8+
import { OverrideExecution } from '../BaseContractShim'
89

910
export const INVALID_ADDRESS = '0x0000000000000000000000000000000000000000'
1011

@@ -48,6 +49,24 @@ export class WalletLink {
4849
return { walletAddress }
4950
}
5051

52+
public async getDefaultWallet(rootKeyAddress: string) {
53+
return this.walletLinkShim.read.getDefaultWallet(rootKeyAddress)
54+
}
55+
56+
public async setDefaultWallet<T = ContractTransaction>(args: {
57+
signer: ethers.Signer
58+
walletAddress: Address
59+
overrideExecution?: OverrideExecution<T>
60+
}) {
61+
const { signer, walletAddress, overrideExecution } = args
62+
return this.walletLinkShim.executeCall({
63+
signer,
64+
functionName: 'setDefaultWallet',
65+
args: [walletAddress],
66+
overrideExecution,
67+
})
68+
}
69+
5170
private generateRootKeySignatureForWallet({
5271
rootKey,
5372
walletAddress,

0 commit comments

Comments
 (0)