@triadxyz/triad-protocol 4.2.1 → 4.2.3

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.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Connection, PublicKey } from '@solana/web3.js';
1
+ import { Connection } from '@solana/web3.js';
2
2
  import { AnchorProvider, Program, Wallet } from '@coral-xyz/anchor';
3
3
  import { TriadProtocol as TriadProtocolIDL } from './types/triad_protocol';
4
4
  import { RpcOptions } from './types';
@@ -31,26 +31,6 @@ export default class TriadProtocol {
31
31
  market: Market;
32
32
  constructor(connection: Connection, wallet: Wallet, rpcOptions: RpcOptions);
33
33
  getPriorityFee(): Promise<void>;
34
- /**
35
- * Get User Orders
36
- * @param wallet - User wallet PublicKey
37
- */
38
- getUserOrders(wallet: PublicKey): Promise<import("./types").Order[]>;
39
- /**
40
- * Get User Orders By Market ID
41
- * @param wallet - User wallet PublicKey
42
- * @param marketId - The ID of the market
43
- */
44
- getUserOrdersByMarketId(wallet: PublicKey, marketId: number): Promise<import("./types").Order[]>;
45
- /**
46
- * Get all User Book Orders
47
- * @param wallet - User wallet PublicKey
48
- */
49
- getUserBookOrders(wallet: PublicKey): Promise<import("./types").BookOrder[]>;
50
- /**
51
- * Get User Book Orders By Market ID
52
- */
53
- getUserBookOrdersByMarketId(wallet: PublicKey, marketId: number): Promise<import("./types").BookOrder[]>;
54
34
  /**
55
35
  * Burn Triad
56
36
  * @param amount - Amount to burn
package/dist/index.js CHANGED
@@ -29,9 +29,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
29
29
  const anchor_1 = require("@coral-xyz/anchor");
30
30
  const bn_js_1 = __importDefault(require("bn.js"));
31
31
  const idl_triad_protocol_json_1 = __importDefault(require("./types/idl_triad_protocol.json"));
32
- const constants_1 = require("./utils/constants");
33
- const helpers_1 = require("./utils/helpers");
34
- const pda_1 = require("./utils/pda");
35
32
  const sendVersionedTransaction_1 = __importDefault(require("./utils/sendVersionedTransaction"));
36
33
  const stake_1 = __importDefault(require("./stake"));
37
34
  const poseidon_1 = __importDefault(require("./poseidon"));
@@ -77,63 +74,6 @@ class TriadProtocol {
77
74
  this.rpcOptions.microLamports = yield (0, getPriorityFee_1.default)();
78
75
  });
79
76
  }
80
- /**
81
- * Get User Orders
82
- * @param wallet - User wallet PublicKey
83
- */
84
- getUserOrders(wallet) {
85
- return __awaiter(this, void 0, void 0, function* () {
86
- const orders = yield this.program.account.orderV2.all([
87
- {
88
- memcmp: {
89
- offset: 8,
90
- bytes: wallet.toBase58()
91
- }
92
- }
93
- ]);
94
- return orders.map(({ account, publicKey }) => (0, helpers_1.formatOrder)(account, publicKey));
95
- });
96
- }
97
- /**
98
- * Get User Orders By Market ID
99
- * @param wallet - User wallet PublicKey
100
- * @param marketId - The ID of the market
101
- */
102
- getUserOrdersByMarketId(wallet, marketId) {
103
- return __awaiter(this, void 0, void 0, function* () {
104
- const orders = yield this.getUserOrders(wallet);
105
- return orders.filter((order) => order.marketId === marketId.toString());
106
- });
107
- }
108
- /**
109
- * Get all User Book Orders
110
- * @param wallet - User wallet PublicKey
111
- */
112
- getUserBookOrders(wallet) {
113
- return __awaiter(this, void 0, void 0, function* () {
114
- const orderbooks = yield this.program.account.orderBook.all();
115
- const bookOrders = orderbooks.map((orderbook) => {
116
- return [...orderbook.account.hypeOrders, ...orderbook.account.flopOrders]
117
- .map((order) => (0, helpers_1.formatBookOrder)(order, orderbook.account.marketId.toNumber()))
118
- .filter((order) => order.authority === wallet.toBase58() &&
119
- order.linkedBookOrderId === constants_1.BOOK_ORDER_NULL.toString());
120
- });
121
- return bookOrders.flat();
122
- });
123
- }
124
- /**
125
- * Get User Book Orders By Market ID
126
- */
127
- getUserBookOrdersByMarketId(wallet, marketId) {
128
- return __awaiter(this, void 0, void 0, function* () {
129
- const orderBook = yield this.program.account.orderBook.fetch((0, pda_1.getOrderBookPDA)(this.program.programId, marketId), this.provider.opts.commitment);
130
- const orders = [...orderBook.hypeOrders, ...orderBook.flopOrders];
131
- return orders
132
- .map((order) => (0, helpers_1.formatBookOrder)(order, marketId))
133
- .filter((order) => order.authority === wallet.toBase58() &&
134
- order.linkedBookOrderId === constants_1.BOOK_ORDER_NULL.toString());
135
- });
136
- }
137
77
  /**
138
78
  * Burn Triad
139
79
  * @param amount - Amount to burn
package/dist/market.d.ts CHANGED
@@ -10,7 +10,7 @@ export default class Market {
10
10
  * Get Orders By Market ID
11
11
  * @param marketId - The ID of the market
12
12
  */
13
- getOrdersByMarketId(marketId: number): Promise<import("./types").Order[]>;
13
+ getOrdersByMarketId(marketId: number): Promise<import("./types").PredictorOrder[]>;
14
14
  /**
15
15
  * Get All Pools
16
16
  */
package/dist/market.js CHANGED
@@ -32,7 +32,7 @@ class Market {
32
32
  getOrdersByMarketId(marketId) {
33
33
  return __awaiter(this, void 0, void 0, function* () {
34
34
  const marketIdBytes = new bn_js_1.default(marketId).toArray('le', 8);
35
- const orders = yield this.program.account.orderV2.all([
35
+ const orders = yield this.program.account.predictorOrder.all([
36
36
  {
37
37
  memcmp: {
38
38
  offset: 8 + 32,
@@ -40,7 +40,7 @@ class Market {
40
40
  }
41
41
  }
42
42
  ]);
43
- return orders.map(({ account, publicKey }) => (0, helpers_1.formatOrder)(account, publicKey));
43
+ return orders.map(({ account, publicKey }) => (0, helpers_1.formatPredictorOrder)(account, publicKey));
44
44
  });
45
45
  }
46
46
  /**
@@ -10,15 +10,39 @@ export default class Predictor {
10
10
  /**
11
11
  * Get predictor
12
12
  * @param authority - Authority public key
13
- * @param customerId - Customer ID (optional) defaults to 7 from Triadmarkets
13
+ * @param customerId - Customer ID
14
14
  */
15
- getPredictor(authority: PublicKey, customerId?: number): Promise<PredictorType>;
15
+ getPredictor(authority: PublicKey, customerId: number): Promise<PredictorType>;
16
+ /**
17
+ * Get User Orders
18
+ * @param wallet - User wallet PublicKey
19
+ */
20
+ getUserOrders(wallet: PublicKey, customerId: number): Promise<import("./types").PredictorOrder[]>;
21
+ /**
22
+ * Get User Orders By Market ID
23
+ * @param wallet - User wallet PublicKey
24
+ * @param marketId - The ID of the market
25
+ */
26
+ getUserOrdersByMarketId(wallet: PublicKey, marketId: number, customerId: number): Promise<import("./types").PredictorOrder[]>;
27
+ /**
28
+ * Get all User Book Orders
29
+ * @param wallet - User wallet PublicKey
30
+ * @param customerId - User Customer ID
31
+ */
32
+ getUserBookOrders(wallet: PublicKey, customerId: number): Promise<import("./types").BookOrder[]>;
33
+ /**
34
+ * Get User Book Orders By Market ID
35
+ * @param wallet - User wallet PublicKey
36
+ * @param marketId - The ID of the market
37
+ * @param customerId - User Customer ID
38
+ */
39
+ getUserBookOrdersByMarketId(wallet: PublicKey, marketId: number, customerId: number): Promise<import("./types").BookOrder[]>;
16
40
  /**
17
41
  * Deposit
18
42
  * @param args.authority - Authority of the deposit
19
43
  * @param args.amount - Amount to deposit
20
- * @param args.refer - Referral public key (optional) defaults to Triadmarkets public key
21
- * @param args.customerId - Customer ID (optional) defaults to 7 from Triadmarkets
44
+ * @param args.refer - Referral public key
45
+ * @param args.customerId - Customer ID
22
46
  */
23
47
  deposit({ authority, amount, refer, customerId }: DepositArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
24
48
  /**
@@ -32,7 +56,7 @@ export default class Predictor {
32
56
  * Collect Rewards
33
57
  * Claims accumulated TRIAD token rewards for the predictor.
34
58
  * @param args.authority - Authority of the predictor
35
- * @param args.customerId - Customer ID (optional) defaults to 7 from Triadmarkets
59
+ * @param args.customerId - Customer ID
36
60
  */
37
61
  collectRewards({ authority, customerId }: CollectRewardsArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
38
62
  }
package/dist/predictor.js CHANGED
@@ -12,12 +12,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- const web3_js_1 = require("@solana/web3.js");
16
15
  const bn_js_1 = __importDefault(require("bn.js"));
17
16
  const constants_1 = require("./utils/constants");
18
- const pda_1 = require("./utils/pda");
19
17
  const sendVersionedTransaction_1 = __importDefault(require("./utils/sendVersionedTransaction"));
20
18
  const helpers_1 = require("./utils/helpers");
19
+ const pda_1 = require("./utils/pda");
21
20
  class Predictor {
22
21
  constructor(program, rpcOptions) {
23
22
  this.program = program;
@@ -26,9 +25,9 @@ class Predictor {
26
25
  /**
27
26
  * Get predictor
28
27
  * @param authority - Authority public key
29
- * @param customerId - Customer ID (optional) defaults to 7 from Triadmarkets
28
+ * @param customerId - Customer ID
30
29
  */
31
- getPredictor(authority, customerId = 7) {
30
+ getPredictor(authority, customerId) {
32
31
  return __awaiter(this, void 0, void 0, function* () {
33
32
  const predictorPDA = (0, pda_1.getPredictorPDA)(this.program.programId, authority, customerId);
34
33
  try {
@@ -48,14 +47,78 @@ class Predictor {
48
47
  }
49
48
  });
50
49
  }
50
+ /**
51
+ * Get User Orders
52
+ * @param wallet - User wallet PublicKey
53
+ */
54
+ getUserOrders(wallet, customerId) {
55
+ return __awaiter(this, void 0, void 0, function* () {
56
+ const predictorPDA = (0, pda_1.getPredictorPDA)(this.program.programId, wallet, customerId);
57
+ const orders = yield this.program.account.predictorOrder.all([
58
+ {
59
+ memcmp: {
60
+ offset: 8,
61
+ bytes: predictorPDA.toBase58()
62
+ }
63
+ }
64
+ ]);
65
+ return orders.map(({ account, publicKey }) => (0, helpers_1.formatPredictorOrder)(account, publicKey));
66
+ });
67
+ }
68
+ /**
69
+ * Get User Orders By Market ID
70
+ * @param wallet - User wallet PublicKey
71
+ * @param marketId - The ID of the market
72
+ */
73
+ getUserOrdersByMarketId(wallet, marketId, customerId) {
74
+ return __awaiter(this, void 0, void 0, function* () {
75
+ const orders = yield this.getUserOrders(wallet, customerId);
76
+ return orders.filter((order) => order.marketId === marketId.toString());
77
+ });
78
+ }
79
+ /**
80
+ * Get all User Book Orders
81
+ * @param wallet - User wallet PublicKey
82
+ * @param customerId - User Customer ID
83
+ */
84
+ getUserBookOrders(wallet, customerId) {
85
+ return __awaiter(this, void 0, void 0, function* () {
86
+ const orderbooks = yield this.program.account.orderBook.all();
87
+ const predictorPDA = (0, pda_1.getPredictorPDA)(this.program.programId, wallet, customerId);
88
+ const bookOrders = orderbooks.map((orderbook) => {
89
+ return [...orderbook.account.hypeOrders, ...orderbook.account.flopOrders]
90
+ .map((order) => (0, helpers_1.formatBookOrder)(order, orderbook.account.marketId.toNumber()))
91
+ .filter((order) => order.authority === predictorPDA.toBase58() &&
92
+ order.linkedBookOrderId === constants_1.BOOK_ORDER_NULL.toString());
93
+ });
94
+ return bookOrders.flat();
95
+ });
96
+ }
97
+ /**
98
+ * Get User Book Orders By Market ID
99
+ * @param wallet - User wallet PublicKey
100
+ * @param marketId - The ID of the market
101
+ * @param customerId - User Customer ID
102
+ */
103
+ getUserBookOrdersByMarketId(wallet, marketId, customerId) {
104
+ return __awaiter(this, void 0, void 0, function* () {
105
+ const orderBook = yield this.program.account.orderBook.fetch((0, pda_1.getOrderBookPDA)(this.program.programId, marketId), this.rpcOptions.commitment);
106
+ const orders = [...orderBook.hypeOrders, ...orderBook.flopOrders];
107
+ const predictorPDA = (0, pda_1.getPredictorPDA)(this.program.programId, wallet, customerId);
108
+ return orders
109
+ .map((order) => (0, helpers_1.formatBookOrder)(order, marketId))
110
+ .filter((order) => order.authority === predictorPDA.toBase58() &&
111
+ order.linkedBookOrderId === constants_1.BOOK_ORDER_NULL.toString());
112
+ });
113
+ }
51
114
  /**
52
115
  * Deposit
53
116
  * @param args.authority - Authority of the deposit
54
117
  * @param args.amount - Amount to deposit
55
- * @param args.refer - Referral public key (optional) defaults to Triadmarkets public key
56
- * @param args.customerId - Customer ID (optional) defaults to 7 from Triadmarkets
118
+ * @param args.refer - Referral public key
119
+ * @param args.customerId - Customer ID
57
120
  */
58
- deposit({ authority, amount, refer = new web3_js_1.PublicKey('DqL77dzdTruyY9qssbU1aQNeDDywxL587k9FquxVv6iX'), customerId = 7 }) {
121
+ deposit({ authority, amount, refer, customerId }) {
59
122
  return __awaiter(this, void 0, void 0, function* () {
60
123
  const ixs = [];
61
124
  const predictorPDA = (0, pda_1.getPredictorPDA)(this.program.programId, authority, customerId);
@@ -90,7 +153,7 @@ class Predictor {
90
153
  * @param args.amount - Amount to deposit
91
154
  * @param args.customerId - Customer ID (optional) defaults to 7 from Triadmarkets
92
155
  */
93
- withdraw({ authority, amount, customerId = 7 }) {
156
+ withdraw({ authority, amount, customerId }) {
94
157
  return __awaiter(this, void 0, void 0, function* () {
95
158
  const predictorPDA = (0, pda_1.getPredictorPDA)(this.program.programId, authority, customerId);
96
159
  const ixs = [
@@ -109,9 +172,9 @@ class Predictor {
109
172
  * Collect Rewards
110
173
  * Claims accumulated TRIAD token rewards for the predictor.
111
174
  * @param args.authority - Authority of the predictor
112
- * @param args.customerId - Customer ID (optional) defaults to 7 from Triadmarkets
175
+ * @param args.customerId - Customer ID
113
176
  */
114
- collectRewards({ authority, customerId = 7 }) {
177
+ collectRewards({ authority, customerId }) {
115
178
  return __awaiter(this, void 0, void 0, function* () {
116
179
  const predictorPDA = (0, pda_1.getPredictorPDA)(this.program.programId, authority, customerId);
117
180
  const ixs = [
package/dist/trade.js CHANGED
@@ -67,7 +67,7 @@ class Trade {
67
67
  * @param args.orders.price - The price of the Order
68
68
  * @param args.orders.orderDirection - The direction of the Order
69
69
  */
70
- placeBidOrder({ orders, customerId = 7 }) {
70
+ placeBidOrder({ orders, customerId }) {
71
71
  return __awaiter(this, void 0, void 0, function* () {
72
72
  const ixs = [];
73
73
  const predictorPDA = (0, pda_1.getPredictorPDA)(this.program.programId, this.program.provider.publicKey, customerId);
@@ -100,7 +100,7 @@ class Trade {
100
100
  * @param args.orders.marketId - The Id from the market
101
101
  * @param args.orders.orderDirection - The direction of the Order
102
102
  */
103
- placeAskOrder({ orders, customerId = 7 }) {
103
+ placeAskOrder({ orders, customerId }) {
104
104
  return __awaiter(this, void 0, void 0, function* () {
105
105
  const ixs = [];
106
106
  const predictorPDA = (0, pda_1.getPredictorPDA)(this.program.programId, this.program.provider.publicKey, customerId);
@@ -129,7 +129,7 @@ class Trade {
129
129
  * @param args.orders.marketId - The ID of the Market
130
130
  * @param args.orders.orderDirection - The direction of the Order
131
131
  */
132
- cancelBidOrder({ orders, customerId = 7 }) {
132
+ cancelBidOrder({ orders, customerId }) {
133
133
  return __awaiter(this, void 0, void 0, function* () {
134
134
  const ixs = [];
135
135
  for (const order of orders) {
@@ -157,7 +157,7 @@ class Trade {
157
157
  * @param args.orders.bookOrderId - The ID of the Book Order
158
158
  * @param args.orders.orderDirection - The direction of the Order
159
159
  */
160
- cancelAskOrder({ orders, customerId = 7 }) {
160
+ cancelAskOrder({ orders, customerId }) {
161
161
  return __awaiter(this, void 0, void 0, function* () {
162
162
  const ixs = [];
163
163
  const predictorPDA = (0, pda_1.getPredictorPDA)(this.program.programId, this.program.provider.publicKey, customerId);
@@ -872,6 +872,22 @@
872
872
  "writable": true,
873
873
  "signer": true
874
874
  },
875
+ {
876
+ "name": "customer",
877
+ "writable": true,
878
+ "pda": {
879
+ "seeds": [
880
+ {
881
+ "kind": "const",
882
+ "value": [99, 117, 115, 116, 111, 109, 101, 114]
883
+ },
884
+ {
885
+ "kind": "arg",
886
+ "path": "args.customer_id"
887
+ }
888
+ ]
889
+ }
890
+ },
875
891
  {
876
892
  "name": "predictor",
877
893
  "writable": true,
@@ -2958,6 +2974,10 @@
2958
2974
  "name": "predictor",
2959
2975
  "type": "pubkey"
2960
2976
  },
2977
+ {
2978
+ "name": "customer_id",
2979
+ "type": "u16"
2980
+ },
2961
2981
  {
2962
2982
  "name": "amount",
2963
2983
  "type": "u64"
@@ -4216,6 +4236,10 @@
4216
4236
  "name": "predictor",
4217
4237
  "type": "pubkey"
4218
4238
  },
4239
+ {
4240
+ "name": "customer_id",
4241
+ "type": "u16"
4242
+ },
4219
4243
  {
4220
4244
  "name": "amount",
4221
4245
  "type": "u64"
@@ -46,16 +46,14 @@ export type Market = {
46
46
  feeRecipient: string;
47
47
  pythPrice: string;
48
48
  };
49
- export type Order = {
49
+ export type PredictorOrder = {
50
50
  address: string;
51
51
  marketId: string;
52
52
  orderStatus: OrderStatus;
53
53
  price: string;
54
54
  shares: string;
55
- orderType: OrderType;
56
55
  orderDirection: OrderDirection;
57
- orderSide: OrderSide;
58
- authority: string;
56
+ predictor: string;
59
57
  };
60
58
  export type BookOrder = {
61
59
  id: string;
@@ -11,15 +11,15 @@ export type Predictor = {
11
11
  export type DepositArgs = {
12
12
  authority: PublicKey;
13
13
  amount: number;
14
- refer?: PublicKey;
15
- customerId?: number;
14
+ refer: PublicKey;
15
+ customerId: number;
16
16
  };
17
17
  export type WithdrawArgs = {
18
18
  authority: PublicKey;
19
19
  amount: number;
20
- customerId?: number;
20
+ customerId: number;
21
21
  };
22
22
  export type CollectRewardsArgs = {
23
23
  authority: PublicKey;
24
- customerId?: number;
24
+ customerId: number;
25
25
  };
@@ -1133,6 +1133,22 @@ export type TriadProtocol = {
1133
1133
  writable: true;
1134
1134
  signer: true;
1135
1135
  },
1136
+ {
1137
+ name: 'customer';
1138
+ writable: true;
1139
+ pda: {
1140
+ seeds: [
1141
+ {
1142
+ kind: 'const';
1143
+ value: [99, 117, 115, 116, 111, 109, 101, 114];
1144
+ },
1145
+ {
1146
+ kind: 'arg';
1147
+ path: 'args.customer_id';
1148
+ }
1149
+ ];
1150
+ };
1151
+ },
1136
1152
  {
1137
1153
  name: 'predictor';
1138
1154
  writable: true;
@@ -3582,6 +3598,10 @@ export type TriadProtocol = {
3582
3598
  name: 'predictor';
3583
3599
  type: 'pubkey';
3584
3600
  },
3601
+ {
3602
+ name: 'customerId';
3603
+ type: 'u16';
3604
+ },
3585
3605
  {
3586
3606
  name: 'amount';
3587
3607
  type: 'u64';
@@ -4840,6 +4860,10 @@ export type TriadProtocol = {
4840
4860
  name: 'predictor';
4841
4861
  type: 'pubkey';
4842
4862
  },
4863
+ {
4864
+ name: 'customerId';
4865
+ type: 'u16';
4866
+ },
4843
4867
  {
4844
4868
  name: 'amount';
4845
4869
  type: 'u64';
@@ -1,6 +1,6 @@
1
1
  import { PublicKey } from '@solana/web3.js';
2
2
  import { IdlAccounts, Program } from '@coral-xyz/anchor';
3
- import { Market, Order, OrderDirection, OrderSide, OrderStatus, OrderType, OrderDirectionEncoded, OrderTypeEncoded, OrderSideEncoded, OrderStatusEncoded, Pool, BookOrder } from '../types';
3
+ import { Market, PredictorOrder, OrderDirection, OrderSide, OrderStatus, OrderType, OrderDirectionEncoded, OrderTypeEncoded, OrderSideEncoded, OrderStatusEncoded, Pool, BookOrder } from '../types';
4
4
  import { Stake, StakeVault, Unstake } from '../types/stake';
5
5
  import { Customer } from '../types/customer';
6
6
  import { TriadProtocol } from '../types/triad_protocol';
@@ -12,7 +12,7 @@ export declare const formatStake: (stake: IdlAccounts<TriadProtocol>['stakeV3'],
12
12
  export declare const formatUnstake: (unstake: IdlAccounts<TriadProtocol>['unstake'], address: PublicKey) => Unstake;
13
13
  export declare const formatPool: (account: IdlAccounts<TriadProtocol>['pool'], address: PublicKey) => Pool;
14
14
  export declare const formatMarket: (account: IdlAccounts<TriadProtocol>['marketV2'], address: PublicKey) => Market;
15
- export declare const formatOrder: (order: IdlAccounts<TriadProtocol>['orderV2'], address: PublicKey) => Order;
15
+ export declare const formatPredictorOrder: (order: IdlAccounts<TriadProtocol>['predictorOrder'], address: PublicKey) => PredictorOrder;
16
16
  export declare const formatBookOrder: (order: IdlAccounts<TriadProtocol>['orderBook']['hypeOrders'][number] | IdlAccounts<TriadProtocol>['orderBook']['flopOrders'][number], marketId: number) => BookOrder;
17
17
  export declare const formatCustomer: (account: IdlAccounts<TriadProtocol>['customer'], publicKey: PublicKey) => Customer;
18
18
  export declare const calculateStakeRewards: (stake: Stake) => number;
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.getCustomerById = exports.getFeedIdFromHex = exports.getPriceFeedAccountForProgram = exports.formatPredictor = exports.getOppositeOrderDirectionEncoded = exports.getOppositeOrderDirection = exports.getOrderDirectionEncoded = exports.getOrderStatus = exports.getOrderSide = exports.getOrderType = exports.getOrderSideFromNumber = exports.getOrderDirectionFromNumber = exports.getOrderDirection = exports.getTokenProgram = exports.calculateStakeRewards = exports.formatCustomer = exports.formatBookOrder = exports.formatOrder = exports.formatMarket = exports.formatPool = exports.formatUnstake = exports.formatStake = exports.formatStakeVault = exports.decodeString = exports.encodeString = void 0;
12
+ exports.getCustomerById = exports.getFeedIdFromHex = exports.getPriceFeedAccountForProgram = exports.formatPredictor = exports.getOppositeOrderDirectionEncoded = exports.getOppositeOrderDirection = exports.getOrderDirectionEncoded = exports.getOrderStatus = exports.getOrderSide = exports.getOrderType = exports.getOrderSideFromNumber = exports.getOrderDirectionFromNumber = exports.getOrderDirection = exports.getTokenProgram = exports.calculateStakeRewards = exports.formatCustomer = exports.formatBookOrder = exports.formatPredictorOrder = exports.formatMarket = exports.formatPool = exports.formatUnstake = exports.formatStake = exports.formatStakeVault = exports.decodeString = exports.encodeString = void 0;
13
13
  const web3_js_1 = require("@solana/web3.js");
14
14
  const spl_token_1 = require("@solana/spl-token");
15
15
  const types_1 = require("../types");
@@ -116,20 +116,18 @@ const formatMarket = (account, address) => {
116
116
  };
117
117
  };
118
118
  exports.formatMarket = formatMarket;
119
- const formatOrder = (order, address) => {
119
+ const formatPredictorOrder = (order, address) => {
120
120
  return {
121
121
  address: address.toString(),
122
- authority: order.authority.toString(),
122
+ predictor: order.predictor.toString(),
123
123
  marketId: order.marketId.toString(),
124
124
  orderStatus: (0, exports.getOrderStatus)(order.orderStatus),
125
- orderType: (0, exports.getOrderType)(order.orderType),
126
125
  orderDirection: (0, exports.getOrderDirection)(order.orderDirection),
127
- orderSide: (0, exports.getOrderSide)(order.orderSide),
128
126
  price: order.price.toString(),
129
127
  shares: order.shares.toString()
130
128
  };
131
129
  };
132
- exports.formatOrder = formatOrder;
130
+ exports.formatPredictorOrder = formatPredictorOrder;
133
131
  const formatBookOrder = (order, marketId) => {
134
132
  return {
135
133
  id: order.id.toString(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "4.2.1",
3
+ "version": "4.2.3",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",