Griptape.js
  • What is Griptape.js?
  • 🛹Getting Started
  • 🚀Bootstrapping Your App
  • 🗞️Interacting with Contracts
    • Contract Definitions
      • More on Definitions
    • Creating Contract Clients
    • Built-In Definitions
    • Extending Contract Definitions
    • Contract Registry
    • Instantiating Contracts
  • 🔑Using Viewing Keys and Permits
    • Using the viewing key manager
    • Using Keplr with Griptape
    • Managing Permits
  • 🕢Handling Events
  • ⚒️Using Utilities
  • 🔀API Reference
    • Bootstrap
    • Contracts
    • Viewing Keys
    • Permits
    • Events
    • Utilities
  • 🐝Tricks Tutorials
    • React Tutorials
      • Hello, Griptape
      • Hello, Contracts
      • Hello, Events
      • Hello, Viewing Keys
      • Hello, Permits
      • Hello, Transactions
      • Hello, Mint
    • Vue Tutorials
      • Hello, Griptape
      • Hello, Contracts
      • Hello, Events
      • Hello, Viewing Keys
      • Hello, Permits
      • Hello, Transactions
      • Hello, Mint
  • 💾Hackathon
    • Welcome Packet
    • Getting Set Up
    • Glossary
Powered by GitBook
On this page
  1. Using Viewing Keys and Permits

Using Keplr with Griptape

Griptape works along with Keplr to provide a way to get and store SNIP-20 viewing keys previously created using the keplr.suggestToken function. To do so, you will need to use the keplrViewingKeyManager

import { keplrViewingKeyManager } from '@stakeordie/griptape.js';

const contract = ...
await keplrViewingKeyManager.add(contract);

The example above will call the keplr.suggestToken in case there is no viewing key available for that contract in Keplr and then stores it on Griptape. In case there is already a viewing key, it will just store it directly on Griptape.

keplrViewingKeyManager has the same API as the viewingKeyManager and therefore you can get the viewing key or set it:

const key = keplrViewingKeyManager.get(contract.at);

keplrViewingKeyManager.set(contract.at);

Is important to mention that the set method of the keplrViewingKeyManager does not updates the viewing key that is hold by Keplr.

PreviousUsing the viewing key managerNextManaging Permits

Last updated 3 years ago

🔑