-
Couldn't load subscription status.
- Fork 2
Wallet Evm design #185
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
Wallet Evm design #185
Conversation
| ) | ||
|
|
||
| // EVMClient represents an EVM client interface for wallet operations | ||
| type EVMClient interface { |
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.
Read only operations are placed here
wallet/local/wallet.go
Outdated
| evmClient EVMClient // For EVM operations | ||
| avalancheClient Client // For Avalanche operations |
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.
clients placed here are just for placheolders
| } | ||
| return tx, issueTxErr | ||
| } | ||
|
|
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.
Functions below are for EVM specific implementations of wallet
| return w.evmClient.GetBalance(ctx, address) | ||
| } | ||
|
|
||
| func (w *LocalWallet) DeployEVMContract(ctx context.Context, account Account, network Network, |
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 similar to our Submit Tx, where it combines Build, Sign and Send Tx into one function
| "github.com/ava-labs/libevm/common" | ||
| "github.com/ava-labs/libevm/core/types" | ||
| ) | ||
|
|
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 file contains the input that can be fed into our build, sign, send Tx operations similar to how we do it for Avalanche Txs
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.
It contains EVMDeployContractInput, Transfer
| ) | ||
|
|
||
| // EVMDeployContractInput represents EVM contract deployment parameters | ||
| type EVMDeployContractInput struct { |
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.
We specify EVMDeployContractInput in case user wants to do build,sign,send. We have have DeployContract function which basically combines these build,sign,send steps into one step. DeployContract is in local/wallet.go
| return w.evmClient.GetBalance(ctx, address) | ||
| } | ||
|
|
||
| func (w *LocalWallet) DeployEVMContract(ctx context.Context, account Account, network Network, |
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 similar to Submit Tx, where it combines, Build,Sign,Send Tx into one
| } | ||
| return tx, issueTxErr | ||
| } | ||
|
|
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.
Functions below are for EVM specific implementations of wallet
| "github.com/ava-labs/libevm/common" | ||
| "github.com/ava-labs/libevm/core/types" | ||
| ) | ||
|
|
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 file contains the input that can be fed into build,sign,send operations. This is similar to how we do it for avalanche txs
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.
It contains EVM Contract Deploy input, Transfer input
| ) | ||
|
|
||
| // EVMDeployContractInput represents EVM contract deployment parameters | ||
| type EVMDeployContractInput struct { |
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.
We specificy EVMDeployContractInput in case user wants to use Build,Sign,Send Workflow for Deploying contract. We also have Deploy Contract function that does Build,Sign,Send in one step in local/wallet.go
Proposed EVM design.
Main idea:
Read only operations are implemented by Client, which is inside Wallet
Write Operations will be implemented by Wallet, consistent with Build/Sign/Send approach.
EVM specific operations (like Deploy Contract) will be handled by EVM wallet implementation of wallet interface.
One wallet object will be able to handle both Avalanche and EVM chains