@triadxyz/triad-protocol 3.2.6-beta → 3.2.8-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, UpdateClaimVaultIsActiveArgs, UpdateClaimVaultAmountArgs } from './types';
5
+ import { RpcOptions, CreateClaimVaultArgs, ClaimTokenArgs, UpdateClaimVaultIsActiveArgs, UpdateClaimVaultAmountArgs, UpdateClaimVaultEndTsArgs } from './types';
6
6
  export default class Claim {
7
7
  private program;
8
8
  private rpcOptions;
@@ -50,4 +50,10 @@ export default class Claim {
50
50
  * @param mint - Mint
51
51
  */
52
52
  updateClaimVaultAmount({ amount, newUsers, claimVaultName, mint, merkleRoot }: UpdateClaimVaultAmountArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
53
+ /**
54
+ * Update Claim Vault End Ts
55
+ * @param endTs - End ts
56
+ * @param claimVaultName - Claim vault name
57
+ */
58
+ updateClaimVaultEndTs({ endTs, claimVaultName }: UpdateClaimVaultEndTsArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
53
59
  }
package/dist/claim.js CHANGED
@@ -161,5 +161,24 @@ class Claim {
161
161
  return (0, sendVersionedTransaction_1.default)(this.program, ixs, this.rpcOptions);
162
162
  });
163
163
  }
164
+ /**
165
+ * Update Claim Vault End Ts
166
+ * @param endTs - End ts
167
+ * @param claimVaultName - Claim vault name
168
+ */
169
+ updateClaimVaultEndTs({ endTs, claimVaultName }) {
170
+ return __awaiter(this, void 0, void 0, function* () {
171
+ const ixs = [
172
+ yield this.program.methods
173
+ .updateClaimVaultEndTs(new anchor_1.BN(endTs))
174
+ .accounts({
175
+ signer: this.program.provider.publicKey,
176
+ claimVault: (0, pda_1.getClaimVaultPDA)(this.program.programId, claimVaultName)
177
+ })
178
+ .instruction()
179
+ ];
180
+ return (0, sendVersionedTransaction_1.default)(this.program, ixs, this.rpcOptions);
181
+ });
182
+ }
164
183
  }
165
184
  exports.default = Claim;
package/dist/index.js CHANGED
@@ -518,7 +518,8 @@ class TriadProtocolClient {
518
518
  wallet: this.program.provider.publicKey.toBase58(),
519
519
  inToken: token,
520
520
  outToken: constants_1.TRD_MINT.toString(),
521
- amount
521
+ amount,
522
+ feePayer: this.rpcOptions.payer.toBase58()
522
523
  });
523
524
  amountInTRD = outAmount;
524
525
  if (swapIxs.length === 0) {
@@ -750,7 +751,8 @@ class TriadProtocolClient {
750
751
  wallet: this.program.provider.publicKey.toBase58(),
751
752
  inToken: constants_1.TRD_MINT.toString(),
752
753
  outToken: constants_1.USDC_MINT.toString(),
753
- amount: Math.floor(amountInTRD)
754
+ amount: Math.floor(amountInTRD),
755
+ feePayer: this.rpcOptions.payer.toBase58()
754
756
  });
755
757
  if (swapIxs.length === 0) {
756
758
  return;
@@ -943,7 +945,8 @@ class TriadProtocolClient {
943
945
  wallet: this.program.provider.publicKey.toBase58(),
944
946
  inToken: constants_1.TRD_MINT.toString(),
945
947
  outToken: constants_1.USDC_MINT.toString(),
946
- amount: Math.floor(amountInTRD)
948
+ amount: Math.floor(amountInTRD),
949
+ feePayer: this.rpcOptions.payer.toBase58()
947
950
  });
948
951
  if (swapIxs.length === 0) {
949
952
  return;
@@ -1083,7 +1086,8 @@ class TriadProtocolClient {
1083
1086
  wallet: this.program.provider.publicKey.toBase58(),
1084
1087
  inToken: constants_1.USDC_MINT.toBase58(),
1085
1088
  outToken: constants_1.TRD_MINT.toString(),
1086
- amount: amountOfUSDC.toNumber() / Math.pow(10, 6)
1089
+ amount: amountOfUSDC.toNumber() / Math.pow(10, 6),
1090
+ feePayer: this.rpcOptions.payer.toBase58()
1087
1091
  });
1088
1092
  if (swapIxs.length > 0) {
1089
1093
  ixs.push(...setupInstructions);
@@ -2374,6 +2374,27 @@
2374
2374
  }
2375
2375
  ]
2376
2376
  },
2377
+ {
2378
+ "name": "update_claim_vault_end_ts",
2379
+ "discriminator": [69, 164, 251, 168, 155, 22, 198, 189],
2380
+ "accounts": [
2381
+ {
2382
+ "name": "signer",
2383
+ "writable": true,
2384
+ "signer": true
2385
+ },
2386
+ {
2387
+ "name": "claim_vault",
2388
+ "writable": true
2389
+ }
2390
+ ],
2391
+ "args": [
2392
+ {
2393
+ "name": "end_ts",
2394
+ "type": "i64"
2395
+ }
2396
+ ]
2397
+ },
2377
2398
  {
2378
2399
  "name": "update_claim_vault_is_active",
2379
2400
  "discriminator": [122, 240, 207, 89, 71, 29, 176, 103],
@@ -353,3 +353,7 @@ export type UpdateClaimVaultAmountArgs = {
353
353
  mint: PublicKey;
354
354
  merkleRoot: number[];
355
355
  };
356
+ export type UpdateClaimVaultEndTsArgs = {
357
+ endTs: number;
358
+ claimVaultName: string;
359
+ };
@@ -3349,6 +3349,27 @@ export type TriadProtocol = {
3349
3349
  }
3350
3350
  ];
3351
3351
  },
3352
+ {
3353
+ name: 'updateClaimVaultEndTs';
3354
+ discriminator: [69, 164, 251, 168, 155, 22, 198, 189];
3355
+ accounts: [
3356
+ {
3357
+ name: 'signer';
3358
+ writable: true;
3359
+ signer: true;
3360
+ },
3361
+ {
3362
+ name: 'claimVault';
3363
+ writable: true;
3364
+ }
3365
+ ];
3366
+ args: [
3367
+ {
3368
+ name: 'endTs';
3369
+ type: 'i64';
3370
+ }
3371
+ ];
3372
+ },
3352
3373
  {
3353
3374
  name: 'updateClaimVaultIsActive';
3354
3375
  discriminator: [122, 240, 207, 89, 71, 29, 176, 103];
@@ -1,10 +1,11 @@
1
1
  import { AddressLookupTableAccount, Connection, TransactionInstruction } from '@solana/web3.js';
2
- export declare const swap: ({ connection, wallet, inToken, outToken, amount }: {
2
+ export declare const swap: ({ connection, wallet, inToken, outToken, amount, feePayer }: {
3
3
  connection: Connection;
4
4
  wallet: string;
5
5
  inToken: string;
6
6
  outToken: string;
7
7
  amount: number;
8
+ feePayer: string;
8
9
  }) => Promise<{
9
10
  swapIxs: TransactionInstruction[];
10
11
  addressLookupTableAccounts: AddressLookupTableAccount[];
@@ -18,7 +18,7 @@ const web3_js_1 = require("@solana/web3.js");
18
18
  const spl_token_1 = require("@solana/spl-token");
19
19
  const pda_1 = require("./pda");
20
20
  const constants_1 = require("./constants");
21
- const swap = ({ connection, wallet, inToken, outToken, amount }) => __awaiter(void 0, void 0, void 0, function* () {
21
+ const swap = ({ connection, wallet, inToken, outToken, amount, feePayer }) => __awaiter(void 0, void 0, void 0, function* () {
22
22
  const token = TOKENS[inToken];
23
23
  if (!token) {
24
24
  throw new Error('Token not found');
@@ -29,6 +29,7 @@ const swap = ({ connection, wallet, inToken, outToken, amount }) => __awaiter(vo
29
29
  const swapResponse = yield axios_1.default.post('https://lite-api.jup.ag/swap/v1/swap-instructions', {
30
30
  quoteResponse: quoteData,
31
31
  userPublicKey: wallet,
32
+ feePayer,
32
33
  feeAccount: inToken === constants_1.TRD_MINT.toString() ? getFeeAccount() : undefined
33
34
  });
34
35
  const { setupInstructions, swapInstruction, addressLookupTableAddresses } = swapResponse.data;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "3.2.6-beta",
3
+ "version": "3.2.8-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",