@vleap/warps-adapter-fastset 0.1.0-alpha.9 → 0.1.0-beta.40

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.
@@ -0,0 +1,32 @@
1
+ import { WarpChainAsset, AdapterFactory, AdapterWarpExecutor, WarpClientConfig, WarpChainInfo, WarpExecutable, WarpAdapterGenericTransaction, AdapterWarpWallet, WarpWalletDetails } from '@vleap/warps';
2
+
3
+ declare const NativeTokenSet: WarpChainAsset;
4
+ declare const getFastsetAdapter: AdapterFactory;
5
+
6
+ declare class WarpFastsetExecutor implements AdapterWarpExecutor {
7
+ private readonly config;
8
+ private readonly chain;
9
+ private readonly client;
10
+ constructor(config: WarpClientConfig, chain: WarpChainInfo);
11
+ createTransaction(executable: WarpExecutable): Promise<any>;
12
+ createTransferTransaction(executable: WarpExecutable): Promise<WarpAdapterGenericTransaction>;
13
+ createContractCallTransaction(executable: WarpExecutable): Promise<any>;
14
+ executeQuery(executable: WarpExecutable): Promise<any>;
15
+ }
16
+
17
+ declare class WarpFastsetWallet implements AdapterWarpWallet {
18
+ private config;
19
+ private chain;
20
+ private client;
21
+ constructor(config: WarpClientConfig, chain: WarpChainInfo);
22
+ signTransaction(tx: WarpAdapterGenericTransaction): Promise<WarpAdapterGenericTransaction>;
23
+ signMessage(message: string): Promise<string>;
24
+ signTransactions(txs: WarpAdapterGenericTransaction[]): Promise<WarpAdapterGenericTransaction[]>;
25
+ sendTransaction(tx: WarpAdapterGenericTransaction): Promise<string>;
26
+ sendTransactions(txs: WarpAdapterGenericTransaction[]): Promise<string[]>;
27
+ create(mnemonic: string): WarpWalletDetails;
28
+ generate(): WarpWalletDetails;
29
+ getAddress(): string | null;
30
+ }
31
+
32
+ export { NativeTokenSet, WarpFastsetExecutor, WarpFastsetWallet, getFastsetAdapter };
package/dist/index.d.ts CHANGED
@@ -1,303 +1,32 @@
1
- import { AdapterFactory, AdapterWarpExecutor, WarpClientConfig, WarpExecutable, WarpChainInfo, 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
- 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
- };
1
+ import { WarpChainAsset, AdapterFactory, AdapterWarpExecutor, WarpClientConfig, WarpChainInfo, WarpExecutable, WarpAdapterGenericTransaction, AdapterWarpWallet, WarpWalletDetails } from '@vleap/warps';
36
2
 
3
+ declare const NativeTokenSet: WarpChainAsset;
37
4
  declare const getFastsetAdapter: AdapterFactory;
38
5
 
39
- declare const Bytes32: _mysten_bcs.BcsType<number[], Iterable<number> & {
40
- length: number;
41
- }>;
42
- declare const PublicKey: _mysten_bcs.BcsType<number[], Iterable<number> & {
43
- length: number;
44
- }>;
45
- declare const Address: _mysten_bcs.BcsType<{
46
- External: number[];
47
- } | {
48
- FastSet: number[];
49
- }, {
50
- External: Iterable<number> & {
51
- length: number;
52
- };
53
- } | {
54
- FastSet: Iterable<number> & {
55
- length: number;
56
- };
57
- }>;
58
- declare const Amount: _mysten_bcs.BcsType<string, unknown>;
59
- declare const UserData: _mysten_bcs.BcsType<number[] | null, (Iterable<number> & {
60
- length: number;
61
- }) | null | undefined>;
62
- declare const Nonce: _mysten_bcs.BcsType<string, string | number | bigint>;
63
- declare const Transfer: _mysten_bcs.BcsType<{
64
- recipient: {
65
- External: number[];
66
- } | {
67
- FastSet: number[];
68
- };
69
- amount: string;
70
- user_data: number[] | null;
71
- }, {
72
- recipient: {
73
- External: Iterable<number> & {
74
- length: number;
75
- };
76
- } | {
77
- FastSet: Iterable<number> & {
78
- length: number;
79
- };
80
- };
81
- amount: unknown;
82
- user_data: (Iterable<number> & {
83
- length: number;
84
- }) | null | undefined;
85
- }>;
86
- declare const ClaimType: _mysten_bcs.BcsType<{
87
- Transfer: {
88
- recipient: {
89
- External: number[];
90
- } | {
91
- FastSet: number[];
92
- };
93
- amount: string;
94
- user_data: number[] | null;
95
- };
96
- }, {
97
- Transfer: {
98
- recipient: {
99
- External: Iterable<number> & {
100
- length: number;
101
- };
102
- } | {
103
- FastSet: Iterable<number> & {
104
- length: number;
105
- };
106
- };
107
- amount: unknown;
108
- user_data: (Iterable<number> & {
109
- length: number;
110
- }) | null | undefined;
111
- };
112
- }>;
113
- declare const Transaction: _mysten_bcs.BcsType<{
114
- sender: number[];
115
- nonce: string;
116
- timestamp_nanos: string;
117
- claim: {
118
- Transfer: {
119
- recipient: {
120
- External: number[];
121
- } | {
122
- FastSet: number[];
123
- };
124
- amount: string;
125
- user_data: number[] | null;
126
- };
127
- };
128
- }, {
129
- sender: Iterable<number> & {
130
- length: number;
131
- };
132
- nonce: string | number | bigint;
133
- timestamp_nanos: string | number | bigint;
134
- claim: {
135
- Transfer: {
136
- recipient: {
137
- External: Iterable<number> & {
138
- length: number;
139
- };
140
- } | {
141
- FastSet: Iterable<number> & {
142
- length: number;
143
- };
144
- };
145
- amount: unknown;
146
- user_data: (Iterable<number> & {
147
- length: number;
148
- }) | null | undefined;
149
- };
150
- };
151
- }>;
152
- interface FastsetTransaction {
153
- sender: Uint8Array;
154
- nonce: number;
155
- timestamp_nanos: bigint;
156
- claim: {
157
- Transfer: {
158
- recipient: {
159
- FastSet: Uint8Array;
160
- } | {
161
- External: Uint8Array;
162
- };
163
- amount: string;
164
- user_data: Uint8Array | null;
165
- };
166
- };
167
- }
168
- interface FastsetTransferRequest {
169
- recipient: Uint8Array;
170
- amount: string;
171
- user_data?: Uint8Array;
172
- }
173
- interface FastsetAccountInfo {
174
- balance: string;
175
- next_nonce: number;
176
- sequence_number: number;
177
- }
178
- interface FastsetSubmitTransactionRequest {
179
- transaction: FastsetTransaction;
180
- signature: Uint8Array;
181
- }
182
- interface FastsetSubmitTransactionResponse {
183
- transaction_hash: Uint8Array;
184
- validator: Uint8Array;
185
- signature: Uint8Array;
186
- }
187
- interface FastsetSubmitCertificateRequest {
188
- transaction: FastsetTransaction;
189
- signature: Uint8Array;
190
- validator_signatures: [Uint8Array, Uint8Array][];
191
- }
192
- interface FastsetFaucetRequest {
193
- recipient: Uint8Array;
194
- amount: string;
195
- }
196
- interface FastsetFaucetResponse {
197
- balance: string;
198
- }
199
- interface FastsetJsonRpcRequest {
200
- jsonrpc: '2.0';
201
- id: number;
202
- method: string;
203
- params: Record<string, unknown>;
204
- }
205
- interface FastsetJsonRpcResponse<T = unknown> {
206
- jsonrpc: '2.0';
207
- id: number;
208
- result?: T;
209
- error?: {
210
- code: number;
211
- message: string;
212
- data?: unknown;
213
- };
214
- }
215
-
216
- interface FastsetClientConfig {
217
- validatorUrl: string;
218
- proxyUrl: string;
219
- }
220
- declare class FastsetClient {
221
- private config;
222
- constructor(config: FastsetClientConfig);
223
- getAccountInfo(address: Uint8Array): Promise<FastsetAccountInfo | null>;
224
- getNextNonce(senderAddress: Uint8Array): Promise<number>;
225
- fundFromFaucet(request: FastsetFaucetRequest): Promise<FastsetFaucetResponse>;
226
- submitTransaction(request: FastsetSubmitTransactionRequest): Promise<FastsetSubmitTransactionResponse>;
227
- submitCertificate(request: FastsetSubmitCertificateRequest): Promise<void>;
228
- executeTransfer(senderPrivateKey: Uint8Array, recipient: Uint8Array, amount: string, userData?: Uint8Array): Promise<Uint8Array>;
229
- signTransaction(transaction: FastsetTransaction, privateKey: Uint8Array): Promise<Uint8Array>;
230
- private serializeTransaction;
231
- private requestValidator;
232
- private requestProxy;
233
- private request;
234
- private jsonReplacer;
235
- }
236
-
237
- declare function isValidFastsetAddress(address: string): boolean;
238
- declare function fromBase64(base64: string): Uint8Array;
239
- declare function toBase64String(bytes: Uint8Array): string;
240
- declare function toHexString(bytes: Uint8Array): string;
241
- declare function hexToDecimal(hex: string): string;
242
- declare function decimalToHex(decimal: string): string;
243
- declare function validateAmount(amount: string): boolean;
244
- declare function normalizeAmount(amount: string): string;
245
- declare function validatePrivateKey(privateKey: string | Uint8Array): boolean;
246
- declare function validatePublicKey(publicKey: string | Uint8Array): boolean;
247
-
248
6
  declare class WarpFastsetExecutor implements AdapterWarpExecutor {
249
7
  private readonly config;
250
- private readonly serializer;
251
- private readonly fastsetClient;
252
- constructor(config: WarpClientConfig);
8
+ private readonly chain;
9
+ private readonly client;
10
+ constructor(config: WarpClientConfig, chain: WarpChainInfo);
253
11
  createTransaction(executable: WarpExecutable): Promise<any>;
254
- createTransferTransaction(executable: WarpExecutable): Promise<any>;
12
+ createTransferTransaction(executable: WarpExecutable): Promise<WarpAdapterGenericTransaction>;
255
13
  createContractCallTransaction(executable: WarpExecutable): Promise<any>;
256
14
  executeQuery(executable: WarpExecutable): Promise<any>;
257
- preprocessInput(chain: WarpChainInfo, input: string, type: WarpActionInputType, value: string): Promise<string>;
258
- private encodeFunctionData;
259
- private executeFastsetQuery;
260
- signMessage(message: string, privateKey: string): Promise<string>;
261
- executeTransfer(executable: WarpExecutable): Promise<any>;
262
- executeTransferWithKey(executable: WarpExecutable, privateKey: string): Promise<any>;
263
- }
264
-
265
- declare class WarpFastsetExplorer implements AdapterWarpExplorer {
266
- private readonly chainInfo;
267
- constructor(chainInfo: WarpChainInfo);
268
- getAccountUrl(address: string): string;
269
- getTransactionUrl(hash: string): string;
270
- getBlockUrl(blockNumber: string | number): string;
271
- getContractUrl(address: string): string;
272
- getAssetUrl(identifier: string): string;
273
- private getDefaultExplorerUrl;
274
15
  }
275
16
 
276
- declare class WarpFastsetResults implements AdapterWarpResults {
277
- private readonly config;
278
- private readonly serializer;
279
- constructor(config: WarpClientConfig);
280
- getTransactionExecutionResults(warp: Warp, tx: any): Promise<WarpExecution>;
281
- extractQueryResults(warp: Warp, typedValues: any[], actionIndex: number, inputs: ResolvedInput[]): Promise<{
282
- values: any[];
283
- results: WarpExecutionResults;
284
- }>;
285
- private isTransactionSuccessful;
286
- private extractGasUsed;
287
- private extractGasPrice;
288
- private extractBlockNumber;
289
- private extractTransactionHash;
290
- private extractLogs;
291
- }
292
-
293
- declare class WarpFastsetSerializer implements AdapterWarpSerializer {
294
- readonly coreSerializer: WarpSerializer;
295
- constructor();
296
- typedToString(value: any): string;
297
- typedToNative(value: any): [WarpActionInputType, WarpNativeValue];
298
- nativeToTyped(type: WarpActionInputType, value: WarpNativeValue): any;
299
- nativeToType(type: BaseWarpActionInputType): WarpAdapterGenericType;
300
- stringToTyped(value: string): any;
301
- }
302
-
303
- 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, Transfer, UserData, WarpFastsetConstants, WarpFastsetExecutor, WarpFastsetExplorer, WarpFastsetResults, WarpFastsetSerializer, decimalToHex, fromBase64, getFastsetAdapter, hexToDecimal, isValidFastsetAddress, normalizeAmount, toBase64String, toHexString, validateAmount, validatePrivateKey, validatePublicKey };
17
+ declare class WarpFastsetWallet implements AdapterWarpWallet {
18
+ private config;
19
+ private chain;
20
+ private client;
21
+ constructor(config: WarpClientConfig, chain: WarpChainInfo);
22
+ signTransaction(tx: WarpAdapterGenericTransaction): Promise<WarpAdapterGenericTransaction>;
23
+ signMessage(message: string): Promise<string>;
24
+ signTransactions(txs: WarpAdapterGenericTransaction[]): Promise<WarpAdapterGenericTransaction[]>;
25
+ sendTransaction(tx: WarpAdapterGenericTransaction): Promise<string>;
26
+ sendTransactions(txs: WarpAdapterGenericTransaction[]): Promise<string[]>;
27
+ create(mnemonic: string): WarpWalletDetails;
28
+ generate(): WarpWalletDetails;
29
+ getAddress(): string | null;
30
+ }
31
+
32
+ export { NativeTokenSet, WarpFastsetExecutor, WarpFastsetWallet, getFastsetAdapter };