Transaction

The APIs related to executing transactions consist of three components:

The necessary APIs can be executed sequentially depending on the situation

  • Generating a signature only: Retrieve Transaction Information ⇒ Sign Transaction

  • Generating a signature and broadcasting: Retrieve Transaction Information ⇒ Sign Transaction ⇒ Broadcast Transaction

Retrieve Transaction Information

Retrieve information such as the required transaction fee.

POST /v1/tx/prepare HTTP/1.1
Host: sdk.wepin.io
X-API-KEY: ${APP_KEY}
X-API-DOMAIN: {APP_DOMAIN}
X-SDK-TYPE: {platform}_rest_api
Content-Type: application/json
Authorization: Bearer ${access_token}

Request

Parameter

Name
Type
Description
Required

userId

String

O

accountId

String

Account ID to send from /v1/account response value.

O

contract

String

Contract address of the token to be sent when sending tokens.

X

to

String

Recipient address

O

isNft

String

ERC1155 | ERC721 Define NFT scheme type when transferring FT.

X

tokenId

Number String

NFT token ID when isNft is set and transferring an NFT.

X

amount

String

Amount of coin or token to send when transferring FT.

X

Response

Success Response

Name
Type
Description

balance

String

The current balance of the account to be transferred.

decimals

String

The decimals of the coin in the account to be transferred.

symbol

String

The symbol of the coin in the account to be transferred.

tokenId

Number

If the account to be transferred is a token account, the tokenId.

detail

TxData(Object)

The data required for the transaction. The TxData format differs depending on the type of account.

Sign Transaction

The actual signing is performed using the data obtained through Retrieve Transaction Information. If necessary, the fee value in TxData can be modified before signing. Before signing, the user's wallet PIN must be obtained using the PIN Pad Library, and the UVD must be sent together.

POST /v1/tx/sign HTTP/1.1
Host: sdk.wepin.io
X-API-KEY: ${APP_KEY}
X-API-DOMAIN: {APP_DOMAIN}
X-SDK-TYPE: {platform}_rest_api
Content-Type: application/json
Authorization: Bearer ${access_token}

Request

Parameter

Name
Type
Description
Required

userId

String

O

type

String

Types of Signatures •transaction (transaction) | msg_sign (Personal sign) | sign_data (typed data) • The configuration of txData differs depending on the type. •msg_sign | sign_data currently supports only EVM transactions.

O

pin

UVD

User's UVD

O

walletId

String

User Wallet ID

O

accountId

String

O

tokenId

String

tokenId for token transfers.

X

isNft

String

ERC1155 | ERC721

X

contract

String

Contract address for token transfers.

X

txData

TxData(Object)

O

otpCode

Object

OTP authentication information.

X

Response

Success Response

Name
Type
Description

signatureResult

Object

Sign result value. Structure varies by transmission network.

transaction

Object

Transmission details.

Broadcast Transaction

Sends the signed transaction.

POST /v1/tx/broadcast HTTP/1.1
Host: sdk.wepin.io
X-API-KEY: ${APP_KEY}
X-API-DOMAIN: {APP_DOMAIN}
X-SDK-TYPE: {platform}_rest_api
Content-Type: application/json
Authorization: Bearer ${access_token}

Request

Parameter

Name
Type
Description
Required

userId

String

O

type

String

Types of Signatures • transaction (transaction) | msg_sign (Personal sign) | sign_data (typed dat • The configuration of txData varies depending on the type. • msg_sign | sign_data currently supports only EVM transactions.

O

pin

UVD

User's UVD

O

walletId

String

User Wallet ID

O

accountId

String

O

tokenId

String

tokenId for token transfers.

X

contract

String

Contract address for token transfers.

X

isNft

String

ERC1155 | ERC721

X

signatureResult

String | Object

For broadcasting already signed data: Use the data received after signing (/tx/sign) without modification.

X

txData

TxData(Object)

X

otpCode

Object

OTP authentication information.

X

Response

Success Response

Name
Type
Description

signatureResult

Object

Sign result value. The structure varies slightly depending on the transmission network.

transaction

Object

Transmission details.

broadcastData

String

Data sent to the network.

txid

String

Transaction ID

Last updated