JSPM

@okxweb3/coin-polkadot

1.0.4
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q39072F
  • License MIT

A polkadot SDK for building Web3 wallets and applications.

Package Exports

  • @okxweb3/coin-polkadot
  • @okxweb3/coin-polkadot/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@okxweb3/coin-polkadot) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@okxweb3/coin-polkadot

Polkadot SDK is used to interact with the Polkadot blockchain, it contains the main functions you need when interact with Polkadot Ecosystem.

Getting Started

Installing Polkadot SDK

npm install @okxweb3/coin-polkadot

What Can Polkadot SDK Do

- getAddress
- validateAddress
- SignTx

Using Polkadot SDK

Get Address / Validate Address

const seed = "e7cfd179d6537a676cb94bac3b5c5c9cb1550e846ac4541040d077dfbac2e7fd"
const address = getNewAddress(seed, NetWork.polkadot)
// validate
const ok = validateAddress(address, NetWork.polkadot)

Transfer

const from = "12VS5aVsZp3qywuC6wjkhAJdkfNp2SC1WPNfoMFevpovCsxr"
const to = "12VS5aVsZp3qywuC6wjkhAJdkfNp2SC1WPNfoMFevpovCsxr"
const tx = {
    From:         from,
    To:           to,
    Amount:       new BN(10000000000),
    Nonce:        new BN(18),
    Tip:          new BN(0),
    BlockHeight:  new BN(10672081),
    BlockHash:    "569e9705bdcd3cf15edb1378433148d437f585a21ad0e2691f0d8c0083021580",
    GenesisHash:  "91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3",
    SpecVersion:  9220,
    TxVersion:    12,
    ModuleMethod: "0500",
    Version:      "84",
}

const privateKey = "e7cfd179d6537a676cb94bac3b5c5c9cb1550e846ac4541040d077dfbac2e7fd"
const b = SignTx(tx, TxType.Transfer, privateKey)

License: MIT