@send-fun/sdk 1.0.1 → 1.2.0

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.
Files changed (72) hide show
  1. package/README.md +13 -5
  2. package/dist/index.cjs +797 -369
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +596 -94
  5. package/dist/index.d.cts.map +1 -1
  6. package/dist/index.d.mts +596 -94
  7. package/dist/index.d.mts.map +1 -1
  8. package/dist/index.mjs +527 -99
  9. package/dist/index.mjs.map +1 -1
  10. package/package.json +4 -6
  11. package/src/dex/generated/accounts/globalConfig.ts +39 -2
  12. package/src/dex/generated/accounts/pool.ts +41 -2
  13. package/src/dex/generated/accounts/rewardAccrual.ts +39 -2
  14. package/src/dex/generated/index.ts +1 -0
  15. package/src/dex/generated/instructions/buyExactIn.ts +1 -1
  16. package/src/dex/generated/instructions/buyExactOut.ts +1 -1
  17. package/src/dex/generated/instructions/claimCreatorFees.ts +1 -1
  18. package/src/dex/generated/instructions/claimProtocolFees.ts +1 -1
  19. package/src/dex/generated/instructions/sellExactIn.ts +1 -1
  20. package/src/dex/generated/instructions/sellExactOut.ts +1 -1
  21. package/src/dex/generated/plugins/sendDex.ts +1 -1
  22. package/src/dex/generated/shared/index.ts +52 -0
  23. package/src/dex/trade.ts +12 -13
  24. package/src/launchpad/create.ts +8 -8
  25. package/src/launchpad/generated/accounts/bondingCurve.ts +39 -2
  26. package/src/launchpad/generated/accounts/globalConfig.ts +39 -2
  27. package/src/launchpad/generated/accounts/rewardAccrual.ts +39 -2
  28. package/src/launchpad/generated/index.ts +1 -0
  29. package/src/launchpad/generated/instructions/buyExactIn.ts +1 -1
  30. package/src/launchpad/generated/instructions/buyExactOut.ts +1 -1
  31. package/src/launchpad/generated/instructions/claimCreatorFees.ts +1 -1
  32. package/src/launchpad/generated/instructions/claimProtocolFees.ts +1 -1
  33. package/src/launchpad/generated/instructions/createToken.ts +1 -1
  34. package/src/launchpad/generated/instructions/migrate.ts +1 -1
  35. package/src/launchpad/generated/instructions/sellExactIn.ts +1 -1
  36. package/src/launchpad/generated/instructions/sellExactOut.ts +1 -1
  37. package/src/launchpad/generated/plugins/sendLaunchpad.ts +1 -1
  38. package/src/launchpad/generated/shared/index.ts +52 -0
  39. package/src/launchpad/migrate.ts +1 -1
  40. package/src/launchpad/trade.ts +15 -15
  41. package/src/math/amm.ts +40 -33
  42. package/src/math/fee-decay.ts +3 -2
  43. package/src/math/fees.ts +4 -2
  44. package/src/math/internal.ts +1 -1
  45. package/src/nexus/fee-helpers.ts +5 -3
  46. package/src/nexus/generated/accounts/altRegistry.ts +41 -2
  47. package/src/nexus/generated/accounts/creatorFeeConfig.ts +39 -2
  48. package/src/nexus/generated/accounts/feePreset.ts +41 -2
  49. package/src/nexus/generated/accounts/globalConfig.ts +39 -2
  50. package/src/nexus/generated/accounts/partnerConfig.ts +39 -2
  51. package/src/nexus/generated/accounts/partnerMetadata.ts +39 -2
  52. package/src/nexus/generated/accounts/rewardState.ts +41 -2
  53. package/src/nexus/generated/accounts/stakingConfig.ts +39 -2
  54. package/src/nexus/generated/accounts/userRewardDebt.ts +39 -2
  55. package/src/nexus/generated/accounts/userStakePosition.ts +39 -2
  56. package/src/nexus/generated/index.ts +1 -0
  57. package/src/nexus/generated/instructions/claim.ts +1 -1
  58. package/src/nexus/generated/instructions/createUserRewardDebt.ts +1 -1
  59. package/src/nexus/generated/instructions/settle.ts +1 -1
  60. package/src/nexus/generated/instructions/stake.ts +1 -1
  61. package/src/nexus/generated/instructions/unstake.ts +1 -1
  62. package/src/nexus/generated/plugins/sendNexus.ts +1 -1
  63. package/src/nexus/generated/shared/index.ts +52 -0
  64. package/src/nexus/staking.ts +45 -41
  65. package/src/platform.ts +2 -2
  66. package/src/transfer-fee.ts +19 -17
  67. package/src/utils/chunk.ts +1 -1
  68. package/src/utils/creator-hash.ts +6 -3
  69. package/src/utils/index.ts +2 -0
  70. package/src/utils/mint-info.ts +8 -7
  71. package/src/utils/partner.ts +1 -1
  72. package/src/utils/pda.ts +1 -1
package/dist/index.cjs CHANGED
@@ -12,7 +12,7 @@ var __exportAll = (all, no_symbols) => {
12
12
  };
13
13
  //#endregion
14
14
  let _solana_kit = require("@solana/kit");
15
- let _solana_program_client_core = require("@solana/program-client-core");
15
+ let _solana_kit_program_client_core = require("@solana/kit/program-client-core");
16
16
  //#region src/dex/generated/programs/sendDex.ts
17
17
  const SEND_DEX_PROGRAM_ADDRESS = "84qj5FPZZdXkQy8mfowyg6RBZ3XKuTds6XS4ZYT1sfDX";
18
18
  //#endregion
@@ -30,22 +30,55 @@ var constants_exports = /* @__PURE__ */ __exportAll({
30
30
  SEND_DEX_PROGRAM_ADDRESS: () => SEND_DEX_PROGRAM_ADDRESS,
31
31
  SEND_LAUNCHPAD_PROGRAM_ADDRESS: () => SEND_LAUNCHPAD_PROGRAM_ADDRESS,
32
32
  SEND_NEXUS_PROGRAM_ADDRESS: () => SEND_NEXUS_PROGRAM_ADDRESS,
33
- SYSTEM_PROGRAM_ADDRESS: () => SYSTEM_PROGRAM_ADDRESS,
33
+ SYSTEM_PROGRAM_ADDRESS: () => SYSTEM_PROGRAM_ADDRESS$3,
34
34
  TOKEN_2022_PROGRAM_ADDRESS: () => TOKEN_2022_PROGRAM_ADDRESS,
35
35
  TOKEN_DECIMALS: () => 6,
36
36
  TOKEN_PROGRAM_ADDRESS: () => TOKEN_PROGRAM_ADDRESS,
37
37
  USDC_MINT: () => USDC_MINT,
38
38
  WSOL_MINT: () => WSOL_MINT
39
39
  });
40
- const SYSTEM_PROGRAM_ADDRESS = (0, _solana_kit.address)("11111111111111111111111111111111");
40
+ const SYSTEM_PROGRAM_ADDRESS$3 = (0, _solana_kit.address)("11111111111111111111111111111111");
41
41
  const TOKEN_PROGRAM_ADDRESS = (0, _solana_kit.address)("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");
42
42
  const TOKEN_2022_PROGRAM_ADDRESS = (0, _solana_kit.address)("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");
43
43
  const ASSOCIATED_TOKEN_PROGRAM_ADDRESS = (0, _solana_kit.address)("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");
44
44
  const WSOL_MINT = (0, _solana_kit.address)("So11111111111111111111111111111111111111112");
45
45
  const USDC_MINT = (0, _solana_kit.address)("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v");
46
- const DEFAULT_PARTNER = SYSTEM_PROGRAM_ADDRESS;
46
+ const DEFAULT_PARTNER = SYSTEM_PROGRAM_ADDRESS$3;
47
47
  const PYTH_SOL_USD_PRICE_ACCOUNT = (0, _solana_kit.address)("7UVimffxr9ow1uXYxsr4LHAcV58mLzhmwaeKvJ1pjLiE");
48
48
  //#endregion
49
+ //#region src/dex/generated/shared/index.ts
50
+ /** The System Program, which owns every address nobody has created an account at yet. */
51
+ const SYSTEM_PROGRAM_ADDRESS$2 = "11111111111111111111111111111111";
52
+ /**
53
+ * Whether an encoded account was created on-chain, rather than merely sent lamports.
54
+ *
55
+ * Anyone can send lamports to an address before its account is created, which leaves it on-chain,
56
+ * owned by the System Program, with no data. This returns `false` for that shape, as it does for an
57
+ * account that does not exist. Any other existing account counts as created, whoever owns it; the
58
+ * `decode*` functions still check the owner.
59
+ *
60
+ * The generated `fetchMaybe*` and `fetchAllMaybe*` helpers apply this rule themselves. Apply it to
61
+ * accounts you fetch or receive another way (subscriptions, batch loaders, caches) before passing
62
+ * them to a `decode*` function, which throws for a lamports-only account: an account passed to it as
63
+ * existing must never come back as the non-existing variant typed as an `Account`.
64
+ *
65
+ * Only a `true` result narrows the type. A lamports-only account is still `exists: true` at runtime,
66
+ * so a `false` result leaves the type unchanged instead of narrowing it to the non-existing variant.
67
+ * The `uncreated` property in the narrowed type is never present; it exists only to prevent that.
68
+ *
69
+ * @example
70
+ * ```ts
71
+ * const maybeAccount = decodeMyAccount(
72
+ * accountIsCreated(encodedAccount) ? encodedAccount : { address: encodedAccount.address, exists: false },
73
+ * );
74
+ * ```
75
+ */
76
+ function accountIsCreated$2(account) {
77
+ const maybeAccount = account;
78
+ if ("exists" in maybeAccount && !maybeAccount.exists) return false;
79
+ return !(maybeAccount.programAddress === SYSTEM_PROGRAM_ADDRESS$2 && maybeAccount.data.length === 0);
80
+ }
81
+ //#endregion
49
82
  //#region src/dex/generated/accounts/globalConfig.ts
50
83
  /**
51
84
  * This code was AUTOGENERATED using the Codama library.
@@ -113,21 +146,40 @@ function decodeGlobalConfig$2(encodedAccount) {
113
146
  }
114
147
  return (0, _solana_kit.decodeAccount)(encodedAccount, getGlobalConfigDecoder$2());
115
148
  }
149
+ /** Fetches a `GlobalConfig` account, throwing when it does not exist or only holds lamports. */
116
150
  async function fetchGlobalConfig$2(rpc, address, config) {
117
151
  const maybeAccount = await fetchMaybeGlobalConfig$2(rpc, address, config);
118
152
  (0, _solana_kit.assertAccountExists)(maybeAccount);
119
153
  return maybeAccount;
120
154
  }
155
+ /**
156
+ * Fetches a `GlobalConfig` account, or the non-existing variant when the address holds no
157
+ * account or only lamports (see {@link accountIsCreated}).
158
+ * {@link decodeGlobalConfig} throws for a lamports-only account instead.
159
+ */
121
160
  async function fetchMaybeGlobalConfig$2(rpc, address, config) {
122
- return decodeGlobalConfig$2(await (0, _solana_kit.fetchEncodedAccount)(rpc, address, config));
161
+ const maybeAccount = await (0, _solana_kit.fetchEncodedAccount)(rpc, address, config);
162
+ return decodeGlobalConfig$2(accountIsCreated$2(maybeAccount) ? maybeAccount : {
163
+ address,
164
+ exists: false
165
+ });
123
166
  }
167
+ /** Fetches `GlobalConfig` accounts, throwing when any does not exist or only holds lamports. */
124
168
  async function fetchAllGlobalConfig$2(rpc, addresses, config) {
125
169
  const maybeAccounts = await fetchAllMaybeGlobalConfig$2(rpc, addresses, config);
126
170
  (0, _solana_kit.assertAccountsExist)(maybeAccounts);
127
171
  return maybeAccounts;
128
172
  }
173
+ /**
174
+ * Fetches `GlobalConfig` accounts, with the non-existing variant for each address that holds
175
+ * no account or only lamports (see {@link accountIsCreated}).
176
+ * {@link decodeGlobalConfig} throws for a lamports-only account instead.
177
+ */
129
178
  async function fetchAllMaybeGlobalConfig$2(rpc, addresses, config) {
130
- return (await (0, _solana_kit.fetchEncodedAccounts)(rpc, addresses, config)).map((maybeAccount) => decodeGlobalConfig$2(maybeAccount));
179
+ return (await (0, _solana_kit.fetchEncodedAccounts)(rpc, addresses, config)).map((maybeAccount) => decodeGlobalConfig$2(accountIsCreated$2(maybeAccount) ? maybeAccount : {
180
+ address: maybeAccount.address,
181
+ exists: false
182
+ }));
131
183
  }
132
184
  function getGlobalConfigSize$1() {
133
185
  return 139;
@@ -288,21 +340,40 @@ function decodePool(encodedAccount) {
288
340
  }
289
341
  return (0, _solana_kit.decodeAccount)(encodedAccount, getPoolDecoder());
290
342
  }
343
+ /** Fetches a `Pool` account, throwing when it does not exist or only holds lamports. */
291
344
  async function fetchPool(rpc, address, config) {
292
345
  const maybeAccount = await fetchMaybePool(rpc, address, config);
293
346
  (0, _solana_kit.assertAccountExists)(maybeAccount);
294
347
  return maybeAccount;
295
348
  }
349
+ /**
350
+ * Fetches a `Pool` account, or the non-existing variant when the address holds no
351
+ * account or only lamports (see {@link accountIsCreated}).
352
+ * {@link decodePool} throws for a lamports-only account instead.
353
+ */
296
354
  async function fetchMaybePool(rpc, address, config) {
297
- return decodePool(await (0, _solana_kit.fetchEncodedAccount)(rpc, address, config));
355
+ const maybeAccount = await (0, _solana_kit.fetchEncodedAccount)(rpc, address, config);
356
+ return decodePool(accountIsCreated$2(maybeAccount) ? maybeAccount : {
357
+ address,
358
+ exists: false
359
+ });
298
360
  }
361
+ /** Fetches `Pool` accounts, throwing when any does not exist or only holds lamports. */
299
362
  async function fetchAllPool(rpc, addresses, config) {
300
363
  const maybeAccounts = await fetchAllMaybePool(rpc, addresses, config);
301
364
  (0, _solana_kit.assertAccountsExist)(maybeAccounts);
302
365
  return maybeAccounts;
303
366
  }
367
+ /**
368
+ * Fetches `Pool` accounts, with the non-existing variant for each address that holds
369
+ * no account or only lamports (see {@link accountIsCreated}).
370
+ * {@link decodePool} throws for a lamports-only account instead.
371
+ */
304
372
  async function fetchAllMaybePool(rpc, addresses, config) {
305
- return (await (0, _solana_kit.fetchEncodedAccounts)(rpc, addresses, config)).map((maybeAccount) => decodePool(maybeAccount));
373
+ return (await (0, _solana_kit.fetchEncodedAccounts)(rpc, addresses, config)).map((maybeAccount) => decodePool(accountIsCreated$2(maybeAccount) ? maybeAccount : {
374
+ address: maybeAccount.address,
375
+ exists: false
376
+ }));
306
377
  }
307
378
  function getPoolSize() {
308
379
  return 389;
@@ -375,21 +446,40 @@ function decodeRewardAccrual$1(encodedAccount) {
375
446
  }
376
447
  return (0, _solana_kit.decodeAccount)(encodedAccount, getRewardAccrualDecoder$1());
377
448
  }
449
+ /** Fetches a `RewardAccrual` account, throwing when it does not exist or only holds lamports. */
378
450
  async function fetchRewardAccrual$1(rpc, address, config) {
379
451
  const maybeAccount = await fetchMaybeRewardAccrual$1(rpc, address, config);
380
452
  (0, _solana_kit.assertAccountExists)(maybeAccount);
381
453
  return maybeAccount;
382
454
  }
455
+ /**
456
+ * Fetches a `RewardAccrual` account, or the non-existing variant when the address holds no
457
+ * account or only lamports (see {@link accountIsCreated}).
458
+ * {@link decodeRewardAccrual} throws for a lamports-only account instead.
459
+ */
383
460
  async function fetchMaybeRewardAccrual$1(rpc, address, config) {
384
- return decodeRewardAccrual$1(await (0, _solana_kit.fetchEncodedAccount)(rpc, address, config));
461
+ const maybeAccount = await (0, _solana_kit.fetchEncodedAccount)(rpc, address, config);
462
+ return decodeRewardAccrual$1(accountIsCreated$2(maybeAccount) ? maybeAccount : {
463
+ address,
464
+ exists: false
465
+ });
385
466
  }
467
+ /** Fetches `RewardAccrual` accounts, throwing when any does not exist or only holds lamports. */
386
468
  async function fetchAllRewardAccrual$1(rpc, addresses, config) {
387
469
  const maybeAccounts = await fetchAllMaybeRewardAccrual$1(rpc, addresses, config);
388
470
  (0, _solana_kit.assertAccountsExist)(maybeAccounts);
389
471
  return maybeAccounts;
390
472
  }
473
+ /**
474
+ * Fetches `RewardAccrual` accounts, with the non-existing variant for each address that holds
475
+ * no account or only lamports (see {@link accountIsCreated}).
476
+ * {@link decodeRewardAccrual} throws for a lamports-only account instead.
477
+ */
391
478
  async function fetchAllMaybeRewardAccrual$1(rpc, addresses, config) {
392
- return (await (0, _solana_kit.fetchEncodedAccounts)(rpc, addresses, config)).map((maybeAccount) => decodeRewardAccrual$1(maybeAccount));
479
+ return (await (0, _solana_kit.fetchEncodedAccounts)(rpc, addresses, config)).map((maybeAccount) => decodeRewardAccrual$1(accountIsCreated$2(maybeAccount) ? maybeAccount : {
480
+ address: maybeAccount.address,
481
+ exists: false
482
+ }));
393
483
  }
394
484
  function getRewardAccrualSize$1() {
395
485
  return 130;
@@ -1411,39 +1501,39 @@ async function getBuyExactInInstructionAsync$1(input) {
1411
1501
  };
1412
1502
  const args = { ...input };
1413
1503
  if (!accounts.pool.value) accounts.pool.value = await findPoolPda({
1414
- baseMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value),
1415
- quoteMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value)
1504
+ baseMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value),
1505
+ quoteMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value)
1416
1506
  });
1417
1507
  if (!accounts.baseVault.value) accounts.baseVault.value = await (0, _solana_kit.getProgramDerivedAddress)({
1418
1508
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
1419
1509
  seeds: [
1420
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("pool", accounts.pool.value)),
1510
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("pool", accounts.pool.value)),
1421
1511
  (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit.address)("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb")),
1422
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value))
1512
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value))
1423
1513
  ]
1424
1514
  });
1425
1515
  if (!accounts.quoteVault.value) accounts.quoteVault.value = await (0, _solana_kit.getProgramDerivedAddress)({
1426
1516
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
1427
1517
  seeds: [
1428
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("pool", accounts.pool.value)),
1429
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
1430
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
1518
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("pool", accounts.pool.value)),
1519
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
1520
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
1431
1521
  ]
1432
1522
  });
1433
1523
  if (!accounts.userBaseAccount.value) accounts.userBaseAccount.value = await (0, _solana_kit.getProgramDerivedAddress)({
1434
1524
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
1435
1525
  seeds: [
1436
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value)),
1526
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value)),
1437
1527
  (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit.address)("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb")),
1438
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value))
1528
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value))
1439
1529
  ]
1440
1530
  });
1441
1531
  if (!accounts.userQuoteAccount.value) accounts.userQuoteAccount.value = await (0, _solana_kit.getProgramDerivedAddress)({
1442
1532
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
1443
1533
  seeds: [
1444
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value)),
1445
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
1446
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
1534
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value)),
1535
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
1536
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
1447
1537
  ]
1448
1538
  });
1449
1539
  if (!accounts.partnerConfig.value) accounts.partnerConfig.value = await (0, _solana_kit.getProgramDerivedAddress)({
@@ -1458,8 +1548,8 @@ async function getBuyExactInInstructionAsync$1(input) {
1458
1548
  101,
1459
1549
  114
1460
1550
  ])),
1461
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getNonNullResolvedInstructionInput)("platformConfig", args.platformConfig)),
1462
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("partner", accounts.partner.value))
1551
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getNonNullResolvedInstructionInput)("platformConfig", args.platformConfig)),
1552
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("partner", accounts.partner.value))
1463
1553
  ]
1464
1554
  });
1465
1555
  if (!accounts.baseTokenProgram.value) accounts.baseTokenProgram.value = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";
@@ -1467,7 +1557,7 @@ async function getBuyExactInInstructionAsync$1(input) {
1467
1557
  if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
1468
1558
  if (!accounts.eventAuthority.value) accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS$2;
1469
1559
  if (!accounts.program.value) accounts.program.value = "84qj5FPZZdXkQy8mfowyg6RBZ3XKuTds6XS4ZYT1sfDX";
1470
- const getAccountMeta = (0, _solana_program_client_core.getAccountMetaFactory)(programAddress, "programId");
1560
+ const getAccountMeta = (0, _solana_kit_program_client_core.getAccountMetaFactory)(programAddress, "programId");
1471
1561
  return Object.freeze({
1472
1562
  accounts: [
1473
1563
  getAccountMeta("user", accounts.user),
@@ -1570,7 +1660,7 @@ function getBuyExactInInstruction$1(input) {
1570
1660
  if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
1571
1661
  if (!accounts.eventAuthority.value) accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS$2;
1572
1662
  if (!accounts.program.value) accounts.program.value = "84qj5FPZZdXkQy8mfowyg6RBZ3XKuTds6XS4ZYT1sfDX";
1573
- const getAccountMeta = (0, _solana_program_client_core.getAccountMetaFactory)(programAddress, "programId");
1663
+ const getAccountMeta = (0, _solana_kit_program_client_core.getAccountMetaFactory)(programAddress, "programId");
1574
1664
  return Object.freeze({
1575
1665
  accounts: [
1576
1666
  getAccountMeta("user", accounts.user),
@@ -1752,39 +1842,39 @@ async function getBuyExactOutInstructionAsync$1(input) {
1752
1842
  };
1753
1843
  const args = { ...input };
1754
1844
  if (!accounts.pool.value) accounts.pool.value = await findPoolPda({
1755
- baseMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value),
1756
- quoteMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value)
1845
+ baseMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value),
1846
+ quoteMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value)
1757
1847
  });
1758
1848
  if (!accounts.baseVault.value) accounts.baseVault.value = await (0, _solana_kit.getProgramDerivedAddress)({
1759
1849
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
1760
1850
  seeds: [
1761
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("pool", accounts.pool.value)),
1851
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("pool", accounts.pool.value)),
1762
1852
  (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit.address)("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb")),
1763
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value))
1853
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value))
1764
1854
  ]
1765
1855
  });
1766
1856
  if (!accounts.quoteVault.value) accounts.quoteVault.value = await (0, _solana_kit.getProgramDerivedAddress)({
1767
1857
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
1768
1858
  seeds: [
1769
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("pool", accounts.pool.value)),
1770
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
1771
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
1859
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("pool", accounts.pool.value)),
1860
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
1861
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
1772
1862
  ]
1773
1863
  });
1774
1864
  if (!accounts.userBaseAccount.value) accounts.userBaseAccount.value = await (0, _solana_kit.getProgramDerivedAddress)({
1775
1865
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
1776
1866
  seeds: [
1777
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value)),
1867
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value)),
1778
1868
  (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit.address)("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb")),
1779
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value))
1869
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value))
1780
1870
  ]
1781
1871
  });
1782
1872
  if (!accounts.userQuoteAccount.value) accounts.userQuoteAccount.value = await (0, _solana_kit.getProgramDerivedAddress)({
1783
1873
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
1784
1874
  seeds: [
1785
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value)),
1786
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
1787
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
1875
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value)),
1876
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
1877
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
1788
1878
  ]
1789
1879
  });
1790
1880
  if (!accounts.partnerConfig.value) accounts.partnerConfig.value = await (0, _solana_kit.getProgramDerivedAddress)({
@@ -1799,8 +1889,8 @@ async function getBuyExactOutInstructionAsync$1(input) {
1799
1889
  101,
1800
1890
  114
1801
1891
  ])),
1802
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getNonNullResolvedInstructionInput)("platformConfig", args.platformConfig)),
1803
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("partner", accounts.partner.value))
1892
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getNonNullResolvedInstructionInput)("platformConfig", args.platformConfig)),
1893
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("partner", accounts.partner.value))
1804
1894
  ]
1805
1895
  });
1806
1896
  if (!accounts.baseTokenProgram.value) accounts.baseTokenProgram.value = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";
@@ -1808,7 +1898,7 @@ async function getBuyExactOutInstructionAsync$1(input) {
1808
1898
  if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
1809
1899
  if (!accounts.eventAuthority.value) accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS$2;
1810
1900
  if (!accounts.program.value) accounts.program.value = "84qj5FPZZdXkQy8mfowyg6RBZ3XKuTds6XS4ZYT1sfDX";
1811
- const getAccountMeta = (0, _solana_program_client_core.getAccountMetaFactory)(programAddress, "programId");
1901
+ const getAccountMeta = (0, _solana_kit_program_client_core.getAccountMetaFactory)(programAddress, "programId");
1812
1902
  return Object.freeze({
1813
1903
  accounts: [
1814
1904
  getAccountMeta("user", accounts.user),
@@ -1911,7 +2001,7 @@ function getBuyExactOutInstruction$1(input) {
1911
2001
  if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
1912
2002
  if (!accounts.eventAuthority.value) accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS$2;
1913
2003
  if (!accounts.program.value) accounts.program.value = "84qj5FPZZdXkQy8mfowyg6RBZ3XKuTds6XS4ZYT1sfDX";
1914
- const getAccountMeta = (0, _solana_program_client_core.getAccountMetaFactory)(programAddress, "programId");
2004
+ const getAccountMeta = (0, _solana_kit_program_client_core.getAccountMetaFactory)(programAddress, "programId");
1915
2005
  return Object.freeze({
1916
2006
  accounts: [
1917
2007
  getAccountMeta("user", accounts.user),
@@ -2076,31 +2166,31 @@ async function getClaimCreatorFeesInstructionAsync$1(input) {
2076
2166
  }
2077
2167
  };
2078
2168
  if (!accounts.pool.value) accounts.pool.value = await findPoolPda({
2079
- baseMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value),
2080
- quoteMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value)
2169
+ baseMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value),
2170
+ quoteMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value)
2081
2171
  });
2082
2172
  if (!accounts.nexusGlobalConfig.value) accounts.nexusGlobalConfig.value = "3bycfBeRULfXYqcg3DmiYFBjv6mMVidMuqKdFZJTGdNr";
2083
2173
  if (!accounts.quoteVault.value) accounts.quoteVault.value = await (0, _solana_kit.getProgramDerivedAddress)({
2084
2174
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
2085
2175
  seeds: [
2086
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("pool", accounts.pool.value)),
2087
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
2088
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
2176
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("pool", accounts.pool.value)),
2177
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
2178
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
2089
2179
  ]
2090
2180
  });
2091
2181
  if (!accounts.destination.value) accounts.destination.value = await (0, _solana_kit.getProgramDerivedAddress)({
2092
2182
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
2093
2183
  seeds: [
2094
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("destinationOwner", accounts.destinationOwner.value)),
2095
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
2096
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
2184
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("destinationOwner", accounts.destinationOwner.value)),
2185
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
2186
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
2097
2187
  ]
2098
2188
  });
2099
2189
  if (!accounts.associatedTokenProgram.value) accounts.associatedTokenProgram.value = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
2100
2190
  if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
2101
2191
  if (!accounts.eventAuthority.value) accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS$2;
2102
2192
  if (!accounts.program.value) accounts.program.value = "84qj5FPZZdXkQy8mfowyg6RBZ3XKuTds6XS4ZYT1sfDX";
2103
- const getAccountMeta = (0, _solana_program_client_core.getAccountMetaFactory)(programAddress, "programId");
2193
+ const getAccountMeta = (0, _solana_kit_program_client_core.getAccountMetaFactory)(programAddress, "programId");
2104
2194
  return Object.freeze({
2105
2195
  accounts: [
2106
2196
  getAccountMeta("claimer", accounts.claimer),
@@ -2192,7 +2282,7 @@ function getClaimCreatorFeesInstruction$1(input) {
2192
2282
  if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
2193
2283
  if (!accounts.eventAuthority.value) accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS$2;
2194
2284
  if (!accounts.program.value) accounts.program.value = "84qj5FPZZdXkQy8mfowyg6RBZ3XKuTds6XS4ZYT1sfDX";
2195
- const getAccountMeta = (0, _solana_program_client_core.getAccountMetaFactory)(programAddress, "programId");
2285
+ const getAccountMeta = (0, _solana_kit_program_client_core.getAccountMetaFactory)(programAddress, "programId");
2196
2286
  return Object.freeze({
2197
2287
  accounts: [
2198
2288
  getAccountMeta("claimer", accounts.claimer),
@@ -2345,15 +2435,15 @@ async function getClaimProtocolFeesInstructionAsync$1(input) {
2345
2435
  }
2346
2436
  };
2347
2437
  if (!accounts.pool.value) accounts.pool.value = await findPoolPda({
2348
- baseMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value),
2349
- quoteMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value)
2438
+ baseMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value),
2439
+ quoteMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value)
2350
2440
  });
2351
2441
  if (!accounts.quoteVault.value) accounts.quoteVault.value = await (0, _solana_kit.getProgramDerivedAddress)({
2352
2442
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
2353
2443
  seeds: [
2354
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("pool", accounts.pool.value)),
2355
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
2356
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
2444
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("pool", accounts.pool.value)),
2445
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
2446
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
2357
2447
  ]
2358
2448
  });
2359
2449
  if (!accounts.nexusStakingConfig.value) accounts.nexusStakingConfig.value = "9WUowYRb6KAWjWVB5KMmTngBidZXEXgQcQRTXbhxeGbF";
@@ -2368,23 +2458,23 @@ async function getClaimProtocolFeesInstructionAsync$1(input) {
2368
2458
  114,
2369
2459
  100
2370
2460
  ])),
2371
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("nexusStakingConfig", accounts.nexusStakingConfig.value)),
2372
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
2461
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("nexusStakingConfig", accounts.nexusStakingConfig.value)),
2462
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
2373
2463
  ]
2374
2464
  });
2375
- if (!accounts.rewardAccrual.value) accounts.rewardAccrual.value = await findRewardAccrualPda$1({ quoteMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value) });
2465
+ if (!accounts.rewardAccrual.value) accounts.rewardAccrual.value = await findRewardAccrualPda$1({ quoteMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value) });
2376
2466
  if (!accounts.stakingVault.value) accounts.stakingVault.value = await (0, _solana_kit.getProgramDerivedAddress)({
2377
2467
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
2378
2468
  seeds: [
2379
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("nexusStakingConfig", accounts.nexusStakingConfig.value)),
2380
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
2381
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
2469
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("nexusStakingConfig", accounts.nexusStakingConfig.value)),
2470
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
2471
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
2382
2472
  ]
2383
2473
  });
2384
2474
  if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
2385
2475
  if (!accounts.eventAuthority.value) accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS$2;
2386
2476
  if (!accounts.program.value) accounts.program.value = "84qj5FPZZdXkQy8mfowyg6RBZ3XKuTds6XS4ZYT1sfDX";
2387
- const getAccountMeta = (0, _solana_program_client_core.getAccountMetaFactory)(programAddress, "programId");
2477
+ const getAccountMeta = (0, _solana_kit_program_client_core.getAccountMetaFactory)(programAddress, "programId");
2388
2478
  return Object.freeze({
2389
2479
  accounts: [
2390
2480
  getAccountMeta("payer", accounts.payer),
@@ -2465,7 +2555,7 @@ function getClaimProtocolFeesInstruction$1(input) {
2465
2555
  if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
2466
2556
  if (!accounts.eventAuthority.value) accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS$2;
2467
2557
  if (!accounts.program.value) accounts.program.value = "84qj5FPZZdXkQy8mfowyg6RBZ3XKuTds6XS4ZYT1sfDX";
2468
- const getAccountMeta = (0, _solana_program_client_core.getAccountMetaFactory)(programAddress, "programId");
2558
+ const getAccountMeta = (0, _solana_kit_program_client_core.getAccountMetaFactory)(programAddress, "programId");
2469
2559
  return Object.freeze({
2470
2560
  accounts: [
2471
2561
  getAccountMeta("payer", accounts.payer),
@@ -2639,39 +2729,39 @@ async function getSellExactInInstructionAsync$1(input) {
2639
2729
  };
2640
2730
  const args = { ...input };
2641
2731
  if (!accounts.pool.value) accounts.pool.value = await findPoolPda({
2642
- baseMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value),
2643
- quoteMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value)
2732
+ baseMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value),
2733
+ quoteMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value)
2644
2734
  });
2645
2735
  if (!accounts.baseVault.value) accounts.baseVault.value = await (0, _solana_kit.getProgramDerivedAddress)({
2646
2736
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
2647
2737
  seeds: [
2648
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("pool", accounts.pool.value)),
2738
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("pool", accounts.pool.value)),
2649
2739
  (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit.address)("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb")),
2650
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value))
2740
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value))
2651
2741
  ]
2652
2742
  });
2653
2743
  if (!accounts.quoteVault.value) accounts.quoteVault.value = await (0, _solana_kit.getProgramDerivedAddress)({
2654
2744
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
2655
2745
  seeds: [
2656
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("pool", accounts.pool.value)),
2657
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
2658
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
2746
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("pool", accounts.pool.value)),
2747
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
2748
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
2659
2749
  ]
2660
2750
  });
2661
2751
  if (!accounts.userBaseAccount.value) accounts.userBaseAccount.value = await (0, _solana_kit.getProgramDerivedAddress)({
2662
2752
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
2663
2753
  seeds: [
2664
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value)),
2754
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value)),
2665
2755
  (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit.address)("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb")),
2666
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value))
2756
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value))
2667
2757
  ]
2668
2758
  });
2669
2759
  if (!accounts.userQuoteAccount.value) accounts.userQuoteAccount.value = await (0, _solana_kit.getProgramDerivedAddress)({
2670
2760
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
2671
2761
  seeds: [
2672
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value)),
2673
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
2674
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
2762
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value)),
2763
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
2764
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
2675
2765
  ]
2676
2766
  });
2677
2767
  if (!accounts.partnerConfig.value) accounts.partnerConfig.value = await (0, _solana_kit.getProgramDerivedAddress)({
@@ -2686,8 +2776,8 @@ async function getSellExactInInstructionAsync$1(input) {
2686
2776
  101,
2687
2777
  114
2688
2778
  ])),
2689
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getNonNullResolvedInstructionInput)("platformConfig", args.platformConfig)),
2690
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("partner", accounts.partner.value))
2779
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getNonNullResolvedInstructionInput)("platformConfig", args.platformConfig)),
2780
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("partner", accounts.partner.value))
2691
2781
  ]
2692
2782
  });
2693
2783
  if (!accounts.baseTokenProgram.value) accounts.baseTokenProgram.value = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";
@@ -2695,7 +2785,7 @@ async function getSellExactInInstructionAsync$1(input) {
2695
2785
  if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
2696
2786
  if (!accounts.eventAuthority.value) accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS$2;
2697
2787
  if (!accounts.program.value) accounts.program.value = "84qj5FPZZdXkQy8mfowyg6RBZ3XKuTds6XS4ZYT1sfDX";
2698
- const getAccountMeta = (0, _solana_program_client_core.getAccountMetaFactory)(programAddress, "programId");
2788
+ const getAccountMeta = (0, _solana_kit_program_client_core.getAccountMetaFactory)(programAddress, "programId");
2699
2789
  return Object.freeze({
2700
2790
  accounts: [
2701
2791
  getAccountMeta("user", accounts.user),
@@ -2798,7 +2888,7 @@ function getSellExactInInstruction$1(input) {
2798
2888
  if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
2799
2889
  if (!accounts.eventAuthority.value) accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS$2;
2800
2890
  if (!accounts.program.value) accounts.program.value = "84qj5FPZZdXkQy8mfowyg6RBZ3XKuTds6XS4ZYT1sfDX";
2801
- const getAccountMeta = (0, _solana_program_client_core.getAccountMetaFactory)(programAddress, "programId");
2891
+ const getAccountMeta = (0, _solana_kit_program_client_core.getAccountMetaFactory)(programAddress, "programId");
2802
2892
  return Object.freeze({
2803
2893
  accounts: [
2804
2894
  getAccountMeta("user", accounts.user),
@@ -2980,39 +3070,39 @@ async function getSellExactOutInstructionAsync$1(input) {
2980
3070
  };
2981
3071
  const args = { ...input };
2982
3072
  if (!accounts.pool.value) accounts.pool.value = await findPoolPda({
2983
- baseMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value),
2984
- quoteMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value)
3073
+ baseMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value),
3074
+ quoteMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value)
2985
3075
  });
2986
3076
  if (!accounts.baseVault.value) accounts.baseVault.value = await (0, _solana_kit.getProgramDerivedAddress)({
2987
3077
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
2988
3078
  seeds: [
2989
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("pool", accounts.pool.value)),
3079
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("pool", accounts.pool.value)),
2990
3080
  (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit.address)("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb")),
2991
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value))
3081
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value))
2992
3082
  ]
2993
3083
  });
2994
3084
  if (!accounts.quoteVault.value) accounts.quoteVault.value = await (0, _solana_kit.getProgramDerivedAddress)({
2995
3085
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
2996
3086
  seeds: [
2997
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("pool", accounts.pool.value)),
2998
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
2999
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
3087
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("pool", accounts.pool.value)),
3088
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
3089
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
3000
3090
  ]
3001
3091
  });
3002
3092
  if (!accounts.userBaseAccount.value) accounts.userBaseAccount.value = await (0, _solana_kit.getProgramDerivedAddress)({
3003
3093
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
3004
3094
  seeds: [
3005
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value)),
3095
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value)),
3006
3096
  (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit.address)("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb")),
3007
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value))
3097
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value))
3008
3098
  ]
3009
3099
  });
3010
3100
  if (!accounts.userQuoteAccount.value) accounts.userQuoteAccount.value = await (0, _solana_kit.getProgramDerivedAddress)({
3011
3101
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
3012
3102
  seeds: [
3013
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value)),
3014
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
3015
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
3103
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value)),
3104
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
3105
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
3016
3106
  ]
3017
3107
  });
3018
3108
  if (!accounts.partnerConfig.value) accounts.partnerConfig.value = await (0, _solana_kit.getProgramDerivedAddress)({
@@ -3027,8 +3117,8 @@ async function getSellExactOutInstructionAsync$1(input) {
3027
3117
  101,
3028
3118
  114
3029
3119
  ])),
3030
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getNonNullResolvedInstructionInput)("platformConfig", args.platformConfig)),
3031
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("partner", accounts.partner.value))
3120
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getNonNullResolvedInstructionInput)("platformConfig", args.platformConfig)),
3121
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("partner", accounts.partner.value))
3032
3122
  ]
3033
3123
  });
3034
3124
  if (!accounts.baseTokenProgram.value) accounts.baseTokenProgram.value = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";
@@ -3036,7 +3126,7 @@ async function getSellExactOutInstructionAsync$1(input) {
3036
3126
  if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
3037
3127
  if (!accounts.eventAuthority.value) accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS$2;
3038
3128
  if (!accounts.program.value) accounts.program.value = "84qj5FPZZdXkQy8mfowyg6RBZ3XKuTds6XS4ZYT1sfDX";
3039
- const getAccountMeta = (0, _solana_program_client_core.getAccountMetaFactory)(programAddress, "programId");
3129
+ const getAccountMeta = (0, _solana_kit_program_client_core.getAccountMetaFactory)(programAddress, "programId");
3040
3130
  return Object.freeze({
3041
3131
  accounts: [
3042
3132
  getAccountMeta("user", accounts.user),
@@ -3139,7 +3229,7 @@ function getSellExactOutInstruction$1(input) {
3139
3229
  if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
3140
3230
  if (!accounts.eventAuthority.value) accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS$2;
3141
3231
  if (!accounts.program.value) accounts.program.value = "84qj5FPZZdXkQy8mfowyg6RBZ3XKuTds6XS4ZYT1sfDX";
3142
- const getAccountMeta = (0, _solana_program_client_core.getAccountMetaFactory)(programAddress, "programId");
3232
+ const getAccountMeta = (0, _solana_kit_program_client_core.getAccountMetaFactory)(programAddress, "programId");
3143
3233
  return Object.freeze({
3144
3234
  accounts: [
3145
3235
  getAccountMeta("user", accounts.user),
@@ -3375,27 +3465,27 @@ function sendDexProgram() {
3375
3465
  tradeEvent: getTradeEventDecoder$1()
3376
3466
  },
3377
3467
  instructions: {
3378
- buyExactIn: (input) => (0, _solana_program_client_core.addSelfPlanAndSendFunctions)(client, getBuyExactInInstructionAsync$1({
3468
+ buyExactIn: (input) => (0, _solana_kit_program_client_core.addSelfPlanAndSendFunctions)(client, getBuyExactInInstructionAsync$1({
3379
3469
  ...input,
3380
3470
  payer: input.payer ?? client.payer
3381
3471
  })),
3382
- buyExactOut: (input) => (0, _solana_program_client_core.addSelfPlanAndSendFunctions)(client, getBuyExactOutInstructionAsync$1({
3472
+ buyExactOut: (input) => (0, _solana_kit_program_client_core.addSelfPlanAndSendFunctions)(client, getBuyExactOutInstructionAsync$1({
3383
3473
  ...input,
3384
3474
  payer: input.payer ?? client.payer
3385
3475
  })),
3386
- claimCreatorFees: (input) => (0, _solana_program_client_core.addSelfPlanAndSendFunctions)(client, getClaimCreatorFeesInstructionAsync$1({
3476
+ claimCreatorFees: (input) => (0, _solana_kit_program_client_core.addSelfPlanAndSendFunctions)(client, getClaimCreatorFeesInstructionAsync$1({
3387
3477
  ...input,
3388
3478
  payer: input.payer ?? client.payer
3389
3479
  })),
3390
- claimProtocolFees: (input) => (0, _solana_program_client_core.addSelfPlanAndSendFunctions)(client, getClaimProtocolFeesInstructionAsync$1({
3480
+ claimProtocolFees: (input) => (0, _solana_kit_program_client_core.addSelfPlanAndSendFunctions)(client, getClaimProtocolFeesInstructionAsync$1({
3391
3481
  ...input,
3392
3482
  payer: input.payer ?? client.payer
3393
3483
  })),
3394
- sellExactIn: (input) => (0, _solana_program_client_core.addSelfPlanAndSendFunctions)(client, getSellExactInInstructionAsync$1({
3484
+ sellExactIn: (input) => (0, _solana_kit_program_client_core.addSelfPlanAndSendFunctions)(client, getSellExactInInstructionAsync$1({
3395
3485
  ...input,
3396
3486
  payer: input.payer ?? client.payer
3397
3487
  })),
3398
- sellExactOut: (input) => (0, _solana_program_client_core.addSelfPlanAndSendFunctions)(client, getSellExactOutInstructionAsync$1({
3488
+ sellExactOut: (input) => (0, _solana_kit_program_client_core.addSelfPlanAndSendFunctions)(client, getSellExactOutInstructionAsync$1({
3399
3489
  ...input,
3400
3490
  payer: input.payer ?? client.payer
3401
3491
  }))
@@ -3449,12 +3539,11 @@ var amm_exports = /* @__PURE__ */ __exportAll({
3449
3539
  });
3450
3540
  const BPS_DIVISOR = 10000n;
3451
3541
  const U64_MAX = 18446744073709551615n;
3452
- /** Each call mirrors a `u64::try_from` in the Rust twin; drop one and an oversized leg fails in the encoder. */
3453
3542
  function assertU64(label, value) {
3454
3543
  if (value > U64_MAX) throw new RangeError(`${label}: overflows u64`);
3455
3544
  return value;
3456
3545
  }
3457
- /** No transfer lands exactly the requested amount; approximating one hands the program a bound it rejects. */
3546
+ /** Thrown when no transfer delivers exactly `amount` after the transfer fee. */
3458
3547
  var TransferFeeNotSettleableError = class extends RangeError {
3459
3548
  amount;
3460
3549
  mintFee;
@@ -3469,7 +3558,8 @@ function assertMintFee(fee) {
3469
3558
  assertBps("MintFee", "bps", fee.bps);
3470
3559
  if (fee.maximumFee < 0n || fee.maximumFee > U64_MAX) throw new RangeError("MintFee: maximumFee must fit a u64");
3471
3560
  }
3472
- /** Rounds up, then caps (SPL's order); swapping them lets a split booking over-credit. */
3561
+ /** Returns the transfer fee on `amount`. Rounds up, then caps at `maximumFee`, in SPL's order.
3562
+ * Returns 0 without `fee`. Throws `RangeError` if `fee` is out of range. */
3473
3563
  function feeOn(amount, fee) {
3474
3564
  if (fee === void 0) return 0n;
3475
3565
  assertMintFee(fee);
@@ -3477,11 +3567,11 @@ function feeOn(amount, fee) {
3477
3567
  const raw = ceilDiv(amount * BigInt(fee.bps), BPS_DIVISOR);
3478
3568
  return raw < fee.maximumFee ? raw : fee.maximumFee;
3479
3569
  }
3480
- /** What lands when `amount` is sent; use `grossUp` to land an exact amount. */
3570
+ /** Returns what the recipient receives when `amount` is sent. `grossUp` is the inverse. */
3481
3571
  function amountAfterFee(amount, fee) {
3482
3572
  return amount - feeOn(amount, fee);
3483
3573
  }
3484
- /** Line-for-line mirror of SPL's `TransferFee::calculate_pre_fee_amount`; `undefined` when no u64 answer exists. */
3574
+ /** Matches SPL `TransferFee::calculate_pre_fee_amount`. `undefined` if the result does not fit a u64. */
3485
3575
  function preFeeAmount(amount, fee) {
3486
3576
  const bps = BigInt(fee.bps);
3487
3577
  if (bps === 0n) return amount;
@@ -3497,7 +3587,8 @@ function preFeeAmount(amount, fee) {
3497
3587
  }
3498
3588
  return rawPreFee > U64_MAX ? void 0 : rawPreFee;
3499
3589
  }
3500
- /** What must be sent for exactly `amount` to land; throws {@link TransferFeeNotSettleableError} if none does. */
3590
+ /** Returns the amount to send so that exactly `amount` arrives. Returns `amount` without `fee`.
3591
+ * Throws {@link TransferFeeNotSettleableError} if no such amount exists. */
3501
3592
  function grossUp(amount, fee) {
3502
3593
  if (fee === void 0) return amount;
3503
3594
  assertMintFee(fee);
@@ -3520,7 +3611,8 @@ function sqrtBigInt(value) {
3520
3611
  }
3521
3612
  return x;
3522
3613
  }
3523
- /** Output rounds down (the new reserve rounds up), so `k` never shrinks. */
3614
+ /** Returns the constant-product output for `amountIn`, rounded down. Throws `RangeError` on a zero
3615
+ * reserve, a zero `amountIn`, a zero output, or an output past u64. */
3524
3616
  function calculateOutput(reserveIn, reserveOut, amountIn) {
3525
3617
  if (reserveIn === 0n || reserveOut === 0n) throw new RangeError("calculateOutput: insufficient liquidity");
3526
3618
  if (amountIn === 0n) throw new RangeError("calculateOutput: invalid amount");
@@ -3530,7 +3622,8 @@ function calculateOutput(reserveIn, reserveOut, amountIn) {
3530
3622
  if (amountOut === 0n) throw new RangeError("calculateOutput: insufficient liquidity");
3531
3623
  return assertU64("calculateOutput", amountOut);
3532
3624
  }
3533
- /** Required input rounds up so the user pays enough. */
3625
+ /** Returns the input needed for `amountOut`, rounded up. Throws `RangeError` on a zero reserve, a zero
3626
+ * `amountOut`, an `amountOut` not below `reserveOut`, or an input past u64. */
3534
3627
  function calculateInputForOutput(reserveIn, reserveOut, amountOut) {
3535
3628
  if (reserveIn === 0n || reserveOut === 0n) throw new RangeError("calculateInputForOutput: insufficient liquidity");
3536
3629
  if (amountOut === 0n || amountOut >= reserveOut) throw new RangeError("calculateInputForOutput: invalid amount");
@@ -3593,7 +3686,9 @@ function buyQuote(legs, quoteTransferFee, baseFee) {
3593
3686
  quoteFromUser: legs.quoteAmount
3594
3687
  };
3595
3688
  }
3596
- /** Guard with `calculateSlippageUp(quoteAmount, bps)`; it already carries the quote mint's cut. */
3689
+ /** Quotes a buy where the buyer receives `baseAmountOut`. With `baseReserveCap`, the vault sends at
3690
+ * most the cap. Guard with `calculateSlippageUp(quoteAmount, bps)`. `quoteAmount` includes the quote
3691
+ * mint's transfer fee. */
3597
3692
  function buyExactOut$2(params) {
3598
3693
  assertBps("buyExactOut", "feeBps", params.feeBps);
3599
3694
  if (params.baseAmountOut === 0n) throw new RangeError("buyExactOut: invalid amount");
@@ -3606,7 +3701,8 @@ function buyExactOut$2(params) {
3606
3701
  quoteAmount: quoteFromUser
3607
3702
  }, quoteFromUser - legs.quoteAmount, params.baseFee);
3608
3703
  }
3609
- /** Guard with `calculateSlippageDown(baseToUser, bps)`, not `baseAmount`: the program bounds what the buyer nets. */
3704
+ /** Quotes a buy that spends `quoteAmountIn`. Guard with `calculateSlippageDown(baseToUser, bps)`, not
3705
+ * `baseAmount`. The program checks the minimum against what the buyer receives. */
3610
3706
  function buyExactIn$2(params) {
3611
3707
  assertBps("buyExactIn", "feeBps", params.feeBps);
3612
3708
  if (params.quoteAmountIn === 0n) throw new RangeError("buyExactIn: invalid amount");
@@ -3625,7 +3721,7 @@ function buyExactIn$2(params) {
3625
3721
  quoteAmount: quoteFromUser
3626
3722
  }, quoteFromUser - capped.quoteAmount, params.baseFee);
3627
3723
  }
3628
- /** Guard with `calculateSlippageDown(quoteToUser, bps)`, not `quoteAmount`. */
3724
+ /** Quotes a sell of `baseAmountIn`. Guard with `calculateSlippageDown(quoteToUser, bps)`, not `quoteAmount`. */
3629
3725
  function sellExactIn$2(params) {
3630
3726
  assertBps("sellExactIn", "feeBps", params.feeBps);
3631
3727
  if (params.baseAmountIn === 0n) throw new RangeError("sellExactIn: invalid amount");
@@ -3643,7 +3739,8 @@ function sellExactIn$2(params) {
3643
3739
  quoteToUser: legs.quoteAmount - quoteTransferFee
3644
3740
  };
3645
3741
  }
3646
- /** Guard with `calculateSlippageUp(baseFromUser, bps)`, which already carries the base mint's cut. */
3742
+ /** Quotes a sell where the seller receives `quoteAmountOut`. Guard with
3743
+ * `calculateSlippageUp(baseFromUser, bps)`. `baseFromUser` includes the base mint's transfer fee. */
3647
3744
  function sellExactOut$2(params) {
3648
3745
  assertBps("sellExactOut", "feeBps", params.feeBps);
3649
3746
  if (params.quoteAmountOut === 0n) throw new RangeError("sellExactOut: invalid amount");
@@ -3668,17 +3765,17 @@ function calculateSlippageDown(amount, slippageBps) {
3668
3765
  assertBps("calculateSlippageDown", "slippageBps", slippageBps);
3669
3766
  return assertU64("calculateSlippageDown", floorDiv(amount * (BPS_DIVISOR - BigInt(slippageBps)), BPS_DIVISOR));
3670
3767
  }
3671
- /** Floors, as the program's `isqrt` does. */
3768
+ /** Returns `sqrt(quoteAmount * baseAmount)`, rounded down. */
3672
3769
  function calculateInitialLp(quoteAmount, baseAmount) {
3673
3770
  return sqrtBigInt(quoteAmount * baseAmount);
3674
3771
  }
3675
- /** Floating-point quote per base, for display only. */
3772
+ /** Returns the price of one base token in quote tokens, as a float. For display only. */
3676
3773
  function calculatePrice(params) {
3677
3774
  const { quoteReserves, baseReserves, quoteDecimals, baseDecimals } = params;
3678
3775
  if (baseReserves === 0n) return 0;
3679
3776
  return Number(quoteReserves) / Number(baseReserves) * 10 ** (baseDecimals - quoteDecimals);
3680
3777
  }
3681
- /** Market cap in raw quote-token units. */
3778
+ /** Returns the market cap in raw quote units. */
3682
3779
  function calculateMarketCap(params) {
3683
3780
  const { quoteReserves, baseReserves, baseSupply } = params;
3684
3781
  if (baseReserves === 0n) return 0n;
@@ -3696,7 +3793,7 @@ var trade_exports$1 = /* @__PURE__ */ __exportAll({
3696
3793
  sellExactIn: () => sellExactIn$1,
3697
3794
  sellExactOut: () => sellExactOut$1
3698
3795
  });
3699
- /** `baseAmountOut` is net to the buyer: the program reads `amount` as `base_to_user`. */
3796
+ /** `baseAmountOut` is the base the buyer receives, after the base mint's transfer fee. */
3700
3797
  async function buyExactOut$1(params) {
3701
3798
  const quote = buyExactOut$2({
3702
3799
  reserveQuote: params.quoteReserves,
@@ -3754,7 +3851,7 @@ async function sellExactIn$1(params) {
3754
3851
  quote
3755
3852
  };
3756
3853
  }
3757
- /** `quoteAmountOut` is net to the seller: the program reads `amount` as `quote_to_user`. */
3854
+ /** `quoteAmountOut` is the quote the seller receives, after the quote mint's transfer fee. */
3758
3855
  async function sellExactOut$1(params) {
3759
3856
  const quote = sellExactOut$2({
3760
3857
  reserveQuote: params.quoteReserves,
@@ -3828,6 +3925,39 @@ var dex_exports = /* @__PURE__ */ __exportAll({
3828
3925
  types: () => types_exports$2
3829
3926
  });
3830
3927
  //#endregion
3928
+ //#region src/launchpad/generated/shared/index.ts
3929
+ /** The System Program, which owns every address nobody has created an account at yet. */
3930
+ const SYSTEM_PROGRAM_ADDRESS$1 = "11111111111111111111111111111111";
3931
+ /**
3932
+ * Whether an encoded account was created on-chain, rather than merely sent lamports.
3933
+ *
3934
+ * Anyone can send lamports to an address before its account is created, which leaves it on-chain,
3935
+ * owned by the System Program, with no data. This returns `false` for that shape, as it does for an
3936
+ * account that does not exist. Any other existing account counts as created, whoever owns it; the
3937
+ * `decode*` functions still check the owner.
3938
+ *
3939
+ * The generated `fetchMaybe*` and `fetchAllMaybe*` helpers apply this rule themselves. Apply it to
3940
+ * accounts you fetch or receive another way (subscriptions, batch loaders, caches) before passing
3941
+ * them to a `decode*` function, which throws for a lamports-only account: an account passed to it as
3942
+ * existing must never come back as the non-existing variant typed as an `Account`.
3943
+ *
3944
+ * Only a `true` result narrows the type. A lamports-only account is still `exists: true` at runtime,
3945
+ * so a `false` result leaves the type unchanged instead of narrowing it to the non-existing variant.
3946
+ * The `uncreated` property in the narrowed type is never present; it exists only to prevent that.
3947
+ *
3948
+ * @example
3949
+ * ```ts
3950
+ * const maybeAccount = decodeMyAccount(
3951
+ * accountIsCreated(encodedAccount) ? encodedAccount : { address: encodedAccount.address, exists: false },
3952
+ * );
3953
+ * ```
3954
+ */
3955
+ function accountIsCreated$1(account) {
3956
+ const maybeAccount = account;
3957
+ if ("exists" in maybeAccount && !maybeAccount.exists) return false;
3958
+ return !(maybeAccount.programAddress === SYSTEM_PROGRAM_ADDRESS$1 && maybeAccount.data.length === 0);
3959
+ }
3960
+ //#endregion
3831
3961
  //#region src/launchpad/generated/types/bondingCurveStatus.ts
3832
3962
  /**
3833
3963
  * This code was AUTOGENERATED using the Codama library.
@@ -3993,21 +4123,40 @@ function decodeBondingCurve(encodedAccount) {
3993
4123
  }
3994
4124
  return (0, _solana_kit.decodeAccount)(encodedAccount, getBondingCurveDecoder());
3995
4125
  }
4126
+ /** Fetches a `BondingCurve` account, throwing when it does not exist or only holds lamports. */
3996
4127
  async function fetchBondingCurve(rpc, address, config) {
3997
4128
  const maybeAccount = await fetchMaybeBondingCurve(rpc, address, config);
3998
4129
  (0, _solana_kit.assertAccountExists)(maybeAccount);
3999
4130
  return maybeAccount;
4000
4131
  }
4132
+ /**
4133
+ * Fetches a `BondingCurve` account, or the non-existing variant when the address holds no
4134
+ * account or only lamports (see {@link accountIsCreated}).
4135
+ * {@link decodeBondingCurve} throws for a lamports-only account instead.
4136
+ */
4001
4137
  async function fetchMaybeBondingCurve(rpc, address, config) {
4002
- return decodeBondingCurve(await (0, _solana_kit.fetchEncodedAccount)(rpc, address, config));
4138
+ const maybeAccount = await (0, _solana_kit.fetchEncodedAccount)(rpc, address, config);
4139
+ return decodeBondingCurve(accountIsCreated$1(maybeAccount) ? maybeAccount : {
4140
+ address,
4141
+ exists: false
4142
+ });
4003
4143
  }
4144
+ /** Fetches `BondingCurve` accounts, throwing when any does not exist or only holds lamports. */
4004
4145
  async function fetchAllBondingCurve(rpc, addresses, config) {
4005
4146
  const maybeAccounts = await fetchAllMaybeBondingCurve(rpc, addresses, config);
4006
4147
  (0, _solana_kit.assertAccountsExist)(maybeAccounts);
4007
4148
  return maybeAccounts;
4008
4149
  }
4150
+ /**
4151
+ * Fetches `BondingCurve` accounts, with the non-existing variant for each address that holds
4152
+ * no account or only lamports (see {@link accountIsCreated}).
4153
+ * {@link decodeBondingCurve} throws for a lamports-only account instead.
4154
+ */
4009
4155
  async function fetchAllMaybeBondingCurve(rpc, addresses, config) {
4010
- return (await (0, _solana_kit.fetchEncodedAccounts)(rpc, addresses, config)).map((maybeAccount) => decodeBondingCurve(maybeAccount));
4156
+ return (await (0, _solana_kit.fetchEncodedAccounts)(rpc, addresses, config)).map((maybeAccount) => decodeBondingCurve(accountIsCreated$1(maybeAccount) ? maybeAccount : {
4157
+ address: maybeAccount.address,
4158
+ exists: false
4159
+ }));
4011
4160
  }
4012
4161
  function getBondingCurveSize() {
4013
4162
  return 421;
@@ -4090,21 +4239,40 @@ function decodeGlobalConfig$1(encodedAccount) {
4090
4239
  }
4091
4240
  return (0, _solana_kit.decodeAccount)(encodedAccount, getGlobalConfigDecoder$1());
4092
4241
  }
4242
+ /** Fetches a `GlobalConfig` account, throwing when it does not exist or only holds lamports. */
4093
4243
  async function fetchGlobalConfig$1(rpc, address, config) {
4094
4244
  const maybeAccount = await fetchMaybeGlobalConfig$1(rpc, address, config);
4095
4245
  (0, _solana_kit.assertAccountExists)(maybeAccount);
4096
4246
  return maybeAccount;
4097
4247
  }
4248
+ /**
4249
+ * Fetches a `GlobalConfig` account, or the non-existing variant when the address holds no
4250
+ * account or only lamports (see {@link accountIsCreated}).
4251
+ * {@link decodeGlobalConfig} throws for a lamports-only account instead.
4252
+ */
4098
4253
  async function fetchMaybeGlobalConfig$1(rpc, address, config) {
4099
- return decodeGlobalConfig$1(await (0, _solana_kit.fetchEncodedAccount)(rpc, address, config));
4254
+ const maybeAccount = await (0, _solana_kit.fetchEncodedAccount)(rpc, address, config);
4255
+ return decodeGlobalConfig$1(accountIsCreated$1(maybeAccount) ? maybeAccount : {
4256
+ address,
4257
+ exists: false
4258
+ });
4100
4259
  }
4260
+ /** Fetches `GlobalConfig` accounts, throwing when any does not exist or only holds lamports. */
4101
4261
  async function fetchAllGlobalConfig$1(rpc, addresses, config) {
4102
4262
  const maybeAccounts = await fetchAllMaybeGlobalConfig$1(rpc, addresses, config);
4103
4263
  (0, _solana_kit.assertAccountsExist)(maybeAccounts);
4104
4264
  return maybeAccounts;
4105
4265
  }
4266
+ /**
4267
+ * Fetches `GlobalConfig` accounts, with the non-existing variant for each address that holds
4268
+ * no account or only lamports (see {@link accountIsCreated}).
4269
+ * {@link decodeGlobalConfig} throws for a lamports-only account instead.
4270
+ */
4106
4271
  async function fetchAllMaybeGlobalConfig$1(rpc, addresses, config) {
4107
- return (await (0, _solana_kit.fetchEncodedAccounts)(rpc, addresses, config)).map((maybeAccount) => decodeGlobalConfig$1(maybeAccount));
4272
+ return (await (0, _solana_kit.fetchEncodedAccounts)(rpc, addresses, config)).map((maybeAccount) => decodeGlobalConfig$1(accountIsCreated$1(maybeAccount) ? maybeAccount : {
4273
+ address: maybeAccount.address,
4274
+ exists: false
4275
+ }));
4108
4276
  }
4109
4277
  function getGlobalConfigSize() {
4110
4278
  return 179;
@@ -4177,21 +4345,40 @@ function decodeRewardAccrual(encodedAccount) {
4177
4345
  }
4178
4346
  return (0, _solana_kit.decodeAccount)(encodedAccount, getRewardAccrualDecoder());
4179
4347
  }
4348
+ /** Fetches a `RewardAccrual` account, throwing when it does not exist or only holds lamports. */
4180
4349
  async function fetchRewardAccrual(rpc, address, config) {
4181
4350
  const maybeAccount = await fetchMaybeRewardAccrual(rpc, address, config);
4182
4351
  (0, _solana_kit.assertAccountExists)(maybeAccount);
4183
4352
  return maybeAccount;
4184
4353
  }
4354
+ /**
4355
+ * Fetches a `RewardAccrual` account, or the non-existing variant when the address holds no
4356
+ * account or only lamports (see {@link accountIsCreated}).
4357
+ * {@link decodeRewardAccrual} throws for a lamports-only account instead.
4358
+ */
4185
4359
  async function fetchMaybeRewardAccrual(rpc, address, config) {
4186
- return decodeRewardAccrual(await (0, _solana_kit.fetchEncodedAccount)(rpc, address, config));
4360
+ const maybeAccount = await (0, _solana_kit.fetchEncodedAccount)(rpc, address, config);
4361
+ return decodeRewardAccrual(accountIsCreated$1(maybeAccount) ? maybeAccount : {
4362
+ address,
4363
+ exists: false
4364
+ });
4187
4365
  }
4366
+ /** Fetches `RewardAccrual` accounts, throwing when any does not exist or only holds lamports. */
4188
4367
  async function fetchAllRewardAccrual(rpc, addresses, config) {
4189
4368
  const maybeAccounts = await fetchAllMaybeRewardAccrual(rpc, addresses, config);
4190
4369
  (0, _solana_kit.assertAccountsExist)(maybeAccounts);
4191
4370
  return maybeAccounts;
4192
4371
  }
4372
+ /**
4373
+ * Fetches `RewardAccrual` accounts, with the non-existing variant for each address that holds
4374
+ * no account or only lamports (see {@link accountIsCreated}).
4375
+ * {@link decodeRewardAccrual} throws for a lamports-only account instead.
4376
+ */
4193
4377
  async function fetchAllMaybeRewardAccrual(rpc, addresses, config) {
4194
- return (await (0, _solana_kit.fetchEncodedAccounts)(rpc, addresses, config)).map((maybeAccount) => decodeRewardAccrual(maybeAccount));
4378
+ return (await (0, _solana_kit.fetchEncodedAccounts)(rpc, addresses, config)).map((maybeAccount) => decodeRewardAccrual(accountIsCreated$1(maybeAccount) ? maybeAccount : {
4379
+ address: maybeAccount.address,
4380
+ exists: false
4381
+ }));
4195
4382
  }
4196
4383
  function getRewardAccrualSize() {
4197
4384
  return 130;
@@ -4515,7 +4702,8 @@ var pdas_exports$1 = /* @__PURE__ */ __exportAll({
4515
4702
  //#endregion
4516
4703
  //#region src/utils/creator-hash.ts
4517
4704
  const MAX_CREATOR_PLATFORM_LEN = 32;
4518
- /** SHA-256 of the LE-u32-length-prefixed platform and id. Frozen: it seeds live PDAs. */
4705
+ /** Returns the SHA-256 of `creatorPlatform` and `creatorId`, each prefixed with its byte length as a
4706
+ * little-endian u32. Throws `RangeError` if `creatorPlatform` is more than 32 bytes. */
4519
4707
  async function creatorHashFromId(creatorPlatform, creatorId) {
4520
4708
  const encoder = new TextEncoder();
4521
4709
  const platformBuf = encoder.encode(creatorPlatform);
@@ -4533,7 +4721,8 @@ async function creatorHashFromId(creatorPlatform, creatorId) {
4533
4721
  const hash = new Uint8Array(await crypto.subtle.digest("SHA-256", buf));
4534
4722
  return (0, _solana_kit.getAddressDecoder)().decode(hash);
4535
4723
  }
4536
- /** NUL-pads `text` to `length` bytes, the on-chain `CreatorFeeConfig.platformId` form; throws RangeError if longer. */
4724
+ /** Pads `text` with NUL bytes to `length` bytes, the form of `CreatorFeeConfig.platformId`.
4725
+ * Throws `RangeError` if `text` is longer. */
4537
4726
  function encodeCreatorId(text, length) {
4538
4727
  const bytes = new TextEncoder().encode(text);
4539
4728
  if (bytes.length > length) throw new RangeError(`text exceeds ${length} bytes (got ${bytes.length})`);
@@ -4541,7 +4730,8 @@ function encodeCreatorId(text, length) {
4541
4730
  out.set(bytes, 0);
4542
4731
  return out;
4543
4732
  }
4544
- /** Strips NUL padding. Pass this, never the padded array, to {@link creatorHashFromId}: the hash is length-prefixed. */
4733
+ /** Removes the trailing NUL bytes and decodes the rest as UTF-8. Pass the result, not the padded
4734
+ * bytes, to {@link creatorHashFromId}. */
4545
4735
  function decodeCreatorId(bytes) {
4546
4736
  let end = bytes.length;
4547
4737
  while (end > 0 && bytes[end - 1] === 0) end -= 1;
@@ -4757,23 +4947,23 @@ async function getCreateTokenInstructionAsync(input) {
4757
4947
  const args = { ...input };
4758
4948
  if (!accounts.globalConfig.value) accounts.globalConfig.value = GLOBAL_CONFIG_PDA_ADDRESS$1;
4759
4949
  if (!accounts.bondingCurve.value) accounts.bondingCurve.value = await findBondingCurvePda({
4760
- baseMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value),
4761
- quoteMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value)
4950
+ baseMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value),
4951
+ quoteMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value)
4762
4952
  });
4763
4953
  if (!accounts.baseVault.value) accounts.baseVault.value = await (0, _solana_kit.getProgramDerivedAddress)({
4764
4954
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
4765
4955
  seeds: [
4766
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("bondingCurve", accounts.bondingCurve.value)),
4956
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("bondingCurve", accounts.bondingCurve.value)),
4767
4957
  (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit.address)("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb")),
4768
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value))
4958
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value))
4769
4959
  ]
4770
4960
  });
4771
4961
  if (!accounts.quoteVault.value) accounts.quoteVault.value = await (0, _solana_kit.getProgramDerivedAddress)({
4772
4962
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
4773
4963
  seeds: [
4774
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("bondingCurve", accounts.bondingCurve.value)),
4775
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
4776
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
4964
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("bondingCurve", accounts.bondingCurve.value)),
4965
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
4966
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
4777
4967
  ]
4778
4968
  });
4779
4969
  if (!accounts.creatorFeeConfig.value) accounts.creatorFeeConfig.value = await (0, _solana_kit.getProgramDerivedAddress)({
@@ -4800,8 +4990,8 @@ async function getCreateTokenInstructionAsync(input) {
4800
4990
  99,
4801
4991
  101
4802
4992
  ])),
4803
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getNonNullResolvedInstructionInput)("creatorHash", args.creatorHash)),
4804
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
4993
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getNonNullResolvedInstructionInput)("creatorHash", args.creatorHash)),
4994
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
4805
4995
  ]
4806
4996
  });
4807
4997
  if (!accounts.nexusProgram.value) accounts.nexusProgram.value = "7rrCurqdWFesbzwtYPo95fM8waTtVXgXwCom45x1sfNX";
@@ -4818,8 +5008,8 @@ async function getCreateTokenInstructionAsync(input) {
4818
5008
  101,
4819
5009
  114
4820
5010
  ])),
4821
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getNonNullResolvedInstructionInput)("platformConfig", args.platformConfig)),
4822
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("partner", accounts.partner.value))
5011
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getNonNullResolvedInstructionInput)("platformConfig", args.platformConfig)),
5012
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("partner", accounts.partner.value))
4823
5013
  ]
4824
5014
  });
4825
5015
  if (!accounts.nexusStakingConfig.value) accounts.nexusStakingConfig.value = "9WUowYRb6KAWjWVB5KMmTngBidZXEXgQcQRTXbhxeGbF";
@@ -4834,17 +5024,17 @@ async function getCreateTokenInstructionAsync(input) {
4834
5024
  114,
4835
5025
  100
4836
5026
  ])),
4837
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("nexusStakingConfig", accounts.nexusStakingConfig.value)),
4838
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
5027
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("nexusStakingConfig", accounts.nexusStakingConfig.value)),
5028
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
4839
5029
  ]
4840
5030
  });
4841
- if (!accounts.rewardAccrual.value) accounts.rewardAccrual.value = await findRewardAccrualPda({ quoteMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value) });
5031
+ if (!accounts.rewardAccrual.value) accounts.rewardAccrual.value = await findRewardAccrualPda({ quoteMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value) });
4842
5032
  if (!accounts.stakingVault.value) accounts.stakingVault.value = await (0, _solana_kit.getProgramDerivedAddress)({
4843
5033
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
4844
5034
  seeds: [
4845
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("nexusStakingConfig", accounts.nexusStakingConfig.value)),
4846
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
4847
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
5035
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("nexusStakingConfig", accounts.nexusStakingConfig.value)),
5036
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
5037
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
4848
5038
  ]
4849
5039
  });
4850
5040
  if (!accounts.stakingWsolVault.value) accounts.stakingWsolVault.value = "AyisZJxXz9ywXhMwR3sb3oePxBB6UBvixXycAQCdSgrz";
@@ -4856,7 +5046,7 @@ async function getCreateTokenInstructionAsync(input) {
4856
5046
  if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
4857
5047
  if (!accounts.eventAuthority.value) accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS$1;
4858
5048
  if (!accounts.program.value) accounts.program.value = "5R1uFyEE4oxqkm7hJDqHq6gXaLVF9dxeF3LF4yz1sfLP";
4859
- const getAccountMeta = (0, _solana_program_client_core.getAccountMetaFactory)(programAddress, "programId");
5049
+ const getAccountMeta = (0, _solana_kit_program_client_core.getAccountMetaFactory)(programAddress, "programId");
4860
5050
  return Object.freeze({
4861
5051
  accounts: [
4862
5052
  getAccountMeta("user", accounts.user),
@@ -5022,7 +5212,7 @@ function getCreateTokenInstruction(input) {
5022
5212
  if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
5023
5213
  if (!accounts.eventAuthority.value) accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS$1;
5024
5214
  if (!accounts.program.value) accounts.program.value = "5R1uFyEE4oxqkm7hJDqHq6gXaLVF9dxeF3LF4yz1sfLP";
5025
- const getAccountMeta = (0, _solana_program_client_core.getAccountMetaFactory)(programAddress, "programId");
5215
+ const getAccountMeta = (0, _solana_kit_program_client_core.getAccountMetaFactory)(programAddress, "programId");
5026
5216
  return Object.freeze({
5027
5217
  accounts: [
5028
5218
  getAccountMeta("user", accounts.user),
@@ -5226,39 +5416,39 @@ async function getBuyExactInInstructionAsync(input) {
5226
5416
  };
5227
5417
  const args = { ...input };
5228
5418
  if (!accounts.bondingCurve.value) accounts.bondingCurve.value = await findBondingCurvePda({
5229
- baseMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value),
5230
- quoteMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value)
5419
+ baseMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value),
5420
+ quoteMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value)
5231
5421
  });
5232
5422
  if (!accounts.baseVault.value) accounts.baseVault.value = await (0, _solana_kit.getProgramDerivedAddress)({
5233
5423
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
5234
5424
  seeds: [
5235
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("bondingCurve", accounts.bondingCurve.value)),
5425
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("bondingCurve", accounts.bondingCurve.value)),
5236
5426
  (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit.address)("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb")),
5237
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value))
5427
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value))
5238
5428
  ]
5239
5429
  });
5240
5430
  if (!accounts.quoteVault.value) accounts.quoteVault.value = await (0, _solana_kit.getProgramDerivedAddress)({
5241
5431
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
5242
5432
  seeds: [
5243
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("bondingCurve", accounts.bondingCurve.value)),
5244
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
5245
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
5433
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("bondingCurve", accounts.bondingCurve.value)),
5434
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
5435
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
5246
5436
  ]
5247
5437
  });
5248
5438
  if (!accounts.userBaseAccount.value) accounts.userBaseAccount.value = await (0, _solana_kit.getProgramDerivedAddress)({
5249
5439
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
5250
5440
  seeds: [
5251
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value)),
5441
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value)),
5252
5442
  (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit.address)("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb")),
5253
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value))
5443
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value))
5254
5444
  ]
5255
5445
  });
5256
5446
  if (!accounts.userQuoteAccount.value) accounts.userQuoteAccount.value = await (0, _solana_kit.getProgramDerivedAddress)({
5257
5447
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
5258
5448
  seeds: [
5259
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value)),
5260
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
5261
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
5449
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value)),
5450
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
5451
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
5262
5452
  ]
5263
5453
  });
5264
5454
  if (!accounts.partnerConfig.value) accounts.partnerConfig.value = await (0, _solana_kit.getProgramDerivedAddress)({
@@ -5273,8 +5463,8 @@ async function getBuyExactInInstructionAsync(input) {
5273
5463
  101,
5274
5464
  114
5275
5465
  ])),
5276
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getNonNullResolvedInstructionInput)("platformConfig", args.platformConfig)),
5277
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("partner", accounts.partner.value))
5466
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getNonNullResolvedInstructionInput)("platformConfig", args.platformConfig)),
5467
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("partner", accounts.partner.value))
5278
5468
  ]
5279
5469
  });
5280
5470
  if (!accounts.baseTokenProgram.value) accounts.baseTokenProgram.value = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";
@@ -5282,7 +5472,7 @@ async function getBuyExactInInstructionAsync(input) {
5282
5472
  if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
5283
5473
  if (!accounts.eventAuthority.value) accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS$1;
5284
5474
  if (!accounts.program.value) accounts.program.value = "5R1uFyEE4oxqkm7hJDqHq6gXaLVF9dxeF3LF4yz1sfLP";
5285
- const getAccountMeta = (0, _solana_program_client_core.getAccountMetaFactory)(programAddress, "programId");
5475
+ const getAccountMeta = (0, _solana_kit_program_client_core.getAccountMetaFactory)(programAddress, "programId");
5286
5476
  return Object.freeze({
5287
5477
  accounts: [
5288
5478
  getAccountMeta("user", accounts.user),
@@ -5385,7 +5575,7 @@ function getBuyExactInInstruction(input) {
5385
5575
  if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
5386
5576
  if (!accounts.eventAuthority.value) accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS$1;
5387
5577
  if (!accounts.program.value) accounts.program.value = "5R1uFyEE4oxqkm7hJDqHq6gXaLVF9dxeF3LF4yz1sfLP";
5388
- const getAccountMeta = (0, _solana_program_client_core.getAccountMetaFactory)(programAddress, "programId");
5578
+ const getAccountMeta = (0, _solana_kit_program_client_core.getAccountMetaFactory)(programAddress, "programId");
5389
5579
  return Object.freeze({
5390
5580
  accounts: [
5391
5581
  getAccountMeta("user", accounts.user),
@@ -5567,39 +5757,39 @@ async function getBuyExactOutInstructionAsync(input) {
5567
5757
  };
5568
5758
  const args = { ...input };
5569
5759
  if (!accounts.bondingCurve.value) accounts.bondingCurve.value = await findBondingCurvePda({
5570
- baseMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value),
5571
- quoteMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value)
5760
+ baseMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value),
5761
+ quoteMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value)
5572
5762
  });
5573
5763
  if (!accounts.baseVault.value) accounts.baseVault.value = await (0, _solana_kit.getProgramDerivedAddress)({
5574
5764
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
5575
5765
  seeds: [
5576
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("bondingCurve", accounts.bondingCurve.value)),
5766
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("bondingCurve", accounts.bondingCurve.value)),
5577
5767
  (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit.address)("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb")),
5578
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value))
5768
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value))
5579
5769
  ]
5580
5770
  });
5581
5771
  if (!accounts.quoteVault.value) accounts.quoteVault.value = await (0, _solana_kit.getProgramDerivedAddress)({
5582
5772
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
5583
5773
  seeds: [
5584
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("bondingCurve", accounts.bondingCurve.value)),
5585
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
5586
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
5774
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("bondingCurve", accounts.bondingCurve.value)),
5775
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
5776
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
5587
5777
  ]
5588
5778
  });
5589
5779
  if (!accounts.userBaseAccount.value) accounts.userBaseAccount.value = await (0, _solana_kit.getProgramDerivedAddress)({
5590
5780
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
5591
5781
  seeds: [
5592
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value)),
5782
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value)),
5593
5783
  (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit.address)("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb")),
5594
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value))
5784
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value))
5595
5785
  ]
5596
5786
  });
5597
5787
  if (!accounts.userQuoteAccount.value) accounts.userQuoteAccount.value = await (0, _solana_kit.getProgramDerivedAddress)({
5598
5788
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
5599
5789
  seeds: [
5600
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value)),
5601
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
5602
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
5790
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value)),
5791
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
5792
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
5603
5793
  ]
5604
5794
  });
5605
5795
  if (!accounts.partnerConfig.value) accounts.partnerConfig.value = await (0, _solana_kit.getProgramDerivedAddress)({
@@ -5614,8 +5804,8 @@ async function getBuyExactOutInstructionAsync(input) {
5614
5804
  101,
5615
5805
  114
5616
5806
  ])),
5617
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getNonNullResolvedInstructionInput)("platformConfig", args.platformConfig)),
5618
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("partner", accounts.partner.value))
5807
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getNonNullResolvedInstructionInput)("platformConfig", args.platformConfig)),
5808
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("partner", accounts.partner.value))
5619
5809
  ]
5620
5810
  });
5621
5811
  if (!accounts.baseTokenProgram.value) accounts.baseTokenProgram.value = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";
@@ -5623,7 +5813,7 @@ async function getBuyExactOutInstructionAsync(input) {
5623
5813
  if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
5624
5814
  if (!accounts.eventAuthority.value) accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS$1;
5625
5815
  if (!accounts.program.value) accounts.program.value = "5R1uFyEE4oxqkm7hJDqHq6gXaLVF9dxeF3LF4yz1sfLP";
5626
- const getAccountMeta = (0, _solana_program_client_core.getAccountMetaFactory)(programAddress, "programId");
5816
+ const getAccountMeta = (0, _solana_kit_program_client_core.getAccountMetaFactory)(programAddress, "programId");
5627
5817
  return Object.freeze({
5628
5818
  accounts: [
5629
5819
  getAccountMeta("user", accounts.user),
@@ -5726,7 +5916,7 @@ function getBuyExactOutInstruction(input) {
5726
5916
  if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
5727
5917
  if (!accounts.eventAuthority.value) accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS$1;
5728
5918
  if (!accounts.program.value) accounts.program.value = "5R1uFyEE4oxqkm7hJDqHq6gXaLVF9dxeF3LF4yz1sfLP";
5729
- const getAccountMeta = (0, _solana_program_client_core.getAccountMetaFactory)(programAddress, "programId");
5919
+ const getAccountMeta = (0, _solana_kit_program_client_core.getAccountMetaFactory)(programAddress, "programId");
5730
5920
  return Object.freeze({
5731
5921
  accounts: [
5732
5922
  getAccountMeta("user", accounts.user),
@@ -5908,39 +6098,39 @@ async function getSellExactInInstructionAsync(input) {
5908
6098
  };
5909
6099
  const args = { ...input };
5910
6100
  if (!accounts.bondingCurve.value) accounts.bondingCurve.value = await findBondingCurvePda({
5911
- baseMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value),
5912
- quoteMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value)
6101
+ baseMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value),
6102
+ quoteMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value)
5913
6103
  });
5914
6104
  if (!accounts.baseVault.value) accounts.baseVault.value = await (0, _solana_kit.getProgramDerivedAddress)({
5915
6105
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
5916
6106
  seeds: [
5917
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("bondingCurve", accounts.bondingCurve.value)),
6107
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("bondingCurve", accounts.bondingCurve.value)),
5918
6108
  (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit.address)("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb")),
5919
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value))
6109
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value))
5920
6110
  ]
5921
6111
  });
5922
6112
  if (!accounts.quoteVault.value) accounts.quoteVault.value = await (0, _solana_kit.getProgramDerivedAddress)({
5923
6113
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
5924
6114
  seeds: [
5925
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("bondingCurve", accounts.bondingCurve.value)),
5926
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
5927
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
6115
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("bondingCurve", accounts.bondingCurve.value)),
6116
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
6117
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
5928
6118
  ]
5929
6119
  });
5930
6120
  if (!accounts.userBaseAccount.value) accounts.userBaseAccount.value = await (0, _solana_kit.getProgramDerivedAddress)({
5931
6121
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
5932
6122
  seeds: [
5933
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value)),
6123
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value)),
5934
6124
  (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit.address)("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb")),
5935
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value))
6125
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value))
5936
6126
  ]
5937
6127
  });
5938
6128
  if (!accounts.userQuoteAccount.value) accounts.userQuoteAccount.value = await (0, _solana_kit.getProgramDerivedAddress)({
5939
6129
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
5940
6130
  seeds: [
5941
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value)),
5942
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
5943
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
6131
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value)),
6132
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
6133
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
5944
6134
  ]
5945
6135
  });
5946
6136
  if (!accounts.partnerConfig.value) accounts.partnerConfig.value = await (0, _solana_kit.getProgramDerivedAddress)({
@@ -5955,8 +6145,8 @@ async function getSellExactInInstructionAsync(input) {
5955
6145
  101,
5956
6146
  114
5957
6147
  ])),
5958
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getNonNullResolvedInstructionInput)("platformConfig", args.platformConfig)),
5959
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("partner", accounts.partner.value))
6148
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getNonNullResolvedInstructionInput)("platformConfig", args.platformConfig)),
6149
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("partner", accounts.partner.value))
5960
6150
  ]
5961
6151
  });
5962
6152
  if (!accounts.baseTokenProgram.value) accounts.baseTokenProgram.value = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";
@@ -5964,7 +6154,7 @@ async function getSellExactInInstructionAsync(input) {
5964
6154
  if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
5965
6155
  if (!accounts.eventAuthority.value) accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS$1;
5966
6156
  if (!accounts.program.value) accounts.program.value = "5R1uFyEE4oxqkm7hJDqHq6gXaLVF9dxeF3LF4yz1sfLP";
5967
- const getAccountMeta = (0, _solana_program_client_core.getAccountMetaFactory)(programAddress, "programId");
6157
+ const getAccountMeta = (0, _solana_kit_program_client_core.getAccountMetaFactory)(programAddress, "programId");
5968
6158
  return Object.freeze({
5969
6159
  accounts: [
5970
6160
  getAccountMeta("user", accounts.user),
@@ -6067,7 +6257,7 @@ function getSellExactInInstruction(input) {
6067
6257
  if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
6068
6258
  if (!accounts.eventAuthority.value) accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS$1;
6069
6259
  if (!accounts.program.value) accounts.program.value = "5R1uFyEE4oxqkm7hJDqHq6gXaLVF9dxeF3LF4yz1sfLP";
6070
- const getAccountMeta = (0, _solana_program_client_core.getAccountMetaFactory)(programAddress, "programId");
6260
+ const getAccountMeta = (0, _solana_kit_program_client_core.getAccountMetaFactory)(programAddress, "programId");
6071
6261
  return Object.freeze({
6072
6262
  accounts: [
6073
6263
  getAccountMeta("user", accounts.user),
@@ -6249,39 +6439,39 @@ async function getSellExactOutInstructionAsync(input) {
6249
6439
  };
6250
6440
  const args = { ...input };
6251
6441
  if (!accounts.bondingCurve.value) accounts.bondingCurve.value = await findBondingCurvePda({
6252
- baseMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value),
6253
- quoteMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value)
6442
+ baseMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value),
6443
+ quoteMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value)
6254
6444
  });
6255
6445
  if (!accounts.baseVault.value) accounts.baseVault.value = await (0, _solana_kit.getProgramDerivedAddress)({
6256
6446
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
6257
6447
  seeds: [
6258
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("bondingCurve", accounts.bondingCurve.value)),
6448
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("bondingCurve", accounts.bondingCurve.value)),
6259
6449
  (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit.address)("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb")),
6260
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value))
6450
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value))
6261
6451
  ]
6262
6452
  });
6263
6453
  if (!accounts.quoteVault.value) accounts.quoteVault.value = await (0, _solana_kit.getProgramDerivedAddress)({
6264
6454
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
6265
6455
  seeds: [
6266
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("bondingCurve", accounts.bondingCurve.value)),
6267
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
6268
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
6456
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("bondingCurve", accounts.bondingCurve.value)),
6457
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
6458
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
6269
6459
  ]
6270
6460
  });
6271
6461
  if (!accounts.userBaseAccount.value) accounts.userBaseAccount.value = await (0, _solana_kit.getProgramDerivedAddress)({
6272
6462
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
6273
6463
  seeds: [
6274
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value)),
6464
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value)),
6275
6465
  (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit.address)("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb")),
6276
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value))
6466
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value))
6277
6467
  ]
6278
6468
  });
6279
6469
  if (!accounts.userQuoteAccount.value) accounts.userQuoteAccount.value = await (0, _solana_kit.getProgramDerivedAddress)({
6280
6470
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
6281
6471
  seeds: [
6282
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value)),
6283
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
6284
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
6472
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value)),
6473
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
6474
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
6285
6475
  ]
6286
6476
  });
6287
6477
  if (!accounts.partnerConfig.value) accounts.partnerConfig.value = await (0, _solana_kit.getProgramDerivedAddress)({
@@ -6296,8 +6486,8 @@ async function getSellExactOutInstructionAsync(input) {
6296
6486
  101,
6297
6487
  114
6298
6488
  ])),
6299
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getNonNullResolvedInstructionInput)("platformConfig", args.platformConfig)),
6300
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("partner", accounts.partner.value))
6489
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getNonNullResolvedInstructionInput)("platformConfig", args.platformConfig)),
6490
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("partner", accounts.partner.value))
6301
6491
  ]
6302
6492
  });
6303
6493
  if (!accounts.baseTokenProgram.value) accounts.baseTokenProgram.value = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";
@@ -6305,7 +6495,7 @@ async function getSellExactOutInstructionAsync(input) {
6305
6495
  if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
6306
6496
  if (!accounts.eventAuthority.value) accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS$1;
6307
6497
  if (!accounts.program.value) accounts.program.value = "5R1uFyEE4oxqkm7hJDqHq6gXaLVF9dxeF3LF4yz1sfLP";
6308
- const getAccountMeta = (0, _solana_program_client_core.getAccountMetaFactory)(programAddress, "programId");
6498
+ const getAccountMeta = (0, _solana_kit_program_client_core.getAccountMetaFactory)(programAddress, "programId");
6309
6499
  return Object.freeze({
6310
6500
  accounts: [
6311
6501
  getAccountMeta("user", accounts.user),
@@ -6408,7 +6598,7 @@ function getSellExactOutInstruction(input) {
6408
6598
  if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
6409
6599
  if (!accounts.eventAuthority.value) accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS$1;
6410
6600
  if (!accounts.program.value) accounts.program.value = "5R1uFyEE4oxqkm7hJDqHq6gXaLVF9dxeF3LF4yz1sfLP";
6411
- const getAccountMeta = (0, _solana_program_client_core.getAccountMetaFactory)(programAddress, "programId");
6601
+ const getAccountMeta = (0, _solana_kit_program_client_core.getAccountMetaFactory)(programAddress, "programId");
6412
6602
  return Object.freeze({
6413
6603
  accounts: [
6414
6604
  getAccountMeta("user", accounts.user),
@@ -6487,7 +6677,8 @@ var trade_exports = /* @__PURE__ */ __exportAll({
6487
6677
  sellExactIn: () => sellExactIn,
6488
6678
  sellExactOut: () => sellExactOut
6489
6679
  });
6490
- /** `baseAmountOut` is net to the buyer: the program reads `amount` as `base_to_user`. */
6680
+ /** `baseAmountOut` is the base the buyer receives, after the base mint's transfer fee.
6681
+ * The buy is capped at the curve's supply left. Read the result from `quote.baseToUser`. */
6491
6682
  async function buyExactOut(params) {
6492
6683
  const quote = buyExactOut$2({
6493
6684
  reserveQuote: params.virtualQuoteReserves,
@@ -6547,7 +6738,7 @@ async function sellExactIn(params) {
6547
6738
  quote
6548
6739
  };
6549
6740
  }
6550
- /** `quoteAmountOut` is net to the seller: the program reads `amount` as `quote_to_user`. */
6741
+ /** `quoteAmountOut` is the quote the seller receives, after the quote mint's transfer fee. */
6551
6742
  async function sellExactOut(params) {
6552
6743
  const quote = sellExactOut$2({
6553
6744
  reserveQuote: params.virtualQuoteReserves,
@@ -6595,7 +6786,7 @@ async function buildSellExactOutInstruction(params) {
6595
6786
  maxAmountIn: params.maxAmountIn
6596
6787
  });
6597
6788
  }
6598
- /** Percent of the curve's real base sold (0-100); 100 is the migration threshold. */
6789
+ /** Returns the percent of the curve's real base sold, from 0 to 100. At 100 the curve can migrate. */
6599
6790
  function calculateBondingCurveProgress(params) {
6600
6791
  const { realBaseReserves, initialRealBase } = params;
6601
6792
  if (initialRealBase === 0n) return 100;
@@ -7441,31 +7632,31 @@ async function getClaimCreatorFeesInstructionAsync(input) {
7441
7632
  }
7442
7633
  };
7443
7634
  if (!accounts.bondingCurve.value) accounts.bondingCurve.value = await findBondingCurvePda({
7444
- baseMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value),
7445
- quoteMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value)
7635
+ baseMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value),
7636
+ quoteMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value)
7446
7637
  });
7447
7638
  if (!accounts.nexusGlobalConfig.value) accounts.nexusGlobalConfig.value = "3bycfBeRULfXYqcg3DmiYFBjv6mMVidMuqKdFZJTGdNr";
7448
7639
  if (!accounts.quoteVault.value) accounts.quoteVault.value = await (0, _solana_kit.getProgramDerivedAddress)({
7449
7640
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
7450
7641
  seeds: [
7451
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("bondingCurve", accounts.bondingCurve.value)),
7452
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
7453
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
7642
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("bondingCurve", accounts.bondingCurve.value)),
7643
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
7644
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
7454
7645
  ]
7455
7646
  });
7456
7647
  if (!accounts.destination.value) accounts.destination.value = await (0, _solana_kit.getProgramDerivedAddress)({
7457
7648
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
7458
7649
  seeds: [
7459
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("destinationOwner", accounts.destinationOwner.value)),
7460
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
7461
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
7650
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("destinationOwner", accounts.destinationOwner.value)),
7651
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
7652
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
7462
7653
  ]
7463
7654
  });
7464
7655
  if (!accounts.associatedTokenProgram.value) accounts.associatedTokenProgram.value = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
7465
7656
  if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
7466
7657
  if (!accounts.eventAuthority.value) accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS$1;
7467
7658
  if (!accounts.program.value) accounts.program.value = "5R1uFyEE4oxqkm7hJDqHq6gXaLVF9dxeF3LF4yz1sfLP";
7468
- const getAccountMeta = (0, _solana_program_client_core.getAccountMetaFactory)(programAddress, "programId");
7659
+ const getAccountMeta = (0, _solana_kit_program_client_core.getAccountMetaFactory)(programAddress, "programId");
7469
7660
  return Object.freeze({
7470
7661
  accounts: [
7471
7662
  getAccountMeta("claimer", accounts.claimer),
@@ -7557,7 +7748,7 @@ function getClaimCreatorFeesInstruction(input) {
7557
7748
  if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
7558
7749
  if (!accounts.eventAuthority.value) accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS$1;
7559
7750
  if (!accounts.program.value) accounts.program.value = "5R1uFyEE4oxqkm7hJDqHq6gXaLVF9dxeF3LF4yz1sfLP";
7560
- const getAccountMeta = (0, _solana_program_client_core.getAccountMetaFactory)(programAddress, "programId");
7751
+ const getAccountMeta = (0, _solana_kit_program_client_core.getAccountMetaFactory)(programAddress, "programId");
7561
7752
  return Object.freeze({
7562
7753
  accounts: [
7563
7754
  getAccountMeta("claimer", accounts.claimer),
@@ -7710,15 +7901,15 @@ async function getClaimProtocolFeesInstructionAsync(input) {
7710
7901
  }
7711
7902
  };
7712
7903
  if (!accounts.bondingCurve.value) accounts.bondingCurve.value = await findBondingCurvePda({
7713
- baseMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value),
7714
- quoteMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value)
7904
+ baseMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value),
7905
+ quoteMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value)
7715
7906
  });
7716
7907
  if (!accounts.quoteVault.value) accounts.quoteVault.value = await (0, _solana_kit.getProgramDerivedAddress)({
7717
7908
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
7718
7909
  seeds: [
7719
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("bondingCurve", accounts.bondingCurve.value)),
7720
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
7721
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
7910
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("bondingCurve", accounts.bondingCurve.value)),
7911
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
7912
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
7722
7913
  ]
7723
7914
  });
7724
7915
  if (!accounts.nexusStakingConfig.value) accounts.nexusStakingConfig.value = "9WUowYRb6KAWjWVB5KMmTngBidZXEXgQcQRTXbhxeGbF";
@@ -7733,23 +7924,23 @@ async function getClaimProtocolFeesInstructionAsync(input) {
7733
7924
  114,
7734
7925
  100
7735
7926
  ])),
7736
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("nexusStakingConfig", accounts.nexusStakingConfig.value)),
7737
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
7927
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("nexusStakingConfig", accounts.nexusStakingConfig.value)),
7928
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
7738
7929
  ]
7739
7930
  });
7740
- if (!accounts.rewardAccrual.value) accounts.rewardAccrual.value = await findRewardAccrualPda({ quoteMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value) });
7931
+ if (!accounts.rewardAccrual.value) accounts.rewardAccrual.value = await findRewardAccrualPda({ quoteMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value) });
7741
7932
  if (!accounts.stakingVault.value) accounts.stakingVault.value = await (0, _solana_kit.getProgramDerivedAddress)({
7742
7933
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
7743
7934
  seeds: [
7744
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("nexusStakingConfig", accounts.nexusStakingConfig.value)),
7745
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
7746
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
7935
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("nexusStakingConfig", accounts.nexusStakingConfig.value)),
7936
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
7937
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
7747
7938
  ]
7748
7939
  });
7749
7940
  if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
7750
7941
  if (!accounts.eventAuthority.value) accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS$1;
7751
7942
  if (!accounts.program.value) accounts.program.value = "5R1uFyEE4oxqkm7hJDqHq6gXaLVF9dxeF3LF4yz1sfLP";
7752
- const getAccountMeta = (0, _solana_program_client_core.getAccountMetaFactory)(programAddress, "programId");
7943
+ const getAccountMeta = (0, _solana_kit_program_client_core.getAccountMetaFactory)(programAddress, "programId");
7753
7944
  return Object.freeze({
7754
7945
  accounts: [
7755
7946
  getAccountMeta("payer", accounts.payer),
@@ -7830,7 +8021,7 @@ function getClaimProtocolFeesInstruction(input) {
7830
8021
  if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
7831
8022
  if (!accounts.eventAuthority.value) accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS$1;
7832
8023
  if (!accounts.program.value) accounts.program.value = "5R1uFyEE4oxqkm7hJDqHq6gXaLVF9dxeF3LF4yz1sfLP";
7833
- const getAccountMeta = (0, _solana_program_client_core.getAccountMetaFactory)(programAddress, "programId");
8024
+ const getAccountMeta = (0, _solana_kit_program_client_core.getAccountMetaFactory)(programAddress, "programId");
7834
8025
  return Object.freeze({
7835
8026
  accounts: [
7836
8027
  getAccountMeta("payer", accounts.payer),
@@ -8015,23 +8206,23 @@ async function getMigrateInstructionAsync(input) {
8015
8206
  }
8016
8207
  };
8017
8208
  if (!accounts.bondingCurve.value) accounts.bondingCurve.value = await findBondingCurvePda({
8018
- baseMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value),
8019
- quoteMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value)
8209
+ baseMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value),
8210
+ quoteMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value)
8020
8211
  });
8021
8212
  if (!accounts.baseVault.value) accounts.baseVault.value = await (0, _solana_kit.getProgramDerivedAddress)({
8022
8213
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
8023
8214
  seeds: [
8024
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("bondingCurve", accounts.bondingCurve.value)),
8215
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("bondingCurve", accounts.bondingCurve.value)),
8025
8216
  (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit.address)("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb")),
8026
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value))
8217
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value))
8027
8218
  ]
8028
8219
  });
8029
8220
  if (!accounts.quoteVault.value) accounts.quoteVault.value = await (0, _solana_kit.getProgramDerivedAddress)({
8030
8221
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
8031
8222
  seeds: [
8032
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("bondingCurve", accounts.bondingCurve.value)),
8033
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
8034
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
8223
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("bondingCurve", accounts.bondingCurve.value)),
8224
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteTokenProgram", accounts.quoteTokenProgram.value)),
8225
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
8035
8226
  ]
8036
8227
  });
8037
8228
  if (!accounts.dexProgram.value) accounts.dexProgram.value = "84qj5FPZZdXkQy8mfowyg6RBZ3XKuTds6XS4ZYT1sfDX";
@@ -8045,8 +8236,8 @@ async function getMigrateInstructionAsync(input) {
8045
8236
  111,
8046
8237
  108
8047
8238
  ])),
8048
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value)),
8049
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
8239
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value)),
8240
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
8050
8241
  ]
8051
8242
  });
8052
8243
  if (!accounts.lpMint.value) accounts.lpMint.value = await (0, _solana_kit.getProgramDerivedAddress)({
@@ -8061,8 +8252,8 @@ async function getMigrateInstructionAsync(input) {
8061
8252
  110,
8062
8253
  116
8063
8254
  ])),
8064
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value)),
8065
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
8255
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("baseMint", accounts.baseMint.value)),
8256
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("quoteMint", accounts.quoteMint.value))
8066
8257
  ]
8067
8258
  });
8068
8259
  if (!accounts.dexEventAuthority.value) accounts.dexEventAuthority.value = "4pTDYKRFdmxTQYFceGZkzPGd3kb8ShMA9n6XKRaPZn8t";
@@ -8072,7 +8263,7 @@ async function getMigrateInstructionAsync(input) {
8072
8263
  if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
8073
8264
  if (!accounts.eventAuthority.value) accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS$1;
8074
8265
  if (!accounts.program.value) accounts.program.value = "5R1uFyEE4oxqkm7hJDqHq6gXaLVF9dxeF3LF4yz1sfLP";
8075
- const getAccountMeta = (0, _solana_program_client_core.getAccountMetaFactory)(programAddress, "programId");
8266
+ const getAccountMeta = (0, _solana_kit_program_client_core.getAccountMetaFactory)(programAddress, "programId");
8076
8267
  return Object.freeze({
8077
8268
  accounts: [
8078
8269
  getAccountMeta("caller", accounts.caller),
@@ -8203,7 +8394,7 @@ function getMigrateInstruction(input) {
8203
8394
  if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
8204
8395
  if (!accounts.eventAuthority.value) accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS$1;
8205
8396
  if (!accounts.program.value) accounts.program.value = "5R1uFyEE4oxqkm7hJDqHq6gXaLVF9dxeF3LF4yz1sfLP";
8206
- const getAccountMeta = (0, _solana_program_client_core.getAccountMetaFactory)(programAddress, "programId");
8397
+ const getAccountMeta = (0, _solana_kit_program_client_core.getAccountMetaFactory)(programAddress, "programId");
8207
8398
  return Object.freeze({
8208
8399
  accounts: [
8209
8400
  getAccountMeta("caller", accounts.caller),
@@ -8480,32 +8671,32 @@ function sendLaunchpadProgram() {
8480
8671
  tradeEvent: getTradeEventDecoder()
8481
8672
  },
8482
8673
  instructions: {
8483
- buyExactIn: (input) => (0, _solana_program_client_core.addSelfPlanAndSendFunctions)(client, getBuyExactInInstructionAsync({
8674
+ buyExactIn: (input) => (0, _solana_kit_program_client_core.addSelfPlanAndSendFunctions)(client, getBuyExactInInstructionAsync({
8484
8675
  ...input,
8485
8676
  payer: input.payer ?? client.payer
8486
8677
  })),
8487
- buyExactOut: (input) => (0, _solana_program_client_core.addSelfPlanAndSendFunctions)(client, getBuyExactOutInstructionAsync({
8678
+ buyExactOut: (input) => (0, _solana_kit_program_client_core.addSelfPlanAndSendFunctions)(client, getBuyExactOutInstructionAsync({
8488
8679
  ...input,
8489
8680
  payer: input.payer ?? client.payer
8490
8681
  })),
8491
- claimCreatorFees: (input) => (0, _solana_program_client_core.addSelfPlanAndSendFunctions)(client, getClaimCreatorFeesInstructionAsync({
8682
+ claimCreatorFees: (input) => (0, _solana_kit_program_client_core.addSelfPlanAndSendFunctions)(client, getClaimCreatorFeesInstructionAsync({
8492
8683
  ...input,
8493
8684
  payer: input.payer ?? client.payer
8494
8685
  })),
8495
- claimProtocolFees: (input) => (0, _solana_program_client_core.addSelfPlanAndSendFunctions)(client, getClaimProtocolFeesInstructionAsync({
8686
+ claimProtocolFees: (input) => (0, _solana_kit_program_client_core.addSelfPlanAndSendFunctions)(client, getClaimProtocolFeesInstructionAsync({
8496
8687
  ...input,
8497
8688
  payer: input.payer ?? client.payer
8498
8689
  })),
8499
- createToken: (input) => (0, _solana_program_client_core.addSelfPlanAndSendFunctions)(client, getCreateTokenInstructionAsync({
8690
+ createToken: (input) => (0, _solana_kit_program_client_core.addSelfPlanAndSendFunctions)(client, getCreateTokenInstructionAsync({
8500
8691
  ...input,
8501
8692
  payer: input.payer ?? client.payer
8502
8693
  })),
8503
- migrate: (input) => (0, _solana_program_client_core.addSelfPlanAndSendFunctions)(client, getMigrateInstructionAsync(input)),
8504
- sellExactIn: (input) => (0, _solana_program_client_core.addSelfPlanAndSendFunctions)(client, getSellExactInInstructionAsync({
8694
+ migrate: (input) => (0, _solana_kit_program_client_core.addSelfPlanAndSendFunctions)(client, getMigrateInstructionAsync(input)),
8695
+ sellExactIn: (input) => (0, _solana_kit_program_client_core.addSelfPlanAndSendFunctions)(client, getSellExactInInstructionAsync({
8505
8696
  ...input,
8506
8697
  payer: input.payer ?? client.payer
8507
8698
  })),
8508
- sellExactOut: (input) => (0, _solana_program_client_core.addSelfPlanAndSendFunctions)(client, getSellExactOutInstructionAsync({
8699
+ sellExactOut: (input) => (0, _solana_kit_program_client_core.addSelfPlanAndSendFunctions)(client, getSellExactOutInstructionAsync({
8509
8700
  ...input,
8510
8701
  payer: input.payer ?? client.payer
8511
8702
  }))
@@ -8530,7 +8721,7 @@ var plugins_exports$1 = /* @__PURE__ */ __exportAll({ sendLaunchpadProgram: () =
8530
8721
  //#endregion
8531
8722
  //#region src/utils/pda.ts
8532
8723
  const addressEncoder = (0, _solana_kit.getAddressEncoder)();
8533
- /** Seed order is [wallet, tokenProgram, mint], not the parameter order. */
8724
+ /** Derives the associated token account of `wallet` for `mint` under `tokenProgram`. */
8534
8725
  async function findAssociatedTokenPda(wallet, mint, tokenProgram = TOKEN_PROGRAM_ADDRESS) {
8535
8726
  return await (0, _solana_kit.getProgramDerivedAddress)({
8536
8727
  programAddress: ASSOCIATED_TOKEN_PROGRAM_ADDRESS,
@@ -8586,7 +8777,8 @@ var launchpad_exports = /* @__PURE__ */ __exportAll({
8586
8777
  //#endregion
8587
8778
  //#region src/math/fee-decay.ts
8588
8779
  var fee_decay_exports = /* @__PURE__ */ __exportAll({ calculateFeeDecayPremium: () => calculateFeeDecayPremium });
8589
- /** Premium in bps, rounded up. */
8780
+ /** Returns the fee decay premium in bps, rounded up. The premium falls quadratically from
8781
+ * `decayStartBps - standardFeeBps` at creation to 0 after `decaySeconds`. */
8590
8782
  function calculateFeeDecayPremium(params) {
8591
8783
  const { currentTimestamp, createdAtTimestamp, decaySeconds, decayStartBps, standardFeeBps } = params;
8592
8784
  if (decaySeconds === 0) return 0n;
@@ -8607,7 +8799,9 @@ function calculateFeeDecayPremium(params) {
8607
8799
  //#endregion
8608
8800
  //#region src/math/fees.ts
8609
8801
  var fees_exports = /* @__PURE__ */ __exportAll({ splitFeeAmount: () => splitFeeAmount });
8610
- /** LP/creator round down; protocol absorbs the decay premium and all remainders. */
8802
+ /** Splits `feeAmount` into protocol, LP and creator shares. LP and creator round down. Protocol gets
8803
+ * the decay premium and all remainders. Throws `RangeError` on a negative or non-integer input,
8804
+ * a zero total bps, or `protocolBps + lpBps` above `baseTotalBps`. */
8611
8805
  function splitFeeAmount(args) {
8612
8806
  const { feeAmount } = args;
8613
8807
  const protocolBps = toBps(args.protocolBps, "protocolBps");
@@ -8653,6 +8847,39 @@ var math_exports = /* @__PURE__ */ __exportAll({
8653
8847
  fees: () => fees_exports
8654
8848
  });
8655
8849
  //#endregion
8850
+ //#region src/nexus/generated/shared/index.ts
8851
+ /** The System Program, which owns every address nobody has created an account at yet. */
8852
+ const SYSTEM_PROGRAM_ADDRESS = "11111111111111111111111111111111";
8853
+ /**
8854
+ * Whether an encoded account was created on-chain, rather than merely sent lamports.
8855
+ *
8856
+ * Anyone can send lamports to an address before its account is created, which leaves it on-chain,
8857
+ * owned by the System Program, with no data. This returns `false` for that shape, as it does for an
8858
+ * account that does not exist. Any other existing account counts as created, whoever owns it; the
8859
+ * `decode*` functions still check the owner.
8860
+ *
8861
+ * The generated `fetchMaybe*` and `fetchAllMaybe*` helpers apply this rule themselves. Apply it to
8862
+ * accounts you fetch or receive another way (subscriptions, batch loaders, caches) before passing
8863
+ * them to a `decode*` function, which throws for a lamports-only account: an account passed to it as
8864
+ * existing must never come back as the non-existing variant typed as an `Account`.
8865
+ *
8866
+ * Only a `true` result narrows the type. A lamports-only account is still `exists: true` at runtime,
8867
+ * so a `false` result leaves the type unchanged instead of narrowing it to the non-existing variant.
8868
+ * The `uncreated` property in the narrowed type is never present; it exists only to prevent that.
8869
+ *
8870
+ * @example
8871
+ * ```ts
8872
+ * const maybeAccount = decodeMyAccount(
8873
+ * accountIsCreated(encodedAccount) ? encodedAccount : { address: encodedAccount.address, exists: false },
8874
+ * );
8875
+ * ```
8876
+ */
8877
+ function accountIsCreated(account) {
8878
+ const maybeAccount = account;
8879
+ if ("exists" in maybeAccount && !maybeAccount.exists) return false;
8880
+ return !(maybeAccount.programAddress === SYSTEM_PROGRAM_ADDRESS && maybeAccount.data.length === 0);
8881
+ }
8882
+ //#endregion
8656
8883
  //#region src/nexus/generated/accounts/altRegistry.ts
8657
8884
  /**
8658
8885
  * This code was AUTOGENERATED using the Codama library.
@@ -8716,21 +8943,40 @@ function decodeAltRegistry(encodedAccount) {
8716
8943
  }
8717
8944
  return (0, _solana_kit.decodeAccount)(encodedAccount, getAltRegistryDecoder());
8718
8945
  }
8946
+ /** Fetches a `AltRegistry` account, throwing when it does not exist or only holds lamports. */
8719
8947
  async function fetchAltRegistry(rpc, address, config) {
8720
8948
  const maybeAccount = await fetchMaybeAltRegistry(rpc, address, config);
8721
8949
  (0, _solana_kit.assertAccountExists)(maybeAccount);
8722
8950
  return maybeAccount;
8723
8951
  }
8952
+ /**
8953
+ * Fetches a `AltRegistry` account, or the non-existing variant when the address holds no
8954
+ * account or only lamports (see {@link accountIsCreated}).
8955
+ * {@link decodeAltRegistry} throws for a lamports-only account instead.
8956
+ */
8724
8957
  async function fetchMaybeAltRegistry(rpc, address, config) {
8725
- return decodeAltRegistry(await (0, _solana_kit.fetchEncodedAccount)(rpc, address, config));
8958
+ const maybeAccount = await (0, _solana_kit.fetchEncodedAccount)(rpc, address, config);
8959
+ return decodeAltRegistry(accountIsCreated(maybeAccount) ? maybeAccount : {
8960
+ address,
8961
+ exists: false
8962
+ });
8726
8963
  }
8964
+ /** Fetches `AltRegistry` accounts, throwing when any does not exist or only holds lamports. */
8727
8965
  async function fetchAllAltRegistry(rpc, addresses, config) {
8728
8966
  const maybeAccounts = await fetchAllMaybeAltRegistry(rpc, addresses, config);
8729
8967
  (0, _solana_kit.assertAccountsExist)(maybeAccounts);
8730
8968
  return maybeAccounts;
8731
8969
  }
8970
+ /**
8971
+ * Fetches `AltRegistry` accounts, with the non-existing variant for each address that holds
8972
+ * no account or only lamports (see {@link accountIsCreated}).
8973
+ * {@link decodeAltRegistry} throws for a lamports-only account instead.
8974
+ */
8732
8975
  async function fetchAllMaybeAltRegistry(rpc, addresses, config) {
8733
- return (await (0, _solana_kit.fetchEncodedAccounts)(rpc, addresses, config)).map((maybeAccount) => decodeAltRegistry(maybeAccount));
8976
+ return (await (0, _solana_kit.fetchEncodedAccounts)(rpc, addresses, config)).map((maybeAccount) => decodeAltRegistry(accountIsCreated(maybeAccount) ? maybeAccount : {
8977
+ address: maybeAccount.address,
8978
+ exists: false
8979
+ }));
8734
8980
  }
8735
8981
  function getAltRegistrySize() {
8736
8982
  return 74;
@@ -8803,21 +9049,40 @@ function decodeCreatorFeeConfig(encodedAccount) {
8803
9049
  }
8804
9050
  return (0, _solana_kit.decodeAccount)(encodedAccount, getCreatorFeeConfigDecoder());
8805
9051
  }
9052
+ /** Fetches a `CreatorFeeConfig` account, throwing when it does not exist or only holds lamports. */
8806
9053
  async function fetchCreatorFeeConfig(rpc, address, config) {
8807
9054
  const maybeAccount = await fetchMaybeCreatorFeeConfig(rpc, address, config);
8808
9055
  (0, _solana_kit.assertAccountExists)(maybeAccount);
8809
9056
  return maybeAccount;
8810
9057
  }
9058
+ /**
9059
+ * Fetches a `CreatorFeeConfig` account, or the non-existing variant when the address holds no
9060
+ * account or only lamports (see {@link accountIsCreated}).
9061
+ * {@link decodeCreatorFeeConfig} throws for a lamports-only account instead.
9062
+ */
8811
9063
  async function fetchMaybeCreatorFeeConfig(rpc, address, config) {
8812
- return decodeCreatorFeeConfig(await (0, _solana_kit.fetchEncodedAccount)(rpc, address, config));
9064
+ const maybeAccount = await (0, _solana_kit.fetchEncodedAccount)(rpc, address, config);
9065
+ return decodeCreatorFeeConfig(accountIsCreated(maybeAccount) ? maybeAccount : {
9066
+ address,
9067
+ exists: false
9068
+ });
8813
9069
  }
9070
+ /** Fetches `CreatorFeeConfig` accounts, throwing when any does not exist or only holds lamports. */
8814
9071
  async function fetchAllCreatorFeeConfig(rpc, addresses, config) {
8815
9072
  const maybeAccounts = await fetchAllMaybeCreatorFeeConfig(rpc, addresses, config);
8816
9073
  (0, _solana_kit.assertAccountsExist)(maybeAccounts);
8817
9074
  return maybeAccounts;
8818
9075
  }
9076
+ /**
9077
+ * Fetches `CreatorFeeConfig` accounts, with the non-existing variant for each address that holds
9078
+ * no account or only lamports (see {@link accountIsCreated}).
9079
+ * {@link decodeCreatorFeeConfig} throws for a lamports-only account instead.
9080
+ */
8819
9081
  async function fetchAllMaybeCreatorFeeConfig(rpc, addresses, config) {
8820
- return (await (0, _solana_kit.fetchEncodedAccounts)(rpc, addresses, config)).map((maybeAccount) => decodeCreatorFeeConfig(maybeAccount));
9082
+ return (await (0, _solana_kit.fetchEncodedAccounts)(rpc, addresses, config)).map((maybeAccount) => decodeCreatorFeeConfig(accountIsCreated(maybeAccount) ? maybeAccount : {
9083
+ address: maybeAccount.address,
9084
+ exists: false
9085
+ }));
8821
9086
  }
8822
9087
  function getCreatorFeeConfigSize() {
8823
9088
  return 151;
@@ -9045,21 +9310,40 @@ function decodeFeePreset(encodedAccount) {
9045
9310
  }
9046
9311
  return (0, _solana_kit.decodeAccount)(encodedAccount, getFeePresetDecoder());
9047
9312
  }
9313
+ /** Fetches a `FeePreset` account, throwing when it does not exist or only holds lamports. */
9048
9314
  async function fetchFeePreset(rpc, address, config) {
9049
9315
  const maybeAccount = await fetchMaybeFeePreset(rpc, address, config);
9050
9316
  (0, _solana_kit.assertAccountExists)(maybeAccount);
9051
9317
  return maybeAccount;
9052
9318
  }
9319
+ /**
9320
+ * Fetches a `FeePreset` account, or the non-existing variant when the address holds no
9321
+ * account or only lamports (see {@link accountIsCreated}).
9322
+ * {@link decodeFeePreset} throws for a lamports-only account instead.
9323
+ */
9053
9324
  async function fetchMaybeFeePreset(rpc, address, config) {
9054
- return decodeFeePreset(await (0, _solana_kit.fetchEncodedAccount)(rpc, address, config));
9325
+ const maybeAccount = await (0, _solana_kit.fetchEncodedAccount)(rpc, address, config);
9326
+ return decodeFeePreset(accountIsCreated(maybeAccount) ? maybeAccount : {
9327
+ address,
9328
+ exists: false
9329
+ });
9055
9330
  }
9331
+ /** Fetches `FeePreset` accounts, throwing when any does not exist or only holds lamports. */
9056
9332
  async function fetchAllFeePreset(rpc, addresses, config) {
9057
9333
  const maybeAccounts = await fetchAllMaybeFeePreset(rpc, addresses, config);
9058
9334
  (0, _solana_kit.assertAccountsExist)(maybeAccounts);
9059
9335
  return maybeAccounts;
9060
9336
  }
9337
+ /**
9338
+ * Fetches `FeePreset` accounts, with the non-existing variant for each address that holds
9339
+ * no account or only lamports (see {@link accountIsCreated}).
9340
+ * {@link decodeFeePreset} throws for a lamports-only account instead.
9341
+ */
9061
9342
  async function fetchAllMaybeFeePreset(rpc, addresses, config) {
9062
- return (await (0, _solana_kit.fetchEncodedAccounts)(rpc, addresses, config)).map((maybeAccount) => decodeFeePreset(maybeAccount));
9343
+ return (await (0, _solana_kit.fetchEncodedAccounts)(rpc, addresses, config)).map((maybeAccount) => decodeFeePreset(accountIsCreated(maybeAccount) ? maybeAccount : {
9344
+ address: maybeAccount.address,
9345
+ exists: false
9346
+ }));
9063
9347
  }
9064
9348
  //#endregion
9065
9349
  //#region src/nexus/generated/accounts/globalConfig.ts
@@ -9129,21 +9413,40 @@ function decodeGlobalConfig(encodedAccount) {
9129
9413
  }
9130
9414
  return (0, _solana_kit.decodeAccount)(encodedAccount, getGlobalConfigDecoder());
9131
9415
  }
9416
+ /** Fetches a `GlobalConfig` account, throwing when it does not exist or only holds lamports. */
9132
9417
  async function fetchGlobalConfig(rpc, address, config) {
9133
9418
  const maybeAccount = await fetchMaybeGlobalConfig(rpc, address, config);
9134
9419
  (0, _solana_kit.assertAccountExists)(maybeAccount);
9135
9420
  return maybeAccount;
9136
9421
  }
9422
+ /**
9423
+ * Fetches a `GlobalConfig` account, or the non-existing variant when the address holds no
9424
+ * account or only lamports (see {@link accountIsCreated}).
9425
+ * {@link decodeGlobalConfig} throws for a lamports-only account instead.
9426
+ */
9137
9427
  async function fetchMaybeGlobalConfig(rpc, address, config) {
9138
- return decodeGlobalConfig(await (0, _solana_kit.fetchEncodedAccount)(rpc, address, config));
9428
+ const maybeAccount = await (0, _solana_kit.fetchEncodedAccount)(rpc, address, config);
9429
+ return decodeGlobalConfig(accountIsCreated(maybeAccount) ? maybeAccount : {
9430
+ address,
9431
+ exists: false
9432
+ });
9139
9433
  }
9434
+ /** Fetches `GlobalConfig` accounts, throwing when any does not exist or only holds lamports. */
9140
9435
  async function fetchAllGlobalConfig(rpc, addresses, config) {
9141
9436
  const maybeAccounts = await fetchAllMaybeGlobalConfig(rpc, addresses, config);
9142
9437
  (0, _solana_kit.assertAccountsExist)(maybeAccounts);
9143
9438
  return maybeAccounts;
9144
9439
  }
9440
+ /**
9441
+ * Fetches `GlobalConfig` accounts, with the non-existing variant for each address that holds
9442
+ * no account or only lamports (see {@link accountIsCreated}).
9443
+ * {@link decodeGlobalConfig} throws for a lamports-only account instead.
9444
+ */
9145
9445
  async function fetchAllMaybeGlobalConfig(rpc, addresses, config) {
9146
- return (await (0, _solana_kit.fetchEncodedAccounts)(rpc, addresses, config)).map((maybeAccount) => decodeGlobalConfig(maybeAccount));
9446
+ return (await (0, _solana_kit.fetchEncodedAccounts)(rpc, addresses, config)).map((maybeAccount) => decodeGlobalConfig(accountIsCreated(maybeAccount) ? maybeAccount : {
9447
+ address: maybeAccount.address,
9448
+ exists: false
9449
+ }));
9147
9450
  }
9148
9451
  //#endregion
9149
9452
  //#region src/nexus/generated/accounts/partnerConfig.ts
@@ -9219,21 +9522,40 @@ function decodePartnerConfig(encodedAccount) {
9219
9522
  }
9220
9523
  return (0, _solana_kit.decodeAccount)(encodedAccount, getPartnerConfigDecoder());
9221
9524
  }
9525
+ /** Fetches a `PartnerConfig` account, throwing when it does not exist or only holds lamports. */
9222
9526
  async function fetchPartnerConfig(rpc, address, config) {
9223
9527
  const maybeAccount = await fetchMaybePartnerConfig(rpc, address, config);
9224
9528
  (0, _solana_kit.assertAccountExists)(maybeAccount);
9225
9529
  return maybeAccount;
9226
9530
  }
9531
+ /**
9532
+ * Fetches a `PartnerConfig` account, or the non-existing variant when the address holds no
9533
+ * account or only lamports (see {@link accountIsCreated}).
9534
+ * {@link decodePartnerConfig} throws for a lamports-only account instead.
9535
+ */
9227
9536
  async function fetchMaybePartnerConfig(rpc, address, config) {
9228
- return decodePartnerConfig(await (0, _solana_kit.fetchEncodedAccount)(rpc, address, config));
9537
+ const maybeAccount = await (0, _solana_kit.fetchEncodedAccount)(rpc, address, config);
9538
+ return decodePartnerConfig(accountIsCreated(maybeAccount) ? maybeAccount : {
9539
+ address,
9540
+ exists: false
9541
+ });
9229
9542
  }
9543
+ /** Fetches `PartnerConfig` accounts, throwing when any does not exist or only holds lamports. */
9230
9544
  async function fetchAllPartnerConfig(rpc, addresses, config) {
9231
9545
  const maybeAccounts = await fetchAllMaybePartnerConfig(rpc, addresses, config);
9232
9546
  (0, _solana_kit.assertAccountsExist)(maybeAccounts);
9233
9547
  return maybeAccounts;
9234
9548
  }
9549
+ /**
9550
+ * Fetches `PartnerConfig` accounts, with the non-existing variant for each address that holds
9551
+ * no account or only lamports (see {@link accountIsCreated}).
9552
+ * {@link decodePartnerConfig} throws for a lamports-only account instead.
9553
+ */
9235
9554
  async function fetchAllMaybePartnerConfig(rpc, addresses, config) {
9236
- return (await (0, _solana_kit.fetchEncodedAccounts)(rpc, addresses, config)).map((maybeAccount) => decodePartnerConfig(maybeAccount));
9555
+ return (await (0, _solana_kit.fetchEncodedAccounts)(rpc, addresses, config)).map((maybeAccount) => decodePartnerConfig(accountIsCreated(maybeAccount) ? maybeAccount : {
9556
+ address: maybeAccount.address,
9557
+ exists: false
9558
+ }));
9237
9559
  }
9238
9560
  function getPartnerConfigSize() {
9239
9561
  return 173;
@@ -9312,21 +9634,40 @@ function decodePartnerMetadata(encodedAccount) {
9312
9634
  }
9313
9635
  return (0, _solana_kit.decodeAccount)(encodedAccount, getPartnerMetadataDecoder());
9314
9636
  }
9637
+ /** Fetches a `PartnerMetadata` account, throwing when it does not exist or only holds lamports. */
9315
9638
  async function fetchPartnerMetadata(rpc, address, config) {
9316
9639
  const maybeAccount = await fetchMaybePartnerMetadata(rpc, address, config);
9317
9640
  (0, _solana_kit.assertAccountExists)(maybeAccount);
9318
9641
  return maybeAccount;
9319
9642
  }
9643
+ /**
9644
+ * Fetches a `PartnerMetadata` account, or the non-existing variant when the address holds no
9645
+ * account or only lamports (see {@link accountIsCreated}).
9646
+ * {@link decodePartnerMetadata} throws for a lamports-only account instead.
9647
+ */
9320
9648
  async function fetchMaybePartnerMetadata(rpc, address, config) {
9321
- return decodePartnerMetadata(await (0, _solana_kit.fetchEncodedAccount)(rpc, address, config));
9649
+ const maybeAccount = await (0, _solana_kit.fetchEncodedAccount)(rpc, address, config);
9650
+ return decodePartnerMetadata(accountIsCreated(maybeAccount) ? maybeAccount : {
9651
+ address,
9652
+ exists: false
9653
+ });
9322
9654
  }
9655
+ /** Fetches `PartnerMetadata` accounts, throwing when any does not exist or only holds lamports. */
9323
9656
  async function fetchAllPartnerMetadata(rpc, addresses, config) {
9324
9657
  const maybeAccounts = await fetchAllMaybePartnerMetadata(rpc, addresses, config);
9325
9658
  (0, _solana_kit.assertAccountsExist)(maybeAccounts);
9326
9659
  return maybeAccounts;
9327
9660
  }
9661
+ /**
9662
+ * Fetches `PartnerMetadata` accounts, with the non-existing variant for each address that holds
9663
+ * no account or only lamports (see {@link accountIsCreated}).
9664
+ * {@link decodePartnerMetadata} throws for a lamports-only account instead.
9665
+ */
9328
9666
  async function fetchAllMaybePartnerMetadata(rpc, addresses, config) {
9329
- return (await (0, _solana_kit.fetchEncodedAccounts)(rpc, addresses, config)).map((maybeAccount) => decodePartnerMetadata(maybeAccount));
9667
+ return (await (0, _solana_kit.fetchEncodedAccounts)(rpc, addresses, config)).map((maybeAccount) => decodePartnerMetadata(accountIsCreated(maybeAccount) ? maybeAccount : {
9668
+ address: maybeAccount.address,
9669
+ exists: false
9670
+ }));
9330
9671
  }
9331
9672
  //#endregion
9332
9673
  //#region src/nexus/generated/accounts/rewardState.ts
@@ -9406,21 +9747,40 @@ function decodeRewardState(encodedAccount) {
9406
9747
  }
9407
9748
  return (0, _solana_kit.decodeAccount)(encodedAccount, getRewardStateDecoder());
9408
9749
  }
9750
+ /** Fetches a `RewardState` account, throwing when it does not exist or only holds lamports. */
9409
9751
  async function fetchRewardState(rpc, address, config) {
9410
9752
  const maybeAccount = await fetchMaybeRewardState(rpc, address, config);
9411
9753
  (0, _solana_kit.assertAccountExists)(maybeAccount);
9412
9754
  return maybeAccount;
9413
9755
  }
9756
+ /**
9757
+ * Fetches a `RewardState` account, or the non-existing variant when the address holds no
9758
+ * account or only lamports (see {@link accountIsCreated}).
9759
+ * {@link decodeRewardState} throws for a lamports-only account instead.
9760
+ */
9414
9761
  async function fetchMaybeRewardState(rpc, address, config) {
9415
- return decodeRewardState(await (0, _solana_kit.fetchEncodedAccount)(rpc, address, config));
9762
+ const maybeAccount = await (0, _solana_kit.fetchEncodedAccount)(rpc, address, config);
9763
+ return decodeRewardState(accountIsCreated(maybeAccount) ? maybeAccount : {
9764
+ address,
9765
+ exists: false
9766
+ });
9416
9767
  }
9768
+ /** Fetches `RewardState` accounts, throwing when any does not exist or only holds lamports. */
9417
9769
  async function fetchAllRewardState(rpc, addresses, config) {
9418
9770
  const maybeAccounts = await fetchAllMaybeRewardState(rpc, addresses, config);
9419
9771
  (0, _solana_kit.assertAccountsExist)(maybeAccounts);
9420
9772
  return maybeAccounts;
9421
9773
  }
9774
+ /**
9775
+ * Fetches `RewardState` accounts, with the non-existing variant for each address that holds
9776
+ * no account or only lamports (see {@link accountIsCreated}).
9777
+ * {@link decodeRewardState} throws for a lamports-only account instead.
9778
+ */
9422
9779
  async function fetchAllMaybeRewardState(rpc, addresses, config) {
9423
- return (await (0, _solana_kit.fetchEncodedAccounts)(rpc, addresses, config)).map((maybeAccount) => decodeRewardState(maybeAccount));
9780
+ return (await (0, _solana_kit.fetchEncodedAccounts)(rpc, addresses, config)).map((maybeAccount) => decodeRewardState(accountIsCreated(maybeAccount) ? maybeAccount : {
9781
+ address: maybeAccount.address,
9782
+ exists: false
9783
+ }));
9424
9784
  }
9425
9785
  function getRewardStateSize() {
9426
9786
  return 196;
@@ -9495,21 +9855,40 @@ function decodeStakingConfig(encodedAccount) {
9495
9855
  }
9496
9856
  return (0, _solana_kit.decodeAccount)(encodedAccount, getStakingConfigDecoder());
9497
9857
  }
9858
+ /** Fetches a `StakingConfig` account, throwing when it does not exist or only holds lamports. */
9498
9859
  async function fetchStakingConfig(rpc, address, config) {
9499
9860
  const maybeAccount = await fetchMaybeStakingConfig(rpc, address, config);
9500
9861
  (0, _solana_kit.assertAccountExists)(maybeAccount);
9501
9862
  return maybeAccount;
9502
9863
  }
9864
+ /**
9865
+ * Fetches a `StakingConfig` account, or the non-existing variant when the address holds no
9866
+ * account or only lamports (see {@link accountIsCreated}).
9867
+ * {@link decodeStakingConfig} throws for a lamports-only account instead.
9868
+ */
9503
9869
  async function fetchMaybeStakingConfig(rpc, address, config) {
9504
- return decodeStakingConfig(await (0, _solana_kit.fetchEncodedAccount)(rpc, address, config));
9870
+ const maybeAccount = await (0, _solana_kit.fetchEncodedAccount)(rpc, address, config);
9871
+ return decodeStakingConfig(accountIsCreated(maybeAccount) ? maybeAccount : {
9872
+ address,
9873
+ exists: false
9874
+ });
9505
9875
  }
9876
+ /** Fetches `StakingConfig` accounts, throwing when any does not exist or only holds lamports. */
9506
9877
  async function fetchAllStakingConfig(rpc, addresses, config) {
9507
9878
  const maybeAccounts = await fetchAllMaybeStakingConfig(rpc, addresses, config);
9508
9879
  (0, _solana_kit.assertAccountsExist)(maybeAccounts);
9509
9880
  return maybeAccounts;
9510
9881
  }
9882
+ /**
9883
+ * Fetches `StakingConfig` accounts, with the non-existing variant for each address that holds
9884
+ * no account or only lamports (see {@link accountIsCreated}).
9885
+ * {@link decodeStakingConfig} throws for a lamports-only account instead.
9886
+ */
9511
9887
  async function fetchAllMaybeStakingConfig(rpc, addresses, config) {
9512
- return (await (0, _solana_kit.fetchEncodedAccounts)(rpc, addresses, config)).map((maybeAccount) => decodeStakingConfig(maybeAccount));
9888
+ return (await (0, _solana_kit.fetchEncodedAccounts)(rpc, addresses, config)).map((maybeAccount) => decodeStakingConfig(accountIsCreated(maybeAccount) ? maybeAccount : {
9889
+ address: maybeAccount.address,
9890
+ exists: false
9891
+ }));
9513
9892
  }
9514
9893
  function getStakingConfigSize() {
9515
9894
  return 117;
@@ -9592,21 +9971,40 @@ function decodeUserRewardDebt(encodedAccount) {
9592
9971
  }
9593
9972
  return (0, _solana_kit.decodeAccount)(encodedAccount, getUserRewardDebtDecoder());
9594
9973
  }
9974
+ /** Fetches a `UserRewardDebt` account, throwing when it does not exist or only holds lamports. */
9595
9975
  async function fetchUserRewardDebt(rpc, address, config) {
9596
9976
  const maybeAccount = await fetchMaybeUserRewardDebt(rpc, address, config);
9597
9977
  (0, _solana_kit.assertAccountExists)(maybeAccount);
9598
9978
  return maybeAccount;
9599
9979
  }
9980
+ /**
9981
+ * Fetches a `UserRewardDebt` account, or the non-existing variant when the address holds no
9982
+ * account or only lamports (see {@link accountIsCreated}).
9983
+ * {@link decodeUserRewardDebt} throws for a lamports-only account instead.
9984
+ */
9600
9985
  async function fetchMaybeUserRewardDebt(rpc, address, config) {
9601
- return decodeUserRewardDebt(await (0, _solana_kit.fetchEncodedAccount)(rpc, address, config));
9986
+ const maybeAccount = await (0, _solana_kit.fetchEncodedAccount)(rpc, address, config);
9987
+ return decodeUserRewardDebt(accountIsCreated(maybeAccount) ? maybeAccount : {
9988
+ address,
9989
+ exists: false
9990
+ });
9602
9991
  }
9992
+ /** Fetches `UserRewardDebt` accounts, throwing when any does not exist or only holds lamports. */
9603
9993
  async function fetchAllUserRewardDebt(rpc, addresses, config) {
9604
9994
  const maybeAccounts = await fetchAllMaybeUserRewardDebt(rpc, addresses, config);
9605
9995
  (0, _solana_kit.assertAccountsExist)(maybeAccounts);
9606
9996
  return maybeAccounts;
9607
9997
  }
9998
+ /**
9999
+ * Fetches `UserRewardDebt` accounts, with the non-existing variant for each address that holds
10000
+ * no account or only lamports (see {@link accountIsCreated}).
10001
+ * {@link decodeUserRewardDebt} throws for a lamports-only account instead.
10002
+ */
9608
10003
  async function fetchAllMaybeUserRewardDebt(rpc, addresses, config) {
9609
- return (await (0, _solana_kit.fetchEncodedAccounts)(rpc, addresses, config)).map((maybeAccount) => decodeUserRewardDebt(maybeAccount));
10004
+ return (await (0, _solana_kit.fetchEncodedAccounts)(rpc, addresses, config)).map((maybeAccount) => decodeUserRewardDebt(accountIsCreated(maybeAccount) ? maybeAccount : {
10005
+ address: maybeAccount.address,
10006
+ exists: false
10007
+ }));
9610
10008
  }
9611
10009
  function getUserRewardDebtSize() {
9612
10010
  return 182;
@@ -9683,21 +10081,40 @@ function decodeUserStakePosition(encodedAccount) {
9683
10081
  }
9684
10082
  return (0, _solana_kit.decodeAccount)(encodedAccount, getUserStakePositionDecoder());
9685
10083
  }
10084
+ /** Fetches a `UserStakePosition` account, throwing when it does not exist or only holds lamports. */
9686
10085
  async function fetchUserStakePosition(rpc, address, config) {
9687
10086
  const maybeAccount = await fetchMaybeUserStakePosition(rpc, address, config);
9688
10087
  (0, _solana_kit.assertAccountExists)(maybeAccount);
9689
10088
  return maybeAccount;
9690
10089
  }
10090
+ /**
10091
+ * Fetches a `UserStakePosition` account, or the non-existing variant when the address holds no
10092
+ * account or only lamports (see {@link accountIsCreated}).
10093
+ * {@link decodeUserStakePosition} throws for a lamports-only account instead.
10094
+ */
9691
10095
  async function fetchMaybeUserStakePosition(rpc, address, config) {
9692
- return decodeUserStakePosition(await (0, _solana_kit.fetchEncodedAccount)(rpc, address, config));
10096
+ const maybeAccount = await (0, _solana_kit.fetchEncodedAccount)(rpc, address, config);
10097
+ return decodeUserStakePosition(accountIsCreated(maybeAccount) ? maybeAccount : {
10098
+ address,
10099
+ exists: false
10100
+ });
9693
10101
  }
10102
+ /** Fetches `UserStakePosition` accounts, throwing when any does not exist or only holds lamports. */
9694
10103
  async function fetchAllUserStakePosition(rpc, addresses, config) {
9695
10104
  const maybeAccounts = await fetchAllMaybeUserStakePosition(rpc, addresses, config);
9696
10105
  (0, _solana_kit.assertAccountsExist)(maybeAccounts);
9697
10106
  return maybeAccounts;
9698
10107
  }
10108
+ /**
10109
+ * Fetches `UserStakePosition` accounts, with the non-existing variant for each address that holds
10110
+ * no account or only lamports (see {@link accountIsCreated}).
10111
+ * {@link decodeUserStakePosition} throws for a lamports-only account instead.
10112
+ */
9699
10113
  async function fetchAllMaybeUserStakePosition(rpc, addresses, config) {
9700
- return (await (0, _solana_kit.fetchEncodedAccounts)(rpc, addresses, config)).map((maybeAccount) => decodeUserStakePosition(maybeAccount));
10114
+ return (await (0, _solana_kit.fetchEncodedAccounts)(rpc, addresses, config)).map((maybeAccount) => decodeUserStakePosition(accountIsCreated(maybeAccount) ? maybeAccount : {
10115
+ address: maybeAccount.address,
10116
+ exists: false
10117
+ }));
9701
10118
  }
9702
10119
  function getUserStakePositionSize() {
9703
10120
  return 120;
@@ -10859,12 +11276,12 @@ async function getClaimInstructionAsync(input) {
10859
11276
  };
10860
11277
  if (!accounts.stakingConfig.value) accounts.stakingConfig.value = STAKING_CONFIG_PDA_ADDRESS;
10861
11278
  if (!accounts.userStakePosition.value) accounts.userStakePosition.value = await findUserStakePositionPda({
10862
- user: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value),
10863
- stakingMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("stakingMint", accounts.stakingMint.value)
11279
+ user: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value),
11280
+ stakingMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("stakingMint", accounts.stakingMint.value)
10864
11281
  });
10865
11282
  if (!accounts.rewardState.value) accounts.rewardState.value = await findRewardStatePda({
10866
- stakingConfig: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("stakingConfig", accounts.stakingConfig.value),
10867
- rewardMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("rewardMint", accounts.rewardMint.value)
11283
+ stakingConfig: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("stakingConfig", accounts.stakingConfig.value),
11284
+ rewardMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("rewardMint", accounts.rewardMint.value)
10868
11285
  });
10869
11286
  if (!accounts.launchpadRewardAccrual.value) accounts.launchpadRewardAccrual.value = await (0, _solana_kit.getProgramDerivedAddress)({
10870
11287
  programAddress: "5R1uFyEE4oxqkm7hJDqHq6gXaLVF9dxeF3LF4yz1sfLP",
@@ -10883,7 +11300,7 @@ async function getClaimInstructionAsync(input) {
10883
11300
  117,
10884
11301
  97,
10885
11302
  108
10886
- ])), (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("rewardMint", accounts.rewardMint.value))]
11303
+ ])), (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("rewardMint", accounts.rewardMint.value))]
10887
11304
  });
10888
11305
  if (!accounts.dexRewardAccrual.value) accounts.dexRewardAccrual.value = await (0, _solana_kit.getProgramDerivedAddress)({
10889
11306
  programAddress: "84qj5FPZZdXkQy8mfowyg6RBZ3XKuTds6XS4ZYT1sfDX",
@@ -10902,19 +11319,19 @@ async function getClaimInstructionAsync(input) {
10902
11319
  117,
10903
11320
  97,
10904
11321
  108
10905
- ])), (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("rewardMint", accounts.rewardMint.value))]
11322
+ ])), (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("rewardMint", accounts.rewardMint.value))]
10906
11323
  });
10907
11324
  if (!accounts.userRewardDebt.value) accounts.userRewardDebt.value = await findUserRewardDebtPda({
10908
- user: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value),
10909
- stakingMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("stakingMint", accounts.stakingMint.value),
10910
- rewardMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("rewardMint", accounts.rewardMint.value)
11325
+ user: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value),
11326
+ stakingMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("stakingMint", accounts.stakingMint.value),
11327
+ rewardMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("rewardMint", accounts.rewardMint.value)
10911
11328
  });
10912
11329
  if (!accounts.tokenProgram.value) accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
10913
11330
  if (!accounts.associatedTokenProgram.value) accounts.associatedTokenProgram.value = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
10914
11331
  if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
10915
11332
  if (!accounts.eventAuthority.value) accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS;
10916
11333
  if (!accounts.program.value) accounts.program.value = "7rrCurqdWFesbzwtYPo95fM8waTtVXgXwCom45x1sfNX";
10917
- const getAccountMeta = (0, _solana_program_client_core.getAccountMetaFactory)(programAddress, "programId");
11334
+ const getAccountMeta = (0, _solana_kit_program_client_core.getAccountMetaFactory)(programAddress, "programId");
10918
11335
  return Object.freeze({
10919
11336
  accounts: [
10920
11337
  getAccountMeta("user", accounts.user),
@@ -11017,7 +11434,7 @@ function getClaimInstruction(input) {
11017
11434
  if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
11018
11435
  if (!accounts.eventAuthority.value) accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS;
11019
11436
  if (!accounts.program.value) accounts.program.value = "7rrCurqdWFesbzwtYPo95fM8waTtVXgXwCom45x1sfNX";
11020
- const getAccountMeta = (0, _solana_program_client_core.getAccountMetaFactory)(programAddress, "programId");
11437
+ const getAccountMeta = (0, _solana_kit_program_client_core.getAccountMetaFactory)(programAddress, "programId");
11021
11438
  return Object.freeze({
11022
11439
  accounts: [
11023
11440
  getAccountMeta("user", accounts.user),
@@ -11159,20 +11576,20 @@ async function getCreateUserRewardDebtInstructionAsync(input) {
11159
11576
  };
11160
11577
  if (!accounts.stakingConfig.value) accounts.stakingConfig.value = STAKING_CONFIG_PDA_ADDRESS;
11161
11578
  if (!accounts.rewardState.value) accounts.rewardState.value = await findRewardStatePda({
11162
- stakingConfig: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("stakingConfig", accounts.stakingConfig.value),
11163
- rewardMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("rewardMint", accounts.rewardMint.value)
11579
+ stakingConfig: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("stakingConfig", accounts.stakingConfig.value),
11580
+ rewardMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("rewardMint", accounts.rewardMint.value)
11164
11581
  });
11165
11582
  if (!accounts.userStakePosition.value) accounts.userStakePosition.value = await findUserStakePositionPda({
11166
- user: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value),
11167
- stakingMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("stakingMint", accounts.stakingMint.value)
11583
+ user: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value),
11584
+ stakingMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("stakingMint", accounts.stakingMint.value)
11168
11585
  });
11169
11586
  if (!accounts.userRewardDebt.value) accounts.userRewardDebt.value = await findUserRewardDebtPda({
11170
- user: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value),
11171
- stakingMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("stakingMint", accounts.stakingMint.value),
11172
- rewardMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("rewardMint", accounts.rewardMint.value)
11587
+ user: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value),
11588
+ stakingMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("stakingMint", accounts.stakingMint.value),
11589
+ rewardMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("rewardMint", accounts.rewardMint.value)
11173
11590
  });
11174
11591
  if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
11175
- const getAccountMeta = (0, _solana_program_client_core.getAccountMetaFactory)(programAddress, "programId");
11592
+ const getAccountMeta = (0, _solana_kit_program_client_core.getAccountMetaFactory)(programAddress, "programId");
11176
11593
  return Object.freeze({
11177
11594
  accounts: [
11178
11595
  getAccountMeta("user", accounts.user),
@@ -11231,7 +11648,7 @@ function getCreateUserRewardDebtInstruction(input) {
11231
11648
  };
11232
11649
  if (!accounts.stakingConfig.value) accounts.stakingConfig.value = STAKING_CONFIG_PDA_ADDRESS;
11233
11650
  if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
11234
- const getAccountMeta = (0, _solana_program_client_core.getAccountMetaFactory)(programAddress, "programId");
11651
+ const getAccountMeta = (0, _solana_kit_program_client_core.getAccountMetaFactory)(programAddress, "programId");
11235
11652
  return Object.freeze({
11236
11653
  accounts: [
11237
11654
  getAccountMeta("user", accounts.user),
@@ -11357,8 +11774,8 @@ async function getSettleInstructionAsync(input) {
11357
11774
  };
11358
11775
  if (!accounts.stakingConfig.value) accounts.stakingConfig.value = STAKING_CONFIG_PDA_ADDRESS;
11359
11776
  if (!accounts.userStakePosition.value) accounts.userStakePosition.value = await findUserStakePositionPda({
11360
- user: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value),
11361
- stakingMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("stakingMint", accounts.stakingMint.value)
11777
+ user: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value),
11778
+ stakingMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("stakingMint", accounts.stakingMint.value)
11362
11779
  });
11363
11780
  if (!accounts.launchpadRewardAccrual.value) accounts.launchpadRewardAccrual.value = await (0, _solana_kit.getProgramDerivedAddress)({
11364
11781
  programAddress: "5R1uFyEE4oxqkm7hJDqHq6gXaLVF9dxeF3LF4yz1sfLP",
@@ -11377,7 +11794,7 @@ async function getSettleInstructionAsync(input) {
11377
11794
  117,
11378
11795
  97,
11379
11796
  108
11380
- ])), (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("rewardMint", accounts.rewardMint.value))]
11797
+ ])), (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("rewardMint", accounts.rewardMint.value))]
11381
11798
  });
11382
11799
  if (!accounts.dexRewardAccrual.value) accounts.dexRewardAccrual.value = await (0, _solana_kit.getProgramDerivedAddress)({
11383
11800
  programAddress: "84qj5FPZZdXkQy8mfowyg6RBZ3XKuTds6XS4ZYT1sfDX",
@@ -11396,14 +11813,14 @@ async function getSettleInstructionAsync(input) {
11396
11813
  117,
11397
11814
  97,
11398
11815
  108
11399
- ])), (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("rewardMint", accounts.rewardMint.value))]
11816
+ ])), (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("rewardMint", accounts.rewardMint.value))]
11400
11817
  });
11401
11818
  if (!accounts.userRewardDebt.value) accounts.userRewardDebt.value = await findUserRewardDebtPda({
11402
- user: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value),
11403
- stakingMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("stakingMint", accounts.stakingMint.value),
11404
- rewardMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("rewardMint", accounts.rewardMint.value)
11819
+ user: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value),
11820
+ stakingMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("stakingMint", accounts.stakingMint.value),
11821
+ rewardMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("rewardMint", accounts.rewardMint.value)
11405
11822
  });
11406
- const getAccountMeta = (0, _solana_program_client_core.getAccountMetaFactory)(programAddress, "programId");
11823
+ const getAccountMeta = (0, _solana_kit_program_client_core.getAccountMetaFactory)(programAddress, "programId");
11407
11824
  return Object.freeze({
11408
11825
  accounts: [
11409
11826
  getAccountMeta("user", accounts.user),
@@ -11461,7 +11878,7 @@ function getSettleInstruction(input) {
11461
11878
  }
11462
11879
  };
11463
11880
  if (!accounts.stakingConfig.value) accounts.stakingConfig.value = STAKING_CONFIG_PDA_ADDRESS;
11464
- const getAccountMeta = (0, _solana_program_client_core.getAccountMetaFactory)(programAddress, "programId");
11881
+ const getAccountMeta = (0, _solana_kit_program_client_core.getAccountMetaFactory)(programAddress, "programId");
11465
11882
  return Object.freeze({
11466
11883
  accounts: [
11467
11884
  getAccountMeta("user", accounts.user),
@@ -11605,23 +12022,23 @@ async function getStakeInstructionAsync(input) {
11605
12022
  if (!accounts.globalConfig.value) accounts.globalConfig.value = GLOBAL_CONFIG_PDA_ADDRESS;
11606
12023
  if (!accounts.stakingConfig.value) accounts.stakingConfig.value = STAKING_CONFIG_PDA_ADDRESS;
11607
12024
  if (!accounts.userStakePosition.value) accounts.userStakePosition.value = await findUserStakePositionPda({
11608
- user: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value),
11609
- stakingMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("stakingMint", accounts.stakingMint.value)
12025
+ user: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value),
12026
+ stakingMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("stakingMint", accounts.stakingMint.value)
11610
12027
  });
11611
12028
  if (!accounts.userTokenAccount.value) accounts.userTokenAccount.value = await (0, _solana_kit.getProgramDerivedAddress)({
11612
12029
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
11613
12030
  seeds: [
11614
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value)),
12031
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value)),
11615
12032
  (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit.address)("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb")),
11616
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("stakingMint", accounts.stakingMint.value))
12033
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("stakingMint", accounts.stakingMint.value))
11617
12034
  ]
11618
12035
  });
11619
12036
  if (!accounts.poolVault.value) accounts.poolVault.value = await (0, _solana_kit.getProgramDerivedAddress)({
11620
12037
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
11621
12038
  seeds: [
11622
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("stakingConfig", accounts.stakingConfig.value)),
12039
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("stakingConfig", accounts.stakingConfig.value)),
11623
12040
  (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit.address)("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb")),
11624
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("stakingMint", accounts.stakingMint.value))
12041
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("stakingMint", accounts.stakingMint.value))
11625
12042
  ]
11626
12043
  });
11627
12044
  if (!accounts.tokenProgram.value) accounts.tokenProgram.value = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";
@@ -11629,7 +12046,7 @@ async function getStakeInstructionAsync(input) {
11629
12046
  if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
11630
12047
  if (!accounts.eventAuthority.value) accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS;
11631
12048
  if (!accounts.program.value) accounts.program.value = "7rrCurqdWFesbzwtYPo95fM8waTtVXgXwCom45x1sfNX";
11632
- const getAccountMeta = (0, _solana_program_client_core.getAccountMetaFactory)(programAddress, "programId");
12049
+ const getAccountMeta = (0, _solana_kit_program_client_core.getAccountMetaFactory)(programAddress, "programId");
11633
12050
  return Object.freeze({
11634
12051
  accounts: [
11635
12052
  getAccountMeta("user", accounts.user),
@@ -11714,7 +12131,7 @@ function getStakeInstruction(input) {
11714
12131
  if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
11715
12132
  if (!accounts.eventAuthority.value) accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS;
11716
12133
  if (!accounts.program.value) accounts.program.value = "7rrCurqdWFesbzwtYPo95fM8waTtVXgXwCom45x1sfNX";
11717
- const getAccountMeta = (0, _solana_program_client_core.getAccountMetaFactory)(programAddress, "programId");
12134
+ const getAccountMeta = (0, _solana_kit_program_client_core.getAccountMetaFactory)(programAddress, "programId");
11718
12135
  return Object.freeze({
11719
12136
  accounts: [
11720
12137
  getAccountMeta("user", accounts.user),
@@ -11861,23 +12278,23 @@ async function getUnstakeInstructionAsync(input) {
11861
12278
  const args = { ...input };
11862
12279
  if (!accounts.stakingConfig.value) accounts.stakingConfig.value = STAKING_CONFIG_PDA_ADDRESS;
11863
12280
  if (!accounts.userStakePosition.value) accounts.userStakePosition.value = await findUserStakePositionPda({
11864
- user: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value),
11865
- stakingMint: (0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("stakingMint", accounts.stakingMint.value)
12281
+ user: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value),
12282
+ stakingMint: (0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("stakingMint", accounts.stakingMint.value)
11866
12283
  });
11867
12284
  if (!accounts.userTokenAccount.value) accounts.userTokenAccount.value = await (0, _solana_kit.getProgramDerivedAddress)({
11868
12285
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
11869
12286
  seeds: [
11870
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value)),
12287
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("user", accounts.user.value)),
11871
12288
  (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit.address)("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb")),
11872
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("stakingMint", accounts.stakingMint.value))
12289
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("stakingMint", accounts.stakingMint.value))
11873
12290
  ]
11874
12291
  });
11875
12292
  if (!accounts.poolVault.value) accounts.poolVault.value = await (0, _solana_kit.getProgramDerivedAddress)({
11876
12293
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
11877
12294
  seeds: [
11878
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("stakingConfig", accounts.stakingConfig.value)),
12295
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("stakingConfig", accounts.stakingConfig.value)),
11879
12296
  (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit.address)("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb")),
11880
- (0, _solana_kit.getAddressEncoder)().encode((0, _solana_program_client_core.getAddressFromResolvedInstructionAccount)("stakingMint", accounts.stakingMint.value))
12297
+ (0, _solana_kit.getAddressEncoder)().encode((0, _solana_kit_program_client_core.getAddressFromResolvedInstructionAccount)("stakingMint", accounts.stakingMint.value))
11881
12298
  ]
11882
12299
  });
11883
12300
  if (!accounts.tokenProgram.value) accounts.tokenProgram.value = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";
@@ -11885,7 +12302,7 @@ async function getUnstakeInstructionAsync(input) {
11885
12302
  if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
11886
12303
  if (!accounts.eventAuthority.value) accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS;
11887
12304
  if (!accounts.program.value) accounts.program.value = "7rrCurqdWFesbzwtYPo95fM8waTtVXgXwCom45x1sfNX";
11888
- const getAccountMeta = (0, _solana_program_client_core.getAccountMetaFactory)(programAddress, "programId");
12305
+ const getAccountMeta = (0, _solana_kit_program_client_core.getAccountMetaFactory)(programAddress, "programId");
11889
12306
  return Object.freeze({
11890
12307
  accounts: [
11891
12308
  getAccountMeta("user", accounts.user),
@@ -11964,7 +12381,7 @@ function getUnstakeInstruction(input) {
11964
12381
  if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
11965
12382
  if (!accounts.eventAuthority.value) accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS;
11966
12383
  if (!accounts.program.value) accounts.program.value = "7rrCurqdWFesbzwtYPo95fM8waTtVXgXwCom45x1sfNX";
11967
- const getAccountMeta = (0, _solana_program_client_core.getAccountMetaFactory)(programAddress, "programId");
12384
+ const getAccountMeta = (0, _solana_kit_program_client_core.getAccountMetaFactory)(programAddress, "programId");
11968
12385
  return Object.freeze({
11969
12386
  accounts: [
11970
12387
  getAccountMeta("user", accounts.user),
@@ -12221,23 +12638,23 @@ function sendNexusProgram() {
12221
12638
  unstakeEvent: getUnstakeEventDecoder()
12222
12639
  },
12223
12640
  instructions: {
12224
- claim: (input) => (0, _solana_program_client_core.addSelfPlanAndSendFunctions)(client, getClaimInstructionAsync({
12641
+ claim: (input) => (0, _solana_kit_program_client_core.addSelfPlanAndSendFunctions)(client, getClaimInstructionAsync({
12225
12642
  ...input,
12226
12643
  payer: input.payer ?? client.payer
12227
12644
  })),
12228
- createUserRewardDebt: (input) => (0, _solana_program_client_core.addSelfPlanAndSendFunctions)(client, getCreateUserRewardDebtInstructionAsync({
12645
+ createUserRewardDebt: (input) => (0, _solana_kit_program_client_core.addSelfPlanAndSendFunctions)(client, getCreateUserRewardDebtInstructionAsync({
12229
12646
  ...input,
12230
12647
  payer: input.payer ?? client.payer
12231
12648
  })),
12232
- settle: (input) => (0, _solana_program_client_core.addSelfPlanAndSendFunctions)(client, getSettleInstructionAsync({
12649
+ settle: (input) => (0, _solana_kit_program_client_core.addSelfPlanAndSendFunctions)(client, getSettleInstructionAsync({
12233
12650
  ...input,
12234
12651
  payer: input.payer ?? client.payer
12235
12652
  })),
12236
- stake: (input) => (0, _solana_program_client_core.addSelfPlanAndSendFunctions)(client, getStakeInstructionAsync({
12653
+ stake: (input) => (0, _solana_kit_program_client_core.addSelfPlanAndSendFunctions)(client, getStakeInstructionAsync({
12237
12654
  ...input,
12238
12655
  payer: input.payer ?? client.payer
12239
12656
  })),
12240
- unstake: (input) => (0, _solana_program_client_core.addSelfPlanAndSendFunctions)(client, getUnstakeInstructionAsync({
12657
+ unstake: (input) => (0, _solana_kit_program_client_core.addSelfPlanAndSendFunctions)(client, getUnstakeInstructionAsync({
12241
12658
  ...input,
12242
12659
  payer: input.payer ?? client.payer
12243
12660
  }))
@@ -12273,7 +12690,8 @@ var fee_helpers_exports = /* @__PURE__ */ __exportAll({
12273
12690
  effectiveFeeBps: () => effectiveFeeBps,
12274
12691
  fetchPartnerFees: () => fetchPartnerFees
12275
12692
  });
12276
- /** Throws if the pair is unregistered. Take `platformConfig` from the market being priced: a partner's fees differ per platform. */
12693
+ /** Fetches the `PartnerConfig` of `partner` on `platformConfig`. Throws if it does not exist.
12694
+ * Use the `platformConfig` of the market you price. A partner's fees differ per platform. */
12277
12695
  async function fetchPartnerFees(rpc, partner, platformConfig) {
12278
12696
  const [partnerPda] = await findPartnerConfigPda({
12279
12697
  partner,
@@ -12283,8 +12701,9 @@ async function fetchPartnerFees(rpc, partner, platformConfig) {
12283
12701
  if (!maybeAccount.exists) throw new Error(`No fee config for partner ${partner} on platform ${platformConfig}`);
12284
12702
  return maybeAccount.data;
12285
12703
  }
12286
- /** The `feeBps` a trade pays: the standard rate plus the decay premium from the market's
12287
- * `createdAt`. Pass `fees.launchpad` for a curve, `fees.dex` for a pool; times in unix seconds. */
12704
+ /** Returns the `feeBps` a trade pays: the standard rate plus the decay premium. `schedule` is the
12705
+ * `PartnerConfig`'s `launchpad` for a curve or `dex` for a pool. `createdAt` is the curve's or
12706
+ * pool's `createdAt`. Both times are in unix seconds. */
12288
12707
  function effectiveFeeBps(schedule, createdAt, now) {
12289
12708
  const standardFeeBps = schedule.protocolFeeBps + schedule.creatorFeeBps + ("lpFeeBps" in schedule ? schedule.lpFeeBps : 0);
12290
12709
  const premium = calculateFeeDecayPremium({
@@ -12300,7 +12719,7 @@ function effectiveFeeBps(schedule, createdAt, now) {
12300
12719
  //#region src/utils/chunk.ts
12301
12720
  /** RPCs reject a `getMultipleAccounts` call past this many addresses. */
12302
12721
  const MAX_ACCOUNTS_PER_REQUEST = 100;
12303
- /** Splits a multi-account read into 100-address calls; results follow `addresses` order. */
12722
+ /** Calls `read` once per 100 addresses. Results follow `addresses` order. */
12304
12723
  async function fetchInChunks(addresses, read) {
12305
12724
  const chunks = [];
12306
12725
  for (let start = 0; start < addresses.length; start += MAX_ACCOUNTS_PER_REQUEST) chunks.push(addresses.slice(start, start + MAX_ACCOUNTS_PER_REQUEST));
@@ -12335,9 +12754,8 @@ function compareAddresses(a, b) {
12335
12754
  if (a > b) return 1;
12336
12755
  return 0;
12337
12756
  }
12338
- /** Registered reward mints, sorted by address. Includes disabled mints: their accrued balance is
12339
- * still owed and the settle gate still counts them. Throws when the sweep disagrees with
12340
- * `StakingConfig.rewardCount` rather than settle a short list. */
12757
+ /** Returns every registered reward mint, disabled mints included, sorted by address.
12758
+ * Throws if the count differs from `StakingConfig.rewardCount`. */
12341
12759
  async function getRewardMints(rpc) {
12342
12760
  const [stakingConfig] = findStakingConfigPda();
12343
12761
  const [accounts, config] = await Promise.all([rpc.getProgramAccounts(SEND_NEXUS_PROGRAM_ADDRESS, {
@@ -12367,7 +12785,8 @@ async function resolveRewardMints(rpc, rewardMints) {
12367
12785
  if (!hasProgramAccounts(rpc)) throw new Error("This RPC has no getProgramAccounts, so the reward registry cannot be read from chain. Pass rewardMints explicitly.");
12368
12786
  return await getRewardMints(rpc);
12369
12787
  }
12370
- /** One idempotent `settle` per mint; a partial mint list leaves `stake` and `unstake` failing `RewardsNotSettled`. */
12788
+ /** Builds one `settle` per reward mint. `source` is the mint list, or an RPC to read it from.
12789
+ * `settle` is idempotent. With a partial list, `stake` and `unstake` fail with `RewardsNotSettled`. */
12371
12790
  async function buildSettleInstructions(source, params) {
12372
12791
  const rewardMints = isRewardMintList(source) ? source : await resolveRewardMints(source, void 0);
12373
12792
  return Promise.all(rewardMints.map((rewardMint) => getSettleInstructionAsync({
@@ -12388,10 +12807,11 @@ async function fetchMissingUserRewardDebts(rpc, user, stakingMint, knownRewardMi
12388
12807
  return addr;
12389
12808
  })), (chunk) => (0, _solana_kit.fetchEncodedAccounts)(rpc, chunk));
12390
12809
  const missingMints = [];
12391
- for (const [index, rewardMint] of rewardMints.entries()) if (!encodedAccounts[index].exists) missingMints.push(rewardMint);
12810
+ for (const [index, rewardMint] of rewardMints.entries()) if (!accountIsCreated(encodedAccounts[index])) missingMints.push(rewardMint);
12392
12811
  return missingMints;
12393
12812
  }
12394
- /** Opens missing `UserRewardDebt`s, then settles every mint; the user never signs, so the stake or unstake after is one wallet prompt. */
12813
+ /** Builds a `create_user_reward_debt` for each missing `UserRewardDebt`, then a `settle` for every
12814
+ * reward mint. The user does not sign these instructions. */
12395
12815
  async function buildStakingPreflightInstructions(rpc, params) {
12396
12816
  const rewardMints = await resolveRewardMints(rpc, params.rewardMints);
12397
12817
  const missingMints = await fetchMissingUserRewardDebts(rpc, params.user, params.stakingMint, rewardMints);
@@ -12404,13 +12824,14 @@ async function buildStakingPreflightInstructions(rpc, params) {
12404
12824
  const settleIxs = await buildSettleInstructions(rewardMints, params);
12405
12825
  return [...createIxs, ...settleIxs];
12406
12826
  }
12407
- /** True once `stake` and `unstake` will pass the `settledCount == rewardCount` gate. */
12827
+ /** Returns true if `stake` and `unstake` pass the `settledCount == rewardCount` check. */
12408
12828
  async function isFullySettled(rpc, user, stakingMint) {
12409
12829
  const [config, position] = await Promise.all([fetchStakingConfigData(rpc), fetchUserStakePositionData(rpc, user, stakingMint)]);
12410
12830
  if (position === null) return config.rewardCount === 0;
12411
12831
  return position.settledCount === config.rewardCount;
12412
12832
  }
12413
- /** Fails `RewardsNotSettled` until every mint is settled at the current `stakeVersion`; run `buildStakingPreflightInstructions` first. */
12833
+ /** The instruction fails with `RewardsNotSettled` until every mint is settled at the current
12834
+ * `stakeVersion`. Run `buildStakingPreflightInstructions` first. */
12414
12835
  async function buildStakeInstruction(params) {
12415
12836
  return getStakeInstructionAsync({
12416
12837
  user: params.user,
@@ -12419,8 +12840,9 @@ async function buildStakeInstruction(params) {
12419
12840
  amount: params.amount
12420
12841
  });
12421
12842
  }
12422
- /** Settle immediately before via `buildStakingPreflightInstructions`: the gate passes on a stale settle,
12423
- * and the window since it is then paid at the post-unstake amount, forfeiting accrual. */
12843
+ /** Run `buildStakingPreflightInstructions` immediately before. The check also passes on an older
12844
+ * settle. Rewards since that settle then accrue on the smaller post-unstake amount, and the
12845
+ * difference is lost. */
12424
12846
  async function buildUnstakeInstruction(params) {
12425
12847
  return getUnstakeInstructionAsync({
12426
12848
  user: params.user,
@@ -12429,8 +12851,8 @@ async function buildUnstakeInstruction(params) {
12429
12851
  amount: params.amount
12430
12852
  });
12431
12853
  }
12432
- /** One `claim` per mint, preceded by `create_user_reward_debt` where the debt is missing:
12433
- * `Claim` requires the account to exist, so one missing debt fails the whole transaction. */
12854
+ /** Builds one `claim` per reward mint. A `create_user_reward_debt` comes before each `claim` whose
12855
+ * `UserRewardDebt` is missing: `claim` fails without it. Throws if a mint has no `RewardState`. */
12434
12856
  async function buildClaimRewardsInstructions(rpc, params) {
12435
12857
  const [stakingConfigAddr] = findStakingConfigPda();
12436
12858
  const rewardMints = await resolveRewardMints(rpc, params.rewardMints);
@@ -12458,13 +12880,13 @@ async function buildClaimRewardsInstructions(rpc, params) {
12458
12880
  const payer = params.payer ?? params.user;
12459
12881
  return (await Promise.all(rewardMints.map(async (rewardMint, index) => {
12460
12882
  const encodedRewardState = fetched[index];
12461
- if (!encodedRewardState.exists) throw new Error(`RewardState not found for mint ${rewardMint}`);
12883
+ if (!accountIsCreated(encodedRewardState)) throw new Error(`RewardState not found for mint ${rewardMint}`);
12462
12884
  const { vault } = rewardStateDecoder.decode(encodedRewardState.data);
12463
12885
  const encodedMint = fetched[rewardMints.length + index];
12464
12886
  const tokenProgram = encodedMint.exists ? encodedMint.programAddress : void 0;
12465
12887
  const [destination] = await findAssociatedTokenPda(params.user.address, rewardMint, tokenProgram);
12466
12888
  const instructions = [];
12467
- if (!fetched[rewardMints.length * 2 + index].exists) instructions.push(await getCreateUserRewardDebtInstructionAsync({
12889
+ if (!accountIsCreated(fetched[rewardMints.length * 2 + index])) instructions.push(await getCreateUserRewardDebtInstructionAsync({
12468
12890
  user: params.user.address,
12469
12891
  payer,
12470
12892
  stakingMint: params.stakingMint,
@@ -12482,7 +12904,8 @@ async function buildClaimRewardsInstructions(rpc, params) {
12482
12904
  return instructions;
12483
12905
  }))).flat();
12484
12906
  }
12485
- /** Accounts for one mint's `withdraw_fees`; call once per mint. */
12907
+ /** Returns the accounts of `withdraw_fees` for one reward mint. Without `tokenProgram`, reads it
12908
+ * from the mint account. Throws if that account does not exist. */
12486
12909
  async function buildWithdrawFeesAccounts(rpc, params) {
12487
12910
  const [stakingConfigAddr] = findStakingConfigPda();
12488
12911
  const tokenProgram = params.tokenProgram ?? (await rpc.getAccountInfo(params.rewardMint, { encoding: "base64" }).send()).value?.owner;
@@ -12515,19 +12938,19 @@ async function fetchUserStakePositionData(rpc, user, stakingMint) {
12515
12938
  const maybePosition = await fetchMaybeUserStakePosition(rpc, positionAddr);
12516
12939
  return maybePosition.exists ? maybePosition.data : null;
12517
12940
  }
12518
- /** Unbound reads as `Pubkey::default()` (the system program address), which `bind_staking_mint`
12519
- * can never store: it requires a token mint. */
12941
+ /** Returns false for the system program address, the value of an unbound staking mint. */
12520
12942
  function isStakingMintBound(stakingMint) {
12521
- return stakingMint !== SYSTEM_PROGRAM_ADDRESS;
12943
+ return stakingMint !== SYSTEM_PROGRAM_ADDRESS$3;
12522
12944
  }
12523
- /** The staking mint is immutable once bound, so this result is safe to cache. */
12945
+ /** Returns the staking mint. Throws if no staking mint is bound. A bound staking mint cannot change. */
12524
12946
  async function fetchSendMint(rpc) {
12525
12947
  const { stakingMint } = await fetchStakingConfigData(rpc);
12526
12948
  if (!isStakingMintBound(stakingMint)) throw new Error("Staking mint not yet bound -- nexus not fully initialized");
12527
12949
  return stakingMint;
12528
12950
  }
12529
- /** One entry per reward mint, in `knownRewardMints` order, else sorted by address. Each amount is in
12530
- * its own mint's base units, so never sum them, and is the vault's debit, not the claimant's credit. */
12951
+ /** Returns one entry per reward mint, in `knownRewardMints` order, else sorted by address. Each amount
12952
+ * is in the raw units of its own mint. Do not add them together. Each amount is what the vault sends,
12953
+ * before the mint's transfer fee. */
12531
12954
  async function fetchPendingRewards(rpc, user, stakingMint, knownRewardMints) {
12532
12955
  const rewardMints = await resolveRewardMints(rpc, knownRewardMints);
12533
12956
  if (rewardMints.length === 0) return [];
@@ -12568,15 +12991,15 @@ async function fetchPendingRewards(rpc, user, stakingMint, knownRewardMints) {
12568
12991
  return pdas.map(({ rewardMint }, index) => {
12569
12992
  const base = index * 3;
12570
12993
  const encodedDebt = encodedAccounts[base];
12571
- const debt = encodedDebt.exists ? userRewardDebtDecoder.decode(encodedDebt.data) : {
12994
+ const debt = accountIsCreated(encodedDebt) ? userRewardDebtDecoder.decode(encodedDebt.data) : {
12572
12995
  owed: 0n,
12573
12996
  accSnapshot: 0n,
12574
12997
  amountSnapshot: stakeAmount
12575
12998
  };
12576
12999
  const encodedLaunchpadAccrual = encodedAccounts[base + 1];
12577
- const launchpadAcc = encodedLaunchpadAccrual.exists ? rewardAccrualDecoder.decode(encodedLaunchpadAccrual.data).accPerToken : 0n;
13000
+ const launchpadAcc = accountIsCreated(encodedLaunchpadAccrual) ? rewardAccrualDecoder.decode(encodedLaunchpadAccrual.data).accPerToken : 0n;
12578
13001
  const encodedDexAccrual = encodedAccounts[base + 2];
12579
- const dexAcc = encodedDexAccrual.exists ? rewardAccrualDecoder.decode(encodedDexAccrual.data).accPerToken : 0n;
13002
+ const dexAcc = accountIsCreated(encodedDexAccrual) ? rewardAccrualDecoder.decode(encodedDexAccrual.data).accPerToken : 0n;
12580
13003
  const basis = debt.amountSnapshot < stakeAmount ? debt.amountSnapshot : stakeAmount;
12581
13004
  const combined = launchpadAcc + dexAcc;
12582
13005
  const accrued = basis * (combined > debt.accSnapshot ? combined - debt.accSnapshot : 0n) / PRECISION;
@@ -12605,9 +13028,9 @@ var platform_exports = /* @__PURE__ */ __exportAll({
12605
13028
  PLATFORM_SEED: () => PLATFORM_SEED,
12606
13029
  findPlatformAddress: () => findPlatformAddress
12607
13030
  });
12608
- /** A platform is only a key, with no on-chain account; it is a PDA so a platform account can later `init` at it. */
13031
+ /** Seed of the platform PDA. A platform has no on-chain account. */
12609
13032
  const PLATFORM_SEED = "platform";
12610
- /** The name is the platform's identity: renaming one orphans every market and partner config under the old key. */
13033
+ /** Derives the platform key for `name` under the nexus program. Each name gives a different platform. */
12611
13034
  async function findPlatformAddress(name) {
12612
13035
  return await (0, _solana_kit.getProgramDerivedAddress)({
12613
13036
  programAddress: SEND_NEXUS_PROGRAM_ADDRESS,
@@ -12649,8 +13072,9 @@ function readEntry(view, start) {
12649
13072
  basisPoints: view.getUint16(start + FEE_BASIS_POINTS, true)
12650
13073
  };
12651
13074
  }
12652
- /** `owner` is the account's program. `undefined` means no fee extension; anything
12653
- * unparseable throws `RangeError` rather than pricing a charging mint free. */
13075
+ /** Decodes the `TransferFeeConfig` extension of a mint. `owner` is the program that owns the account.
13076
+ * Returns `undefined` if the mint has no such extension. Throws `RangeError` if `owner` is not a
13077
+ * token program or `data` is not a valid mint. */
12654
13078
  function decodeTransferFeeConfig(data, owner) {
12655
13079
  if (owner === TOKEN_PROGRAM_ADDRESS) return void 0;
12656
13080
  if (owner !== TOKEN_2022_PROGRAM_ADDRESS) throw new RangeError(`decodeTransferFeeConfig: ${owner} is not a token program`);
@@ -12679,7 +13103,7 @@ function decodeTransferFeeConfig(data, owner) {
12679
13103
  offset = next;
12680
13104
  }
12681
13105
  }
12682
- /** Mirrors SPL `get_epoch_fee`: the newer entry is live from its own epoch on. */
13106
+ /** Returns the fee for `epoch`, as SPL `get_epoch_fee` does. The newer entry applies from its own epoch on. */
12683
13107
  function transferFeeAtEpoch(config, epoch) {
12684
13108
  const entry = epoch >= config.newer.epoch ? config.newer : config.older;
12685
13109
  return {
@@ -12694,8 +13118,9 @@ function mintFeeAtEpoch(data, owner, epoch) {
12694
13118
  function currentEpoch(rpc, commitment) {
12695
13119
  return rpc.getEpochInfo(commitment === void 0 ? void 0 : { commitment }).send().then((info) => info.epoch);
12696
13120
  }
12697
- /** A missing account throws, never reads as fee-free. Valid only for `epoch`, which defaults to
12698
- * the cluster's (a second call). */
13121
+ /** Reads the transfer fee of each mint for `epoch`. The result is valid only for that epoch.
13122
+ * `epoch` defaults to the current cluster epoch, read with `getEpochInfo`. A mint without a
13123
+ * transfer fee maps to `undefined`. Throws if a mint account is missing or does not decode. */
12699
13124
  async function fetchMintFees(rpc, mints, options) {
12700
13125
  const commitment = options?.commitment;
12701
13126
  const [epoch, accounts] = await Promise.all([options?.epoch ?? currentEpoch(rpc, commitment), fetchInChunks(mints, (chunk) => rpc.getMultipleAccounts(chunk, commitment === void 0 ? { encoding: "base64" } : {
@@ -12724,7 +13149,8 @@ function decodeMintInfo(mint, data, owner) {
12724
13149
  tokenProgram: owner
12725
13150
  };
12726
13151
  }
12727
- /** Throws when the mint does not exist or is not owned by a token program. */
13152
+ /** Reads the decimals and token program of `mint`. Throws if the account does not exist, a token
13153
+ * program does not own it, or it is too short for a mint. */
12728
13154
  async function fetchQuoteMintInfo(rpc, mint, commitment) {
12729
13155
  const { value } = await rpc.getAccountInfo(mint, commitment === void 0 ? { encoding: "base64" } : {
12730
13156
  commitment,
@@ -12733,7 +13159,8 @@ async function fetchQuoteMintInfo(rpc, mint, commitment) {
12733
13159
  if (!value) throw new Error(`fetchQuoteMintInfo: no account at ${mint}`);
12734
13160
  return decodeMintInfo(mint, new Uint8Array((0, _solana_kit.getBase64Encoder)().encode(value.data[0])), value.owner);
12735
13161
  }
12736
- /** One round trip per 100 mints; results follow `mints` order. */
13162
+ /** Reads the decimals and token program of each mint. Results follow `mints` order. Throws as
13163
+ * {@link fetchQuoteMintInfo} does. */
12737
13164
  async function fetchQuoteMintInfos(rpc, mints, commitment) {
12738
13165
  if (mints.length === 0) return [];
12739
13166
  const value = await fetchInChunks(mints, (chunk) => rpc.getMultipleAccounts(chunk, commitment === void 0 ? { encoding: "base64" } : {
@@ -12750,6 +13177,7 @@ async function fetchQuoteMintInfos(rpc, mints, commitment) {
12750
13177
  //#endregion
12751
13178
  //#region src/utils/index.ts
12752
13179
  var utils_exports = /* @__PURE__ */ __exportAll({
13180
+ accountIsCreated: () => accountIsCreated,
12753
13181
  creatorHashFromId: () => creatorHashFromId,
12754
13182
  decodeCreatorId: () => decodeCreatorId,
12755
13183
  encodeCreatorId: () => encodeCreatorId,