Like @tofudefi/java-tron-provider but uses the TronLink extension for signing transactions.
See tronlink-provider-demo for a demo.
npm install @tofudefi/tronlink-provider
The functionSignatures
array must contain all mutable function that
will potentially be called. Otherwise, you could get an "cannot find
function name mapping for signature" error.
const abi = [
{
constant: true,
inputs: [],
name: "get",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
payable: false,
stateMutability: "view",
type: "function",
},
{
constant: false,
inputs: [{ internalType: "uint256", name: "_value", type: "uint256" }],
name: "set",
outputs: [],
payable: false,
stateMutability: "nonpayable",
type: "function",
},
];
const provider = createTronLinkProvider({
network: "nile",
functionSignatures: abi,
});
const web3 = new Web3(provider);
eth_requestAccounts