@theliem/xmarket-sdk 4.1.2 → 4.2.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.js +23 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2134,7 +2134,7 @@ ${logs.join("\n")}`);
|
|
|
2134
2134
|
* remaining_accounts per NO maker (6):
|
|
2135
2135
|
* [maker, order_record, buyer_no_token, buyer_no_collateral, buyer_no_position, no_order_status]
|
|
2136
2136
|
*/
|
|
2137
|
-
async _buildMintIx(yesSigned, noMakers, collateralMint, operator, payer) {
|
|
2137
|
+
async _buildMintIx(yesSigned, noMakers, collateralMint, operator, payer, feeRecipient, opts) {
|
|
2138
2138
|
const condition = yesSigned.order.condition;
|
|
2139
2139
|
const taker = yesSigned.order.maker;
|
|
2140
2140
|
const takerNonce = yesSigned.order.nonce;
|
|
@@ -2172,6 +2172,26 @@ ${logs.join("\n")}`);
|
|
|
2172
2172
|
{ pubkey: noStatus, isSigner: false, isWritable: true }
|
|
2173
2173
|
);
|
|
2174
2174
|
}
|
|
2175
|
+
if (yesSigned.order.fee.gtn(0) && this.programIds.feeManagement && this.feeConfigOwner) {
|
|
2176
|
+
const companyAddr = await this.companyAddress();
|
|
2177
|
+
const refVault = await this.referralVault();
|
|
2178
|
+
if (companyAddr && refVault) {
|
|
2179
|
+
const feeOverridePda = PDA.marketFeeOverride(condition, this.programIds)[0];
|
|
2180
|
+
const feeOverrideExists = await this.provider.connection.getAccountInfo(feeOverridePda);
|
|
2181
|
+
if (feeOverrideExists) {
|
|
2182
|
+
const oracleVault = opts?.marketOracleVault ?? await this.getMarketOracleVault(condition, collateralMint) ?? payer;
|
|
2183
|
+
remainingAccounts.push(
|
|
2184
|
+
{ pubkey: this.programIds.feeManagement, isSigner: false, isWritable: false },
|
|
2185
|
+
{ pubkey: PDA.feeConfig(this.feeConfigOwner, this.programIds)[0], isSigner: false, isWritable: false },
|
|
2186
|
+
{ pubkey: feeOverridePda, isSigner: false, isWritable: false },
|
|
2187
|
+
{ pubkey: splToken.getAssociatedTokenAddressSync(collateralMint, companyAddr), isSigner: false, isWritable: true },
|
|
2188
|
+
{ pubkey: oracleVault, isSigner: false, isWritable: true },
|
|
2189
|
+
{ pubkey: refVault, isSigner: false, isWritable: true }
|
|
2190
|
+
);
|
|
2191
|
+
}
|
|
2192
|
+
}
|
|
2193
|
+
}
|
|
2194
|
+
const resolvedFeeRecipient = feeRecipient ?? clobUsdcAta;
|
|
2175
2195
|
return this.program.methods.matchMintOrders(takerNonce, fillAmount, true).accounts({
|
|
2176
2196
|
operator,
|
|
2177
2197
|
payer,
|
|
@@ -2183,6 +2203,7 @@ ${logs.join("\n")}`);
|
|
|
2183
2203
|
takerYesToken,
|
|
2184
2204
|
takerYesPosition,
|
|
2185
2205
|
takerOrderStatus,
|
|
2206
|
+
feeRecipient: resolvedFeeRecipient,
|
|
2186
2207
|
clobUsdcAta,
|
|
2187
2208
|
clobYesAta,
|
|
2188
2209
|
clobNoAta,
|
|
@@ -2212,7 +2233,7 @@ ${logs.join("\n")}`);
|
|
|
2212
2233
|
const [noMint] = PDA.noMint(condition, this.programIds);
|
|
2213
2234
|
const clobYesAta = splToken.getAssociatedTokenAddressSync(yesMint, clobConfig, true, splToken.TOKEN_PROGRAM_ID);
|
|
2214
2235
|
const clobNoAta = splToken.getAssociatedTokenAddressSync(noMint, clobConfig, true, splToken.TOKEN_PROGRAM_ID);
|
|
2215
|
-
const matchIx = await this._buildMintIx(yesSigned, noMakers, collateralMint, operatorWallet.publicKey, this.walletPubkey);
|
|
2236
|
+
const matchIx = await this._buildMintIx(yesSigned, noMakers, collateralMint, operatorWallet.publicKey, this.walletPubkey, _feeRecipient);
|
|
2216
2237
|
await this._ensureClobOutcomeAtas(yesMint, noMint, clobConfig, clobYesAta, clobNoAta);
|
|
2217
2238
|
const sig = await this.sendMatchTx([matchIx], lookupTable, operatorWallet);
|
|
2218
2239
|
return { signature: sig };
|