0

有人可以提供有关如何使用该库的示例吗? https://www.npmjs.com/package/@ledgerhq/logs

这是我的代码:

const LedgerWalletProvider = require('@ledgerhq/web3-subprovider');
const createLedgerSubprovider = LedgerWalletProvider.default;
const TransportNodeHid = require('@ledgerhq/hw-transport-node-hid').default;
const ProviderEngine = require('web3-provider-engine');
const RpcSubprovider = require('web3-provider-engine/subproviders/rpc');

const engine = new ProviderEngine();
const getTransport = () => TransportNodeHid.create();
const ledger = createLedgerSubprovider(getTransport, { askConfirm: true });
engine.addProvider(ledger);
engine.addProvider(new RpcSubprovider({ rpcUrl: process.env.BLOCKCHAIN_NODE_MAINNET }));
engine.start();

module.exports = engine;
4

1 回答 1

0
const logger = require("@ledgerhq/logs");

logger.listen(log => console.log(log.type + ": " + log.message));
于 2020-06-05T18:59:54.433 回答