@atomiqlabs/chain-solana 12.0.14 → 12.0.15
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/dist/index.d.ts +29 -29
- package/dist/index.js +45 -45
- package/dist/solana/SolanaChainType.d.ts +11 -11
- package/dist/solana/SolanaChainType.js +2 -2
- package/dist/solana/SolanaChains.d.ts +20 -20
- package/dist/solana/SolanaChains.js +25 -25
- package/dist/solana/SolanaInitializer.d.ts +18 -18
- package/dist/solana/SolanaInitializer.js +63 -63
- package/dist/solana/btcrelay/SolanaBtcRelay.d.ts +228 -228
- package/dist/solana/btcrelay/SolanaBtcRelay.js +441 -441
- package/dist/solana/btcrelay/headers/SolanaBtcHeader.d.ts +29 -29
- package/dist/solana/btcrelay/headers/SolanaBtcHeader.js +34 -34
- package/dist/solana/btcrelay/headers/SolanaBtcStoredHeader.d.ts +46 -46
- package/dist/solana/btcrelay/headers/SolanaBtcStoredHeader.js +78 -78
- package/dist/solana/btcrelay/program/programIdl.json +671 -671
- package/dist/solana/chain/SolanaAction.d.ts +26 -26
- package/dist/solana/chain/SolanaAction.js +86 -86
- package/dist/solana/chain/SolanaChainInterface.d.ts +65 -65
- package/dist/solana/chain/SolanaChainInterface.js +125 -125
- 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 +28 -28
- package/dist/solana/chain/modules/SolanaBlocks.js +72 -72
- 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 +121 -121
- package/dist/solana/chain/modules/SolanaFees.js +379 -379
- package/dist/solana/chain/modules/SolanaSignatures.d.ts +23 -23
- package/dist/solana/chain/modules/SolanaSignatures.js +39 -39
- package/dist/solana/chain/modules/SolanaSlots.d.ts +31 -31
- package/dist/solana/chain/modules/SolanaSlots.js +68 -68
- package/dist/solana/chain/modules/SolanaTokens.d.ts +136 -136
- package/dist/solana/chain/modules/SolanaTokens.js +248 -248
- package/dist/solana/chain/modules/SolanaTransactions.d.ts +124 -124
- package/dist/solana/chain/modules/SolanaTransactions.js +323 -323
- package/dist/solana/events/SolanaChainEvents.d.ts +88 -88
- package/dist/solana/events/SolanaChainEvents.js +256 -256
- package/dist/solana/events/SolanaChainEventsBrowser.d.ts +75 -75
- package/dist/solana/events/SolanaChainEventsBrowser.js +172 -172
- package/dist/solana/program/SolanaProgramBase.d.ts +40 -40
- package/dist/solana/program/SolanaProgramBase.js +43 -43
- 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 +114 -114
- package/dist/solana/swaps/SolanaSwapData.d.ts +71 -71
- package/dist/solana/swaps/SolanaSwapData.js +292 -292
- package/dist/solana/swaps/SolanaSwapModule.d.ts +10 -10
- package/dist/solana/swaps/SolanaSwapModule.js +11 -11
- package/dist/solana/swaps/SolanaSwapProgram.d.ts +224 -224
- package/dist/solana/swaps/SolanaSwapProgram.js +570 -570
- package/dist/solana/swaps/SwapTypeEnum.d.ts +11 -11
- package/dist/solana/swaps/SwapTypeEnum.js +42 -42
- package/dist/solana/swaps/modules/SolanaDataAccount.d.ts +94 -94
- package/dist/solana/swaps/modules/SolanaDataAccount.js +231 -231
- package/dist/solana/swaps/modules/SolanaLpVault.d.ts +71 -71
- package/dist/solana/swaps/modules/SolanaLpVault.js +173 -173
- package/dist/solana/swaps/modules/SwapClaim.d.ts +129 -129
- package/dist/solana/swaps/modules/SwapClaim.js +291 -291
- package/dist/solana/swaps/modules/SwapInit.d.ts +217 -217
- package/dist/solana/swaps/modules/SwapInit.js +519 -519
- package/dist/solana/swaps/modules/SwapRefund.d.ts +82 -82
- package/dist/solana/swaps/modules/SwapRefund.js +262 -262
- 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/wallet/SolanaKeypairWallet.d.ts +9 -9
- package/dist/solana/wallet/SolanaKeypairWallet.js +33 -33
- package/dist/solana/wallet/SolanaSigner.d.ts +11 -11
- package/dist/solana/wallet/SolanaSigner.js +17 -17
- package/dist/utils/Utils.d.ts +53 -53
- package/dist/utils/Utils.js +170 -170
- package/package.json +41 -41
- package/src/index.ts +36 -36
- package/src/solana/SolanaChainType.ts +27 -27
- package/src/solana/SolanaChains.ts +23 -23
- package/src/solana/SolanaInitializer.ts +102 -102
- package/src/solana/btcrelay/SolanaBtcRelay.ts +589 -589
- package/src/solana/btcrelay/headers/SolanaBtcHeader.ts +57 -57
- package/src/solana/btcrelay/headers/SolanaBtcStoredHeader.ts +102 -102
- package/src/solana/btcrelay/program/programIdl.json +670 -670
- package/src/solana/chain/SolanaAction.ts +108 -108
- package/src/solana/chain/SolanaChainInterface.ts +192 -192
- package/src/solana/chain/SolanaModule.ts +20 -20
- package/src/solana/chain/modules/SolanaAddresses.ts +20 -20
- package/src/solana/chain/modules/SolanaBlocks.ts +78 -78
- package/src/solana/chain/modules/SolanaEvents.ts +270 -270
- package/src/solana/chain/modules/SolanaFees.ts +450 -450
- package/src/solana/chain/modules/SolanaSignatures.ts +39 -39
- package/src/solana/chain/modules/SolanaSlots.ts +82 -82
- package/src/solana/chain/modules/SolanaTokens.ts +307 -307
- package/src/solana/chain/modules/SolanaTransactions.ts +365 -365
- package/src/solana/events/SolanaChainEvents.ts +299 -299
- package/src/solana/events/SolanaChainEventsBrowser.ts +209 -209
- package/src/solana/program/SolanaProgramBase.ts +79 -79
- package/src/solana/program/SolanaProgramModule.ts +15 -15
- package/src/solana/program/modules/SolanaProgramEvents.ts +155 -155
- package/src/solana/swaps/SolanaSwapData.ts +430 -430
- package/src/solana/swaps/SolanaSwapModule.ts +16 -16
- package/src/solana/swaps/SolanaSwapProgram.ts +854 -854
- package/src/solana/swaps/SwapTypeEnum.ts +29 -29
- package/src/solana/swaps/modules/SolanaDataAccount.ts +307 -307
- package/src/solana/swaps/modules/SolanaLpVault.ts +215 -215
- package/src/solana/swaps/modules/SwapClaim.ts +389 -389
- package/src/solana/swaps/modules/SwapInit.ts +663 -663
- package/src/solana/swaps/modules/SwapRefund.ts +323 -323
- package/src/solana/swaps/programIdl.json +944 -944
- package/src/solana/swaps/programTypes.ts +1885 -1885
- package/src/solana/wallet/SolanaKeypairWallet.ts +36 -36
- package/src/solana/wallet/SolanaSigner.ts +24 -24
- package/src/utils/Utils.ts +180 -180
|
@@ -1,217 +1,217 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { ParsedAccountsModeBlockResponse, PublicKey } from "@solana/web3.js";
|
|
3
|
-
import { SolanaSwapData } from "../SolanaSwapData";
|
|
4
|
-
import { SolanaSwapModule } from "../SolanaSwapModule";
|
|
5
|
-
import { SolanaTx } from "../../chain/modules/SolanaTransactions";
|
|
6
|
-
import { Buffer } from "buffer";
|
|
7
|
-
import { SolanaSigner } from "../../wallet/SolanaSigner";
|
|
8
|
-
export type SolanaPreFetchVerification = {
|
|
9
|
-
latestSlot?: {
|
|
10
|
-
slot: number;
|
|
11
|
-
timestamp: number;
|
|
12
|
-
};
|
|
13
|
-
transactionSlot?: {
|
|
14
|
-
slot: number;
|
|
15
|
-
blockhash: string;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
export type SolanaPreFetchData = {
|
|
19
|
-
block: ParsedAccountsModeBlockResponse;
|
|
20
|
-
slot: number;
|
|
21
|
-
timestamp: number;
|
|
22
|
-
};
|
|
23
|
-
export declare class SwapInit extends SolanaSwapModule {
|
|
24
|
-
readonly SIGNATURE_SLOT_BUFFER = 20;
|
|
25
|
-
readonly SIGNATURE_PREFETCH_DATA_VALIDITY = 5000;
|
|
26
|
-
private static readonly CUCosts;
|
|
27
|
-
/**
|
|
28
|
-
* bare Init action based on the data passed in swapData
|
|
29
|
-
*
|
|
30
|
-
* @param swapData
|
|
31
|
-
* @param timeout
|
|
32
|
-
* @private
|
|
33
|
-
*/
|
|
34
|
-
private Init;
|
|
35
|
-
/**
|
|
36
|
-
* InitPayIn action which includes SOL to WSOL wrapping if indicated by the fee rate
|
|
37
|
-
*
|
|
38
|
-
* @param swapData
|
|
39
|
-
* @param timeout
|
|
40
|
-
* @param feeRate
|
|
41
|
-
* @constructor
|
|
42
|
-
* @private
|
|
43
|
-
*/
|
|
44
|
-
private InitPayIn;
|
|
45
|
-
/**
|
|
46
|
-
* InitNotPayIn action with additional createAssociatedTokenAccountIdempotentInstruction instruction, such that
|
|
47
|
-
* a recipient ATA is created if it doesn't exist
|
|
48
|
-
*
|
|
49
|
-
* @param swapData
|
|
50
|
-
* @param timeout
|
|
51
|
-
* @constructor
|
|
52
|
-
* @private
|
|
53
|
-
*/
|
|
54
|
-
private InitNotPayIn;
|
|
55
|
-
private Wrap;
|
|
56
|
-
/**
|
|
57
|
-
* Extracts data about SOL to WSOL wrapping from the fee rate, fee rate is used to convey this information from
|
|
58
|
-
* the user to the intermediary, such that the intermediary creates valid signature for transaction including
|
|
59
|
-
* the SOL to WSOL wrapping instructions
|
|
60
|
-
*
|
|
61
|
-
* @param feeRate
|
|
62
|
-
* @private
|
|
63
|
-
*/
|
|
64
|
-
private extractAtaDataFromFeeRate;
|
|
65
|
-
/**
|
|
66
|
-
* Checks whether a wrap instruction (SOL -> WSOL) should be a part of the signed init message
|
|
67
|
-
*
|
|
68
|
-
* @param swapData
|
|
69
|
-
* @param feeRate
|
|
70
|
-
* @private
|
|
71
|
-
* @returns {boolean} returns true if wrap instruction should be added
|
|
72
|
-
*/
|
|
73
|
-
private shouldWrapOnInit;
|
|
74
|
-
/**
|
|
75
|
-
* Returns the transaction to be signed as an initialization signature from the intermediary, also adds
|
|
76
|
-
* SOL to WSOL wrapping if indicated by the fee rate
|
|
77
|
-
*
|
|
78
|
-
* @param swapData
|
|
79
|
-
* @param timeout
|
|
80
|
-
* @param feeRate
|
|
81
|
-
* @private
|
|
82
|
-
*/
|
|
83
|
-
private getTxToSign;
|
|
84
|
-
/**
|
|
85
|
-
* Returns auth prefix to be used with a specific swap, payIn=true & payIn=false use different prefixes (these
|
|
86
|
-
* actually have no meaning for the smart contract/solana program in the Solana case)
|
|
87
|
-
*
|
|
88
|
-
* @param swapData
|
|
89
|
-
* @private
|
|
90
|
-
*/
|
|
91
|
-
private getAuthPrefix;
|
|
92
|
-
/**
|
|
93
|
-
* Returns "processed" slot required for signature validation, uses preFetchedData if provided & valid
|
|
94
|
-
*
|
|
95
|
-
* @param preFetchedData
|
|
96
|
-
* @private
|
|
97
|
-
*/
|
|
98
|
-
private getSlotForSignature;
|
|
99
|
-
/**
|
|
100
|
-
* Returns blockhash required for signature validation, uses preFetchedData if provided & valid
|
|
101
|
-
*
|
|
102
|
-
* @param txSlot
|
|
103
|
-
* @param preFetchedData
|
|
104
|
-
* @private
|
|
105
|
-
*/
|
|
106
|
-
private getBlockhashForSignature;
|
|
107
|
-
/**
|
|
108
|
-
* Pre-fetches slot & block based on priorly received SolanaPreFetchData, such that it can later be used
|
|
109
|
-
* by signature verification
|
|
110
|
-
*
|
|
111
|
-
* @param data
|
|
112
|
-
*/
|
|
113
|
-
preFetchForInitSignatureVerification(data: SolanaPreFetchData): Promise<SolanaPreFetchVerification>;
|
|
114
|
-
/**
|
|
115
|
-
* Pre-fetches block data required for signing the init message by the LP, this can happen in parallel before
|
|
116
|
-
* signing takes place making the quoting quicker
|
|
117
|
-
*/
|
|
118
|
-
preFetchBlockDataForSignatures(): Promise<SolanaPreFetchData>;
|
|
119
|
-
/**
|
|
120
|
-
* Signs swap initialization authorization, using data from preFetchedBlockData if provided & still valid (subject
|
|
121
|
-
* to SIGNATURE_PREFETCH_DATA_VALIDITY)
|
|
122
|
-
*
|
|
123
|
-
* @param signer
|
|
124
|
-
* @param swapData
|
|
125
|
-
* @param authorizationTimeout
|
|
126
|
-
* @param feeRate
|
|
127
|
-
* @param preFetchedBlockData
|
|
128
|
-
* @public
|
|
129
|
-
*/
|
|
130
|
-
signSwapInitialization(signer: SolanaSigner, swapData: SolanaSwapData, authorizationTimeout: number, preFetchedBlockData?: SolanaPreFetchData, feeRate?: string): Promise<{
|
|
131
|
-
prefix: string;
|
|
132
|
-
timeout: string;
|
|
133
|
-
signature: string;
|
|
134
|
-
}>;
|
|
135
|
-
/**
|
|
136
|
-
* Checks whether the provided signature data is valid, using preFetchedData if provided and still valid
|
|
137
|
-
*
|
|
138
|
-
* @param sender
|
|
139
|
-
* @param swapData
|
|
140
|
-
* @param timeout
|
|
141
|
-
* @param prefix
|
|
142
|
-
* @param signature
|
|
143
|
-
* @param feeRate
|
|
144
|
-
* @param preFetchedData
|
|
145
|
-
* @public
|
|
146
|
-
*/
|
|
147
|
-
isSignatureValid(sender: string, swapData: SolanaSwapData, timeout: string, prefix: string, signature: string, feeRate?: string, preFetchedData?: SolanaPreFetchVerification): Promise<Buffer>;
|
|
148
|
-
/**
|
|
149
|
-
* Gets expiry of the provided signature data, this is a minimum of slot expiry & swap signature expiry
|
|
150
|
-
*
|
|
151
|
-
* @param timeout
|
|
152
|
-
* @param signature
|
|
153
|
-
* @param preFetchedData
|
|
154
|
-
* @public
|
|
155
|
-
*/
|
|
156
|
-
getSignatureExpiry(timeout: string, signature: string, preFetchedData?: SolanaPreFetchVerification): Promise<number>;
|
|
157
|
-
/**
|
|
158
|
-
* Checks whether signature is expired for good (uses "finalized" slot)
|
|
159
|
-
*
|
|
160
|
-
* @param signature
|
|
161
|
-
* @param timeout
|
|
162
|
-
* @public
|
|
163
|
-
*/
|
|
164
|
-
isSignatureExpired(signature: string, timeout: string): Promise<boolean>;
|
|
165
|
-
/**
|
|
166
|
-
* Creates init transaction (InitPayIn) with a valid signature from an LP, also adds a SOL to WSOL wrapping ix to
|
|
167
|
-
* the init transaction (if indicated by the fee rate) or adds the wrapping in a separate transaction (if no
|
|
168
|
-
* indication in the fee rate)
|
|
169
|
-
*
|
|
170
|
-
* @param swapData swap to initialize
|
|
171
|
-
* @param timeout init signature timeout
|
|
172
|
-
* @param prefix init signature prefix
|
|
173
|
-
* @param signature init signature
|
|
174
|
-
* @param skipChecks whether to skip signature validity checks
|
|
175
|
-
* @param feeRate fee rate to use for the transaction
|
|
176
|
-
*/
|
|
177
|
-
txsInitPayIn(swapData: SolanaSwapData, timeout: string, prefix: string, signature: string, skipChecks?: boolean, feeRate?: string): Promise<SolanaTx[]>;
|
|
178
|
-
/**
|
|
179
|
-
* Creates init transactions (InitNotPayIn) with a valid signature from an intermediary
|
|
180
|
-
*
|
|
181
|
-
* @param swapData swap to initialize
|
|
182
|
-
* @param timeout init signature timeout
|
|
183
|
-
* @param prefix init signature prefix
|
|
184
|
-
* @param signature init signature
|
|
185
|
-
* @param skipChecks whether to skip signature validity checks
|
|
186
|
-
* @param feeRate fee rate to use for the transaction
|
|
187
|
-
*/
|
|
188
|
-
txsInit(swapData: SolanaSwapData, timeout: string, prefix: string, signature: string, skipChecks?: boolean, feeRate?: string): Promise<SolanaTx[]>;
|
|
189
|
-
/**
|
|
190
|
-
* Returns the fee rate to be used for a specific init transaction, also adding indication whether the WSOL ATA
|
|
191
|
-
* should be initialized in the init transaction and/or current balance in the WSOL ATA
|
|
192
|
-
*
|
|
193
|
-
* @param offerer
|
|
194
|
-
* @param claimer
|
|
195
|
-
* @param token
|
|
196
|
-
* @param paymentHash
|
|
197
|
-
*/
|
|
198
|
-
getInitPayInFeeRate(offerer?: PublicKey, claimer?: PublicKey, token?: PublicKey, paymentHash?: string): Promise<string>;
|
|
199
|
-
/**
|
|
200
|
-
* Returns the fee rate to be used for a specific init transaction
|
|
201
|
-
*
|
|
202
|
-
* @param offerer
|
|
203
|
-
* @param claimer
|
|
204
|
-
* @param token
|
|
205
|
-
* @param paymentHash
|
|
206
|
-
*/
|
|
207
|
-
getInitFeeRate(offerer?: PublicKey, claimer?: PublicKey, token?: PublicKey, paymentHash?: string): Promise<string>;
|
|
208
|
-
/**
|
|
209
|
-
* Get the estimated solana fee of the init transaction, this includes the required deposit for creating swap PDA
|
|
210
|
-
* and also deposit for ATAs
|
|
211
|
-
*/
|
|
212
|
-
getInitFee(swapData: SolanaSwapData, feeRate?: string): Promise<bigint>;
|
|
213
|
-
/**
|
|
214
|
-
* Get the estimated solana fee of the init transaction, without the required deposit for creating swap PDA
|
|
215
|
-
*/
|
|
216
|
-
getRawInitFee(swapData: SolanaSwapData, feeRate?: string): Promise<bigint>;
|
|
217
|
-
}
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { ParsedAccountsModeBlockResponse, PublicKey } from "@solana/web3.js";
|
|
3
|
+
import { SolanaSwapData } from "../SolanaSwapData";
|
|
4
|
+
import { SolanaSwapModule } from "../SolanaSwapModule";
|
|
5
|
+
import { SolanaTx } from "../../chain/modules/SolanaTransactions";
|
|
6
|
+
import { Buffer } from "buffer";
|
|
7
|
+
import { SolanaSigner } from "../../wallet/SolanaSigner";
|
|
8
|
+
export type SolanaPreFetchVerification = {
|
|
9
|
+
latestSlot?: {
|
|
10
|
+
slot: number;
|
|
11
|
+
timestamp: number;
|
|
12
|
+
};
|
|
13
|
+
transactionSlot?: {
|
|
14
|
+
slot: number;
|
|
15
|
+
blockhash: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export type SolanaPreFetchData = {
|
|
19
|
+
block: ParsedAccountsModeBlockResponse;
|
|
20
|
+
slot: number;
|
|
21
|
+
timestamp: number;
|
|
22
|
+
};
|
|
23
|
+
export declare class SwapInit extends SolanaSwapModule {
|
|
24
|
+
readonly SIGNATURE_SLOT_BUFFER = 20;
|
|
25
|
+
readonly SIGNATURE_PREFETCH_DATA_VALIDITY = 5000;
|
|
26
|
+
private static readonly CUCosts;
|
|
27
|
+
/**
|
|
28
|
+
* bare Init action based on the data passed in swapData
|
|
29
|
+
*
|
|
30
|
+
* @param swapData
|
|
31
|
+
* @param timeout
|
|
32
|
+
* @private
|
|
33
|
+
*/
|
|
34
|
+
private Init;
|
|
35
|
+
/**
|
|
36
|
+
* InitPayIn action which includes SOL to WSOL wrapping if indicated by the fee rate
|
|
37
|
+
*
|
|
38
|
+
* @param swapData
|
|
39
|
+
* @param timeout
|
|
40
|
+
* @param feeRate
|
|
41
|
+
* @constructor
|
|
42
|
+
* @private
|
|
43
|
+
*/
|
|
44
|
+
private InitPayIn;
|
|
45
|
+
/**
|
|
46
|
+
* InitNotPayIn action with additional createAssociatedTokenAccountIdempotentInstruction instruction, such that
|
|
47
|
+
* a recipient ATA is created if it doesn't exist
|
|
48
|
+
*
|
|
49
|
+
* @param swapData
|
|
50
|
+
* @param timeout
|
|
51
|
+
* @constructor
|
|
52
|
+
* @private
|
|
53
|
+
*/
|
|
54
|
+
private InitNotPayIn;
|
|
55
|
+
private Wrap;
|
|
56
|
+
/**
|
|
57
|
+
* Extracts data about SOL to WSOL wrapping from the fee rate, fee rate is used to convey this information from
|
|
58
|
+
* the user to the intermediary, such that the intermediary creates valid signature for transaction including
|
|
59
|
+
* the SOL to WSOL wrapping instructions
|
|
60
|
+
*
|
|
61
|
+
* @param feeRate
|
|
62
|
+
* @private
|
|
63
|
+
*/
|
|
64
|
+
private extractAtaDataFromFeeRate;
|
|
65
|
+
/**
|
|
66
|
+
* Checks whether a wrap instruction (SOL -> WSOL) should be a part of the signed init message
|
|
67
|
+
*
|
|
68
|
+
* @param swapData
|
|
69
|
+
* @param feeRate
|
|
70
|
+
* @private
|
|
71
|
+
* @returns {boolean} returns true if wrap instruction should be added
|
|
72
|
+
*/
|
|
73
|
+
private shouldWrapOnInit;
|
|
74
|
+
/**
|
|
75
|
+
* Returns the transaction to be signed as an initialization signature from the intermediary, also adds
|
|
76
|
+
* SOL to WSOL wrapping if indicated by the fee rate
|
|
77
|
+
*
|
|
78
|
+
* @param swapData
|
|
79
|
+
* @param timeout
|
|
80
|
+
* @param feeRate
|
|
81
|
+
* @private
|
|
82
|
+
*/
|
|
83
|
+
private getTxToSign;
|
|
84
|
+
/**
|
|
85
|
+
* Returns auth prefix to be used with a specific swap, payIn=true & payIn=false use different prefixes (these
|
|
86
|
+
* actually have no meaning for the smart contract/solana program in the Solana case)
|
|
87
|
+
*
|
|
88
|
+
* @param swapData
|
|
89
|
+
* @private
|
|
90
|
+
*/
|
|
91
|
+
private getAuthPrefix;
|
|
92
|
+
/**
|
|
93
|
+
* Returns "processed" slot required for signature validation, uses preFetchedData if provided & valid
|
|
94
|
+
*
|
|
95
|
+
* @param preFetchedData
|
|
96
|
+
* @private
|
|
97
|
+
*/
|
|
98
|
+
private getSlotForSignature;
|
|
99
|
+
/**
|
|
100
|
+
* Returns blockhash required for signature validation, uses preFetchedData if provided & valid
|
|
101
|
+
*
|
|
102
|
+
* @param txSlot
|
|
103
|
+
* @param preFetchedData
|
|
104
|
+
* @private
|
|
105
|
+
*/
|
|
106
|
+
private getBlockhashForSignature;
|
|
107
|
+
/**
|
|
108
|
+
* Pre-fetches slot & block based on priorly received SolanaPreFetchData, such that it can later be used
|
|
109
|
+
* by signature verification
|
|
110
|
+
*
|
|
111
|
+
* @param data
|
|
112
|
+
*/
|
|
113
|
+
preFetchForInitSignatureVerification(data: SolanaPreFetchData): Promise<SolanaPreFetchVerification>;
|
|
114
|
+
/**
|
|
115
|
+
* Pre-fetches block data required for signing the init message by the LP, this can happen in parallel before
|
|
116
|
+
* signing takes place making the quoting quicker
|
|
117
|
+
*/
|
|
118
|
+
preFetchBlockDataForSignatures(): Promise<SolanaPreFetchData>;
|
|
119
|
+
/**
|
|
120
|
+
* Signs swap initialization authorization, using data from preFetchedBlockData if provided & still valid (subject
|
|
121
|
+
* to SIGNATURE_PREFETCH_DATA_VALIDITY)
|
|
122
|
+
*
|
|
123
|
+
* @param signer
|
|
124
|
+
* @param swapData
|
|
125
|
+
* @param authorizationTimeout
|
|
126
|
+
* @param feeRate
|
|
127
|
+
* @param preFetchedBlockData
|
|
128
|
+
* @public
|
|
129
|
+
*/
|
|
130
|
+
signSwapInitialization(signer: SolanaSigner, swapData: SolanaSwapData, authorizationTimeout: number, preFetchedBlockData?: SolanaPreFetchData, feeRate?: string): Promise<{
|
|
131
|
+
prefix: string;
|
|
132
|
+
timeout: string;
|
|
133
|
+
signature: string;
|
|
134
|
+
}>;
|
|
135
|
+
/**
|
|
136
|
+
* Checks whether the provided signature data is valid, using preFetchedData if provided and still valid
|
|
137
|
+
*
|
|
138
|
+
* @param sender
|
|
139
|
+
* @param swapData
|
|
140
|
+
* @param timeout
|
|
141
|
+
* @param prefix
|
|
142
|
+
* @param signature
|
|
143
|
+
* @param feeRate
|
|
144
|
+
* @param preFetchedData
|
|
145
|
+
* @public
|
|
146
|
+
*/
|
|
147
|
+
isSignatureValid(sender: string, swapData: SolanaSwapData, timeout: string, prefix: string, signature: string, feeRate?: string, preFetchedData?: SolanaPreFetchVerification): Promise<Buffer>;
|
|
148
|
+
/**
|
|
149
|
+
* Gets expiry of the provided signature data, this is a minimum of slot expiry & swap signature expiry
|
|
150
|
+
*
|
|
151
|
+
* @param timeout
|
|
152
|
+
* @param signature
|
|
153
|
+
* @param preFetchedData
|
|
154
|
+
* @public
|
|
155
|
+
*/
|
|
156
|
+
getSignatureExpiry(timeout: string, signature: string, preFetchedData?: SolanaPreFetchVerification): Promise<number>;
|
|
157
|
+
/**
|
|
158
|
+
* Checks whether signature is expired for good (uses "finalized" slot)
|
|
159
|
+
*
|
|
160
|
+
* @param signature
|
|
161
|
+
* @param timeout
|
|
162
|
+
* @public
|
|
163
|
+
*/
|
|
164
|
+
isSignatureExpired(signature: string, timeout: string): Promise<boolean>;
|
|
165
|
+
/**
|
|
166
|
+
* Creates init transaction (InitPayIn) with a valid signature from an LP, also adds a SOL to WSOL wrapping ix to
|
|
167
|
+
* the init transaction (if indicated by the fee rate) or adds the wrapping in a separate transaction (if no
|
|
168
|
+
* indication in the fee rate)
|
|
169
|
+
*
|
|
170
|
+
* @param swapData swap to initialize
|
|
171
|
+
* @param timeout init signature timeout
|
|
172
|
+
* @param prefix init signature prefix
|
|
173
|
+
* @param signature init signature
|
|
174
|
+
* @param skipChecks whether to skip signature validity checks
|
|
175
|
+
* @param feeRate fee rate to use for the transaction
|
|
176
|
+
*/
|
|
177
|
+
txsInitPayIn(swapData: SolanaSwapData, timeout: string, prefix: string, signature: string, skipChecks?: boolean, feeRate?: string): Promise<SolanaTx[]>;
|
|
178
|
+
/**
|
|
179
|
+
* Creates init transactions (InitNotPayIn) with a valid signature from an intermediary
|
|
180
|
+
*
|
|
181
|
+
* @param swapData swap to initialize
|
|
182
|
+
* @param timeout init signature timeout
|
|
183
|
+
* @param prefix init signature prefix
|
|
184
|
+
* @param signature init signature
|
|
185
|
+
* @param skipChecks whether to skip signature validity checks
|
|
186
|
+
* @param feeRate fee rate to use for the transaction
|
|
187
|
+
*/
|
|
188
|
+
txsInit(swapData: SolanaSwapData, timeout: string, prefix: string, signature: string, skipChecks?: boolean, feeRate?: string): Promise<SolanaTx[]>;
|
|
189
|
+
/**
|
|
190
|
+
* Returns the fee rate to be used for a specific init transaction, also adding indication whether the WSOL ATA
|
|
191
|
+
* should be initialized in the init transaction and/or current balance in the WSOL ATA
|
|
192
|
+
*
|
|
193
|
+
* @param offerer
|
|
194
|
+
* @param claimer
|
|
195
|
+
* @param token
|
|
196
|
+
* @param paymentHash
|
|
197
|
+
*/
|
|
198
|
+
getInitPayInFeeRate(offerer?: PublicKey, claimer?: PublicKey, token?: PublicKey, paymentHash?: string): Promise<string>;
|
|
199
|
+
/**
|
|
200
|
+
* Returns the fee rate to be used for a specific init transaction
|
|
201
|
+
*
|
|
202
|
+
* @param offerer
|
|
203
|
+
* @param claimer
|
|
204
|
+
* @param token
|
|
205
|
+
* @param paymentHash
|
|
206
|
+
*/
|
|
207
|
+
getInitFeeRate(offerer?: PublicKey, claimer?: PublicKey, token?: PublicKey, paymentHash?: string): Promise<string>;
|
|
208
|
+
/**
|
|
209
|
+
* Get the estimated solana fee of the init transaction, this includes the required deposit for creating swap PDA
|
|
210
|
+
* and also deposit for ATAs
|
|
211
|
+
*/
|
|
212
|
+
getInitFee(swapData: SolanaSwapData, feeRate?: string): Promise<bigint>;
|
|
213
|
+
/**
|
|
214
|
+
* Get the estimated solana fee of the init transaction, without the required deposit for creating swap PDA
|
|
215
|
+
*/
|
|
216
|
+
getRawInitFee(swapData: SolanaSwapData, feeRate?: string): Promise<bigint>;
|
|
217
|
+
}
|