メインコンテンツへスキップ

Documentation Index

Fetch the complete documentation index at: https://injectivelabs-mintlify-jp-native-developers-first-half.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

InjectiveはEthereumとCosmosの両方のネイティブウォレットをサポートしています。Metamask、Ledger、Keplr、LeapなどのメジャーなウォレットでInjective上のトランザクションに署名できます。

Wallet Strategy

これらすべてのウォレットを統一的にサポートする推奨方法は、Injectiveが提供するWalletStrategy抽象化 を利用することです。このアプローチにより、dAppのユーザーはさまざまなウォレットに接続して操作できるようになります。 これをMsgBroadcaster抽象化と組み合わせることで、1回の関数呼び出しでトランザクションに署名できます。これは、Helix、Hub、Explorerなどのすべてのプロダクトで使用されている方式であり、dAppでもこのアプローチの使用を強く推奨します。 何らかのウォレットを(WalletStrategyクラスを介さずに)ネイティブに使用したい場合に備えて、本ドキュメントではMetamaskとKeplrを介してInjective上に構築されたdAppに接続する例を提供します。

Metamask

MetamaskはEthereumネイティブのウォレットであり、Injective上に構築されたdAppへの接続および操作に使用できます。
  • MetamaskからInjectiveアドレスを取得する
import { getInjectiveAddress } from "@injectivelabs/sdk-ts/utils";

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);
  • Metamaskを使用してトランザクションに署名する
Metamaskを使用してInjective上でトランザクションを準備・署名・ブロードキャストする方法の例はこちらを参照してください。

Keplr

KeplrはCosmosネイティブのウォレットであり、Injective上に構築されたdAppへの接続および操作に使用できます。
  • KeplrからInjectiveアドレスを取得する
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);
})();
  • Keplrを使用してトランザクションに署名する
Keplrを使用して、Injective上でトランザクションを準備・署名・ブロードキャストする方法の例については、Cosmosトランザクションを参照してください。
Last modified on May 14, 2026