@triadxyz/triad-protocol 2.1.1-beta → 2.1.2-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.
package/dist/trade.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Program } from '@coral-xyz/anchor';
2
2
  import { TriadProtocol } from './types/triad_protocol';
3
3
  import { PublicKey, TransactionInstruction } from '@solana/web3.js';
4
- import { CreateMarketArgs, OpenOrderArgs, UserTrade, CreateCustomerArgs, Order, MarketBidOrderArgs, CancelBidOrderArgs, CancelAskOrderArgs, PlaceBidOrderArgs, PlaceAskOrderArgs } from './types/trade';
4
+ import { CreateMarketArgs, OpenOrderArgs, UserTrade, CreateCustomerArgs, Order, MarketBidOrderArgs, CancelBidOrderArgs, CancelAskOrderArgs, PlaceBidOrderArgs, PlaceAskOrderArgs, CreatePoolArgs } from './types/trade';
5
5
  import { RpcOptions } from './types';
6
6
  import BN from 'bn.js';
7
7
  export default class Trade {
@@ -48,7 +48,7 @@ export default class Trade {
48
48
  authority: PublicKey;
49
49
  totalDeposits: BN;
50
50
  totalWithdraws: BN;
51
- padding2: number[];
51
+ version: BN;
52
52
  orders: {
53
53
  ts: BN;
54
54
  orderId: BN;
@@ -157,6 +157,15 @@ export default class Trade {
157
157
  *
158
158
  */
159
159
  createMarket({ marketId, startTime, endTime, question, feeBps, customer, payoutFee, mint }: CreateMarketArgs, options?: RpcOptions): Promise<string>;
160
+ /**
161
+ * Create Pool
162
+ * @param poolId - The ID of the pool
163
+ * @param question - The question of the pool
164
+ * @param markets - The markets of the pool
165
+ *
166
+ * @param options - RPC options
167
+ */
168
+ createPool({ poolId, question, markets, mint, customer, startTime, endTime, feeBps, payoutFee }: CreatePoolArgs, options?: RpcOptions): Promise<string>;
160
169
  /**
161
170
  * Open Order
162
171
  * @param args.marketId - The ID of the Market
package/dist/trade.js CHANGED
@@ -134,9 +134,59 @@ class Trade {
134
134
  signer: this.program.provider.publicKey,
135
135
  mint,
136
136
  tokenProgram: (0, helpers_1.getTokenProgram)(mint),
137
- customer
137
+ customer,
138
+ pool: null
138
139
  }), options);
139
140
  }
141
+ /**
142
+ * Create Pool
143
+ * @param poolId - The ID of the pool
144
+ * @param question - The question of the pool
145
+ * @param markets - The markets of the pool
146
+ *
147
+ * @param options - RPC options
148
+ */
149
+ createPool({ poolId, question, markets, mint, customer, startTime, endTime, feeBps, payoutFee }, options) {
150
+ return __awaiter(this, void 0, void 0, function* () {
151
+ if (question.length > 80) {
152
+ throw new Error('Pool question must be less than 80 characters');
153
+ }
154
+ const ixs = [];
155
+ const poolPDA = (0, pda_1.getPoolPDA)(this.program.programId, poolId);
156
+ ixs.push(yield this.program.methods
157
+ .createPool({
158
+ poolId: new bn_js_1.default(poolId),
159
+ question: (0, helpers_1.encodeString)(question, 80)
160
+ })
161
+ .accounts({
162
+ signer: this.program.provider.publicKey
163
+ })
164
+ .instruction());
165
+ for (const market of markets) {
166
+ if (market.question.length > 80) {
167
+ throw new Error('Market question must be less than 80 characters');
168
+ }
169
+ ixs.push(yield this.program.methods
170
+ .createMarket({
171
+ marketId: new bn_js_1.default(market.marketId),
172
+ question: (0, helpers_1.encodeString)(market.question, 80),
173
+ marketStart: new bn_js_1.default(startTime),
174
+ marketEnd: new bn_js_1.default(endTime),
175
+ feeBps,
176
+ payoutFee
177
+ })
178
+ .accounts({
179
+ signer: this.program.provider.publicKey,
180
+ mint,
181
+ tokenProgram: (0, helpers_1.getTokenProgram)(mint),
182
+ pool: poolPDA,
183
+ customer
184
+ })
185
+ .instruction());
186
+ }
187
+ return (0, sendVersionedTransaction_1.default)(this.program, ixs, options);
188
+ });
189
+ }
140
190
  /**
141
191
  * Open Order
142
192
  * @param args.marketId - The ID of the Market
@@ -507,7 +557,7 @@ class Trade {
507
557
  return (0, sendMethod_1.default)(this.program.methods.cancelBidOrder(new bn_js_1.default(orderId)).accounts({
508
558
  signer: this.program.provider.publicKey,
509
559
  market: (0, pda_1.getMarketPDA)(this.program.programId, marketId),
510
- userTrade: userTradePDA,
560
+ bidUserTrade: userTradePDA,
511
561
  mint,
512
562
  tokenProgram: (0, helpers_1.getTokenProgram)(mint)
513
563
  }), options);
@@ -87,11 +87,11 @@
87
87
  "signer": true
88
88
  },
89
89
  {
90
- "name": "user_trade",
90
+ "name": "market",
91
91
  "writable": true
92
92
  },
93
93
  {
94
- "name": "market",
94
+ "name": "bid_user_trade",
95
95
  "writable": true
96
96
  },
97
97
  {
@@ -127,7 +127,7 @@
127
127
  }
128
128
  },
129
129
  {
130
- "name": "market_vault",
130
+ "name": "market_ata",
131
131
  "writable": true,
132
132
  "pda": {
133
133
  "seeds": [
@@ -560,6 +560,11 @@
560
560
  "writable": true,
561
561
  "optional": true
562
562
  },
563
+ {
564
+ "name": "pool",
565
+ "writable": true,
566
+ "optional": true
567
+ },
563
568
  {
564
569
  "name": "market",
565
570
  "writable": true,
@@ -631,6 +636,47 @@
631
636
  }
632
637
  ]
633
638
  },
639
+ {
640
+ "name": "create_pool",
641
+ "discriminator": [233, 146, 209, 142, 207, 104, 64, 188],
642
+ "accounts": [
643
+ {
644
+ "name": "signer",
645
+ "writable": true,
646
+ "signer": true
647
+ },
648
+ {
649
+ "name": "pool",
650
+ "writable": true,
651
+ "pda": {
652
+ "seeds": [
653
+ {
654
+ "kind": "const",
655
+ "value": [112, 111, 111, 108]
656
+ },
657
+ {
658
+ "kind": "arg",
659
+ "path": "args.pool_id"
660
+ }
661
+ ]
662
+ }
663
+ },
664
+ {
665
+ "name": "system_program",
666
+ "address": "11111111111111111111111111111111"
667
+ }
668
+ ],
669
+ "args": [
670
+ {
671
+ "name": "args",
672
+ "type": {
673
+ "defined": {
674
+ "name": "CreatePoolArgs"
675
+ }
676
+ }
677
+ }
678
+ ]
679
+ },
634
680
  {
635
681
  "name": "create_sub_user_trade",
636
682
  "discriminator": [77, 201, 111, 73, 47, 229, 244, 161],
@@ -1120,11 +1166,11 @@
1120
1166
  "writable": true
1121
1167
  },
1122
1168
  {
1123
- "name": "ask_user_trade",
1169
+ "name": "bid_user_trade",
1124
1170
  "writable": true
1125
1171
  },
1126
1172
  {
1127
- "name": "bid_user_trade",
1173
+ "name": "ask_user_trade",
1128
1174
  "writable": true
1129
1175
  },
1130
1176
  {
@@ -1796,6 +1842,10 @@
1796
1842
  "name": "Nft",
1797
1843
  "discriminator": [88, 10, 146, 176, 101, 11, 40, 217]
1798
1844
  },
1845
+ {
1846
+ "name": "Pool",
1847
+ "discriminator": [241, 154, 109, 4, 17, 177, 109, 188]
1848
+ },
1799
1849
  {
1800
1850
  "name": "StakeV2",
1801
1851
  "discriminator": [207, 98, 130, 13, 118, 181, 238, 47]
@@ -1818,6 +1868,10 @@
1818
1868
  "name": "OrderEvent",
1819
1869
  "discriminator": [209, 51, 146, 206, 88, 127, 112, 69]
1820
1870
  },
1871
+ {
1872
+ "name": "PoolEvent",
1873
+ "discriminator": [76, 227, 205, 183, 1, 218, 164, 244]
1874
+ },
1821
1875
  {
1822
1876
  "name": "PriceEvent",
1823
1877
  "discriminator": [31, 40, 141, 125, 132, 253, 225, 229]
@@ -1967,6 +2021,11 @@
1967
2021
  "code": 6027,
1968
2022
  "name": "LinkedBidOrderNotFound",
1969
2023
  "msg": "Linked bid order not found"
2024
+ },
2025
+ {
2026
+ "code": 6028,
2027
+ "name": "MarketAlreadyAggregated",
2028
+ "msg": "Market already aggregated"
1970
2029
  }
1971
2030
  ],
1972
2031
  "types": [
@@ -2140,6 +2199,26 @@
2140
2199
  ]
2141
2200
  }
2142
2201
  },
2202
+ {
2203
+ "name": "CreatePoolArgs",
2204
+ "type": {
2205
+ "kind": "struct",
2206
+ "fields": [
2207
+ {
2208
+ "name": "pool_id",
2209
+ "type": "u64"
2210
+ },
2211
+ {
2212
+ "name": "question",
2213
+ "type": {
2214
+ "option": {
2215
+ "array": ["u8", 80]
2216
+ }
2217
+ }
2218
+ }
2219
+ ]
2220
+ }
2221
+ },
2143
2222
  {
2144
2223
  "name": "Customer",
2145
2224
  "type": {
@@ -2293,10 +2372,6 @@
2293
2372
  "name": "update_ts",
2294
2373
  "type": "i64"
2295
2374
  },
2296
- {
2297
- "name": "opened_orders",
2298
- "type": "u64"
2299
- },
2300
2375
  {
2301
2376
  "name": "next_order_id",
2302
2377
  "type": "u64"
@@ -2358,6 +2433,10 @@
2358
2433
  {
2359
2434
  "name": "payout_fee",
2360
2435
  "type": "u16"
2436
+ },
2437
+ {
2438
+ "name": "pool_id",
2439
+ "type": "u64"
2361
2440
  }
2362
2441
  ]
2363
2442
  }
@@ -2416,8 +2495,10 @@
2416
2495
  "type": "i64"
2417
2496
  },
2418
2497
  {
2419
- "name": "opened_orders",
2420
- "type": "u64"
2498
+ "name": "padding_1",
2499
+ "type": {
2500
+ "array": ["u8", 8]
2501
+ }
2421
2502
  },
2422
2503
  {
2423
2504
  "name": "next_order_id",
@@ -2485,10 +2566,14 @@
2485
2566
  "name": "version",
2486
2567
  "type": "u64"
2487
2568
  },
2569
+ {
2570
+ "name": "pool_id",
2571
+ "type": "u64"
2572
+ },
2488
2573
  {
2489
2574
  "name": "padding",
2490
2575
  "type": {
2491
- "array": ["u8", 80]
2576
+ "array": ["u8", 72]
2492
2577
  }
2493
2578
  }
2494
2579
  ]
@@ -2815,6 +2900,66 @@
2815
2900
  ]
2816
2901
  }
2817
2902
  },
2903
+ {
2904
+ "name": "Pool",
2905
+ "type": {
2906
+ "kind": "struct",
2907
+ "fields": [
2908
+ {
2909
+ "name": "bump",
2910
+ "type": "u8"
2911
+ },
2912
+ {
2913
+ "name": "id",
2914
+ "type": "u64"
2915
+ },
2916
+ {
2917
+ "name": "question",
2918
+ "type": {
2919
+ "array": ["u8", 80]
2920
+ }
2921
+ },
2922
+ {
2923
+ "name": "authority",
2924
+ "type": "pubkey"
2925
+ },
2926
+ {
2927
+ "name": "padding",
2928
+ "type": {
2929
+ "array": ["u8", 64]
2930
+ }
2931
+ }
2932
+ ]
2933
+ }
2934
+ },
2935
+ {
2936
+ "name": "PoolEvent",
2937
+ "type": {
2938
+ "kind": "struct",
2939
+ "fields": [
2940
+ {
2941
+ "name": "pool_id",
2942
+ "type": "u64"
2943
+ },
2944
+ {
2945
+ "name": "question",
2946
+ "type": {
2947
+ "array": ["u8", 80]
2948
+ }
2949
+ },
2950
+ {
2951
+ "name": "authority",
2952
+ "type": "pubkey"
2953
+ },
2954
+ {
2955
+ "name": "markets",
2956
+ "type": {
2957
+ "array": ["u64", 60]
2958
+ }
2959
+ }
2960
+ ]
2961
+ }
2962
+ },
2818
2963
  {
2819
2964
  "name": "PriceEvent",
2820
2965
  "type": {
@@ -3108,10 +3253,8 @@
3108
3253
  "type": "u64"
3109
3254
  },
3110
3255
  {
3111
- "name": "padding_2",
3112
- "type": {
3113
- "array": ["u8", 8]
3114
- }
3256
+ "name": "version",
3257
+ "type": "u64"
3115
3258
  },
3116
3259
  {
3117
3260
  "name": "orders",
@@ -13,7 +13,6 @@ export type Market = {
13
13
  volume: string;
14
14
  mint: string;
15
15
  updateTs: string;
16
- openedOrders: string;
17
16
  nextOrderId: string;
18
17
  feeBps: number;
19
18
  isAllowedToPayout: boolean;
@@ -139,6 +138,20 @@ export type CreateMarketArgs = {
139
138
  payoutFee: number;
140
139
  mint: PublicKey;
141
140
  };
141
+ export type CreatePoolArgs = {
142
+ poolId: number;
143
+ question: string;
144
+ startTime: number;
145
+ endTime: number;
146
+ feeBps: number;
147
+ payoutFee: number;
148
+ mint: PublicKey;
149
+ customer: PublicKey | null;
150
+ markets: {
151
+ marketId: number;
152
+ question: string;
153
+ }[];
154
+ };
142
155
  export type CancelBidOrderArgs = {
143
156
  marketId: number;
144
157
  orderId: number;
@@ -93,11 +93,11 @@ export type TriadProtocol = {
93
93
  signer: true;
94
94
  },
95
95
  {
96
- name: 'userTrade';
96
+ name: 'market';
97
97
  writable: true;
98
98
  },
99
99
  {
100
- name: 'market';
100
+ name: 'bidUserTrade';
101
101
  writable: true;
102
102
  },
103
103
  {
@@ -162,7 +162,7 @@ export type TriadProtocol = {
162
162
  };
163
163
  },
164
164
  {
165
- name: 'marketVault';
165
+ name: 'marketAta';
166
166
  writable: true;
167
167
  pda: {
168
168
  seeds: [
@@ -810,6 +810,11 @@ export type TriadProtocol = {
810
810
  writable: true;
811
811
  optional: true;
812
812
  },
813
+ {
814
+ name: 'pool';
815
+ writable: true;
816
+ optional: true;
817
+ },
813
818
  {
814
819
  name: 'market';
815
820
  writable: true;
@@ -910,6 +915,47 @@ export type TriadProtocol = {
910
915
  }
911
916
  ];
912
917
  },
918
+ {
919
+ name: 'createPool';
920
+ discriminator: [233, 146, 209, 142, 207, 104, 64, 188];
921
+ accounts: [
922
+ {
923
+ name: 'signer';
924
+ writable: true;
925
+ signer: true;
926
+ },
927
+ {
928
+ name: 'pool';
929
+ writable: true;
930
+ pda: {
931
+ seeds: [
932
+ {
933
+ kind: 'const';
934
+ value: [112, 111, 111, 108];
935
+ },
936
+ {
937
+ kind: 'arg';
938
+ path: 'args.pool_id';
939
+ }
940
+ ];
941
+ };
942
+ },
943
+ {
944
+ name: 'systemProgram';
945
+ address: '11111111111111111111111111111111';
946
+ }
947
+ ];
948
+ args: [
949
+ {
950
+ name: 'args';
951
+ type: {
952
+ defined: {
953
+ name: 'createPoolArgs';
954
+ };
955
+ };
956
+ }
957
+ ];
958
+ },
913
959
  {
914
960
  name: 'createSubUserTrade';
915
961
  discriminator: [77, 201, 111, 73, 47, 229, 244, 161];
@@ -1573,11 +1619,11 @@ export type TriadProtocol = {
1573
1619
  writable: true;
1574
1620
  },
1575
1621
  {
1576
- name: 'askUserTrade';
1622
+ name: 'bidUserTrade';
1577
1623
  writable: true;
1578
1624
  },
1579
1625
  {
1580
- name: 'bidUserTrade';
1626
+ name: 'askUserTrade';
1581
1627
  writable: true;
1582
1628
  },
1583
1629
  {
@@ -2517,6 +2563,10 @@ export type TriadProtocol = {
2517
2563
  name: 'nft';
2518
2564
  discriminator: [88, 10, 146, 176, 101, 11, 40, 217];
2519
2565
  },
2566
+ {
2567
+ name: 'pool';
2568
+ discriminator: [241, 154, 109, 4, 17, 177, 109, 188];
2569
+ },
2520
2570
  {
2521
2571
  name: 'stakeV2';
2522
2572
  discriminator: [207, 98, 130, 13, 118, 181, 238, 47];
@@ -2539,6 +2589,10 @@ export type TriadProtocol = {
2539
2589
  name: 'orderEvent';
2540
2590
  discriminator: [209, 51, 146, 206, 88, 127, 112, 69];
2541
2591
  },
2592
+ {
2593
+ name: 'poolEvent';
2594
+ discriminator: [76, 227, 205, 183, 1, 218, 164, 244];
2595
+ },
2542
2596
  {
2543
2597
  name: 'priceEvent';
2544
2598
  discriminator: [31, 40, 141, 125, 132, 253, 225, 229];
@@ -2688,6 +2742,11 @@ export type TriadProtocol = {
2688
2742
  code: 6027;
2689
2743
  name: 'linkedBidOrderNotFound';
2690
2744
  msg: 'Linked bid order not found';
2745
+ },
2746
+ {
2747
+ code: 6028;
2748
+ name: 'marketAlreadyAggregated';
2749
+ msg: 'Market already aggregated';
2691
2750
  }
2692
2751
  ];
2693
2752
  types: [
@@ -2861,6 +2920,26 @@ export type TriadProtocol = {
2861
2920
  ];
2862
2921
  };
2863
2922
  },
2923
+ {
2924
+ name: 'createPoolArgs';
2925
+ type: {
2926
+ kind: 'struct';
2927
+ fields: [
2928
+ {
2929
+ name: 'poolId';
2930
+ type: 'u64';
2931
+ },
2932
+ {
2933
+ name: 'question';
2934
+ type: {
2935
+ option: {
2936
+ array: ['u8', 80];
2937
+ };
2938
+ };
2939
+ }
2940
+ ];
2941
+ };
2942
+ },
2864
2943
  {
2865
2944
  name: 'customer';
2866
2945
  type: {
@@ -3014,10 +3093,6 @@ export type TriadProtocol = {
3014
3093
  name: 'updateTs';
3015
3094
  type: 'i64';
3016
3095
  },
3017
- {
3018
- name: 'openedOrders';
3019
- type: 'u64';
3020
- },
3021
3096
  {
3022
3097
  name: 'nextOrderId';
3023
3098
  type: 'u64';
@@ -3079,6 +3154,10 @@ export type TriadProtocol = {
3079
3154
  {
3080
3155
  name: 'payoutFee';
3081
3156
  type: 'u16';
3157
+ },
3158
+ {
3159
+ name: 'poolId';
3160
+ type: 'u64';
3082
3161
  }
3083
3162
  ];
3084
3163
  };
@@ -3137,8 +3216,10 @@ export type TriadProtocol = {
3137
3216
  type: 'i64';
3138
3217
  },
3139
3218
  {
3140
- name: 'openedOrders';
3141
- type: 'u64';
3219
+ name: 'padding1';
3220
+ type: {
3221
+ array: ['u8', 8];
3222
+ };
3142
3223
  },
3143
3224
  {
3144
3225
  name: 'nextOrderId';
@@ -3206,10 +3287,14 @@ export type TriadProtocol = {
3206
3287
  name: 'version';
3207
3288
  type: 'u64';
3208
3289
  },
3290
+ {
3291
+ name: 'poolId';
3292
+ type: 'u64';
3293
+ },
3209
3294
  {
3210
3295
  name: 'padding';
3211
3296
  type: {
3212
- array: ['u8', 80];
3297
+ array: ['u8', 72];
3213
3298
  };
3214
3299
  }
3215
3300
  ];
@@ -3536,6 +3621,66 @@ export type TriadProtocol = {
3536
3621
  ];
3537
3622
  };
3538
3623
  },
3624
+ {
3625
+ name: 'pool';
3626
+ type: {
3627
+ kind: 'struct';
3628
+ fields: [
3629
+ {
3630
+ name: 'bump';
3631
+ type: 'u8';
3632
+ },
3633
+ {
3634
+ name: 'id';
3635
+ type: 'u64';
3636
+ },
3637
+ {
3638
+ name: 'question';
3639
+ type: {
3640
+ array: ['u8', 80];
3641
+ };
3642
+ },
3643
+ {
3644
+ name: 'authority';
3645
+ type: 'pubkey';
3646
+ },
3647
+ {
3648
+ name: 'padding';
3649
+ type: {
3650
+ array: ['u8', 64];
3651
+ };
3652
+ }
3653
+ ];
3654
+ };
3655
+ },
3656
+ {
3657
+ name: 'poolEvent';
3658
+ type: {
3659
+ kind: 'struct';
3660
+ fields: [
3661
+ {
3662
+ name: 'poolId';
3663
+ type: 'u64';
3664
+ },
3665
+ {
3666
+ name: 'question';
3667
+ type: {
3668
+ array: ['u8', 80];
3669
+ };
3670
+ },
3671
+ {
3672
+ name: 'authority';
3673
+ type: 'pubkey';
3674
+ },
3675
+ {
3676
+ name: 'markets';
3677
+ type: {
3678
+ array: ['u64', 60];
3679
+ };
3680
+ }
3681
+ ];
3682
+ };
3683
+ },
3539
3684
  {
3540
3685
  name: 'priceEvent';
3541
3686
  type: {
@@ -3829,10 +3974,8 @@ export type TriadProtocol = {
3829
3974
  type: 'u64';
3830
3975
  },
3831
3976
  {
3832
- name: 'padding2';
3833
- type: {
3834
- array: ['u8', 8];
3835
- };
3977
+ name: 'version';
3978
+ type: 'u64';
3836
3979
  },
3837
3980
  {
3838
3981
  name: 'orders';
@@ -67,7 +67,6 @@ const formatMarket = (account, address) => {
67
67
  volume: account.volume.toString(),
68
68
  mint: account.mint.toString(),
69
69
  updateTs: account.updateTs.toString(),
70
- openedOrders: account.openedOrders.toString(),
71
70
  nextOrderId: account.nextOrderId.toString(),
72
71
  feeBps: account.feeBps,
73
72
  isAllowedToPayout: account.isAllowedToPayout,
@@ -4,3 +4,4 @@ export declare const getMarketPDA: (programId: PublicKey, marketId: number) => P
4
4
  export declare const getCustomerPDA: (programId: PublicKey, customerId: number) => PublicKey;
5
5
  export declare const getUserTradePDA: (programId: PublicKey, wallet: PublicKey) => PublicKey;
6
6
  export declare const getSubUserTradePDA: (programId: PublicKey, wallet: PublicKey, nonce: number) => PublicKey;
7
+ export declare const getPoolPDA: (programId: PublicKey, poolId: 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.getSubUserTradePDA = exports.getUserTradePDA = exports.getCustomerPDA = exports.getMarketPDA = exports.getTokenATA = void 0;
6
+ exports.getPoolPDA = exports.getSubUserTradePDA = exports.getUserTradePDA = exports.getCustomerPDA = 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");
@@ -31,3 +31,7 @@ const getSubUserTradePDA = (programId, wallet, nonce) => {
31
31
  ], programId)[0];
32
32
  };
33
33
  exports.getSubUserTradePDA = getSubUserTradePDA;
34
+ const getPoolPDA = (programId, poolId) => {
35
+ return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('pool'), new bn_js_1.default(poolId).toArrayLike(Buffer, 'le', 8)], programId)[0];
36
+ };
37
+ exports.getPoolPDA = getPoolPDA;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "2.1.1-beta",
3
+ "version": "2.1.2-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",