@sodax/sdk 0.0.1-rc.22 → 0.0.1-rc.23
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/index.cjs +15 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.mjs +15 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6186,6 +6186,17 @@ function calculateFeeAmount(inputAmount, fee) {
|
|
|
6186
6186
|
}
|
|
6187
6187
|
return feeAmount;
|
|
6188
6188
|
}
|
|
6189
|
+
function adjustAmountByFee(amount, fee, quoteType) {
|
|
6190
|
+
invariant10__default.default(amount > 0n, "Amount must be greater than 0");
|
|
6191
|
+
invariant10__default.default(quoteType === "exact_input" || quoteType === "exact_output", "Invalid quote type");
|
|
6192
|
+
if (quoteType === "exact_input") {
|
|
6193
|
+
return amount - calculateFeeAmount(amount, fee);
|
|
6194
|
+
}
|
|
6195
|
+
if (quoteType === "exact_output") {
|
|
6196
|
+
return amount + calculateFeeAmount(amount, fee);
|
|
6197
|
+
}
|
|
6198
|
+
throw new Error("Invalid quote type");
|
|
6199
|
+
}
|
|
6189
6200
|
function BigIntToHex(value) {
|
|
6190
6201
|
return `0x${value.toString(16)}`;
|
|
6191
6202
|
}
|
|
@@ -11201,7 +11212,7 @@ var SolverService = class {
|
|
|
11201
11212
|
async getQuote(payload) {
|
|
11202
11213
|
payload = {
|
|
11203
11214
|
...payload,
|
|
11204
|
-
amount: payload.amount
|
|
11215
|
+
amount: adjustAmountByFee(payload.amount, this.config.partnerFee, payload.quote_type)
|
|
11205
11216
|
};
|
|
11206
11217
|
return SolverApiService.getQuote(payload, this.config);
|
|
11207
11218
|
}
|
|
@@ -11711,8 +11722,7 @@ var SolverService = class {
|
|
|
11711
11722
|
params.srcAddress.toLowerCase() === walletAddress.toLowerCase(),
|
|
11712
11723
|
"srcAddress must be the same as wallet address"
|
|
11713
11724
|
);
|
|
11714
|
-
const
|
|
11715
|
-
const creatorHubWalletAddress = spokeProvider.chainConfig.chain.id === this.hubProvider.chainConfig.chain.id ? walletAddressBytes : await WalletAbstractionService.getUserHubWalletAddress(walletAddress, spokeProvider, this.hubProvider);
|
|
11725
|
+
const creatorHubWalletAddress = spokeProvider.chainConfig.chain.id === this.hubProvider.chainConfig.chain.id ? walletAddress : await WalletAbstractionService.getUserHubWalletAddress(walletAddress, spokeProvider, this.hubProvider);
|
|
11716
11726
|
const [data, intent, feeAmount] = EvmSolverService.constructCreateIntentData(
|
|
11717
11727
|
{
|
|
11718
11728
|
...params,
|
|
@@ -11763,8 +11773,7 @@ var SolverService = class {
|
|
|
11763
11773
|
invariant10__default.default(isValidIntentRelayChainId(intent.srcChain), `Invalid intent.srcChain: ${intent.srcChain}`);
|
|
11764
11774
|
invariant10__default.default(isValidIntentRelayChainId(intent.dstChain), `Invalid intent.dstChain: ${intent.dstChain}`);
|
|
11765
11775
|
const walletAddress = await spokeProvider.walletProvider.getWalletAddress();
|
|
11766
|
-
const
|
|
11767
|
-
const creatorHubWalletAddress = spokeProvider.chainConfig.chain.id === this.hubProvider.chainConfig.chain.id ? walletAddressBytes : await WalletAbstractionService.getUserHubWalletAddress(walletAddress, spokeProvider, this.hubProvider);
|
|
11776
|
+
const creatorHubWalletAddress = spokeProvider.chainConfig.chain.id === this.hubProvider.chainConfig.chain.id ? walletAddress : await WalletAbstractionService.getUserHubWalletAddress(walletAddress, spokeProvider, this.hubProvider);
|
|
11768
11777
|
const calls = [];
|
|
11769
11778
|
const intentsContract = this.config.intentsContract;
|
|
11770
11779
|
calls.push(EvmSolverService.encodeCancelIntent(intent, intentsContract));
|
|
@@ -16212,6 +16221,7 @@ exports.WAD = WAD;
|
|
|
16212
16221
|
exports.WAD_RAY_RATIO = WAD_RAY_RATIO;
|
|
16213
16222
|
exports.WEI_DECIMALS = WEI_DECIMALS;
|
|
16214
16223
|
exports.WalletAbstractionService = WalletAbstractionService;
|
|
16224
|
+
exports.adjustAmountByFee = adjustAmountByFee;
|
|
16215
16225
|
exports.assetManagerAbi = assetManagerAbi;
|
|
16216
16226
|
exports.balnSwapAbi = balnSwapAbi;
|
|
16217
16227
|
exports.binomialApproximatedRayPow = binomialApproximatedRayPow;
|