2023-07-31 14:21:58 -07:00
2023-07-30 08:45:21 -07:00
2023-07-30 08:45:21 -07:00
2023-07-30 08:45:21 -07:00
2023-07-30 09:22:48 -07:00
2023-07-31 14:21:58 -07:00
2023-07-30 08:49:10 -07:00
2023-07-31 14:21:58 -07:00

@wharfkit/example-nodejs

A simple script for nodejs that performs a token transfer using @wharfkit/session and @wharfkit/wallet-plugin-privatekey.

nodejs and fetch

The script requires nodejs v18+ in order to run due to its dependency on fetch. If running an older version of nodejs, an instance of fetch needs to be provided, which can be done by running:

yarn add node-fetch@2.6.1

Then include node-fetch at the top of the index.js file:

const fetch = require('node-fetch')

And pass fetch in to the 2nd parameter of the Session constructor.

// Establish the session with all of the above parameters
const session = new Session(
    {
        actor: accountName,
        permission: permissionName,
        chain,
        walletPlugin: new WalletPluginPrivateKey(privateKey),
    },
    // The fetch function to use for API calls
    {
        fetch,
    }
)
S
Description
No description provided
Readme 54 KiB
Languages
JavaScript 100%