@vleap/warps-adapter-fastset 0.1.0-alpha.19 → 0.1.0-alpha.20

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 CHANGED
@@ -1,321 +1,87 @@
1
- import { WarpChainAsset, AdapterFactory, AdapterWarpDataLoader, WarpClientConfig, WarpChainInfo, WarpChainAccount, WarpChainAction, WarpDataLoaderOptions, AdapterWarpExecutor, WarpExecutable, AdapterWarpExplorer, AdapterWarpResults, Warp, WarpExecution, ResolvedInput, WarpExecutionResults, AdapterWarpSerializer, WarpSerializer, WarpActionInputType, WarpNativeValue, BaseWarpActionInputType, WarpAdapterGenericType } from '@vleap/warps';
2
- import * as _mysten_bcs from '@mysten/bcs';
1
+ import { WarpChainAsset, AdapterFactory, WarpClientConfig, AdapterWarpDataLoader, WarpChainInfo, WarpChainAccount, WarpChainAction, WarpDataLoaderOptions, AdapterWarpExecutor, WarpExecutable, AdapterWarpExplorer, AdapterWarpResults, Warp, WarpExecution, ResolvedInput, WarpExecutionResults, AdapterWarpSerializer, WarpSerializer, WarpActionInputType, WarpNativeValue, BaseWarpActionInputType, WarpAdapterGenericType } from '@vleap/warps';
3
2
 
4
3
  declare const WarpFastsetConstants: {};
5
4
 
6
5
  declare const NativeTokenSet: WarpChainAsset;
7
6
  declare const getFastsetAdapter: AdapterFactory;
8
7
 
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
- };
8
+ interface PageRequest {
9
+ limit: number;
10
+ token?: number[];
11
+ }
12
+ interface Pagination {
13
+ limit?: number;
14
+ offset: number;
15
+ }
16
+ interface Page<T> {
17
+ data: T[];
18
+ next_page_token: number[];
19
+ }
20
+ interface Timed<T> {
21
+ data: T;
22
+ timing?: {
23
+ signing_duration_nanos?: number;
24
+ user_time_nanos?: number;
25
+ settlement_duration_nanos: number;
136
26
  };
137
27
  }
138
- interface FastsetTransferRequest {
139
- recipient: Uint8Array;
140
- amount: string;
141
- user_data?: Uint8Array;
28
+ interface TokenMetadata {
29
+ update_id: number;
30
+ admin: number[];
31
+ token_name: string;
32
+ decimals: number;
33
+ total_supply: string;
34
+ mints: number[][];
142
35
  }
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;
36
+ interface TokenInfoResponse {
37
+ requested_token_metadata: Array<[number[], TokenMetadata]>;
165
38
  }
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
- };
39
+ interface TransactionData {
40
+ sender: number[];
41
+ recipient: any;
42
+ nonce: number;
43
+ timestamp_nanos: string;
44
+ claim: any;
184
45
  }
185
- interface FastsetAssetBalance {
186
- asset_id: string;
46
+ interface AccountInfoResponse {
47
+ sender: number[];
187
48
  balance: string;
188
- name?: string;
189
- decimals?: number;
190
- logo_url?: string;
191
- }
192
- interface FastsetAssetBalances {
193
- [assetId: string]: FastsetAssetBalance;
194
- }
195
-
196
- interface ClaimData {
197
- [key: string]: unknown;
198
- }
199
- declare abstract class Claim {
200
- abstract readonly type: string;
201
- abstract readonly data: ClaimData;
202
- abstract toTransactionData(): unknown;
203
- static fromTransaction(transaction: FastsetTransaction): Claim;
204
- }
205
- declare class TransferClaim extends Claim {
206
- readonly type = "Transfer";
207
- readonly data: {
208
- recipient: Uint8Array;
209
- amount: string;
210
- userData?: Uint8Array;
211
- };
212
- constructor(recipient: Uint8Array, amount: string, userData?: Uint8Array);
213
- toTransactionData(): unknown;
214
- static fromData(data: any): TransferClaim;
215
- getRecipient(): Uint8Array;
216
- getAmount(): string;
217
- getUserData(): Uint8Array | undefined;
218
- }
219
-
220
- interface FastsetClientConfig {
221
- validatorUrl: string;
222
- proxyUrl: string;
49
+ next_nonce: number;
50
+ pending_confirmation?: any;
51
+ requested_certificate?: any;
52
+ requested_validated_transaction?: any;
53
+ requested_received_transfers: any[];
54
+ token_balance: Array<[number[], string]>;
55
+ requested_claim_by_id?: any;
56
+ requested_claims: any[];
223
57
  }
224
58
  declare class FastsetClient {
225
- private config;
226
- constructor(config?: FastsetClientConfig);
227
- private handleRpcCall;
228
- getAccountInfo(address: string): Promise<FastsetAccountInfo | null>;
229
- getNextNonce(senderAddress: string): Promise<number>;
230
- getAssetBalance(accountId: string, assetId: string): Promise<FastsetAssetBalance | null>;
231
- getAssetBalances(accountId: string): Promise<FastsetAssetBalances | null>;
232
- fundFromFaucet(recipientAddress: string, amount: string): Promise<FastsetFaucetResponse>;
233
- submitTransaction(request: FastsetSubmitTransactionRequest): Promise<FastsetSubmitTransactionResponse>;
234
- submitCertificate(request: FastsetSubmitCertificateRequest): Promise<void>;
235
- executeTransfer(senderPrivateKey: Uint8Array, recipient: string, amount: string, userData?: Uint8Array): Promise<Uint8Array>;
236
- submitClaim(senderPrivateKey: Uint8Array, claim: any): Promise<Uint8Array>;
237
- signTransaction(transaction: FastsetTransaction, privateKey: Uint8Array): Promise<Uint8Array>;
238
- getTransactionStatus(txHash: string): Promise<any>;
239
- getTransactionInfo(txHash: string): Promise<any>;
240
- getNetworkInfo(): Promise<any>;
241
- private requestValidator;
242
- private requestProxy;
243
- private request;
244
- private jsonReplacer;
245
- }
246
-
247
- interface TransactionOptions {
248
- timestamp?: bigint;
249
- }
250
- declare class Transaction {
251
- private sender;
252
- private nonce;
253
- private claim;
254
- private timestamp;
255
- constructor(sender: Uint8Array, nonce: number, claim: Claim, options?: TransactionOptions);
256
- toTransaction(): FastsetTransaction;
257
- getSender(): Uint8Array;
258
- getNonce(): number;
259
- getClaim(): Claim;
260
- getTimestamp(): bigint;
261
- static fromTransaction(transaction: FastsetTransaction): Transaction;
59
+ private readonly apiUrl;
60
+ constructor(config?: WarpClientConfig | {
61
+ proxyUrl: string;
62
+ }, chain?: any);
63
+ private makeRequest;
64
+ getAccountInfo(address: number[], token_balance_filter?: number[][], certificate_by_nonce?: number): Promise<AccountInfoResponse>;
65
+ getTokenInfo(token_ids: number[][]): Promise<TokenInfoResponse>;
66
+ getTransfers(page: PageRequest): Promise<Page<Timed<any>>>;
67
+ getClaims(confirmed: boolean, page: PageRequest): Promise<Page<Timed<any>>>;
68
+ getClaimsByAddress(address: number[], page: Pagination): Promise<any[]>;
69
+ getNextNonce(address: string | number[]): Promise<number>;
70
+ submitTransaction(transaction: TransactionData, signature: number[] | Uint8Array): Promise<any>;
71
+ private addressToBytes;
262
72
  }
263
73
 
264
- interface WalletConfig {
265
- privateKeyHex: string;
266
- }
267
- interface WalletInfo {
268
- publicKeyHex: string;
269
- address: string;
270
- }
271
- declare class Wallet {
272
- readonly publicKey: Uint8Array;
273
- readonly publicKeyHex: string;
274
- private readonly privateKey;
275
- constructor(privateKeyHex: string);
276
- toBech32(): string;
277
- getWalletInfo(): WalletInfo;
278
- createTransferClaim(recipientAddress: string, amount: bigint, assetType: 'native' | 'set' | 'usdc' | string): TransferClaim;
279
- createTransaction(nonce: number, claim: TransferClaim): Transaction;
280
- signTransaction(transaction: Transaction): Promise<Uint8Array>;
281
- static decodeBech32Address(address: string): Uint8Array;
282
- static encodeBech32Address(publicKey: Uint8Array): string;
283
- static fromPrivateKey(privateKeyHex: string): Wallet;
284
- static generateNew(): Wallet;
285
- static fromPrivateKeyFile(filePath: string): Promise<Wallet>;
286
- }
287
-
288
- interface FastsetAccountData {
289
- address: string;
290
- balance: string;
291
- balanceDecimal: number;
292
- nextNonce: number;
293
- sequenceNumber: number;
294
- }
295
- interface FastsetTransactionData {
296
- hash: string;
297
- hashHex: string;
298
- status: string;
299
- details: any;
300
- }
301
74
  declare class WarpFastsetDataLoader implements AdapterWarpDataLoader {
302
75
  private readonly config;
303
76
  private readonly chain;
304
77
  private client;
305
78
  constructor(config: WarpClientConfig, chain: WarpChainInfo);
79
+ private addressToBytes;
306
80
  getAccount(address: string): Promise<WarpChainAccount>;
307
81
  getAccountAssets(address: string): Promise<WarpChainAsset[]>;
308
82
  getAsset(identifier: string): Promise<WarpChainAsset | null>;
309
83
  getAction(identifier: string, awaitCompleted?: boolean): Promise<WarpChainAction | null>;
310
84
  getAccountActions(address: string, options?: WarpDataLoaderOptions): Promise<WarpChainAction[]>;
311
- getAccountInfo(address: string): Promise<FastsetAccountData | null>;
312
- getTransactionInfo(txHash: string): Promise<FastsetTransactionData | null>;
313
- checkTransferStatus(fromAddress: string, toAddress: string, amount: string): Promise<boolean>;
314
- getAccountBalance(address: string): Promise<{
315
- balance: string;
316
- balanceDecimal: number;
317
- } | null>;
318
- getAssetBalance(address: string, assetId: string): Promise<WarpChainAsset | null>;
319
85
  }
320
86
 
321
87
  declare class WarpFastsetExecutor implements AdapterWarpExecutor {
@@ -329,6 +95,7 @@ declare class WarpFastsetExecutor implements AdapterWarpExecutor {
329
95
  createContractCallTransaction(executable: WarpExecutable): Promise<any>;
330
96
  executeQuery(executable: WarpExecutable): Promise<any>;
331
97
  signMessage(message: string, privateKey: string): Promise<string>;
98
+ private signTransaction;
332
99
  executeTransfer(executable: WarpExecutable): Promise<any>;
333
100
  executeTransferWithKey(executable: WarpExecutable, privateKey: string): Promise<any>;
334
101
  private encodeFunctionData;
@@ -375,4 +142,4 @@ declare class WarpFastsetSerializer implements AdapterWarpSerializer {
375
142
  stringToTyped(value: string): any;
376
143
  }
377
144
 
378
- export { Address, Amount, BcsTransaction, Bytes32, Claim, type ClaimData, ClaimType, type FastsetAccountData, type FastsetAccountInfo, type FastsetAssetBalance, type FastsetAssetBalances, 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 };
145
+ export { type AccountInfoResponse, FastsetClient, NativeTokenSet, type Page, type PageRequest, type Pagination, type Timed, type TokenInfoResponse, type TokenMetadata, type TransactionData, WarpFastsetConstants, WarpFastsetDataLoader, WarpFastsetExecutor, WarpFastsetExplorer, WarpFastsetResults, WarpFastsetSerializer, getFastsetAdapter };