-
Notifications
You must be signed in to change notification settings - Fork 38
Open
Description
For RPC calls when wallet-auth: true, the admin token needs to be set as an option when instantiating the client:
const {WalletClient, Network} = require('bcoin');
const network = Network.get('regtest');
const walletOptions = {
network: network.type,
port: network.walletPort,
apiKey: 'api-key'
token: <ADMIN TOKEN OR WALLET TOKEN>
}
const walletClient = new WalletClient(walletOptions);
(async () => {
const result = await walletClient.execute('getwalletinfo');
console.log(result);
})();
The token property is stored in the bcurl/client, without setting this property there is no other way to add a token to an RPC call -- note that with the REST-API HTTP calls the docs already specify to add ?token=... or --token=...
https://bcoin.io/api-docs/?shell--curl#wallet-authentication
Metadata
Metadata
Assignees
Labels
No labels