Skip to content

Latest commit

 

History

History
72 lines (40 loc) · 3.7 KB

HOW-TO.md

File metadata and controls

72 lines (40 loc) · 3.7 KB

How-to

This document provides valuable information regarding OISY Wallet integration and features.

SNS Token Support

The SNS aggregator is used to pre-populate the list of available SNSes. This information is not fetched at runtime because it does not change frequently. Moreover, this approach is best suited for a smoother UI/UX experience.

Note: Some SNSes may not be enabled due to their related Index canister version being outdated and therefore not compatible with OISY Wallet. If you wish to use these, contact the related project to propose an upgrade to their canister.

See script ./script/buil.dsns.tokens.mjs for more details.

Custom ICRC Token Integration

OISY Wallet allows users to add custom ICRC tokens to their wallet. However, certain requirements must be met to ensure compatibility and security.

This chapter outlines the necessary steps and considerations for integrating a custom token into OISY Wallet.

Requirements

To add a custom token to OISY Wallet, users must provide both a Ledger and Index canister ID. The Ledger canister ID is straightforward, representing the ledger where the token transactions are recorded. However, the Index canister ID is also required because OISY Wallet does not index transactions and balances. Instead, OISY reads balance and transactions from an indexer, the Index canister.

Index Canister

Custom tokens seeking compatibility with OISY Wallet can choose one of the following options for the Index canister:

  1. Spin up an Index canister on mainnet using the index-ng WASM.

  2. Provide a custom canister that implements specific functions.

Index-ng

The source code of the Index-ng canister can be found in the Internet Computer main repository and can be downloaded using the following script:

#!/bin/bash

IC_COMMIT="43f31c0a1b0d9f9ecbc4e2e5f142c56c7d9b0c7b"

curl -sSL https://download.dfinity.systems/ic/$IC_COMMIT/canisters/ic-icrc1-index-ng.wasm.gz -o "$DIR"/ckbtc_index.wasm.gz
gunzip "$DIR"/ckbtc_index.wasm.gz

curl -sSL https://raw.githubusercontent.com/dfinity/ic/$IC_COMMIT/rs/ledger_suite/icrc1/index-ng/index-ng.did -o "$DIR"/ckbtc_index.did

Tips: You can follow this guide to deploy an ICRC-1 index canister locally.

Custom Canister

If opting for a custom canister, it must implement the following two endpoints: one to retrieve the related Ledger canister ID and one function to effectively provide the balance and transactions.

It's important to note that although both functions are queries, for security reasons, they are called with both query and update.

OISY uses the JavaScript library @dfinity/ledger-icrc to interact with the canister.

Ledger ID

This function is used to verify that the Index canister is indeed linked with the Ledger. It returns the principal of the Ledger associated with the Index canister.

ledger_id : () -> (principal) query;

Get balance and transactions

This function allows querying of balance and transactions for a specific account. OISY Wallet uses the principal provided by Internet Identity for the current account without a sub-account.

get_account_transactions : (GetAccountTransactionsArgs) -> (GetTransactionsResult) query;

Find more information in the Index-ng Candid file definition.