@opentron/tronlink-provider

Web3 provider that uses the `java-tron` HTTP API and tronlink.

Usage no npm install needed!

<script type="module">
  import opentronTronlinkProvider from 'https://cdn.skypack.dev/@opentron/tronlink-provider';
</script>

README

@opentron/tronlink-provider

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

See tronlink-provider-demo for a demo.

Install

npm install @opentron/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

  • eth_requestAccounts