Skip to content

MetaMask - RPC Error: MetaMask Tx Signature: User denied transaction signature #434

Description

@norbibi

Hi,

I'm unable to catch a transaction reject from Metamask.
I still get the Uncaught (in promise) error.

My code:

import { POSClient, use } from '@maticnetwork/maticjs';
import { Web3ClientPlugin } from '@maticnetwork/maticjs-web3';
import Web3 from "web3";

use(Web3ClientPlugin);

const posClient = new POSClient();
const web3 = new Web3(window.ethereum);
const GLMtokenAddress = "0x0B220b82F3eA3B7F6d9A1D8ab58930C064A2b5Bf";
const YagnaWalletAddress = "0x2a624D89C9C30A424eE07C9FF9442F03a1f208CF";
const erc20Token = posClient.erc20(GLMtokenAddress);

export async function pay_ticket(account, quantity) {
	var qtty = 600000000000000000 * quantity;
	return posClient.init({
        log: false,
        network: "mainnet",
        version: 'v1',
        parent: {
            provider: web3.currentProvider,
            defaultConfig: {
                from: account
            }
        },
        child: {
            provider: web3.currentProvider,
            defaultConfig: {
                from: account
            }
        }
    }).then(() => {
        return web3.eth.getGasPrice().then((fees) => {
        	return fees;
        });
    }).then((fees) => {
    	return erc20Token.transfer(qtty.toString(), YagnaWalletAddress, {gasPrice: fees*2}).then((tx) => {
    	    return tx;
    	});
    }).then((tx) => {
    	return tx.getReceipt().then((receipt) => {
            return {'err': null, 'txhash': receipt.transactionHash};
        });
    }).catch((err) => {
        return {'err': 'err', 'txhash': null};
    });
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions