This document introduces API operations supported by the contract platform and describes the responses of the operation calls. For more information about each operation, see relevant topics.
Environment operations
Name | Description |
Chain | You can call this operation to initialize an environment instance. |
Account operations
Name | Description |
CreateAccount | You can call this operation to create an account. |
TransferBalance | You can call this operation to perform a transfer. |
SetRecoverkey | You can call this operation to set a recovery key. |
PreResetPubKey | You can call this operation to pre-reset a public key. |
ResetPubKey | You can call this operation to reset a public key. |
UpdateAuthMap | You can call this operation to update the weight. |
Contract operations
Name | Description |
contract | You can call this operation to create a smart contract instance. |
new | You can call this operation to deploy a contract. |
Name of the user-defined contract method | You can call this operation to call a contract. |
update | You can call this operation to update a contract. |
Query operations
Local execution operations
Native deposit operations
Event operations
Name | Description |
event.account | You can call this operation to subscribe to an account event. |
accountEvent.close | You can call this operation to unsubscribe an account event. |
event.contract | You can call this operation to subscribe to a contract event. |
contractEvent.close | You can call this operation to unsubscribe a contract event. |
event.topic | You can call this operation to subscribe to a topic event. |
topicEvent.close | You can call this operation to unsubscribe a topic event. |
event.block | You can call this operation to subscribe to a block event. |
blockEvent.close | You can call this operation to unsubscribe a block event. |
Name | Description |
getHash | You can call the GetHash() function to return the hash for a string. |
toDecimal | You can call this operation to convert a hexadecimal string to a decimal string. |
toUtf8 | You can call this operation to convert a hexadecimal string to a UTF-8 string. |
getKeyInfo | You can call this operation to obtain the account information. |
decryptAESWithPassword | You can call this operation to decrypt the transaction method of the TEE-based blockchain. |
decryptTXWithAES | You can call this operation to decrypt the transaction method of the TEE-based blockchain. |
generateAESKey | For the blockchain based on TEE, the specified AES key is used with the specified transaction hash to generate a final AES key for the target transaction. |
Responses
Most operations in the JS SDK return results in the same callback mode. However, for contract-related operations, the results are returned differently.
- Response parameters of common operations
Name |
Type |
Description |
err |
string |
The account name that is used to create a new account. |
data |
object |
The receipt of the transaction. |
- Response parameters of contract-related operations
Name |
Type |
Description |
err |
string |
The error message. An undefined value indicates that no errors were found. |
output |
Unspecified |
In the case of deploying a contract, this field is the bytecode of the contract. If this field is called by the contract, the field type is the same as the return value type of the contract method. |
data |
object |
The receipt of the transaction. |
The content of the data
field varies with the operation. For more information, check the response of a specified operation.