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
  • Create Withdrawal
  • CreateWithdrawal
  • IWithdrawalDto
  • IWithdrawalStatus
  • Fetch Withdrawals
  • FilterWithdrawalDto
  • FindWithdrawalsDto
  1. References
  2. Wallet

Withdrawal

With the PAKT SDK, users can create withdrawals, as well as fetch lists of withdrawal history. Withdrawals are executed from Chainsite wallets.

PreviousWalletNextTutorial

Last updated 11 months ago

Create Withdrawal

Execute a withdrawal, using the CreateWithdrawal payload model.

CreateWithdrawal

Field
Description
Type
Optional

coin

Currency of the value to be withdrawn

string

false

amount

Monetary worth to be withdrawn

number

false

address

Address to receive the value, the address is usually an external address not on the chainsite

string

false

password

The authenticated user password

string

false

twoFaCode

For users who have activated two-factor authentication.

string

true

Upon success, returns the IWithdrawalDto.

IWithdrawalDto

Field
Description
Type

_id

Identification for the withdrawal record

string

owner

User details of the authenticated user who executed the withdrawal. The user details are populated

string | IUser

txId

The transaction record of the withdrawal

string | ITransactionDto

chainTxId

The transaction hash of the withdrawal

string

coin

Currency of the value that is withdrawn

string

address

The address that received the value

string

amount

Monetary worth withdrawn

number

usdValue

USD Monetary equivalent withdrawan

number

usdRate

Exchange rate that was implemented for the withdrawal

number

status

Classification of the withdrawal

IWithdrawalStatus

IWithdrawalStatus

The IWithdrawalStatus details the different categories of placement of the withdrawal.

Field
Description

pending

Withdrawal is not yet in pipeline for execution

processing

Withdrawal is currently being executed

completed

Withdrawal execution is finished with success.

failed

Withdrawal execution is finished with an error or a result thats is rejected.

Here is an example of implementing the create withdrawal.

export const create = async ({ payload }: { payload: CreateWithdrawal }) => {
  const withdrawal: IWithdrawalDto = await sdkInit.withdraw.createWithdrawal(payload);
};

Fetch Withdrawals

The withdrawal history of an authenticated user can be retrieved and paginated.

Use the FilterWithdrawalDto to filter and paginate.

FilterWithdrawalDto

Field
Description
Optional

page

The page of list of withdrawals

true

limit

Number of withdrawal records to be retrieved

true

owner

The id of the authenticated user

false

This feature returns FindWithdrawalsDto, upon success.

FindWithdrawalsDto

Field
Description
Type

page

Notation of the list of record

number

pages

Total number of lists retrievable of withdrawals

number

total

Total withdrawal records

number

data

Array of the withdrawals records

Array

For example, implementing fetching withdrawals:

export const fetch = async ({ authToken, filter }: { authToken: string; filter: FilterWithdrawalDto }) => {
  const withdrawals: ResponseDto<FindWithdrawalsDto> = await sdkInit.withdraw.fetchWithdrawal(authToken, filter);
};
Create withdrawal
Fetch withdrawal history