@atomiqlabs/chain-solana 12.0.12 → 12.0.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/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 -225
- 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 -256
- 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,292 +1,292 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SolanaSwapData = void 0;
|
|
4
|
-
const web3_js_1 = require("@solana/web3.js");
|
|
5
|
-
const BN = require("bn.js");
|
|
6
|
-
const base_1 = require("@atomiqlabs/base");
|
|
7
|
-
const SwapTypeEnum_1 = require("./SwapTypeEnum");
|
|
8
|
-
const buffer_1 = require("buffer");
|
|
9
|
-
const spl_token_1 = require("@solana/spl-token");
|
|
10
|
-
const Utils_1 = require("../../utils/Utils");
|
|
11
|
-
const SolanaTokens_1 = require("../chain/modules/SolanaTokens");
|
|
12
|
-
const EXPIRY_BLOCKHEIGHT_THRESHOLD = new BN("1000000000");
|
|
13
|
-
class SolanaSwapData extends base_1.SwapData {
|
|
14
|
-
constructor(offererOrData, claimer, token, amount, paymentHash, sequence, expiry, nonce, confirmations, payOut, kind, payIn, offererAta, claimerAta, securityDeposit, claimerBounty, txoHash) {
|
|
15
|
-
super();
|
|
16
|
-
if (claimer != null || token != null || amount != null || paymentHash != null || expiry != null ||
|
|
17
|
-
nonce != null || confirmations != null || payOut != null || kind != null || payIn != null || claimerAta != null) {
|
|
18
|
-
this.offerer = offererOrData;
|
|
19
|
-
this.claimer = claimer;
|
|
20
|
-
this.token = token;
|
|
21
|
-
this.amount = amount;
|
|
22
|
-
this.paymentHash = paymentHash;
|
|
23
|
-
this.sequence = sequence;
|
|
24
|
-
this.expiry = expiry;
|
|
25
|
-
this.nonce = nonce;
|
|
26
|
-
this.confirmations = confirmations;
|
|
27
|
-
this.payOut = payOut;
|
|
28
|
-
this.kind = kind;
|
|
29
|
-
this.payIn = payIn;
|
|
30
|
-
this.claimerAta = claimerAta;
|
|
31
|
-
this.offererAta = offererAta;
|
|
32
|
-
this.securityDeposit = securityDeposit;
|
|
33
|
-
this.claimerBounty = claimerBounty;
|
|
34
|
-
this.txoHash = txoHash;
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
this.offerer = offererOrData.offerer == null ? null : new web3_js_1.PublicKey(offererOrData.offerer);
|
|
38
|
-
this.claimer = offererOrData.claimer == null ? null : new web3_js_1.PublicKey(offererOrData.claimer);
|
|
39
|
-
this.token = offererOrData.token == null ? null : new web3_js_1.PublicKey(offererOrData.token);
|
|
40
|
-
this.amount = offererOrData.amount == null ? null : new BN(offererOrData.amount);
|
|
41
|
-
this.paymentHash = offererOrData.paymentHash;
|
|
42
|
-
this.sequence = offererOrData.sequence == null ? null : new BN(offererOrData.sequence);
|
|
43
|
-
this.expiry = offererOrData.expiry == null ? null : new BN(offererOrData.expiry);
|
|
44
|
-
this.nonce = offererOrData.nonce == null ? null : new BN(offererOrData.nonce);
|
|
45
|
-
this.confirmations = offererOrData.confirmations;
|
|
46
|
-
this.payOut = offererOrData.payOut;
|
|
47
|
-
this.kind = offererOrData.kind;
|
|
48
|
-
this.payIn = offererOrData.payIn;
|
|
49
|
-
this.claimerAta = offererOrData.claimerAta == null ? null : new web3_js_1.PublicKey(offererOrData.claimerAta);
|
|
50
|
-
this.offererAta = offererOrData.offererAta == null ? null : new web3_js_1.PublicKey(offererOrData.offererAta);
|
|
51
|
-
this.securityDeposit = offererOrData.securityDeposit == null ? null : new BN(offererOrData.securityDeposit);
|
|
52
|
-
this.claimerBounty = offererOrData.claimerBounty == null ? null : new BN(offererOrData.claimerBounty);
|
|
53
|
-
this.txoHash = offererOrData.txoHash;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
getOfferer() {
|
|
57
|
-
return this.offerer.toBase58();
|
|
58
|
-
}
|
|
59
|
-
setOfferer(newOfferer) {
|
|
60
|
-
this.offerer = new web3_js_1.PublicKey(newOfferer);
|
|
61
|
-
this.offererAta = (0, spl_token_1.getAssociatedTokenAddressSync)(this.token, this.offerer);
|
|
62
|
-
this.payIn = true;
|
|
63
|
-
}
|
|
64
|
-
getClaimer() {
|
|
65
|
-
return this.claimer.toBase58();
|
|
66
|
-
}
|
|
67
|
-
setClaimer(newClaimer) {
|
|
68
|
-
this.claimer = new web3_js_1.PublicKey(newClaimer);
|
|
69
|
-
this.payIn = false;
|
|
70
|
-
this.payOut = true;
|
|
71
|
-
this.claimerAta = (0, spl_token_1.getAssociatedTokenAddressSync)(this.token, this.claimer);
|
|
72
|
-
}
|
|
73
|
-
serialize() {
|
|
74
|
-
return {
|
|
75
|
-
type: "sol",
|
|
76
|
-
offerer: this.offerer == null ? null : this.offerer.toBase58(),
|
|
77
|
-
claimer: this.claimer == null ? null : this.claimer.toBase58(),
|
|
78
|
-
token: this.token == null ? null : this.token.toBase58(),
|
|
79
|
-
amount: this.amount == null ? null : this.amount.toString(10),
|
|
80
|
-
paymentHash: this.paymentHash,
|
|
81
|
-
sequence: this.sequence == null ? null : this.sequence.toString(10),
|
|
82
|
-
expiry: this.expiry == null ? null : this.expiry.toString(10),
|
|
83
|
-
nonce: this.nonce == null ? null : this.nonce.toString(10),
|
|
84
|
-
confirmations: this.confirmations,
|
|
85
|
-
payOut: this.payOut,
|
|
86
|
-
kind: this.kind,
|
|
87
|
-
payIn: this.payIn,
|
|
88
|
-
offererAta: this.offererAta == null ? null : this.offererAta.toBase58(),
|
|
89
|
-
claimerAta: this.claimerAta == null ? null : this.claimerAta.toBase58(),
|
|
90
|
-
securityDeposit: this.securityDeposit == null ? null : this.securityDeposit.toString(10),
|
|
91
|
-
claimerBounty: this.claimerBounty == null ? null : this.claimerBounty.toString(10),
|
|
92
|
-
txoHash: this.txoHash
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
getAmount() {
|
|
96
|
-
return (0, Utils_1.toBigInt)(this.amount);
|
|
97
|
-
}
|
|
98
|
-
getToken() {
|
|
99
|
-
return this.token.toString();
|
|
100
|
-
}
|
|
101
|
-
isToken(token) {
|
|
102
|
-
return this.token.equals(new web3_js_1.PublicKey(token));
|
|
103
|
-
}
|
|
104
|
-
getType() {
|
|
105
|
-
return SolanaSwapData.kindToType(this.kind);
|
|
106
|
-
}
|
|
107
|
-
getExpiry() {
|
|
108
|
-
if (this.expiry.lt(EXPIRY_BLOCKHEIGHT_THRESHOLD))
|
|
109
|
-
return null;
|
|
110
|
-
return (0, Utils_1.toBigInt)(this.expiry);
|
|
111
|
-
}
|
|
112
|
-
getConfirmationsHint() {
|
|
113
|
-
return this.confirmations;
|
|
114
|
-
}
|
|
115
|
-
getNonceHint() {
|
|
116
|
-
return (0, Utils_1.toBigInt)(this.nonce);
|
|
117
|
-
}
|
|
118
|
-
isPayIn() {
|
|
119
|
-
return this.payIn;
|
|
120
|
-
}
|
|
121
|
-
isPayOut() {
|
|
122
|
-
return this.payOut;
|
|
123
|
-
}
|
|
124
|
-
getClaimHash() {
|
|
125
|
-
return (0, Utils_1.toClaimHash)(this.paymentHash, (0, Utils_1.toBigInt)(this.nonce), this.confirmations);
|
|
126
|
-
}
|
|
127
|
-
getEscrowHash() {
|
|
128
|
-
return (0, Utils_1.toEscrowHash)(this.paymentHash, this.sequence);
|
|
129
|
-
}
|
|
130
|
-
getSequence() {
|
|
131
|
-
return (0, Utils_1.toBigInt)(this.sequence);
|
|
132
|
-
}
|
|
133
|
-
getTxoHashHint() {
|
|
134
|
-
if (this.txoHash === "0000000000000000000000000000000000000000000000000000000000000000")
|
|
135
|
-
return null; //Txo hash opt-out flag
|
|
136
|
-
return this.txoHash;
|
|
137
|
-
}
|
|
138
|
-
getHTLCHashHint() {
|
|
139
|
-
if (this.getType() === base_1.ChainSwapType.HTLC)
|
|
140
|
-
return this.paymentHash;
|
|
141
|
-
return null;
|
|
142
|
-
}
|
|
143
|
-
getExtraData() {
|
|
144
|
-
return this.txoHash;
|
|
145
|
-
}
|
|
146
|
-
setExtraData(txoHash) {
|
|
147
|
-
this.txoHash = txoHash;
|
|
148
|
-
}
|
|
149
|
-
getSecurityDeposit() {
|
|
150
|
-
return (0, Utils_1.toBigInt)(this.securityDeposit);
|
|
151
|
-
}
|
|
152
|
-
getClaimerBounty() {
|
|
153
|
-
return (0, Utils_1.toBigInt)(this.claimerBounty);
|
|
154
|
-
}
|
|
155
|
-
getTotalDeposit() {
|
|
156
|
-
return (0, Utils_1.toBigInt)(this.claimerBounty.lt(this.securityDeposit) ? this.securityDeposit : this.claimerBounty);
|
|
157
|
-
}
|
|
158
|
-
toSwapDataStruct() {
|
|
159
|
-
return {
|
|
160
|
-
kind: SwapTypeEnum_1.SwapTypeEnum.fromNumber(this.kind),
|
|
161
|
-
confirmations: this.confirmations,
|
|
162
|
-
nonce: this.nonce,
|
|
163
|
-
hash: [...buffer_1.Buffer.from(this.paymentHash, "hex")],
|
|
164
|
-
payIn: this.payIn,
|
|
165
|
-
payOut: this.payOut,
|
|
166
|
-
amount: this.amount,
|
|
167
|
-
expiry: this.expiry,
|
|
168
|
-
sequence: this.sequence
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
correctPDA(account) {
|
|
172
|
-
return SwapTypeEnum_1.SwapTypeEnum.toNumber(account.data.kind) === this.kind &&
|
|
173
|
-
account.data.confirmations === this.confirmations &&
|
|
174
|
-
this.nonce.eq(account.data.nonce) &&
|
|
175
|
-
buffer_1.Buffer.from(account.data.hash).toString("hex") === this.paymentHash &&
|
|
176
|
-
account.data.payIn === this.payIn &&
|
|
177
|
-
account.data.payOut === this.payOut &&
|
|
178
|
-
this.amount.eq(account.data.amount) &&
|
|
179
|
-
this.expiry.eq(account.data.expiry) &&
|
|
180
|
-
this.sequence.eq(account.data.sequence) &&
|
|
181
|
-
account.offerer.equals(this.offerer) &&
|
|
182
|
-
(this.offererAta == null || account.offererAta.equals(this.offererAta)) &&
|
|
183
|
-
account.claimer.equals(this.claimer) &&
|
|
184
|
-
(this.claimerAta == null || account.claimerAta.equals(this.claimerAta)) &&
|
|
185
|
-
account.mint.equals(this.token) &&
|
|
186
|
-
this.claimerBounty.eq(account.claimerBounty) &&
|
|
187
|
-
this.securityDeposit.eq(account.securityDeposit);
|
|
188
|
-
}
|
|
189
|
-
equals(other) {
|
|
190
|
-
if (this.claimerAta == null && other.claimerAta != null)
|
|
191
|
-
return false;
|
|
192
|
-
if (this.claimerAta != null && other.claimerAta == null)
|
|
193
|
-
return false;
|
|
194
|
-
if (this.claimerAta != null && other.claimerAta != null) {
|
|
195
|
-
if (!this.claimerAta.equals(other.claimerAta))
|
|
196
|
-
return false;
|
|
197
|
-
}
|
|
198
|
-
if (this.offererAta == null && other.offererAta != null)
|
|
199
|
-
return false;
|
|
200
|
-
if (this.offererAta != null && other.offererAta == null)
|
|
201
|
-
return false;
|
|
202
|
-
if (this.offererAta != null && other.offererAta != null) {
|
|
203
|
-
if (!this.offererAta.equals(other.offererAta))
|
|
204
|
-
return false;
|
|
205
|
-
}
|
|
206
|
-
return other.kind === this.kind &&
|
|
207
|
-
other.confirmations === this.confirmations &&
|
|
208
|
-
this.nonce.eq(other.nonce) &&
|
|
209
|
-
other.paymentHash === this.paymentHash &&
|
|
210
|
-
this.sequence.eq(other.sequence) &&
|
|
211
|
-
other.payIn === this.payIn &&
|
|
212
|
-
other.payOut === this.payOut &&
|
|
213
|
-
other.offerer.equals(this.offerer) &&
|
|
214
|
-
other.claimer.equals(this.claimer) &&
|
|
215
|
-
other.expiry.eq(this.expiry) &&
|
|
216
|
-
other.amount.eq(this.amount) &&
|
|
217
|
-
other.securityDeposit.eq(this.securityDeposit) &&
|
|
218
|
-
other.claimerBounty.eq(this.claimerBounty) &&
|
|
219
|
-
other.token.equals(this.token);
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* Converts initialize instruction data into {SolanaSwapData}
|
|
223
|
-
*
|
|
224
|
-
* @param initIx
|
|
225
|
-
* @param txoHash
|
|
226
|
-
* @private
|
|
227
|
-
* @returns {SolanaSwapData} converted and parsed swap data
|
|
228
|
-
*/
|
|
229
|
-
static fromInstruction(initIx, txoHash) {
|
|
230
|
-
const paymentHash = buffer_1.Buffer.from(initIx.data.swapData.hash);
|
|
231
|
-
let securityDeposit = new BN(0);
|
|
232
|
-
let claimerBounty = new BN(0);
|
|
233
|
-
let payIn = true;
|
|
234
|
-
if (initIx.name === "offererInitialize") {
|
|
235
|
-
payIn = false;
|
|
236
|
-
securityDeposit = initIx.data.securityDeposit;
|
|
237
|
-
claimerBounty = initIx.data.claimerBounty;
|
|
238
|
-
}
|
|
239
|
-
return new SolanaSwapData(initIx.accounts.offerer, initIx.accounts.claimer, initIx.accounts.mint, initIx.data.swapData.amount, paymentHash.toString("hex"), initIx.data.swapData.sequence, initIx.data.swapData.expiry, initIx.data.swapData.nonce, initIx.data.swapData.confirmations, initIx.data.swapData.payOut, SwapTypeEnum_1.SwapTypeEnum.toNumber(initIx.data.swapData.kind), payIn, initIx.name === "offererInitializePayIn" ? initIx.accounts.offererAta : web3_js_1.PublicKey.default, initIx.data.swapData.payOut ? initIx.accounts.claimerAta : web3_js_1.PublicKey.default, securityDeposit, claimerBounty, txoHash);
|
|
240
|
-
}
|
|
241
|
-
static fromEscrowState(account) {
|
|
242
|
-
const data = account.data;
|
|
243
|
-
return new SolanaSwapData(account.offerer, account.claimer, account.mint, data.amount, buffer_1.Buffer.from(data.hash).toString("hex"), data.sequence, data.expiry, data.nonce, data.confirmations, data.payOut, SwapTypeEnum_1.SwapTypeEnum.toNumber(data.kind), data.payIn, account.offererAta, account.claimerAta, account.securityDeposit, account.claimerBounty, null);
|
|
244
|
-
}
|
|
245
|
-
static typeToKind(type) {
|
|
246
|
-
switch (type) {
|
|
247
|
-
case base_1.ChainSwapType.HTLC:
|
|
248
|
-
return 0;
|
|
249
|
-
case base_1.ChainSwapType.CHAIN:
|
|
250
|
-
return 1;
|
|
251
|
-
case base_1.ChainSwapType.CHAIN_NONCED:
|
|
252
|
-
return 2;
|
|
253
|
-
case base_1.ChainSwapType.CHAIN_TXID:
|
|
254
|
-
return 3;
|
|
255
|
-
}
|
|
256
|
-
return null;
|
|
257
|
-
}
|
|
258
|
-
static kindToType(value) {
|
|
259
|
-
switch (value) {
|
|
260
|
-
case 0:
|
|
261
|
-
return base_1.ChainSwapType.HTLC;
|
|
262
|
-
case 1:
|
|
263
|
-
return base_1.ChainSwapType.CHAIN;
|
|
264
|
-
case 2:
|
|
265
|
-
return base_1.ChainSwapType.CHAIN_NONCED;
|
|
266
|
-
case 3:
|
|
267
|
-
return base_1.ChainSwapType.CHAIN_TXID;
|
|
268
|
-
}
|
|
269
|
-
return null;
|
|
270
|
-
}
|
|
271
|
-
isClaimer(address) {
|
|
272
|
-
const _address = new web3_js_1.PublicKey(address);
|
|
273
|
-
if (this.isPayOut()) {
|
|
274
|
-
//Also check that swapData's ATA is correct
|
|
275
|
-
const ourAta = (0, spl_token_1.getAssociatedTokenAddressSync)(this.token, _address);
|
|
276
|
-
if (!this.claimerAta.equals(ourAta))
|
|
277
|
-
return false;
|
|
278
|
-
}
|
|
279
|
-
return this.claimer.equals(new web3_js_1.PublicKey(address));
|
|
280
|
-
}
|
|
281
|
-
isOfferer(address) {
|
|
282
|
-
return this.offerer.equals(new web3_js_1.PublicKey(address));
|
|
283
|
-
}
|
|
284
|
-
getDepositToken() {
|
|
285
|
-
return SolanaTokens_1.SolanaTokens.WSOL_ADDRESS.toString();
|
|
286
|
-
}
|
|
287
|
-
isDepositToken(token) {
|
|
288
|
-
return SolanaTokens_1.SolanaTokens.WSOL_ADDRESS.equals(new web3_js_1.PublicKey(token));
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
exports.SolanaSwapData = SolanaSwapData;
|
|
292
|
-
base_1.SwapData.deserializers["sol"] = SolanaSwapData;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SolanaSwapData = void 0;
|
|
4
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
5
|
+
const BN = require("bn.js");
|
|
6
|
+
const base_1 = require("@atomiqlabs/base");
|
|
7
|
+
const SwapTypeEnum_1 = require("./SwapTypeEnum");
|
|
8
|
+
const buffer_1 = require("buffer");
|
|
9
|
+
const spl_token_1 = require("@solana/spl-token");
|
|
10
|
+
const Utils_1 = require("../../utils/Utils");
|
|
11
|
+
const SolanaTokens_1 = require("../chain/modules/SolanaTokens");
|
|
12
|
+
const EXPIRY_BLOCKHEIGHT_THRESHOLD = new BN("1000000000");
|
|
13
|
+
class SolanaSwapData extends base_1.SwapData {
|
|
14
|
+
constructor(offererOrData, claimer, token, amount, paymentHash, sequence, expiry, nonce, confirmations, payOut, kind, payIn, offererAta, claimerAta, securityDeposit, claimerBounty, txoHash) {
|
|
15
|
+
super();
|
|
16
|
+
if (claimer != null || token != null || amount != null || paymentHash != null || expiry != null ||
|
|
17
|
+
nonce != null || confirmations != null || payOut != null || kind != null || payIn != null || claimerAta != null) {
|
|
18
|
+
this.offerer = offererOrData;
|
|
19
|
+
this.claimer = claimer;
|
|
20
|
+
this.token = token;
|
|
21
|
+
this.amount = amount;
|
|
22
|
+
this.paymentHash = paymentHash;
|
|
23
|
+
this.sequence = sequence;
|
|
24
|
+
this.expiry = expiry;
|
|
25
|
+
this.nonce = nonce;
|
|
26
|
+
this.confirmations = confirmations;
|
|
27
|
+
this.payOut = payOut;
|
|
28
|
+
this.kind = kind;
|
|
29
|
+
this.payIn = payIn;
|
|
30
|
+
this.claimerAta = claimerAta;
|
|
31
|
+
this.offererAta = offererAta;
|
|
32
|
+
this.securityDeposit = securityDeposit;
|
|
33
|
+
this.claimerBounty = claimerBounty;
|
|
34
|
+
this.txoHash = txoHash;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
this.offerer = offererOrData.offerer == null ? null : new web3_js_1.PublicKey(offererOrData.offerer);
|
|
38
|
+
this.claimer = offererOrData.claimer == null ? null : new web3_js_1.PublicKey(offererOrData.claimer);
|
|
39
|
+
this.token = offererOrData.token == null ? null : new web3_js_1.PublicKey(offererOrData.token);
|
|
40
|
+
this.amount = offererOrData.amount == null ? null : new BN(offererOrData.amount);
|
|
41
|
+
this.paymentHash = offererOrData.paymentHash;
|
|
42
|
+
this.sequence = offererOrData.sequence == null ? null : new BN(offererOrData.sequence);
|
|
43
|
+
this.expiry = offererOrData.expiry == null ? null : new BN(offererOrData.expiry);
|
|
44
|
+
this.nonce = offererOrData.nonce == null ? null : new BN(offererOrData.nonce);
|
|
45
|
+
this.confirmations = offererOrData.confirmations;
|
|
46
|
+
this.payOut = offererOrData.payOut;
|
|
47
|
+
this.kind = offererOrData.kind;
|
|
48
|
+
this.payIn = offererOrData.payIn;
|
|
49
|
+
this.claimerAta = offererOrData.claimerAta == null ? null : new web3_js_1.PublicKey(offererOrData.claimerAta);
|
|
50
|
+
this.offererAta = offererOrData.offererAta == null ? null : new web3_js_1.PublicKey(offererOrData.offererAta);
|
|
51
|
+
this.securityDeposit = offererOrData.securityDeposit == null ? null : new BN(offererOrData.securityDeposit);
|
|
52
|
+
this.claimerBounty = offererOrData.claimerBounty == null ? null : new BN(offererOrData.claimerBounty);
|
|
53
|
+
this.txoHash = offererOrData.txoHash;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
getOfferer() {
|
|
57
|
+
return this.offerer.toBase58();
|
|
58
|
+
}
|
|
59
|
+
setOfferer(newOfferer) {
|
|
60
|
+
this.offerer = new web3_js_1.PublicKey(newOfferer);
|
|
61
|
+
this.offererAta = (0, spl_token_1.getAssociatedTokenAddressSync)(this.token, this.offerer);
|
|
62
|
+
this.payIn = true;
|
|
63
|
+
}
|
|
64
|
+
getClaimer() {
|
|
65
|
+
return this.claimer.toBase58();
|
|
66
|
+
}
|
|
67
|
+
setClaimer(newClaimer) {
|
|
68
|
+
this.claimer = new web3_js_1.PublicKey(newClaimer);
|
|
69
|
+
this.payIn = false;
|
|
70
|
+
this.payOut = true;
|
|
71
|
+
this.claimerAta = (0, spl_token_1.getAssociatedTokenAddressSync)(this.token, this.claimer);
|
|
72
|
+
}
|
|
73
|
+
serialize() {
|
|
74
|
+
return {
|
|
75
|
+
type: "sol",
|
|
76
|
+
offerer: this.offerer == null ? null : this.offerer.toBase58(),
|
|
77
|
+
claimer: this.claimer == null ? null : this.claimer.toBase58(),
|
|
78
|
+
token: this.token == null ? null : this.token.toBase58(),
|
|
79
|
+
amount: this.amount == null ? null : this.amount.toString(10),
|
|
80
|
+
paymentHash: this.paymentHash,
|
|
81
|
+
sequence: this.sequence == null ? null : this.sequence.toString(10),
|
|
82
|
+
expiry: this.expiry == null ? null : this.expiry.toString(10),
|
|
83
|
+
nonce: this.nonce == null ? null : this.nonce.toString(10),
|
|
84
|
+
confirmations: this.confirmations,
|
|
85
|
+
payOut: this.payOut,
|
|
86
|
+
kind: this.kind,
|
|
87
|
+
payIn: this.payIn,
|
|
88
|
+
offererAta: this.offererAta == null ? null : this.offererAta.toBase58(),
|
|
89
|
+
claimerAta: this.claimerAta == null ? null : this.claimerAta.toBase58(),
|
|
90
|
+
securityDeposit: this.securityDeposit == null ? null : this.securityDeposit.toString(10),
|
|
91
|
+
claimerBounty: this.claimerBounty == null ? null : this.claimerBounty.toString(10),
|
|
92
|
+
txoHash: this.txoHash
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
getAmount() {
|
|
96
|
+
return (0, Utils_1.toBigInt)(this.amount);
|
|
97
|
+
}
|
|
98
|
+
getToken() {
|
|
99
|
+
return this.token.toString();
|
|
100
|
+
}
|
|
101
|
+
isToken(token) {
|
|
102
|
+
return this.token.equals(new web3_js_1.PublicKey(token));
|
|
103
|
+
}
|
|
104
|
+
getType() {
|
|
105
|
+
return SolanaSwapData.kindToType(this.kind);
|
|
106
|
+
}
|
|
107
|
+
getExpiry() {
|
|
108
|
+
if (this.expiry.lt(EXPIRY_BLOCKHEIGHT_THRESHOLD))
|
|
109
|
+
return null;
|
|
110
|
+
return (0, Utils_1.toBigInt)(this.expiry);
|
|
111
|
+
}
|
|
112
|
+
getConfirmationsHint() {
|
|
113
|
+
return this.confirmations;
|
|
114
|
+
}
|
|
115
|
+
getNonceHint() {
|
|
116
|
+
return (0, Utils_1.toBigInt)(this.nonce);
|
|
117
|
+
}
|
|
118
|
+
isPayIn() {
|
|
119
|
+
return this.payIn;
|
|
120
|
+
}
|
|
121
|
+
isPayOut() {
|
|
122
|
+
return this.payOut;
|
|
123
|
+
}
|
|
124
|
+
getClaimHash() {
|
|
125
|
+
return (0, Utils_1.toClaimHash)(this.paymentHash, (0, Utils_1.toBigInt)(this.nonce), this.confirmations);
|
|
126
|
+
}
|
|
127
|
+
getEscrowHash() {
|
|
128
|
+
return (0, Utils_1.toEscrowHash)(this.paymentHash, this.sequence);
|
|
129
|
+
}
|
|
130
|
+
getSequence() {
|
|
131
|
+
return (0, Utils_1.toBigInt)(this.sequence);
|
|
132
|
+
}
|
|
133
|
+
getTxoHashHint() {
|
|
134
|
+
if (this.txoHash === "0000000000000000000000000000000000000000000000000000000000000000")
|
|
135
|
+
return null; //Txo hash opt-out flag
|
|
136
|
+
return this.txoHash;
|
|
137
|
+
}
|
|
138
|
+
getHTLCHashHint() {
|
|
139
|
+
if (this.getType() === base_1.ChainSwapType.HTLC)
|
|
140
|
+
return this.paymentHash;
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
getExtraData() {
|
|
144
|
+
return this.txoHash;
|
|
145
|
+
}
|
|
146
|
+
setExtraData(txoHash) {
|
|
147
|
+
this.txoHash = txoHash;
|
|
148
|
+
}
|
|
149
|
+
getSecurityDeposit() {
|
|
150
|
+
return (0, Utils_1.toBigInt)(this.securityDeposit);
|
|
151
|
+
}
|
|
152
|
+
getClaimerBounty() {
|
|
153
|
+
return (0, Utils_1.toBigInt)(this.claimerBounty);
|
|
154
|
+
}
|
|
155
|
+
getTotalDeposit() {
|
|
156
|
+
return (0, Utils_1.toBigInt)(this.claimerBounty.lt(this.securityDeposit) ? this.securityDeposit : this.claimerBounty);
|
|
157
|
+
}
|
|
158
|
+
toSwapDataStruct() {
|
|
159
|
+
return {
|
|
160
|
+
kind: SwapTypeEnum_1.SwapTypeEnum.fromNumber(this.kind),
|
|
161
|
+
confirmations: this.confirmations,
|
|
162
|
+
nonce: this.nonce,
|
|
163
|
+
hash: [...buffer_1.Buffer.from(this.paymentHash, "hex")],
|
|
164
|
+
payIn: this.payIn,
|
|
165
|
+
payOut: this.payOut,
|
|
166
|
+
amount: this.amount,
|
|
167
|
+
expiry: this.expiry,
|
|
168
|
+
sequence: this.sequence
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
correctPDA(account) {
|
|
172
|
+
return SwapTypeEnum_1.SwapTypeEnum.toNumber(account.data.kind) === this.kind &&
|
|
173
|
+
account.data.confirmations === this.confirmations &&
|
|
174
|
+
this.nonce.eq(account.data.nonce) &&
|
|
175
|
+
buffer_1.Buffer.from(account.data.hash).toString("hex") === this.paymentHash &&
|
|
176
|
+
account.data.payIn === this.payIn &&
|
|
177
|
+
account.data.payOut === this.payOut &&
|
|
178
|
+
this.amount.eq(account.data.amount) &&
|
|
179
|
+
this.expiry.eq(account.data.expiry) &&
|
|
180
|
+
this.sequence.eq(account.data.sequence) &&
|
|
181
|
+
account.offerer.equals(this.offerer) &&
|
|
182
|
+
(this.offererAta == null || account.offererAta.equals(this.offererAta)) &&
|
|
183
|
+
account.claimer.equals(this.claimer) &&
|
|
184
|
+
(this.claimerAta == null || account.claimerAta.equals(this.claimerAta)) &&
|
|
185
|
+
account.mint.equals(this.token) &&
|
|
186
|
+
this.claimerBounty.eq(account.claimerBounty) &&
|
|
187
|
+
this.securityDeposit.eq(account.securityDeposit);
|
|
188
|
+
}
|
|
189
|
+
equals(other) {
|
|
190
|
+
if (this.claimerAta == null && other.claimerAta != null)
|
|
191
|
+
return false;
|
|
192
|
+
if (this.claimerAta != null && other.claimerAta == null)
|
|
193
|
+
return false;
|
|
194
|
+
if (this.claimerAta != null && other.claimerAta != null) {
|
|
195
|
+
if (!this.claimerAta.equals(other.claimerAta))
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
if (this.offererAta == null && other.offererAta != null)
|
|
199
|
+
return false;
|
|
200
|
+
if (this.offererAta != null && other.offererAta == null)
|
|
201
|
+
return false;
|
|
202
|
+
if (this.offererAta != null && other.offererAta != null) {
|
|
203
|
+
if (!this.offererAta.equals(other.offererAta))
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
return other.kind === this.kind &&
|
|
207
|
+
other.confirmations === this.confirmations &&
|
|
208
|
+
this.nonce.eq(other.nonce) &&
|
|
209
|
+
other.paymentHash === this.paymentHash &&
|
|
210
|
+
this.sequence.eq(other.sequence) &&
|
|
211
|
+
other.payIn === this.payIn &&
|
|
212
|
+
other.payOut === this.payOut &&
|
|
213
|
+
other.offerer.equals(this.offerer) &&
|
|
214
|
+
other.claimer.equals(this.claimer) &&
|
|
215
|
+
other.expiry.eq(this.expiry) &&
|
|
216
|
+
other.amount.eq(this.amount) &&
|
|
217
|
+
other.securityDeposit.eq(this.securityDeposit) &&
|
|
218
|
+
other.claimerBounty.eq(this.claimerBounty) &&
|
|
219
|
+
other.token.equals(this.token);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Converts initialize instruction data into {SolanaSwapData}
|
|
223
|
+
*
|
|
224
|
+
* @param initIx
|
|
225
|
+
* @param txoHash
|
|
226
|
+
* @private
|
|
227
|
+
* @returns {SolanaSwapData} converted and parsed swap data
|
|
228
|
+
*/
|
|
229
|
+
static fromInstruction(initIx, txoHash) {
|
|
230
|
+
const paymentHash = buffer_1.Buffer.from(initIx.data.swapData.hash);
|
|
231
|
+
let securityDeposit = new BN(0);
|
|
232
|
+
let claimerBounty = new BN(0);
|
|
233
|
+
let payIn = true;
|
|
234
|
+
if (initIx.name === "offererInitialize") {
|
|
235
|
+
payIn = false;
|
|
236
|
+
securityDeposit = initIx.data.securityDeposit;
|
|
237
|
+
claimerBounty = initIx.data.claimerBounty;
|
|
238
|
+
}
|
|
239
|
+
return new SolanaSwapData(initIx.accounts.offerer, initIx.accounts.claimer, initIx.accounts.mint, initIx.data.swapData.amount, paymentHash.toString("hex"), initIx.data.swapData.sequence, initIx.data.swapData.expiry, initIx.data.swapData.nonce, initIx.data.swapData.confirmations, initIx.data.swapData.payOut, SwapTypeEnum_1.SwapTypeEnum.toNumber(initIx.data.swapData.kind), payIn, initIx.name === "offererInitializePayIn" ? initIx.accounts.offererAta : web3_js_1.PublicKey.default, initIx.data.swapData.payOut ? initIx.accounts.claimerAta : web3_js_1.PublicKey.default, securityDeposit, claimerBounty, txoHash);
|
|
240
|
+
}
|
|
241
|
+
static fromEscrowState(account) {
|
|
242
|
+
const data = account.data;
|
|
243
|
+
return new SolanaSwapData(account.offerer, account.claimer, account.mint, data.amount, buffer_1.Buffer.from(data.hash).toString("hex"), data.sequence, data.expiry, data.nonce, data.confirmations, data.payOut, SwapTypeEnum_1.SwapTypeEnum.toNumber(data.kind), data.payIn, account.offererAta, account.claimerAta, account.securityDeposit, account.claimerBounty, null);
|
|
244
|
+
}
|
|
245
|
+
static typeToKind(type) {
|
|
246
|
+
switch (type) {
|
|
247
|
+
case base_1.ChainSwapType.HTLC:
|
|
248
|
+
return 0;
|
|
249
|
+
case base_1.ChainSwapType.CHAIN:
|
|
250
|
+
return 1;
|
|
251
|
+
case base_1.ChainSwapType.CHAIN_NONCED:
|
|
252
|
+
return 2;
|
|
253
|
+
case base_1.ChainSwapType.CHAIN_TXID:
|
|
254
|
+
return 3;
|
|
255
|
+
}
|
|
256
|
+
return null;
|
|
257
|
+
}
|
|
258
|
+
static kindToType(value) {
|
|
259
|
+
switch (value) {
|
|
260
|
+
case 0:
|
|
261
|
+
return base_1.ChainSwapType.HTLC;
|
|
262
|
+
case 1:
|
|
263
|
+
return base_1.ChainSwapType.CHAIN;
|
|
264
|
+
case 2:
|
|
265
|
+
return base_1.ChainSwapType.CHAIN_NONCED;
|
|
266
|
+
case 3:
|
|
267
|
+
return base_1.ChainSwapType.CHAIN_TXID;
|
|
268
|
+
}
|
|
269
|
+
return null;
|
|
270
|
+
}
|
|
271
|
+
isClaimer(address) {
|
|
272
|
+
const _address = new web3_js_1.PublicKey(address);
|
|
273
|
+
if (this.isPayOut()) {
|
|
274
|
+
//Also check that swapData's ATA is correct
|
|
275
|
+
const ourAta = (0, spl_token_1.getAssociatedTokenAddressSync)(this.token, _address);
|
|
276
|
+
if (!this.claimerAta.equals(ourAta))
|
|
277
|
+
return false;
|
|
278
|
+
}
|
|
279
|
+
return this.claimer.equals(new web3_js_1.PublicKey(address));
|
|
280
|
+
}
|
|
281
|
+
isOfferer(address) {
|
|
282
|
+
return this.offerer.equals(new web3_js_1.PublicKey(address));
|
|
283
|
+
}
|
|
284
|
+
getDepositToken() {
|
|
285
|
+
return SolanaTokens_1.SolanaTokens.WSOL_ADDRESS.toString();
|
|
286
|
+
}
|
|
287
|
+
isDepositToken(token) {
|
|
288
|
+
return SolanaTokens_1.SolanaTokens.WSOL_ADDRESS.equals(new web3_js_1.PublicKey(token));
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
exports.SolanaSwapData = SolanaSwapData;
|
|
292
|
+
base_1.SwapData.deserializers["sol"] = SolanaSwapData;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { SolanaSwapProgram } from "./SolanaSwapProgram";
|
|
2
|
-
import { Program } from "@coral-xyz/anchor";
|
|
3
|
-
import { SwapProgram } from "./programTypes";
|
|
4
|
-
import { SolanaProgramModule } from "../program/SolanaProgramModule";
|
|
5
|
-
import { SolanaChainInterface } from "../chain/SolanaChainInterface";
|
|
6
|
-
export declare class SolanaSwapModule extends SolanaProgramModule<SwapProgram> {
|
|
7
|
-
protected readonly program: SolanaSwapProgram;
|
|
8
|
-
protected readonly swapProgram: Program<SwapProgram>;
|
|
9
|
-
constructor(chainInterface: SolanaChainInterface, program: SolanaSwapProgram);
|
|
10
|
-
}
|
|
1
|
+
import { SolanaSwapProgram } from "./SolanaSwapProgram";
|
|
2
|
+
import { Program } from "@coral-xyz/anchor";
|
|
3
|
+
import { SwapProgram } from "./programTypes";
|
|
4
|
+
import { SolanaProgramModule } from "../program/SolanaProgramModule";
|
|
5
|
+
import { SolanaChainInterface } from "../chain/SolanaChainInterface";
|
|
6
|
+
export declare class SolanaSwapModule extends SolanaProgramModule<SwapProgram> {
|
|
7
|
+
protected readonly program: SolanaSwapProgram;
|
|
8
|
+
protected readonly swapProgram: Program<SwapProgram>;
|
|
9
|
+
constructor(chainInterface: SolanaChainInterface, program: SolanaSwapProgram);
|
|
10
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SolanaSwapModule = void 0;
|
|
4
|
-
const SolanaProgramModule_1 = require("../program/SolanaProgramModule");
|
|
5
|
-
class SolanaSwapModule extends SolanaProgramModule_1.SolanaProgramModule {
|
|
6
|
-
constructor(chainInterface, program) {
|
|
7
|
-
super(chainInterface, program);
|
|
8
|
-
this.swapProgram = program.program;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
exports.SolanaSwapModule = SolanaSwapModule;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SolanaSwapModule = void 0;
|
|
4
|
+
const SolanaProgramModule_1 = require("../program/SolanaProgramModule");
|
|
5
|
+
class SolanaSwapModule extends SolanaProgramModule_1.SolanaProgramModule {
|
|
6
|
+
constructor(chainInterface, program) {
|
|
7
|
+
super(chainInterface, program);
|
|
8
|
+
this.swapProgram = program.program;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.SolanaSwapModule = SolanaSwapModule;
|