@atomiqlabs/lp-lib 13.0.0-beta.5 → 13.0.0-beta.7
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.
|
@@ -126,8 +126,18 @@ class FromBtcAmountAssertions extends AmountAssertions_1.AmountAssertions {
|
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
else {
|
|
129
|
+
this.checkBtcAmountInBounds(requestedAmount.amount);
|
|
129
130
|
amountBD = requestedAmount.amount - amountBDgas;
|
|
130
|
-
|
|
131
|
+
if (amountBD < 0n) {
|
|
132
|
+
throw {
|
|
133
|
+
code: 20003,
|
|
134
|
+
msg: "Amount too low!",
|
|
135
|
+
data: {
|
|
136
|
+
min: this.config.min.toString(10),
|
|
137
|
+
max: this.config.max.toString(10)
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
}
|
|
131
141
|
}
|
|
132
142
|
const swapFee = fees.baseFee + (amountBD * fees.feePPM / 1000000n);
|
|
133
143
|
const swapFeeInToken = await this.swapPricing.getFromBtcSwapAmount(swapFee, requestedAmount.token, chainIdentifier, true, requestedAmount.pricePrefetch);
|
|
@@ -18,7 +18,7 @@ var SpvVaultSwapState;
|
|
|
18
18
|
class SpvVaultSwap extends SwapHandlerSwap_1.SwapHandlerSwap {
|
|
19
19
|
constructor(chainIdentifierOrObj, quoteId, expiry, vault, vaultUtxo, btcAddress, btcFeeRate, recipient, amountBtc, amountToken, amountGasToken, swapFee, swapFeeInToken, gasSwapFee, gasSwapFeeInToken, callerFeeShare, frontingFeeShare, executionFeeShare, token, gasToken) {
|
|
20
20
|
if (typeof (chainIdentifierOrObj) === "string") {
|
|
21
|
-
super(chainIdentifierOrObj, swapFee + gasSwapFee, swapFeeInToken
|
|
21
|
+
super(chainIdentifierOrObj, swapFee + gasSwapFee, swapFeeInToken);
|
|
22
22
|
this.state = SpvVaultSwapState.CREATED;
|
|
23
23
|
this.quoteId = quoteId;
|
|
24
24
|
this.expiry = expiry;
|
package/package.json
CHANGED
|
@@ -189,8 +189,18 @@ export class FromBtcAmountAssertions extends AmountAssertions {
|
|
|
189
189
|
};
|
|
190
190
|
}
|
|
191
191
|
} else {
|
|
192
|
+
this.checkBtcAmountInBounds(requestedAmount.amount);
|
|
192
193
|
amountBD = requestedAmount.amount - amountBDgas;
|
|
193
|
-
|
|
194
|
+
if(amountBD < 0n) {
|
|
195
|
+
throw {
|
|
196
|
+
code: 20003,
|
|
197
|
+
msg: "Amount too low!",
|
|
198
|
+
data: {
|
|
199
|
+
min: this.config.min.toString(10),
|
|
200
|
+
max: this.config.max.toString(10)
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
}
|
|
194
204
|
}
|
|
195
205
|
|
|
196
206
|
const swapFee = fees.baseFee + (amountBD * fees.feePPM / 1000000n);
|
|
@@ -70,7 +70,7 @@ export class SpvVaultSwap extends SwapHandlerSwap<SpvVaultSwapState> {
|
|
|
70
70
|
token?: string, gasToken?: string
|
|
71
71
|
) {
|
|
72
72
|
if(typeof(chainIdentifierOrObj)==="string") {
|
|
73
|
-
super(chainIdentifierOrObj, swapFee + gasSwapFee, swapFeeInToken
|
|
73
|
+
super(chainIdentifierOrObj, swapFee + gasSwapFee, swapFeeInToken);
|
|
74
74
|
this.state = SpvVaultSwapState.CREATED;
|
|
75
75
|
this.quoteId = quoteId;
|
|
76
76
|
this.expiry = expiry;
|