eosjs 文档(JSON-RPC)
文章目录
JSON-RPC
类
JsonRpc
函数
arrayToHex
函数
arrayToHex
arrayToHex(data: Uint8Array): string
参数:
| 名称 | 类型 |
|---|---|
| data | Uint8Array |
返回:string
JsonRpc
实现接口
- AuthorityProvider
- AbiProvider
构造函数
new JsonRpc(endpoint: string, args?: object): JsonRpc
参数:
endpoint:stringDefault value args:object
-
fetch:- 浏览器:保留
null或undefined - node:提供实现
- 浏览器:保留
| 名称 | 类型 |
|---|---|
| (可选的)fetch | function |
返回:JsonRpc
属性
endpoint
- endpoint:
string
fetchBuiltin
- fetchBuiltin:
function
类型声明
(input?: Request | string, init?: RequestInit): Promise<Response>
参数:
| 名称 | 类型 |
|---|---|
| (可选的)input |
Request | string
|
| (可选的)init | RequestInit |
返回:Promise<Response>
方法
db_size_get
db_size_get(): Promise<any>
原始调用/v1/db_size/get
返回:Promise<any>
fetch
fetch(path: string, body: any): Promise<any>
发布body到endpoint + path,在可用时在RpcError中抛出详细的错误信息。
参数:
| 名称 | 类型 |
|---|---|
| path | string |
| body | any |
返回:Promise<any>
getRawAbi
getRawAbi(accountName: string): Promise<BinaryAbi>
调用/v1/chain/get_raw_code_and_abi并提取不需要的原始wasm代码。
参数:
| 名称 | 类型 |
|---|---|
| accountName | string |
返回:Promise<BinaryAbi>
getRequiredKeys
getRequiredKeys(args: AuthorityProviderArgs): Promise<string[]>
获取满足transaction权限所需的availableKeys子集,实现AuthorityProvider。
参数:
| 名称 | 类型 |
|---|---|
| args | AuthorityProviderArgs |
返回:Promise<string[]>
get_abi
get_abi(account_name: string): Promise<GetAbiResult>
原始调用/v1/chain/get_abi
参数:
| 名称 | 类型 |
|---|---|
| account_name | string |
返回:Promise<GetAbiResult>
get_account
get_account(account_name: string): Promise<any>
原始调用/v1/chain/get_account
参数:
| 名称 | 类型 |
|---|---|
| account_name | string |
返回:Promise<any>
get_block
get_block(block_num_or_id: number | string): Promise<GetBlockResult>
原始调用/v1/chain/get_block
参数:
| 名称 | 类型 |
|---|---|
| block_num_or_id |
number | string
|
返回:Promise<GetBlockResult>
get_block_header_state
get_block_header_state(block_num_or_id: number | string): Promise<any>
原始调用/v1/chain/get_block_header_state
参数:
| 名称 | 类型 |
|---|---|
| block_num_or_id |
number | string
|
返回:Promise<any>
get_code
get_code(account_name: string): Promise<GetCodeResult>
原始调用/v1/chain/get_code
参数:
| 名称 | 类型 |
|---|---|
| account_name | string |
返回:Promise<GetCodeResult>
get_currency_balance
get_currency_balance(code: string, account: string, symbol?: string): Promise<any>
原始调用/v1/chain/get_currency_balance
参数:
| 名称 | 类型 | 默认值 |
|---|---|---|
| code | string |
- |
| account | string |
- |
Default value symbol |
string |
null |
返回:Promise<any>
get_currency_stats
get_currency_stats(code: string, symbol: string): Promise<any>
原始调用/v1/chain/get_currency_stats
参数:
| 名称 | 类型 |
|---|---|
| code | string |
| symbol | string |
返回:Promise<any>
get_info
get_info(): Promise<GetInfoResult>
原始调用/v1/chain/get_info
返回:Promise<GetInfoResult>
get_producer_schedule
get_producer_schedule(): Promise<any>
原始调用/v1/chain/get_producer_schedule
返回:Promise<any>
get_producers
get_producers(json?: boolean, lower_bound?: string, limit?: number): Promise<any>
原始调用/v1/chain/get_producers
参数:
| 名称 | 类型 | 默认值 |
|---|---|---|
Default value json |
boolean |
true |
Default value lower_bound |
string |
"" |
Default value limit |
number |
50 |
返回:Promise<any>
get_raw_code_and_abi
get_raw_code_and_abi(account_name: string): Promise<GetRawCodeAndAbiResult>
原始调用/v1/chain/get_raw_code_and_abi
参数:
| 名称 | 类型 |
|---|---|
| account_name | string |
返回:Promise<GetRawCodeAndAbiResult>
get_table_rows
get_table_rows(__namedParameters: object): Promise<any>
原始调用/v1/chain/get_table_rows
参数:
__namedParameters:object
| 名称 | 类型 | 默认值 |
|---|---|---|
| code | any |
- |
| index_position | any |
1 |
| json | any |
true |
| key_type | any |
"" |
| limit | any |
10 |
| lower_bound | any |
"" |
| scope | any |
- |
| table | any |
- |
| table_key | any |
"" |
| upper_bound | any |
"" |
返回:Promise<any>
history_get_actions
history_get_actions(account_name: string, pos?: number, offset?: number): Promise<any>
原始调用/v1/history/get_actions
参数:
| 名称 | 类型 | 默认值 |
|---|---|---|
| account_name | string |
- |
Default value pos |
number |
null |
Default value offset |
number |
null |
返回:Promise<any>
history_get_controlled_accounts
history_get_controlled_accounts(controlling_account: string): Promise<any>
原始调用/v1/history/get_controlled_accounts
参数:
| 名称 | 类型 |
|---|---|
| controlling_account | string |
返回:Promise<any>
history_get_key_accounts
history_get_key_accounts(public_key: string): Promise<any>
原始调用/v1/history/get_key_accounts
参数:
| 名称 | 类型 |
|---|---|
| public_key | string |
返回:Promise<any>
history_get_transaction
history_get_transaction(id: string, block_num_hint?: number): Promise<any>
原始调用/v1/history/get_transaction
参数:
| 名称 | 类型 | 默认值 |
|---|---|---|
| id | Uint8Array |
- |
Default value block_num_hint |
number |
null |
返回:Promise<any>
push_transaction
push_transaction(__namedParameters: object): Promise<any>
推送序列化交易。
参数:
__namedParameters:object
| 名称 | 类型 |
|---|---|
| serializedTransaction | Uint8Array |
| signatures | string[] |
返回:Promise<any>

评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论