@vleap/warps-adapter-fastset 0.1.0-alpha.2 → 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.
@@ -0,0 +1,124 @@
1
+ import { WarpChainAsset, AdapterFactory, WarpClientConfig, AdapterWarpExecutor, WarpChainInfo, WarpExecutable, AdapterWarpWallet, WarpAdapterGenericTransaction, WarpWalletDetails } from '@vleap/warps';
2
+
3
+ declare const NativeTokenSet: WarpChainAsset;
4
+ declare const getFastsetAdapter: AdapterFactory;
5
+
6
+ interface TransactionData {
7
+ sender: number[] | Uint8Array;
8
+ recipient: any;
9
+ nonce: number;
10
+ timestamp_nanos: bigint;
11
+ claim: any;
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
+ }
55
+ interface AccountInfoResponse {
56
+ sender: number[];
57
+ balance: string;
58
+ next_nonce: number;
59
+ pending_confirmation?: any;
60
+ requested_certificate?: any;
61
+ requested_validated_transaction?: any;
62
+ requested_received_transfers: any[];
63
+ token_balance: Array<[number[], string]>;
64
+ requested_claim_by_id?: any;
65
+ requested_claims: any[];
66
+ }
67
+ declare class FastsetClient {
68
+ private proxyUrl;
69
+ constructor(config?: WarpClientConfig | {
70
+ proxyUrl: string;
71
+ }, chain?: any);
72
+ private makeRequest;
73
+ getAccountInfo(address: number[]): Promise<AccountInfoResponse>;
74
+ getNextNonce(address: string | number[]): Promise<number>;
75
+ submitTransaction(transaction: TransactionData, signature: number[] | Uint8Array): Promise<string>;
76
+ faucetDrip(recipient: number[] | Uint8Array, amount: string): Promise<any>;
77
+ private addressToBytes;
78
+ generateNewWallet(): Wallet;
79
+ createWallet(privateKeyHex: string): Wallet;
80
+ static decodeBech32Address(address: string): Uint8Array;
81
+ static encodeBech32Address(publicKey: Uint8Array): string;
82
+ }
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;
90
+ }
91
+
92
+ declare class WarpFastsetExecutor implements AdapterWarpExecutor {
93
+ private readonly config;
94
+ private readonly chain;
95
+ private readonly fastsetClient;
96
+ constructor(config: WarpClientConfig, chain: WarpChainInfo);
97
+ createTransaction(executable: WarpExecutable): Promise<any>;
98
+ createTransferTransaction(executable: WarpExecutable): Promise<Transaction>;
99
+ createContractCallTransaction(executable: WarpExecutable): Promise<any>;
100
+ executeQuery(executable: WarpExecutable): Promise<any>;
101
+ executeTransfer(executable: WarpExecutable): Promise<any>;
102
+ executeTransferWithKey(executable: WarpExecutable, privateKey: string): Promise<any>;
103
+ private signTransaction;
104
+ private serializeTransaction;
105
+ private executeFastsetQuery;
106
+ private fromBase64;
107
+ }
108
+
109
+ declare class WarpFastsetWallet implements AdapterWarpWallet {
110
+ private config;
111
+ private chain;
112
+ private wallet;
113
+ constructor(config: WarpClientConfig, chain: WarpChainInfo);
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;
122
+ }
123
+
124
+ export { FastsetClient, NativeTokenSet, Transaction, Wallet, WarpFastsetExecutor, WarpFastsetWallet, getFastsetAdapter };
package/dist/index.d.ts CHANGED
@@ -1,132 +1,124 @@
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, AdapterWarpExecutor, WarpChainInfo, WarpExecutable, AdapterWarpWallet, WarpAdapterGenericTransaction, WarpWalletDetails } 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;
3
+ declare const NativeTokenSet: WarpChainAsset;
4
+ declare const getFastsetAdapter: AdapterFactory;
5
+
6
+ interface TransactionData {
7
+ sender: number[] | Uint8Array;
8
+ recipient: any;
9
+ nonce: number;
10
+ timestamp_nanos: bigint;
11
+ claim: any;
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;
40
30
  };
31
+ nonce: number;
32
+ timestamp_nanos: bigint;
33
+ claim: any;
41
34
  };
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;
35
+ getRecipientAddress(): {
36
+ FastSet: Uint8Array;
37
+ } | {
38
+ External: Uint8Array;
52
39
  };
53
- };
54
-
55
- declare const getFastsetAdapter: AdapterFactory;
56
-
57
- declare class WarpFastsetBuilder implements CombinedWarpBuilder {
58
- 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;
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
+ }
55
+ interface AccountInfoResponse {
56
+ sender: number[];
57
+ balance: string;
58
+ next_nonce: number;
59
+ pending_confirmation?: any;
60
+ requested_certificate?: any;
61
+ requested_validated_transaction?: any;
62
+ requested_received_transfers: any[];
63
+ token_balance: Array<[number[], string]>;
64
+ requested_claim_by_id?: any;
65
+ requested_claims: any[];
66
+ }
67
+ declare class FastsetClient {
68
+ private proxyUrl;
69
+ constructor(config?: WarpClientConfig | {
70
+ proxyUrl: string;
71
+ }, chain?: any);
72
+ private makeRequest;
73
+ getAccountInfo(address: number[]): Promise<AccountInfoResponse>;
74
+ getNextNonce(address: string | number[]): Promise<number>;
75
+ submitTransaction(transaction: TransactionData, signature: number[] | Uint8Array): Promise<string>;
76
+ faucetDrip(recipient: number[] | Uint8Array, amount: string): Promise<any>;
77
+ private addressToBytes;
78
+ generateNewWallet(): Wallet;
79
+ createWallet(privateKeyHex: string): Wallet;
80
+ static decodeBech32Address(address: string): Uint8Array;
81
+ static encodeBech32Address(publicKey: Uint8Array): string;
82
+ }
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;
76
90
  }
77
91
 
78
92
  declare class WarpFastsetExecutor implements AdapterWarpExecutor {
79
93
  private readonly config;
80
- private readonly serializer;
81
- constructor(config: WarpClientConfig);
94
+ private readonly chain;
95
+ private readonly fastsetClient;
96
+ constructor(config: WarpClientConfig, chain: WarpChainInfo);
82
97
  createTransaction(executable: WarpExecutable): Promise<any>;
83
- createTransferTransaction(executable: WarpExecutable): Promise<any>;
98
+ createTransferTransaction(executable: WarpExecutable): Promise<Transaction>;
84
99
  createContractCallTransaction(executable: WarpExecutable): Promise<any>;
85
100
  executeQuery(executable: WarpExecutable): Promise<any>;
86
- preprocessInput(chain: WarpChainInfo, input: string, type: WarpActionInputType, value: string): Promise<string>;
87
- private isValidFastsetAddress;
88
- private encodeFunctionData;
101
+ executeTransfer(executable: WarpExecutable): Promise<any>;
102
+ executeTransferWithKey(executable: WarpExecutable, privateKey: string): Promise<any>;
103
+ private signTransaction;
104
+ private serializeTransaction;
89
105
  private executeFastsetQuery;
90
- signMessage(message: string, privateKey: string): Promise<string>;
91
- }
92
-
93
- declare class WarpFastsetExplorer implements AdapterWarpExplorer {
94
- private readonly chainInfo;
95
- private readonly chainName;
96
- constructor(chainInfo: WarpChainInfo, chainName?: string);
97
- getAccountUrl(address: string): string;
98
- getTransactionUrl(hash: string): string;
99
- getBlockUrl(blockNumber: string | number): string;
100
- getContractUrl(address: string): string;
101
- getTokenUrl(address: string): string;
102
- private getDefaultExplorerUrl;
103
- }
104
-
105
- declare class WarpFastsetResults implements AdapterWarpResults {
106
- private readonly config;
107
- private readonly serializer;
108
- constructor(config: WarpClientConfig);
109
- getTransactionExecutionResults(warp: Warp, tx: any): Promise<WarpExecution>;
110
- extractQueryResults(warp: Warp, typedValues: any[], actionIndex: number, inputs: ResolvedInput[]): Promise<{
111
- values: any[];
112
- results: WarpExecutionResults;
113
- }>;
114
- private isTransactionSuccessful;
115
- private extractGasUsed;
116
- private extractGasPrice;
117
- private extractBlockNumber;
118
- private extractTransactionHash;
119
- private extractLogs;
106
+ private fromBase64;
120
107
  }
121
108
 
122
- declare class WarpFastsetSerializer implements AdapterWarpSerializer {
123
- readonly coreSerializer: WarpSerializer;
124
- constructor();
125
- typedToString(value: any): string;
126
- typedToNative(value: any): [WarpActionInputType, WarpNativeValue];
127
- nativeToTyped(type: WarpActionInputType, value: WarpNativeValue): any;
128
- nativeToType(type: BaseWarpActionInputType): WarpAdapterGenericType;
129
- stringToTyped(value: string): any;
109
+ declare class WarpFastsetWallet implements AdapterWarpWallet {
110
+ private config;
111
+ private chain;
112
+ private wallet;
113
+ constructor(config: WarpClientConfig, chain: WarpChainInfo);
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;
130
122
  }
131
123
 
132
- export { WarpFastsetBuilder, WarpFastsetConstants, WarpFastsetExecutor, WarpFastsetExplorer, WarpFastsetResults, WarpFastsetSerializer, getFastsetAdapter };
124
+ export { FastsetClient, NativeTokenSet, Transaction, Wallet, WarpFastsetExecutor, WarpFastsetWallet, getFastsetAdapter };