Add support for Privy embedded wallets with delegation - #583
Conversation
🟡 Heimdall Review Status
|
There was a problem hiding this comment.
Thank you for the quick work :) Some more nits, but in the meantime I'll start testing it out
I would like to rename this to something that will not confuse users about the fact that this runs in a backend context, rather than frontend (which is where people think when they hear 'embedded wallet'). Something like PrivyEvmDelegatedEmbeddedWalletProvider.
I know it's a mouthful, but it's important to us that this distinction is clear.
There was a problem hiding this comment.
Please update the PrivyWalletProvider section in typescript/agentkit/README.md. Does not need to be a big update, but just enough to signal that it can be either server or embedded.
Could even be a one line addition to the config to add type: 'server' // 'server' or 'embedded'
CarsonRoscoe
left a comment
There was a problem hiding this comment.
Please add the new example under agentkit/typescript/examples/ for our repository structure. It's in alphabetical order, so it would go between langchain-privy-chatbot and langchain-solana-chatbot
This change needs to be in two places, our CONTIRBUTING guide and our root README
There was a problem hiding this comment.
Can you add a .env-local file to the chatbot example?
See here. Basically copy-paste here, but make remove optional from wallet id's description
Got it. I agree |
the way the readme is structured here, after PrivyWalletProvider, it goes on to tell you how to configure the different types. re: 'server' | 'embedded' |
CarsonRoscoe
left a comment
There was a problem hiding this comment.
This is looking good to me!
I'm going to merge this into a new branch and finish it up there. This approach ensures your commits will live on into the final merge, and you will be properly credited for all your valuable work.
Thank you again for the contribution, the ETA is it will be included in the Friday release :)
3ff19cc
into
coinbase:feat/privy-evm-delegated-embedded-wallet-provider
* chore: implement privy delegated wallet provider for evm * chore: rename provider to be evm specific * add unused func to fix inheritance error * chore: add tests for privy evm embedded wallet provider * update readme and changeset * fix onchain spelling * chore: Changed the parameter structure to accept a single config object with address and add example * chore: export privy client from shared privy class * chore: fix native assets transfer * uncomment analytics event * remove logs and use viem's Adress type * use viem's Hex type * lookup chain ID using global NETWORK_ID_TO_CHAIN_ID * remove unused chainid mapping fnc * fix(wallet-providers): Fix type casting in PrivyWalletProvider * remove unnecessary comments * delete lock files * chore: remove logs * chore: await response from privy provider variant * chore: rename spelling to privyEvmDelegatedEmbeddedWalletProvider * udpate chatbot example to use new naming and add env.local file
* chore: implement privy delegated wallet provider for evm * chore: rename provider to be evm specific * add unused func to fix inheritance error * chore: add tests for privy evm embedded wallet provider * update readme and changeset * fix onchain spelling * chore: Changed the parameter structure to accept a single config object with address and add example * chore: export privy client from shared privy class * chore: fix native assets transfer * uncomment analytics event * remove logs and use viem's Adress type * use viem's Hex type * lookup chain ID using global NETWORK_ID_TO_CHAIN_ID * remove unused chainid mapping fnc * fix(wallet-providers): Fix type casting in PrivyWalletProvider * remove unnecessary comments * delete lock files * chore: remove logs * chore: await response from privy provider variant * chore: rename spelling to privyEvmDelegatedEmbeddedWalletProvider * udpate chatbot example to use new naming and add env.local file
* Add support for Privy embedded wallets with delegation (#583) * chore: implement privy delegated wallet provider for evm * chore: rename provider to be evm specific * add unused func to fix inheritance error * chore: add tests for privy evm embedded wallet provider * update readme and changeset * fix onchain spelling * chore: Changed the parameter structure to accept a single config object with address and add example * chore: export privy client from shared privy class * chore: fix native assets transfer * uncomment analytics event * remove logs and use viem's Adress type * use viem's Hex type * lookup chain ID using global NETWORK_ID_TO_CHAIN_ID * remove unused chainid mapping fnc * fix(wallet-providers): Fix type casting in PrivyWalletProvider * remove unnecessary comments * delete lock files * chore: remove logs * chore: await response from privy provider variant * chore: rename spelling to privyEvmDelegatedEmbeddedWalletProvider * udpate chatbot example to use new naming and add env.local file * chore: fix package-lock.json * chore: missing pr feedback addressed * chore: improved typing/logic in PrivyWalletProvider logic that routes to the correct provider * chore: merged privy delegated embedded wallet example with standard privy example * chore: updated privy chatbot readme to signal the server/embedded distinction * chore: removed test. will reintroduce after wallet provider tests pr is merged, and add to privyWalletProvider tests * chore: format/lint * chore: added njokuScript credits to changelog entry * feat: readded test file matching new standard * fix: depps * chore: lint/format * PR feedback * chore: refactor axios to fetch * fix: changed default privy config in chatbot --------- Co-authored-by: Njoku Emmanuel <kalunjoku123@gmail.com>
Add support for Privy embedded wallets with delegation
Description
This PR adds support for Privy's embedded wallets with delegation to AgentKit. It introduces a new wallet provider,
PrivyEvmEmbeddedWalletProvider, that allows AgentKit to use wallets which have been delegated transaction signing authority through Privy's embedded wallet system. This enables autonomous agents to perform onchain actions on behalf of users.The implementation:
PrivyEvmEmbeddedWalletProviderclass that extendsEvmWalletProviderPrivyWalletProviderfactory to support embedded wallets via a newwalletTypeoptionCurrently our UI uses Privy's embedded wallet for delegation to agents, but Coinbase's agent kit only supports Privy's server wallet. This change makes the two systems compatible, allowing agents to properly execute transactions with delegated embedded wallets.
Tests
Checklist