@vleap/warps-adapter-solana 0.1.0-beta.1

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,190 @@
1
+ import { WarpChainAsset, AdapterFactory, WarpChain, WarpChainEnv, AdapterWarpDataLoader, WarpClientConfig, WarpChainInfo, WarpChainAccount, WarpChainAction, WarpDataLoaderOptions, AdapterWarpExecutor, WarpExecutable, WarpActionExecutionResult, AdapterWarpExplorer, AdapterWarpOutput, Warp, WarpActionIndex, WarpAdapterGenericRemoteTransaction, ResolvedInput, WarpNativeValue, WarpExecutionOutput, AdapterWarpSerializer, WarpSerializer, WarpActionInputType, BaseWarpActionInputType, WarpAdapterGenericType, AdapterWarpWallet, WarpAdapterGenericTransaction } from '@vleap/warps';
2
+ import { Transaction } from '@solana/web3.js';
3
+
4
+ declare const NativeTokenSol: WarpChainAsset;
5
+ declare const getSolanaAdapter: AdapterFactory;
6
+
7
+ declare const WarpSolanaConstants: {
8
+ ComputeUnitLimit: {
9
+ Default: number;
10
+ Transfer: number;
11
+ TokenTransfer: number;
12
+ ContractCall: number;
13
+ };
14
+ PriorityFee: {
15
+ Default: number;
16
+ };
17
+ Validation: {
18
+ MinComputeUnits: number;
19
+ MaxComputeUnits: number;
20
+ };
21
+ Programs: {
22
+ TokenProgram: string;
23
+ SystemProgram: string;
24
+ };
25
+ NativeToken: {
26
+ Identifier: string;
27
+ Decimals: number;
28
+ };
29
+ };
30
+ declare enum SolanaExplorers {
31
+ Solscan = "solscan",
32
+ SolscanMainnet = "solscan_mainnet",
33
+ SolscanDevnet = "solscan_devnet",
34
+ SolanaExplorer = "solana_explorer",
35
+ SolanaExplorerMainnet = "solana_explorer_mainnet",
36
+ SolanaExplorerDevnet = "solana_explorer_devnet"
37
+ }
38
+ type ExplorerName = SolanaExplorers;
39
+ declare const SolanaExplorerMap: {
40
+ readonly solana: {
41
+ readonly mainnet: readonly [SolanaExplorers.SolscanMainnet, SolanaExplorers.SolanaExplorerMainnet];
42
+ readonly testnet: readonly [SolanaExplorers.Solscan, SolanaExplorers.SolanaExplorer];
43
+ readonly devnet: readonly [SolanaExplorers.SolscanDevnet, SolanaExplorers.SolanaExplorerDevnet];
44
+ };
45
+ };
46
+ declare const ExplorerUrls: Record<ExplorerName, string>;
47
+ declare const SolanaExplorerNames: {
48
+ readonly mainnet: readonly [SolanaExplorers.SolscanMainnet, SolanaExplorers.SolanaExplorerMainnet];
49
+ readonly testnet: readonly [SolanaExplorers.Solscan, SolanaExplorers.SolanaExplorer];
50
+ readonly devnet: readonly [SolanaExplorers.SolscanDevnet, SolanaExplorers.SolanaExplorerDevnet];
51
+ };
52
+ declare const SolanaExplorerUrls: Record<ExplorerName, string>;
53
+
54
+ declare const KnownTokens: Record<WarpChain, Record<string, WarpChainAsset[]>>;
55
+ declare const findKnownTokenById: (chain: WarpChain, env: WarpChainEnv, id: string) => WarpChainAsset | null;
56
+ declare const getKnownTokensForChain: (chainName: string, env?: string) => WarpChainAsset[];
57
+
58
+ interface TokenMetadata {
59
+ name: string;
60
+ symbol: string;
61
+ decimals: number;
62
+ logoUrl?: string;
63
+ }
64
+ interface TokenBalance {
65
+ tokenAddress: string;
66
+ balance: bigint;
67
+ metadata: TokenMetadata;
68
+ }
69
+
70
+ declare class WarpSolanaDataLoader implements AdapterWarpDataLoader {
71
+ private readonly config;
72
+ private readonly chain;
73
+ private connection;
74
+ private cache;
75
+ constructor(config: WarpClientConfig, chain: WarpChainInfo);
76
+ getAccount(address: string): Promise<WarpChainAccount>;
77
+ getAccountAssets(address: string): Promise<WarpChainAsset[]>;
78
+ getAsset(identifier: string): Promise<WarpChainAsset | null>;
79
+ getAction(identifier: string, awaitCompleted?: boolean): Promise<WarpChainAction | null>;
80
+ getAccountActions(address: string, options?: WarpDataLoaderOptions): Promise<WarpChainAction[]>;
81
+ private getTokenBalances;
82
+ private getTokenMetadata;
83
+ }
84
+
85
+ declare class WarpSolanaExecutor implements AdapterWarpExecutor {
86
+ private readonly config;
87
+ private readonly chain;
88
+ private readonly serializer;
89
+ private readonly connection;
90
+ private readonly output;
91
+ constructor(config: WarpClientConfig, chain: WarpChainInfo);
92
+ createTransaction(executable: WarpExecutable): Promise<Transaction>;
93
+ createTransferTransaction(executable: WarpExecutable): Promise<Transaction>;
94
+ createContractCallTransaction(executable: WarpExecutable): Promise<Transaction>;
95
+ private encodeInstructionData;
96
+ private encodeBasicInstructionData;
97
+ private encodeArgs;
98
+ private buildInstructionAccounts;
99
+ private createTokenTransferTransaction;
100
+ private createSingleTokenTransfer;
101
+ executeQuery(executable: WarpExecutable): Promise<WarpActionExecutionResult>;
102
+ verifyMessage(message: string, signature: string): Promise<string>;
103
+ private setTransactionDefaults;
104
+ }
105
+
106
+ declare class WarpSolanaExplorer implements AdapterWarpExplorer {
107
+ private readonly chain;
108
+ private readonly config;
109
+ constructor(chain: WarpChainInfo, config: WarpClientConfig);
110
+ private getExplorers;
111
+ private getPrimaryExplorer;
112
+ private getExplorerUrlByName;
113
+ getAccountUrl(address: string, explorer?: ExplorerName): string;
114
+ getTransactionUrl(hash: string, explorer?: ExplorerName): string;
115
+ getBlockUrl(blockNumber: string | number, explorer?: ExplorerName): string;
116
+ getAssetUrl(identifier: string, explorer?: ExplorerName): string;
117
+ getContractUrl(address: string, explorer?: ExplorerName): string;
118
+ getAllExplorers(): readonly ExplorerName[];
119
+ getExplorerByName(name: string): ExplorerName | undefined;
120
+ getAccountUrls(address: string): Record<ExplorerName, string>;
121
+ getTransactionUrls(hash: string): Record<ExplorerName, string>;
122
+ getAssetUrls(identifier: string): Record<ExplorerName, string>;
123
+ getContractUrls(address: string): Record<ExplorerName, string>;
124
+ getBlockUrls(blockNumber: string | number): Record<ExplorerName, string>;
125
+ }
126
+
127
+ declare class WarpSolanaOutput implements AdapterWarpOutput {
128
+ private readonly config;
129
+ private readonly chain;
130
+ private readonly serializer;
131
+ private readonly connection;
132
+ private readonly cache;
133
+ constructor(config: WarpClientConfig, chain: WarpChainInfo);
134
+ getActionExecution(warp: Warp, actionIndex: WarpActionIndex, tx: WarpAdapterGenericRemoteTransaction): Promise<WarpActionExecutionResult>;
135
+ private createFailedExecution;
136
+ private handleWarpChainAction;
137
+ private handleTransactionSignature;
138
+ extractQueryOutput(warp: Warp, typedValues: unknown[], actionIndex: number, inputs: ResolvedInput[]): Promise<{
139
+ values: {
140
+ string: string[];
141
+ native: WarpNativeValue[];
142
+ mapped: Record<string, any>;
143
+ };
144
+ output: WarpExecutionOutput;
145
+ }>;
146
+ getTransactionStatus(txHash: string): Promise<{
147
+ status: 'pending' | 'confirmed' | 'failed';
148
+ blockNumber?: number;
149
+ gasUsed?: bigint;
150
+ }>;
151
+ getTransactionReceipt(txHash: string): Promise<any>;
152
+ }
153
+
154
+ declare class WarpSolanaSerializer implements AdapterWarpSerializer {
155
+ readonly coreSerializer: WarpSerializer;
156
+ constructor();
157
+ typedToString(value: any): string;
158
+ typedToNative(value: any): [WarpActionInputType, WarpNativeValue];
159
+ nativeToTyped(type: WarpActionInputType, value: WarpNativeValue): any;
160
+ nativeToType(type: BaseWarpActionInputType): WarpAdapterGenericType;
161
+ stringToTyped(value: string): any;
162
+ private parseNativeValue;
163
+ }
164
+
165
+ declare class WarpSolanaWallet implements AdapterWarpWallet {
166
+ private config;
167
+ private chain;
168
+ private connection;
169
+ constructor(config: WarpClientConfig, chain: WarpChainInfo);
170
+ signTransaction(tx: WarpAdapterGenericTransaction): Promise<WarpAdapterGenericTransaction>;
171
+ signTransactions(txs: WarpAdapterGenericTransaction[]): Promise<WarpAdapterGenericTransaction[]>;
172
+ signMessage(message: string): Promise<string>;
173
+ sendTransaction(tx: WarpAdapterGenericTransaction): Promise<string>;
174
+ sendTransactions(txs: WarpAdapterGenericTransaction[]): Promise<string[]>;
175
+ create(mnemonic: string): {
176
+ address: string;
177
+ privateKey: string;
178
+ mnemonic: string;
179
+ };
180
+ generate(): {
181
+ address: string;
182
+ privateKey: string;
183
+ mnemonic: string;
184
+ };
185
+ getAddress(): string | null;
186
+ getPublicKey(): string | null;
187
+ private getKeypair;
188
+ }
189
+
190
+ export { type ExplorerName, ExplorerUrls, KnownTokens, NativeTokenSol, SolanaExplorerMap, SolanaExplorerNames, SolanaExplorerUrls, SolanaExplorers, type TokenBalance, type TokenMetadata, WarpSolanaConstants, WarpSolanaDataLoader, WarpSolanaExecutor, WarpSolanaExplorer, WarpSolanaOutput, WarpSolanaSerializer, WarpSolanaWallet, findKnownTokenById, getKnownTokensForChain, getSolanaAdapter };
@@ -0,0 +1,190 @@
1
+ import { WarpChainAsset, AdapterFactory, WarpChain, WarpChainEnv, AdapterWarpDataLoader, WarpClientConfig, WarpChainInfo, WarpChainAccount, WarpChainAction, WarpDataLoaderOptions, AdapterWarpExecutor, WarpExecutable, WarpActionExecutionResult, AdapterWarpExplorer, AdapterWarpOutput, Warp, WarpActionIndex, WarpAdapterGenericRemoteTransaction, ResolvedInput, WarpNativeValue, WarpExecutionOutput, AdapterWarpSerializer, WarpSerializer, WarpActionInputType, BaseWarpActionInputType, WarpAdapterGenericType, AdapterWarpWallet, WarpAdapterGenericTransaction } from '@vleap/warps';
2
+ import { Transaction } from '@solana/web3.js';
3
+
4
+ declare const NativeTokenSol: WarpChainAsset;
5
+ declare const getSolanaAdapter: AdapterFactory;
6
+
7
+ declare const WarpSolanaConstants: {
8
+ ComputeUnitLimit: {
9
+ Default: number;
10
+ Transfer: number;
11
+ TokenTransfer: number;
12
+ ContractCall: number;
13
+ };
14
+ PriorityFee: {
15
+ Default: number;
16
+ };
17
+ Validation: {
18
+ MinComputeUnits: number;
19
+ MaxComputeUnits: number;
20
+ };
21
+ Programs: {
22
+ TokenProgram: string;
23
+ SystemProgram: string;
24
+ };
25
+ NativeToken: {
26
+ Identifier: string;
27
+ Decimals: number;
28
+ };
29
+ };
30
+ declare enum SolanaExplorers {
31
+ Solscan = "solscan",
32
+ SolscanMainnet = "solscan_mainnet",
33
+ SolscanDevnet = "solscan_devnet",
34
+ SolanaExplorer = "solana_explorer",
35
+ SolanaExplorerMainnet = "solana_explorer_mainnet",
36
+ SolanaExplorerDevnet = "solana_explorer_devnet"
37
+ }
38
+ type ExplorerName = SolanaExplorers;
39
+ declare const SolanaExplorerMap: {
40
+ readonly solana: {
41
+ readonly mainnet: readonly [SolanaExplorers.SolscanMainnet, SolanaExplorers.SolanaExplorerMainnet];
42
+ readonly testnet: readonly [SolanaExplorers.Solscan, SolanaExplorers.SolanaExplorer];
43
+ readonly devnet: readonly [SolanaExplorers.SolscanDevnet, SolanaExplorers.SolanaExplorerDevnet];
44
+ };
45
+ };
46
+ declare const ExplorerUrls: Record<ExplorerName, string>;
47
+ declare const SolanaExplorerNames: {
48
+ readonly mainnet: readonly [SolanaExplorers.SolscanMainnet, SolanaExplorers.SolanaExplorerMainnet];
49
+ readonly testnet: readonly [SolanaExplorers.Solscan, SolanaExplorers.SolanaExplorer];
50
+ readonly devnet: readonly [SolanaExplorers.SolscanDevnet, SolanaExplorers.SolanaExplorerDevnet];
51
+ };
52
+ declare const SolanaExplorerUrls: Record<ExplorerName, string>;
53
+
54
+ declare const KnownTokens: Record<WarpChain, Record<string, WarpChainAsset[]>>;
55
+ declare const findKnownTokenById: (chain: WarpChain, env: WarpChainEnv, id: string) => WarpChainAsset | null;
56
+ declare const getKnownTokensForChain: (chainName: string, env?: string) => WarpChainAsset[];
57
+
58
+ interface TokenMetadata {
59
+ name: string;
60
+ symbol: string;
61
+ decimals: number;
62
+ logoUrl?: string;
63
+ }
64
+ interface TokenBalance {
65
+ tokenAddress: string;
66
+ balance: bigint;
67
+ metadata: TokenMetadata;
68
+ }
69
+
70
+ declare class WarpSolanaDataLoader implements AdapterWarpDataLoader {
71
+ private readonly config;
72
+ private readonly chain;
73
+ private connection;
74
+ private cache;
75
+ constructor(config: WarpClientConfig, chain: WarpChainInfo);
76
+ getAccount(address: string): Promise<WarpChainAccount>;
77
+ getAccountAssets(address: string): Promise<WarpChainAsset[]>;
78
+ getAsset(identifier: string): Promise<WarpChainAsset | null>;
79
+ getAction(identifier: string, awaitCompleted?: boolean): Promise<WarpChainAction | null>;
80
+ getAccountActions(address: string, options?: WarpDataLoaderOptions): Promise<WarpChainAction[]>;
81
+ private getTokenBalances;
82
+ private getTokenMetadata;
83
+ }
84
+
85
+ declare class WarpSolanaExecutor implements AdapterWarpExecutor {
86
+ private readonly config;
87
+ private readonly chain;
88
+ private readonly serializer;
89
+ private readonly connection;
90
+ private readonly output;
91
+ constructor(config: WarpClientConfig, chain: WarpChainInfo);
92
+ createTransaction(executable: WarpExecutable): Promise<Transaction>;
93
+ createTransferTransaction(executable: WarpExecutable): Promise<Transaction>;
94
+ createContractCallTransaction(executable: WarpExecutable): Promise<Transaction>;
95
+ private encodeInstructionData;
96
+ private encodeBasicInstructionData;
97
+ private encodeArgs;
98
+ private buildInstructionAccounts;
99
+ private createTokenTransferTransaction;
100
+ private createSingleTokenTransfer;
101
+ executeQuery(executable: WarpExecutable): Promise<WarpActionExecutionResult>;
102
+ verifyMessage(message: string, signature: string): Promise<string>;
103
+ private setTransactionDefaults;
104
+ }
105
+
106
+ declare class WarpSolanaExplorer implements AdapterWarpExplorer {
107
+ private readonly chain;
108
+ private readonly config;
109
+ constructor(chain: WarpChainInfo, config: WarpClientConfig);
110
+ private getExplorers;
111
+ private getPrimaryExplorer;
112
+ private getExplorerUrlByName;
113
+ getAccountUrl(address: string, explorer?: ExplorerName): string;
114
+ getTransactionUrl(hash: string, explorer?: ExplorerName): string;
115
+ getBlockUrl(blockNumber: string | number, explorer?: ExplorerName): string;
116
+ getAssetUrl(identifier: string, explorer?: ExplorerName): string;
117
+ getContractUrl(address: string, explorer?: ExplorerName): string;
118
+ getAllExplorers(): readonly ExplorerName[];
119
+ getExplorerByName(name: string): ExplorerName | undefined;
120
+ getAccountUrls(address: string): Record<ExplorerName, string>;
121
+ getTransactionUrls(hash: string): Record<ExplorerName, string>;
122
+ getAssetUrls(identifier: string): Record<ExplorerName, string>;
123
+ getContractUrls(address: string): Record<ExplorerName, string>;
124
+ getBlockUrls(blockNumber: string | number): Record<ExplorerName, string>;
125
+ }
126
+
127
+ declare class WarpSolanaOutput implements AdapterWarpOutput {
128
+ private readonly config;
129
+ private readonly chain;
130
+ private readonly serializer;
131
+ private readonly connection;
132
+ private readonly cache;
133
+ constructor(config: WarpClientConfig, chain: WarpChainInfo);
134
+ getActionExecution(warp: Warp, actionIndex: WarpActionIndex, tx: WarpAdapterGenericRemoteTransaction): Promise<WarpActionExecutionResult>;
135
+ private createFailedExecution;
136
+ private handleWarpChainAction;
137
+ private handleTransactionSignature;
138
+ extractQueryOutput(warp: Warp, typedValues: unknown[], actionIndex: number, inputs: ResolvedInput[]): Promise<{
139
+ values: {
140
+ string: string[];
141
+ native: WarpNativeValue[];
142
+ mapped: Record<string, any>;
143
+ };
144
+ output: WarpExecutionOutput;
145
+ }>;
146
+ getTransactionStatus(txHash: string): Promise<{
147
+ status: 'pending' | 'confirmed' | 'failed';
148
+ blockNumber?: number;
149
+ gasUsed?: bigint;
150
+ }>;
151
+ getTransactionReceipt(txHash: string): Promise<any>;
152
+ }
153
+
154
+ declare class WarpSolanaSerializer implements AdapterWarpSerializer {
155
+ readonly coreSerializer: WarpSerializer;
156
+ constructor();
157
+ typedToString(value: any): string;
158
+ typedToNative(value: any): [WarpActionInputType, WarpNativeValue];
159
+ nativeToTyped(type: WarpActionInputType, value: WarpNativeValue): any;
160
+ nativeToType(type: BaseWarpActionInputType): WarpAdapterGenericType;
161
+ stringToTyped(value: string): any;
162
+ private parseNativeValue;
163
+ }
164
+
165
+ declare class WarpSolanaWallet implements AdapterWarpWallet {
166
+ private config;
167
+ private chain;
168
+ private connection;
169
+ constructor(config: WarpClientConfig, chain: WarpChainInfo);
170
+ signTransaction(tx: WarpAdapterGenericTransaction): Promise<WarpAdapterGenericTransaction>;
171
+ signTransactions(txs: WarpAdapterGenericTransaction[]): Promise<WarpAdapterGenericTransaction[]>;
172
+ signMessage(message: string): Promise<string>;
173
+ sendTransaction(tx: WarpAdapterGenericTransaction): Promise<string>;
174
+ sendTransactions(txs: WarpAdapterGenericTransaction[]): Promise<string[]>;
175
+ create(mnemonic: string): {
176
+ address: string;
177
+ privateKey: string;
178
+ mnemonic: string;
179
+ };
180
+ generate(): {
181
+ address: string;
182
+ privateKey: string;
183
+ mnemonic: string;
184
+ };
185
+ getAddress(): string | null;
186
+ getPublicKey(): string | null;
187
+ private getKeypair;
188
+ }
189
+
190
+ export { type ExplorerName, ExplorerUrls, KnownTokens, NativeTokenSol, SolanaExplorerMap, SolanaExplorerNames, SolanaExplorerUrls, SolanaExplorers, type TokenBalance, type TokenMetadata, WarpSolanaConstants, WarpSolanaDataLoader, WarpSolanaExecutor, WarpSolanaExplorer, WarpSolanaOutput, WarpSolanaSerializer, WarpSolanaWallet, findKnownTokenById, getKnownTokensForChain, getSolanaAdapter };