Smart Account

sa_getSmartAccount

Get the smart account of address. Smart account has the same value in all networks. In other words, the smart account of the same address is the same in the Ether mainnet and the BSC mainnet.

Parameters

NameTypeDescription

address

String

Address

Return Value

NameTypeDescription

smartAccount

String

Smart account of address

Example

{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": { 
            "smartAccount": "0x79bbD96C7fd6bef0ED943ee42D8D350867d0D61E",
        }
    }
}

sa_getUserOpReceipt

Queries the results of user operation. Unlike regular transactions, user operation must call sc_getUserOpReceipt to check whether execution was successful.

Parameters

NameTypeDescription

userOpHash

String

User operation hash

Return Value

NameTypeDescription

userOpHash

String

User operation hash

success

String

“true” or “false”

actualGasCost

BigInteger

Gas cost used

actualGasUsed

BigInteger

Gas volume used

reason

String

Error details in case of failure

status

Transaction status value

See below

transactionHash

String

Transaction hash

Transaction status value

CodeDescription

0x1

Success

0x0

Fail

Example

{
  "resultCode":"200",
  "resultMessage":"success",
  "resultData":{
    "userOpHash":"0xdba638a19c23ee0f69fb9e8683528531211d1a9deb8c93402c9294b170080415",
    "success":"true",
    "actualGasCost":595091657654760,
    "actualGasUsed":169890,
    "reason":"",
    "status":"0x1",
    "transactionHash":"0xe822beb4b6700802df2b5bf459afa1bef5e53b83c47b75126c8b5e4450968675"
  }
}

If userOpHash is invalid or pending, the error below is returned.

{
  "resultCode":"532",
  "resultMessage":"USEROP_RECEIPT_NOT_FOUND",
  "resultData":""
}

sa_erc20_transfer

Create and submit an ERC20 token transfer transaction using user operation. The result is a user operation hash. You can check the success of the returned user operation hash through sc_getUserOpReceipt.

Because it is processed as a user operation, it is processed even if neither the owner nor the sender have a balance in the network's main coin (e.g. Ether, BNB) for gas fees. The gas fee will be paid on your behalf from your predefined payment master account.

Parameters

NameTypeDescription

contractAddress

String

Token contract address

owner

String

Owner address of smart account

sender

String

Sender address

(Must be a smart account)

toAddress

String

To address

amount

BigDecimal

Amount of transfer

gasPrice

BigDecimal

Gas price

tempKey

String

tempKey for “transfer”

hashKey

String

hash(tempKey | secretKey)

signature

String

sign ( hash ( contractAddress | owner | sender | toAddress | amount | tempKey | hashKey ) ) by owner’s privateKey using signData API

Return Value

NameTypeDescription

userOpHash

String

User Operation Hash

Example

{
  "resultCode":"200",
  "resultMessage":"success",
  "resultData":{
    "userOpHash":"0xdba638a19c23ee0f69fb9e8683528531211d1a9deb8c93402c9294b170080415"
  }
}

Last updated