Assets

Retrieves a list of all assets events associated with an account or a Contract Identifier.

getAccountAssets

This API endpoint retrieves a comprehensive list of asset events associated with a specific account or Contract Identifier, including asset transfers and mints. It is essential for tracking asset movements and changes in ownership within the Stacks blockchain.

Parameters

principal
Required
string

The account address or contract identifier whose asset events are to be retrieved.

initOverridesRequestInit

Optional overrides for the request initialization settings.

import { Configuration, AccountsApi } from '@stacks/blockchain-api-client';

const apiConfig = new Configuration({
  basePath: 'https://api.testnet.hiro.so',
});

const accountsApi = new AccountsApi(apiConfig);
const principal = 'ST000000000000000000002AMW42H';
// Retrieve all asset events for the specified account or contract identifier
const assets = await accountsApi.getAccountAssets({
  principal: principal,
});

UserSession

The Stacks authentication process enables secure user sign-in for web apps by generating and handling encrypted authentication requests. It involves setting up an app domain, configuring permissions, and creating a UserSession to manage user data.

Functions

isSignInPendingfunction

Determines if there is an incoming authentication response.

handlePendingSignInfunction

Processes the response and provides a userData object containing the user's identity, BNS username and profile information.

isUserSignedInfunction

Checks if the user is already authenticated.

loadUserDatafunction

Retrieves the user's profile data if the user is already authenticated.

encryptContentfunction

Encrypts user data for secure storage.

decryptContentfunction

Decrypts user data for secure storage.

const isPending = userSession.isSignInPending();

if (isPending) {
  userSession.handlePendingSignIn().then(userData => {
    // Do something with userData
  });
}

Last updated on