@triadxyz/triad-protocol 2.5.7-beta → 2.5.9-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/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { Connection, PublicKey, TransactionInstruction } from '@solana/web3.js';
2
2
  import { AnchorProvider, Program, Wallet } from '@coral-xyz/anchor';
3
3
  import BN from 'bn.js';
4
4
  import { TriadProtocol } from './types/triad_protocol';
5
- import { CreateMarketArgs, OpenOrderArgs, UserTrade, CreateCustomerArgs, MarketBidOrderArgs, CancelBidOrderArgs, CancelAskOrderArgs, PlaceBidOrderArgs, PlaceAskOrderArgs, CreatePoolArgs, BookOrder, MarketAskOrderArgs, RpcOptions, CollectMarketFeeArgs } from './types';
5
+ import { CreateMarketArgs, OpenOrderArgs, UserTrade, CreateCustomerArgs, MarketBidOrderArgs, CancelBidOrderArgs, CancelAskOrderArgs, PlaceBidOrderArgs, PlaceAskOrderArgs, CreatePoolArgs, BookOrder, MarketAskOrderArgs, RpcOptions, CollectMarketFeeArgs, UpdateCustomerFeeArgs } from './types';
6
6
  import Stake from './stake';
7
7
  import Poseidon from './poseidon';
8
8
  export * from './types';
@@ -328,7 +328,7 @@ export default class TriadProtocolClient {
328
328
  * @param options - RPC options
329
329
  *
330
330
  */
331
- createCustomer({ id, name, authority, feeRecipient, feeBps, isVerified }: CreateCustomerArgs, options?: RpcOptions): Promise<string>;
331
+ createCustomer({ id, name, authority, feeRecipient, isStaked }: CreateCustomerArgs, options?: RpcOptions): Promise<string>;
332
332
  /**
333
333
  * Get User Trade Nonce With Slots
334
334
  * @param userTrades - User Trades
@@ -455,4 +455,12 @@ export default class TriadProtocolClient {
455
455
  * @param options - RPC options
456
456
  */
457
457
  createRefer(options?: RpcOptions): Promise<string>;
458
+ /**
459
+ * Update Customer Fee
460
+ * @param feeBps - The fee in basis points
461
+ * @param wallet - The wallet of the customer to update the fee for
462
+ *
463
+ * @param options - RPC options
464
+ */
465
+ updateCustomerFee({ feeBps, wallet }: UpdateCustomerFeeArgs, options?: RpcOptions): Promise<string>;
458
466
  }
package/dist/index.js CHANGED
@@ -259,8 +259,8 @@ class TriadProtocolClient {
259
259
  .accounts({
260
260
  signer: this.program.provider.publicKey,
261
261
  tokenProgram: (0, helpers_1.getTokenProgram)(mint),
262
- customer,
263
- pool: poolPDA
262
+ pool: poolPDA,
263
+ customer
264
264
  })
265
265
  .instruction());
266
266
  ixs.push(yield this.program.methods
@@ -575,15 +575,15 @@ class TriadProtocolClient {
575
575
  * @param options - RPC options
576
576
  *
577
577
  */
578
- createCustomer({ id, name, authority, feeRecipient, feeBps, isVerified }, options) {
578
+ createCustomer({ id, name, authority, feeRecipient, isStaked }, options) {
579
579
  return __awaiter(this, void 0, void 0, function* () {
580
580
  const ixs = [];
581
581
  let stakePDA = null;
582
- if (!isVerified) {
582
+ if (isStaked) {
583
583
  stakePDA = (0, stake_2.getStakePDA)(this.program.programId, this.program.provider.publicKey);
584
584
  }
585
585
  ixs.push(yield this.program.methods
586
- .createCustomer({ id, name, authority, feeRecipient, feeBps })
586
+ .createCustomer({ id, name, authority, feeRecipient })
587
587
  .accounts({
588
588
  signer: this.program.provider.publicKey,
589
589
  stake: stakePDA
@@ -1021,5 +1021,26 @@ class TriadProtocolClient {
1021
1021
  return (0, sendVersionedTransaction_1.default)(this.program, ixs, options);
1022
1022
  });
1023
1023
  }
1024
+ /**
1025
+ * Update Customer Fee
1026
+ * @param feeBps - The fee in basis points
1027
+ * @param wallet - The wallet of the customer to update the fee for
1028
+ *
1029
+ * @param options - RPC options
1030
+ */
1031
+ updateCustomerFee({ feeBps, wallet }, options) {
1032
+ return __awaiter(this, void 0, void 0, function* () {
1033
+ const ixs = [];
1034
+ const customer = yield this.getCustomerByWallet(wallet);
1035
+ ixs.push(yield this.program.methods
1036
+ .updateCustomerFee(feeBps)
1037
+ .accounts({
1038
+ signer: this.program.provider.publicKey,
1039
+ customer: customer.address
1040
+ })
1041
+ .instruction());
1042
+ return (0, sendVersionedTransaction_1.default)(this.program, ixs, options);
1043
+ });
1044
+ }
1024
1045
  }
1025
1046
  exports.default = TriadProtocolClient;
@@ -2009,6 +2009,31 @@
2009
2009
  ],
2010
2010
  "args": []
2011
2011
  },
2012
+ {
2013
+ "name": "update_customer_fee",
2014
+ "discriminator": [218, 240, 1, 38, 34, 166, 40, 25],
2015
+ "accounts": [
2016
+ {
2017
+ "name": "signer",
2018
+ "writable": true,
2019
+ "signer": true
2020
+ },
2021
+ {
2022
+ "name": "customer",
2023
+ "writable": true
2024
+ },
2025
+ {
2026
+ "name": "system_program",
2027
+ "address": "11111111111111111111111111111111"
2028
+ }
2029
+ ],
2030
+ "args": [
2031
+ {
2032
+ "name": "fee_bps",
2033
+ "type": "u16"
2034
+ }
2035
+ ]
2036
+ },
2012
2037
  {
2013
2038
  "name": "update_market",
2014
2039
  "discriminator": [153, 39, 2, 197, 179, 50, 199, 217],
@@ -2724,10 +2749,6 @@
2724
2749
  {
2725
2750
  "name": "fee_recipient",
2726
2751
  "type": "pubkey"
2727
- },
2728
- {
2729
- "name": "fee_bps",
2730
- "type": "u16"
2731
2752
  }
2732
2753
  ]
2733
2754
  }
@@ -143,8 +143,7 @@ export type CreateCustomerArgs = {
143
143
  name: string;
144
144
  authority: PublicKey;
145
145
  feeRecipient: PublicKey;
146
- feeBps: number;
147
- isVerified: boolean;
146
+ isStaked: boolean;
148
147
  };
149
148
  export type OpenOrderArgs = {
150
149
  marketId: number;
@@ -247,3 +246,7 @@ export type Customer = {
247
246
  isVerified: boolean;
248
247
  address: string;
249
248
  };
249
+ export type UpdateCustomerFeeArgs = {
250
+ feeBps: number;
251
+ wallet: PublicKey;
252
+ };
@@ -2788,6 +2788,31 @@ export type TriadProtocol = {
2788
2788
  ];
2789
2789
  args: [];
2790
2790
  },
2791
+ {
2792
+ name: 'updateCustomerFee';
2793
+ discriminator: [218, 240, 1, 38, 34, 166, 40, 25];
2794
+ accounts: [
2795
+ {
2796
+ name: 'signer';
2797
+ writable: true;
2798
+ signer: true;
2799
+ },
2800
+ {
2801
+ name: 'customer';
2802
+ writable: true;
2803
+ },
2804
+ {
2805
+ name: 'systemProgram';
2806
+ address: '11111111111111111111111111111111';
2807
+ }
2808
+ ];
2809
+ args: [
2810
+ {
2811
+ name: 'feeBps';
2812
+ type: 'u16';
2813
+ }
2814
+ ];
2815
+ },
2791
2816
  {
2792
2817
  name: 'updateMarket';
2793
2818
  discriminator: [153, 39, 2, 197, 179, 50, 199, 217];
@@ -3573,10 +3598,6 @@ export type TriadProtocol = {
3573
3598
  {
3574
3599
  name: 'feeRecipient';
3575
3600
  type: 'pubkey';
3576
- },
3577
- {
3578
- name: 'feeBps';
3579
- type: 'u16';
3580
3601
  }
3581
3602
  ];
3582
3603
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "2.5.7-beta",
3
+ "version": "2.5.9-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",