This document summarizes all JS APIs supported by the contract platform, including interface return values. For detailed interface specifications, refer to the relevant documentation.
Core APIs
- Environment Interfaces
Initialize blockchain instances and manage runtime configurations. - Account Interfaces
Handle account creation, balance transfers, key management, and authorization updates. - Contract Interfaces
Deploy, call, and upgrade smart contracts with custom logic. - Query Interfaces
Retrieve blockchain data including blocks, transactions, accounts, and contract states. - Local Execution Interfaces
Simulate transactions locally without on-chain execution. - Native Notarization Interfaces
Store immutable proofs of data directly on the blockchain. - Event Interfaces
Subscribe to real-time updates for accounts, contracts, blocks, and custom events. - Utility Interfaces
Helper methods for hash generation, data conversion, and account info retrieval.
Environment Interfaces
| Interface | Description |
|---|---|
Chain | Initializes a blockchain environment instance. |
๐ Learn how to optimize blockchain environments
Account Interfaces
| Interface | Description |
|---|---|
CreateAccount | Generates new blockchain accounts. |
TransferBalance | Executes token transfers between accounts. |
SetRecoverkey | Configures account recovery keys. |
Contract Interfaces
| Interface | Description |
|---|---|
contract | Constructs contract instances. |
new | Deploys contracts to the blockchain. |
update | Upgrades existing contract code. |
Query Interfaces
Retrieve critical blockchain data with these methods:
| Interface | Description |
|---|---|
QueryBlockHeader | Fetches block header details. |
QueryTransactionReceipt | Retrieves transaction execution receipts. |
Local Execution Interfaces
Test transactions offline before broadcasting:
| Interface | Description |
|---|---|
LocalTransaction | Simulates standard transactions. |
๐ Explore advanced local execution techniques
Native Notarization Interfaces
| Interface | Description |
|---|---|
NativeDepositData | Stores immutable data proofs on-chain. |
Event Interfaces
Subscribe to real-time blockchain events:
| Interface | Description |
|---|---|
event.account | Tracks account state changes. |
event.contract | Monitors contract interactions. |
Utility Interfaces
| Tool | Description |
|---|---|
getHash | Computes cryptographic hashes. |
toUtf8 | Converts hex to human-readable strings. |
Return Value Specifications
Standard Interface Returns
| Parameter | Type | Description |
|---|---|---|
err | string | Error message (if any). |
data | object | Transaction receipt details. |
Contract-Specific Returns
| Parameter | Type | Description |
|---|---|---|
output | varies | Contract bytecode or method result. |
FAQ
Q: How do I handle failed transactions?
A: Check the err field in returns and verify gas parameters before retrying.
Q: Can I test contracts before deployment?
A: Yes, use Local Execution Interfaces for dry-run testing.
Q: What's the cost of native notarization?
A: Fees vary by data size - estimate costs with local execution first.
Q: How frequently do events update?
A: Events trigger in real-time upon on-chain confirmation.
Q: Are there rate limits for API calls?
A: Public nodes may throttle requests; consider dedicated nodes for high volume.
Q: Where can I find complete code samples?
A: Visit our developer portal for SDK integration guides.