@theliem/xmarket-sdk 3.1.1 → 3.1.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.
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +11 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as anchor from '@coral-xyz/anchor';
|
|
2
2
|
import * as _solana_web3_js from '@solana/web3.js';
|
|
3
|
-
import { PublicKey, Keypair,
|
|
3
|
+
import { PublicKey, Keypair, Transaction, TransactionInstruction, AddressLookupTableAccount } from '@solana/web3.js';
|
|
4
4
|
import BN from 'bn.js';
|
|
5
5
|
|
|
6
6
|
interface ProgramIds {
|
|
@@ -342,17 +342,17 @@ declare class CtfClient {
|
|
|
342
342
|
* Split `amount` collateral into equal YES + NO tokens.
|
|
343
343
|
* ATAs created automatically via `init_if_needed`.
|
|
344
344
|
*/
|
|
345
|
-
splitPosition(condition: PublicKey, collateralMint: PublicKey, amount: anchor.BN, user?: PublicKey, payer?: PublicKey
|
|
345
|
+
splitPosition(condition: PublicKey, collateralMint: PublicKey, amount: anchor.BN, user?: PublicKey, payer?: PublicKey): Promise<Transaction>;
|
|
346
346
|
/**
|
|
347
347
|
* Merge `amount` YES + NO tokens back into collateral.
|
|
348
348
|
* Both token balances must be ≥ amount.
|
|
349
349
|
*/
|
|
350
|
-
mergePosition(condition: PublicKey, collateralMint: PublicKey, amount: anchor.BN, user?: PublicKey, payer?: PublicKey
|
|
350
|
+
mergePosition(condition: PublicKey, collateralMint: PublicKey, amount: anchor.BN, user?: PublicKey, payer?: PublicKey): Promise<Transaction>;
|
|
351
351
|
/**
|
|
352
352
|
* After condition resolves: burn outcome tokens proportional to payout
|
|
353
353
|
* and receive USDC. Works for winning, losing, or both positions.
|
|
354
354
|
*/
|
|
355
|
-
redeemPositions(condition: PublicKey, collateralMint: PublicKey, user?: PublicKey, payer?: PublicKey
|
|
355
|
+
redeemPositions(condition: PublicKey, collateralMint: PublicKey, user?: PublicKey, payer?: PublicKey): Promise<Transaction>;
|
|
356
356
|
/**
|
|
357
357
|
* Oracle directly resolves a condition with payout numerators.
|
|
358
358
|
* Bypasses QuestionMarket — only for oracle-owned conditions.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as anchor from '@coral-xyz/anchor';
|
|
2
2
|
import * as _solana_web3_js from '@solana/web3.js';
|
|
3
|
-
import { PublicKey, Keypair,
|
|
3
|
+
import { PublicKey, Keypair, Transaction, TransactionInstruction, AddressLookupTableAccount } from '@solana/web3.js';
|
|
4
4
|
import BN from 'bn.js';
|
|
5
5
|
|
|
6
6
|
interface ProgramIds {
|
|
@@ -342,17 +342,17 @@ declare class CtfClient {
|
|
|
342
342
|
* Split `amount` collateral into equal YES + NO tokens.
|
|
343
343
|
* ATAs created automatically via `init_if_needed`.
|
|
344
344
|
*/
|
|
345
|
-
splitPosition(condition: PublicKey, collateralMint: PublicKey, amount: anchor.BN, user?: PublicKey, payer?: PublicKey
|
|
345
|
+
splitPosition(condition: PublicKey, collateralMint: PublicKey, amount: anchor.BN, user?: PublicKey, payer?: PublicKey): Promise<Transaction>;
|
|
346
346
|
/**
|
|
347
347
|
* Merge `amount` YES + NO tokens back into collateral.
|
|
348
348
|
* Both token balances must be ≥ amount.
|
|
349
349
|
*/
|
|
350
|
-
mergePosition(condition: PublicKey, collateralMint: PublicKey, amount: anchor.BN, user?: PublicKey, payer?: PublicKey
|
|
350
|
+
mergePosition(condition: PublicKey, collateralMint: PublicKey, amount: anchor.BN, user?: PublicKey, payer?: PublicKey): Promise<Transaction>;
|
|
351
351
|
/**
|
|
352
352
|
* After condition resolves: burn outcome tokens proportional to payout
|
|
353
353
|
* and receive USDC. Works for winning, losing, or both positions.
|
|
354
354
|
*/
|
|
355
|
-
redeemPositions(condition: PublicKey, collateralMint: PublicKey, user?: PublicKey, payer?: PublicKey
|
|
355
|
+
redeemPositions(condition: PublicKey, collateralMint: PublicKey, user?: PublicKey, payer?: PublicKey): Promise<Transaction>;
|
|
356
356
|
/**
|
|
357
357
|
* Oracle directly resolves a condition with payout numerators.
|
|
358
358
|
* Bypasses QuestionMarket — only for oracle-owned conditions.
|
package/dist/index.js
CHANGED
|
@@ -970,7 +970,7 @@ var CtfClient = class {
|
|
|
970
970
|
* Split `amount` collateral into equal YES + NO tokens.
|
|
971
971
|
* ATAs created automatically via `init_if_needed`.
|
|
972
972
|
*/
|
|
973
|
-
async splitPosition(condition, collateralMint, amount, user = this.walletPubkey, payer = this.walletPubkey
|
|
973
|
+
async splitPosition(condition, collateralMint, amount, user = this.walletPubkey, payer = this.walletPubkey) {
|
|
974
974
|
const [collateralVault] = PDA.collateralVault(collateralMint, this.programIds);
|
|
975
975
|
const [vaultTokenAccount] = PDA.vaultToken(collateralMint, this.programIds);
|
|
976
976
|
const [yesMint] = PDA.yesMint(condition, this.programIds);
|
|
@@ -981,7 +981,7 @@ var CtfClient = class {
|
|
|
981
981
|
const userYesAta = splToken.getAssociatedTokenAddressSync(yesMint, user, false, splToken.TOKEN_2022_PROGRAM_ID);
|
|
982
982
|
const userNoAta = splToken.getAssociatedTokenAddressSync(noMint, user, false, splToken.TOKEN_2022_PROGRAM_ID);
|
|
983
983
|
const userCollateral = splToken.getAssociatedTokenAddressSync(collateralMint, user);
|
|
984
|
-
|
|
984
|
+
return this.program.methods.splitPosition(amount).accounts({
|
|
985
985
|
user,
|
|
986
986
|
payer,
|
|
987
987
|
condition,
|
|
@@ -999,14 +999,13 @@ var CtfClient = class {
|
|
|
999
999
|
token2022Program: splToken.TOKEN_2022_PROGRAM_ID,
|
|
1000
1000
|
associatedTokenProgram: splToken.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
1001
1001
|
systemProgram: web3_js.SystemProgram.programId
|
|
1002
|
-
}).
|
|
1003
|
-
return { signature: sig };
|
|
1002
|
+
}).transaction();
|
|
1004
1003
|
}
|
|
1005
1004
|
/**
|
|
1006
1005
|
* Merge `amount` YES + NO tokens back into collateral.
|
|
1007
1006
|
* Both token balances must be ≥ amount.
|
|
1008
1007
|
*/
|
|
1009
|
-
async mergePosition(condition, collateralMint, amount, user = this.walletPubkey, payer = this.walletPubkey
|
|
1008
|
+
async mergePosition(condition, collateralMint, amount, user = this.walletPubkey, payer = this.walletPubkey) {
|
|
1010
1009
|
const [collateralVault] = PDA.collateralVault(collateralMint, this.programIds);
|
|
1011
1010
|
const [vaultTokenAccount] = PDA.vaultToken(collateralMint, this.programIds);
|
|
1012
1011
|
const [yesMint] = PDA.yesMint(condition, this.programIds);
|
|
@@ -1016,7 +1015,7 @@ var CtfClient = class {
|
|
|
1016
1015
|
const userYesAta = splToken.getAssociatedTokenAddressSync(yesMint, user, false, splToken.TOKEN_2022_PROGRAM_ID);
|
|
1017
1016
|
const userNoAta = splToken.getAssociatedTokenAddressSync(noMint, user, false, splToken.TOKEN_2022_PROGRAM_ID);
|
|
1018
1017
|
const userCollateral = splToken.getAssociatedTokenAddressSync(collateralMint, user);
|
|
1019
|
-
|
|
1018
|
+
return this.program.methods.mergePosition(amount).accounts({
|
|
1020
1019
|
user,
|
|
1021
1020
|
payer,
|
|
1022
1021
|
condition,
|
|
@@ -1032,14 +1031,13 @@ var CtfClient = class {
|
|
|
1032
1031
|
tokenProgram: splToken.TOKEN_PROGRAM_ID,
|
|
1033
1032
|
token2022Program: splToken.TOKEN_2022_PROGRAM_ID,
|
|
1034
1033
|
systemProgram: web3_js.SystemProgram.programId
|
|
1035
|
-
}).
|
|
1036
|
-
return { signature: sig };
|
|
1034
|
+
}).transaction();
|
|
1037
1035
|
}
|
|
1038
1036
|
/**
|
|
1039
1037
|
* After condition resolves: burn outcome tokens proportional to payout
|
|
1040
1038
|
* and receive USDC. Works for winning, losing, or both positions.
|
|
1041
1039
|
*/
|
|
1042
|
-
async redeemPositions(condition, collateralMint, user = this.walletPubkey, payer = this.walletPubkey
|
|
1040
|
+
async redeemPositions(condition, collateralMint, user = this.walletPubkey, payer = this.walletPubkey) {
|
|
1043
1041
|
const [collateralVault] = PDA.collateralVault(collateralMint, this.programIds);
|
|
1044
1042
|
const [vaultTokenAccount] = PDA.vaultToken(collateralMint, this.programIds);
|
|
1045
1043
|
const [yesMint] = PDA.yesMint(condition, this.programIds);
|
|
@@ -1049,7 +1047,7 @@ var CtfClient = class {
|
|
|
1049
1047
|
const userYesAta = splToken.getAssociatedTokenAddressSync(yesMint, user, false, splToken.TOKEN_2022_PROGRAM_ID);
|
|
1050
1048
|
const userNoAta = splToken.getAssociatedTokenAddressSync(noMint, user, false, splToken.TOKEN_2022_PROGRAM_ID);
|
|
1051
1049
|
const userCollateral = splToken.getAssociatedTokenAddressSync(collateralMint, user);
|
|
1052
|
-
|
|
1050
|
+
return this.program.methods.redeemPositions().accounts({
|
|
1053
1051
|
user,
|
|
1054
1052
|
payer,
|
|
1055
1053
|
condition,
|
|
@@ -1065,8 +1063,7 @@ var CtfClient = class {
|
|
|
1065
1063
|
tokenProgram: splToken.TOKEN_PROGRAM_ID,
|
|
1066
1064
|
token2022Program: splToken.TOKEN_2022_PROGRAM_ID,
|
|
1067
1065
|
systemProgram: web3_js.SystemProgram.programId
|
|
1068
|
-
}).
|
|
1069
|
-
return { signature: sig };
|
|
1066
|
+
}).transaction();
|
|
1070
1067
|
}
|
|
1071
1068
|
/**
|
|
1072
1069
|
* Oracle directly resolves a condition with payout numerators.
|
|
@@ -1407,8 +1404,8 @@ var ClobClient = class {
|
|
|
1407
1404
|
async _sendLegacyTx(instructions) {
|
|
1408
1405
|
const { connection } = this.provider;
|
|
1409
1406
|
const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash();
|
|
1410
|
-
const { Transaction:
|
|
1411
|
-
const tx = new
|
|
1407
|
+
const { Transaction: Transaction5 } = await import('@solana/web3.js');
|
|
1408
|
+
const tx = new Transaction5();
|
|
1412
1409
|
tx.recentBlockhash = blockhash;
|
|
1413
1410
|
tx.feePayer = this.walletPubkey;
|
|
1414
1411
|
tx.add(...instructions);
|