@injectivelabs/wallet-cosmos
TypeScript icon, indicating that this package has built-in type declarations

0.0.6 • Public • Published

🌟 Injective Protocol - Cosmos Wallet Strategy

downloads npm-version license

Package to use Cosmos Wallets on Injective via the wallet strategy.


📚 Installation

yarn add @injectivelabs/wallet-cosmos

📖 Documentation

Injective's wallet packages are intended to make it easy for developers to choose exactly what wallets - and subsequent dependencies - they want to include in their projects.

Regardless of which wallet package(s) you choose to use you must also have @injectivelabs/wallet-core and @injectivelabs/wallet-base installed. These contain all of the types and core wallet functionality, with the separate wallet packages only providing the necessary dependencies and implementations for their specific wallets.

Here's a brief example of how to use this package to send 1 INJ.:

import { Wallet } from '@injectivelabs/wallet-base';
import { BaseWalletStrategy, MsgBroadcaster } from '@injectivelabs/wallet-core';
import { CosmosWalletStrategy } from '@injectivelabs/wallet-cosmos';


const strategyArgs: WalletStrategyArguments = {
  chainId: ChainId.Mainnet,
  wallet: Wallet.Keplr,
  strategies: {
    [Wallet.Keplr]: new CosmosWalletStrategy({
      chainId: ChainId.Mainnet
    }),
  },
}
const walletStrategy = new BaseWalletStrategy(strategyArgs)

const msgBroadcaster = new MsgBroadcaster({
  walletStrategy,
  simulateTx: true,
  network: Network.Mainnet,
})

const sendTX = async () => {
    const injectiveAddress = 'someInjectiveAddress'

    const message = MsgSend.fromJSON({
      srcInjectiveAddress: injectiveAddress,
      dstInjectiveAddress: injectiveAddress,
      amount: {
        amount: '1',
        denom: 'inj',
      },
    })

    return await msgBroadcaster.broadcast({ msgs: message })
  }

  const result = await sendTX()

Read more and find example usages on our WalletStrategy Docs


📜 Contribution

Contribution guides and practices will be available once there is a stable foundation of the whole package set within the injective-ts repo.


⛑ Support

Reach out to us at one of the following places!


🔓 License

Copyright © 2021 - 2022 Injective Labs Inc. (https://injectivelabs.org/)

Originally released by Injective Labs Inc. under:
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

 

Powering the future of decentralized finance.

Readme

Keywords

none

Package Sidebar

Install

npm i @injectivelabs/wallet-cosmos

Weekly Downloads

172

Version

0.0.6

License

Apache-2.0

Unpacked Size

108 kB

Total Files

29

Last publish

Collaborators

  • ivan-angelkoski
  • nicolasbaum
  • dbrajovic
  • danidomi
  • proofofze
  • shanemoore
  • mmeloni
  • hmoragrega
  • thomasralee
  • albertchon
  • bangjelkoski
  • markuswaas