mirror of
https://github.com/jwinterm/grin-wallet.git
synced 2026-10-17 15:21:39 +02:00
* build: update jayson and uuid * npm: update lock file to v3 * npm: update lock file --------- Co-authored-by: ardocrat <ardocrat@gri.mw>
Connecting to the wallet's V3 Owner API from Node
This is a small sample with code that demonstrates how to initialize the Wallet V3's Secure API and call API functions through it.
To run this sample:
First run the Owner API:
grin-wallet owner_api
The Owner API uses HTTP Basic authentication when api_secret_path is configured in grin-wallet.toml. Before running the sample, load the secret from that file into an environment variable:
export GRIN_OWNER_API_SECRET="$(cat /path/to/.owner_api_secret)"
The sample sends it as the password for the grin user. If api_secret_path is disabled, the environment variable can be omitted.
Ensure the client connection settings in src/index.js match the Owner API address.
Then (assuming node.js and npm are installed on the system):
npm install
node src/index.js
Feel free to play around with the sample, modifying it to call whatever functions you'd like to see in operation!