@theliem/xmarket-sdk 3.7.0 → 3.8.0
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.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +18 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1750,7 +1750,7 @@ ${logs.join("\n")}`);
|
|
|
1750
1750
|
* [extraAccountMetaList, hookConfig, hookProgram]
|
|
1751
1751
|
* [feeManagement, fee_config, mkt_override, company_ata, oracle_vault] (when fee > 0)
|
|
1752
1752
|
*/
|
|
1753
|
-
async buildMatchComplementaryIxs(takerSigned, makersSigned, collateralMint, feeRecipient, operator, opts, useTakerPrice = false) {
|
|
1753
|
+
async buildMatchComplementaryIxs(takerSigned, makersSigned, collateralMint, feeRecipient, operator, opts, useTakerPrice = false, skipCrossingCheck = true) {
|
|
1754
1754
|
const condition = takerSigned.order.condition;
|
|
1755
1755
|
const tokenId = takerSigned.order.tokenId;
|
|
1756
1756
|
const taker = takerSigned.order.maker;
|
|
@@ -1790,17 +1790,21 @@ ${logs.join("\n")}`);
|
|
|
1790
1790
|
if (takerSigned.order.fee.gtn(0) && this.programIds.feeManagement && this.feeConfigOwner) {
|
|
1791
1791
|
const companyAddr = await this.companyAddress();
|
|
1792
1792
|
if (companyAddr) {
|
|
1793
|
-
const
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1793
|
+
const feeOverridePda = PDA.marketFeeOverride(condition, this.programIds)[0];
|
|
1794
|
+
const feeOverrideExists = await this.provider.connection.getAccountInfo(feeOverridePda);
|
|
1795
|
+
if (feeOverrideExists) {
|
|
1796
|
+
const oracleVault = opts?.marketOracleVault ?? this.walletPubkey;
|
|
1797
|
+
feeAccounts = [
|
|
1798
|
+
{ pubkey: this.programIds.feeManagement, isSigner: false, isWritable: false },
|
|
1799
|
+
{ pubkey: PDA.feeConfig(this.feeConfigOwner, this.programIds)[0], isSigner: false, isWritable: false },
|
|
1800
|
+
{ pubkey: feeOverridePda, isSigner: false, isWritable: false },
|
|
1801
|
+
{ pubkey: getAssociatedTokenAddressSync(collateralMint, companyAddr), isSigner: false, isWritable: true },
|
|
1802
|
+
{ pubkey: oracleVault, isSigner: false, isWritable: true }
|
|
1803
|
+
];
|
|
1804
|
+
}
|
|
1801
1805
|
}
|
|
1802
1806
|
}
|
|
1803
|
-
const matchIx = await this.program.methods.matchComplementary(takerNonce, fillAmount, useTakerPrice).accounts({
|
|
1807
|
+
const matchIx = await this.program.methods.matchComplementary(takerNonce, fillAmount, useTakerPrice, skipCrossingCheck).accounts({
|
|
1804
1808
|
operator,
|
|
1805
1809
|
payer: this.walletPubkey,
|
|
1806
1810
|
clobConfig: this.configPda(),
|
|
@@ -2116,17 +2120,6 @@ ${logs.join("\n")}`);
|
|
|
2116
2120
|
} else {
|
|
2117
2121
|
throw new InvalidParamError("COMPLEMENTARY requires one BUY and one or more SELLs on same tokenId");
|
|
2118
2122
|
}
|
|
2119
|
-
const buy = buySignedOrder.order;
|
|
2120
|
-
const totalSellDemand = sellCandidates.reduce(
|
|
2121
|
-
(acc, s) => acc + BigInt(s.order.takerAmount.toString()),
|
|
2122
|
-
BigInt(0)
|
|
2123
|
-
);
|
|
2124
|
-
const buyBudget = BigInt(buy.makerAmount.toString());
|
|
2125
|
-
if (buyBudget < totalSellDemand) {
|
|
2126
|
-
throw new InvalidParamError(
|
|
2127
|
-
`COMPLEMENTARY: total sell demand ${totalSellDemand} > buy budget ${buyBudget}. Build taker order with limitPrice, not averageMatchedPrice.`
|
|
2128
|
-
);
|
|
2129
|
-
}
|
|
2130
2123
|
const finalSells = sellCandidates;
|
|
2131
2124
|
return this.matchComplementary(buySignedOrder, finalSells, collateralMint, feeRecipient, operatorWallet, alt, opts);
|
|
2132
2125
|
}
|
|
@@ -8828,6 +8821,10 @@ var clob_exchange_default = {
|
|
|
8828
8821
|
{
|
|
8829
8822
|
name: "use_taker_price",
|
|
8830
8823
|
type: "bool"
|
|
8824
|
+
},
|
|
8825
|
+
{
|
|
8826
|
+
name: "skip_crossing_check",
|
|
8827
|
+
type: "bool"
|
|
8831
8828
|
}
|
|
8832
8829
|
]
|
|
8833
8830
|
},
|