@chainflip/sdk 2.0.2-dev.0 → 2.0.2-dev.1
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/dist/swap.cjs +8 -4
- package/dist/swap.d.cts +1 -1
- package/dist/swap.d.ts +1 -1
- package/dist/swap.js +8 -4
- package/package.json +1 -1
package/dist/swap.cjs
CHANGED
|
@@ -940,7 +940,7 @@ var getChainData = (chain2, network, env) => ({
|
|
|
940
940
|
|
|
941
941
|
// package.json
|
|
942
942
|
var package_default = {
|
|
943
|
-
version: "2.0.2-dev.
|
|
943
|
+
version: "2.0.2-dev.1"};
|
|
944
944
|
|
|
945
945
|
// src/swap/consts.ts
|
|
946
946
|
var CF_SDK_VERSION_HEADERS = { "X-Chainflip-Sdk-Version": package_default.version };
|
|
@@ -1406,9 +1406,13 @@ var SwapSDK = class {
|
|
|
1406
1406
|
"Max oracle price slippage must be set in FillOrKillParams when live price protection is enabled for both assets in DCA V2"
|
|
1407
1407
|
);
|
|
1408
1408
|
}
|
|
1409
|
-
async calculateLivePriceSlippageTolerancePercent(slippageTolerancePercent,
|
|
1409
|
+
async calculateLivePriceSlippageTolerancePercent(slippageTolerancePercent, brokerCommissionBpsInput, quote) {
|
|
1410
1410
|
assert(slippageTolerancePercent >= 0, "slippageTolerancePercent must be non-negative");
|
|
1411
|
-
assert(
|
|
1411
|
+
assert(
|
|
1412
|
+
brokerCommissionBpsInput === void 0 || brokerCommissionBpsInput >= 0,
|
|
1413
|
+
"brokerCommissionBps must be non-negative"
|
|
1414
|
+
);
|
|
1415
|
+
const brokerCommissionBps = await this.getCommissionBps(brokerCommissionBpsInput);
|
|
1412
1416
|
const { assets: assets2 } = await this.cache.read("networkInfo");
|
|
1413
1417
|
const srcAsset = chainflip.getInternalAsset(quote.srcAsset);
|
|
1414
1418
|
const destAsset = chainflip.getInternalAsset(quote.destAsset);
|
|
@@ -1422,7 +1426,7 @@ var SwapSDK = class {
|
|
|
1422
1426
|
const networkFeeBps = Math.max(
|
|
1423
1427
|
Number(chainflip.readAssetValue(networkFeeRates, srcAsset)),
|
|
1424
1428
|
Number(chainflip.readAssetValue(networkFeeRates, destAsset))
|
|
1425
|
-
);
|
|
1429
|
+
) / 100;
|
|
1426
1430
|
return slippageTolerancePercent + networkFeeBps / 100 + brokerCommissionBps / 100;
|
|
1427
1431
|
}
|
|
1428
1432
|
};
|
package/dist/swap.d.cts
CHANGED
|
@@ -702,7 +702,7 @@ declare class SwapSDK {
|
|
|
702
702
|
estimatedExpiryTime?: number | undefined;
|
|
703
703
|
}>;
|
|
704
704
|
private checkLivePriceProtectionRequirement;
|
|
705
|
-
calculateLivePriceSlippageTolerancePercent(slippageTolerancePercent: number,
|
|
705
|
+
calculateLivePriceSlippageTolerancePercent(slippageTolerancePercent: number, brokerCommissionBpsInput: number | undefined, quote: Pick<Quote | BoostQuote, 'srcAsset' | 'destAsset' | 'isOnChain'>): Promise<number | false>;
|
|
706
706
|
}
|
|
707
707
|
|
|
708
708
|
/**
|
package/dist/swap.d.ts
CHANGED
|
@@ -702,7 +702,7 @@ declare class SwapSDK {
|
|
|
702
702
|
estimatedExpiryTime?: number | undefined;
|
|
703
703
|
}>;
|
|
704
704
|
private checkLivePriceProtectionRequirement;
|
|
705
|
-
calculateLivePriceSlippageTolerancePercent(slippageTolerancePercent: number,
|
|
705
|
+
calculateLivePriceSlippageTolerancePercent(slippageTolerancePercent: number, brokerCommissionBpsInput: number | undefined, quote: Pick<Quote | BoostQuote, 'srcAsset' | 'destAsset' | 'isOnChain'>): Promise<number | false>;
|
|
706
706
|
}
|
|
707
707
|
|
|
708
708
|
/**
|
package/dist/swap.js
CHANGED
|
@@ -745,7 +745,7 @@ var getChainData = (chain2, network, env) => ({
|
|
|
745
745
|
|
|
746
746
|
// package.json
|
|
747
747
|
var package_default = {
|
|
748
|
-
version: "2.0.2-dev.
|
|
748
|
+
version: "2.0.2-dev.1"};
|
|
749
749
|
|
|
750
750
|
// src/swap/consts.ts
|
|
751
751
|
var CF_SDK_VERSION_HEADERS = { "X-Chainflip-Sdk-Version": package_default.version };
|
|
@@ -1211,9 +1211,13 @@ var SwapSDK = class {
|
|
|
1211
1211
|
"Max oracle price slippage must be set in FillOrKillParams when live price protection is enabled for both assets in DCA V2"
|
|
1212
1212
|
);
|
|
1213
1213
|
}
|
|
1214
|
-
async calculateLivePriceSlippageTolerancePercent(slippageTolerancePercent,
|
|
1214
|
+
async calculateLivePriceSlippageTolerancePercent(slippageTolerancePercent, brokerCommissionBpsInput, quote) {
|
|
1215
1215
|
assert(slippageTolerancePercent >= 0, "slippageTolerancePercent must be non-negative");
|
|
1216
|
-
assert(
|
|
1216
|
+
assert(
|
|
1217
|
+
brokerCommissionBpsInput === void 0 || brokerCommissionBpsInput >= 0,
|
|
1218
|
+
"brokerCommissionBps must be non-negative"
|
|
1219
|
+
);
|
|
1220
|
+
const brokerCommissionBps = await this.getCommissionBps(brokerCommissionBpsInput);
|
|
1217
1221
|
const { assets: assets2 } = await this.cache.read("networkInfo");
|
|
1218
1222
|
const srcAsset = getInternalAsset(quote.srcAsset);
|
|
1219
1223
|
const destAsset = getInternalAsset(quote.destAsset);
|
|
@@ -1227,7 +1231,7 @@ var SwapSDK = class {
|
|
|
1227
1231
|
const networkFeeBps = Math.max(
|
|
1228
1232
|
Number(readAssetValue(networkFeeRates, srcAsset)),
|
|
1229
1233
|
Number(readAssetValue(networkFeeRates, destAsset))
|
|
1230
|
-
);
|
|
1234
|
+
) / 100;
|
|
1231
1235
|
return slippageTolerancePercent + networkFeeBps / 100 + brokerCommissionBps / 100;
|
|
1232
1236
|
}
|
|
1233
1237
|
};
|