Api
abiAbi
transactionAbi
<Const>
abiAbiany
= require('../src/abi.abi.json')定义于eosjs-api.ts:12git
<Const>
transactionAbiany
= require('../src/transaction.abi.json')定义于eosjs-api.ts:14github
new Api(args: object): Api
定义于eosjs-api.ts:45json
args: object
segmentfault
rpc
:发出RPC调用authorityProvider
:获取在交易中知足权限所需的公钥abiProvider
:以原始形式供应ABI(二进制)signatureProvider
:签名交易chainId
:标识链textEncoder
:要使用的TextEncoder
实例,若是在浏览器中运行,则传入null
textDecoder
:要使用的TextDecoder
实例,若是在浏览器中运行,则传入null
名称 | 类型 |
---|---|
(可选的)abiProvider | AbiProvider |
(可选的)authorityProvider | AuthorityProvider |
(可选的)chainId | string |
rpc | JsonRpc |
signatureProvider | SignatureProvider |
(可选的)textDecoder | TextDecoder |
(可选的)textEncoder | TextEncoder |
返回:Api
api
AbiProvider
定义于eosjs-api.ts:24浏览器
以原始形式供应ABI(二进制)ide
Map<string, ser.Type>
定义于eosjs-api.ts:36函数
在二进制和结构化形式之间转换abi文件(abi.abi.json
)区块链
AuthorityProvider
定义于eosjs-api.ts:21ui
获取知足transaction
权限所需的availableKeys
子集
Map<string, CachedAbi> = new Map()
提取abi
string
标识链
Map<string, Contract> = new Map()
保存序列化合约操做所需的信息
JsonRpc
发出RPC调用
SignatureProvider
签名交易
TextDecoder
TextEncoder
Map<string, ser.Type>
在二进制和结构化形式之间转换交易(transaction.abi.json
)
deserialize(buffer: ser.SerialBuffer, type: string): any
将buffer
中的数据转换为结构化形式,type
必须是内置的abi类型或者在transaction.abi.json
中。
参数:
名称 | 类型 |
---|---|
buffer | ser.SerialBuffer |
type | string |
返回:any
deserializeActions(actions: ser.Action[]): Promise<ser.Action[]>
从十六进制转换操做
参数:
名称 | 类型 |
---|---|
actions | ser.Action[] |
返回:Promise<ser.Action[]>
deserializeTransaction(transaction: Uint8Array): any
从二进制转换交易,将操做保留为十六进制
参数:
名称 | 类型 |
---|---|
transaction | Uint8Array |
返回:any
deserializeTransactionWithActions(transaction: Uint8Array | string): Promise<any>
从二进制转换交易,同时反序列化操做
参数:
名称 | 类型 |
---|---|
transaction | Uint8Array | string |
返回:Promise<any>
getAbi(accountName: string, reload?: boolean): Promise<Abi>
以结构化形式获取abi,须要时提取
参数:
名称 | 类型 | 默认值 |
---|---|---|
accountName | string |
- |
Default value reload |
boolean |
false |
返回:Promise<Abi>
getCachedAbi(accountName: string, reload?: boolean): Promise<CachedAbi>
以二进制和结构化形式获取abi,须要时提取
参数:
名称 | 类型 | 默认值 |
---|---|---|
accountName | string |
- |
Default value reload |
boolean |
false |
返回:Promise<CachedAbi>
getContract(accountName: string, reload?: boolean): Promise<ser.Contract>
获取序列化合约中的操做所需的数据
参数:
名称 | 类型 | 默认值 |
---|---|---|
accountName | string |
- |
Default value reload |
boolean |
false |
返回:Promise<ser.Contract>
getTransactionAbis(transaction: any, reload?: boolean): Promise<BinaryAbi[]>
获取交易所需的abi
参数:
名称 | 类型 | 默认值 |
---|---|---|
transaction | any |
- |
Default value reload |
boolean |
false |
返回:Promise<BinaryAbi[]>
pushSignedTransaction(__namedParameters: object): Promise<any>
广播已签名的交易
__namedParameters:object
名称 | 类型 |
---|---|
serializedTransaction | Uint8Array |
signatures | string[] |
返回:Promise<any>
rawAbiToJson(rawAbi: Uint8Array): Abi
将abi做为Uint8Array
解码为json
参数:
名称 | 类型 |
---|---|
rawAbi | Uint8Array |
返回:Abi
serialize(buffer: ser.SerialBuffer, type: string, value: any): void
将value
转换为二进制形式,type
必须是内置的abi类型或者在transaction.abi.json
中。
参数:
名称 | 类型 |
---|---|
buffer | ser.SerialBuffer |
type | string |
value | any |
返回:void
serializeActions(actions: ser.Action[]): Promise<ser.SerializedAction[]>
将操做转换为十六进制
参数:
名称 | 类型 |
---|---|
actions | ser.Action[] |
返回:Promise<ser.SerializedAction[]>
serializeTransaction(transaction: any): Uint8Array
将交易转换为二进制
参数:
名称 | 类型 |
---|---|
transaction | any |
返回:Uint8Array
transact(transaction: any, __namedParameters?: object): Promise<any>
建立并可选择广播交易
命名参数:
broadcast
:广播此交易?sign
:签名此交易?blocksBehind
和expireSeconds
都存在,而后提取块头后面的blockBehind
块,将其用做TAPoS的引用,并在该块的时间expireSeconds
以后过时交易。参数:
transaction:any
Default value
__namedParameters:object
名称 | 类型 | 默认值 |
---|---|---|
blocksBehind | number |
- |
broadcast | boolean |
true |
expireSeconds | number |
- |
sign | boolean |
true |
返回:若是broadcast
,则Promise<any>
节点响应,若是!broadcast
则{signatures, serializedTransaction}
。