@atomiqlabs/chain-solana 13.5.13 → 13.5.14
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/LICENSE +201 -201
- package/README.md +73 -73
- package/dist/index.d.ts +81 -81
- package/dist/index.js +102 -102
- package/dist/node/index.d.ts +9 -9
- package/dist/node/index.js +13 -13
- package/dist/solana/SolanaChainType.d.ts +15 -15
- package/dist/solana/SolanaChainType.js +2 -2
- package/dist/solana/SolanaChains.d.ts +12 -12
- package/dist/solana/SolanaChains.js +45 -45
- package/dist/solana/SolanaInitializer.d.ts +94 -94
- package/dist/solana/SolanaInitializer.js +174 -174
- package/dist/solana/btcrelay/SolanaBtcRelay.d.ts +222 -222
- package/dist/solana/btcrelay/SolanaBtcRelay.js +455 -455
- package/dist/solana/btcrelay/headers/SolanaBtcHeader.d.ts +84 -84
- package/dist/solana/btcrelay/headers/SolanaBtcHeader.js +70 -70
- package/dist/solana/btcrelay/headers/SolanaBtcStoredHeader.d.ts +92 -92
- package/dist/solana/btcrelay/headers/SolanaBtcStoredHeader.js +109 -109
- package/dist/solana/btcrelay/program/programIdl.json +671 -671
- package/dist/solana/chain/SolanaAction.d.ts +26 -26
- package/dist/solana/chain/SolanaAction.js +87 -87
- package/dist/solana/chain/SolanaChainInterface.d.ts +224 -224
- package/dist/solana/chain/SolanaChainInterface.js +275 -275
- package/dist/solana/chain/SolanaModule.d.ts +14 -14
- package/dist/solana/chain/SolanaModule.js +13 -13
- package/dist/solana/chain/modules/SolanaAddresses.d.ts +8 -8
- package/dist/solana/chain/modules/SolanaAddresses.js +22 -22
- package/dist/solana/chain/modules/SolanaBlocks.d.ts +32 -32
- package/dist/solana/chain/modules/SolanaBlocks.js +78 -78
- package/dist/solana/chain/modules/SolanaEvents.d.ts +68 -68
- package/dist/solana/chain/modules/SolanaEvents.js +238 -238
- package/dist/solana/chain/modules/SolanaFees.d.ts +189 -189
- package/dist/solana/chain/modules/SolanaFees.js +434 -434
- package/dist/solana/chain/modules/SolanaSignatures.d.ts +24 -24
- package/dist/solana/chain/modules/SolanaSignatures.js +39 -39
- package/dist/solana/chain/modules/SolanaSlots.d.ts +33 -33
- package/dist/solana/chain/modules/SolanaSlots.js +72 -72
- package/dist/solana/chain/modules/SolanaTokens.d.ts +123 -123
- package/dist/solana/chain/modules/SolanaTokens.js +242 -242
- package/dist/solana/chain/modules/SolanaTransactions.d.ts +149 -149
- package/dist/solana/chain/modules/SolanaTransactions.js +445 -445
- package/dist/solana/connection/ConnectionWithRetries.d.ts +35 -35
- package/dist/solana/connection/ConnectionWithRetries.js +86 -71
- package/dist/solana/events/SolanaChainEvents.d.ts +45 -45
- package/dist/solana/events/SolanaChainEvents.js +108 -108
- package/dist/solana/events/SolanaChainEventsBrowser.d.ts +205 -205
- package/dist/solana/events/SolanaChainEventsBrowser.js +404 -404
- package/dist/solana/program/SolanaProgramBase.d.ts +73 -73
- package/dist/solana/program/SolanaProgramBase.js +54 -54
- package/dist/solana/program/SolanaProgramModule.d.ts +8 -8
- package/dist/solana/program/SolanaProgramModule.js +11 -11
- package/dist/solana/program/modules/SolanaProgramEvents.d.ts +53 -53
- package/dist/solana/program/modules/SolanaProgramEvents.js +117 -117
- package/dist/solana/swaps/SolanaSwapData.d.ts +333 -333
- package/dist/solana/swaps/SolanaSwapData.js +535 -535
- package/dist/solana/swaps/SolanaSwapModule.d.ts +11 -11
- package/dist/solana/swaps/SolanaSwapModule.js +12 -12
- package/dist/solana/swaps/SolanaSwapProgram.d.ts +376 -376
- package/dist/solana/swaps/SolanaSwapProgram.js +769 -769
- package/dist/solana/swaps/SwapTypeEnum.d.ts +11 -11
- package/dist/solana/swaps/SwapTypeEnum.js +43 -43
- package/dist/solana/swaps/modules/SolanaDataAccount.d.ts +95 -95
- package/dist/solana/swaps/modules/SolanaDataAccount.js +232 -232
- package/dist/solana/swaps/modules/SolanaLpVault.d.ts +69 -69
- package/dist/solana/swaps/modules/SolanaLpVault.js +171 -171
- package/dist/solana/swaps/modules/SwapClaim.d.ts +126 -126
- package/dist/solana/swaps/modules/SwapClaim.js +294 -294
- package/dist/solana/swaps/modules/SwapInit.d.ts +213 -213
- package/dist/solana/swaps/modules/SwapInit.js +658 -658
- package/dist/solana/swaps/modules/SwapRefund.d.ts +87 -87
- package/dist/solana/swaps/modules/SwapRefund.js +293 -293
- package/dist/solana/swaps/programIdl.json +945 -945
- package/dist/solana/swaps/programTypes.d.ts +943 -943
- package/dist/solana/swaps/programTypes.js +945 -945
- package/dist/solana/swaps/v1/programIdl.json +945 -945
- package/dist/solana/swaps/v1/programTypes.d.ts +943 -943
- package/dist/solana/swaps/v1/programTypes.js +945 -945
- package/dist/solana/swaps/v2/programIdl.json +952 -952
- package/dist/solana/swaps/v2/programTypes.d.ts +950 -950
- package/dist/solana/swaps/v2/programTypes.js +952 -952
- package/dist/solana/wallet/SolanaKeypairWallet.d.ts +29 -29
- package/dist/solana/wallet/SolanaKeypairWallet.js +50 -50
- package/dist/solana/wallet/SolanaSigner.d.ts +30 -30
- package/dist/solana/wallet/SolanaSigner.js +30 -30
- package/dist/utils/Utils.d.ts +58 -58
- package/dist/utils/Utils.js +170 -170
- package/node/index.d.ts +1 -1
- package/node/index.js +3 -3
- package/package.json +46 -46
- package/src/index.ts +87 -87
- package/src/node/index.ts +9 -9
- package/src/solana/SolanaChainType.ts +32 -32
- package/src/solana/SolanaChains.ts +46 -46
- package/src/solana/SolanaInitializer.ts +278 -278
- package/src/solana/btcrelay/SolanaBtcRelay.ts +615 -615
- package/src/solana/btcrelay/headers/SolanaBtcHeader.ts +116 -116
- package/src/solana/btcrelay/headers/SolanaBtcStoredHeader.ts +148 -148
- package/src/solana/btcrelay/program/programIdl.json +670 -670
- package/src/solana/chain/SolanaAction.ts +109 -109
- package/src/solana/chain/SolanaChainInterface.ts +404 -404
- package/src/solana/chain/SolanaModule.ts +20 -20
- package/src/solana/chain/modules/SolanaAddresses.ts +20 -20
- package/src/solana/chain/modules/SolanaBlocks.ts +89 -89
- package/src/solana/chain/modules/SolanaEvents.ts +271 -271
- package/src/solana/chain/modules/SolanaFees.ts +522 -522
- package/src/solana/chain/modules/SolanaSignatures.ts +39 -39
- package/src/solana/chain/modules/SolanaSlots.ts +85 -85
- package/src/solana/chain/modules/SolanaTokens.ts +300 -300
- package/src/solana/chain/modules/SolanaTransactions.ts +503 -503
- package/src/solana/connection/ConnectionWithRetries.ts +113 -96
- package/src/solana/events/SolanaChainEvents.ts +127 -127
- package/src/solana/events/SolanaChainEventsBrowser.ts +495 -495
- package/src/solana/program/SolanaProgramBase.ts +119 -119
- package/src/solana/program/SolanaProgramModule.ts +15 -15
- package/src/solana/program/modules/SolanaProgramEvents.ts +157 -157
- package/src/solana/swaps/SolanaSwapData.ts +735 -735
- package/src/solana/swaps/SolanaSwapModule.ts +19 -19
- package/src/solana/swaps/SolanaSwapProgram.ts +1074 -1074
- package/src/solana/swaps/SwapTypeEnum.ts +30 -30
- package/src/solana/swaps/modules/SolanaDataAccount.ts +302 -302
- package/src/solana/swaps/modules/SolanaLpVault.ts +208 -208
- package/src/solana/swaps/modules/SwapClaim.ts +387 -387
- package/src/solana/swaps/modules/SwapInit.ts +785 -785
- package/src/solana/swaps/modules/SwapRefund.ts +353 -353
- package/src/solana/swaps/v1/programIdl.json +944 -944
- package/src/solana/swaps/v1/programTypes.ts +1885 -1885
- package/src/solana/swaps/v2/programIdl.json +951 -951
- package/src/solana/swaps/v2/programTypes.ts +1899 -1899
- package/src/solana/wallet/SolanaKeypairWallet.ts +56 -56
- package/src/solana/wallet/SolanaSigner.ts +43 -43
- package/src/utils/Utils.ts +194 -194
|
@@ -1,224 +1,224 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
import { Connection, SendOptions, Transaction } from "@solana/web3.js";
|
|
4
|
-
import { SolanaFees } from "./modules/SolanaFees";
|
|
5
|
-
import { SolanaBlocks } from "./modules/SolanaBlocks";
|
|
6
|
-
import { SolanaSlots } from "./modules/SolanaSlots";
|
|
7
|
-
import { SolanaTokens } from "./modules/SolanaTokens";
|
|
8
|
-
import { SignedSolanaTx, SolanaTransactions, SolanaTx } from "./modules/SolanaTransactions";
|
|
9
|
-
import { SolanaSignatures } from "./modules/SolanaSignatures";
|
|
10
|
-
import { SolanaEvents } from "./modules/SolanaEvents";
|
|
11
|
-
import { BitcoinNetwork, ChainInterface, TransactionConfirmationOptions } from "@atomiqlabs/base";
|
|
12
|
-
import { SolanaSigner } from "../wallet/SolanaSigner";
|
|
13
|
-
import { Buffer } from "buffer";
|
|
14
|
-
import { Wallet } from "@coral-xyz/anchor/dist/cjs/provider";
|
|
15
|
-
/**
|
|
16
|
-
* Retry policy configuration for Solana RPC calls
|
|
17
|
-
* @category Chain Interface
|
|
18
|
-
*/
|
|
19
|
-
export type SolanaRetryPolicy = {
|
|
20
|
-
/**
|
|
21
|
-
* Maximum retries to be attempted
|
|
22
|
-
*/
|
|
23
|
-
maxRetries?: number;
|
|
24
|
-
/**
|
|
25
|
-
* Default delay between retries
|
|
26
|
-
*/
|
|
27
|
-
delay?: number;
|
|
28
|
-
/**
|
|
29
|
-
* Whether the delays should scale exponentially, i.e. 1 second, 2 seconds, 4 seconds, 8 seconds
|
|
30
|
-
*/
|
|
31
|
-
exponential?: boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Interval between re-sending Solana transaction to the RPC
|
|
34
|
-
*/
|
|
35
|
-
transactionResendInterval?: number;
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Main chain interface for interacting with Solana blockchain
|
|
39
|
-
* @category Chain Interface
|
|
40
|
-
*/
|
|
41
|
-
export declare class SolanaChainInterface implements ChainInterface<SolanaTx, SignedSolanaTx, SolanaSigner, "SOLANA", Wallet> {
|
|
42
|
-
/**
|
|
43
|
-
* @inheritDoc
|
|
44
|
-
*/
|
|
45
|
-
readonly chainId = "SOLANA";
|
|
46
|
-
/**
|
|
47
|
-
* Average Solana slot time in milliseconds.
|
|
48
|
-
* @internal
|
|
49
|
-
*/
|
|
50
|
-
readonly _SLOT_TIME = 400;
|
|
51
|
-
/**
|
|
52
|
-
* Approximate number of recent slots for which a transaction remains valid.
|
|
53
|
-
* @internal
|
|
54
|
-
*/
|
|
55
|
-
readonly _TX_SLOT_VALIDITY = 151;
|
|
56
|
-
/**
|
|
57
|
-
* Underlying Solana web3.js connection.
|
|
58
|
-
* @internal
|
|
59
|
-
*/
|
|
60
|
-
readonly _connection: Connection;
|
|
61
|
-
/**
|
|
62
|
-
* Retry policy used by chain modules.
|
|
63
|
-
* @internal
|
|
64
|
-
*/
|
|
65
|
-
readonly _retryPolicy?: SolanaRetryPolicy;
|
|
66
|
-
/**
|
|
67
|
-
* Block-related read module.
|
|
68
|
-
*/
|
|
69
|
-
readonly Blocks: SolanaBlocks;
|
|
70
|
-
/**
|
|
71
|
-
* Fee estimation and fee-rate module.
|
|
72
|
-
*/
|
|
73
|
-
Fees: SolanaFees;
|
|
74
|
-
/**
|
|
75
|
-
* Slot-related read module.
|
|
76
|
-
*/
|
|
77
|
-
readonly Slots: SolanaSlots;
|
|
78
|
-
/**
|
|
79
|
-
* Token operations module.
|
|
80
|
-
*/
|
|
81
|
-
readonly Tokens: SolanaTokens;
|
|
82
|
-
/**
|
|
83
|
-
* Transaction send/confirm/serialization module.
|
|
84
|
-
*/
|
|
85
|
-
readonly Transactions: SolanaTransactions;
|
|
86
|
-
/**
|
|
87
|
-
* Signature utilities module.
|
|
88
|
-
*/
|
|
89
|
-
readonly Signatures: SolanaSignatures;
|
|
90
|
-
/**
|
|
91
|
-
* Event/log scanning module.
|
|
92
|
-
*/
|
|
93
|
-
readonly Events: SolanaEvents;
|
|
94
|
-
/**
|
|
95
|
-
* @internal
|
|
96
|
-
*/
|
|
97
|
-
protected readonly logger: {
|
|
98
|
-
debug: (msg: string, ...args: any[]) => false | void;
|
|
99
|
-
info: (msg: string, ...args: any[]) => false | void;
|
|
100
|
-
warn: (msg: string, ...args: any[]) => false | void;
|
|
101
|
-
error: (msg: string, ...args: any[]) => false | void;
|
|
102
|
-
};
|
|
103
|
-
constructor(connection: Connection, retryPolicy?: SolanaRetryPolicy, solanaFeeEstimator?: SolanaFees);
|
|
104
|
-
/**
|
|
105
|
-
* @inheritDoc
|
|
106
|
-
*/
|
|
107
|
-
getBalance(signer: string, tokenAddress: string): Promise<bigint>;
|
|
108
|
-
/**
|
|
109
|
-
* @inheritDoc
|
|
110
|
-
*/
|
|
111
|
-
isValidAddress(address: string): boolean;
|
|
112
|
-
/**
|
|
113
|
-
* @inheritDoc
|
|
114
|
-
*/
|
|
115
|
-
normalizeAddress(address: string): string;
|
|
116
|
-
/**
|
|
117
|
-
* @inheritDoc
|
|
118
|
-
*/
|
|
119
|
-
getNativeCurrencyAddress(): string;
|
|
120
|
-
/**
|
|
121
|
-
* @inheritDoc
|
|
122
|
-
*/
|
|
123
|
-
shouldGetNativeTokenDrop(tokenAddress: string): boolean;
|
|
124
|
-
/**
|
|
125
|
-
* @inheritDoc
|
|
126
|
-
*/
|
|
127
|
-
txsTransfer(signer: string, token: string, amount: bigint, dstAddress: string, feeRate?: string): Promise<SolanaTx[]>;
|
|
128
|
-
/**
|
|
129
|
-
* @inheritDoc
|
|
130
|
-
*/
|
|
131
|
-
transfer(signer: SolanaSigner, token: string, amount: bigint, dstAddress: string, txOptions?: TransactionConfirmationOptions): Promise<string>;
|
|
132
|
-
/**
|
|
133
|
-
* @inheritDoc
|
|
134
|
-
*/
|
|
135
|
-
sendAndConfirm(signer: SolanaSigner, txs: SolanaTx[], waitForConfirmation?: boolean, abortSignal?: AbortSignal, parallel?: boolean, onBeforePublish?: (txId: string, rawTx: string) => Promise<void>): Promise<string[]>;
|
|
136
|
-
/**
|
|
137
|
-
* @inheritDoc
|
|
138
|
-
*/
|
|
139
|
-
sendSignedAndConfirm(txs: SignedSolanaTx[], waitForConfirmation?: boolean, abortSignal?: AbortSignal, parallel?: boolean, onBeforePublish?: (txId: string, rawTx: string) => Promise<void>): Promise<string[]>;
|
|
140
|
-
/**
|
|
141
|
-
* @inheritDoc
|
|
142
|
-
*/
|
|
143
|
-
prepareTxs(txs: SolanaTx[]): Promise<SolanaTx[]>;
|
|
144
|
-
/**
|
|
145
|
-
* @inheritDoc
|
|
146
|
-
*/
|
|
147
|
-
serializeTx(tx: SolanaTx): Promise<string>;
|
|
148
|
-
/**
|
|
149
|
-
* @inheritDoc
|
|
150
|
-
*/
|
|
151
|
-
deserializeTx(txData: string): Promise<SolanaTx>;
|
|
152
|
-
/**
|
|
153
|
-
* @inheritDoc
|
|
154
|
-
*/
|
|
155
|
-
serializeSignedTx(tx: Transaction): Promise<string>;
|
|
156
|
-
/**
|
|
157
|
-
* @inheritDoc
|
|
158
|
-
*/
|
|
159
|
-
deserializeSignedTx(txData: string): Promise<Transaction>;
|
|
160
|
-
/**
|
|
161
|
-
* @inheritDoc
|
|
162
|
-
*/
|
|
163
|
-
getTxId(signedTX: SignedSolanaTx): Promise<string>;
|
|
164
|
-
/**
|
|
165
|
-
* @inheritDoc
|
|
166
|
-
*/
|
|
167
|
-
getTxIdStatus(txId: string): Promise<"not_found" | "pending" | "success" | "reverted">;
|
|
168
|
-
/**
|
|
169
|
-
* @inheritDoc
|
|
170
|
-
*/
|
|
171
|
-
getTxStatus(tx: string): Promise<"not_found" | "pending" | "success" | "reverted">;
|
|
172
|
-
/**
|
|
173
|
-
* @inheritDoc
|
|
174
|
-
*/
|
|
175
|
-
getFinalizedBlock(): Promise<{
|
|
176
|
-
height: number;
|
|
177
|
-
blockHash: string;
|
|
178
|
-
}>;
|
|
179
|
-
/**
|
|
180
|
-
* @inheritDoc
|
|
181
|
-
*/
|
|
182
|
-
offBeforeTxReplace(callback: (oldTx: string, oldTxId: string, newTx: string, newTxId: string) => Promise<void>): boolean;
|
|
183
|
-
/**
|
|
184
|
-
* @inheritDoc
|
|
185
|
-
*/
|
|
186
|
-
onBeforeTxReplace(callback: (oldTx: string, oldTxId: string, newTx: string, newTxId: string) => Promise<void>): void;
|
|
187
|
-
/**
|
|
188
|
-
* @inheritDoc
|
|
189
|
-
*/
|
|
190
|
-
onBeforeTxSigned(callback: (tx: SolanaTx) => Promise<void>): void;
|
|
191
|
-
/**
|
|
192
|
-
* @inheritDoc
|
|
193
|
-
*/
|
|
194
|
-
offBeforeTxSigned(callback: (tx: SolanaTx) => Promise<void>): boolean;
|
|
195
|
-
/**
|
|
196
|
-
* Registers a low-level transaction sender override hook.
|
|
197
|
-
*
|
|
198
|
-
* @param callback Callback used for raw transaction publishing
|
|
199
|
-
*/
|
|
200
|
-
onSendTransaction(callback: (tx: Buffer, options?: SendOptions) => Promise<string>): void;
|
|
201
|
-
/**
|
|
202
|
-
* Unregisters a previously registered transaction sender override hook.
|
|
203
|
-
*
|
|
204
|
-
* @param callback Previously registered callback
|
|
205
|
-
*/
|
|
206
|
-
offSendTransaction(callback: (tx: Buffer, options?: SendOptions) => Promise<string>): boolean;
|
|
207
|
-
/**
|
|
208
|
-
* @inheritDoc
|
|
209
|
-
*/
|
|
210
|
-
isValidToken(tokenIdentifier: string): boolean;
|
|
211
|
-
/**
|
|
212
|
-
* @inheritDoc
|
|
213
|
-
*/
|
|
214
|
-
randomAddress(): string;
|
|
215
|
-
/**
|
|
216
|
-
* @inheritDoc
|
|
217
|
-
*/
|
|
218
|
-
randomSigner(): SolanaSigner;
|
|
219
|
-
/**
|
|
220
|
-
* @inheritDoc
|
|
221
|
-
*/
|
|
222
|
-
wrapSigner(signer: Wallet): Promise<SolanaSigner>;
|
|
223
|
-
verifyNetwork(bitcoinNetwork: BitcoinNetwork): Promise<void>;
|
|
224
|
-
}
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { Connection, SendOptions, Transaction } from "@solana/web3.js";
|
|
4
|
+
import { SolanaFees } from "./modules/SolanaFees";
|
|
5
|
+
import { SolanaBlocks } from "./modules/SolanaBlocks";
|
|
6
|
+
import { SolanaSlots } from "./modules/SolanaSlots";
|
|
7
|
+
import { SolanaTokens } from "./modules/SolanaTokens";
|
|
8
|
+
import { SignedSolanaTx, SolanaTransactions, SolanaTx } from "./modules/SolanaTransactions";
|
|
9
|
+
import { SolanaSignatures } from "./modules/SolanaSignatures";
|
|
10
|
+
import { SolanaEvents } from "./modules/SolanaEvents";
|
|
11
|
+
import { BitcoinNetwork, ChainInterface, TransactionConfirmationOptions } from "@atomiqlabs/base";
|
|
12
|
+
import { SolanaSigner } from "../wallet/SolanaSigner";
|
|
13
|
+
import { Buffer } from "buffer";
|
|
14
|
+
import { Wallet } from "@coral-xyz/anchor/dist/cjs/provider";
|
|
15
|
+
/**
|
|
16
|
+
* Retry policy configuration for Solana RPC calls
|
|
17
|
+
* @category Chain Interface
|
|
18
|
+
*/
|
|
19
|
+
export type SolanaRetryPolicy = {
|
|
20
|
+
/**
|
|
21
|
+
* Maximum retries to be attempted
|
|
22
|
+
*/
|
|
23
|
+
maxRetries?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Default delay between retries
|
|
26
|
+
*/
|
|
27
|
+
delay?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Whether the delays should scale exponentially, i.e. 1 second, 2 seconds, 4 seconds, 8 seconds
|
|
30
|
+
*/
|
|
31
|
+
exponential?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Interval between re-sending Solana transaction to the RPC
|
|
34
|
+
*/
|
|
35
|
+
transactionResendInterval?: number;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Main chain interface for interacting with Solana blockchain
|
|
39
|
+
* @category Chain Interface
|
|
40
|
+
*/
|
|
41
|
+
export declare class SolanaChainInterface implements ChainInterface<SolanaTx, SignedSolanaTx, SolanaSigner, "SOLANA", Wallet> {
|
|
42
|
+
/**
|
|
43
|
+
* @inheritDoc
|
|
44
|
+
*/
|
|
45
|
+
readonly chainId = "SOLANA";
|
|
46
|
+
/**
|
|
47
|
+
* Average Solana slot time in milliseconds.
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
readonly _SLOT_TIME = 400;
|
|
51
|
+
/**
|
|
52
|
+
* Approximate number of recent slots for which a transaction remains valid.
|
|
53
|
+
* @internal
|
|
54
|
+
*/
|
|
55
|
+
readonly _TX_SLOT_VALIDITY = 151;
|
|
56
|
+
/**
|
|
57
|
+
* Underlying Solana web3.js connection.
|
|
58
|
+
* @internal
|
|
59
|
+
*/
|
|
60
|
+
readonly _connection: Connection;
|
|
61
|
+
/**
|
|
62
|
+
* Retry policy used by chain modules.
|
|
63
|
+
* @internal
|
|
64
|
+
*/
|
|
65
|
+
readonly _retryPolicy?: SolanaRetryPolicy;
|
|
66
|
+
/**
|
|
67
|
+
* Block-related read module.
|
|
68
|
+
*/
|
|
69
|
+
readonly Blocks: SolanaBlocks;
|
|
70
|
+
/**
|
|
71
|
+
* Fee estimation and fee-rate module.
|
|
72
|
+
*/
|
|
73
|
+
Fees: SolanaFees;
|
|
74
|
+
/**
|
|
75
|
+
* Slot-related read module.
|
|
76
|
+
*/
|
|
77
|
+
readonly Slots: SolanaSlots;
|
|
78
|
+
/**
|
|
79
|
+
* Token operations module.
|
|
80
|
+
*/
|
|
81
|
+
readonly Tokens: SolanaTokens;
|
|
82
|
+
/**
|
|
83
|
+
* Transaction send/confirm/serialization module.
|
|
84
|
+
*/
|
|
85
|
+
readonly Transactions: SolanaTransactions;
|
|
86
|
+
/**
|
|
87
|
+
* Signature utilities module.
|
|
88
|
+
*/
|
|
89
|
+
readonly Signatures: SolanaSignatures;
|
|
90
|
+
/**
|
|
91
|
+
* Event/log scanning module.
|
|
92
|
+
*/
|
|
93
|
+
readonly Events: SolanaEvents;
|
|
94
|
+
/**
|
|
95
|
+
* @internal
|
|
96
|
+
*/
|
|
97
|
+
protected readonly logger: {
|
|
98
|
+
debug: (msg: string, ...args: any[]) => false | void;
|
|
99
|
+
info: (msg: string, ...args: any[]) => false | void;
|
|
100
|
+
warn: (msg: string, ...args: any[]) => false | void;
|
|
101
|
+
error: (msg: string, ...args: any[]) => false | void;
|
|
102
|
+
};
|
|
103
|
+
constructor(connection: Connection, retryPolicy?: SolanaRetryPolicy, solanaFeeEstimator?: SolanaFees);
|
|
104
|
+
/**
|
|
105
|
+
* @inheritDoc
|
|
106
|
+
*/
|
|
107
|
+
getBalance(signer: string, tokenAddress: string): Promise<bigint>;
|
|
108
|
+
/**
|
|
109
|
+
* @inheritDoc
|
|
110
|
+
*/
|
|
111
|
+
isValidAddress(address: string): boolean;
|
|
112
|
+
/**
|
|
113
|
+
* @inheritDoc
|
|
114
|
+
*/
|
|
115
|
+
normalizeAddress(address: string): string;
|
|
116
|
+
/**
|
|
117
|
+
* @inheritDoc
|
|
118
|
+
*/
|
|
119
|
+
getNativeCurrencyAddress(): string;
|
|
120
|
+
/**
|
|
121
|
+
* @inheritDoc
|
|
122
|
+
*/
|
|
123
|
+
shouldGetNativeTokenDrop(tokenAddress: string): boolean;
|
|
124
|
+
/**
|
|
125
|
+
* @inheritDoc
|
|
126
|
+
*/
|
|
127
|
+
txsTransfer(signer: string, token: string, amount: bigint, dstAddress: string, feeRate?: string): Promise<SolanaTx[]>;
|
|
128
|
+
/**
|
|
129
|
+
* @inheritDoc
|
|
130
|
+
*/
|
|
131
|
+
transfer(signer: SolanaSigner, token: string, amount: bigint, dstAddress: string, txOptions?: TransactionConfirmationOptions): Promise<string>;
|
|
132
|
+
/**
|
|
133
|
+
* @inheritDoc
|
|
134
|
+
*/
|
|
135
|
+
sendAndConfirm(signer: SolanaSigner, txs: SolanaTx[], waitForConfirmation?: boolean, abortSignal?: AbortSignal, parallel?: boolean, onBeforePublish?: (txId: string, rawTx: string) => Promise<void>): Promise<string[]>;
|
|
136
|
+
/**
|
|
137
|
+
* @inheritDoc
|
|
138
|
+
*/
|
|
139
|
+
sendSignedAndConfirm(txs: SignedSolanaTx[], waitForConfirmation?: boolean, abortSignal?: AbortSignal, parallel?: boolean, onBeforePublish?: (txId: string, rawTx: string) => Promise<void>): Promise<string[]>;
|
|
140
|
+
/**
|
|
141
|
+
* @inheritDoc
|
|
142
|
+
*/
|
|
143
|
+
prepareTxs(txs: SolanaTx[]): Promise<SolanaTx[]>;
|
|
144
|
+
/**
|
|
145
|
+
* @inheritDoc
|
|
146
|
+
*/
|
|
147
|
+
serializeTx(tx: SolanaTx): Promise<string>;
|
|
148
|
+
/**
|
|
149
|
+
* @inheritDoc
|
|
150
|
+
*/
|
|
151
|
+
deserializeTx(txData: string): Promise<SolanaTx>;
|
|
152
|
+
/**
|
|
153
|
+
* @inheritDoc
|
|
154
|
+
*/
|
|
155
|
+
serializeSignedTx(tx: Transaction): Promise<string>;
|
|
156
|
+
/**
|
|
157
|
+
* @inheritDoc
|
|
158
|
+
*/
|
|
159
|
+
deserializeSignedTx(txData: string): Promise<Transaction>;
|
|
160
|
+
/**
|
|
161
|
+
* @inheritDoc
|
|
162
|
+
*/
|
|
163
|
+
getTxId(signedTX: SignedSolanaTx): Promise<string>;
|
|
164
|
+
/**
|
|
165
|
+
* @inheritDoc
|
|
166
|
+
*/
|
|
167
|
+
getTxIdStatus(txId: string): Promise<"not_found" | "pending" | "success" | "reverted">;
|
|
168
|
+
/**
|
|
169
|
+
* @inheritDoc
|
|
170
|
+
*/
|
|
171
|
+
getTxStatus(tx: string): Promise<"not_found" | "pending" | "success" | "reverted">;
|
|
172
|
+
/**
|
|
173
|
+
* @inheritDoc
|
|
174
|
+
*/
|
|
175
|
+
getFinalizedBlock(): Promise<{
|
|
176
|
+
height: number;
|
|
177
|
+
blockHash: string;
|
|
178
|
+
}>;
|
|
179
|
+
/**
|
|
180
|
+
* @inheritDoc
|
|
181
|
+
*/
|
|
182
|
+
offBeforeTxReplace(callback: (oldTx: string, oldTxId: string, newTx: string, newTxId: string) => Promise<void>): boolean;
|
|
183
|
+
/**
|
|
184
|
+
* @inheritDoc
|
|
185
|
+
*/
|
|
186
|
+
onBeforeTxReplace(callback: (oldTx: string, oldTxId: string, newTx: string, newTxId: string) => Promise<void>): void;
|
|
187
|
+
/**
|
|
188
|
+
* @inheritDoc
|
|
189
|
+
*/
|
|
190
|
+
onBeforeTxSigned(callback: (tx: SolanaTx) => Promise<void>): void;
|
|
191
|
+
/**
|
|
192
|
+
* @inheritDoc
|
|
193
|
+
*/
|
|
194
|
+
offBeforeTxSigned(callback: (tx: SolanaTx) => Promise<void>): boolean;
|
|
195
|
+
/**
|
|
196
|
+
* Registers a low-level transaction sender override hook.
|
|
197
|
+
*
|
|
198
|
+
* @param callback Callback used for raw transaction publishing
|
|
199
|
+
*/
|
|
200
|
+
onSendTransaction(callback: (tx: Buffer, options?: SendOptions) => Promise<string>): void;
|
|
201
|
+
/**
|
|
202
|
+
* Unregisters a previously registered transaction sender override hook.
|
|
203
|
+
*
|
|
204
|
+
* @param callback Previously registered callback
|
|
205
|
+
*/
|
|
206
|
+
offSendTransaction(callback: (tx: Buffer, options?: SendOptions) => Promise<string>): boolean;
|
|
207
|
+
/**
|
|
208
|
+
* @inheritDoc
|
|
209
|
+
*/
|
|
210
|
+
isValidToken(tokenIdentifier: string): boolean;
|
|
211
|
+
/**
|
|
212
|
+
* @inheritDoc
|
|
213
|
+
*/
|
|
214
|
+
randomAddress(): string;
|
|
215
|
+
/**
|
|
216
|
+
* @inheritDoc
|
|
217
|
+
*/
|
|
218
|
+
randomSigner(): SolanaSigner;
|
|
219
|
+
/**
|
|
220
|
+
* @inheritDoc
|
|
221
|
+
*/
|
|
222
|
+
wrapSigner(signer: Wallet): Promise<SolanaSigner>;
|
|
223
|
+
verifyNetwork(bitcoinNetwork: BitcoinNetwork): Promise<void>;
|
|
224
|
+
}
|