@vleap/warps-adapter-fastset 0.1.0-alpha.2 → 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.
@@ -0,0 +1,145 @@
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: {};
4
+
5
+ declare const NativeTokenSet: WarpChainAsset;
6
+ declare const getFastsetAdapter: AdapterFactory;
7
+
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
+ interface TransactionData {
40
+ sender: number[];
41
+ recipient: any;
42
+ nonce: number;
43
+ timestamp_nanos: string;
44
+ claim: any;
45
+ }
46
+ interface AccountInfoResponse {
47
+ sender: number[];
48
+ balance: 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[];
57
+ }
58
+ declare class FastsetClient {
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;
72
+ }
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[]>;
85
+ }
86
+
87
+ declare class WarpFastsetExecutor implements AdapterWarpExecutor {
88
+ private readonly config;
89
+ private readonly chain;
90
+ private readonly serializer;
91
+ private readonly fastsetClient;
92
+ constructor(config: WarpClientConfig, chain: WarpChainInfo);
93
+ createTransaction(executable: WarpExecutable): Promise<any>;
94
+ createTransferTransaction(executable: WarpExecutable): Promise<any>;
95
+ createContractCallTransaction(executable: WarpExecutable): Promise<any>;
96
+ executeQuery(executable: WarpExecutable): Promise<any>;
97
+ signMessage(message: string, privateKey: string): Promise<string>;
98
+ private signTransaction;
99
+ executeTransfer(executable: WarpExecutable): Promise<any>;
100
+ executeTransferWithKey(executable: WarpExecutable, privateKey: string): Promise<any>;
101
+ private encodeFunctionData;
102
+ private executeFastsetQuery;
103
+ private isValidFastsetAddress;
104
+ 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
+ }
118
+
119
+ declare class WarpFastsetResults implements AdapterWarpResults {
120
+ private readonly config;
121
+ private readonly chain;
122
+ private readonly serializer;
123
+ 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;
143
+ }
144
+
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 };
package/dist/index.d.ts CHANGED
@@ -1,122 +1,135 @@
1
- import { AdapterFactory, CombinedWarpBuilder, WarpClientConfig, Warp, BaseWarpBuilder, WarpAction, AdapterWarpExecutor, WarpExecutable, WarpChainInfo, WarpActionInputType, AdapterWarpExplorer, AdapterWarpResults, WarpExecution, ResolvedInput, WarpExecutionResults, AdapterWarpSerializer, WarpSerializer, WarpNativeValue, BaseWarpActionInputType, WarpAdapterGenericType } from '@vleap/warps';
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
2
 
3
- declare const WarpFastsetConstants: {
4
- ChainName: string;
5
- ChainPrefix: string;
6
- Pi: {
7
- Identifier: string;
8
- DisplayName: string;
9
- Decimals: number;
10
- };
11
- GasLimit: {
12
- Default: number;
13
- ContractCall: number;
14
- ContractDeploy: number;
15
- Transfer: number;
16
- Approve: number;
17
- Swap: number;
18
- };
19
- GasPrice: {
20
- Default: string;
21
- Low: string;
22
- Medium: string;
23
- High: string;
24
- };
25
- Network: {
26
- Mainnet: {
27
- ChainId: string;
28
- Name: string;
29
- BlockTime: number;
30
- };
31
- Testnet: {
32
- ChainId: string;
33
- Name: string;
34
- BlockTime: number;
35
- };
36
- Devnet: {
37
- ChainId: string;
38
- Name: string;
39
- BlockTime: number;
40
- };
41
- };
42
- Validation: {
43
- AddressLength: number;
44
- HexPrefix: string;
45
- MinGasLimit: number;
46
- MaxGasLimit: number;
47
- };
48
- Timeouts: {
49
- DefaultRpcTimeout: number;
50
- GasEstimationTimeout: number;
51
- QueryTimeout: number;
52
- };
53
- };
3
+ declare const WarpFastsetConstants: {};
54
4
 
5
+ declare const NativeTokenSet: WarpChainAsset;
55
6
  declare const getFastsetAdapter: AdapterFactory;
56
7
 
57
- declare class WarpFastsetBuilder implements CombinedWarpBuilder {
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
+ interface TransactionData {
40
+ sender: number[];
41
+ recipient: any;
42
+ nonce: number;
43
+ timestamp_nanos: string;
44
+ claim: any;
45
+ }
46
+ interface AccountInfoResponse {
47
+ sender: number[];
48
+ balance: 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[];
57
+ }
58
+ declare class FastsetClient {
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;
72
+ }
73
+
74
+ declare class WarpFastsetDataLoader implements AdapterWarpDataLoader {
58
75
  private readonly config;
59
- private warp;
60
- private actions;
61
- constructor(config: WarpClientConfig);
62
- createFromRaw(encoded: string): Promise<Warp>;
63
- setTitle(title: string): BaseWarpBuilder;
64
- setDescription(description: string): BaseWarpBuilder;
65
- setPreview(preview: string): BaseWarpBuilder;
66
- setActions(actions: WarpAction[]): BaseWarpBuilder;
67
- addAction(action: WarpAction): BaseWarpBuilder;
68
- build(): Promise<Warp>;
69
- createInscriptionTransaction(warp: Warp): any;
70
- createFromTransaction(tx: any, validate?: boolean): Promise<Warp>;
71
- createFromTransactionHash(hash: string, cache?: any): Promise<Warp | null>;
72
- private generateHash;
73
- private validateWarp;
74
- private fetchTransaction;
75
- private getApiUrl;
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[]>;
76
85
  }
77
86
 
78
87
  declare class WarpFastsetExecutor implements AdapterWarpExecutor {
79
88
  private readonly config;
89
+ private readonly chain;
80
90
  private readonly serializer;
81
- constructor(config: WarpClientConfig);
91
+ private readonly fastsetClient;
92
+ constructor(config: WarpClientConfig, chain: WarpChainInfo);
82
93
  createTransaction(executable: WarpExecutable): Promise<any>;
83
94
  createTransferTransaction(executable: WarpExecutable): Promise<any>;
84
95
  createContractCallTransaction(executable: WarpExecutable): Promise<any>;
85
96
  executeQuery(executable: WarpExecutable): Promise<any>;
86
- preprocessInput(chain: WarpChainInfo, input: string, type: WarpActionInputType, value: string): Promise<string>;
87
- private isValidFastsetAddress;
97
+ signMessage(message: string, privateKey: string): Promise<string>;
98
+ private signTransaction;
99
+ executeTransfer(executable: WarpExecutable): Promise<any>;
100
+ executeTransferWithKey(executable: WarpExecutable, privateKey: string): Promise<any>;
88
101
  private encodeFunctionData;
89
102
  private executeFastsetQuery;
90
- signMessage(message: string, privateKey: string): Promise<string>;
103
+ private isValidFastsetAddress;
104
+ private fromBase64;
105
+ private normalizeAmount;
91
106
  }
92
107
 
93
108
  declare class WarpFastsetExplorer implements AdapterWarpExplorer {
94
- private readonly chainInfo;
95
- private readonly chainName;
96
- constructor(chainInfo: WarpChainInfo, chainName?: string);
109
+ private readonly _chainInfo;
110
+ private readonly _config?;
111
+ private readonly explorerUrl;
112
+ constructor(_chainInfo: WarpChainInfo, _config?: WarpClientConfig | undefined);
97
113
  getAccountUrl(address: string): string;
98
114
  getTransactionUrl(hash: string): string;
99
- getBlockUrl(blockNumber: string | number): string;
115
+ getAssetUrl(identifier: string): string;
100
116
  getContractUrl(address: string): string;
101
- getTokenUrl(address: string): string;
102
- private getDefaultExplorerUrl;
103
117
  }
104
118
 
105
119
  declare class WarpFastsetResults implements AdapterWarpResults {
106
120
  private readonly config;
121
+ private readonly chain;
107
122
  private readonly serializer;
108
- constructor(config: WarpClientConfig);
123
+ constructor(config: WarpClientConfig, chain: WarpChainInfo);
109
124
  getTransactionExecutionResults(warp: Warp, tx: any): Promise<WarpExecution>;
110
125
  extractQueryResults(warp: Warp, typedValues: any[], actionIndex: number, inputs: ResolvedInput[]): Promise<{
111
126
  values: any[];
112
127
  results: WarpExecutionResults;
113
128
  }>;
114
129
  private isTransactionSuccessful;
115
- private extractGasUsed;
116
- private extractGasPrice;
117
- private extractBlockNumber;
118
130
  private extractTransactionHash;
119
- private extractLogs;
131
+ private extractBlockNumber;
132
+ private extractTimestamp;
120
133
  }
121
134
 
122
135
  declare class WarpFastsetSerializer implements AdapterWarpSerializer {
@@ -129,4 +142,4 @@ declare class WarpFastsetSerializer implements AdapterWarpSerializer {
129
142
  stringToTyped(value: string): any;
130
143
  }
131
144
 
132
- export { WarpFastsetBuilder, WarpFastsetConstants, 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 };