Coin98
English
English
  • Coin98
  • Products
    • Coin98 AI Wallet
    • Coin98 Telegram Wallet
      • How to create a Coin98 Telegram Wallet
      • General Settings
      • How to invite friends on Coin98 Telegram Wallet
      • How to create/import a hot wallet on Coin98 Telegram Wallet
      • How to activate a wallet on Coin98 Telegram Wallet
      • How to manage blockchains on Coin98 Telegram Wallet
      • How to use Watch-only Wallet
      • How to retrieve Seed Phrase/Private key on Coin98 Telegram Wallet
      • How to buy cryptocurrency by fiat on Coin98 Telegram Wallet
      • How to Send a Token
      • How to Receive tokens
      • How to swap natively on Coin98 Telegram Wallet
      • How to contact Live Chat on the Coin98 Telegram Wallet
    • Coin98 Super Wallet
      • Mobile
        • Coin98 Super Wallet V15 UI Overview
        • Getting Started
          • How to download and install Coin98 Super Wallet
          • General Settings
          • How to automatically update Coin98 Super Wallet
          • How to manage notifications on Coin98 Super Wallet
          • How to create or import a Multichain Wallet to Coin98 Super Wallet
          • How to buy cryptocurrency by fiat on Coin98 Super Wallet?
          • How to add a contact on Coin98 Super Wallet
          • FAQs
            • What is the difference between Private Key and Seed phrase?
            • Do I have to backup every time my Wallet updates?
            • Does Coin98 Super Wallet hold my funds?
            • I can't find an answer to my question. Where do I find an answer?
        • Wallet Management
          • How to activate a wallet on Coin98 Super Wallet
          • How to show Seed Phrase / Private key
          • How to import Multi-chain wallets to Coin98 Super Wallet
          • How to switch a single-chain wallet to another chain wallet on Coin98 Super Wallet
          • How to use Seed Phrase Recover Tool
          • How to Refresh a Multichain Wallet
          • How to connect Hardware Wallet on Coin98 Super Wallet
          • How to use Watch-only Wallet
          • How to rename/remove Wallet
          • FAQ: Why did I recover a wallet but my balance shows 0 and the addresses are changed?
        • Social Wallet
          • How to upgrade a social wallet to Ramper Core V2 on Coin98 Super Wallet
          • How to create a Social Wallet
          • How to restore a Social Wallet
          • How to manage a Social Wallet
        • Zen Card Wallet
          • How to Create a Zen Card Wallet
          • How to Restore a Zen Card Wallet
          • Migrate Hot Wallets to Zen Card
          • How to Manage Zen Card
          • How to Setup and Manage a Profile for eCard
          • How to Redeem Zen Gift
          • How to Use Zen Card
          • FAQs
        • Asset Management
          • How to connect your account from an exchange platform to Coin98 Super Wallet
          • How to manage blockchains on Coin98 Super Wallet
          • How to add Custom Network on Coin98 Super Wallet
          • How to withdraw tokens from Binance to Coin98 Super Wallet
          • How to create a send request for someone
          • How to Send a Token
          • How to send a token to multiple addresses
          • How to add a Custom Token on Coin98 Super Wallet
          • How to Receive (Deposit) a Token
          • How to hide/unhide tokens on Coin98 Super Wallet
          • How to create a token using Token Issuer
          • How to create a portfolio on Coin98 Super Wallet
          • How to track portfolio on Coin98 Super Wallet
          • FAQs
            • Balances Not Loading or Showing on my wallet
            • Why can't I send USDT to other wallets?
        • NFTs
          • How to create a NFT using NFT Issuer
          • How to Receive (Deposit) an NFT
          • How to Send NFT
          • How to send multiple NFTs to an address
          • How to list an NFT on Marketplace
          • NFTverse
          • How to buy NFT in Coin98 Super Wallet
        • SwapX
          • How to swap tokens natively on SwapX
          • How to convert tokens on SwapX?
          • FAQs
            • Why did my transaction fail?
            • What is gas setting
            • Why did I have to pay gas fees for a failed transaction?
            • What is slippage tolerance
            • What is inverse rate
            • What is Unlimited approval?
            • What is Transaction Deadline
            • FAQs
        • Futures
          • How to use Futures on Coin98 Super Wallet
        • OneID
          • OneID Profile: Log in with OneID, Manage Profile and Get OneID Referral Link
          • How to link a wallet to a OneID on Coin98 Super Wallet
          • How to use OneID on Coin98 Super Wallet
          • How to perform KYC Verification on Coin98 Super Wallet
        • Stake Master
          • How to unstake Coin98 Staking V1
          • How to use Coin98 PowerPool on Coin98 Super Wallet
          • How to use Dynamic Rate Staking on Coin98 Super Wallet
        • Coin98 Messenger
          • How to change Messenger settings
          • How to start new conversation in Coin98 Messenger
          • How to create a request for someone to send their tokens
          • Cypheus Assistant Bot
          • How to set up a Lucky Gift
          • How to receive a Lucky Gift
          • How to set up a Quiz Gift
          • How to receive a Quiz Gift
          • How to contact Coin98 Live Support via Coin98 Messenger
        • Third party platforms and dApps
          • How to use multichain dApp browser on Coin98 Super Wallet
          • How to use Faucet on Coin98 Super Wallet
          • How to manage connections of the wallet
          • How to use Super Connect
        • Coin98 Vault
          • How to use Coin98 Vault on Coin98 Super Wallet
          • How to claim NFT on NFT Privileges
        • Security & Privacy
          • What to do when your wallet has been hacked?
          • How to use Cloud Backup on the Coin98 Super Wallet
          • How to revoke token allowances using Wallet Approval
          • How to use Clear Clipboard on Coin98 Super Wallet?
      • Extension
        • Getting Started
          • How to install Coin98 Extension
          • General Settings
          • How to update Coin98 Extension
          • How to create or import a Multichain Wallet to Coin98 Extension
          • How to buy cryptocurrency by fiat on Coin98 Extension?
          • Get Started with Coin98 Extension: Set a password and Create your new wallet
          • How to change your Coin98 Extension Password
        • Wallet Management
          • How to activate a wallet on Coin98 Extension
          • How to show Seed Phrase / Private key
          • How to switch a single-chain wallet to another chain wallet on Coin98 Extension
          • How to Refresh a Multichain Wallet
          • How to connect Hardware Wallet on Coin98 Extension
          • How to use Watch-only Wallet
          • How to rename/remove Wallet
        • Social Wallet
          • How to create a Social Wallet
          • How to restore a Social Wallet
        • Asset Management
          • How to manage blockchains on Coin98 Extension
          • How to add Custom Network on Coin98 Extension
          • How to Send a Token
          • How to send a token to multiple addresses
          • How to add a Custom Token on Coin98 Extension
          • How to Receive (Deposit) a Token
        • Swap
          • How to swap natively on Coin98 Extension
        • Bridge
          • How to convert tokens on Bridge?
        • Security & Privacy
          • How to use Cloud Backup on the Coin98 Extension
    • Zen Card
      • How to use Zen Card with Coin98 Super Wallet
      • Legal
        • PRIVACY POLICY
        • TERMS OF USE
      • FAQs
    • Coin98 Vault
      • How to claim Vault on Coin98 Super Wallet
      • How to claim Vault with Coin98 Extension
      • How to create Vault to distribute tokens
    • Coin98 Staking
      • How to stake C98 on Coin98 Super Wallet
      • How to stake C98 on Coin98 Staking website
      • Fixed Rate Staking
    • Coin98 Token
      • Why is the C98 token issued on Ethereum, BNB Chain, Solana, Polygon and Viction?
      • How can I get Coin98 (C98) Token?
      • Where to trade C98
      • Where can I store my C98
      • Can I get back the money when I sent C98 to the contract address?
      • How to convert C98 token on Coin98 Super Wallet
    • Coin98 Terminals
      • Token Issuer
        • How to use Token Issuer on Coin98 Super Wallet
        • How to use Token Issuer on Coin98 Extension
      • Multisender
        • How to use Multisend
    • Coin98 Markets
      • How to use Coin98 Markets
    • Single Chain Wallet
      • Ancient8 Wallet
        • How to migrate social wallet to V2
        • Terms of Service
        • Privacy Policy
        • Developer Guide
  • Audits
    • Coin98 Token
    • Coin98 Staking
    • Coin98 Vault
    • 🐞BUG BOUNTY
  • Developer Guide
    • Coin98 Adapter
      • Setup Coin98 Adapter for Next.js
      • Setup Coin98 Adapter for React
      • Hooks
        • useWallet
        • useWalletModal
      • Example
    • Coin98 Connect Integration
    • Bitcoin Dapps Integration
    • Ethereum DApps Integration
    • EthereumPoW DApps Integration
    • BNB Chain DApps Integration
    • Kucoin Chain DApps Integration
    • Solana DApps Integration
    • Near DApps Integration
    • Cosmos DApps Integration
      • Keplr Override
        • Basic API
        • Use with CosmJs
        • Use with SecretJS
        • Suggest Chain
    • Secret Network DApps Integration
      • Keplr Override
        • Basic API
        • Use with CosmJs
        • Use with SecretJS
        • Suggest Chain
    • KAVA DApps Integration
      • Keplr Override
        • Basic API
        • Use with CosmJs
        • Use with SecretJS
        • Suggest Chain
    • Persistence DApps Integration
      • Keplr Override
        • Basic API
        • Use with CosmJs
        • Use with SecretJS
        • Suggest Chain
    • Terra DApps Integration
      • Terra Station Override
    • Ronin DApps Integration
    • Arbitrum DApps Integration
    • Optimism DApps Integration
    • Boba Network DApps Integration
    • Harmony DApps Integration
    • Klaytn DApps Integration
    • Fantom DApps Integration
    • Celo DApps Integration
    • Gnosis Chain DApps Integration
    • GateChain DApps Integration
    • Polygon DApps Integration
    • Viction DApps Integration
    • Avalanche DApps Integration
    • OKExChain DApps Integration
    • Heco DApps Integration
    • Aurora DApps Integration
    • Cronos DApps Integration
    • Bittorrent DApps Integration
    • PlatON Network DApps Integration
    • Moonbeam DApps Integration
    • Kardia DApps Integration
    • Aptos Dapps Integration
    • Sui DApps Integration
    • Sei DApps Integration
      • Keplr Override
        • Basic API
        • Use with CosmJs
        • Use with SecretJS
        • Suggest Chain
    • Osmosis DApps Integration
      • Keplr Override
        • Basic API
        • Use with CosmJs
        • Use with SecretJS
        • Suggest Chain
    • Injective DApps Integration
      • Keplr Override
        • Basic API
        • Use with CosmJs
        • Use with SecretJS
        • Suggest Chain
    • Oasis network DApps Integration
    • Evmos DApps Integration
      • Keplr Override
        • Basic API
        • Use with CosmJs
        • Use with SecretJS
        • Suggest Chain
    • Juno network DApps Integration
      • Keplr Override
        • Basic API
        • Use with CosmJs
        • Use with SecretJS
        • Suggest Chain
    • Agoric DApps Integration
      • Keplr Override
        • Basic API
        • Use with CosmJs
        • Use with SecretJS
        • Suggest Chain
    • Archway (Testnet) DApps Integration
      • Keplr Override
        • Basic API
        • Use with CosmJs
        • Use with SecretJS
        • Suggest Chain
    • Stargaze DApps Integration
      • Keplr Override
        • Basic API
        • Use with CosmJs
        • Use with SecretJS
        • Suggest Chain
    • Umee DApps Integration
      • Keplr Override
        • Basic API
        • Use with CosmJs
        • Use with SecretJS
        • Suggest Chain
    • Stride DApps Integration
      • Keplr Override
        • Basic API
        • Use with CosmJs
        • Use with SecretJS
        • Suggest Chain
    • Deeplink
    • Kujira DApps Integration
      • Keplr Override
        • Basic API
        • Use with CosmJs
        • Use with SecretJS
        • Suggest Chain
    • Mantle DApps Integration
    • DApps Integration
      • EVM-compatible DApps Integration
    • Ethereum Coin98 Telegram Wallet SDK Bot Integration
      • Ethereum Coin98 Telegram Wallet SDK Bot Integration For React
      • Ethereum Coin98 Telegram Wallet SDK Bot Integration For Vanilla Javascript
  • Ton SDK Integration Guide For Partners
  • Legal
    • Coin98 Super Wallet
      • Terms of Service
      • Privacy Policy
    • Coin98 Telegram Game
      • Terms of Use
      • Privacy Policy
  • Coin98 Links and Communities
    • Official Coin98 Links
    • Official Communities
  • BRAND ASSETS & GUIDLINES
    • Brand Assets & Guidelines
Powered by GitBook
On this page
  • How to detect Coin98
  • Connecting with CosmJS
  • Types of Offline Signers
  • Use with Stargate
  1. Developer Guide
  2. Injective DApps Integration
  3. Keplr Override

Use with CosmJs

PreviousBasic APINextUse with SecretJS

Last updated 2 years ago

How to detect Coin98

Coin98 API may be undefined right after the webpage shown. Please check the first before reading this section.

Connecting with CosmJS

CosmJS link: ,

You can connect Coin98 to CosmJS using the OfflineSigner.

// Enabling before using the Coin98 is recommended.
// This method will ask the user whether or not to allow access if they haven't visited this website.
// Also, it will request user to unlock the wallet if the wallet is locked.
await window.keplr.enable(chainId);

const offlineSigner = window.getOfflineSigner(chainId);

// You can get the address/public keys by `getAccounts` method.
// It can return the array of address/public key.
// But, currently, Coin98 extension manages only one address/public key pair.
// XXX: This line is needed to set the sender address for SigningCosmosClient.
const accounts = await offlineSigner.getAccounts();

// Initialize the gaia api with the offline signer that is injected by Coin98 extension.
const cosmJS = new SigningCosmosClient(
    "https://lcd-cosmoshub.keplr.app/rest",
    accounts[0].address,
    offlineSigner,
);

To get the OfflineSigner, you may use keplr.getOfflineSigner(chainId) or window.getOfflineSigner(chainId). (window.getOfflineSigner is an alias that runs keplr.getOfflineSigner and returns the value)

The window.keplr.enable(chainId) method will request the user to unlock their Coin98 extension if it's locked. If the user has not given permission to connect their extension to the website, it will first ask to connect the website.

If the user cancels the unlock or rejects the permission to connect, an error will be thrown.

If the extension is already unlocked and the website has permission to connect, no action will happen and resolve.

window.keplr.enable(chainId) is not mandatory. Even if the method wasn't called, if an API that requests access to Coin98 is called the flow above will automatically run. However, it is recommended that window.keplr.enable(chainId) is first run.

Types of Offline Signers

In CosmJS, there are two types of Signers: OfflineSigner and OfflineDirectSigner. OfflineSigner is used to sign SignDoc serialized with Amino in Cosmos SDK Launchpad (Cosmos SDK v0.39.x or below). OfflineDirectSigner is used to sign Protobuf encoded SignDoc.

Coin98 supports both types of Signers. Coin98’s keplr.getOfflineSigner(chainId) or window.getOfflineSigner(chainId) returns a Signer that satisfies both the OfflineSigner and OfflineDirectSigner. Therefore, when using CosmJS with this Signer, Amino is used for Launchpad chains and Protobuf is used for Stargate chains.

However, if the msg to be sent is able to be serialized/deserialized using Amino codec you can use a signer for Amino. Also, as there are some limitations to protobuf type sign doc, there may be cases when Amino is necessary. For example, Protobuf formatted sign doc is currently not supported by Ledger Nano’s Cosmos app. Also, because protobuf sign doc is binary formatted, msgs not natively supported by Coin98 may not be human-readable.

If you’d like to enforce the use of Amino, you can use the following APIs: keplr.getOfflineSignerOnlyAmino(chainId) or window.getOfflineSignerOnlyAmino(chainId: string). Because this will always return an Amino compatible signer, any CosmJS requested msg that is Amino compatible will request an Amino SignDoc to Coin98.

Use with Stargate

Coin98's OfflineSigner implements the OfflineDirectSigner interface. Use SigningStargateClient with Coin98's OfflineSigner, and Coin98 will sign the transaction in Proto sign doc format.

Example

Interaction Options

Adding a custom blockchain to Coin98

Also, window.getOfflineSignerAuto(chainId: string): Promise<OfflineSigner | OfflineDirectSigner> or window.getOfflineSignerAuto(chainId: string): Promise<OfflineSigner | OfflineDirectSigner> API is supported. Please note that the value returned is async. This API automatically returns a signer that only supports Amino if the account is a Ledger-based account, and returns a signer that is compatible for both Amino and Protobuf if the account is a mnemonic/private key-based account. Because this API is affected by the type of the connected Coin98 account, if event is used to detect account changes the signer must be changed using the API when this event has been triggered.

Refer to the repository for example code on how to integrate Coin98 with CosmJS.

You can use Coin98 native API’s to set interaction options even when using CosmJS. Please refer to .

If Coin98 doesn't natively support your blockchain within the extension, please refer to the section.

How to detect Coin98
https://www.npmjs.com/package/@cosmjs/launchpad (opens new window)
https://www.npmjs.com/package/@cosmjs/stargate(opens new window)
keplr_keystorechange
keplr-example (opens new window)
this section
Suggest chain