#
Quick Start
Inkey is built to work with Algonaut.js, an open-source front-end library for Algorand.
Try the [inkey-sample-vue
starter project] to get up and running quickly.
#
Step 1: Install Algonaut.js
npm install --save @thencc/algonautjs
#
Step 2: Set up your Algorand node
Pass node configuration to Algonaut, and set the SIGNING_MODE
to 'inkey'
. This tells Algonaut to use Inkey to sign transactions, rather than a local account.
import Algonaut from '@thencc/algonautjs';
const algonaut = new Algonaut({
BASE_SERVER: 'https://testnet-algorand.api.purestake.io/ps2',
INDEX_SERVER: 'https://testnet-algorand.api.purestake.io/idx2',
LEDGER: 'TestNet',
PORT: '',
SIGNING_MODE: 'inkey', // this must be set to use Inkey
API_TOKEN: { 'X-API-Key': 'PURESTAKE_API_KEY' }
});
#
Step 3: Authenticate users
You can pass welcome text to the Algonaut method inkeyConnect
, which will be shown to the user.
The Inkey window will pop down from the top of the screen, and the user can create an account, or log in with an existing account. Their account address is passed back to your app.
const account = await algonaut.inkeyConnect('Connect to my dApp')
#
Step 4: Run transactions
Inkey pops down again to ask users to approve or reject transactions.
const txStatus = await algonaut.sendAlgo({ to: 'ADDRESS', amount: 1000 });
Algonaut.js wraps up the whole Algorand network API in something a bit more front-end friendly. Check the API docs here.