Skip to main content
Version: Next


PryzmJs is a JavaScript software development kit (SDK) that enables the development of applications that interact with the Pryzm blockchain from both Node.js and web browsers. It offers straightforward abstractions over fundamental data structures and serialization, simplifying the process of building applications that utilize the Pryzm blockchain.


pnpm install @pryzm-finance/pryzmjs


gRPC-web Clients

Import the pryzm object from @pryzm-finance/pryzmjs.

import { pryzm } from '@pryzm-finance/pryzmjs';

const client = await pryzm.ClientFactory.createGrpcWebClient({endpoint: GRPC_ENDPOINT});

// now you can query the pryzm modules
const params = await client.pryzm.amm.v1.params();

// you can also query the cosmos modules
const balance = await{ address: 'pryzm1addresshere' });

Import the alliance object from @pryzm-finance/pryzmjs/lib/alliance.

import { alliance } from "@pryzm-finance/pryzmjs/lib/alliance"

const client = await alliance.ClientFactory.createGrpcWebClient({ endpoint: GRPC_ENDPOINT })

// now you can query the alliance module
const params = await client.alliance.params()

LCD Clients

import { pryzm } from '@pryzm-finance/pryzmjs';

const client = await pryzm.ClientFactory.createLCDClient({restEndpoint: LCD_ENDPOINT})

// now you can query the pryzm modules
const params = await client.pryzm.amm.v1.params();

// you can also query the cosmos modules
const balance = await{ address: 'pryzm1addresshere' });
import { alliance } from "@pryzm-finance/pryzmjs/lib/alliance"

const client = await alliance.ClientFactory.createLCDClient({restEndpoint: LCD_ENDPOINT})

// now you can query the alliance module
const params = await client.alliance.params()


import { pryzmatics } from "@pryzm-finance/pryzmjs";

const pryzmaticsClient = await pryzmatics.ClientFactory.createClient({restEndpoint: PRISMATICS_ENDPOINT})

const syncInfo = (await pryzmaticsClient.pryzmatics.syncInfo()).sync_info

Composing Messages

import { pryzm } from '@pryzm-finance/pryzmjs';

// sample messages from refactor module
const {
} = pryzm.refractor.v1.MessageComposer.withTypeUrl

// sample messages from amm module
const {
} = pryzm.amm.v1.MessageComposer.withTypeUrl
import { alliance } from "@pryzm-finance/pryzmjs/lib/alliance"

// sample messages from alliance module
const {
} = alliance.MessageComposer.withTypeUrl

Example Project

example is a sample project that depends on @pryzm-finance/pryzmjs and contains example on how to query data or sign and send messages.

Connecting with Wallets and Signing Messages

⚡️ For web interfaces, we recommend using cosmos-kit. Continue below to see how to manually construct signers and clients.

Here are the docs on creating signers in cosmos-kit that can be used with Keplr and other wallets.

Initializing the Stargate Client

Use getSigningPryzmClient to get your SigningStargateClient, with the proto/amino messages full-loaded. No need to manually add amino types, just require and initialize the client:

import { getSigningPryzmClient } from '@pryzm-finance/pryzmjs';

const stargateClient = await getSigningPryzmClient({
signer // OfflineSigner

Creating Signers

To broadcast messages, you can create signers with a variety of options:

Amino Signer

Likely you'll want to use the Amino, so unless you need proto, you should use this one:

import { getOfflineSignerAmino as getOfflineSigner } from 'cosmjs-utils';

Proto Signer

import { getOfflineSignerProto as getOfflineSigner } from 'cosmjs-utils';

WARNING: NOT RECOMMENDED TO USE PLAIN-TEXT MNEMONICS. Please take care of your security and use best practices such as AES encryption and/or methods from 12factor applications.

import { chains } from 'chain-registry';

const mnemonic = 'unfold client turtle either pilot stock floor glow toward bullet car science';
const chain = chains.find(({ chain_name }) => chain_name === 'pryzm');
const signer = await getOfflineSigner({

Broadcasting Messages

Now that you have your stargateClient, you can broadcast messages:

import { pryzm } from '@pryzm-finance/pryzmjs';

const { refract } = pryzm.refractor.v1.MessageComposer.withTypeUrl

const msg = refract({
creator: "signer",
maturity: "31Jan2025",
amount: {
amount: "10",
denom: "c:luna"

const fee: StdFee = {
amount: [
denom: 'coin',
amount: '864'
gas: '86364'
const response = await stargateClient.signAndBroadcast(address, [msg], fee);

Advanced Usage

If you want to manually construct a stargate client

import { OfflineSigner, GeneratedType, Registry } from "@cosmjs/proto-signing";
import { AminoTypes, SigningStargateClient } from "@cosmjs/stargate";

import {
} from '@pryzm-finance/pryzmjs';

const signer: OfflineSigner = /* create your signer (see above) */
const rpcEndpint = '<>'; // or another URL

const protoRegistry: ReadonlyArray<[string, GeneratedType]> = [

const aminoConverters = {

const registry = new Registry(protoRegistry);
const aminoTypes = new AminoTypes(aminoConverters);

const stargateClient = await SigningStargateClient.connectWithSigner(rpcEndpoint, signer, {


When first cloning the repo:

pnpm install


Contract schemas live in ./contracts, and protos in ./proto. Look inside of scripts/codegen.js and configure the settings for bundling your SDK and contracts into @pryzm-finance/pryzmjs:

pnpm codegen


Build the types and then publish:

pnpm compile
pnpm publish


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

Code built with the help of these related projects: