@vleap/warps-adapter-fastset 0.1.0-alpha.12 → 0.1.0-alpha.14
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.ts +121 -62
- package/dist/index.mjs +529 -332
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,39 +1,9 @@
|
|
|
1
|
-
import { 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
|
|
|
6
|
+
declare const NativeTokenSet: WarpChainAsset;
|
|
37
7
|
declare const getFastsetAdapter: AdapterFactory;
|
|
38
8
|
|
|
39
9
|
declare const Bytes32: _mysten_bcs.BcsType<number[], Iterable<number> & {
|
|
@@ -110,7 +80,7 @@ declare const ClaimType: _mysten_bcs.BcsType<{
|
|
|
110
80
|
}) | null | undefined;
|
|
111
81
|
};
|
|
112
82
|
}>;
|
|
113
|
-
declare const
|
|
83
|
+
declare const BcsTransaction: _mysten_bcs.BcsType<{
|
|
114
84
|
sender: number[];
|
|
115
85
|
nonce: string;
|
|
116
86
|
timestamp_nanos: string;
|
|
@@ -213,6 +183,30 @@ interface FastsetJsonRpcResponse<T = unknown> {
|
|
|
213
183
|
};
|
|
214
184
|
}
|
|
215
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
|
+
|
|
216
210
|
interface FastsetClientConfig {
|
|
217
211
|
validatorUrl: string;
|
|
218
212
|
proxyUrl: string;
|
|
@@ -220,30 +214,93 @@ interface FastsetClientConfig {
|
|
|
220
214
|
declare class FastsetClient {
|
|
221
215
|
private config;
|
|
222
216
|
constructor(config: FastsetClientConfig);
|
|
223
|
-
getAccountInfo(address:
|
|
224
|
-
getNextNonce(senderAddress:
|
|
225
|
-
fundFromFaucet(
|
|
217
|
+
getAccountInfo(address: string): Promise<FastsetAccountInfo | null>;
|
|
218
|
+
getNextNonce(senderAddress: string): Promise<number>;
|
|
219
|
+
fundFromFaucet(recipientAddress: string, amount: string): Promise<FastsetFaucetResponse>;
|
|
226
220
|
submitTransaction(request: FastsetSubmitTransactionRequest): Promise<FastsetSubmitTransactionResponse>;
|
|
227
221
|
submitCertificate(request: FastsetSubmitCertificateRequest): Promise<void>;
|
|
228
|
-
executeTransfer(senderPrivateKey: Uint8Array, recipient:
|
|
222
|
+
executeTransfer(senderPrivateKey: Uint8Array, recipient: string, amount: string, userData?: Uint8Array): Promise<Uint8Array>;
|
|
223
|
+
submitClaim(senderPrivateKey: Uint8Array, claim: any): Promise<Uint8Array>;
|
|
229
224
|
signTransaction(transaction: FastsetTransaction, privateKey: Uint8Array): Promise<Uint8Array>;
|
|
230
|
-
|
|
225
|
+
getTransactionStatus(txHash: string): Promise<any>;
|
|
226
|
+
getTransactionInfo(txHash: string): Promise<any>;
|
|
227
|
+
getNetworkInfo(): Promise<any>;
|
|
231
228
|
private requestValidator;
|
|
232
229
|
private requestProxy;
|
|
233
230
|
private request;
|
|
234
231
|
private jsonReplacer;
|
|
235
232
|
}
|
|
236
233
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
declare
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
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
|
+
}
|
|
247
304
|
|
|
248
305
|
declare class WarpFastsetExecutor implements AdapterWarpExecutor {
|
|
249
306
|
private readonly config;
|
|
@@ -256,39 +313,41 @@ declare class WarpFastsetExecutor implements AdapterWarpExecutor {
|
|
|
256
313
|
createContractCallTransaction(executable: WarpExecutable): Promise<any>;
|
|
257
314
|
executeQuery(executable: WarpExecutable): Promise<any>;
|
|
258
315
|
preprocessInput(chain: WarpChainInfo, input: string, type: WarpActionInputType, value: string): Promise<string>;
|
|
259
|
-
private encodeFunctionData;
|
|
260
|
-
private executeFastsetQuery;
|
|
261
316
|
signMessage(message: string, privateKey: string): Promise<string>;
|
|
262
317
|
executeTransfer(executable: WarpExecutable): Promise<any>;
|
|
263
318
|
executeTransferWithKey(executable: WarpExecutable, privateKey: string): Promise<any>;
|
|
319
|
+
private encodeFunctionData;
|
|
320
|
+
private executeFastsetQuery;
|
|
321
|
+
private isValidFastsetAddress;
|
|
322
|
+
private fromBase64;
|
|
323
|
+
private normalizeAmount;
|
|
264
324
|
}
|
|
265
325
|
|
|
266
326
|
declare class WarpFastsetExplorer implements AdapterWarpExplorer {
|
|
267
|
-
private readonly
|
|
268
|
-
|
|
327
|
+
private readonly _chainInfo;
|
|
328
|
+
private readonly _config?;
|
|
329
|
+
private readonly explorerUrl;
|
|
330
|
+
constructor(_chainInfo: WarpChainInfo, _config?: WarpClientConfig | undefined);
|
|
269
331
|
getAccountUrl(address: string): string;
|
|
270
332
|
getTransactionUrl(hash: string): string;
|
|
271
|
-
getBlockUrl(blockNumber: string | number): string;
|
|
272
|
-
getContractUrl(address: string): string;
|
|
273
333
|
getAssetUrl(identifier: string): string;
|
|
274
|
-
|
|
334
|
+
getContractUrl(address: string): string;
|
|
275
335
|
}
|
|
276
336
|
|
|
277
337
|
declare class WarpFastsetResults implements AdapterWarpResults {
|
|
278
338
|
private readonly config;
|
|
339
|
+
private readonly chain;
|
|
279
340
|
private readonly serializer;
|
|
280
|
-
constructor(config: WarpClientConfig);
|
|
341
|
+
constructor(config: WarpClientConfig, chain: WarpChainInfo);
|
|
281
342
|
getTransactionExecutionResults(warp: Warp, tx: any): Promise<WarpExecution>;
|
|
282
343
|
extractQueryResults(warp: Warp, typedValues: any[], actionIndex: number, inputs: ResolvedInput[]): Promise<{
|
|
283
344
|
values: any[];
|
|
284
345
|
results: WarpExecutionResults;
|
|
285
346
|
}>;
|
|
286
347
|
private isTransactionSuccessful;
|
|
287
|
-
private extractGasUsed;
|
|
288
|
-
private extractGasPrice;
|
|
289
|
-
private extractBlockNumber;
|
|
290
348
|
private extractTransactionHash;
|
|
291
|
-
private
|
|
349
|
+
private extractBlockNumber;
|
|
350
|
+
private extractTimestamp;
|
|
292
351
|
}
|
|
293
352
|
|
|
294
353
|
declare class WarpFastsetSerializer implements AdapterWarpSerializer {
|
|
@@ -301,4 +360,4 @@ declare class WarpFastsetSerializer implements AdapterWarpSerializer {
|
|
|
301
360
|
stringToTyped(value: string): any;
|
|
302
361
|
}
|
|
303
362
|
|
|
304
|
-
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, 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 };
|