@triadxyz/triad-protocol 2.3.4-beta → 2.3.6-beta

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.
@@ -19,9 +19,7 @@ const getPriorityFee = () => __awaiter(void 0, void 0, void 0, function* () {
19
19
  const response = yield axios_1.default.get('https://solanacompass.com/api/fees');
20
20
  fee = response.data[1].priorityTx;
21
21
  }
22
- catch (e) {
23
- fee = 1000;
24
- }
22
+ catch (_a) { }
25
23
  return fee;
26
24
  });
27
25
  exports.default = getPriorityFee;
@@ -1,7 +1,7 @@
1
- import { Stake, StakeVault } from './../types/stake';
2
- import { Market, Order, OrderDirection, OrderSide, OrderStatus, OrderType, UserTrade, Chest, Pool } from '../types/trade';
3
1
  import { PublicKey } from '@solana/web3.js';
4
2
  import { IdlAccounts } from '@coral-xyz/anchor';
3
+ import { Stake, StakeVault } from './../types/stake';
4
+ import { Market, Order, OrderDirection, OrderSide, OrderStatus, OrderType, UserTrade, Pool, BookOrder } from '../types';
5
5
  import { TriadProtocol } from '../types/triad_protocol';
6
6
  export declare const encodeString: (value: string, alloc?: number) => number[];
7
7
  export declare const decodeString: (bytes: number[]) => string;
@@ -11,7 +11,7 @@ export declare const formatPool: (account: IdlAccounts<TriadProtocol>['pool'], a
11
11
  export declare const formatMarket: (account: IdlAccounts<TriadProtocol>['marketV2'], address: PublicKey) => Market;
12
12
  export declare const formatUserTrade: (account: IdlAccounts<TriadProtocol>['userTrade'], publicKey: PublicKey) => UserTrade;
13
13
  export declare const formatOrder: (order: IdlAccounts<TriadProtocol>['userTrade']['orders'][number], authority?: string) => Order;
14
- export declare const formatChest: (chest: IdlAccounts<TriadProtocol>['chest']) => Chest;
14
+ export declare const formatBookOrder: (order: IdlAccounts<TriadProtocol>['orderBook']['hypeOrders'][number] | IdlAccounts<TriadProtocol>['orderBook']['flopOrders'][number]) => BookOrder;
15
15
  export declare const calculateStakeRewards: (stake: Stake) => number;
16
16
  export declare const getTokenProgram: (mint: PublicKey) => PublicKey;
17
17
  export declare const getOrderDirection: (direction: {
@@ -19,6 +19,8 @@ export declare const getOrderDirection: (direction: {
19
19
  } | {
20
20
  flop: {};
21
21
  }) => OrderDirection;
22
+ export declare const getOrderDirectionFromNumber: (direction: number) => OrderDirection;
23
+ export declare const getOrderSideFromNumber: (side: number) => OrderSide;
22
24
  export declare const getOrderType: (type: {
23
25
  limit: {};
24
26
  } | {
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getOrderStatus = exports.getOrderSide = exports.getOrderType = exports.getOrderDirection = exports.getTokenProgram = exports.calculateStakeRewards = exports.formatChest = exports.formatOrder = exports.formatUserTrade = exports.formatMarket = exports.formatPool = exports.formatStake = exports.formatStakeVault = exports.decodeString = exports.encodeString = void 0;
4
- const trade_1 = require("../types/trade");
5
- const constants_1 = require("./constants");
3
+ exports.getOrderStatus = exports.getOrderSide = exports.getOrderType = exports.getOrderSideFromNumber = exports.getOrderDirectionFromNumber = exports.getOrderDirection = exports.getTokenProgram = exports.calculateStakeRewards = exports.formatBookOrder = exports.formatOrder = exports.formatUserTrade = exports.formatMarket = exports.formatPool = exports.formatStake = exports.formatStakeVault = exports.decodeString = exports.encodeString = void 0;
6
4
  const spl_token_1 = require("@solana/spl-token");
7
- const spl_token_2 = require("@solana/spl-token");
5
+ const types_1 = require("../types");
6
+ const constants_1 = require("./constants");
8
7
  const encodeString = (value, alloc = 32) => {
9
8
  const buffer = Buffer.alloc(alloc, 32);
10
9
  buffer.write(value);
@@ -89,7 +88,7 @@ const formatMarket = (account, address) => {
89
88
  payoutFeeClaimed: account.payoutFeeClaimed.toString(),
90
89
  marketFeeAvailable: account.marketFeeAvailable.toString(),
91
90
  marketFeeClaimed: account.marketFeeClaimed.toString(),
92
- winningDirection: trade_1.WinningDirection[Object.keys(account.winningDirection)[0].toUpperCase()],
91
+ winningDirection: types_1.WinningDirection[Object.keys(account.winningDirection)[0].toUpperCase()],
93
92
  marketLiquidityAtStart: account.marketLiquidityAtStart.toNumber() > 0
94
93
  ? account.marketLiquidityAtStart.toString()
95
94
  : '0',
@@ -126,25 +125,23 @@ const formatOrder = (order, authority) => {
126
125
  orderSide: (0, exports.getOrderSide)(order.orderSide),
127
126
  price: order.price.toString(),
128
127
  totalShares: order.totalShares.toString(),
129
- filledShares: order.filledShares ? order.filledShares.toString() : '',
130
- linkedOrderId: order.linkedOrderId ? order.linkedOrderId.toString() : '',
131
- linkedBidOrderId: order.linkedBidOrderId
132
- ? order.linkedBidOrderId.toString()
133
- : ''
128
+ filledShares: order.filledShares ? order.filledShares.toString() : ''
134
129
  };
135
130
  };
136
131
  exports.formatOrder = formatOrder;
137
- const formatChest = (chest) => {
132
+ const formatBookOrder = (order) => {
138
133
  return {
139
- id: chest.id.toNumber(),
140
- prizePool: chest.prizePool.toNumber(),
141
- timer: chest.timer.toNumber(),
142
- isFinished: chest.isFinished,
143
- lastUser: chest.lastUser.toString(),
144
- ts: chest.ts.toNumber()
134
+ id: order.id.toString(),
135
+ price: order.price.toString(),
136
+ totalShares: order.totalShares.toString(),
137
+ authority: order.authority.toString(),
138
+ filledShares: order.filledShares.toString(),
139
+ orderDirection: (0, exports.getOrderDirectionFromNumber)(order.orderDirection),
140
+ orderSide: (0, exports.getOrderSideFromNumber)(order.orderSide),
141
+ userNonce: order.userNonce.toString()
145
142
  };
146
143
  };
147
- exports.formatChest = formatChest;
144
+ exports.formatBookOrder = formatBookOrder;
148
145
  const calculateStakeRewards = (stake) => {
149
146
  if (stake.withdrawTs !== 0)
150
147
  return 0;
@@ -168,45 +165,61 @@ const getTokenProgram = (mint) => {
168
165
  if (mint.toBase58() === constants_1.TRD_MINT.toBase58()) {
169
166
  return spl_token_1.TOKEN_2022_PROGRAM_ID;
170
167
  }
171
- return spl_token_2.TOKEN_PROGRAM_ID;
168
+ return spl_token_1.TOKEN_PROGRAM_ID;
172
169
  };
173
170
  exports.getTokenProgram = getTokenProgram;
174
171
  const getOrderDirection = (direction) => {
175
172
  if (Object.keys(direction)[0] === 'hype') {
176
- return trade_1.OrderDirection.HYPE;
173
+ return types_1.OrderDirection.HYPE;
177
174
  }
178
- return trade_1.OrderDirection.FLOP;
175
+ return types_1.OrderDirection.FLOP;
179
176
  };
180
177
  exports.getOrderDirection = getOrderDirection;
178
+ const getOrderDirectionFromNumber = (direction) => {
179
+ if (direction === 1) {
180
+ return types_1.OrderDirection.HYPE;
181
+ }
182
+ if (direction === 2) {
183
+ return types_1.OrderDirection.FLOP;
184
+ }
185
+ };
186
+ exports.getOrderDirectionFromNumber = getOrderDirectionFromNumber;
187
+ const getOrderSideFromNumber = (side) => {
188
+ if (side === 0) {
189
+ return types_1.OrderSide.BID;
190
+ }
191
+ return types_1.OrderSide.ASK;
192
+ };
193
+ exports.getOrderSideFromNumber = getOrderSideFromNumber;
181
194
  const getOrderType = (type) => {
182
195
  if (Object.keys(type)[0] === 'limit') {
183
- return trade_1.OrderType.LIMIT;
196
+ return types_1.OrderType.LIMIT;
184
197
  }
185
- return trade_1.OrderType.MARKET;
198
+ return types_1.OrderType.MARKET;
186
199
  };
187
200
  exports.getOrderType = getOrderType;
188
201
  const getOrderSide = (side) => {
189
202
  if (Object.keys(side)[0] === 'bid') {
190
- return trade_1.OrderSide.BID;
203
+ return types_1.OrderSide.BID;
191
204
  }
192
- return trade_1.OrderSide.ASK;
205
+ return types_1.OrderSide.ASK;
193
206
  };
194
207
  exports.getOrderSide = getOrderSide;
195
208
  const getOrderStatus = (status) => {
196
209
  let currentStatus = Object.keys(status)[0];
197
210
  switch (currentStatus) {
198
211
  case 'init':
199
- return trade_1.OrderStatus.INIT;
212
+ return types_1.OrderStatus.INIT;
200
213
  case 'open':
201
- return trade_1.OrderStatus.OPEN;
214
+ return types_1.OrderStatus.OPEN;
202
215
  case 'closed':
203
- return trade_1.OrderStatus.CLOSED;
216
+ return types_1.OrderStatus.CLOSED;
204
217
  case 'claimed':
205
- return trade_1.OrderStatus.CLAIMED;
218
+ return types_1.OrderStatus.CLAIMED;
206
219
  case 'liquidated':
207
- return trade_1.OrderStatus.LIQUIDATED;
220
+ return types_1.OrderStatus.LIQUIDATED;
208
221
  case 'waiting':
209
- return trade_1.OrderStatus.WAITING;
222
+ return types_1.OrderStatus.WAITING;
210
223
  default:
211
224
  throw new Error('Invalid order status');
212
225
  }
@@ -1,6 +1,7 @@
1
1
  import { PublicKey } from '@solana/web3.js';
2
2
  export declare const getTokenATA: (address: PublicKey, Mint: PublicKey, program?: PublicKey) => PublicKey;
3
3
  export declare const getMarketPDA: (programId: PublicKey, marketId: number) => PublicKey;
4
+ export declare const getOrderBookPDA: (programId: PublicKey, marketId: number) => PublicKey;
4
5
  export declare const getCustomerPDA: (programId: PublicKey, customerId: number) => PublicKey;
5
6
  export declare const getUserTradePDA: (programId: PublicKey, wallet: PublicKey) => PublicKey;
6
7
  export declare const getSubUserTradePDA: (programId: PublicKey, wallet: PublicKey, nonce: number) => PublicKey;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getPoolPDA = exports.getSubUserTradePDA = exports.getUserTradePDA = exports.getCustomerPDA = exports.getMarketPDA = exports.getTokenATA = void 0;
6
+ exports.getPoolPDA = exports.getSubUserTradePDA = exports.getUserTradePDA = exports.getCustomerPDA = exports.getOrderBookPDA = exports.getMarketPDA = exports.getTokenATA = void 0;
7
7
  const web3_js_1 = require("@solana/web3.js");
8
8
  const bn_js_1 = __importDefault(require("bn.js"));
9
9
  const spl_token_1 = require("@solana/spl-token");
@@ -15,6 +15,10 @@ const getMarketPDA = (programId, marketId) => {
15
15
  return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('market'), new bn_js_1.default(marketId).toArrayLike(Buffer, 'le', 8)], programId)[0];
16
16
  };
17
17
  exports.getMarketPDA = getMarketPDA;
18
+ const getOrderBookPDA = (programId, marketId) => {
19
+ return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('order_book'), new bn_js_1.default(marketId).toArrayLike(Buffer, 'le', 8)], programId)[0];
20
+ };
21
+ exports.getOrderBookPDA = getOrderBookPDA;
18
22
  const getCustomerPDA = (programId, customerId) => {
19
23
  return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('customer'), new bn_js_1.default(customerId).toArrayLike(Buffer, 'le', 8)], programId)[0];
20
24
  };
@@ -2,4 +2,3 @@ import { PublicKey } from '@solana/web3.js';
2
2
  export declare const getCollectionPDA: (programId: PublicKey, collectionSymbol: string) => PublicKey;
3
3
  export declare const getNftPDA: (programId: PublicKey, number: number) => PublicKey;
4
4
  export declare const getPoseidonPDA: (programId: PublicKey, number: number) => PublicKey;
5
- export declare const getChestPDA: (programId: PublicKey, id: number) => PublicKey;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getChestPDA = exports.getPoseidonPDA = exports.getNftPDA = exports.getCollectionPDA = void 0;
6
+ exports.getPoseidonPDA = exports.getNftPDA = exports.getCollectionPDA = void 0;
7
7
  const web3_js_1 = require("@solana/web3.js");
8
8
  const bn_js_1 = __importDefault(require("bn.js"));
9
9
  const getCollectionPDA = (programId, collectionSymbol) => {
@@ -18,7 +18,3 @@ const getPoseidonPDA = (programId, number) => {
18
18
  return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('poseidon'), new bn_js_1.default(number).toArrayLike(Buffer, 'le', 8)], programId)[0];
19
19
  };
20
20
  exports.getPoseidonPDA = getPoseidonPDA;
21
- const getChestPDA = (programId, id) => {
22
- return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('chest'), new bn_js_1.default(id).toArrayLike(Buffer, 'le', 8)], programId)[0];
23
- };
24
- exports.getChestPDA = getChestPDA;
@@ -1,7 +1,6 @@
1
- import { TransactionInstruction } from '@solana/web3.js';
2
- import { RpcOptions } from '../types';
3
- import { AddressLookupTableAccount } from '@solana/web3.js';
1
+ import { TransactionInstruction, AddressLookupTableAccount } from '@solana/web3.js';
4
2
  import { Program } from '@coral-xyz/anchor';
3
+ import { RpcOptions } from '../types';
5
4
  import { TriadProtocol } from '../types/triad_protocol';
6
5
  declare const sendVersionedTransaction: (program: Program<TriadProtocol>, ixs: TransactionInstruction[], options?: RpcOptions, addressLookupTableAccounts?: AddressLookupTableAccount[]) => Promise<string>;
7
6
  export default sendVersionedTransaction;
@@ -27,12 +27,11 @@ const sendVersionedTransaction = (program, ixs, options, addressLookupTableAccou
27
27
  }));
28
28
  }
29
29
  const { blockhash } = yield program.provider.connection.getLatestBlockhash();
30
- const tx = new web3_js_1.VersionedTransaction(new web3_js_1.TransactionMessage({
30
+ return program.provider.sendAndConfirm(new web3_js_1.VersionedTransaction(new web3_js_1.TransactionMessage({
31
31
  instructions: ixs,
32
32
  recentBlockhash: blockhash,
33
33
  payerKey: program.provider.publicKey
34
- }).compileToV0Message(addressLookupTableAccounts));
35
- return program.provider.sendAndConfirm(tx, [], {
34
+ }).compileToV0Message(addressLookupTableAccounts)), [], {
36
35
  skipPreflight: options === null || options === void 0 ? void 0 : options.skipPreflight,
37
36
  commitment: 'confirmed'
38
37
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "2.3.4-beta",
3
+ "version": "2.3.6-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
package/dist/trade.d.ts DELETED
@@ -1,379 +0,0 @@
1
- import { Program } from '@coral-xyz/anchor';
2
- import { TriadProtocol } from './types/triad_protocol';
3
- import { PublicKey, TransactionInstruction } from '@solana/web3.js';
4
- import { CreateMarketArgs, OpenOrderArgs, UserTrade, CreateCustomerArgs, Order, MarketBidOrderArgs, CancelBidOrderArgs, CancelAskOrderArgs, PlaceBidOrderArgs, PlaceAskOrderArgs, CreatePoolArgs } from './types/trade';
5
- import { RpcOptions } from './types';
6
- import BN from 'bn.js';
7
- export default class Trade {
8
- private program;
9
- decimals: number;
10
- constructor(program: Program<TriadProtocol>);
11
- /**
12
- * Get All Pools
13
- *
14
- */
15
- getAllPools(): Promise<import("./types/trade").Pool[]>;
16
- /**
17
- * Get All Markets
18
- *
19
- */
20
- getAllMarkets(): Promise<import("./types/trade").Market[]>;
21
- /**
22
- * Get My User Trades from a user authority
23
- * @param user - User PublicKey
24
- *
25
- */
26
- getMyUserTrades(user: PublicKey): Promise<UserTrade[]>;
27
- /**
28
- * Get User Orders
29
- * @param user - User PublicKey
30
- *
31
- */
32
- getUserOrders(user: PublicKey): Promise<Order[]>;
33
- /**
34
- * Get Pool By ID
35
- * @param poolId - The ID of the pool
36
- *
37
- */
38
- getPoolById(poolId: number): Promise<import("./types/trade").Pool>;
39
- /**
40
- * Get Market By ID
41
- * @param marketId - The ID of the market
42
- *
43
- */
44
- getMarketById(marketId: number): Promise<import("./types/trade").Market>;
45
- /**
46
- * Get Market By Address
47
- * @param address - The address of the market
48
- *
49
- */
50
- getMarketByAddress(address: PublicKey): Promise<import("./types/trade").Market>;
51
- /**
52
- * Get User Trade
53
- * @param user - User PublicKey
54
- * @param userNonce - The nonce of the user
55
- *
56
- */
57
- getUserTrade(user: PublicKey, userNonce?: number): Promise<{
58
- bump: number;
59
- authority: PublicKey;
60
- totalDeposits: BN;
61
- totalWithdraws: BN;
62
- padding1: number[];
63
- orders: {
64
- ts: BN;
65
- orderId: BN;
66
- filledShares: BN;
67
- marketId: BN;
68
- orderStatus: ({
69
- open?: never;
70
- closed?: never;
71
- claimed?: never;
72
- liquidated?: never;
73
- waiting?: never;
74
- } & {
75
- init: Record<string, never>;
76
- }) | ({
77
- init?: never;
78
- closed?: never;
79
- claimed?: never;
80
- liquidated?: never;
81
- waiting?: never;
82
- } & {
83
- open: Record<string, never>;
84
- }) | ({
85
- init?: never;
86
- open?: never;
87
- claimed?: never;
88
- liquidated?: never;
89
- waiting?: never;
90
- } & {
91
- closed: Record<string, never>;
92
- }) | ({
93
- init?: never;
94
- open?: never;
95
- closed?: never;
96
- liquidated?: never;
97
- waiting?: never;
98
- } & {
99
- claimed: Record<string, never>;
100
- }) | ({
101
- init?: never;
102
- open?: never;
103
- closed?: never;
104
- claimed?: never;
105
- waiting?: never;
106
- } & {
107
- liquidated: Record<string, never>;
108
- }) | ({
109
- init?: never;
110
- open?: never;
111
- closed?: never;
112
- claimed?: never;
113
- liquidated?: never;
114
- } & {
115
- waiting: Record<string, never>;
116
- });
117
- price: BN;
118
- padding1: number[];
119
- totalShares: BN;
120
- orderType: ({
121
- limit?: never;
122
- } & {
123
- market: Record<string, never>;
124
- }) | ({
125
- market?: never;
126
- } & {
127
- limit: Record<string, never>;
128
- });
129
- orderDirection: ({
130
- flop?: never;
131
- } & {
132
- hype: Record<string, never>;
133
- }) | ({
134
- hype?: never;
135
- } & {
136
- flop: Record<string, never>;
137
- });
138
- userNonce: number;
139
- orderSide: ({
140
- ask?: never;
141
- } & {
142
- bid: Record<string, never>;
143
- }) | ({
144
- bid?: never;
145
- } & {
146
- ask: Record<string, never>;
147
- });
148
- linkedOrderId: BN;
149
- createdAt: BN;
150
- linkedBidOrderId: BN;
151
- padding: number[];
152
- }[];
153
- nonce: number;
154
- isSubUser: boolean;
155
- poseidon: number;
156
- padding: number[];
157
- }>;
158
- /**
159
- * Create Market
160
- * @param args.marketId - new markert id - length + 1
161
- * @param args.startTime - start time
162
- * @param args.endTime - end time
163
- * @param args.question - question (max 80 characters)
164
- * @param args.liquidityAtStart - liquidity at start
165
- * @param args.payoutFee - payout fee (to add affiliate system)
166
- * @param args.currentMarketId - if fast market, we need check the pool parameters
167
- *
168
- * @param options - RPC options
169
- *
170
- */
171
- createMarket({ marketId, startTime, endTime, question, feeBps, customer, payoutFee, mint, poolId }: CreateMarketArgs, options?: RpcOptions): Promise<string>;
172
- /**
173
- * Create Pool
174
- * @param poolId - The ID of the pool
175
- * @param question - The question of the pool
176
- * @param markets - The markets of the pool
177
- *
178
- * @param options - RPC options
179
- */
180
- createPool({ poolId, question, markets, mint, customer, startTime, endTime, feeBps, payoutFee, isFast }: CreatePoolArgs, options?: RpcOptions): Promise<string>;
181
- /**
182
- * Open Order
183
- * @param args.marketId - The ID of the Market
184
- * @param args.amount - The amount of the Order
185
- * @param args.direction - The direction of the Order
186
- * @param args.mint - The mint of the Order
187
- * @param args.token - The token to use for the Order
188
- *
189
- * @param options - RPC options
190
- *
191
- */
192
- openOrder({ marketId, amount, direction, mint, token }: OpenOrderArgs, options?: RpcOptions): Promise<string>;
193
- /**
194
- * Close Order
195
- * @param args.marketId - The ID of the Market
196
- * @param args.orderId - The ID of the Order
197
- * @param args.userNonce - The nonce of the user
198
- *
199
- * @param options - RPC options
200
- *
201
- */
202
- closeOrder({ marketId, orderId, userNonce }: {
203
- marketId: number;
204
- orderId: number;
205
- userNonce: number;
206
- }, options?: RpcOptions): Promise<string>;
207
- /**
208
- * Resolve Market
209
- * @param args.marketId - The ID of the Market
210
- * @param args.winningDirection - The Winning Direction of the Market
211
- *
212
- * @param options - RPC options
213
- *
214
- */
215
- resolveMarket({ marketId, poolId, winningDirection }: {
216
- marketId: number;
217
- poolId?: number;
218
- winningDirection: {
219
- hype: {};
220
- } | {
221
- flop: {};
222
- } | {
223
- none: {};
224
- } | {
225
- draw: {};
226
- };
227
- }, options?: RpcOptions): Promise<string>;
228
- /**
229
- * Collect Remaining Liquidity
230
- * @param marketId - The ID of the market
231
- *
232
- * @param options - RPC options
233
- *
234
- */
235
- collectRemainingLiquidity(marketId: number, options?: RpcOptions): Promise<string>;
236
- /**
237
- * Payout Order
238
- * @param args.marketId - The ID of the Market
239
- * @param args.orderId - The ID of the Order to Payout
240
- * @param args.userNonce - The nonce of the user
241
- *
242
- * @param options - RPC options
243
- *
244
- */
245
- payoutOrder(orders: {
246
- marketId: number;
247
- orderId: number;
248
- userNonce: number;
249
- mint: PublicKey;
250
- }[], options?: RpcOptions): Promise<string>;
251
- /**
252
- * Allow Market to Payout
253
- * @param marketId - The ID of the market
254
- *
255
- * @param options - RPC options
256
- *
257
- */
258
- allowMarketToPayout({ marketId, poolId }: {
259
- marketId: number;
260
- poolId?: number;
261
- }, options?: RpcOptions): Promise<string>;
262
- /**
263
- * Create Sub User Trade
264
- * @param user - User PublicKey the main user
265
- *
266
- * @param options - RPC options
267
- *
268
- */
269
- createSubUserTrade(user: PublicKey, options?: RpcOptions): Promise<string>;
270
- /**
271
- * Update Market
272
- * @param marketId - The ID of the market
273
- * @param marketEnd - The end time of the market
274
- *
275
- * @param options - RPC options
276
- *
277
- */
278
- updateMarket(marketId: number, marketEnd: number, options?: RpcOptions): Promise<string>;
279
- /**
280
- * Create Customer
281
- * @param args.id - The ID of the customer
282
- * @param args.name - The name of the customer
283
- * @param args.authority - The authority of the customer
284
- *
285
- * @param options - RPC options
286
- *
287
- */
288
- createCustomer({ id, name, authority, feeRecipient }: CreateCustomerArgs, options?: RpcOptions): Promise<string>;
289
- /**
290
- * Get User Trade Nonce With Slots
291
- * @param userTrades - User Trades
292
- *
293
- */
294
- getUserTradeNonceWithSlots(userTrades: UserTrade[]): PublicKey;
295
- getUserTradeIxs(): Promise<{
296
- userTradePDA: PublicKey;
297
- ixs: TransactionInstruction[];
298
- nonce: number;
299
- } | {
300
- userTradePDA: PublicKey;
301
- ixs: TransactionInstruction[];
302
- nonce?: undefined;
303
- }>;
304
- /**
305
- * Place Bid Order
306
- * @param args.marketId - The ID of the Market
307
- * @param args.amount - The amount of the Order
308
- * @param args.direction - The direction of the Order
309
- * @param args.mint - The mint of the Order
310
- * @param args.price - The price of the Order
311
- *
312
- * @param options - RPC options
313
- */
314
- placeBidOrder({ marketId, amount, direction, mint, price }: PlaceBidOrderArgs, options?: RpcOptions): Promise<string>;
315
- /**
316
- * Place Ask Order
317
- * @param args.marketId - The ID of the Market
318
- * @param args.amount - The amount of the Order
319
- * @param args.direction - The direction of the Order
320
- * @param args.price - The price of the Order
321
- * @param args.bidOrderId - The ID of the Bid Order
322
- * @param args.bidNonce - The nonce of the Bid Order
323
- *
324
- * @param options - RPC options
325
- *
326
- */
327
- placeAskOrder({ marketId, orders, direction }: PlaceAskOrderArgs, options?: RpcOptions): Promise<string>;
328
- /**
329
- * Cancel Bid Order
330
- * @param args.marketId - The ID of the Market
331
- * @param args.orderId - The ID of the Order
332
- * @param args.userNonce - The nonce of the user
333
- *
334
- * @param options - RPC options
335
- */
336
- cancelBidOrder({ marketId, orderId, userNonce, mint }: CancelBidOrderArgs, options?: RpcOptions): Promise<string>;
337
- /**
338
- * Cancel Ask Order
339
- * @param args.marketId - The ID of the Market
340
- * @param args.orderId - The ID of the Order
341
- * @param args.userNonce - The nonce of the user
342
- * @param args.userNonceBidOrder - The nonce of the bid user
343
- *
344
- * @param options - RPC options
345
- */
346
- cancelAskOrder({ marketId, orderId, userNonce, userNonceBidOrder }: CancelAskOrderArgs, options?: RpcOptions): Promise<string>;
347
- /**
348
- * Market Bid Order
349
- * @param args.marketId - The ID of the Market
350
- * @param args.amount - The amount of the Order
351
- * @param args.direction - The direction of the Order
352
- * @param args.mint - The mint of the Order
353
- *
354
- * @param options - RPC options
355
- */
356
- marketBidOrder({ marketId, amount, direction, mint, feeBps }: MarketBidOrderArgs, options?: RpcOptions): Promise<string>;
357
- /**
358
- * Get Orders By Market ID
359
- * @param marketId - The ID of the market
360
- *
361
- */
362
- getOrderBook(marketId: number): Promise<{
363
- hype: {
364
- bid: Order[];
365
- ask: Order[];
366
- };
367
- flop: {
368
- bid: Order[];
369
- ask: Order[];
370
- };
371
- }>;
372
- /**
373
- * Collect Market Fee
374
- * @param marketId - The ID of the market
375
- *
376
- * @param options - RPC options
377
- */
378
- collectMarketFee(marketId: number, options?: RpcOptions): Promise<string>;
379
- }