Closed lukema95 closed 1 month ago
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Solana CLI stores keys in ~/.config/solana/id.json
. Please, suggest how we can modify the task to optionally use a key from there (and whether this is a good idea). Maybe we check if this file exists, use it, if not default to the private key in env.
Also, please, add a way to specify a custom Solana address to query. If address is provided, don't derive it from private key.
Maybe,
npx hardhat balances --evm 0x*** --solana *** --bitcoin ***
Also, please, add a way to specify a custom Solana address to query. If address is provided, don't derive it from private key.
Maybe,
npx hardhat balances --evm 0x*** --solana *** --bitcoin ***
Given that we currently have tokens on three heterogeneous chains, and may expand to more in the future, I'd like to clarify a few points:
- Is an EVM address (--evm or private key) mandatory?
- If we provide one of the three parameters --evm, --solana, or --bitcoin, can we ignore the private key?
- Would it be better to uniformly place all required private keys in the .env file? Currently, there's only one PRIVATE_KEY, but Solana needs to read from ~/.config/solana/id.json. This can cause some confusion in decision-making. Can we expand the variables to EVM_PRIVATE_KEY, SOLANA_PRIVATE_KEY, and BTC_PRIVATE_KEY? This would provide greater flexibility.
- For the above, we only need to first determine whether condition 2 is provided, if not, then directly read the private key in condition 3. This makes the code judgment simpler.
Is an EVM address (--evm or private key) mandatory?
No, I don't think it's mandatory.
If we provide one of the three parameters --evm, --solana, or --bitcoin, can we ignore the private key?
I think we can. This is basically "watch mode" in a wallet, where you provide an address, can view balances, but of course can't sign txs.
Would it be better to uniformly place all required private keys in the .env file? Currently, there's only one PRIVATE_KEY, but Solana needs to read from ~/.config/solana/id.json. This can cause some confusion in decision-making. Can we expand the variables to EVM_PRIVATE_KEY, SOLANA_PRIVATE_KEY, and BTC_PRIVATE_KEY? This would provide greater flexibility.
Yes, I think it's a good decision!
npx hardhat balances --solana HEgoKVmb6yohTatYM3D7nXFojo7uYEmitz2qj1255KL2 --evm 0x6093537Aa6C8C8bf4705bda40aC9193977208B39 --bitcoin tb1quy77dhfutn7dndevv7vff5he7g0d2j2hj2jwrv
EVM: 0x6093537Aa6C8C8bf4705bda40aC9193977208B39
Bitcoin: tb1quy77dhfutn7dndevv7vff5he7g0d2j2hj2jwrv
Solana: HEgoKVmb6yohTatYM3D7nXFojo7uYEmitz2qj1255KL2
┌─────────┬───────────────────┬───────────────────────────────────┬─────────┬─────────────┐
│ (index) │ Chain │ Token │ Type │ Amount │
├─────────┼───────────────────┼───────────────────────────────────┼─────────┼─────────────┤
│ 0 │ 'amoy_testnet' │ 'WZETA' │ 'ERC20' │ '0.000000' │
│ 1 │ 'amoy_testnet' │ 'MATIC.AMOY' │ 'Gas' │ '0.650769' │
│ 2 │ 'base_sepolia' │ 'ETH.BASESEPOLIA' │ 'Gas' │ '0.000000' │
│ 3 │ 'bsc_testnet' │ 'USDC' │ 'ERC20' │ '0.001689' │
│ 4 │ 'bsc_testnet' │ 'WZETA' │ 'ERC20' │ '0.000000' │
│ 5 │ 'bsc_testnet' │ 'tBNB' │ 'Gas' │ '0.795821' │
│ 6 │ 'btc_testnet' │ 'tBTC' │ 'Gas' │ '0.000112' │
│ 7 │ 'sepolia_testnet' │ 'USDC.SEPOLIA' │ 'ERC20' │ '0.000000' │
│ 8 │ 'sepolia_testnet' │ 'WZETA' │ 'ERC20' │ '0.000000' │
│ 9 │ 'sepolia_testnet' │ 'sETH.SEPOLIA' │ 'Gas' │ '0.241025' │
│ 10 │ 'solana_devnet' │ 'SOL.SOLANA' │ 'Gas' │ '3.189423' │
│ 11 │ 'zeta_testnet' │ 'sETH.SEPOLIA' │ 'ZRC20' │ '0.031614' │
│ 12 │ 'zeta_testnet' │ 'USDC-goerli_testnet' │ 'ZRC20' │ '0.000000' │
│ 13 │ 'zeta_testnet' │ 'gETH' │ 'ZRC20' │ '0.000000' │
│ 14 │ 'zeta_testnet' │ 'ETH.BASESEPOLIA' │ 'ZRC20' │ '0.000000' │
│ 15 │ 'zeta_testnet' │ 'tMATIC' │ 'ZRC20' │ '0.000000' │
│ 16 │ 'zeta_testnet' │ 'tBTC' │ 'ZRC20' │ '0.000022' │
│ 17 │ 'zeta_testnet' │ 'MATIC.AMOY' │ 'ZRC20' │ '0.108915' │
│ 18 │ 'zeta_testnet' │ 'USDC-bsc_testnet' │ 'ZRC20' │ '0.000000' │
│ 19 │ 'zeta_testnet' │ 'USDC-mumbai_testnet' │ 'ZRC20' │ '0.000000' │
│ 20 │ 'zeta_testnet' │ 'SOL.SOLANA' │ 'ZRC20' │ '0.000000' │
│ 21 │ 'zeta_testnet' │ 'ZetaChain ZRC20 USDC on SEPOLIA' │ 'ZRC20' │ '0.116826' │
│ 22 │ 'zeta_testnet' │ 'tBNB' │ 'ZRC20' │ '0.000000' │
│ 23 │ 'zeta_testnet' │ 'WZETA' │ 'ERC20' │ '0.042220' │
│ 24 │ 'zeta_testnet' │ 'ZETA' │ 'Gas' │ '70.274601' │
└─────────┴───────────────────┴───────────────────────────────────┴─────────┴─────────────┘
npx hardhat balances
EVM: 0x6093537Aa6C8C8bf4705bda40aC9193977208B39
Bitcoin: tb1quy77dhfutn7dndevv7vff5he7g0d2j2hj2jwrv
Solana: HEgoKVmb6yohTatYM3D7nXFojo7uYEmitz2qj1255KL2
┌─────────┬───────────────────┬───────────────────────────────────┬─────────┬─────────────┐
│ (index) │ Chain │ Token │ Type │ Amount │
├─────────┼───────────────────┼───────────────────────────────────┼─────────┼─────────────┤
│ 0 │ 'amoy_testnet' │ 'WZETA' │ 'ERC20' │ '0.000000' │
│ 1 │ 'amoy_testnet' │ 'MATIC.AMOY' │ 'Gas' │ '0.650769' │
│ 2 │ 'base_sepolia' │ 'ETH.BASESEPOLIA' │ 'Gas' │ '0.000000' │
│ 3 │ 'bsc_testnet' │ 'USDC' │ 'ERC20' │ '0.001689' │
│ 4 │ 'bsc_testnet' │ 'WZETA' │ 'ERC20' │ '0.000000' │
│ 5 │ 'bsc_testnet' │ 'tBNB' │ 'Gas' │ '0.795821' │
│ 6 │ 'btc_testnet' │ 'tBTC' │ 'Gas' │ '0.000112' │
│ 7 │ 'sepolia_testnet' │ 'USDC.SEPOLIA' │ 'ERC20' │ '0.000000' │
│ 8 │ 'sepolia_testnet' │ 'WZETA' │ 'ERC20' │ '0.000000' │
│ 9 │ 'sepolia_testnet' │ 'sETH.SEPOLIA' │ 'Gas' │ '0.241025' │
│ 10 │ 'solana_devnet' │ 'SOL.SOLANA' │ 'Gas' │ '3.189423' │
│ 11 │ 'zeta_testnet' │ 'sETH.SEPOLIA' │ 'ZRC20' │ '0.031614' │
│ 12 │ 'zeta_testnet' │ 'USDC-goerli_testnet' │ 'ZRC20' │ '0.000000' │
│ 13 │ 'zeta_testnet' │ 'gETH' │ 'ZRC20' │ '0.000000' │
│ 14 │ 'zeta_testnet' │ 'ETH.BASESEPOLIA' │ 'ZRC20' │ '0.000000' │
│ 15 │ 'zeta_testnet' │ 'tMATIC' │ 'ZRC20' │ '0.000000' │
│ 16 │ 'zeta_testnet' │ 'tBTC' │ 'ZRC20' │ '0.000022' │
│ 17 │ 'zeta_testnet' │ 'MATIC.AMOY' │ 'ZRC20' │ '0.108915' │
│ 18 │ 'zeta_testnet' │ 'USDC-bsc_testnet' │ 'ZRC20' │ '0.000000' │
│ 19 │ 'zeta_testnet' │ 'USDC-mumbai_testnet' │ 'ZRC20' │ '0.000000' │
│ 20 │ 'zeta_testnet' │ 'SOL.SOLANA' │ 'ZRC20' │ '0.000000' │
│ 21 │ 'zeta_testnet' │ 'ZetaChain ZRC20 USDC on SEPOLIA' │ 'ZRC20' │ '0.116826' │
│ 22 │ 'zeta_testnet' │ 'tBNB' │ 'ZRC20' │ '0.000000' │
│ 23 │ 'zeta_testnet' │ 'WZETA' │ 'ERC20' │ '0.042220' │
│ 24 │ 'zeta_testnet' │ 'ZETA' │ 'Gas' │ '70.274601' │
└─────────┴───────────────────┴───────────────────────────────────┴─────────┴─────────────┘
@fadeev pls review. Looks like we need to update npx hardhat account --save
.
@fadeev pls review. Looks like we need to update
npx hardhat account --save
.
Yes, I've added an issue: https://github.com/zeta-chain/toolkit/issues/187 (feel free to take it!)
Looks good! I think
XYZ_PRIVATE_KEY
is definitely the way to go, but can you please addPRIVATE_KEY
as an alias toEVM_PRIVATE_KEY
for backwards compatibility. We don't want to break the experience for no good reason.So, the logic is for EVM if exists use
EVM_PRIVATE_KEY
(higher priority), if not usePRIVATE_KEY
(lower priority).
Done
Relevant issue: #180
Summary by CodeRabbit
New Features
Bug Fixes
Documentation