Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@initia/amino-converter

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@initia/amino-converter

Amino types and proto registry for initia chains

  • 0.1.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

@initia/amino-converter

Amino types and proto registry for initia chains


Installation

npm install @initia/amino-converter

Included Types

  • Cosmos Types
  • Cosmwasm Types
  • Initia Types
  • Evm Types
  • Opinit Types

Usage

With Signing Stargate Client

import { SigningStargateClient } from '@cosmjs/stargate'
import { registry, aminoTypes } from '@initia/amino-converter'

const signingClient = await SigningStargateClient.connectWithSigner(
  '[RPC-URL]',
  signer, // Offline signer
  {
    registry,
    aminoTypes,
  }
)

Add Custom Types

import { Registry } from '@cosmjs/proto-signing'
import { AminoTypes, SigningStargateClient } from '@cosmjs/stargate'
import { protoRegistry, aminoConverters } from '@initia/amino-converter'

const registry = new Registry([...protoRegistry, ...customRegistry])

const aminoTypes = new AminoTypes({
  ...aminoConverters,
  ...customAminoConverters,
})

const signingClient = await SigningStargateClient.connectWithSigner(
  '[RPC-URL]',
  signer, // Offline signer
  {
    registry,
    aminoTypes,
  }
)

Generate Amino Converter With Custom Msg

If you need to use MsgExecuteMessages, MsgSubmitProposal and MsgSubmitTx with your custom messages, you need to register your custom messages to thier amino converter.

import { Registry } from '@cosmjs/proto-signing'
import { AminoTypes, SigningStargateClient } from '@cosmjs/stargate'
import {
  protoRegistry,
  aminoConverters,
  generateMsgExecuteMessagesAminoConverter,
  generateMsgSubmitProposalAminoConverter,
  generateMsgSubmitTxAminoConverter,
} from '@initia/amino-converter'

const registry = new Registry([...protoRegistry, ...customRegistry])

const msgExecuteMessagesAminoConverter =
  generateMsgExecuteMessagesAminoConverter(
    [...protoRegistry, ...customRegistry],
    {
      ...aminoConverters,
      ...customAminoConverters,
    }
  ) // register custom msg

const aminoTypes = new AminoTypes({
  ...aminoConverters,
  ...customAminoConverters,
  msgExecuteMessagesAminoConverter,
})

const signingClient = await SigningStargateClient.connectWithSigner(
  '[RPC-URL]',
  signer, // Offline signer
  {
    registry,
    aminoTypes,
  }
)

FAQs

Package last updated on 22 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc