Injective | TS & dApps Docs
DocumentationInjective TS
  • Overview
  • Getting Started
    • Technical Concepts
    • Application Concepts
      • Calculations
        • Min Price Tick Size
        • Min Quantity Tick Size
      • Networks
      • CosmJs Support
    • Assets
      • Creating Tokens
      • Denom Client (deprecated)
      • Injective Lists
    • Running examples
  • Wallets
    • Getting Started
    • Accounts
    • Wallet Connections
    • Wallet Strategy
    • Offchain (Arbitrary) Data
  • Querying
    • Getting Started
    • Chain
      • Auction
      • Auth
      • Bank
      • Distribution
      • Exchange
      • Governance
      • IBC
      • Mint
      • Insurance Funds
      • Oracle
      • Peggy
      • Permissions
      • Staking
      • Tendermint
      • Wasm
      • WasmX
      • Token Factory
    • Indexer
      • Account
      • Auction
      • Derivatives
      • Explorer
      • Insurance Funds
      • Markets
      • Leaderboard
      • Mito
      • Oracle
      • Portfolio
      • Spot
      • Web3Gw Transactions
      • Streaming
        • Account
        • Auction
        • Derivatives
        • Oracle
        • Portfolio
        • Spot
        • Explorer
    • Ethereum (GraphQL)
  • Transactions
    • Getting Started
    • Cosmos
      • Ledger through Keplr Wallet
    • Ethereum
      • Ethereum Ledger
    • MsgBroadcaster
    • Private Key
    • Web3 Gateway
  • Core Modules (& examples)
    • Getting Started
    • Auction
    • AuthZ
    • Bank
    • Distribution
    • Exchange
    • Feegrant
    • Governance
    • IBC
    • Insurance
    • Peggy
    • Permissions
    • Staking
    • Tokenfactory
    • Wasm
  • Smart Contracts
    • Cosmwasm
      • Injective Name Service
      • Neptune Service
      • CW20 to Bank & Market Order in One Transaction
  • Bridges
    • Getting Started
    • Ethereum
    • IBC
    • Wormhole
  • Building Dapps
    • Getting Started
    • Configuring Nuxt
    • Configuring React
    • dApps Examples
      • Smart Contract
      • DEX
      • Bridge
      • Simple HTML example with Webpack
Powered by GitBook
On this page
  • Wallet Strategy
  • Metamask
  • Keplr
  1. Wallets

Wallet Connections

PreviousAccountsNextWallet Strategy

Last updated 1 year ago

Injective supports both Ethereum and Cosmos native wallets. You can use popular wallets like Metamask, Ledger, Keplr, Leap, etc. to sign transactions on Injective.

Wallet Strategy

The recommended way to have support for all of these wallets out of the box is to use the abstraction we've built. This approach will enable your dApp users to connect and interact with different wallets.

Combining it with the abstraction allows you to sign transactions using one function call. This is what's being used on all products like Helix, Hub, Explorer, etc., and we strongly recommend using this approach in your dApp.

In case you still want to use some wallet natively (without the WalletStrategy class), we are going to provide examples of how to connect to a dApp built on Injective via Metamask and Keplr in this doc.

Metamask

Metamask is an Ethereum native wallet and can be used to connect and interact with your dApp built on Injective.

  • Get Injective addresses from Metamask


import { getInjectiveAddress } from '@injectivelabs/sdk-ts'

const getEthereum = () => {
  if (!window.ethereum) {
    throw new Error('Metamask extension not installed')
  }
  
  return window.ethereum
}

const ethereum = getEthereum()
const addresses = await ethereum.request({
  method: 'eth_requestAccounts',
}) /** these are evm addresses */

const injectiveAddresses = addresses.map(getInjectiveAddress)
console.log(injectiveAddresses)
  • Sign transactions using Metamask

Keplr

Keplr is an Cosmos native wallet and can be used to connect and interact with your dApp built on Injective.

  • Get Injective addresses from Keplr


import { getInjectiveAddress } from '@injectivelabs/sdk-ts'
import { ChainId } from '@injectivelabs/ts-types'

const getKeplr = () => {
  if (!window.keplr) {
    throw new Error('Keplr extension not installed')
  }
  
  return window.keplr
}

(async() => {
  const keplr = getKeplr()
  const chainId = ChainId.Mainnet
  await keplr.enable(chainId)
  const injectiveAddresses = await keplr.getOfflineSigner(chainId).getAccounts()

  console.log(injectiveAddresses)
})()
  • Sign transactions using Keplr

An example of how to prepare + sign + broadcast a transaction on Injective using Metamask can be found .

An example of how to prepare + sign + broadcast a transaction on Injective using Keplr can be found .

WalletStrategy
MsgBroadcaster
here
here