0.7.4-alpha.5 • Published 2 months ago

trustlessjs v0.7.4-alpha.5

Weekly downloads
-
License
SEE LICENSE IN LI...
Repository
github
Last release
2 months ago

trustlessjs

install

npm install trustlessjs

Connecting with Wallets and Signing Messages

⚡️ For web interfaces, we recommend using cosmos-kit. To sign and broadcast messages, you can create signers with a variety of options:

Initializing the Stargate Client

We recommend manually making the SigningStargateClient instance yourself by using getTrstSigningClientOptions:

import { getTrstSigningClientOptions, trstAccountParser } from "@trustlessjs";

const { registry, aminoTypes } = getTrstSigningClientOptions();

const client = await SigningStargateClient.connectWithSigner(
  rpc,
  offlineSigner,
  {
    registry,
    aminoTypes,
    accountParser: trstAccountParser,
  }
);

Usage

We strongly recommend that you check the generated files in src/codegen/trst and use it as source of truth for which functions you could use.

The rest of our documentation will cover only the tip of the iceberg examples you can take ideas from.

RPC Client

import { trst } from "trustlessjs";

const client = await trst.ClientFactory.createRPCQueryClient({
  rpcEndpoint: RPC_ENDPOINT,
});

const balance = await client.cosmos.bank.v1beta1.allBalances({
  address: "trst1addresshere",
});

Composing & Broadcasting Trst Messages

import { trst } from "trustlessjs";

const msgClaimFreeAmount =
  trst.claim.MessageComposer.withTypeUrl.claimFreeAmount({
    user: "trst1addresshere",
  });

const fee = {
  amount: [
    {
      amount: "0",
      denom: "utrst",
    },
  ],
  gas: 250_000,
};

const tx = await trstAccount.client.signAndBroadcast(
  "trst1addresshere",
  [msgClaimFreeAmount],
  fee,
  ""
);

assertIsDeliverTxSuccess(tx);

If you're unfamiliar with Stargate, you can read their guide here.

Composing IBC Messages

import { ibc } from "trustlessjs";

const { transfer } =
  ibc.applications.transfer.v1.MessageComposer.withTypeUrl.transfer({
    // Redacted (check internal types for the message parameters)
  });

Developing & Publishing

When first cloning the repo:

git submodule update --init
telescope install
telescope transpile

Codegen

Update the generated ts files:

yarn codegen

Build the module and types:

yarn build

Publishing

If you haven't logged to npm cli, run:

npm login

Afterwards, update package.json version.

# Example: <version> = v0.4.1
git tag <version>
git push origin <version>
git push origin main
npm publish

Credits

🛠 Built by Cosmology — if you like our tools, please consider delegating to their validator ⚛️

Code built with the help of these related projects:

0.7.4-alpha.5

2 months ago

0.7.4-alpha.2

3 months ago

0.7.4-alpha.3

3 months ago

0.7.4-alpha.4

3 months ago

0.7.3-alpha.3

3 months ago

0.7.3-alpha.4

3 months ago

0.7.3-alpha.1

3 months ago

0.7.3-alpha.2

3 months ago

0.7.2-alpha.8

4 months ago

0.7.2-alpha.1

9 months ago

0.7.2-alpha.2

9 months ago

0.7.2-alpha.3

9 months ago

0.7.2-alpha.4

9 months ago

0.7.2-alpha.5

9 months ago

0.7.2-alpha.6

9 months ago

0.7.0-alpha.1

10 months ago

0.7.0-alpha.3

10 months ago

0.7.0-alpha.2

10 months ago

0.7.1-alpha.5

9 months ago

0.7.1-alpha.2

9 months ago

0.7.1-alpha.1

9 months ago

0.7.1-alpha.4

9 months ago

0.7.1-alpha.3

9 months ago

1.2.3-alpha.0

1 year ago

1.2.3-alpha.1

1 year ago

1.2.3-beta.1

1 year ago

1.2.3-beta.0

1 year ago

1.2.4-alpha.10

1 year ago

1.2.4-alpha.11

1 year ago

1.2.4-alpha.12

1 year ago

1.2.4-alpha.6

1 year ago

1.2.4-alpha.7

1 year ago

1.2.4-alpha.8

1 year ago

1.2.4-alpha.9

1 year ago

1.2.4-alpha.2

1 year ago

1.2.4-alpha.3

1 year ago

1.2.4-alpha.4

1 year ago

1.2.4-alpha.5

1 year ago

1.2.3-alpha.7

1 year ago

1.2.2-alpha.1

2 years ago

1.2.2-alpha.0

2 years ago

1.2.3-alpha.2

1 year ago

1.2.2-beta.0

2 years ago

1.2.3-alpha.3

1 year ago

1.2.3-alpha.4

1 year ago

1.2.3-alpha.5

1 year ago

1.2.3-alpha.6

1 year ago

1.2.2-alpha.6

2 years ago

1.2.2-alpha.3

2 years ago

1.2.2-alpha.2

2 years ago

1.2.2-alpha.5

2 years ago

1.2.2-alpha.4

2 years ago

1.2.0-alpha.8

2 years ago

1.2.0-alpha.6

2 years ago

1.2.0-alpha.5

2 years ago

1.2.0-alpha.4

2 years ago

1.2.0-alpha.16

2 years ago

1.2.0-alpha.14

2 years ago

1.2.0-alpha.13

2 years ago

1.2.0-alpha.11

2 years ago

1.2.0-alpha.10

2 years ago

1.2.0-alpha.9

2 years ago

1.2.0-alpha.7

2 years ago

0.17.7

2 years ago

0.17.6

2 years ago

0.17.5

2 years ago