GemWallet / gemwallet-extension

GemWallet is a cutting-edge crypto wallet and Web3 layer for the XRP Ledger. Our browser extension enables you to interact with the XRP Ledger directly from your browser (Metamask for the XRPL). - https://gemwallet.app
https://gemwallet.app
Other
53 stars 20 forks source link

Detect wrong NetworkID in Transaction views #343

Closed ThibautBremand closed 9 months ago

ThibautBremand commented 9 months ago

How to test: 1/ Add a NetworkID in packages/api/templates/index.html, e.g.:

  function handleMintNFT() {
    GemWalletApi.isInstalled()
      .then(({ result }) => {
        if (result.isInstalled) {
          const transaction = {
            URI: '4d696e746564207468726f7567682047656d57616c6c657421',
            flags: {
              tfOnlyXRP: true,
              tfTransferable: true
            },
            // fee: '199',
            transferFee: 3000, // 3%,
            NFTokenTaxon: 0,
            networkID: 21338,
            memos: [
              {
                memo: {
                  memoType: '4465736372697074696f6e',
                  memoData: '54657374206d656d6f'
                }
              }
            ]
          };

          GemWalletApi.mintNFT(transaction)
            .then((res) => {
              console.log('Received response: ', res);
            })
            .catch((e) => {
              console.error('Cannot proceed the transaction: ', e);
            });
        }
      })
      .catch((e) => {
        console.error('GemWallet is not connected: ', e);
      });
  }

21338 for Xahau Testnet

2/ Open GemWallet, set the chain to XRPL.

3/ Try the transaction: a modal will appear asking to switch network