JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q20882F
  • License Apache-2.0

t3rn protocol's type definitions for use with polkadot.js clients

Package Exports

  • @t3rn/types

Readme

@t3rn/types

This package contains all the necessary types and RPC calls to interact with the t3rn protocol via the @polkadot/api client.

Usage

import "@t3rn/types"; // always import for @polkadot/api augmentations
import { createType } from "@t3rn/types"; // function for building typesafe types
import { T3rnTypesSfxSideEffect } from "@polkadot/types/lookup"; // import the specific type that was added via augmentation

let sfx: T3rnTypesSfxSideEffect = createType(
  "T3rnTypesSfxSideEffect",
  // The second parameter is automatically typesafe!
  {
    target: "roco",
    maxReward: 1000000,
    insurance: 100000,
    encodedAction: "tran",
    encodedArgs: ["0x0", "0x1"],
    signature: "",
    enforceExecutor: "",
    rewardAssetId: 1,
  }
);

In your project's tsconfig.json add the following compiler options:

 "compilerOptions": {
    "module": "esnext" /** Ensures tsc uses esmodules **/,
    "target": "ES2018" /** Use a recent target **/,
    "esModuleInterop": true ,
    "moduleResolution": "node",
    "skipLibCheck": true /** Important: skips type checking for external libraries  **/
  }

In your project's package.json add the following:

  "type": "module" /** Ensures this package is esm **/,
  "exports": {
    ".": "./index.js"  /** Define your exports **/
  },