Gryfyn with Web3.js (API_key: gryfyn_api_demo_local)

My Gryfyn Wallet Address



Send Transaction:

Destination Ethereum address



Include gryfyn api.js

    <script src="//cdnjs.cloudflare.com/ajax/libs/web3/1.7.5/web3.min.js"></script>
    <script src="//<Gryfyn_PATH>/api.min.js"></script>
  

Loading the API:
      <script>
        const Wallet = GryFyn.default.getProvider('<YOUR_API_KEY>');
      </script>
    
Sending Transaction:

    try {
      // Get wallet address
      const accounts = await Wallet.request({ method: 'eth_requestAccounts' });
      const myaddress = accounts[0];
      
      console.log('wallet address', myaddress);

      if (myaddress) {
        const nonce = await web3.eth.getTransactionCount(myaddress);
        const chainID = await Wallet.request({ method: 'eth_chainId' });
        const params = {
            from: myaddress,
            to: toAddress,
            value: web3.utils.toWei(amount, 'ether'),
            gasLimit: '0x5208',
            gasPrice: '0x174e6cc900',
            nonce: nonce,
            // maxFeePerGas: web3.utils.toWei('50.1', 'gwei'),
            // maxPriorityFeePerGas: web3.utils.toWei('50.1', 'gwei'),
        }
        console.log(params);
        web3.eth.sendTransaction(params);
    }
    } catch (err) {
      console.error(err);
    }