@theliem/xmarket-sdk 1.0.12 → 3.0.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 +4 -83
- package/dist/index.d.ts +4 -83
- package/dist/index.js +7 -106
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -104
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -12,7 +12,7 @@ interface ProgramIds {
|
|
|
12
12
|
}
|
|
13
13
|
interface CollateralConfig {
|
|
14
14
|
mint: PublicKey;
|
|
15
|
-
/** Token decimals
|
|
15
|
+
/** Token decimals */
|
|
16
16
|
decimals: number;
|
|
17
17
|
}
|
|
18
18
|
interface NetworkConfig {
|
|
@@ -21,11 +21,7 @@ interface NetworkConfig {
|
|
|
21
21
|
programIds: ProgramIds;
|
|
22
22
|
defaultCollateral: CollateralConfig;
|
|
23
23
|
}
|
|
24
|
-
type NetworkName =
|
|
25
|
-
declare const DEVNET_CONFIG: NetworkConfig;
|
|
26
|
-
declare const LOCALNET_CONFIG: NetworkConfig;
|
|
27
|
-
declare const MAINNET_CONFIG: NetworkConfig;
|
|
28
|
-
declare const NETWORK_CONFIGS: Record<NetworkName, NetworkConfig>;
|
|
24
|
+
type NetworkName = string;
|
|
29
25
|
|
|
30
26
|
interface TxResult {
|
|
31
27
|
signature: string;
|
|
@@ -552,45 +548,8 @@ declare class ClobClient {
|
|
|
552
548
|
isOrderCancelled(maker: PublicKey, nonce: anchor.BN): Promise<boolean>;
|
|
553
549
|
}
|
|
554
550
|
|
|
555
|
-
interface XMarketSDKConfig {
|
|
556
|
-
/**
|
|
557
|
-
* Network to connect to.
|
|
558
|
-
* - `"devnet"` — public devnet, programs deployed
|
|
559
|
-
* - `"localnet"` — local test validator (same program IDs as devnet)
|
|
560
|
-
* - `"mainnet"` — mainnet-beta (hook + clob IDs TBD)
|
|
561
|
-
* - `NetworkConfig` — fully custom config
|
|
562
|
-
*/
|
|
563
|
-
network: NetworkName | NetworkConfig;
|
|
564
|
-
wallet: anchor.Wallet;
|
|
565
|
-
/**
|
|
566
|
-
* Owner public key used to derive QuestionMarket + Oracle config PDAs.
|
|
567
|
-
* Defaults to wallet pubkey.
|
|
568
|
-
*/
|
|
569
|
-
marketOwner?: PublicKey;
|
|
570
|
-
}
|
|
571
|
-
/**
|
|
572
|
-
* Top-level SDK entry point.
|
|
573
|
-
*
|
|
574
|
-
* ```ts
|
|
575
|
-
* // Quickstart: devnet
|
|
576
|
-
* const sdk = XMarketSDK.devnet(wallet);
|
|
577
|
-
*
|
|
578
|
-
* // Create a question market
|
|
579
|
-
* await sdk.market.createQuestion({ content: "...", ... }, oraclePubkey);
|
|
580
|
-
*
|
|
581
|
-
* // Split collateral into YES + NO tokens
|
|
582
|
-
* await sdk.ctf.splitPosition(conditionPda, usdcMint, new BN(100_000));
|
|
583
|
-
*
|
|
584
|
-
* // Match orders on the CLOB
|
|
585
|
-
* await sdk.clob.matchMintOrders(yesOrder, noOrder, fillAmount, usdcMint);
|
|
586
|
-
*
|
|
587
|
-
* // Inspect active network config
|
|
588
|
-
* console.log(sdk.networkConfig.name, sdk.networkConfig.programIds);
|
|
589
|
-
* ```
|
|
590
|
-
*/
|
|
591
551
|
declare class XMarketSDK {
|
|
592
552
|
readonly provider: anchor.AnchorProvider;
|
|
593
|
-
/** Active network configuration (program IDs, RPC, collateral) */
|
|
594
553
|
readonly networkConfig: NetworkConfig;
|
|
595
554
|
private readonly _programIds;
|
|
596
555
|
private readonly _marketOwner;
|
|
@@ -599,51 +558,13 @@ declare class XMarketSDK {
|
|
|
599
558
|
private _market?;
|
|
600
559
|
private _ctf?;
|
|
601
560
|
private _clob?;
|
|
602
|
-
constructor(config:
|
|
561
|
+
constructor(config: NetworkConfig, wallet: anchor.Wallet, marketOwner?: PublicKey);
|
|
603
562
|
private _withAddress;
|
|
604
|
-
/** Oracle program client */
|
|
605
563
|
get oracle(): OracleClient;
|
|
606
|
-
/** Transfer-hook program client */
|
|
607
564
|
get hook(): HookClient;
|
|
608
|
-
/** QuestionMarket program client */
|
|
609
565
|
get market(): MarketClient;
|
|
610
|
-
/** Conditional tokens (CTF) program client */
|
|
611
566
|
get ctf(): CtfClient;
|
|
612
|
-
/** CLOB exchange program client */
|
|
613
567
|
get clob(): ClobClient;
|
|
614
|
-
/**
|
|
615
|
-
* Connect to devnet.
|
|
616
|
-
* ```ts
|
|
617
|
-
* const sdk = XMarketSDK.devnet(wallet);
|
|
618
|
-
* ```
|
|
619
|
-
*/
|
|
620
|
-
static devnet(wallet: anchor.Wallet, marketOwner?: PublicKey): XMarketSDK;
|
|
621
|
-
/**
|
|
622
|
-
* Connect to localhost test validator.
|
|
623
|
-
* ```ts
|
|
624
|
-
* const sdk = XMarketSDK.localnet(wallet);
|
|
625
|
-
* ```
|
|
626
|
-
*/
|
|
627
|
-
static localnet(wallet: anchor.Wallet, marketOwner?: PublicKey): XMarketSDK;
|
|
628
|
-
/**
|
|
629
|
-
* Connect to mainnet-beta.
|
|
630
|
-
* ```ts
|
|
631
|
-
* const sdk = XMarketSDK.mainnet(wallet);
|
|
632
|
-
* ```
|
|
633
|
-
*/
|
|
634
|
-
static mainnet(wallet: anchor.Wallet, marketOwner?: PublicKey): XMarketSDK;
|
|
635
|
-
/**
|
|
636
|
-
* Custom network (e.g. custom RPC, custom program IDs for a fork).
|
|
637
|
-
* ```ts
|
|
638
|
-
* const sdk = XMarketSDK.custom({
|
|
639
|
-
* name: "staging",
|
|
640
|
-
* rpcUrl: "https://my-rpc.com",
|
|
641
|
-
* programIds: { ... },
|
|
642
|
-
* defaultCollateral: { mint: ..., decimals: 6 },
|
|
643
|
-
* }, wallet);
|
|
644
|
-
* ```
|
|
645
|
-
*/
|
|
646
|
-
static custom(config: NetworkConfig, wallet: anchor.Wallet, marketOwner?: PublicKey): XMarketSDK;
|
|
647
568
|
}
|
|
648
569
|
|
|
649
570
|
declare const SEEDS: {
|
|
@@ -815,4 +736,4 @@ declare function buildApproveCollateralTx(collateralMint: PublicKey, signer: Pub
|
|
|
815
736
|
*/
|
|
816
737
|
declare function buildApproveAllOutcomeTokensTx(condition: PublicKey, signer: PublicKey, payer: PublicKey, delegate: PublicKey, programIds: ProgramIds, amount?: BN): Transaction;
|
|
817
738
|
|
|
818
|
-
export { AccountNotFoundError, ClobClient, type ClobConfig, type ClobWhitelistEntry, type CollateralConfig, type CollateralVault, type Condition, type CreateQuestionParams, CtfClient, type CtfConfig,
|
|
739
|
+
export { AccountNotFoundError, ClobClient, type ClobConfig, type ClobWhitelistEntry, type CollateralConfig, type CollateralVault, type Condition, type CreateQuestionParams, CtfClient, type CtfConfig, HookClient, type HookConfig, IX_SYSVAR, InvalidParamError, MAX_APPROVE_AMOUNT, MarketClient, type MatchType, type NetworkConfig, type NetworkName, OracleClient, type OracleConfig, type Order, type OrderStatus, PDA, type Position, type ProgramIds, type Question, type QuestionMarketConfig, type QuestionResult, QuestionStatus, SEEDS, type SignedOrder, type TxResult, UnauthorizedError, XMarketError, XMarketSDK, buildApproveAllOutcomeTokensTx, buildApproveCollateralTx, buildBatchedEd25519Instruction, buildOrder, deserializeSignedOrder, detectMatchType, generateContentHash, generateQuestionId, getOrderSignBytes, serializeOrderToBytes, serializeSignedOrder, signOrder, signOrderWithKeypair, verifySignedOrder };
|
package/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ interface ProgramIds {
|
|
|
12
12
|
}
|
|
13
13
|
interface CollateralConfig {
|
|
14
14
|
mint: PublicKey;
|
|
15
|
-
/** Token decimals
|
|
15
|
+
/** Token decimals */
|
|
16
16
|
decimals: number;
|
|
17
17
|
}
|
|
18
18
|
interface NetworkConfig {
|
|
@@ -21,11 +21,7 @@ interface NetworkConfig {
|
|
|
21
21
|
programIds: ProgramIds;
|
|
22
22
|
defaultCollateral: CollateralConfig;
|
|
23
23
|
}
|
|
24
|
-
type NetworkName =
|
|
25
|
-
declare const DEVNET_CONFIG: NetworkConfig;
|
|
26
|
-
declare const LOCALNET_CONFIG: NetworkConfig;
|
|
27
|
-
declare const MAINNET_CONFIG: NetworkConfig;
|
|
28
|
-
declare const NETWORK_CONFIGS: Record<NetworkName, NetworkConfig>;
|
|
24
|
+
type NetworkName = string;
|
|
29
25
|
|
|
30
26
|
interface TxResult {
|
|
31
27
|
signature: string;
|
|
@@ -552,45 +548,8 @@ declare class ClobClient {
|
|
|
552
548
|
isOrderCancelled(maker: PublicKey, nonce: anchor.BN): Promise<boolean>;
|
|
553
549
|
}
|
|
554
550
|
|
|
555
|
-
interface XMarketSDKConfig {
|
|
556
|
-
/**
|
|
557
|
-
* Network to connect to.
|
|
558
|
-
* - `"devnet"` — public devnet, programs deployed
|
|
559
|
-
* - `"localnet"` — local test validator (same program IDs as devnet)
|
|
560
|
-
* - `"mainnet"` — mainnet-beta (hook + clob IDs TBD)
|
|
561
|
-
* - `NetworkConfig` — fully custom config
|
|
562
|
-
*/
|
|
563
|
-
network: NetworkName | NetworkConfig;
|
|
564
|
-
wallet: anchor.Wallet;
|
|
565
|
-
/**
|
|
566
|
-
* Owner public key used to derive QuestionMarket + Oracle config PDAs.
|
|
567
|
-
* Defaults to wallet pubkey.
|
|
568
|
-
*/
|
|
569
|
-
marketOwner?: PublicKey;
|
|
570
|
-
}
|
|
571
|
-
/**
|
|
572
|
-
* Top-level SDK entry point.
|
|
573
|
-
*
|
|
574
|
-
* ```ts
|
|
575
|
-
* // Quickstart: devnet
|
|
576
|
-
* const sdk = XMarketSDK.devnet(wallet);
|
|
577
|
-
*
|
|
578
|
-
* // Create a question market
|
|
579
|
-
* await sdk.market.createQuestion({ content: "...", ... }, oraclePubkey);
|
|
580
|
-
*
|
|
581
|
-
* // Split collateral into YES + NO tokens
|
|
582
|
-
* await sdk.ctf.splitPosition(conditionPda, usdcMint, new BN(100_000));
|
|
583
|
-
*
|
|
584
|
-
* // Match orders on the CLOB
|
|
585
|
-
* await sdk.clob.matchMintOrders(yesOrder, noOrder, fillAmount, usdcMint);
|
|
586
|
-
*
|
|
587
|
-
* // Inspect active network config
|
|
588
|
-
* console.log(sdk.networkConfig.name, sdk.networkConfig.programIds);
|
|
589
|
-
* ```
|
|
590
|
-
*/
|
|
591
551
|
declare class XMarketSDK {
|
|
592
552
|
readonly provider: anchor.AnchorProvider;
|
|
593
|
-
/** Active network configuration (program IDs, RPC, collateral) */
|
|
594
553
|
readonly networkConfig: NetworkConfig;
|
|
595
554
|
private readonly _programIds;
|
|
596
555
|
private readonly _marketOwner;
|
|
@@ -599,51 +558,13 @@ declare class XMarketSDK {
|
|
|
599
558
|
private _market?;
|
|
600
559
|
private _ctf?;
|
|
601
560
|
private _clob?;
|
|
602
|
-
constructor(config:
|
|
561
|
+
constructor(config: NetworkConfig, wallet: anchor.Wallet, marketOwner?: PublicKey);
|
|
603
562
|
private _withAddress;
|
|
604
|
-
/** Oracle program client */
|
|
605
563
|
get oracle(): OracleClient;
|
|
606
|
-
/** Transfer-hook program client */
|
|
607
564
|
get hook(): HookClient;
|
|
608
|
-
/** QuestionMarket program client */
|
|
609
565
|
get market(): MarketClient;
|
|
610
|
-
/** Conditional tokens (CTF) program client */
|
|
611
566
|
get ctf(): CtfClient;
|
|
612
|
-
/** CLOB exchange program client */
|
|
613
567
|
get clob(): ClobClient;
|
|
614
|
-
/**
|
|
615
|
-
* Connect to devnet.
|
|
616
|
-
* ```ts
|
|
617
|
-
* const sdk = XMarketSDK.devnet(wallet);
|
|
618
|
-
* ```
|
|
619
|
-
*/
|
|
620
|
-
static devnet(wallet: anchor.Wallet, marketOwner?: PublicKey): XMarketSDK;
|
|
621
|
-
/**
|
|
622
|
-
* Connect to localhost test validator.
|
|
623
|
-
* ```ts
|
|
624
|
-
* const sdk = XMarketSDK.localnet(wallet);
|
|
625
|
-
* ```
|
|
626
|
-
*/
|
|
627
|
-
static localnet(wallet: anchor.Wallet, marketOwner?: PublicKey): XMarketSDK;
|
|
628
|
-
/**
|
|
629
|
-
* Connect to mainnet-beta.
|
|
630
|
-
* ```ts
|
|
631
|
-
* const sdk = XMarketSDK.mainnet(wallet);
|
|
632
|
-
* ```
|
|
633
|
-
*/
|
|
634
|
-
static mainnet(wallet: anchor.Wallet, marketOwner?: PublicKey): XMarketSDK;
|
|
635
|
-
/**
|
|
636
|
-
* Custom network (e.g. custom RPC, custom program IDs for a fork).
|
|
637
|
-
* ```ts
|
|
638
|
-
* const sdk = XMarketSDK.custom({
|
|
639
|
-
* name: "staging",
|
|
640
|
-
* rpcUrl: "https://my-rpc.com",
|
|
641
|
-
* programIds: { ... },
|
|
642
|
-
* defaultCollateral: { mint: ..., decimals: 6 },
|
|
643
|
-
* }, wallet);
|
|
644
|
-
* ```
|
|
645
|
-
*/
|
|
646
|
-
static custom(config: NetworkConfig, wallet: anchor.Wallet, marketOwner?: PublicKey): XMarketSDK;
|
|
647
568
|
}
|
|
648
569
|
|
|
649
570
|
declare const SEEDS: {
|
|
@@ -815,4 +736,4 @@ declare function buildApproveCollateralTx(collateralMint: PublicKey, signer: Pub
|
|
|
815
736
|
*/
|
|
816
737
|
declare function buildApproveAllOutcomeTokensTx(condition: PublicKey, signer: PublicKey, payer: PublicKey, delegate: PublicKey, programIds: ProgramIds, amount?: BN): Transaction;
|
|
817
738
|
|
|
818
|
-
export { AccountNotFoundError, ClobClient, type ClobConfig, type ClobWhitelistEntry, type CollateralConfig, type CollateralVault, type Condition, type CreateQuestionParams, CtfClient, type CtfConfig,
|
|
739
|
+
export { AccountNotFoundError, ClobClient, type ClobConfig, type ClobWhitelistEntry, type CollateralConfig, type CollateralVault, type Condition, type CreateQuestionParams, CtfClient, type CtfConfig, HookClient, type HookConfig, IX_SYSVAR, InvalidParamError, MAX_APPROVE_AMOUNT, MarketClient, type MatchType, type NetworkConfig, type NetworkName, OracleClient, type OracleConfig, type Order, type OrderStatus, PDA, type Position, type ProgramIds, type Question, type QuestionMarketConfig, type QuestionResult, QuestionStatus, SEEDS, type SignedOrder, type TxResult, UnauthorizedError, XMarketError, XMarketSDK, buildApproveAllOutcomeTokensTx, buildApproveCollateralTx, buildBatchedEd25519Instruction, buildOrder, deserializeSignedOrder, detectMatchType, generateContentHash, generateQuestionId, getOrderSignBytes, serializeOrderToBytes, serializeSignedOrder, signOrder, signOrderWithKeypair, verifySignedOrder };
|
package/dist/index.js
CHANGED
|
@@ -42,53 +42,6 @@ var BN4__default = /*#__PURE__*/_interopDefault(BN4);
|
|
|
42
42
|
var nacl__namespace = /*#__PURE__*/_interopNamespace(nacl);
|
|
43
43
|
|
|
44
44
|
// src/sdk.ts
|
|
45
|
-
var DEVNET_CONFIG = {
|
|
46
|
-
name: "devnet",
|
|
47
|
-
rpcUrl: "https://api.devnet.solana.com",
|
|
48
|
-
programIds: {
|
|
49
|
-
oracle: new web3_js.PublicKey("FzLnnbKtQCTKviEbrDYMLZYXNDHQdjSSa4Ybj4jAbrUL"),
|
|
50
|
-
conditionalTokens: new web3_js.PublicKey("A6N1F8MRsdgcojAx8p6FaECvw8mo8w6qJcWsbKQBANK4"),
|
|
51
|
-
questionMarket: new web3_js.PublicKey("FCvCbWoLpzNYKzQnXYXCo1yz9DTpgUs11QqHVqnqtWhA"),
|
|
52
|
-
hook: new web3_js.PublicKey("F7y5MfW8d5kqR25QHDhUQ9LrKCiZUZVF6Pdnw15q5zZW"),
|
|
53
|
-
clobExchange: new web3_js.PublicKey("Cs4GY1yZVxjxhhyUum3AupMuS3bo4yKRXifgLTTAh1sf")
|
|
54
|
-
},
|
|
55
|
-
defaultCollateral: {
|
|
56
|
-
mint: new web3_js.PublicKey("53osACZSom79AHf6nK4eq8DL6viMZmyVERYPDB6S6Eck"),
|
|
57
|
-
decimals: 9
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
var LOCALNET_CONFIG = {
|
|
61
|
-
name: "localnet",
|
|
62
|
-
rpcUrl: "http://localhost:8899",
|
|
63
|
-
programIds: { ...DEVNET_CONFIG.programIds },
|
|
64
|
-
defaultCollateral: {
|
|
65
|
-
mint: new web3_js.PublicKey("6Gk4qsruSjunenwzP4L5DQukawfVNvdr9rPX2qG77jmH"),
|
|
66
|
-
decimals: 6
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
var MAINNET_CONFIG = {
|
|
70
|
-
name: "mainnet",
|
|
71
|
-
rpcUrl: "https://api.mainnet-beta.solana.com",
|
|
72
|
-
programIds: {
|
|
73
|
-
oracle: new web3_js.PublicKey("E667trvbHmZEnptjnjXp9x8e1Fpji3viHo1J1DGPKijh"),
|
|
74
|
-
conditionalTokens: new web3_js.PublicKey("3WFSX7zPLrJSU811h7awgqXTZuKhUR1Fi1VBDayHhk4s"),
|
|
75
|
-
questionMarket: new web3_js.PublicKey("GiQh2xBmEiM4gYq4U9PMSaUJNq1T9TfEJL5cXvNYhtGm"),
|
|
76
|
-
hook: new web3_js.PublicKey("11111111111111111111111111111111"),
|
|
77
|
-
// not yet deployed
|
|
78
|
-
clobExchange: new web3_js.PublicKey("11111111111111111111111111111111")
|
|
79
|
-
// not yet deployed
|
|
80
|
-
},
|
|
81
|
-
defaultCollateral: {
|
|
82
|
-
mint: new web3_js.PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),
|
|
83
|
-
// USDC mainnet
|
|
84
|
-
decimals: 6
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
var NETWORK_CONFIGS = {
|
|
88
|
-
devnet: DEVNET_CONFIG,
|
|
89
|
-
localnet: LOCALNET_CONFIG,
|
|
90
|
-
mainnet: MAINNET_CONFIG
|
|
91
|
-
};
|
|
92
45
|
var SEEDS = {
|
|
93
46
|
config: Buffer.from("config"),
|
|
94
47
|
question: Buffer.from("question"),
|
|
@@ -1595,23 +1548,21 @@ var ClobClient = class {
|
|
|
1595
1548
|
return status?.isCancelled === true;
|
|
1596
1549
|
}
|
|
1597
1550
|
};
|
|
1598
|
-
var XMarketSDK = class
|
|
1599
|
-
constructor(config) {
|
|
1600
|
-
this.networkConfig =
|
|
1551
|
+
var XMarketSDK = class {
|
|
1552
|
+
constructor(config, wallet, marketOwner) {
|
|
1553
|
+
this.networkConfig = config;
|
|
1601
1554
|
this.provider = new anchor4__namespace.AnchorProvider(
|
|
1602
|
-
new web3_js.Connection(
|
|
1603
|
-
|
|
1555
|
+
new web3_js.Connection(config.rpcUrl, "confirmed"),
|
|
1556
|
+
wallet,
|
|
1604
1557
|
{ commitment: "confirmed", preflightCommitment: "confirmed" }
|
|
1605
1558
|
);
|
|
1606
1559
|
anchor4__namespace.setProvider(this.provider);
|
|
1607
|
-
this._programIds =
|
|
1608
|
-
this._marketOwner =
|
|
1560
|
+
this._programIds = config.programIds;
|
|
1561
|
+
this._marketOwner = marketOwner ?? wallet.publicKey;
|
|
1609
1562
|
}
|
|
1610
|
-
// ─── Lazy-initialised clients ─────────────────────────────────────────────
|
|
1611
1563
|
_withAddress(idl, address) {
|
|
1612
1564
|
return { ...idl, address: address.toBase58() };
|
|
1613
1565
|
}
|
|
1614
|
-
/** Oracle program client */
|
|
1615
1566
|
get oracle() {
|
|
1616
1567
|
if (!this._oracle) {
|
|
1617
1568
|
const program = new anchor4__namespace.Program(this._withAddress(oracleIdl__default.default, this._programIds.oracle), this.provider);
|
|
@@ -1619,7 +1570,6 @@ var XMarketSDK = class _XMarketSDK {
|
|
|
1619
1570
|
}
|
|
1620
1571
|
return this._oracle;
|
|
1621
1572
|
}
|
|
1622
|
-
/** Transfer-hook program client */
|
|
1623
1573
|
get hook() {
|
|
1624
1574
|
if (!this._hook) {
|
|
1625
1575
|
const program = new anchor4__namespace.Program(this._withAddress(hookIdl__default.default, this._programIds.hook), this.provider);
|
|
@@ -1627,7 +1577,6 @@ var XMarketSDK = class _XMarketSDK {
|
|
|
1627
1577
|
}
|
|
1628
1578
|
return this._hook;
|
|
1629
1579
|
}
|
|
1630
|
-
/** QuestionMarket program client */
|
|
1631
1580
|
get market() {
|
|
1632
1581
|
if (!this._market) {
|
|
1633
1582
|
const program = new anchor4__namespace.Program(this._withAddress(questionMarketIdl__default.default, this._programIds.questionMarket), this.provider);
|
|
@@ -1636,7 +1585,6 @@ var XMarketSDK = class _XMarketSDK {
|
|
|
1636
1585
|
}
|
|
1637
1586
|
return this._market;
|
|
1638
1587
|
}
|
|
1639
|
-
/** Conditional tokens (CTF) program client */
|
|
1640
1588
|
get ctf() {
|
|
1641
1589
|
if (!this._ctf) {
|
|
1642
1590
|
const program = new anchor4__namespace.Program(this._withAddress(conditionalTokensIdl__default.default, this._programIds.conditionalTokens), this.provider);
|
|
@@ -1644,7 +1592,6 @@ var XMarketSDK = class _XMarketSDK {
|
|
|
1644
1592
|
}
|
|
1645
1593
|
return this._ctf;
|
|
1646
1594
|
}
|
|
1647
|
-
/** CLOB exchange program client */
|
|
1648
1595
|
get clob() {
|
|
1649
1596
|
if (!this._clob) {
|
|
1650
1597
|
const program = new anchor4__namespace.Program(this._withAddress(clobExchangeIdl__default.default, this._programIds.clobExchange), this.provider);
|
|
@@ -1652,48 +1599,6 @@ var XMarketSDK = class _XMarketSDK {
|
|
|
1652
1599
|
}
|
|
1653
1600
|
return this._clob;
|
|
1654
1601
|
}
|
|
1655
|
-
// ─── Factory helpers ──────────────────────────────────────────────────────
|
|
1656
|
-
/**
|
|
1657
|
-
* Connect to devnet.
|
|
1658
|
-
* ```ts
|
|
1659
|
-
* const sdk = XMarketSDK.devnet(wallet);
|
|
1660
|
-
* ```
|
|
1661
|
-
*/
|
|
1662
|
-
static devnet(wallet, marketOwner) {
|
|
1663
|
-
return new _XMarketSDK({ network: "devnet", wallet, marketOwner });
|
|
1664
|
-
}
|
|
1665
|
-
/**
|
|
1666
|
-
* Connect to localhost test validator.
|
|
1667
|
-
* ```ts
|
|
1668
|
-
* const sdk = XMarketSDK.localnet(wallet);
|
|
1669
|
-
* ```
|
|
1670
|
-
*/
|
|
1671
|
-
static localnet(wallet, marketOwner) {
|
|
1672
|
-
return new _XMarketSDK({ network: "localnet", wallet, marketOwner });
|
|
1673
|
-
}
|
|
1674
|
-
/**
|
|
1675
|
-
* Connect to mainnet-beta.
|
|
1676
|
-
* ```ts
|
|
1677
|
-
* const sdk = XMarketSDK.mainnet(wallet);
|
|
1678
|
-
* ```
|
|
1679
|
-
*/
|
|
1680
|
-
static mainnet(wallet, marketOwner) {
|
|
1681
|
-
return new _XMarketSDK({ network: "mainnet", wallet, marketOwner });
|
|
1682
|
-
}
|
|
1683
|
-
/**
|
|
1684
|
-
* Custom network (e.g. custom RPC, custom program IDs for a fork).
|
|
1685
|
-
* ```ts
|
|
1686
|
-
* const sdk = XMarketSDK.custom({
|
|
1687
|
-
* name: "staging",
|
|
1688
|
-
* rpcUrl: "https://my-rpc.com",
|
|
1689
|
-
* programIds: { ... },
|
|
1690
|
-
* defaultCollateral: { mint: ..., decimals: 6 },
|
|
1691
|
-
* }, wallet);
|
|
1692
|
-
* ```
|
|
1693
|
-
*/
|
|
1694
|
-
static custom(config, wallet, marketOwner) {
|
|
1695
|
-
return new _XMarketSDK({ network: config, wallet, marketOwner });
|
|
1696
|
-
}
|
|
1697
1602
|
};
|
|
1698
1603
|
function buildOrder(params) {
|
|
1699
1604
|
return {
|
|
@@ -1826,15 +1731,11 @@ function buildApproveAllOutcomeTokensTx(condition, signer, payer, delegate, prog
|
|
|
1826
1731
|
exports.AccountNotFoundError = AccountNotFoundError;
|
|
1827
1732
|
exports.ClobClient = ClobClient;
|
|
1828
1733
|
exports.CtfClient = CtfClient;
|
|
1829
|
-
exports.DEVNET_CONFIG = DEVNET_CONFIG;
|
|
1830
1734
|
exports.HookClient = HookClient;
|
|
1831
1735
|
exports.IX_SYSVAR = IX_SYSVAR;
|
|
1832
1736
|
exports.InvalidParamError = InvalidParamError;
|
|
1833
|
-
exports.LOCALNET_CONFIG = LOCALNET_CONFIG;
|
|
1834
|
-
exports.MAINNET_CONFIG = MAINNET_CONFIG;
|
|
1835
1737
|
exports.MAX_APPROVE_AMOUNT = MAX_APPROVE_AMOUNT;
|
|
1836
1738
|
exports.MarketClient = MarketClient;
|
|
1837
|
-
exports.NETWORK_CONFIGS = NETWORK_CONFIGS;
|
|
1838
1739
|
exports.OracleClient = OracleClient;
|
|
1839
1740
|
exports.PDA = PDA;
|
|
1840
1741
|
exports.QuestionStatus = QuestionStatus;
|