@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.mjs
CHANGED
|
@@ -936,7 +936,7 @@ var CtfClient = class {
|
|
|
936
936
|
* Split `amount` collateral into equal YES + NO tokens.
|
|
937
937
|
* ATAs created automatically via `init_if_needed`.
|
|
938
938
|
*/
|
|
939
|
-
async splitPosition(condition, collateralMint, amount, user = this.walletPubkey, payer = this.walletPubkey
|
|
939
|
+
async splitPosition(condition, collateralMint, amount, user = this.walletPubkey, payer = this.walletPubkey) {
|
|
940
940
|
const [collateralVault] = PDA.collateralVault(collateralMint, this.programIds);
|
|
941
941
|
const [vaultTokenAccount] = PDA.vaultToken(collateralMint, this.programIds);
|
|
942
942
|
const [yesMint] = PDA.yesMint(condition, this.programIds);
|
|
@@ -947,7 +947,7 @@ var CtfClient = class {
|
|
|
947
947
|
const userYesAta = getAssociatedTokenAddressSync(yesMint, user, false, TOKEN_2022_PROGRAM_ID);
|
|
948
948
|
const userNoAta = getAssociatedTokenAddressSync(noMint, user, false, TOKEN_2022_PROGRAM_ID);
|
|
949
949
|
const userCollateral = getAssociatedTokenAddressSync(collateralMint, user);
|
|
950
|
-
|
|
950
|
+
return this.program.methods.splitPosition(amount).accounts({
|
|
951
951
|
user,
|
|
952
952
|
payer,
|
|
953
953
|
condition,
|
|
@@ -965,14 +965,13 @@ var CtfClient = class {
|
|
|
965
965
|
token2022Program: TOKEN_2022_PROGRAM_ID,
|
|
966
966
|
associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
967
967
|
systemProgram: SystemProgram.programId
|
|
968
|
-
}).
|
|
969
|
-
return { signature: sig };
|
|
968
|
+
}).transaction();
|
|
970
969
|
}
|
|
971
970
|
/**
|
|
972
971
|
* Merge `amount` YES + NO tokens back into collateral.
|
|
973
972
|
* Both token balances must be ≥ amount.
|
|
974
973
|
*/
|
|
975
|
-
async mergePosition(condition, collateralMint, amount, user = this.walletPubkey, payer = this.walletPubkey
|
|
974
|
+
async mergePosition(condition, collateralMint, amount, user = this.walletPubkey, payer = this.walletPubkey) {
|
|
976
975
|
const [collateralVault] = PDA.collateralVault(collateralMint, this.programIds);
|
|
977
976
|
const [vaultTokenAccount] = PDA.vaultToken(collateralMint, this.programIds);
|
|
978
977
|
const [yesMint] = PDA.yesMint(condition, this.programIds);
|
|
@@ -982,7 +981,7 @@ var CtfClient = class {
|
|
|
982
981
|
const userYesAta = getAssociatedTokenAddressSync(yesMint, user, false, TOKEN_2022_PROGRAM_ID);
|
|
983
982
|
const userNoAta = getAssociatedTokenAddressSync(noMint, user, false, TOKEN_2022_PROGRAM_ID);
|
|
984
983
|
const userCollateral = getAssociatedTokenAddressSync(collateralMint, user);
|
|
985
|
-
|
|
984
|
+
return this.program.methods.mergePosition(amount).accounts({
|
|
986
985
|
user,
|
|
987
986
|
payer,
|
|
988
987
|
condition,
|
|
@@ -998,14 +997,13 @@ var CtfClient = class {
|
|
|
998
997
|
tokenProgram: TOKEN_PROGRAM_ID,
|
|
999
998
|
token2022Program: TOKEN_2022_PROGRAM_ID,
|
|
1000
999
|
systemProgram: SystemProgram.programId
|
|
1001
|
-
}).
|
|
1002
|
-
return { signature: sig };
|
|
1000
|
+
}).transaction();
|
|
1003
1001
|
}
|
|
1004
1002
|
/**
|
|
1005
1003
|
* After condition resolves: burn outcome tokens proportional to payout
|
|
1006
1004
|
* and receive USDC. Works for winning, losing, or both positions.
|
|
1007
1005
|
*/
|
|
1008
|
-
async redeemPositions(condition, collateralMint, user = this.walletPubkey, payer = this.walletPubkey
|
|
1006
|
+
async redeemPositions(condition, collateralMint, user = this.walletPubkey, payer = this.walletPubkey) {
|
|
1009
1007
|
const [collateralVault] = PDA.collateralVault(collateralMint, this.programIds);
|
|
1010
1008
|
const [vaultTokenAccount] = PDA.vaultToken(collateralMint, this.programIds);
|
|
1011
1009
|
const [yesMint] = PDA.yesMint(condition, this.programIds);
|
|
@@ -1015,7 +1013,7 @@ var CtfClient = class {
|
|
|
1015
1013
|
const userYesAta = getAssociatedTokenAddressSync(yesMint, user, false, TOKEN_2022_PROGRAM_ID);
|
|
1016
1014
|
const userNoAta = getAssociatedTokenAddressSync(noMint, user, false, TOKEN_2022_PROGRAM_ID);
|
|
1017
1015
|
const userCollateral = getAssociatedTokenAddressSync(collateralMint, user);
|
|
1018
|
-
|
|
1016
|
+
return this.program.methods.redeemPositions().accounts({
|
|
1019
1017
|
user,
|
|
1020
1018
|
payer,
|
|
1021
1019
|
condition,
|
|
@@ -1031,8 +1029,7 @@ var CtfClient = class {
|
|
|
1031
1029
|
tokenProgram: TOKEN_PROGRAM_ID,
|
|
1032
1030
|
token2022Program: TOKEN_2022_PROGRAM_ID,
|
|
1033
1031
|
systemProgram: SystemProgram.programId
|
|
1034
|
-
}).
|
|
1035
|
-
return { signature: sig };
|
|
1032
|
+
}).transaction();
|
|
1036
1033
|
}
|
|
1037
1034
|
/**
|
|
1038
1035
|
* Oracle directly resolves a condition with payout numerators.
|
|
@@ -1373,8 +1370,8 @@ var ClobClient = class {
|
|
|
1373
1370
|
async _sendLegacyTx(instructions) {
|
|
1374
1371
|
const { connection } = this.provider;
|
|
1375
1372
|
const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash();
|
|
1376
|
-
const { Transaction:
|
|
1377
|
-
const tx = new
|
|
1373
|
+
const { Transaction: Transaction5 } = await import('@solana/web3.js');
|
|
1374
|
+
const tx = new Transaction5();
|
|
1378
1375
|
tx.recentBlockhash = blockhash;
|
|
1379
1376
|
tx.feePayer = this.walletPubkey;
|
|
1380
1377
|
tx.add(...instructions);
|