0.8.0-alpha.5 • Published 9 months ago

stridejs v0.8.0-alpha.5

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

stridejs

install

npm install stridejs

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 getSigningStrideClientOptions:

import {
  getSigningStrideClientOptions,
  strideAccountParser,
} from "@stride/proto";

const { registry, aminoTypes } = getSigningStrideClientOptions();

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

Usage

We strongly recommend that you check the generated files in src/codegen/stride 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 { stride } from "stridejs";

const client = await stride.ClienFactory.createRPCQueryClient({
  rpcEndpoint: RPC_ENDPOINT,
});

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

Composing & Broadcasting Stride Messages

import { stride } from "stridejs";

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

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

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

assertIsDeliverTxSuccess(tx);

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

Composing IBC Messages

import { ibc } from "stridejs";

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
npm install

Codegen

Update the generated ts files:

npm run codegen

Build the module and types:

npm run buidl

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 our validator ⚛️

Code built with the help of these related projects:

0.8.0-alpha.5

9 months ago

0.8.0-alpha.2

10 months ago

0.8.0-alpha.1

10 months ago

0.8.0-alpha.4

9 months ago

0.7.0-alpha.1

11 months ago

0.8.0-alpha.3

9 months ago

0.6.2

1 year ago

0.4.4

1 year ago

0.5.0

1 year ago

0.6.1

1 year ago

0.4.3

1 year ago

0.6.0

1 year ago

0.3.0

1 year ago

0.4.1

1 year ago

0.4.0

1 year ago

0.4.2

1 year ago

0.2.0

2 years ago

0.1.0

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago