@joai/warps-adapter-solana 1.0.0-beta.23
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/README.md +44 -0
- package/dist/index.d.cts +223 -0
- package/dist/index.d.ts +223 -0
- package/dist/index.js +2319 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2305 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +48 -0
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# @joai/warps-adapter-solana
|
|
2
|
+
|
|
3
|
+
Solana blockchain adapter for the Warps SDK. Enables Warp execution on Solana mainnet, testnet, and devnet.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @joai/warps-adapter-solana
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { WarpClient, withAdapterFallback } from '@joai/warps'
|
|
15
|
+
import { SolanaAdapter } from '@joai/warps-adapter-solana'
|
|
16
|
+
import { MultiversxAdapter } from '@joai/warps-adapter-multiversx'
|
|
17
|
+
|
|
18
|
+
// Solana adapter requires a fallback adapter
|
|
19
|
+
const client = new WarpClient(config, {
|
|
20
|
+
chains: [withAdapterFallback(SolanaAdapter, MultiversxAdapter)],
|
|
21
|
+
})
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Supported Networks
|
|
25
|
+
|
|
26
|
+
- **Solana Mainnet**
|
|
27
|
+
- **Solana Testnet**
|
|
28
|
+
- **Solana Devnet**
|
|
29
|
+
|
|
30
|
+
## Features
|
|
31
|
+
|
|
32
|
+
- Transaction creation and execution
|
|
33
|
+
- Program (smart contract) interaction
|
|
34
|
+
- Token transfers (SPL tokens)
|
|
35
|
+
- Query program state
|
|
36
|
+
- Transaction signing and sending
|
|
37
|
+
- Explorer integration
|
|
38
|
+
|
|
39
|
+
## Wallet Providers
|
|
40
|
+
|
|
41
|
+
Supports multiple wallet providers:
|
|
42
|
+
- Private key
|
|
43
|
+
- Mnemonic
|
|
44
|
+
- Read-only (for queries)
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { WarpChainAsset, ChainAdapterFactory, WarpChainName, 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, WarpWalletDetails, WarpWalletProvider } from '@joai/warps';
|
|
2
|
+
import { Connection, VersionedTransaction } from '@solana/web3.js';
|
|
3
|
+
|
|
4
|
+
declare const NativeTokenSol: WarpChainAsset;
|
|
5
|
+
declare const SolanaAdapter: ChainAdapterFactory;
|
|
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
|
+
declare const X402SolanaNetworkIdentifiers: {
|
|
54
|
+
readonly Mainnet: "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
|
|
55
|
+
readonly Devnet: "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1";
|
|
56
|
+
};
|
|
57
|
+
declare const SupportedX402SolanaNetworks: string[];
|
|
58
|
+
|
|
59
|
+
declare const KnownTokens: Partial<Record<WarpChainName, Record<WarpChainEnv, WarpChainAsset[]>>>;
|
|
60
|
+
declare const findKnownTokenById: (chain: WarpChainName, env: WarpChainEnv, id: string) => WarpChainAsset | null;
|
|
61
|
+
declare const getKnownTokensForChain: (chainName: WarpChainName, env: WarpChainEnv) => WarpChainAsset[];
|
|
62
|
+
|
|
63
|
+
declare module '@solana/kit' {
|
|
64
|
+
export function createKeyPairSignerFromBytes(bytes: Uint8Array): Promise<{
|
|
65
|
+
signMessage: (message: Uint8Array) => Promise<Uint8Array>
|
|
66
|
+
signTransaction: (transaction: unknown) => Promise<unknown>
|
|
67
|
+
}>
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
declare module '@x402/svm/exact/client' {
|
|
71
|
+
export function registerExactSvmScheme(client: unknown, options: { signer: unknown }): void
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
declare class WarpSolanaDataLoader implements AdapterWarpDataLoader {
|
|
75
|
+
private readonly config;
|
|
76
|
+
private readonly chain;
|
|
77
|
+
readonly connection: Connection;
|
|
78
|
+
private cache;
|
|
79
|
+
constructor(config: WarpClientConfig, chain: WarpChainInfo);
|
|
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
|
+
private getTokenBalances;
|
|
86
|
+
private getTokenMetadata;
|
|
87
|
+
private waitForTransaction;
|
|
88
|
+
private tryFetchTransaction;
|
|
89
|
+
private calculateBackoffDelay;
|
|
90
|
+
private createFailedAction;
|
|
91
|
+
private parseTransactionToAction;
|
|
92
|
+
private extractAccountKeys;
|
|
93
|
+
private calculateTransactionValue;
|
|
94
|
+
private determineFunctionName;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
declare class WarpSolanaExecutor implements AdapterWarpExecutor {
|
|
98
|
+
private readonly config;
|
|
99
|
+
private readonly chain;
|
|
100
|
+
private readonly serializer;
|
|
101
|
+
private readonly connection;
|
|
102
|
+
private readonly output;
|
|
103
|
+
constructor(config: WarpClientConfig, chain: WarpChainInfo);
|
|
104
|
+
createTransaction(executable: WarpExecutable): Promise<VersionedTransaction>;
|
|
105
|
+
createTransferTransaction(executable: WarpExecutable): Promise<VersionedTransaction>;
|
|
106
|
+
createContractCallTransaction(executable: WarpExecutable): Promise<VersionedTransaction>;
|
|
107
|
+
private ensureATAs;
|
|
108
|
+
private encodeInstructionData;
|
|
109
|
+
private encodeBasicInstructionData;
|
|
110
|
+
private encodeArgs;
|
|
111
|
+
private buildInstructionAccounts;
|
|
112
|
+
private extractAccountInputs;
|
|
113
|
+
private resolveAccountFromInput;
|
|
114
|
+
private interpolateAccountAddress;
|
|
115
|
+
private createTokenTransferTransaction;
|
|
116
|
+
private createSingleTokenTransfer;
|
|
117
|
+
executeQuery(executable: WarpExecutable): Promise<WarpActionExecutionResult>;
|
|
118
|
+
verifyMessage(message: string, signature: string): Promise<string>;
|
|
119
|
+
private setTransactionDefaults;
|
|
120
|
+
private toPublicKey;
|
|
121
|
+
private extractContractArgs;
|
|
122
|
+
private buildInstructionData;
|
|
123
|
+
private extractAccountAddress;
|
|
124
|
+
private resolveAccountPubkey;
|
|
125
|
+
private determineAccountFlags;
|
|
126
|
+
private addComputeBudgetInstructions;
|
|
127
|
+
private buildAccountMetaMap;
|
|
128
|
+
private sortAccounts;
|
|
129
|
+
private buildAccountIndexMap;
|
|
130
|
+
private compileInstructions;
|
|
131
|
+
private buildMessageV0;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
declare class WarpSolanaExplorer implements AdapterWarpExplorer {
|
|
135
|
+
private readonly chain;
|
|
136
|
+
private readonly config;
|
|
137
|
+
constructor(chain: WarpChainInfo, config: WarpClientConfig);
|
|
138
|
+
private getExplorers;
|
|
139
|
+
private getPrimaryExplorer;
|
|
140
|
+
private getExplorerUrlByName;
|
|
141
|
+
getAccountUrl(address: string, explorer?: ExplorerName): string;
|
|
142
|
+
getTransactionUrl(hash: string, explorer?: ExplorerName): string;
|
|
143
|
+
getBlockUrl(blockNumber: string | number, explorer?: ExplorerName): string;
|
|
144
|
+
getAssetUrl(identifier: string, explorer?: ExplorerName): string;
|
|
145
|
+
getContractUrl(address: string, explorer?: ExplorerName): string;
|
|
146
|
+
getAllExplorers(): readonly ExplorerName[];
|
|
147
|
+
getExplorerByName(name: string): ExplorerName | undefined;
|
|
148
|
+
getAccountUrls(address: string): Record<ExplorerName, string>;
|
|
149
|
+
getTransactionUrls(hash: string): Record<ExplorerName, string>;
|
|
150
|
+
getAssetUrls(identifier: string): Record<ExplorerName, string>;
|
|
151
|
+
getContractUrls(address: string): Record<ExplorerName, string>;
|
|
152
|
+
getBlockUrls(blockNumber: string | number): Record<ExplorerName, string>;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
declare class WarpSolanaOutput implements AdapterWarpOutput {
|
|
156
|
+
private readonly config;
|
|
157
|
+
private readonly chain;
|
|
158
|
+
private readonly serializer;
|
|
159
|
+
private readonly connection;
|
|
160
|
+
private readonly cache;
|
|
161
|
+
constructor(config: WarpClientConfig, chain: WarpChainInfo);
|
|
162
|
+
getActionExecution(warp: Warp, actionIndex: WarpActionIndex, tx: WarpAdapterGenericRemoteTransaction): Promise<WarpActionExecutionResult>;
|
|
163
|
+
private createFailedExecution;
|
|
164
|
+
private handleWarpChainAction;
|
|
165
|
+
private handleTransactionSignature;
|
|
166
|
+
extractQueryOutput(warp: Warp, typedValues: unknown[], actionIndex: number, inputs: ResolvedInput[]): Promise<{
|
|
167
|
+
values: {
|
|
168
|
+
string: string[];
|
|
169
|
+
native: WarpNativeValue[];
|
|
170
|
+
mapped: Record<string, any>;
|
|
171
|
+
};
|
|
172
|
+
output: WarpExecutionOutput;
|
|
173
|
+
}>;
|
|
174
|
+
getTransactionStatus(txHash: string): Promise<{
|
|
175
|
+
status: 'pending' | 'confirmed' | 'failed';
|
|
176
|
+
blockNumber?: number;
|
|
177
|
+
gasUsed?: bigint;
|
|
178
|
+
}>;
|
|
179
|
+
getTransactionReceipt(txHash: string): Promise<any>;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
declare class WarpSolanaSerializer implements AdapterWarpSerializer {
|
|
183
|
+
readonly coreSerializer: WarpSerializer;
|
|
184
|
+
constructor();
|
|
185
|
+
typedToString(value: any): string;
|
|
186
|
+
typedToNative(value: any): [WarpActionInputType, WarpNativeValue];
|
|
187
|
+
nativeToTyped(type: WarpActionInputType, value: WarpNativeValue): any;
|
|
188
|
+
nativeToType(type: BaseWarpActionInputType): WarpAdapterGenericType;
|
|
189
|
+
stringToTyped(value: string): any;
|
|
190
|
+
private parseNativeValue;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
declare class WarpSolanaWallet implements AdapterWarpWallet {
|
|
194
|
+
private config;
|
|
195
|
+
private chain;
|
|
196
|
+
private connection;
|
|
197
|
+
private walletProvider;
|
|
198
|
+
private cachedAddress;
|
|
199
|
+
private cachedPublicKey;
|
|
200
|
+
constructor(config: WarpClientConfig, chain: WarpChainInfo);
|
|
201
|
+
signTransaction(tx: WarpAdapterGenericTransaction): Promise<WarpAdapterGenericTransaction>;
|
|
202
|
+
signTransactions(txs: WarpAdapterGenericTransaction[]): Promise<WarpAdapterGenericTransaction[]>;
|
|
203
|
+
signMessage(message: string): Promise<string>;
|
|
204
|
+
sendTransaction(tx: WarpAdapterGenericTransaction): Promise<string>;
|
|
205
|
+
sendTransactions(txs: WarpAdapterGenericTransaction[]): Promise<string[]>;
|
|
206
|
+
importFromMnemonic(mnemonic: string): Promise<WarpWalletDetails>;
|
|
207
|
+
importFromPrivateKey(privateKey: string): Promise<WarpWalletDetails>;
|
|
208
|
+
export(provider: WarpWalletProvider): Promise<WarpWalletDetails>;
|
|
209
|
+
generate(provider: WarpWalletProvider): Promise<WarpWalletDetails>;
|
|
210
|
+
getAddress(): string | null;
|
|
211
|
+
getPublicKey(): string | null;
|
|
212
|
+
registerX402Handlers(client: unknown): Promise<Record<string, () => void>>;
|
|
213
|
+
private createProvider;
|
|
214
|
+
private initializeCache;
|
|
215
|
+
private createProviderForOperation;
|
|
216
|
+
private resolveTransaction;
|
|
217
|
+
private shouldSkipPreflight;
|
|
218
|
+
private sendWithRetry;
|
|
219
|
+
private sendRawTransaction;
|
|
220
|
+
private isSimulationError;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export { type ExplorerName, ExplorerUrls, KnownTokens, NativeTokenSol, SolanaAdapter, SolanaExplorerMap, SolanaExplorerNames, SolanaExplorerUrls, SolanaExplorers, SupportedX402SolanaNetworks, WarpSolanaConstants, WarpSolanaDataLoader, WarpSolanaExecutor, WarpSolanaExplorer, WarpSolanaOutput, WarpSolanaSerializer, WarpSolanaWallet, X402SolanaNetworkIdentifiers, findKnownTokenById, getKnownTokensForChain };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { WarpChainAsset, ChainAdapterFactory, WarpChainName, 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, WarpWalletDetails, WarpWalletProvider } from '@joai/warps';
|
|
2
|
+
import { Connection, VersionedTransaction } from '@solana/web3.js';
|
|
3
|
+
|
|
4
|
+
declare const NativeTokenSol: WarpChainAsset;
|
|
5
|
+
declare const SolanaAdapter: ChainAdapterFactory;
|
|
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
|
+
declare const X402SolanaNetworkIdentifiers: {
|
|
54
|
+
readonly Mainnet: "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
|
|
55
|
+
readonly Devnet: "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1";
|
|
56
|
+
};
|
|
57
|
+
declare const SupportedX402SolanaNetworks: string[];
|
|
58
|
+
|
|
59
|
+
declare const KnownTokens: Partial<Record<WarpChainName, Record<WarpChainEnv, WarpChainAsset[]>>>;
|
|
60
|
+
declare const findKnownTokenById: (chain: WarpChainName, env: WarpChainEnv, id: string) => WarpChainAsset | null;
|
|
61
|
+
declare const getKnownTokensForChain: (chainName: WarpChainName, env: WarpChainEnv) => WarpChainAsset[];
|
|
62
|
+
|
|
63
|
+
declare module '@solana/kit' {
|
|
64
|
+
export function createKeyPairSignerFromBytes(bytes: Uint8Array): Promise<{
|
|
65
|
+
signMessage: (message: Uint8Array) => Promise<Uint8Array>
|
|
66
|
+
signTransaction: (transaction: unknown) => Promise<unknown>
|
|
67
|
+
}>
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
declare module '@x402/svm/exact/client' {
|
|
71
|
+
export function registerExactSvmScheme(client: unknown, options: { signer: unknown }): void
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
declare class WarpSolanaDataLoader implements AdapterWarpDataLoader {
|
|
75
|
+
private readonly config;
|
|
76
|
+
private readonly chain;
|
|
77
|
+
readonly connection: Connection;
|
|
78
|
+
private cache;
|
|
79
|
+
constructor(config: WarpClientConfig, chain: WarpChainInfo);
|
|
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
|
+
private getTokenBalances;
|
|
86
|
+
private getTokenMetadata;
|
|
87
|
+
private waitForTransaction;
|
|
88
|
+
private tryFetchTransaction;
|
|
89
|
+
private calculateBackoffDelay;
|
|
90
|
+
private createFailedAction;
|
|
91
|
+
private parseTransactionToAction;
|
|
92
|
+
private extractAccountKeys;
|
|
93
|
+
private calculateTransactionValue;
|
|
94
|
+
private determineFunctionName;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
declare class WarpSolanaExecutor implements AdapterWarpExecutor {
|
|
98
|
+
private readonly config;
|
|
99
|
+
private readonly chain;
|
|
100
|
+
private readonly serializer;
|
|
101
|
+
private readonly connection;
|
|
102
|
+
private readonly output;
|
|
103
|
+
constructor(config: WarpClientConfig, chain: WarpChainInfo);
|
|
104
|
+
createTransaction(executable: WarpExecutable): Promise<VersionedTransaction>;
|
|
105
|
+
createTransferTransaction(executable: WarpExecutable): Promise<VersionedTransaction>;
|
|
106
|
+
createContractCallTransaction(executable: WarpExecutable): Promise<VersionedTransaction>;
|
|
107
|
+
private ensureATAs;
|
|
108
|
+
private encodeInstructionData;
|
|
109
|
+
private encodeBasicInstructionData;
|
|
110
|
+
private encodeArgs;
|
|
111
|
+
private buildInstructionAccounts;
|
|
112
|
+
private extractAccountInputs;
|
|
113
|
+
private resolveAccountFromInput;
|
|
114
|
+
private interpolateAccountAddress;
|
|
115
|
+
private createTokenTransferTransaction;
|
|
116
|
+
private createSingleTokenTransfer;
|
|
117
|
+
executeQuery(executable: WarpExecutable): Promise<WarpActionExecutionResult>;
|
|
118
|
+
verifyMessage(message: string, signature: string): Promise<string>;
|
|
119
|
+
private setTransactionDefaults;
|
|
120
|
+
private toPublicKey;
|
|
121
|
+
private extractContractArgs;
|
|
122
|
+
private buildInstructionData;
|
|
123
|
+
private extractAccountAddress;
|
|
124
|
+
private resolveAccountPubkey;
|
|
125
|
+
private determineAccountFlags;
|
|
126
|
+
private addComputeBudgetInstructions;
|
|
127
|
+
private buildAccountMetaMap;
|
|
128
|
+
private sortAccounts;
|
|
129
|
+
private buildAccountIndexMap;
|
|
130
|
+
private compileInstructions;
|
|
131
|
+
private buildMessageV0;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
declare class WarpSolanaExplorer implements AdapterWarpExplorer {
|
|
135
|
+
private readonly chain;
|
|
136
|
+
private readonly config;
|
|
137
|
+
constructor(chain: WarpChainInfo, config: WarpClientConfig);
|
|
138
|
+
private getExplorers;
|
|
139
|
+
private getPrimaryExplorer;
|
|
140
|
+
private getExplorerUrlByName;
|
|
141
|
+
getAccountUrl(address: string, explorer?: ExplorerName): string;
|
|
142
|
+
getTransactionUrl(hash: string, explorer?: ExplorerName): string;
|
|
143
|
+
getBlockUrl(blockNumber: string | number, explorer?: ExplorerName): string;
|
|
144
|
+
getAssetUrl(identifier: string, explorer?: ExplorerName): string;
|
|
145
|
+
getContractUrl(address: string, explorer?: ExplorerName): string;
|
|
146
|
+
getAllExplorers(): readonly ExplorerName[];
|
|
147
|
+
getExplorerByName(name: string): ExplorerName | undefined;
|
|
148
|
+
getAccountUrls(address: string): Record<ExplorerName, string>;
|
|
149
|
+
getTransactionUrls(hash: string): Record<ExplorerName, string>;
|
|
150
|
+
getAssetUrls(identifier: string): Record<ExplorerName, string>;
|
|
151
|
+
getContractUrls(address: string): Record<ExplorerName, string>;
|
|
152
|
+
getBlockUrls(blockNumber: string | number): Record<ExplorerName, string>;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
declare class WarpSolanaOutput implements AdapterWarpOutput {
|
|
156
|
+
private readonly config;
|
|
157
|
+
private readonly chain;
|
|
158
|
+
private readonly serializer;
|
|
159
|
+
private readonly connection;
|
|
160
|
+
private readonly cache;
|
|
161
|
+
constructor(config: WarpClientConfig, chain: WarpChainInfo);
|
|
162
|
+
getActionExecution(warp: Warp, actionIndex: WarpActionIndex, tx: WarpAdapterGenericRemoteTransaction): Promise<WarpActionExecutionResult>;
|
|
163
|
+
private createFailedExecution;
|
|
164
|
+
private handleWarpChainAction;
|
|
165
|
+
private handleTransactionSignature;
|
|
166
|
+
extractQueryOutput(warp: Warp, typedValues: unknown[], actionIndex: number, inputs: ResolvedInput[]): Promise<{
|
|
167
|
+
values: {
|
|
168
|
+
string: string[];
|
|
169
|
+
native: WarpNativeValue[];
|
|
170
|
+
mapped: Record<string, any>;
|
|
171
|
+
};
|
|
172
|
+
output: WarpExecutionOutput;
|
|
173
|
+
}>;
|
|
174
|
+
getTransactionStatus(txHash: string): Promise<{
|
|
175
|
+
status: 'pending' | 'confirmed' | 'failed';
|
|
176
|
+
blockNumber?: number;
|
|
177
|
+
gasUsed?: bigint;
|
|
178
|
+
}>;
|
|
179
|
+
getTransactionReceipt(txHash: string): Promise<any>;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
declare class WarpSolanaSerializer implements AdapterWarpSerializer {
|
|
183
|
+
readonly coreSerializer: WarpSerializer;
|
|
184
|
+
constructor();
|
|
185
|
+
typedToString(value: any): string;
|
|
186
|
+
typedToNative(value: any): [WarpActionInputType, WarpNativeValue];
|
|
187
|
+
nativeToTyped(type: WarpActionInputType, value: WarpNativeValue): any;
|
|
188
|
+
nativeToType(type: BaseWarpActionInputType): WarpAdapterGenericType;
|
|
189
|
+
stringToTyped(value: string): any;
|
|
190
|
+
private parseNativeValue;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
declare class WarpSolanaWallet implements AdapterWarpWallet {
|
|
194
|
+
private config;
|
|
195
|
+
private chain;
|
|
196
|
+
private connection;
|
|
197
|
+
private walletProvider;
|
|
198
|
+
private cachedAddress;
|
|
199
|
+
private cachedPublicKey;
|
|
200
|
+
constructor(config: WarpClientConfig, chain: WarpChainInfo);
|
|
201
|
+
signTransaction(tx: WarpAdapterGenericTransaction): Promise<WarpAdapterGenericTransaction>;
|
|
202
|
+
signTransactions(txs: WarpAdapterGenericTransaction[]): Promise<WarpAdapterGenericTransaction[]>;
|
|
203
|
+
signMessage(message: string): Promise<string>;
|
|
204
|
+
sendTransaction(tx: WarpAdapterGenericTransaction): Promise<string>;
|
|
205
|
+
sendTransactions(txs: WarpAdapterGenericTransaction[]): Promise<string[]>;
|
|
206
|
+
importFromMnemonic(mnemonic: string): Promise<WarpWalletDetails>;
|
|
207
|
+
importFromPrivateKey(privateKey: string): Promise<WarpWalletDetails>;
|
|
208
|
+
export(provider: WarpWalletProvider): Promise<WarpWalletDetails>;
|
|
209
|
+
generate(provider: WarpWalletProvider): Promise<WarpWalletDetails>;
|
|
210
|
+
getAddress(): string | null;
|
|
211
|
+
getPublicKey(): string | null;
|
|
212
|
+
registerX402Handlers(client: unknown): Promise<Record<string, () => void>>;
|
|
213
|
+
private createProvider;
|
|
214
|
+
private initializeCache;
|
|
215
|
+
private createProviderForOperation;
|
|
216
|
+
private resolveTransaction;
|
|
217
|
+
private shouldSkipPreflight;
|
|
218
|
+
private sendWithRetry;
|
|
219
|
+
private sendRawTransaction;
|
|
220
|
+
private isSimulationError;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export { type ExplorerName, ExplorerUrls, KnownTokens, NativeTokenSol, SolanaAdapter, SolanaExplorerMap, SolanaExplorerNames, SolanaExplorerUrls, SolanaExplorers, SupportedX402SolanaNetworks, WarpSolanaConstants, WarpSolanaDataLoader, WarpSolanaExecutor, WarpSolanaExplorer, WarpSolanaOutput, WarpSolanaSerializer, WarpSolanaWallet, X402SolanaNetworkIdentifiers, findKnownTokenById, getKnownTokensForChain };
|