@triadxyz/triad-protocol 3.1.9-beta → 3.2.0-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/claim.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  import { Program } from '@coral-xyz/anchor';
3
3
  import { PublicKey } from '@solana/web3.js';
4
4
  import { TriadProtocol } from './types/triad_protocol';
5
- import { RpcOptions, CreateClaimVaultArgs, ClaimTokenArgs, UpdateClaimVaultMerkleRootArgs, UpdateClaimVaultIsActiveArgs, UpdateClaimVaultAmountArgs } from './types';
5
+ import { RpcOptions, CreateClaimVaultArgs, ClaimTokenArgs, UpdateClaimVaultIsActiveArgs, UpdateClaimVaultAmountArgs } from './types';
6
6
  export default class Claim {
7
7
  private program;
8
8
  private rpcOptions;
@@ -42,12 +42,6 @@ export default class Claim {
42
42
  * @param claimVault - Claim vault
43
43
  */
44
44
  updateClaimVaultIsActive({ isActive, claimVaultName }: UpdateClaimVaultIsActiveArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
45
- /**
46
- * Update Claim Vault Merkle Root
47
- * @param merkleRoot - Merkle root
48
- * @param claimVault - Claim vault
49
- */
50
- updateClaimVaultMerkleRoot({ merkleRoot, claimVaultName }: UpdateClaimVaultMerkleRootArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
51
45
  /**
52
46
  * Update Claim Vault Amount
53
47
  * @param amount - Amount to add
@@ -55,5 +49,5 @@ export default class Claim {
55
49
  * @param claimVaultName - Claim vault name
56
50
  * @param mint - Mint
57
51
  */
58
- updateClaimVaultAmount({ amount, newUsers, claimVaultName, mint }: UpdateClaimVaultAmountArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
52
+ updateClaimVaultAmount({ amount, newUsers, claimVaultName, mint, merkleRoot }: UpdateClaimVaultAmountArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
59
53
  }
package/dist/claim.js CHANGED
@@ -134,25 +134,6 @@ class Claim {
134
134
  return (0, sendVersionedTransaction_1.default)(this.program, ixs, this.rpcOptions);
135
135
  });
136
136
  }
137
- /**
138
- * Update Claim Vault Merkle Root
139
- * @param merkleRoot - Merkle root
140
- * @param claimVault - Claim vault
141
- */
142
- updateClaimVaultMerkleRoot({ merkleRoot, claimVaultName }) {
143
- return __awaiter(this, void 0, void 0, function* () {
144
- const ixs = [
145
- yield this.program.methods
146
- .updateClaimVaultMerkleRoot(merkleRoot)
147
- .accounts({
148
- signer: this.program.provider.publicKey,
149
- claimVault: (0, pda_1.getClaimVaultPDA)(this.program.programId, claimVaultName)
150
- })
151
- .instruction()
152
- ];
153
- return (0, sendVersionedTransaction_1.default)(this.program, ixs, this.rpcOptions);
154
- });
155
- }
156
137
  /**
157
138
  * Update Claim Vault Amount
158
139
  * @param amount - Amount to add
@@ -160,13 +141,14 @@ class Claim {
160
141
  * @param claimVaultName - Claim vault name
161
142
  * @param mint - Mint
162
143
  */
163
- updateClaimVaultAmount({ amount, newUsers, claimVaultName, mint }) {
144
+ updateClaimVaultAmount({ amount, newUsers, claimVaultName, mint, merkleRoot }) {
164
145
  return __awaiter(this, void 0, void 0, function* () {
165
146
  const ixs = [
166
147
  yield this.program.methods
167
148
  .updateClaimVaultAmount({
168
149
  amount: new anchor_1.BN(amount * Math.pow(10, 6)),
169
- newUsers: new anchor_1.BN(newUsers)
150
+ newUsers: new anchor_1.BN(newUsers),
151
+ merkleRoot
170
152
  })
171
153
  .accounts({
172
154
  signer: this.program.provider.publicKey,
package/dist/index.js CHANGED
@@ -684,12 +684,12 @@ class TriadProtocolClient {
684
684
  break;
685
685
  }
686
686
  userTrade.orders.forEach((order) => {
687
- if (order.orderStatus === types_1.OrderStatus.INIT ||
688
- order.orderStatus === types_1.OrderStatus.CLOSED) {
687
+ if (order.orderStatus !== types_1.OrderStatus.OPEN) {
689
688
  nonce = userTrade.isSubUser ? Number(userTrade.nonce) : 0;
690
689
  }
691
690
  });
692
691
  }
692
+ console.log('nonce', nonce);
693
693
  if (nonce === null) {
694
694
  throw new Error('No open orders found');
695
695
  }
@@ -783,11 +783,11 @@ class TriadProtocolClient {
783
783
  return;
784
784
  }
785
785
  }
786
+ const { userTradePDA, userTradeIxs } = yield this.getUserTradeNonce(marketId, Object.keys(orders[0].orderDirection)[0]);
787
+ if (userTradeIxs.length > 0) {
788
+ ixs.push(...userTradeIxs);
789
+ }
786
790
  for (const order of orders) {
787
- const { userTradePDA, userTradeIxs } = yield this.getUserTradeNonce(marketId, Object.keys(order.orderDirection)[0]);
788
- if (userTradeIxs.length > 0) {
789
- ixs.push(...userTradeIxs);
790
- }
791
791
  ixs.push(yield this.program.methods
792
792
  .placeBidOrder({
793
793
  amount: new bn_js_1.default(order.amount * Math.pow(10, constants_1.BASE_DECIMALS)),
@@ -2679,29 +2679,6 @@
2679
2679
  }
2680
2680
  ]
2681
2681
  },
2682
- {
2683
- "name": "update_claim_vault_merkle_root",
2684
- "discriminator": [83, 209, 102, 81, 118, 44, 157, 23],
2685
- "accounts": [
2686
- {
2687
- "name": "signer",
2688
- "writable": true,
2689
- "signer": true
2690
- },
2691
- {
2692
- "name": "claim_vault",
2693
- "writable": true
2694
- }
2695
- ],
2696
- "args": [
2697
- {
2698
- "name": "merkle_root",
2699
- "type": {
2700
- "array": ["u8", 32]
2701
- }
2702
- }
2703
- ]
2704
- },
2705
2682
  {
2706
2683
  "name": "update_customer_fee",
2707
2684
  "discriminator": [218, 240, 1, 38, 34, 166, 40, 25],
@@ -4100,6 +4077,22 @@
4100
4077
  {
4101
4078
  "name": "pool_id",
4102
4079
  "type": "u64"
4080
+ },
4081
+ {
4082
+ "name": "market_order_fee_available",
4083
+ "type": "u64"
4084
+ },
4085
+ {
4086
+ "name": "market_order_fee_claimed",
4087
+ "type": "u64"
4088
+ },
4089
+ {
4090
+ "name": "fee_recipient",
4091
+ "type": "pubkey"
4092
+ },
4093
+ {
4094
+ "name": "resolved_ts",
4095
+ "type": "i64"
4103
4096
  }
4104
4097
  ]
4105
4098
  }
@@ -4968,6 +4961,12 @@
4968
4961
  {
4969
4962
  "name": "new_users",
4970
4963
  "type": "u64"
4964
+ },
4965
+ {
4966
+ "name": "merkle_root",
4967
+ "type": {
4968
+ "array": ["u8", 32]
4969
+ }
4971
4970
  }
4972
4971
  ]
4973
4972
  }
@@ -337,10 +337,6 @@ export type UpdateClaimVaultIsActiveArgs = {
337
337
  isActive: boolean;
338
338
  claimVaultName: string;
339
339
  };
340
- export type UpdateClaimVaultMerkleRootArgs = {
341
- merkleRoot: number[];
342
- claimVaultName: string;
343
- };
344
340
  export type UpdateMarketWinningDirectionArgs = {
345
341
  marketId: number;
346
342
  poolId?: number;
@@ -356,4 +352,5 @@ export type UpdateClaimVaultAmountArgs = {
356
352
  newUsers: number;
357
353
  claimVaultName: string;
358
354
  mint: PublicKey;
355
+ merkleRoot: number[];
359
356
  };
@@ -3770,29 +3770,6 @@ export type TriadProtocol = {
3770
3770
  }
3771
3771
  ];
3772
3772
  },
3773
- {
3774
- name: 'updateClaimVaultMerkleRoot';
3775
- discriminator: [83, 209, 102, 81, 118, 44, 157, 23];
3776
- accounts: [
3777
- {
3778
- name: 'signer';
3779
- writable: true;
3780
- signer: true;
3781
- },
3782
- {
3783
- name: 'claimVault';
3784
- writable: true;
3785
- }
3786
- ];
3787
- args: [
3788
- {
3789
- name: 'merkleRoot';
3790
- type: {
3791
- array: ['u8', 32];
3792
- };
3793
- }
3794
- ];
3795
- },
3796
3773
  {
3797
3774
  name: 'updateCustomerFee';
3798
3775
  discriminator: [218, 240, 1, 38, 34, 166, 40, 25];
@@ -5203,6 +5180,22 @@ export type TriadProtocol = {
5203
5180
  {
5204
5181
  name: 'poolId';
5205
5182
  type: 'u64';
5183
+ },
5184
+ {
5185
+ name: 'marketOrderFeeAvailable';
5186
+ type: 'u64';
5187
+ },
5188
+ {
5189
+ name: 'marketOrderFeeClaimed';
5190
+ type: 'u64';
5191
+ },
5192
+ {
5193
+ name: 'feeRecipient';
5194
+ type: 'pubkey';
5195
+ },
5196
+ {
5197
+ name: 'resolvedTs';
5198
+ type: 'i64';
5206
5199
  }
5207
5200
  ];
5208
5201
  };
@@ -6071,6 +6064,12 @@ export type TriadProtocol = {
6071
6064
  {
6072
6065
  name: 'newUsers';
6073
6066
  type: 'u64';
6067
+ },
6068
+ {
6069
+ name: 'merkleRoot';
6070
+ type: {
6071
+ array: ['u8', 32];
6072
+ };
6074
6073
  }
6075
6074
  ];
6076
6075
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "3.1.9-beta",
3
+ "version": "3.2.0-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",