Skip to content
🎉 Welcome to the new Aptos Docs! Click here to submit feedback!
BuildGuidesWallet Integration Guide

Wallet Integration Guide

This describes how to integrate Aptos and Aptos assets into a wallet. It provides generic information for tracking balances, transferring assets, and testing the integration.

Wallet Creation

Supported Key types

Key Derivation

Private Keys Exporting

Wallet Importing

Hardware Support

Transactions

Gas Estimation

Signing Transactions

Submitting Transactions

Waiting on Transactions

Displaying Previous Transactions

Wallet Adapter (connecting to dapps)

Follow these guides to integrate your wallet with Aptos dapps:

Assets

Below are the different types of standards of assets on the Aptos blockchain, and how to handle them.

Fungible Tokens

These are tokens that are interchangeable with each other. They are often used for cryptocurrencies.

Coins

Listing owned Coins

Aptos provides in the Aptos TypeScript SDK a function to list all coins and fungible assets owned by an account.

import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const aptos = new Aptos(new AptosConfig(Network.Devnet));
 
await aptos.getCurrentFungibleAssetBalances({ownerAddress: "0x1"}); // List of tokens owned by 0x1

Displaying

Transfers

Fungible Assets

These are fungible assets that can be used interchangeably with each other. They replace the coin standard and are used for currencies such as USDt and USDC.

Listing owned Assets

Displaying

Transfers

Non-Fungible Tokens (NFTs or Digital Assets)

These are tokens that are unique and not interchangeable with each other. They are often used for digital collectibles, art, and other unique assets.

Digital Assets Standard

The Digital Assets standard replaced the Legacy Token standard for new NFTs. It is the standard for all new NFTs created on the Aptos blockchain.

Listing owned Digital Assets

Aptos provides in the Aptos TypeScript SDK a function to list all NFTs combined between types. This is useful for wallets to display all NFTs in a single list.

import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const aptos = new Aptos(new AptosConfig(Network.Devnet));
 
await aptos.getOwnedDigitalAssets({ownerAddress: "0x1"}); // List of tokens owned by 0x1

See more details on the TypeScript docs

Displaying Digital Assets

The token URL is the primary way to display the digital asset in a wallet. The URL can either be a URL pointing to a JSON file containing an image field, or a URL pointing to an image, mp4, or other media file.

Note that the URL can be either an HTTP or an IPFS URL. IPFS URLs are recommended for IPFS-hosted content, rather than using the HTTP gateway URL.

Example metadata JSON:

{
  "name": "Aptomingo #847",
  "description": "1212 flamingos on the Aptos blockchain striving for a stronger and more educated ecosystem. The first of hopefully many interesting experiments conducted by B.FLY LABS.",
  "image": "ipfs://bafybeidlvhvnnnl3zznatgio6gvd3xsss5uszc7fuwzsqn2ttzknosnxly/847.png",
  "attributes": [
    {
      "trait_type": "Background",
      "value": "Azure"
    }
  ]
}

Transferring Digital Assets

Digital Asset transfers are simple. In order to transfer a digital asset, you need to know the address of the asset (also known as the token_id), and the address of the receiver.

To transfer a digital, call 0x1::object::transfer with the token_id and the receiver address. The TypeScript SDK provides a function to transfer a digital asset

import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
const aptos = new Aptos(new AptosConfig(Network.Devnet));
const sender = Account.fromPrivateKey("private key");
const rawTxn = await aptos.transferDigitalAssetTransactions({sender, digitalAssetAddress: "0x1213456", recipient: "0x111111111"}); // List of tokens owned by 0x1
// ...

Legacy Token Standard

The Legacy Token standard only applies to NFTs created before the Digital Assets Standard was introduced. It is rarely used on new collections, and likely will not apply much to your wallet. However, it is still supported for backwards compatibility.

Tokens are referred to by the tuple of:

  • creator - the address of the account that created the collection
  • collection - the name of the collection
  • name - the name of the token within the collection

Tokens are uniquely named and cannot be duplicated within a collection.

Additionally, there is a property_version field that keeps track of which version to transfer of the token. You should always transfer the latest version of the token.

For more information about the standard see: Legacy Token Standard.

Listing owned Legacy Tokens

See Listing owned Digital Assets for how to list owned tokens.

Displaying Legacy Tokens

See Displaying Digital Assets for how to display tokens.

Transferring Legacy Tokens

Transfers of Legacy Tokens are controlled, meaning that users must opt in for receiving tokens from other users. This is a security feature to prevent spam.

In order to opt in, call the 0x4::token::opt_in_direct_transfer entry function to opt in to receiving tokens from any sender.

Then to send a token to a user who has opted in, call the 0x4::token::direct_transfer_script entry function to send to the receiver.

Offering / Claiming Legacy Tokens

If the receiver does not opt in, the sender can offer the token to the receiver. The receiver can then accept the token, which will opt them in to receiving the token.

To offer, call the 0x4::token_transfers::offer_script entry function for the token.

To claim, call the 0x4::token_transfers::claim_script entry function for the token.

To cancel an offer, call 0x4::token_transfers::cancel_offer_script entry function for the token.