cennznet / api.js

CENNZnet JS API for browsers, React Native and Node.js
Apache License 2.0
10 stars 10 forks source link

Support/metamask #465

Closed KarishmaBothara closed 2 years ago

KarishmaBothara commented 2 years ago

Closes https://github.com/cennznet/api.js/issues/463 Detail - with this PR, user can use CENNZnet API to sign tx with Metamask wallet. Users eth address should have CPAY to do a CENNZnet operation. The call required is as simple as

await api.tx.genericAsset
            .transfer(stakingAssetId, alice.address, transferAmt)
            . signViaEthWallet(
                ethAddress,
                api
            );

ethAddress - Ethereum address on metamask

KarishmaBothara commented 2 years ago

should we have test for the new extrinsic method signViaEthWallet and the cvmToAddress function?

we have one for signViaEthWallet here - https://github.com/cennznet/api.js/blob/support/Metamask/packages/api/test/e2e/tx.e2e.ts#L130 can add one for cvmToAddress function