@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.mjs
CHANGED
|
@@ -2108,7 +2108,7 @@ ${logs.join("\n")}`);
|
|
|
2108
2108
|
* remaining_accounts per NO maker (6):
|
|
2109
2109
|
* [maker, order_record, buyer_no_token, buyer_no_collateral, buyer_no_position, no_order_status]
|
|
2110
2110
|
*/
|
|
2111
|
-
async _buildMintIx(yesSigned, noMakers, collateralMint, operator, payer) {
|
|
2111
|
+
async _buildMintIx(yesSigned, noMakers, collateralMint, operator, payer, feeRecipient, opts) {
|
|
2112
2112
|
const condition = yesSigned.order.condition;
|
|
2113
2113
|
const taker = yesSigned.order.maker;
|
|
2114
2114
|
const takerNonce = yesSigned.order.nonce;
|
|
@@ -2146,6 +2146,26 @@ ${logs.join("\n")}`);
|
|
|
2146
2146
|
{ pubkey: noStatus, isSigner: false, isWritable: true }
|
|
2147
2147
|
);
|
|
2148
2148
|
}
|
|
2149
|
+
if (yesSigned.order.fee.gtn(0) && this.programIds.feeManagement && this.feeConfigOwner) {
|
|
2150
|
+
const companyAddr = await this.companyAddress();
|
|
2151
|
+
const refVault = await this.referralVault();
|
|
2152
|
+
if (companyAddr && refVault) {
|
|
2153
|
+
const feeOverridePda = PDA.marketFeeOverride(condition, this.programIds)[0];
|
|
2154
|
+
const feeOverrideExists = await this.provider.connection.getAccountInfo(feeOverridePda);
|
|
2155
|
+
if (feeOverrideExists) {
|
|
2156
|
+
const oracleVault = opts?.marketOracleVault ?? await this.getMarketOracleVault(condition, collateralMint) ?? payer;
|
|
2157
|
+
remainingAccounts.push(
|
|
2158
|
+
{ pubkey: this.programIds.feeManagement, isSigner: false, isWritable: false },
|
|
2159
|
+
{ pubkey: PDA.feeConfig(this.feeConfigOwner, this.programIds)[0], isSigner: false, isWritable: false },
|
|
2160
|
+
{ pubkey: feeOverridePda, isSigner: false, isWritable: false },
|
|
2161
|
+
{ pubkey: getAssociatedTokenAddressSync(collateralMint, companyAddr), isSigner: false, isWritable: true },
|
|
2162
|
+
{ pubkey: oracleVault, isSigner: false, isWritable: true },
|
|
2163
|
+
{ pubkey: refVault, isSigner: false, isWritable: true }
|
|
2164
|
+
);
|
|
2165
|
+
}
|
|
2166
|
+
}
|
|
2167
|
+
}
|
|
2168
|
+
const resolvedFeeRecipient = feeRecipient ?? clobUsdcAta;
|
|
2149
2169
|
return this.program.methods.matchMintOrders(takerNonce, fillAmount, true).accounts({
|
|
2150
2170
|
operator,
|
|
2151
2171
|
payer,
|
|
@@ -2157,6 +2177,7 @@ ${logs.join("\n")}`);
|
|
|
2157
2177
|
takerYesToken,
|
|
2158
2178
|
takerYesPosition,
|
|
2159
2179
|
takerOrderStatus,
|
|
2180
|
+
feeRecipient: resolvedFeeRecipient,
|
|
2160
2181
|
clobUsdcAta,
|
|
2161
2182
|
clobYesAta,
|
|
2162
2183
|
clobNoAta,
|
|
@@ -2186,7 +2207,7 @@ ${logs.join("\n")}`);
|
|
|
2186
2207
|
const [noMint] = PDA.noMint(condition, this.programIds);
|
|
2187
2208
|
const clobYesAta = getAssociatedTokenAddressSync(yesMint, clobConfig, true, TOKEN_PROGRAM_ID);
|
|
2188
2209
|
const clobNoAta = getAssociatedTokenAddressSync(noMint, clobConfig, true, TOKEN_PROGRAM_ID);
|
|
2189
|
-
const matchIx = await this._buildMintIx(yesSigned, noMakers, collateralMint, operatorWallet.publicKey, this.walletPubkey);
|
|
2210
|
+
const matchIx = await this._buildMintIx(yesSigned, noMakers, collateralMint, operatorWallet.publicKey, this.walletPubkey, _feeRecipient);
|
|
2190
2211
|
await this._ensureClobOutcomeAtas(yesMint, noMint, clobConfig, clobYesAta, clobNoAta);
|
|
2191
2212
|
const sig = await this.sendMatchTx([matchIx], lookupTable, operatorWallet);
|
|
2192
2213
|
return { signature: sig };
|