1 |
|
2 |
|
3 |
|
4 | import { AbiProvider, ActionSerializerType, AuthorityProvider, BinaryAbi, CachedAbi, ContextFreeGroupCallback, Query, QueryConfig, SignatureProvider, TransactConfig, Transaction, TransactResult } from './eosjs-api-interfaces';
|
5 | import { JsonRpc } from './eosjs-jsonrpc';
|
6 | import { Abi, PushTransactionArgs, ReadOnlyTransactResult } from './eosjs-rpc-interfaces';
|
7 | import * as ser from './eosjs-serialize';
|
8 | export declare class Api {
|
9 |
|
10 | rpc: JsonRpc;
|
11 |
|
12 | authorityProvider: AuthorityProvider;
|
13 |
|
14 | abiProvider: AbiProvider;
|
15 |
|
16 | signatureProvider: SignatureProvider;
|
17 |
|
18 | chainId: string;
|
19 | textEncoder: TextEncoder;
|
20 | textDecoder: TextDecoder;
|
21 |
|
22 | abiTypes: Map<string, ser.Type>;
|
23 |
|
24 | transactionTypes: Map<string, ser.Type>;
|
25 |
|
26 | contracts: Map<string, ser.Contract>;
|
27 |
|
28 | cachedAbis: Map<string, CachedAbi>;
|
29 | |
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 | constructor(args: {
|
40 | rpc: JsonRpc;
|
41 | authorityProvider?: AuthorityProvider;
|
42 | abiProvider?: AbiProvider;
|
43 | signatureProvider: SignatureProvider;
|
44 | chainId?: string;
|
45 | textEncoder?: TextEncoder;
|
46 | textDecoder?: TextDecoder;
|
47 | });
|
48 | /** Decodes an abi as Uint8Array into json. */
|
49 | rawAbiToJson(rawAbi: Uint8Array): Abi;
|
50 | /** Encodes a json abi as Uint8Array. */
|
51 | jsonToRawAbi(jsonAbi: Abi): Uint8Array;
|
52 | /** Get abi in both binary and structured forms. Fetch when needed. */
|
53 | getCachedAbi(accountName: string, reload?: boolean): Promise<CachedAbi>;
|
54 | /** Get abi in structured form. Fetch when needed. */
|
55 | getAbi(accountName: string, reload?: boolean): Promise<Abi>;
|
56 | /** Get abis needed by a transaction */
|
57 | getTransactionAbis(transaction: Transaction, reload?: boolean): Promise<BinaryAbi[]>;
|
58 | /** Get data needed to serialize actions in a contract */
|
59 | getContract(accountName: string, reload?: boolean): Promise<ser.Contract>;
|
60 | /** Convert `value` to binary form. `type` must be a built-in abi type or in `transaction.abi.json`. */
|
61 | serialize(buffer: ser.SerialBuffer, type: string, value: any): void;
|
62 | /** Convert data in `buffer` to structured form. `type` must be a built-in abi type or in `transaction.abi.json`. */
|
63 | deserialize(buffer: ser.SerialBuffer, type: string): any;
|
64 | /** Convert a transaction to binary */
|
65 | serializeTransaction(transaction: Transaction): Uint8Array;
|
66 | /** Serialize context-free data */
|
67 | serializeContextFreeData(contextFreeData: Uint8Array[]): Uint8Array;
|
68 | /** Convert a transaction from binary. Leaves actions in hex. */
|
69 | deserializeTransaction(transaction: Uint8Array): Transaction;
|
70 | private transactionExtensions;
|
71 | serializeTransactionExtensions(transaction: Transaction): [number, string][];
|
72 | deserializeTransactionExtensions(data: [number, string][]): any[];
|
73 | deleteTransactionExtensionObjects(transaction: Transaction): Transaction;
|
74 | /** Convert actions to hex */
|
75 | serializeActions(actions: ser.Action[]): Promise<ser.SerializedAction[]>;
|
76 | /** Convert actions from hex */
|
77 | deserializeActions(actions: ser.Action[]): Promise<ser.Action[]>;
|
78 | /** Convert a transaction from binary. Also deserializes actions. */
|
79 | deserializeTransactionWithActions(transaction: Uint8Array | string): Promise<Transaction>;
|
80 | /** Deflate a serialized object */
|
81 | deflateSerializedArray(serializedArray: Uint8Array): Uint8Array;
|
82 | /** Inflate a compressed serialized object */
|
83 | inflateSerializedArray(compressedSerializedArray: Uint8Array): Uint8Array;
|
84 | /**
|
85 | * Create and optionally broadcast a transaction.
|
86 | *
|
87 | * Named Parameters:
|
88 | * `broadcast`: broadcast this transaction?
|
89 | * `sign`: sign this transaction?
|
90 | * `compression`: compress this transaction?
|
91 | * `readOnlyTrx`: read only transaction?
|
92 | * `returnFailureTraces`: return failure traces? (only available for read only transactions currently)
|
93 | *
|
94 | * If both `blocksBehind` and `expireSeconds` are present,
|
95 | * then fetch the block which is `blocksBehind` behind head block,
|
96 | * use it as a reference for TAPoS, and expire the transaction `expireSeconds` after that block's time.
|
97 | *
|
98 | * If both `useLastIrreversible` and `expireSeconds` are present,
|
99 | * then fetch the last irreversible block, use it as a reference for TAPoS,
|
100 | * and expire the transaction `expireSeconds` after that block's time.
|
101 | *
|
102 | * @returns node response if `broadcast`, `{signatures, serializedTransaction}` if `!broadcast`
|
103 | */
|
104 | transact(transaction: Transaction, { broadcast, sign, readOnlyTrx, returnFailureTraces, requiredKeys, compression, blocksBehind, useLastIrreversible, expireSeconds }?: TransactConfig): Promise<TransactResult | ReadOnlyTransactResult | PushTransactionArgs>;
|
105 | query(account: string, short: boolean, query: Query, { sign, requiredKeys, authorization }: QueryConfig): Promise<any>;
|
106 | /** Broadcast a signed transaction */
|
107 | pushSignedTransaction({ signatures, serializedTransaction, serializedContextFreeData }: PushTransactionArgs, readOnlyTrx?: boolean, returnFailureTraces?: boolean): Promise<TransactResult | ReadOnlyTransactResult>;
|
108 | pushCompressedSignedTransaction({ signatures, serializedTransaction, serializedContextFreeData }: PushTransactionArgs, readOnlyTrx?: boolean, returnFailureTraces?: boolean): Promise<TransactResult | ReadOnlyTransactResult>;
|
109 | private generateTapos;
|
110 | private hasRequiredTaposFields;
|
111 | private tryGetBlockHeaderState;
|
112 | private tryGetBlockInfo;
|
113 | private tryRefBlockFromGetInfo;
|
114 | with(accountName: string): ActionBuilder;
|
115 | buildTransaction(cb?: (tx: TransactionBuilder) => void): TransactionBuilder | void;
|
116 | }
|
117 | export declare class TransactionBuilder {
|
118 | private api;
|
119 | private actions;
|
120 | private contextFreeGroups;
|
121 | constructor(api: Api);
|
122 | with(accountName: string): ActionBuilder;
|
123 | associateContextFree(contextFreeGroup: ContextFreeGroupCallback): TransactionBuilder;
|
124 | send(config?: TransactConfig): Promise<PushTransactionArgs | ReadOnlyTransactResult | TransactResult>;
|
125 | }
|
126 | export declare class ActionBuilder {
|
127 | private api;
|
128 | private readonly accountName;
|
129 | serializedData: ser.SerializedAction;
|
130 | constructor(api: Api, accountName: string);
|
131 | as(actorName?: string | ser.Authorization[]): ActionSerializerType;
|
132 | }
|
133 |
|
\ | No newline at end of file |