Web SDK
  • Home
  • Overview
  • Getting started
  • References
    • Authentication
    • Account
      • Users
    • Notifications
    • Bookmark
    • 2FA
    • Collection
    • Connection filters
    • Feed
    • File Upload
    • Invite
    • Messaging
    • Payment
    • Reviews
    • Search
    • Verification
      • Supported document type
      • List of expected ISO countries
    • Wallet
      • Withdrawal
  • Tutorial
  • Web API
Powered by GitBook
On this page
  • Get exchange information
  • Get transactions
  • Get a transaction
  • Get transaction stats
  • Get aggregate transaction stats
  • Get all wallets
  • Get a single wallet details
  1. References

Wallet

With the Pakt SDK, Chainsite builders can establish user wallet features such as:

PreviousList of expected ISO countriesNextWithdrawal

Last updated 11 months ago

Get exchange information

With the PAKT SDK, users can fetch the prices of cryptocurrencies, at market prices. The authenticated user jwt token is required to execute this feature.

This feature returns the IWalletExchangeDto.

IWalletExchangeDto

Field
Description
Type

avax

The market price for the AVALANCHE cryptocurrency, $avax is returned

number

Here is an example depicting the call:

export const exchangeRate = async () => {
  const rate = await sdkInit.wallet.getExchange();
};

Get transactions

The PAKT SDK allows the retrieval of transaction records, paginated, for the authenticated user jwt token.

This call returns the FindTransactionsDto for a successful request.

FindTransactionsDto

Field
Description
Type

page

The current page, list of transaction records

number

pages

The total pages of transaction records

number

total

The complete number of transaction records for the authenticated user

number

limit

The total transaction records for the page. Defaults to 12.

number

transactions

The array list of transactions records with the model ITransactionDto

Array

ITransactionDto

The ITransactionDto is the model that contains a record detailing information about a transaction.

Field
Description
Type
Optional

_id

The identification for the transaction record.

string

false

owner

Details of the authenticated user that initiated the transaction. This field returns as a string or as the details of the user

string | WalletUser

false

amount

The measure of cryptocurrency that was enacted

number

false

sender

User details of the orginator of the tranasction. For withdrawals, this fields will not be returned

string

true

reciever

User details of the beneficiary of the transaction. For withdrawals, this fields will not be returned

string

true

currency

The medium, symbol of the transaction.

string

false

usdValue

The USD value of the transaction

number

false

description

Written account of the transaction

string

false

tx

Transaction block information

string

true

type

The categorization of the type of transaction

ITransactionType

false

hash

The transaction hash

string

false

method

The categorization of the method of transaction

ITransactionType

false

status

The status of the tranaction

ITransactionStatus

false

WalletUser

The user profile of the transaction.

Field
Description
Type

_id

The identification of the user

string

firstName

The firstName of the user

string

lastName

The lasttName of the user

string

type

Categorization of the user

recipient | creator

profile.talent.tags

Array of labels for the user

string[]

profile.talent.tagsIds

Array of tags information

Record<string, any>[]

profile.talent.availability

Identifier for the user accessibility

AWAY, OFFLINE, ONLINE

ITransactionType

The type of transaction helps to understand the description of the event that occurred.

Field
Description

sent

Value transferred from the initator to the beneficiary

deposit

Value moved into a user's wallet for an event

withdrawal

Value taken out of the user's wallet

recieved

Value transferred into the authenticated user's wallet

escrow

Value received into an escrow account to ensure transparency between actors.

job-payout

Value transferred to the recipient; a type of user, after the completion of a task or event

fee-payout

Value transferred to the designated chainsite wallet address in accordance with the chainsite settings or policy.

ITransactionStatus

status refers to the classification of the process of the transaction.

Field
Description

pending

Transaction is yet to be executed

processing

Transaction is in the pipeline and is being executed

completed

Transaction is concluded and is successful, with the receipt or hash available

failed

Transaction was executed and response returned with error

Here is an example detailing the implementation of getting transactions for an authenticated user.

export const getTransactions = async (authToken: string) => {
  const resp: ResponseDto<FindTransactionsDto> = await sdkInit.wallet.getTransactions(authToken);
  const transactions = resp.data;
};

Get a transaction

To get the transaction details of a transaction, the id, as well as the authenticated user jwt token, is required.

Upon successful response, returns the ITransactionDto object.

Here is an example:

export const getATransaction = async (id: string, authToken:string) => {
    const txn: ResponseDto<ITransactionDto> = await sdkInit.wallet.getATransaction(authToken, id);
};

Get transaction stats

With the SDK, an authenticated user can retrieve transaction statistics for an authenticated user, filterable with the following query.

Query
Description
Type

format

Format refers to the timeframe in which the statistics are provided. Formats are weekly, monthly and yearly as ITransactionStatsFormat.

ITransactionStatsFormat

This feature returns an array of ITransactionStatsDto.

ITransactionStatsFormat

Field
Description

weekly

Statistics are fetched over a 7-day period

monthly

Statistics are fetched over a 30-day period

yearly

Statistics are fetched over a 12-month period

ITransactionStatsDto

Field
Description
Type

_id

Identification for the stats

number

count

Value calculated

number

Get aggregate transaction stats

With the SDK, aggregate transaction statistics can be retrieved for transactions with status marked as completed.

This feature returns an array of AggTxns.

AggTxns

Field
Description

type

The type of transaction helps to understand the description of the event that occurred. See ITransactionType

string

amount

Value that was transferred

number

date

The timestamp for the transaction

string

Here is an example, implementing the feature

export const getAggregateTransactionStats = async (authToken: string) => {
  const aggregateStats: ResponseDto<AggTxns[]> = await sdkInit.wallet.getAggregateTransactionStats(authToken);
};

Models for Wallet & Transaction are typed like so:

Get all wallets

When an account is registered, wallets are auto-generated for cryptocurrencies supported. Currently, PAKT supports AVAX & Circle's USDC.

Wallets generated for an authenticated user can be retrieved.

This feature, upon success, returns an array of IWalletDto

IWalletDto

Field
Description
Type

_id

Identification of the wallet record

string

amount

Value held by the wallet

number

usdValue

USD worth held in the wallet

number

coin

The currency of the wallet

string

Here is an example function implementing how to get a list of wallets for an authenticated user.

export const getAllWallets = async (authToken: string) => {
  const wallets: ResponseDto<IWalletDto[]> = await sdkInit.wallet.getWallets(authToken);
};

Get a single wallet details

Get a single wallet details for an authenticated user.

The feature returns IWalletDto, upon success.

Here is an example function showcasing how to implement the function

export const getSingleWallet = async (authToken: string, coin: string) => {
  const wallet: ResponseDto<IWalletDto> = await sdkInit.wallet.getSingleWallet(authToken, coin);
};

Get exchange information
Get transactions
Get transaction stats
Get aggregate transaction stats
Get all wallets
Get a single wallet details