# Smart Account

### sa\_getSmartAccount <a href="#sa_getsmartaccount" id="sa_getsmartaccount"></a>

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 <a href="#parameter" id="parameter"></a>

| Name    | Type   | Description |
| ------- | ------ | ----------- |
| address | String | Address     |

#### Return Value <a href="#parameter" id="parameter"></a>

| Name         | Type   | Description              |
| ------------ | ------ | ------------------------ |
| smartAccount | String | Smart account of address |

#### Example

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

### sa\_getUserOpReceipt <a href="#sa_getuseropreceipt" id="sa_getuseropreceipt"></a>

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

#### Parameters <a href="#parameter" id="parameter"></a>

| Name       | Type   | Description         |
| ---------- | ------ | ------------------- |
| userOpHash | String | User operation hash |

#### Return Value <a href="#parameter" id="parameter"></a>

| Name            | Type       | Description                                     |
| --------------- | ---------- | ----------------------------------------------- |
| 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          |            | <p>Transaction status value</p><p>See below</p> |
| transactionHash | String     | Transaction hash                                |

#### Transaction status value

| Code | Description |
| ---- | ----------- |
| 0x1  | Success     |
| 0x0  | Fail        |

#### Example

```json
{
  "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.

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

### sa\_erc20\_transfer <a href="#sa_erc20_transfer" id="sa_erc20_transfer"></a>

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 <a href="#parameter" id="parameter"></a>

| Name            | Type       | Description                                                                                                                                |
| --------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| contractAddress | String     | Token contract address                                                                                                                     |
| owner           | String     | Owner address of smart account                                                                                                             |
| sender          | String     | <p>Sender address</p><p>(Must be a smart account)</p>                                                                                      |
| 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 <a href="#parameter" id="parameter"></a>

| Name       | Type   | Description         |
| ---------- | ------ | ------------------- |
| userOpHash | String | User Operation Hash |

#### Example

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