@vleap/warps-adapter-fastset 0.1.0-alpha.13 → 0.1.0-alpha.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.cts +363 -0
- package/dist/index.d.ts +120 -62
- package/dist/index.js +1057 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +525 -335
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -3
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
import { WarpChainAsset, AdapterFactory, AdapterWarpDataLoader, WarpClientConfig, WarpChainInfo, WarpChainAccount, WarpDataLoaderOptions, WarpChainAction, AdapterWarpExecutor, WarpExecutable, WarpActionInputType, AdapterWarpExplorer, AdapterWarpResults, Warp, WarpExecution, ResolvedInput, WarpExecutionResults, AdapterWarpSerializer, WarpSerializer, WarpNativeValue, BaseWarpActionInputType, WarpAdapterGenericType } from '@vleap/warps';
|
|
2
|
+
import * as _mysten_bcs from '@mysten/bcs';
|
|
3
|
+
|
|
4
|
+
declare const WarpFastsetConstants: {};
|
|
5
|
+
|
|
6
|
+
declare const NativeTokenSet: WarpChainAsset;
|
|
7
|
+
declare const getFastsetAdapter: AdapterFactory;
|
|
8
|
+
|
|
9
|
+
declare const Bytes32: _mysten_bcs.BcsType<number[], Iterable<number> & {
|
|
10
|
+
length: number;
|
|
11
|
+
}>;
|
|
12
|
+
declare const PublicKey: _mysten_bcs.BcsType<number[], Iterable<number> & {
|
|
13
|
+
length: number;
|
|
14
|
+
}>;
|
|
15
|
+
declare const Address: _mysten_bcs.BcsType<{
|
|
16
|
+
External: number[];
|
|
17
|
+
} | {
|
|
18
|
+
FastSet: number[];
|
|
19
|
+
}, {
|
|
20
|
+
External: Iterable<number> & {
|
|
21
|
+
length: number;
|
|
22
|
+
};
|
|
23
|
+
} | {
|
|
24
|
+
FastSet: Iterable<number> & {
|
|
25
|
+
length: number;
|
|
26
|
+
};
|
|
27
|
+
}>;
|
|
28
|
+
declare const Amount: _mysten_bcs.BcsType<string, unknown>;
|
|
29
|
+
declare const UserData: _mysten_bcs.BcsType<number[] | null, (Iterable<number> & {
|
|
30
|
+
length: number;
|
|
31
|
+
}) | null | undefined>;
|
|
32
|
+
declare const Nonce: _mysten_bcs.BcsType<string, string | number | bigint>;
|
|
33
|
+
declare const Transfer: _mysten_bcs.BcsType<{
|
|
34
|
+
recipient: {
|
|
35
|
+
External: number[];
|
|
36
|
+
} | {
|
|
37
|
+
FastSet: number[];
|
|
38
|
+
};
|
|
39
|
+
amount: string;
|
|
40
|
+
user_data: number[] | null;
|
|
41
|
+
}, {
|
|
42
|
+
recipient: {
|
|
43
|
+
External: Iterable<number> & {
|
|
44
|
+
length: number;
|
|
45
|
+
};
|
|
46
|
+
} | {
|
|
47
|
+
FastSet: Iterable<number> & {
|
|
48
|
+
length: number;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
amount: unknown;
|
|
52
|
+
user_data: (Iterable<number> & {
|
|
53
|
+
length: number;
|
|
54
|
+
}) | null | undefined;
|
|
55
|
+
}>;
|
|
56
|
+
declare const ClaimType: _mysten_bcs.BcsType<{
|
|
57
|
+
Transfer: {
|
|
58
|
+
recipient: {
|
|
59
|
+
External: number[];
|
|
60
|
+
} | {
|
|
61
|
+
FastSet: number[];
|
|
62
|
+
};
|
|
63
|
+
amount: string;
|
|
64
|
+
user_data: number[] | null;
|
|
65
|
+
};
|
|
66
|
+
}, {
|
|
67
|
+
Transfer: {
|
|
68
|
+
recipient: {
|
|
69
|
+
External: Iterable<number> & {
|
|
70
|
+
length: number;
|
|
71
|
+
};
|
|
72
|
+
} | {
|
|
73
|
+
FastSet: Iterable<number> & {
|
|
74
|
+
length: number;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
amount: unknown;
|
|
78
|
+
user_data: (Iterable<number> & {
|
|
79
|
+
length: number;
|
|
80
|
+
}) | null | undefined;
|
|
81
|
+
};
|
|
82
|
+
}>;
|
|
83
|
+
declare const BcsTransaction: _mysten_bcs.BcsType<{
|
|
84
|
+
sender: number[];
|
|
85
|
+
nonce: string;
|
|
86
|
+
timestamp_nanos: string;
|
|
87
|
+
claim: {
|
|
88
|
+
Transfer: {
|
|
89
|
+
recipient: {
|
|
90
|
+
External: number[];
|
|
91
|
+
} | {
|
|
92
|
+
FastSet: number[];
|
|
93
|
+
};
|
|
94
|
+
amount: string;
|
|
95
|
+
user_data: number[] | null;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
}, {
|
|
99
|
+
sender: Iterable<number> & {
|
|
100
|
+
length: number;
|
|
101
|
+
};
|
|
102
|
+
nonce: string | number | bigint;
|
|
103
|
+
timestamp_nanos: string | number | bigint;
|
|
104
|
+
claim: {
|
|
105
|
+
Transfer: {
|
|
106
|
+
recipient: {
|
|
107
|
+
External: Iterable<number> & {
|
|
108
|
+
length: number;
|
|
109
|
+
};
|
|
110
|
+
} | {
|
|
111
|
+
FastSet: Iterable<number> & {
|
|
112
|
+
length: number;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
amount: unknown;
|
|
116
|
+
user_data: (Iterable<number> & {
|
|
117
|
+
length: number;
|
|
118
|
+
}) | null | undefined;
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
}>;
|
|
122
|
+
interface FastsetTransaction {
|
|
123
|
+
sender: Uint8Array;
|
|
124
|
+
nonce: number;
|
|
125
|
+
timestamp_nanos: bigint;
|
|
126
|
+
claim: {
|
|
127
|
+
Transfer: {
|
|
128
|
+
recipient: {
|
|
129
|
+
FastSet: Uint8Array;
|
|
130
|
+
} | {
|
|
131
|
+
External: Uint8Array;
|
|
132
|
+
};
|
|
133
|
+
amount: string;
|
|
134
|
+
user_data: Uint8Array | null;
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
interface FastsetTransferRequest {
|
|
139
|
+
recipient: Uint8Array;
|
|
140
|
+
amount: string;
|
|
141
|
+
user_data?: Uint8Array;
|
|
142
|
+
}
|
|
143
|
+
interface FastsetAccountInfo {
|
|
144
|
+
balance: string;
|
|
145
|
+
next_nonce: number;
|
|
146
|
+
sequence_number: number;
|
|
147
|
+
}
|
|
148
|
+
interface FastsetSubmitTransactionRequest {
|
|
149
|
+
transaction: FastsetTransaction;
|
|
150
|
+
signature: Uint8Array;
|
|
151
|
+
}
|
|
152
|
+
interface FastsetSubmitTransactionResponse {
|
|
153
|
+
transaction_hash: Uint8Array;
|
|
154
|
+
validator: Uint8Array;
|
|
155
|
+
signature: Uint8Array;
|
|
156
|
+
}
|
|
157
|
+
interface FastsetSubmitCertificateRequest {
|
|
158
|
+
transaction: FastsetTransaction;
|
|
159
|
+
signature: Uint8Array;
|
|
160
|
+
validator_signatures: [Uint8Array, Uint8Array][];
|
|
161
|
+
}
|
|
162
|
+
interface FastsetFaucetRequest {
|
|
163
|
+
recipient: Uint8Array;
|
|
164
|
+
amount: string;
|
|
165
|
+
}
|
|
166
|
+
interface FastsetFaucetResponse {
|
|
167
|
+
balance: string;
|
|
168
|
+
}
|
|
169
|
+
interface FastsetJsonRpcRequest {
|
|
170
|
+
jsonrpc: '2.0';
|
|
171
|
+
id: number;
|
|
172
|
+
method: string;
|
|
173
|
+
params: Record<string, unknown>;
|
|
174
|
+
}
|
|
175
|
+
interface FastsetJsonRpcResponse<T = unknown> {
|
|
176
|
+
jsonrpc: '2.0';
|
|
177
|
+
id: number;
|
|
178
|
+
result?: T;
|
|
179
|
+
error?: {
|
|
180
|
+
code: number;
|
|
181
|
+
message: string;
|
|
182
|
+
data?: unknown;
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
interface ClaimData {
|
|
187
|
+
[key: string]: unknown;
|
|
188
|
+
}
|
|
189
|
+
declare abstract class Claim {
|
|
190
|
+
abstract readonly type: string;
|
|
191
|
+
abstract readonly data: ClaimData;
|
|
192
|
+
abstract toTransactionData(): unknown;
|
|
193
|
+
static fromTransaction(transaction: FastsetTransaction): Claim;
|
|
194
|
+
}
|
|
195
|
+
declare class TransferClaim extends Claim {
|
|
196
|
+
readonly type = "Transfer";
|
|
197
|
+
readonly data: {
|
|
198
|
+
recipient: Uint8Array;
|
|
199
|
+
amount: string;
|
|
200
|
+
userData?: Uint8Array;
|
|
201
|
+
};
|
|
202
|
+
constructor(recipient: Uint8Array, amount: string, userData?: Uint8Array);
|
|
203
|
+
toTransactionData(): unknown;
|
|
204
|
+
static fromData(data: any): TransferClaim;
|
|
205
|
+
getRecipient(): Uint8Array;
|
|
206
|
+
getAmount(): string;
|
|
207
|
+
getUserData(): Uint8Array | undefined;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
interface FastsetClientConfig {
|
|
211
|
+
validatorUrl: string;
|
|
212
|
+
proxyUrl: string;
|
|
213
|
+
}
|
|
214
|
+
declare class FastsetClient {
|
|
215
|
+
private config;
|
|
216
|
+
constructor(config: FastsetClientConfig);
|
|
217
|
+
getAccountInfo(address: string): Promise<FastsetAccountInfo | null>;
|
|
218
|
+
getNextNonce(senderAddress: string): Promise<number>;
|
|
219
|
+
fundFromFaucet(recipientAddress: string, amount: string): Promise<FastsetFaucetResponse>;
|
|
220
|
+
submitTransaction(request: FastsetSubmitTransactionRequest): Promise<FastsetSubmitTransactionResponse>;
|
|
221
|
+
submitCertificate(request: FastsetSubmitCertificateRequest): Promise<void>;
|
|
222
|
+
executeTransfer(senderPrivateKey: Uint8Array, recipient: string, amount: string, userData?: Uint8Array): Promise<Uint8Array>;
|
|
223
|
+
submitClaim(senderPrivateKey: Uint8Array, claim: any): Promise<Uint8Array>;
|
|
224
|
+
signTransaction(transaction: FastsetTransaction, privateKey: Uint8Array): Promise<Uint8Array>;
|
|
225
|
+
getTransactionStatus(txHash: string): Promise<any>;
|
|
226
|
+
getTransactionInfo(txHash: string): Promise<any>;
|
|
227
|
+
getNetworkInfo(): Promise<any>;
|
|
228
|
+
private requestValidator;
|
|
229
|
+
private requestProxy;
|
|
230
|
+
private request;
|
|
231
|
+
private jsonReplacer;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
interface TransactionOptions {
|
|
235
|
+
timestamp?: bigint;
|
|
236
|
+
}
|
|
237
|
+
declare class Transaction {
|
|
238
|
+
private sender;
|
|
239
|
+
private nonce;
|
|
240
|
+
private claim;
|
|
241
|
+
private timestamp;
|
|
242
|
+
constructor(sender: Uint8Array, nonce: number, claim: Claim, options?: TransactionOptions);
|
|
243
|
+
toTransaction(): FastsetTransaction;
|
|
244
|
+
getSender(): Uint8Array;
|
|
245
|
+
getNonce(): number;
|
|
246
|
+
getClaim(): Claim;
|
|
247
|
+
getTimestamp(): bigint;
|
|
248
|
+
static fromTransaction(transaction: FastsetTransaction): Transaction;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
interface WalletConfig {
|
|
252
|
+
privateKeyHex: string;
|
|
253
|
+
}
|
|
254
|
+
interface WalletInfo {
|
|
255
|
+
publicKeyHex: string;
|
|
256
|
+
address: string;
|
|
257
|
+
}
|
|
258
|
+
declare class Wallet {
|
|
259
|
+
readonly publicKey: Uint8Array;
|
|
260
|
+
readonly publicKeyHex: string;
|
|
261
|
+
private readonly privateKey;
|
|
262
|
+
constructor(privateKeyHex: string);
|
|
263
|
+
toBech32(): string;
|
|
264
|
+
getWalletInfo(): WalletInfo;
|
|
265
|
+
createTransferClaim(recipientAddress: string, amount: bigint, assetType: 'native' | 'set' | 'usdc' | string): TransferClaim;
|
|
266
|
+
createTransaction(nonce: number, claim: TransferClaim): Transaction;
|
|
267
|
+
signTransaction(transaction: Transaction): Promise<Uint8Array>;
|
|
268
|
+
static decodeBech32Address(address: string): Uint8Array;
|
|
269
|
+
static encodeBech32Address(publicKey: Uint8Array): string;
|
|
270
|
+
static fromPrivateKey(privateKeyHex: string): Wallet;
|
|
271
|
+
static generateNew(): Wallet;
|
|
272
|
+
static fromPrivateKeyFile(filePath: string): Promise<Wallet>;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
interface FastsetAccountData {
|
|
276
|
+
address: string;
|
|
277
|
+
balance: string;
|
|
278
|
+
balanceDecimal: number;
|
|
279
|
+
nextNonce: number;
|
|
280
|
+
sequenceNumber: number;
|
|
281
|
+
}
|
|
282
|
+
interface FastsetTransactionData {
|
|
283
|
+
hash: string;
|
|
284
|
+
hashHex: string;
|
|
285
|
+
status: string;
|
|
286
|
+
details: any;
|
|
287
|
+
}
|
|
288
|
+
declare class WarpFastsetDataLoader implements AdapterWarpDataLoader {
|
|
289
|
+
private readonly config;
|
|
290
|
+
private readonly chain;
|
|
291
|
+
private client;
|
|
292
|
+
constructor(config: WarpClientConfig, chain: WarpChainInfo);
|
|
293
|
+
getAccount(address: string): Promise<WarpChainAccount>;
|
|
294
|
+
getAccountAssets(address: string): Promise<WarpChainAsset[]>;
|
|
295
|
+
getAccountActions(address: string, options?: WarpDataLoaderOptions): Promise<WarpChainAction[]>;
|
|
296
|
+
getAccountInfo(address: string): Promise<FastsetAccountData | null>;
|
|
297
|
+
getTransactionInfo(txHash: string): Promise<FastsetTransactionData | null>;
|
|
298
|
+
checkTransferStatus(fromAddress: string, toAddress: string, amount: string): Promise<boolean>;
|
|
299
|
+
getAccountBalance(address: string): Promise<{
|
|
300
|
+
balance: string;
|
|
301
|
+
balanceDecimal: number;
|
|
302
|
+
} | null>;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
declare class WarpFastsetExecutor implements AdapterWarpExecutor {
|
|
306
|
+
private readonly config;
|
|
307
|
+
private readonly chain;
|
|
308
|
+
private readonly serializer;
|
|
309
|
+
private readonly fastsetClient;
|
|
310
|
+
constructor(config: WarpClientConfig, chain: WarpChainInfo);
|
|
311
|
+
createTransaction(executable: WarpExecutable): Promise<any>;
|
|
312
|
+
createTransferTransaction(executable: WarpExecutable): Promise<any>;
|
|
313
|
+
createContractCallTransaction(executable: WarpExecutable): Promise<any>;
|
|
314
|
+
executeQuery(executable: WarpExecutable): Promise<any>;
|
|
315
|
+
preprocessInput(chain: WarpChainInfo, input: string, type: WarpActionInputType, value: string): Promise<string>;
|
|
316
|
+
signMessage(message: string, privateKey: string): Promise<string>;
|
|
317
|
+
executeTransfer(executable: WarpExecutable): Promise<any>;
|
|
318
|
+
executeTransferWithKey(executable: WarpExecutable, privateKey: string): Promise<any>;
|
|
319
|
+
private encodeFunctionData;
|
|
320
|
+
private executeFastsetQuery;
|
|
321
|
+
private isValidFastsetAddress;
|
|
322
|
+
private fromBase64;
|
|
323
|
+
private normalizeAmount;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
declare class WarpFastsetExplorer implements AdapterWarpExplorer {
|
|
327
|
+
private readonly _chainInfo;
|
|
328
|
+
private readonly _config?;
|
|
329
|
+
private readonly explorerUrl;
|
|
330
|
+
constructor(_chainInfo: WarpChainInfo, _config?: WarpClientConfig | undefined);
|
|
331
|
+
getAccountUrl(address: string): string;
|
|
332
|
+
getTransactionUrl(hash: string): string;
|
|
333
|
+
getAssetUrl(identifier: string): string;
|
|
334
|
+
getContractUrl(address: string): string;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
declare class WarpFastsetResults implements AdapterWarpResults {
|
|
338
|
+
private readonly config;
|
|
339
|
+
private readonly chain;
|
|
340
|
+
private readonly serializer;
|
|
341
|
+
constructor(config: WarpClientConfig, chain: WarpChainInfo);
|
|
342
|
+
getTransactionExecutionResults(warp: Warp, tx: any): Promise<WarpExecution>;
|
|
343
|
+
extractQueryResults(warp: Warp, typedValues: any[], actionIndex: number, inputs: ResolvedInput[]): Promise<{
|
|
344
|
+
values: any[];
|
|
345
|
+
results: WarpExecutionResults;
|
|
346
|
+
}>;
|
|
347
|
+
private isTransactionSuccessful;
|
|
348
|
+
private extractTransactionHash;
|
|
349
|
+
private extractBlockNumber;
|
|
350
|
+
private extractTimestamp;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
declare class WarpFastsetSerializer implements AdapterWarpSerializer {
|
|
354
|
+
readonly coreSerializer: WarpSerializer;
|
|
355
|
+
constructor();
|
|
356
|
+
typedToString(value: any): string;
|
|
357
|
+
typedToNative(value: any): [WarpActionInputType, WarpNativeValue];
|
|
358
|
+
nativeToTyped(type: WarpActionInputType, value: WarpNativeValue): any;
|
|
359
|
+
nativeToType(type: BaseWarpActionInputType): WarpAdapterGenericType;
|
|
360
|
+
stringToTyped(value: string): any;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
export { Address, Amount, BcsTransaction, Bytes32, Claim, type ClaimData, ClaimType, type FastsetAccountData, type FastsetAccountInfo, FastsetClient, type FastsetClientConfig, type FastsetFaucetRequest, type FastsetFaucetResponse, type FastsetJsonRpcRequest, type FastsetJsonRpcResponse, type FastsetSubmitCertificateRequest, type FastsetSubmitTransactionRequest, type FastsetSubmitTransactionResponse, type FastsetTransaction, type FastsetTransactionData, type FastsetTransferRequest, NativeTokenSet, Nonce, PublicKey, Transaction, type TransactionOptions, Transfer, TransferClaim, UserData, Wallet, type WalletConfig, type WalletInfo, WarpFastsetConstants, WarpFastsetDataLoader, WarpFastsetExecutor, WarpFastsetExplorer, WarpFastsetResults, WarpFastsetSerializer, getFastsetAdapter };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,38 +1,7 @@
|
|
|
1
|
-
import { WarpChainAsset, AdapterFactory,
|
|
1
|
+
import { WarpChainAsset, AdapterFactory, AdapterWarpDataLoader, WarpClientConfig, WarpChainInfo, WarpChainAccount, WarpDataLoaderOptions, WarpChainAction, AdapterWarpExecutor, WarpExecutable, WarpActionInputType, AdapterWarpExplorer, AdapterWarpResults, Warp, WarpExecution, ResolvedInput, WarpExecutionResults, AdapterWarpSerializer, WarpSerializer, WarpNativeValue, BaseWarpActionInputType, WarpAdapterGenericType } from '@vleap/warps';
|
|
2
2
|
import * as _mysten_bcs from '@mysten/bcs';
|
|
3
3
|
|
|
4
|
-
declare const WarpFastsetConstants: {
|
|
5
|
-
Pi: {
|
|
6
|
-
Identifier: string;
|
|
7
|
-
DisplayName: string;
|
|
8
|
-
Decimals: number;
|
|
9
|
-
};
|
|
10
|
-
GasLimit: {
|
|
11
|
-
Default: number;
|
|
12
|
-
ContractCall: number;
|
|
13
|
-
ContractDeploy: number;
|
|
14
|
-
Transfer: number;
|
|
15
|
-
Approve: number;
|
|
16
|
-
Swap: number;
|
|
17
|
-
};
|
|
18
|
-
GasPrice: {
|
|
19
|
-
Default: string;
|
|
20
|
-
Low: string;
|
|
21
|
-
Medium: string;
|
|
22
|
-
High: string;
|
|
23
|
-
};
|
|
24
|
-
Validation: {
|
|
25
|
-
AddressLength: number;
|
|
26
|
-
HexPrefix: string;
|
|
27
|
-
MinGasLimit: number;
|
|
28
|
-
MaxGasLimit: number;
|
|
29
|
-
};
|
|
30
|
-
Timeouts: {
|
|
31
|
-
DefaultRpcTimeout: number;
|
|
32
|
-
GasEstimationTimeout: number;
|
|
33
|
-
QueryTimeout: number;
|
|
34
|
-
};
|
|
35
|
-
};
|
|
4
|
+
declare const WarpFastsetConstants: {};
|
|
36
5
|
|
|
37
6
|
declare const NativeTokenSet: WarpChainAsset;
|
|
38
7
|
declare const getFastsetAdapter: AdapterFactory;
|
|
@@ -111,7 +80,7 @@ declare const ClaimType: _mysten_bcs.BcsType<{
|
|
|
111
80
|
}) | null | undefined;
|
|
112
81
|
};
|
|
113
82
|
}>;
|
|
114
|
-
declare const
|
|
83
|
+
declare const BcsTransaction: _mysten_bcs.BcsType<{
|
|
115
84
|
sender: number[];
|
|
116
85
|
nonce: string;
|
|
117
86
|
timestamp_nanos: string;
|
|
@@ -214,6 +183,30 @@ interface FastsetJsonRpcResponse<T = unknown> {
|
|
|
214
183
|
};
|
|
215
184
|
}
|
|
216
185
|
|
|
186
|
+
interface ClaimData {
|
|
187
|
+
[key: string]: unknown;
|
|
188
|
+
}
|
|
189
|
+
declare abstract class Claim {
|
|
190
|
+
abstract readonly type: string;
|
|
191
|
+
abstract readonly data: ClaimData;
|
|
192
|
+
abstract toTransactionData(): unknown;
|
|
193
|
+
static fromTransaction(transaction: FastsetTransaction): Claim;
|
|
194
|
+
}
|
|
195
|
+
declare class TransferClaim extends Claim {
|
|
196
|
+
readonly type = "Transfer";
|
|
197
|
+
readonly data: {
|
|
198
|
+
recipient: Uint8Array;
|
|
199
|
+
amount: string;
|
|
200
|
+
userData?: Uint8Array;
|
|
201
|
+
};
|
|
202
|
+
constructor(recipient: Uint8Array, amount: string, userData?: Uint8Array);
|
|
203
|
+
toTransactionData(): unknown;
|
|
204
|
+
static fromData(data: any): TransferClaim;
|
|
205
|
+
getRecipient(): Uint8Array;
|
|
206
|
+
getAmount(): string;
|
|
207
|
+
getUserData(): Uint8Array | undefined;
|
|
208
|
+
}
|
|
209
|
+
|
|
217
210
|
interface FastsetClientConfig {
|
|
218
211
|
validatorUrl: string;
|
|
219
212
|
proxyUrl: string;
|
|
@@ -221,30 +214,93 @@ interface FastsetClientConfig {
|
|
|
221
214
|
declare class FastsetClient {
|
|
222
215
|
private config;
|
|
223
216
|
constructor(config: FastsetClientConfig);
|
|
224
|
-
getAccountInfo(address:
|
|
225
|
-
getNextNonce(senderAddress:
|
|
226
|
-
fundFromFaucet(
|
|
217
|
+
getAccountInfo(address: string): Promise<FastsetAccountInfo | null>;
|
|
218
|
+
getNextNonce(senderAddress: string): Promise<number>;
|
|
219
|
+
fundFromFaucet(recipientAddress: string, amount: string): Promise<FastsetFaucetResponse>;
|
|
227
220
|
submitTransaction(request: FastsetSubmitTransactionRequest): Promise<FastsetSubmitTransactionResponse>;
|
|
228
221
|
submitCertificate(request: FastsetSubmitCertificateRequest): Promise<void>;
|
|
229
|
-
executeTransfer(senderPrivateKey: Uint8Array, recipient:
|
|
222
|
+
executeTransfer(senderPrivateKey: Uint8Array, recipient: string, amount: string, userData?: Uint8Array): Promise<Uint8Array>;
|
|
223
|
+
submitClaim(senderPrivateKey: Uint8Array, claim: any): Promise<Uint8Array>;
|
|
230
224
|
signTransaction(transaction: FastsetTransaction, privateKey: Uint8Array): Promise<Uint8Array>;
|
|
231
|
-
|
|
225
|
+
getTransactionStatus(txHash: string): Promise<any>;
|
|
226
|
+
getTransactionInfo(txHash: string): Promise<any>;
|
|
227
|
+
getNetworkInfo(): Promise<any>;
|
|
232
228
|
private requestValidator;
|
|
233
229
|
private requestProxy;
|
|
234
230
|
private request;
|
|
235
231
|
private jsonReplacer;
|
|
236
232
|
}
|
|
237
233
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
declare
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
234
|
+
interface TransactionOptions {
|
|
235
|
+
timestamp?: bigint;
|
|
236
|
+
}
|
|
237
|
+
declare class Transaction {
|
|
238
|
+
private sender;
|
|
239
|
+
private nonce;
|
|
240
|
+
private claim;
|
|
241
|
+
private timestamp;
|
|
242
|
+
constructor(sender: Uint8Array, nonce: number, claim: Claim, options?: TransactionOptions);
|
|
243
|
+
toTransaction(): FastsetTransaction;
|
|
244
|
+
getSender(): Uint8Array;
|
|
245
|
+
getNonce(): number;
|
|
246
|
+
getClaim(): Claim;
|
|
247
|
+
getTimestamp(): bigint;
|
|
248
|
+
static fromTransaction(transaction: FastsetTransaction): Transaction;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
interface WalletConfig {
|
|
252
|
+
privateKeyHex: string;
|
|
253
|
+
}
|
|
254
|
+
interface WalletInfo {
|
|
255
|
+
publicKeyHex: string;
|
|
256
|
+
address: string;
|
|
257
|
+
}
|
|
258
|
+
declare class Wallet {
|
|
259
|
+
readonly publicKey: Uint8Array;
|
|
260
|
+
readonly publicKeyHex: string;
|
|
261
|
+
private readonly privateKey;
|
|
262
|
+
constructor(privateKeyHex: string);
|
|
263
|
+
toBech32(): string;
|
|
264
|
+
getWalletInfo(): WalletInfo;
|
|
265
|
+
createTransferClaim(recipientAddress: string, amount: bigint, assetType: 'native' | 'set' | 'usdc' | string): TransferClaim;
|
|
266
|
+
createTransaction(nonce: number, claim: TransferClaim): Transaction;
|
|
267
|
+
signTransaction(transaction: Transaction): Promise<Uint8Array>;
|
|
268
|
+
static decodeBech32Address(address: string): Uint8Array;
|
|
269
|
+
static encodeBech32Address(publicKey: Uint8Array): string;
|
|
270
|
+
static fromPrivateKey(privateKeyHex: string): Wallet;
|
|
271
|
+
static generateNew(): Wallet;
|
|
272
|
+
static fromPrivateKeyFile(filePath: string): Promise<Wallet>;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
interface FastsetAccountData {
|
|
276
|
+
address: string;
|
|
277
|
+
balance: string;
|
|
278
|
+
balanceDecimal: number;
|
|
279
|
+
nextNonce: number;
|
|
280
|
+
sequenceNumber: number;
|
|
281
|
+
}
|
|
282
|
+
interface FastsetTransactionData {
|
|
283
|
+
hash: string;
|
|
284
|
+
hashHex: string;
|
|
285
|
+
status: string;
|
|
286
|
+
details: any;
|
|
287
|
+
}
|
|
288
|
+
declare class WarpFastsetDataLoader implements AdapterWarpDataLoader {
|
|
289
|
+
private readonly config;
|
|
290
|
+
private readonly chain;
|
|
291
|
+
private client;
|
|
292
|
+
constructor(config: WarpClientConfig, chain: WarpChainInfo);
|
|
293
|
+
getAccount(address: string): Promise<WarpChainAccount>;
|
|
294
|
+
getAccountAssets(address: string): Promise<WarpChainAsset[]>;
|
|
295
|
+
getAccountActions(address: string, options?: WarpDataLoaderOptions): Promise<WarpChainAction[]>;
|
|
296
|
+
getAccountInfo(address: string): Promise<FastsetAccountData | null>;
|
|
297
|
+
getTransactionInfo(txHash: string): Promise<FastsetTransactionData | null>;
|
|
298
|
+
checkTransferStatus(fromAddress: string, toAddress: string, amount: string): Promise<boolean>;
|
|
299
|
+
getAccountBalance(address: string): Promise<{
|
|
300
|
+
balance: string;
|
|
301
|
+
balanceDecimal: number;
|
|
302
|
+
} | null>;
|
|
303
|
+
}
|
|
248
304
|
|
|
249
305
|
declare class WarpFastsetExecutor implements AdapterWarpExecutor {
|
|
250
306
|
private readonly config;
|
|
@@ -257,39 +313,41 @@ declare class WarpFastsetExecutor implements AdapterWarpExecutor {
|
|
|
257
313
|
createContractCallTransaction(executable: WarpExecutable): Promise<any>;
|
|
258
314
|
executeQuery(executable: WarpExecutable): Promise<any>;
|
|
259
315
|
preprocessInput(chain: WarpChainInfo, input: string, type: WarpActionInputType, value: string): Promise<string>;
|
|
260
|
-
private encodeFunctionData;
|
|
261
|
-
private executeFastsetQuery;
|
|
262
316
|
signMessage(message: string, privateKey: string): Promise<string>;
|
|
263
317
|
executeTransfer(executable: WarpExecutable): Promise<any>;
|
|
264
318
|
executeTransferWithKey(executable: WarpExecutable, privateKey: string): Promise<any>;
|
|
319
|
+
private encodeFunctionData;
|
|
320
|
+
private executeFastsetQuery;
|
|
321
|
+
private isValidFastsetAddress;
|
|
322
|
+
private fromBase64;
|
|
323
|
+
private normalizeAmount;
|
|
265
324
|
}
|
|
266
325
|
|
|
267
326
|
declare class WarpFastsetExplorer implements AdapterWarpExplorer {
|
|
268
|
-
private readonly
|
|
269
|
-
|
|
327
|
+
private readonly _chainInfo;
|
|
328
|
+
private readonly _config?;
|
|
329
|
+
private readonly explorerUrl;
|
|
330
|
+
constructor(_chainInfo: WarpChainInfo, _config?: WarpClientConfig | undefined);
|
|
270
331
|
getAccountUrl(address: string): string;
|
|
271
332
|
getTransactionUrl(hash: string): string;
|
|
272
|
-
getBlockUrl(blockNumber: string | number): string;
|
|
273
|
-
getContractUrl(address: string): string;
|
|
274
333
|
getAssetUrl(identifier: string): string;
|
|
275
|
-
|
|
334
|
+
getContractUrl(address: string): string;
|
|
276
335
|
}
|
|
277
336
|
|
|
278
337
|
declare class WarpFastsetResults implements AdapterWarpResults {
|
|
279
338
|
private readonly config;
|
|
339
|
+
private readonly chain;
|
|
280
340
|
private readonly serializer;
|
|
281
|
-
constructor(config: WarpClientConfig);
|
|
341
|
+
constructor(config: WarpClientConfig, chain: WarpChainInfo);
|
|
282
342
|
getTransactionExecutionResults(warp: Warp, tx: any): Promise<WarpExecution>;
|
|
283
343
|
extractQueryResults(warp: Warp, typedValues: any[], actionIndex: number, inputs: ResolvedInput[]): Promise<{
|
|
284
344
|
values: any[];
|
|
285
345
|
results: WarpExecutionResults;
|
|
286
346
|
}>;
|
|
287
347
|
private isTransactionSuccessful;
|
|
288
|
-
private extractGasUsed;
|
|
289
|
-
private extractGasPrice;
|
|
290
|
-
private extractBlockNumber;
|
|
291
348
|
private extractTransactionHash;
|
|
292
|
-
private
|
|
349
|
+
private extractBlockNumber;
|
|
350
|
+
private extractTimestamp;
|
|
293
351
|
}
|
|
294
352
|
|
|
295
353
|
declare class WarpFastsetSerializer implements AdapterWarpSerializer {
|
|
@@ -302,4 +360,4 @@ declare class WarpFastsetSerializer implements AdapterWarpSerializer {
|
|
|
302
360
|
stringToTyped(value: string): any;
|
|
303
361
|
}
|
|
304
362
|
|
|
305
|
-
export { Address, Amount, Bytes32, ClaimType, type FastsetAccountInfo, FastsetClient, type FastsetClientConfig, type FastsetFaucetRequest, type FastsetFaucetResponse, type FastsetJsonRpcRequest, type FastsetJsonRpcResponse, type FastsetSubmitCertificateRequest, type FastsetSubmitTransactionRequest, type FastsetSubmitTransactionResponse, type FastsetTransaction, type FastsetTransferRequest, NativeTokenSet, Nonce, PublicKey, Transaction,
|
|
363
|
+
export { Address, Amount, BcsTransaction, Bytes32, Claim, type ClaimData, ClaimType, type FastsetAccountData, type FastsetAccountInfo, FastsetClient, type FastsetClientConfig, type FastsetFaucetRequest, type FastsetFaucetResponse, type FastsetJsonRpcRequest, type FastsetJsonRpcResponse, type FastsetSubmitCertificateRequest, type FastsetSubmitTransactionRequest, type FastsetSubmitTransactionResponse, type FastsetTransaction, type FastsetTransactionData, type FastsetTransferRequest, NativeTokenSet, Nonce, PublicKey, Transaction, type TransactionOptions, Transfer, TransferClaim, UserData, Wallet, type WalletConfig, type WalletInfo, WarpFastsetConstants, WarpFastsetDataLoader, WarpFastsetExecutor, WarpFastsetExplorer, WarpFastsetResults, WarpFastsetSerializer, getFastsetAdapter };
|