API Endpoints

API endpoints act as gateways for communication between the wallet application and server systems. These endpoints facilitate the exchange of data, enabling developers to integrate the wallet's functionalities into their applications.

These endpoints provide information about the Activelink wallet user including creating an account, account balances, transaction history, and more.

/init

The process configures “near-api-server.config.json” and establishes a master account to store credentials within this file.

This setup enables the use of "simple methods," reducing the need to pass multiple parameters, notably the master account ID and private key or seed phrase.

Note: Use near login to save your key pair to your local machine.

API Endpoint

/init

API Method

POST

API Parameters

master_account_id: The master account that has full access to the NFT contract below.

seed_phrase OR private_key: Seed phrase OR private key of the account ID above.

nft_contract: Contract account that has NFT contract deployed to it server_host: Public IP address for your API server (localhost is the default) Server_port: (Port your API server will listen on.) rpc_node: Network your server will be running on (testnet, mainnet, or betanet)

API Example

{

"master_account_id": "example.testnet",

"seed_phrase": "seed phrase for master_account_id goes here",

"nft_contract": "nft-contract.example.testnet",

"server_host": "localhost",

"server_port": 3000,

"rpc_node": "https://rpc.testnet.near.org"

}

Response

{

"text": "Settings updated."

}

/create_user

Creates a Near sub-account using an initialized master account and saves credentials to /storage directory. Requires /init configuration with the master account.

Note: Only letters, digits, and - or _ separators are allowed.

API Endpoint

/create_user

API Method

POST

API Parameters

None

API Example

{

"name": "satoshi"

}

Response

{

"text": "Account satoshi.example.testnet created. Public key: ed25519:HW4koiHqLi5WdVHWy9fqBWHbLRrzfmvCiRAUVhMa14T2"

}

/parse_seed_phrase

Converts a seed phrase into a public/private key pair.

Note: Only letters, digits, and - or _ separators are allowed.

API Endpoint

/parse_seed_phrase

API Method

POST

API Parameters

None

API Example

{

"seed_phrase": "witch collapse practice feed shame open despair creek road again ice least"

}

Response

{

"seedPhrase": "witch collapse practice feed shame open despair creek road again ice least",

"secretKey": "ed25519:41oHMLtYygTsgwDzaMdjWRq48Sy9xJsitJGmMxgA9A7nvd65aT8vQwAvRdHi1nruPP47B6pNhW5T5TK8SsqCZmjn",

"publicKey": "ed25519:Cgg4i7ciid8uG4K5Vnjzy5N4PXLst5aeH9ApRAUA3y8U"

}

/keypair

Generates Ed25519 key pair.

Note: Only letters, digits, and - or _ separators are allowed.

API Endpoint

/keypair

API Method

Get

API Parameters

None

API Example

http://localhost:3000/keypair

Response

{

"public_key": "ed25519:3pNJK3fwP14UEbPjQqgDASwWR4XmbAEQBeNsyThhtNKY",

"private_key": "3s9nVrCU4MER3w9cxXcJM58RGRzFNJnLzo9vgQiNrkuGW3Xp7Up6cYnY4JKQZ7Qp3GhmXckrApRyDPAfzo2oCm8a"

}

/balance

Displays account balance in yoctoNEAR, which is the smallest unit of Near (10^-24 NEAR).

Note: Only letters, digits, and - or _ separators are allowed.

API Endpoint

/balance

API Method

Get

API Parameters

None

API Example

http://localhost:3000/balance/name.testnet

Response

199999959035075000000000000

Last updated