test-actions-bump-sdk
v1.3.1
Published
The @unique-nft/sdk package implements the SDK methods via the REST API. The package implements all the basic methods for working with the Unique Network SDK.
Maintainers
Readme
Client
Table of Contents
About Client package
The @unique-nft/sdk package implements the SDK methods via the REST API. The package implements all the basic methods for working with the SDK:
The package is under construction. Check the SDK package methods list to learn more about the methods, that will be implemented in the @unique-nft/sdk package.
Installation
npm
npm install @unique-nft/sdkInitialization
Node.js
import { Sdk, Options } from '@unique-nft/sdk';
const options: Options = {
baseUrl: '<REST API URL>'
};
const sdk = new Sdk(options);In the baseUrl parameter, you must pass one of the paths to the Unique Network
Opal
https://rest.unique.network/opal/v1Quartz
https://rest.unique.network/quartz/v1Unique
https://rest.unique.network/unique/v1Set a signer
To be able to sign extrinsics, you need to install the Accounts package
npm install @unique-nft/accountsPass the singer in the parameters when creating the Client object
import { KeyringOptions } from "@polkadot/keyring/types";
import { KeyringProvider } from '@unique-nft/accounts/keyring';
import { Sdk } from "@unique-nft/sdk";
const options: KeyringOptions = {
type: 'sr25519',
};
const provider = new KeyringProvider(options);
await provider.init();
const signer = provider.addSeed('<seed of account>');
const clientOptions = {
baseUrl: 'REST API URL',
signer
};
const sdk = new Sdk(clientOptions);Method call examples
const balanceResponse = await sdk.balance.get({ address: '<address>' });const { parsed } = await sdk.balance.transfer.submitWaitResult(
{
address: '<address from>',
destination: '<address to>',
amount: 0.01
});