Fin Wallet
  • 🐳Fin Wallet For Sei
  • Product / Feature
    • Extension
    • Mobile App
  • User Guide
    • Basic
      • Mobile App
      • Extension
        • How to install Fin Wallet Extension
        • How to set up Fin Extension Wallet
        • How to add a new wallet
        • How to manage wallets
        • How to send or receive tokens
        • How to send or receive NFTs
        • How to add a custom token?
        • How to manage tokens
        • How to add view-only wallet
        • How to link Sei native with Sei EVM wallet address
        • General settings
    • FAQs
      • Balances Not Showing on My Wallet
      • I can't recover my wallet by using Seed Phrase.
      • What is the difference between Private Key and Seed Phrase?
      • Are there any service fees on Fin Wallet when I send tokens?
      • Where can I get Sei Testnet Token?
      • Can I change the wallet name?
      • How do I contact Fin Wallet for support?
  • Developer Guide
    • Dev Guide V1 - Sei DApps Integration
      • Keplr Override
        • Basic API
        • Use with CosmJs
        • Use with SecretJS
        • Suggest Chain
    • Dev Guide V2 - Sei DApps V2 Integration
  • Legal
    • Terms of Service
    • Privacy Policy
  • Official Links
    • Website
    • Twitter
    • Discord
    • Telegram
    • Blog
  • BRAND ASSETS
Powered by GitBook
On this page
  • How to detect Fin
  • Connecting with SecretJS
  1. Developer Guide
  2. Dev Guide V1 - Sei DApps Integration
  3. Keplr Override

Use with SecretJS

PreviousUse with CosmJsNextSuggest Chain

Last updated 2 years ago

How to detect Fin

Fin API may be undefined right after the webpage shown. Please check the How to detect Fin first before reading this section.

Connecting with SecretJS

SecretJS link: The basics of using SecretJS is similar to CosmJS. Refer to the section for more information.

One difference between CosmJS and SecretJS is that we recommend using Fin's EnigmaUtils. By using Fin's EnigmaUtils, you can use Fin to encrypt/decrypt, and the decrypted transaction messages are shown to the user in a human-readable format.

// Enabling before using the Fin 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);
**const enigmaUtils = window.getEnigmaUtils(chainId);**

// You can get the address/public keys by `getAccounts` method.
// It can return the array of address/public key.
// But, currently, Fin 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 Fin extension.
const cosmJS = new SigningCosmWasmClient(
    "https://lcd-secret.keplr.app/rest",
    accounts[0].address,
    offlineSigner,
    **enigmaUtils**
);

Suggest Adding SNIP-20 Tokens to Fin

async suggestToken(chainId: string, contractAddress: string): Promise<void>

The webpage can request the user permission to add a SNIP-20 token to Fin's token list. Will throw an error if the user rejects the request. If a SNIP-20 with the same contract address already exists, nothing will happen.

Get SNIP-20 Viewing Key

getSecret20ViewingKey(
    chainId: string,
    contractAddress: string
): Promise<string>;

Returns the viewing key of a SNIP-20 token registered in Fin. If the SNIP-20 of the contract address doesn't exist, it will throw an error.

Interaction Options

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

https://www.npmjs.com/package/secretjs (opens new window)
Use with CosmJs
this section