ETransfer
  • About ETransfer
    • Introduction
    • Business process
      • Deposit process
      • Withdraw process
  • ⚒️SDK
    • SDK introduction
    • SDK change log
    • Get Started
      • 📥Installation
      • 📃Configuration
      • ⌨️Quick Start
      • 🔐Auth
      • 💰Deposit Digital Assets
      • 💰Withdraw Digital Assets
      • ⚒️UI SDK
        • Configuration
        • Deposit Component
        • Withdraw Component
        • History Component
        • Transfer Detail Component
        • ETransfer Content Component
  • Install portkey wallet
  • FAQ
  • Contact us
  • MORE INFORMATION
    • Terms of Service
    • Privacy Policy
Powered by GitBook
On this page
  • Introduction
  • How to use
  • Installation
  • Usage
  1. SDK
  2. Get Started

Withdraw Digital Assets

PreviousDeposit Digital AssetsNextUI SDK

Last updated 11 months ago

Introduction

Withdraw Digital Assets

Transfer assets from the aelf chain to other chains.

SDK - Withdraw Assets

Based on the token, network and other information selected by the user, generate TransactionRaw and submit it to the server to complete the creation of the withdrawal order.

How to use

Installation

npm install @etransfer/core
# OR
yarn add @etransfer/core

Usage

Get supported assets

Acquire the list of assets supported by ETransfer.You can find which assets are supported for withdrawal.

Example

import { eTransferCore } from '@etransfer/core';
import { BusinessType } from '@etransfer/types';

const result = await eTransferCore.services.getTokenList({
  type: BusinessType.Withdraw,
  chainId: 'AELF',
});

Http Headers

Header
Type
Required
Remarks

Authorization

string

true

The authorization token is the result returned by /connect/token.

Method Parameters

Field
Type
Required
Remarks

type

BusinessType

true

Business type: 'Deposit'

chainId

ChainId

true

'AELF' | 'tDVV'

Method return value

Field
Type
Remarks

tokenList

TTokenItem[]

Crypto array

TTokenItem type

Field
Type
Remarks

name

string

Crypto name

symbol

string

Crypto symbol

icon

string

Crypto logo url

contractAddress

string

ETransfer contract address

decimals

number

Crypto decimals

Get supported networks

Acquire the list of networks supported by ETransfer.You can find which networks are supported for withdrawal.You can get the basic information and the block confirmations of the network, etc.

Example

import { eTransferCore } from '@etransfer/core';
import { BusinessType } from '@etransfer/types';

const result = await eTransferCore.services.getNetworkList({
  type: BusinessType.Withdraw,
  chainId: 'AELF',
  symbol: 'USDT',
  address: '0x...',
});

Http Headers

Header
Type
Required
Remarks

Authorization

string

true

The authorization token is the result returned by /connect/token.

Method Parameters

Field
Type
Required
Remarks

type

BusinessType

true

Business type: 'Withdraw'

chainId

ChainId

true

'AELF' | 'tDVV'

symbol

string

false

Get data from eTransferCore.services.getTokenList

address

string

false

Withdrawal address. Please remove the prefix and suffix of the ELF-DID address.

Method return value

Field
Type
Remarks

network

string

Network

name

string

Network name

multiConfirm

string

Network block confirmations

multiConfirmTime

string

Network block confirmation time

contractAddress

string

Network contract address

explorerUrl

string

Network explorer address

status

NetworkStatus

Network health status 'Health' | 'Congesting' | 'Offline'

withdrawFee

string

Network withdrawal fee

withdrawFeeUnit

string

Network withdrawal fee unit

Get withdrawal information

Acquire the withdrawal information and transaction fee.

Please check the minimum withdrawal limit and remaining limit.

Example

import { eTransferCore } from '@etransfer/core';
import { PortkeyVersion } from '@etransfer/types';

const result = await eTransferCore.services.getWithdrawInfo({
  chainId: 'AELF',
  network: 'ETH',
  symbol: 'USDT',
  amount: '100',
  address: '0x...',
  version: PortkeyVersion.v2,
});

Http Headers

Header
Type
Required
Remarks

Authorization

string

true

The authorization token is the result returned by /connect/token.

Method Parameters

Field

Type

Required

Remarks

chainId

ChainId

true

'AELF' | 'tDVV'

network

string

false

Get data from eTransferCore.services.getNetworkList

symbol

string

false

Get data from eTransferCore.services.getTokenList

amount

string

false

Withdrawal amount, without decimals

address

string

false

Withdrawal address. Please remove the prefix and suffix of the ELF-DID address

version

PortkeyVersion

false

'v1' | 'v2'.

Recommend using 'v2'

Method return value

Field

Type

Remarks

amountUsd

string

Withdrawal amount in USD

maxAmount

string

Maximum withdrawal amount

minAmount

string

Minimum withdrawal amount

receiveAmount

string

Estimated amount to be received

receiveAmountUsd

string

Estimated USD received

limitCurrency

string

Withdrawal crypto

totalLimit

string

Total limit

remainingLimit

string

Remaining Limit

transactionFee

string

Transaction fee

transactionUnit

string

Transaction fee unit

aelfTransactionFee

string

Aelf transaction fee

aelfTransactionUnit

string

Aelf transaction fee unit

feeUsd

string

Total transaction fees in USD

expiredTimestamp

string

The expiration time of this response

Create a withdrawal order

There are two ways to create an order:

  • Create a withdrawal order, including additional business logic.

Before generating TransactionRaw, a series of transaction strategies such as balance judgment, allowance judgment, and approval are required, and finally TransactionRaw is generated and submitted to the ETransfer server.This method includes the above series of verification processes.

Example

import { eTransferCore } from '@etransfer/core';

const result = await eTransferCore.sendWithdrawOrder({
  tokenContractAddress: '',
  endPoint: 'https://xxx.xx',
  symbol: 'USDT',
  decimals: 6,
  amount: '100',
  toAddress: '0x...',
  caContractAddress: '',
  eTransferContractAddress: '',
  caHash: '',
  network: 'ETH',
  chainId: 'AELF',
  managerAddress: '',
  accountAddress: '',
  getSignature: async (ser: any) => {
    // Some code
  },
  tokenContractCallSendMethod: async (ser: any) => {
    // Some code
  },
});

Http Headers

Header
Type
Required
Remarks

Authorization

string

true

The authorization token is the result returned by /connect/token.

Method Parameters

Field
Type
Required
Remarks

tokenContractAddress

string

true

Token contract address

endPoint

string

true

End point url

symbol

string

true

Withdrawal crypto, Get data from eTransferCore.services.getTokenList

decimals

string | number

true

Withdrawal crypto decimals

amount

string

true

Withdrawal amount, without decimals

accountAddress

string

true

Aelf chain account address

eTransferContractAddress

string

true

ETransfer contract address

toAddress

string

true

Withdrawal address

caContractAddress

string

true

Aelf ca contract address

caHash

string

true

User 's ca hash

network

string

true

Withdrawal network, Get data from eTransferCore.services.getNetworkList

chainId

ChainId

true

'AELF' | 'tDVV'

managerAddress

string

true

User 's manager address

getSignature

TGetSignatureFunc

true

Get wallet signature method

tokenContractCallSendMethod

(params: CallContractParams<T>, sendOptions?: SendOptions): Promise<R & {transactionId: string;}> | undefined

true

Send token contract method

Method return value

Field
Type
Remarks

orderId

string

Order id

transactionId

string

Transaction id. You can use this transactionId to view transaction details in the browser.

  • Only create orders, no additional business logic required.

This method does not include a series of verification processes.

Example

import { eTransferCore } from '@etransfer/core';

const result = await eTransferCore.services.createWithdrawOrder({
  network: 'ETH',
  symbol: 'USDT',
  amount: '100',
  fromChainId: 'AELF',
  toAddress: 'withdrawal address',
  rawTransaction: 'transaction raw',
});

Http Headers

Header
Type
Required
Remarks

Authorization

string

true

The authorization token is the result returned by /connect/token.

Method Parameters

Field

Type

Required

Remarks

network

string

true

Get data from eTransferCore.services.getNetworkList

symbol

string

true

Get data from eTransferCore.services.getTokenList

amount

string

true

Withdrawal amount, without decimals

fromChainId

ChainId

true

'AELF' | 'tDVV'

toAddress

string

true

Withdrawal address. Please remove the prefix and suffix of the ELF-DID address

rawTransaction

string

true

Transaction raw

Method return value

Field

Type

Remarks

orderId

string

Order id

transactionId

string

Transaction id. You can use this transactionId to view transaction details in the browser.

First, init the ETransferCore instance. You can find it in .

First, init the ETransferCore instance. You can find it in .

How to acquire: .

How to acquire: .

How to acquire: .

How to acquire: .

How to acquire: .

⚒️
💰
ETransfer SDK Quick Start
📥Installation
ETransfer SDK Quick Start
ETransfer SDK Auth
ETransfer SDK Auth
ETransfer SDK Auth
ETransfer SDK Auth
ETransfer SDK Auth
Withdraw process