Socket
Socket
Sign inDemoInstall

@unique-nft/sdk

Package Overview
Dependencies
6
Maintainers
5
Versions
96
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @unique-nft/sdk

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.


Version published
Weekly downloads
96
increased by14.29%
Maintainers
5
Created
Weekly downloads
 

Readme

Source
Unique Network

polkadotjs uniquenetwork language license GitHub Release Date GitHub stability-alpha

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/sdk

unpkg.com

<script src="https://unpkg.com/@unique-nft/sdk/bundles/index.js"></script>
<script src="https://unpkg.com/@unique-nft/sdk/bundles/evm.js"></script>
<script src="https://unpkg.com/@unique-nft/sdk/bundles/full.js"></script>
<script src="https://unpkg.com/@unique-nft/sdk/bundles/subscriptions.js"></script>

Initialization

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/v1
Quartz
https://rest.unique.network/quartz/v1
Unique
https://rest.unique.network/unique/v1

Set a signer

To be able to sign extrinsics, you need to install the Accounts package

npm install @unique-nft/accounts

Pass 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
  });

Keywords

FAQs

Last updated on 23 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc