@t3rn/types
TypeScript icon, indicating that this package has built-in type declarations

0.1.12 • Public • Published

@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 **/
  },

Package Sidebar

Install

npm i @t3rn/types

Weekly Downloads

10

Version

0.1.12

License

Apache-2.0

Unpacked Size

2.89 MB

Total Files

67

Last publish

Collaborators

  • t3rn_dev
  • marcin_t3rn_io