@atomiqlabs/chain-solana 7.3.1 → 7.3.2
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.
|
@@ -18,6 +18,7 @@ const spl_token_1 = require("@solana/spl-token");
|
|
|
18
18
|
const SolanaSwapModule_1 = require("../SolanaSwapModule");
|
|
19
19
|
const Utils_1 = require("../../../utils/Utils");
|
|
20
20
|
const buffer_1 = require("buffer");
|
|
21
|
+
const SolanaTokens_1 = require("../../base/modules/SolanaTokens");
|
|
21
22
|
class SwapInit extends SolanaSwapModule_1.SolanaSwapModule {
|
|
22
23
|
constructor() {
|
|
23
24
|
super(...arguments);
|
|
@@ -503,7 +504,13 @@ class SwapInit extends SolanaSwapModule_1.SolanaSwapModule {
|
|
|
503
504
|
(swapData.payIn
|
|
504
505
|
? yield this.getInitPayInFeeRate(swapData.offerer, swapData.claimer, swapData.token, swapData.paymentHash)
|
|
505
506
|
: yield this.getInitFeeRate(swapData.offerer, swapData.claimer, swapData.token, swapData.paymentHash));
|
|
506
|
-
|
|
507
|
+
let computeBudget = swapData.payIn ? SwapInit.CUCosts.INIT_PAY_IN : SwapInit.CUCosts.INIT;
|
|
508
|
+
if (swapData.payIn && this.shouldWrapOnInit(swapData, feeRate)) {
|
|
509
|
+
computeBudget += SolanaTokens_1.SolanaTokens.CUCosts.WRAP_SOL;
|
|
510
|
+
const data = this.extractAtaDataFromFeeRate(feeRate);
|
|
511
|
+
if (data.initAta)
|
|
512
|
+
computeBudget += SolanaTokens_1.SolanaTokens.CUCosts.ATA_INIT;
|
|
513
|
+
}
|
|
507
514
|
const baseFee = swapData.payIn ? 10000 : 10000 + 5000;
|
|
508
515
|
return new BN(baseFee).add(this.root.Fees.getPriorityFee(computeBudget, feeRate));
|
|
509
516
|
});
|
package/package.json
CHANGED
|
@@ -14,6 +14,7 @@ import {SolanaTx} from "../../base/modules/SolanaTransactions";
|
|
|
14
14
|
import {tryWithRetries} from "../../../utils/Utils";
|
|
15
15
|
import {Buffer} from "buffer";
|
|
16
16
|
import {SolanaSigner} from "../../wallet/SolanaSigner";
|
|
17
|
+
import {SolanaTokens} from "../../base/modules/SolanaTokens";
|
|
17
18
|
|
|
18
19
|
export type SolanaPreFetchVerification = {
|
|
19
20
|
latestSlot?: {
|
|
@@ -619,7 +620,12 @@ export class SwapInit extends SolanaSwapModule {
|
|
|
619
620
|
? await this.getInitPayInFeeRate(swapData.offerer, swapData.claimer, swapData.token, swapData.paymentHash)
|
|
620
621
|
: await this.getInitFeeRate(swapData.offerer, swapData.claimer, swapData.token, swapData.paymentHash));
|
|
621
622
|
|
|
622
|
-
|
|
623
|
+
let computeBudget = swapData.payIn ? SwapInit.CUCosts.INIT_PAY_IN : SwapInit.CUCosts.INIT;
|
|
624
|
+
if(swapData.payIn && this.shouldWrapOnInit(swapData, feeRate)) {
|
|
625
|
+
computeBudget += SolanaTokens.CUCosts.WRAP_SOL;
|
|
626
|
+
const data = this.extractAtaDataFromFeeRate(feeRate);
|
|
627
|
+
if(data.initAta) computeBudget += SolanaTokens.CUCosts.ATA_INIT;
|
|
628
|
+
}
|
|
623
629
|
const baseFee = swapData.payIn ? 10000 : 10000 + 5000;
|
|
624
630
|
|
|
625
631
|
return new BN(baseFee).add(
|