tofudefi / tronlink-provider

MIT License
0 stars 1 forks source link

@tofudefi/java-tron-provider

Like @tofudefi/java-tron-provider but uses the TronLink extension for signing transactions.

See tronlink-provider-demo for a demo.

Install

npm install @tofudefi/tronlink-provider

Usage

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);

TODO