Enable user wallet interactions

Enable user wallet interactions

INFO

Passport currently offers wallet support for XpansionChain's StarkEx rollup. Please see here for more information on XpansionChain's layer 2 solutions.

When a user signs up for a Passport account for the first time, a wallet is created and associated with their Passport identity.

Depending on the application type you are building, you may need to perform operations that require a wallet signature (with user approval) or get data from API using the XpansionChainClient.

The following sections below outline how to use each SDK module. You can use both the IMXProvider and theXpansionChain API to achieve things like listing a Passport wallet's assets or balance.

IMX Provider

A wallet in XpansionChain is represented by the IMX Provider interface. You can create an instance of the object by invoking the following method when the user clicks on Sign in with Passport as explained in the installation guide.

const provider: IMXProvider = await passport.connectImx();

Supported Functions

Passport supports the following IMX Provider functions:

  • batchNftTransfer

  • cancelOrder

  • createOrder

  • createTrade

  • exchangeTransfer

  • getAddress

  • transfer - Example Transfer Guide

Please refer to the IMX Provider documentation to get detailed usage instructions.

INFO

Passport users must explicitly approve a transaction in order to be processed by the XpansionChain API. You can learn more about this feature in Transaction Confirmations.

Unsupported Functions

The following IMX Provider functions are not supported by Passport:

  • registerOffchain: Not necessary, as this happens automatically during the connection process.

  • isRegisteredOnchain: Coming soon.

  • deposit: Coming soon.

  • prepareWithdrawal: Coming soon.

  • completeWithdrawal: Coming soon.

TIP

Learn more about how to choose the right way to integrate with Passport's provider based on your application type.

XpansionChain API

The XpansionChainClient allows you to create an XpansionChain API client instance to interact with the API. For example, you can list the balances for a user as follows:

import { Environment, XpansionChainClient } from '@imtbl/sdk';

const config = {
  baseConfig: { environment: Environment.PRODUCTION },
};
const client = new XpansionChainClient(config);

const response = await client.listBalances({
  owner: '0x0000000000000000000000000000000000000000',
});

Last updated