zeta-chain / toolkit

A library of ZetaChain helper utilities, contracts, and Hardhat tasks for smart-contract development
MIT License
43 stars 22 forks source link

Make Solana deposit function callable from `ZetaChainClient` and from browser #182

Open fadeev opened 2 months ago

fadeev commented 2 months ago

Right now the function reads a key from a filesystem. This works in a Hardhat/Node.js environment, but of course doesn't work in a browser.

https://github.com/zeta-chain/toolkit/blob/73b823d9341b2e30e6ece801c8cbe19daaca7e5d/packages/client/src/solanaDeposit.ts

We need to ensure that the function can be used from a browser.

const client = new ZetaChainClient({
  network: "testnet",
  //...
});
client.solanaDeposit()

For EVM chains we're using Ethers signer. For Solana I'm assuming it's going to be something else. Although, RainbowKit integrates with Solana.

### Tasks
- [ ] Modify the function to be used from `ZetaChainClient` in a browser
- [ ] Ensure that address derived in the toolkit matches the one in the official Solana extension wallet for the same key/mnemonic.
- [ ] Ensure that the function can be called using official Solana extension walllet (Phantom) by passings Solana equivalent of Ethers signer. So that in a browser context you're using extension wallet's signer rather than passing a key/mnemonic

Related: https://github.com/zeta-chain/toolkit/issues/180

lukema95 commented 2 weeks ago

@fadeev We haven't used this function in any examples yet, have we?

fadeev commented 2 weeks ago

@fadeev We haven't used this function in any examples yet, have we?

Not yet, no, but it can be used with this example https://github.com/zeta-chain/example-contracts/tree/main/omnichain/swap

See https://github.com/zeta-chain/toolkit/pull/179