Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RPC commands require token to be set in client options #163

Open
pinheadmz opened this issue Nov 18, 2019 · 0 comments
Open

RPC commands require token to be set in client options #163

pinheadmz opened this issue Nov 18, 2019 · 0 comments

Comments

@pinheadmz
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant