-
Notifications
You must be signed in to change notification settings - Fork 362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add wallet_getAssets support + Chain Abstraction demo changes #816
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
17 Skipped Deployments
|
Deploying demo-ai-agents with
|
Latest commit: |
bb1446f
|
Status: | ✅ Deploy successful! |
Preview URL: | https://92cdb92d.demo-ai-agents.pages.dev |
Branch Preview URL: | https://feat-wallet-getassets.demo-ai-agents.pages.dev |
}; | ||
|
||
// WalletConnect specific functions | ||
const getWalletConnectAssets = async ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this walletconnect specific or CAIP-25 specific?
// Embedded Wallet specific functions | ||
const getEmbeddedWalletAssets = async ( | ||
walletProvider: UniversalProvider, | ||
request: WalletAssetRequest, | ||
chainIdAsHex: Hex, | ||
address: string | ||
): Promise<Record<Hex, Asset[]>[]> => { | ||
const capabilities = await walletProvider.request({ | ||
method: "wallet_getCapabilities", | ||
params: [address] | ||
}) as Capabilities; | ||
|
||
if (!capabilities[chainIdAsHex]?.assetDiscovery?.supported) { | ||
throw new Error("Wallet does not support wallet_getAssets"); | ||
} | ||
|
||
const response = await walletProvider.request({ | ||
method: "wallet_getAssets", | ||
params: [request], | ||
}) as Record<Hex, Asset[]>; | ||
|
||
return [response]; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this specific to our embedded wallet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to rename the method, its not specific to Embedded wallet.
const assetsResponse = await (walletProviderType === "WALLET_CONNECT" | ||
? getWalletConnectAssets(walletProvider, request, chainIdAsHex, projectId!) | ||
: getEmbeddedWalletAssets(walletProvider, request, chainIdAsHex, address) | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if I connect with browser extension wallet for example?
}; | ||
} | ||
|
||
async function aggregateERC20Balances( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we doing this dapp side?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is in the react-wallet
wallet_getAssets
rpc on sample wallet servicewallet_getAssets