xek-sdk
Version:
SDK for katana blockchain
102 lines (79 loc) • 2.71 kB
Markdown
## Properties
- `api` : uri of api server
## Constructor
- `new API(api)` : create new instance API
## Methods
- `getBlock(blockHeight)`
+ Parameters:
+ block: height of block
+ Returns:
+ Success:(Promise) block at height
+ Other: Error
- `getTransaction(txHash)`
+ Parameters:
+ txHash: hash of transaction.
+ Returns:
+ Success:(Promise) The transaction has transaction hash as input.
+ Other: Error
- `getAccountDetail(address)`
+ Parameters:
+ address: address of account (hex string, length = 40)
+ Returns:
+ Success: details of account has address as input.
+ Other: Error
- `getGetHistoryTransaction({address, page, limit = 10})`
+ Parameters
+ address: address want to get history
+ page: number of pages
+ limit: default is 10, amount of transactions will be returned in response.
+ Returns:
+ Success:(Promise) transactions of address.
+ Other: Error
- `getSequence(address)`
+ Parameters:
+ address: address of account wants to get sequence number.
+ Returns:
+ Success: (Promise) sequence of address.
+ Other: Error
- `getBalance(address)`
+ Parameters:
+ address: address of account wants to get balance.
+ Returns:
+ Success: (Promise) balance of address.
+ Other: Error
- `getPermission(address)`
+ Parameters:
+ address: address wants to get permission.
+ Returns:
+ Success: (Promise) permission of address.
+ Other: Error
- `getParams(method, body, headers, uri)` : static function
+ Parameters:
+ method: method of request( GET, POST, ...)
+ body: body of request
+ headers: header of request
+ uri: uri of request.
+ Returns:
+ Success: request as a JSON.
- `sendTransaction(tx)`
+ Parameters:
+ tx: transaction will be sent to blockchain network.
+ Returns:
+ Success: (Promise) transaction hash of transaction.
+ Other: Error
- `getTransactionFee()`
+ Parameters:
+ Returns:
+ Success: (Promise) fee and address of receiver.
+ Other: Error
- `requestAPI(endpoint, method, body, headers)`
+ Parameters:
+ endpoint: request will be sent to endpoint
+ method: method of request (GET, POST)
+ body: body of request
+ headers: headers of request
+ Returns:
+ Success: response of request
+ Other: Error
## Source code
- [code](#)