@wgb5445/aptos-intent-npm 0.1.2 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,203 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Wrapper to decompile script in its serialized form and wrap it with wasm errors.
5
+ * @param {Uint8Array} script
6
+ * @returns {(MoveFunctionCall)[]}
7
+ */
8
+ export function generate_batched_call_payload_wasm(script: Uint8Array): (MoveFunctionCall)[];
9
+ /**
10
+ * How to consume the returned value coming from a previous `MoveFunctionCall`.
11
+ */
12
+ export enum ArgumentOperation {
13
+ /**
14
+ * Move the returned value to the next caller. This can be used for values that don't have
15
+ * `copy` ability.
16
+ */
17
+ Move = 0,
18
+ /**
19
+ * Copy the returned value and pass it to the next caller.
20
+ */
21
+ Copy = 1,
22
+ /**
23
+ * Borrow an immutable reference from a returned value and pass it to the next caller.
24
+ */
25
+ Borrow = 2,
26
+ /**
27
+ * Borrow a mutable reference from a returned value and pass it to the next caller.
28
+ */
29
+ BorrowMut = 3,
30
+ }
31
+ export interface AllocatedLocal {
32
+ op_type: ArgumentOperation;
33
+ is_parameter: boolean;
34
+ local_idx: number;
35
+ }
36
+
37
+ /**
38
+ * Arguments to the `MoveFunctionCall`.
39
+ */
40
+ // export type CallArgument = { Raw: number[] } | { Signer: number } | { PreviousResult: PreviousResult };
41
+
42
+ export class CallArgument {
43
+ free(): void;
44
+ /**
45
+ * @param {Uint8Array} bytes
46
+ * @returns {CallArgument}
47
+ */
48
+ static new_bytes(bytes: Uint8Array) : CallArgument;
49
+ /**
50
+ * @param {number} signer_idx
51
+ * @returns {CallArgument}
52
+ */
53
+ static new_signer(signer_idx: number) : CallArgument
54
+ /**
55
+ * @returns {CallArgument}
56
+ */
57
+ borrow(): CallArgument
58
+ /**
59
+ * @returns {CallArgument}
60
+ */
61
+ borrow_mut() :CallArgument
62
+ /**
63
+ * @returns {CallArgument}
64
+ */
65
+ copy() :CallArgument
66
+ }
67
+
68
+
69
+ export class AllocatedLocal {
70
+ free(): void;
71
+ }
72
+ export class BuilderCall {
73
+ free(): void;
74
+ }
75
+ export class IntoUnderlyingByteSource {
76
+ free(): void;
77
+ /**
78
+ * @param {any} controller
79
+ */
80
+ start(controller: any): void;
81
+ /**
82
+ * @param {any} controller
83
+ * @returns {Promise<any>}
84
+ */
85
+ pull(controller: any): Promise<any>;
86
+ cancel(): void;
87
+ readonly autoAllocateChunkSize: number;
88
+ readonly type: string;
89
+ }
90
+ export class IntoUnderlyingSink {
91
+ free(): void;
92
+ /**
93
+ * @param {any} chunk
94
+ * @returns {Promise<any>}
95
+ */
96
+ write(chunk: any): Promise<any>;
97
+ /**
98
+ * @returns {Promise<any>}
99
+ */
100
+ close(): Promise<any>;
101
+ /**
102
+ * @param {any} reason
103
+ * @returns {Promise<any>}
104
+ */
105
+ abort(reason: any): Promise<any>;
106
+ }
107
+ export class IntoUnderlyingSource {
108
+ free(): void;
109
+ /**
110
+ * @param {any} controller
111
+ * @returns {Promise<any>}
112
+ */
113
+ pull(controller: any): Promise<any>;
114
+ cancel(): void;
115
+ }
116
+ /**
117
+ * Calling a Move function.
118
+ *
119
+ * Similar to a public entry function call, but the arguments could specified as `CallArgument`,
120
+ * which can be a return value of a previous `MoveFunctionCall`.
121
+ */
122
+ export class MoveFunctionCall {
123
+ free(): void;
124
+ }
125
+ /**
126
+ * Raw options for [`pipeTo()`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/pipeTo).
127
+ */
128
+ export class PipeOptions {
129
+ free(): void;
130
+ readonly preventAbort: boolean;
131
+ readonly preventCancel: boolean;
132
+ readonly preventClose: boolean;
133
+ readonly signal: AbortSignal | undefined;
134
+ }
135
+ /**
136
+ * Representing a returned value from a previous list of `MoveFunctionCall`s.
137
+ */
138
+ export class PreviousResult {
139
+ free(): void;
140
+ }
141
+ export class QueuingStrategy {
142
+ free(): void;
143
+ readonly highWaterMark: number;
144
+ }
145
+ /**
146
+ * Raw options for [`getReader()`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/getReader).
147
+ */
148
+ export class ReadableStreamGetReaderOptions {
149
+ free(): void;
150
+ readonly mode: any;
151
+ }
152
+ export class TransactionComposer {
153
+ free(): void;
154
+ /**
155
+ * Create a builder with one distinct signer available. This should be the default configuration.
156
+ * @returns {TransactionComposer}
157
+ */
158
+ static single_signer(): TransactionComposer;
159
+ /**
160
+ * Create a builder with one signer needed for script. This would be needed for multi-agent
161
+ * transaction where multiple signers are present.
162
+ * @param {number} signer_count
163
+ * @returns {TransactionComposer}
164
+ */
165
+ static multi_signer(signer_count: number): TransactionComposer;
166
+ /**
167
+ * Consume the builder and generate a serialized script with calls in the builder.
168
+ * @param {boolean} with_metadata
169
+ * @returns {Uint8Array}
170
+ */
171
+ generate_batched_calls(with_metadata: boolean): Uint8Array;
172
+ /**
173
+ * Load up a module from a remote endpoint. Will need to invoke this function prior to the
174
+ * call.
175
+ * @param {string} api_url
176
+ * @param {string} module_name
177
+ * @returns {Promise<void>}
178
+ */
179
+ load_module(api_url: string, module_name: string): Promise<void>;
180
+ /**
181
+ * Load up the dependency modules of a TypeTag from a remote endpoint.
182
+ * @param {string} api_url
183
+ * @param {string} type_tag
184
+ * @returns {Promise<void>}
185
+ */
186
+ load_type_tag(api_url: string, type_tag: string): Promise<void>;
187
+ /**
188
+ * This would be the core api for the `TransactionComposer`. The function would:
189
+ * - add the function call to the builder
190
+ * - allocate the locals and parameters needed for this function call
191
+ * - return the arguments back to the caller which could be passed into subsequent calls
192
+ * into `add_batched_call`.
193
+ *
194
+ * This function would also check for the ability and type safety when passing values
195
+ * into the function call, and will abort if there's a violation.
196
+ * @param {string} module
197
+ * @param {string} _function
198
+ * @param {(string)[]} ty_args
199
+ * @param {(CallArgument)[]} args
200
+ * @returns {(CallArgument)[]}
201
+ */
202
+ add_batched_call(module: string, _function: string, ty_args: (string)[], args: (CallArgument)[]): (CallArgument)[];
203
+ }