feat: add svm keypair wallet provider - #246
Conversation
✅ Heimdall Review Status
|
9cb2b3e to
8e81267
Compare
| * @param transaction - The transaction to sign. | ||
| * @returns The signed transaction. | ||
| */ | ||
| abstract signTransaction(transaction: VersionedTransaction): VersionedTransaction; |
There was a problem hiding this comment.
| abstract signTransaction(transaction: VersionedTransaction): VersionedTransaction; | |
| abstract signTransaction(transaction: VersionedTransaction): Promise<VersionedTransaction>; |
Signing will be async with some wallet provider implementations
|
@ngundotra - LGTM. Please commit last pending change request + update |
85b94b5 to
10e7810
Compare
|
@John-peterson-coinbase ty for ping! I addressed feedback & updated interface. Also added a test in wallet-providers, but looks a bit unwieldy. Lmk if I should move it somewhere else. |
|
Hey @ngundotra just fyi – two things:
|
|
@0xRAG Thanks for the tag.
|
| try { | ||
| new SolanaKeypairWalletProvider({ keypair: Keypair.generate().secretKey, rpcUrl: clusterApiUrl('mainnet-beta'), genesisHash: "0x123" }); | ||
| } catch (error) { | ||
| expect(error).toBeDefined(); | ||
| expect(error).toBeInstanceOf(Error); | ||
| expect((error as Error).message).toContain("Unknown network with genesis hash"); | ||
| } |
There was a problem hiding this comment.
Please update to:
expect(() => new SolanaKeypairWalletProvider({ keypair: Keypair.generate().secretKey, rpcUrl: clusterApiUrl('mainnet-beta'), genesisHash: "0x123" })).toThrowError("Unknown network with genesis hash");There was a problem hiding this comment.
Updated! Thanks for this, way cleaner
|
|
Also the PR has a formatting failure – pls run |
| ], | ||
| "dependencies": { | ||
| "@coinbase/coinbase-sdk": "^0.17.0", | ||
| "@solana/web3.js": "^1.98.0", |
There was a problem hiding this comment.
There was a problem hiding this comment.
I prefer not to right now, since the interface is changing, and not all ecosystem packages have upgraded to use it.
But if you really want to get in the guts, it's absolutely more flexible than v1. Bit of a learning curve though
There was a problem hiding this comment.
Got it – that's fine. Only thing I would suggest is to preemptively rename solanaKeyPairWalletProvider and related to solanaV1KeyPairWalletProvider. BTW, why not call svmWalletProvider -> solanaWalletProvider?
There was a problem hiding this comment.
Technically v1 and v2 of @solana/web3.js are compatible. @solana/web3.js@next is just a more opinionated & web-optimized version of v1. Therefore, I don't think it makes sense to name the implementation based on the version of the framework it uses.
That being said, I will version if you think it's better for longevity.
why not call
svmWalletProvider->solanaWalletProvider
I was following the evm naming convention. Here, svm refers to Solana Virtual Machine-like networks that have the same signing curve & similar virtual machine behavior (not formally defined). For example - Eclipse, Sonic, Soon, etc.
I reserved SolanaWalletProvider for an implementation that has some hard-coded checks against the canonical Solana clusters (mainnet-beta, testnet, and devnet)
|
Not sure what those Python test failures are about, maybe try rebasing the PR There are some lint errors to fix now that the formatting is fixed |
dedec87 to
8f3c97c
Compare
|
@ngundotra Thanks for pushing through on this! Two more things:
|
|
@ngundotra Almost there! Can you pls update the PR title to follow Conventional Commits – |
|
@ngundotra Great work here! Let's update the title and then we can merge 🚀 |
|
@ngundotra - you will also need to rebase onto signed commits before merging to master. Please follow these instructions to set up commit signing |
6c8a2a5 to
21f69a4
Compare
|
@John-peterson-coinbase sorry for the spam force rebases... I had added the key to SSH keys, not signing keys 🤦♂️ |
it looks like all but one commit is signed: f02b986 |
…ovider.ts Co-authored-by: John Peterson <98187317+John-peterson-coinbase@users.noreply.github.com>
21f69a4 to
494588e
Compare
|
@0xRAG should be good to go now |
|
@ngundotra thank you, merged! 🚀 |
What changed? Why?
Add Solana wallet provider abstract class called
svmWalletProviderin order to pave the way for Solana integration with Coinbase's AgentKit. There is a concrete implementation calledSvmKeypairWalletProviderthat performs the basic functions to implement Solana actions.This PR updates the
WalletProviderinstance fromabstract getNetwork() -> Networktoabstract getNetwork() -> Promise<Network>in order to support Solana network retrieval, which requires a network request to check genesis hash.Qualified Impact
WalletProviderinterfaceThis PR has minimal evidence to show it works because there are currently no Solana actions tightly integrated with this SDK.