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

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,48 +1,57 @@
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';
2
-
3
- declare const WarpFastsetConstants: {};
1
+ import { WarpChainAsset, AdapterFactory, WarpClientConfig, AdapterWarpExecutor, WarpChainInfo, WarpExecutable, AdapterWarpWallet, WarpAdapterGenericTransaction, WarpWalletDetails } from '@vleap/warps';
4
2
 
5
3
  declare const NativeTokenSet: WarpChainAsset;
6
4
  declare const getFastsetAdapter: AdapterFactory;
7
5
 
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;
26
- };
27
- }
28
- interface TokenMetadata {
29
- update_id: number;
30
- admin: number[];
31
- token_name: string;
32
- decimals: number;
33
- total_supply: string;
34
- mints: number[][];
35
- }
36
- interface TokenInfoResponse {
37
- requested_token_metadata: Array<[number[], TokenMetadata]>;
38
- }
39
6
  interface TransactionData {
40
- sender: number[];
7
+ sender: number[] | Uint8Array;
41
8
  recipient: any;
42
9
  nonce: number;
43
- timestamp_nanos: string;
10
+ timestamp_nanos: bigint;
44
11
  claim: any;
45
12
  }
13
+ declare class Transaction {
14
+ private sender;
15
+ private recipient;
16
+ private nonce;
17
+ private claim;
18
+ private timestamp;
19
+ constructor(sender: Uint8Array, recipient: {
20
+ FastSet: Uint8Array;
21
+ } | {
22
+ External: Uint8Array;
23
+ }, nonce: number, claim: any, timestamp?: bigint);
24
+ toTransaction(): {
25
+ sender: Uint8Array<ArrayBufferLike>;
26
+ recipient: {
27
+ FastSet: Uint8Array;
28
+ } | {
29
+ External: Uint8Array;
30
+ };
31
+ nonce: number;
32
+ timestamp_nanos: bigint;
33
+ claim: any;
34
+ };
35
+ getRecipientAddress(): {
36
+ FastSet: Uint8Array;
37
+ } | {
38
+ External: Uint8Array;
39
+ };
40
+ getAmount(): any;
41
+ getUserData(): any;
42
+ }
43
+ interface AccountInfoResponse {
44
+ sender: number[];
45
+ balance: string;
46
+ next_nonce: number;
47
+ pending_confirmation?: any;
48
+ requested_certificate?: any;
49
+ requested_validated_transaction?: any;
50
+ requested_received_transfers: any[];
51
+ token_balance: Array<[number[], string]>;
52
+ requested_claim_by_id?: any;
53
+ requested_claims: any[];
54
+ }
46
55
  interface AccountInfoResponse {
47
56
  sender: number[];
48
57
  balance: string;
@@ -56,90 +65,60 @@ interface AccountInfoResponse {
56
65
  requested_claims: any[];
57
66
  }
58
67
  declare class FastsetClient {
59
- private readonly apiUrl;
68
+ private proxyUrl;
60
69
  constructor(config?: WarpClientConfig | {
61
70
  proxyUrl: string;
62
71
  }, chain?: any);
63
72
  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[]>;
73
+ getAccountInfo(address: number[]): Promise<AccountInfoResponse>;
69
74
  getNextNonce(address: string | number[]): Promise<number>;
70
- submitTransaction(transaction: TransactionData, signature: number[] | Uint8Array): Promise<any>;
75
+ submitTransaction(transaction: TransactionData, signature: number[] | Uint8Array): Promise<string>;
76
+ faucetDrip(recipient: number[] | Uint8Array, amount: string): Promise<any>;
71
77
  private addressToBytes;
78
+ generateNewWallet(): Wallet;
79
+ createWallet(privateKeyHex: string): Wallet;
80
+ static decodeBech32Address(address: string): Uint8Array;
81
+ static encodeBech32Address(publicKey: Uint8Array): string;
72
82
  }
73
-
74
- declare class WarpFastsetDataLoader implements AdapterWarpDataLoader {
75
- private readonly config;
76
- private readonly chain;
77
- private client;
78
- constructor(config: WarpClientConfig, chain: WarpChainInfo);
79
- private addressToBytes;
80
- getAccount(address: string): Promise<WarpChainAccount>;
81
- getAccountAssets(address: string): Promise<WarpChainAsset[]>;
82
- getAsset(identifier: string): Promise<WarpChainAsset | null>;
83
- getAction(identifier: string, awaitCompleted?: boolean): Promise<WarpChainAction | null>;
84
- getAccountActions(address: string, options?: WarpDataLoaderOptions): Promise<WarpChainAction[]>;
83
+ declare class Wallet {
84
+ readonly publicKey: Uint8Array;
85
+ private readonly privateKey;
86
+ constructor(privateKeyHex: string);
87
+ toBech32(): string;
88
+ signTransactionRaw(data: Uint8Array): Uint8Array;
89
+ getPrivateKey(): Uint8Array;
85
90
  }
86
91
 
87
92
  declare class WarpFastsetExecutor implements AdapterWarpExecutor {
88
93
  private readonly config;
89
94
  private readonly chain;
90
- private readonly serializer;
91
95
  private readonly fastsetClient;
92
96
  constructor(config: WarpClientConfig, chain: WarpChainInfo);
93
97
  createTransaction(executable: WarpExecutable): Promise<any>;
94
- createTransferTransaction(executable: WarpExecutable): Promise<any>;
98
+ createTransferTransaction(executable: WarpExecutable): Promise<Transaction>;
95
99
  createContractCallTransaction(executable: WarpExecutable): Promise<any>;
96
100
  executeQuery(executable: WarpExecutable): Promise<any>;
97
- signMessage(message: string, privateKey: string): Promise<string>;
98
- private signTransaction;
99
101
  executeTransfer(executable: WarpExecutable): Promise<any>;
100
102
  executeTransferWithKey(executable: WarpExecutable, privateKey: string): Promise<any>;
101
- private encodeFunctionData;
103
+ private signTransaction;
104
+ private serializeTransaction;
102
105
  private executeFastsetQuery;
103
- private isValidFastsetAddress;
104
106
  private fromBase64;
105
- private normalizeAmount;
106
- }
107
-
108
- declare class WarpFastsetExplorer implements AdapterWarpExplorer {
109
- private readonly _chainInfo;
110
- private readonly _config?;
111
- private readonly explorerUrl;
112
- constructor(_chainInfo: WarpChainInfo, _config?: WarpClientConfig | undefined);
113
- getAccountUrl(address: string): string;
114
- getTransactionUrl(hash: string): string;
115
- getAssetUrl(identifier: string): string;
116
- getContractUrl(address: string): string;
117
107
  }
118
108
 
119
- declare class WarpFastsetResults implements AdapterWarpResults {
120
- private readonly config;
121
- private readonly chain;
122
- private readonly serializer;
109
+ declare class WarpFastsetWallet implements AdapterWarpWallet {
110
+ private config;
111
+ private chain;
112
+ private wallet;
123
113
  constructor(config: WarpClientConfig, chain: WarpChainInfo);
124
- getTransactionExecutionResults(warp: Warp, tx: any): Promise<WarpExecution>;
125
- extractQueryResults(warp: Warp, typedValues: any[], actionIndex: number, inputs: ResolvedInput[]): Promise<{
126
- values: any[];
127
- results: WarpExecutionResults;
128
- }>;
129
- private isTransactionSuccessful;
130
- private extractTransactionHash;
131
- private extractBlockNumber;
132
- private extractTimestamp;
133
- }
134
-
135
- declare class WarpFastsetSerializer implements AdapterWarpSerializer {
136
- readonly coreSerializer: WarpSerializer;
137
- constructor();
138
- typedToString(value: any): string;
139
- typedToNative(value: any): [WarpActionInputType, WarpNativeValue];
140
- nativeToTyped(type: WarpActionInputType, value: WarpNativeValue): any;
141
- nativeToType(type: BaseWarpActionInputType): WarpAdapterGenericType;
142
- stringToTyped(value: string): any;
114
+ private initializeWallet;
115
+ signTransaction(tx: WarpAdapterGenericTransaction): Promise<WarpAdapterGenericTransaction>;
116
+ signMessage(message: string): Promise<string>;
117
+ sendTransaction(tx: WarpAdapterGenericTransaction): Promise<string>;
118
+ create(mnemonic: string): WarpWalletDetails;
119
+ generate(): WarpWalletDetails;
120
+ getAddress(): string | null;
121
+ private serializeTransaction;
143
122
  }
144
123
 
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 };
124
+ export { FastsetClient, NativeTokenSet, Transaction, Wallet, WarpFastsetExecutor, WarpFastsetWallet, getFastsetAdapter };
package/dist/index.d.ts CHANGED
@@ -1,48 +1,57 @@
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';
2
-
3
- declare const WarpFastsetConstants: {};
1
+ import { WarpChainAsset, AdapterFactory, WarpClientConfig, AdapterWarpExecutor, WarpChainInfo, WarpExecutable, AdapterWarpWallet, WarpAdapterGenericTransaction, WarpWalletDetails } from '@vleap/warps';
4
2
 
5
3
  declare const NativeTokenSet: WarpChainAsset;
6
4
  declare const getFastsetAdapter: AdapterFactory;
7
5
 
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;
26
- };
27
- }
28
- interface TokenMetadata {
29
- update_id: number;
30
- admin: number[];
31
- token_name: string;
32
- decimals: number;
33
- total_supply: string;
34
- mints: number[][];
35
- }
36
- interface TokenInfoResponse {
37
- requested_token_metadata: Array<[number[], TokenMetadata]>;
38
- }
39
6
  interface TransactionData {
40
- sender: number[];
7
+ sender: number[] | Uint8Array;
41
8
  recipient: any;
42
9
  nonce: number;
43
- timestamp_nanos: string;
10
+ timestamp_nanos: bigint;
44
11
  claim: any;
45
12
  }
13
+ declare class Transaction {
14
+ private sender;
15
+ private recipient;
16
+ private nonce;
17
+ private claim;
18
+ private timestamp;
19
+ constructor(sender: Uint8Array, recipient: {
20
+ FastSet: Uint8Array;
21
+ } | {
22
+ External: Uint8Array;
23
+ }, nonce: number, claim: any, timestamp?: bigint);
24
+ toTransaction(): {
25
+ sender: Uint8Array<ArrayBufferLike>;
26
+ recipient: {
27
+ FastSet: Uint8Array;
28
+ } | {
29
+ External: Uint8Array;
30
+ };
31
+ nonce: number;
32
+ timestamp_nanos: bigint;
33
+ claim: any;
34
+ };
35
+ getRecipientAddress(): {
36
+ FastSet: Uint8Array;
37
+ } | {
38
+ External: Uint8Array;
39
+ };
40
+ getAmount(): any;
41
+ getUserData(): any;
42
+ }
43
+ interface AccountInfoResponse {
44
+ sender: number[];
45
+ balance: string;
46
+ next_nonce: number;
47
+ pending_confirmation?: any;
48
+ requested_certificate?: any;
49
+ requested_validated_transaction?: any;
50
+ requested_received_transfers: any[];
51
+ token_balance: Array<[number[], string]>;
52
+ requested_claim_by_id?: any;
53
+ requested_claims: any[];
54
+ }
46
55
  interface AccountInfoResponse {
47
56
  sender: number[];
48
57
  balance: string;
@@ -56,90 +65,60 @@ interface AccountInfoResponse {
56
65
  requested_claims: any[];
57
66
  }
58
67
  declare class FastsetClient {
59
- private readonly apiUrl;
68
+ private proxyUrl;
60
69
  constructor(config?: WarpClientConfig | {
61
70
  proxyUrl: string;
62
71
  }, chain?: any);
63
72
  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[]>;
73
+ getAccountInfo(address: number[]): Promise<AccountInfoResponse>;
69
74
  getNextNonce(address: string | number[]): Promise<number>;
70
- submitTransaction(transaction: TransactionData, signature: number[] | Uint8Array): Promise<any>;
75
+ submitTransaction(transaction: TransactionData, signature: number[] | Uint8Array): Promise<string>;
76
+ faucetDrip(recipient: number[] | Uint8Array, amount: string): Promise<any>;
71
77
  private addressToBytes;
78
+ generateNewWallet(): Wallet;
79
+ createWallet(privateKeyHex: string): Wallet;
80
+ static decodeBech32Address(address: string): Uint8Array;
81
+ static encodeBech32Address(publicKey: Uint8Array): string;
72
82
  }
73
-
74
- declare class WarpFastsetDataLoader implements AdapterWarpDataLoader {
75
- private readonly config;
76
- private readonly chain;
77
- private client;
78
- constructor(config: WarpClientConfig, chain: WarpChainInfo);
79
- private addressToBytes;
80
- getAccount(address: string): Promise<WarpChainAccount>;
81
- getAccountAssets(address: string): Promise<WarpChainAsset[]>;
82
- getAsset(identifier: string): Promise<WarpChainAsset | null>;
83
- getAction(identifier: string, awaitCompleted?: boolean): Promise<WarpChainAction | null>;
84
- getAccountActions(address: string, options?: WarpDataLoaderOptions): Promise<WarpChainAction[]>;
83
+ declare class Wallet {
84
+ readonly publicKey: Uint8Array;
85
+ private readonly privateKey;
86
+ constructor(privateKeyHex: string);
87
+ toBech32(): string;
88
+ signTransactionRaw(data: Uint8Array): Uint8Array;
89
+ getPrivateKey(): Uint8Array;
85
90
  }
86
91
 
87
92
  declare class WarpFastsetExecutor implements AdapterWarpExecutor {
88
93
  private readonly config;
89
94
  private readonly chain;
90
- private readonly serializer;
91
95
  private readonly fastsetClient;
92
96
  constructor(config: WarpClientConfig, chain: WarpChainInfo);
93
97
  createTransaction(executable: WarpExecutable): Promise<any>;
94
- createTransferTransaction(executable: WarpExecutable): Promise<any>;
98
+ createTransferTransaction(executable: WarpExecutable): Promise<Transaction>;
95
99
  createContractCallTransaction(executable: WarpExecutable): Promise<any>;
96
100
  executeQuery(executable: WarpExecutable): Promise<any>;
97
- signMessage(message: string, privateKey: string): Promise<string>;
98
- private signTransaction;
99
101
  executeTransfer(executable: WarpExecutable): Promise<any>;
100
102
  executeTransferWithKey(executable: WarpExecutable, privateKey: string): Promise<any>;
101
- private encodeFunctionData;
103
+ private signTransaction;
104
+ private serializeTransaction;
102
105
  private executeFastsetQuery;
103
- private isValidFastsetAddress;
104
106
  private fromBase64;
105
- private normalizeAmount;
106
- }
107
-
108
- declare class WarpFastsetExplorer implements AdapterWarpExplorer {
109
- private readonly _chainInfo;
110
- private readonly _config?;
111
- private readonly explorerUrl;
112
- constructor(_chainInfo: WarpChainInfo, _config?: WarpClientConfig | undefined);
113
- getAccountUrl(address: string): string;
114
- getTransactionUrl(hash: string): string;
115
- getAssetUrl(identifier: string): string;
116
- getContractUrl(address: string): string;
117
107
  }
118
108
 
119
- declare class WarpFastsetResults implements AdapterWarpResults {
120
- private readonly config;
121
- private readonly chain;
122
- private readonly serializer;
109
+ declare class WarpFastsetWallet implements AdapterWarpWallet {
110
+ private config;
111
+ private chain;
112
+ private wallet;
123
113
  constructor(config: WarpClientConfig, chain: WarpChainInfo);
124
- getTransactionExecutionResults(warp: Warp, tx: any): Promise<WarpExecution>;
125
- extractQueryResults(warp: Warp, typedValues: any[], actionIndex: number, inputs: ResolvedInput[]): Promise<{
126
- values: any[];
127
- results: WarpExecutionResults;
128
- }>;
129
- private isTransactionSuccessful;
130
- private extractTransactionHash;
131
- private extractBlockNumber;
132
- private extractTimestamp;
133
- }
134
-
135
- declare class WarpFastsetSerializer implements AdapterWarpSerializer {
136
- readonly coreSerializer: WarpSerializer;
137
- constructor();
138
- typedToString(value: any): string;
139
- typedToNative(value: any): [WarpActionInputType, WarpNativeValue];
140
- nativeToTyped(type: WarpActionInputType, value: WarpNativeValue): any;
141
- nativeToType(type: BaseWarpActionInputType): WarpAdapterGenericType;
142
- stringToTyped(value: string): any;
114
+ private initializeWallet;
115
+ signTransaction(tx: WarpAdapterGenericTransaction): Promise<WarpAdapterGenericTransaction>;
116
+ signMessage(message: string): Promise<string>;
117
+ sendTransaction(tx: WarpAdapterGenericTransaction): Promise<string>;
118
+ create(mnemonic: string): WarpWalletDetails;
119
+ generate(): WarpWalletDetails;
120
+ getAddress(): string | null;
121
+ private serializeTransaction;
143
122
  }
144
123
 
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 };
124
+ export { FastsetClient, NativeTokenSet, Transaction, Wallet, WarpFastsetExecutor, WarpFastsetWallet, getFastsetAdapter };