Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/wallet-sdk/src/CoinbaseWalletProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export class CoinbaseWalletProvider extends ProviderEventEmitter implements Prov
}
const signer = this.initSigner(signerType);

if (signerType === 'scw' && subAccountsConfig?.enableAutoSubAccounts) {
if (signerType === 'scw') {
await signer.handshake({ method: 'handshake' });
// eth_requestAccounts gets translated to wallet_connect at SCWSigner level
await signer.request(args);
Expand Down
12 changes: 9 additions & 3 deletions packages/wallet-sdk/src/sign/scw/SCWSigner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,10 @@ export class SCWSigner implements Signer {
},
],
});
this.callback?.('connect', { chainId: numberToHex(this.chain.id) });

return this.accounts;
}
case 'wallet_switchEthereumChain': {
case 'wallet_switchEthereumChain': {
assertParamsChainId(request.params);
this.chain.id = Number(request.params[0].chainId);
return;
Expand Down Expand Up @@ -236,6 +236,7 @@ export class SCWSigner implements Signer {
: appendWithoutDuplicates(this.accounts, subAccount.address);
}

this.callback?.('connect', { chainId: numberToHex(this.chain.id) });
return this.accounts;
}
case 'eth_coinbase':
Expand Down Expand Up @@ -279,6 +280,8 @@ export class SCWSigner implements Signer {
request,
subAccountsConfig?.capabilities ?? {}
);

this.callback?.('connect', { chainId: numberToHex(this.chain.id) });
return this.sendRequestToPopup(modifiedRequest);
}
// Sub Account Support
Expand All @@ -293,7 +296,10 @@ export class SCWSigner implements Signer {
if (!this.chain.rpcUrl) {
throw standardErrors.rpc.internal('No RPC URL set for chain');
}
const response = await fetchRPCRequest(request, this.chain.rpcUrl) as GetSubAccountsResponse;
const response = (await fetchRPCRequest(
request,
this.chain.rpcUrl
)) as GetSubAccountsResponse;
assertArrayPresence(response.subAccounts, 'subAccounts');
if (response.subAccounts.length > 0) {
// cache the sub account
Expand Down
Loading