@jpool/bond-sdk 0.11.7 → 0.11.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,7 +1,6 @@
1
- import { utils, AnchorProvider, Program, BN } from '@coral-xyz/anchor';
2
- import { STAKE_POOL_PROGRAM_ID, StakePoolInstruction, getStakePoolAccount, depositSol } from '@solana/spl-stake-pool';
3
- import { getAssociatedTokenAddressSync, createAssociatedTokenAccountIdempotentInstruction, ACCOUNT_SIZE, AccountLayout } from '@solana/spl-token';
4
- import { PublicKey, LAMPORTS_PER_SOL, Transaction, Keypair, SystemProgram } from '@solana/web3.js';
1
+ import { utils, Program, AnchorProvider, BN } from '@coral-xyz/anchor';
2
+ import { getAssociatedTokenAddressSync, ACCOUNT_SIZE, AccountLayout } from '@solana/spl-token';
3
+ import { PublicKey, Transaction, LAMPORTS_PER_SOL } from '@solana/web3.js';
5
4
 
6
5
  var __create = Object.create;
7
6
  var __defProp = Object.defineProperty;
@@ -4548,13 +4547,17 @@ var require_bn = __commonJS({
4548
4547
  // src/client.ts
4549
4548
  var import_bn = __toESM(require_bn());
4550
4549
 
4550
+ // src/constants.ts
4551
+ var GLOBAL_STATE_SEED = "global_state";
4552
+ var BOND_STATE_SEED = "bond_state";
4553
+ var VALIDATOR_BOND_SEED = "validator_bond";
4554
+ var STANDARD_BOND_SEED = "standard";
4555
+ var CROWDFUNDING_BOND_SEED = "crowdfunding";
4556
+ var ENV_PROGRAM_ID = {
4557
+ // [BondClientEnv.DEV]: new PublicKey('...'),
4558
+ };
4559
+
4551
4560
  // src/types/index.ts
4552
- var JBondClientEnv = /* @__PURE__ */ ((JBondClientEnv2) => {
4553
- JBondClientEnv2["DEV"] = "dev";
4554
- JBondClientEnv2["STAGE"] = "stage";
4555
- JBondClientEnv2["PROD"] = "prod";
4556
- return JBondClientEnv2;
4557
- })(JBondClientEnv || {});
4558
4561
  var SessionStatus = /* @__PURE__ */ ((SessionStatus2) => {
4559
4562
  SessionStatus2[SessionStatus2["Live"] = 0] = "Live";
4560
4563
  SessionStatus2[SessionStatus2["Finished"] = 1] = "Finished";
@@ -4566,26 +4569,13 @@ var BondType = /* @__PURE__ */ ((BondType2) => {
4566
4569
  return BondType2;
4567
4570
  })(BondType || {});
4568
4571
  var BondTransactionType = /* @__PURE__ */ ((BondTransactionType2) => {
4569
- BondTransactionType2["Registered"] = "registered";
4570
4572
  BondTransactionType2["Deposit"] = "deposit";
4571
4573
  BondTransactionType2["Withdrawal"] = "withdrawal";
4572
4574
  BondTransactionType2["Compensation"] = "compensation";
4573
4575
  return BondTransactionType2;
4574
4576
  })(BondTransactionType || {});
4575
4577
 
4576
- // src/constants.ts
4577
- var GLOBAL_STATE_SEED = "global_state";
4578
- var BOND_STATE_SEED = "bond_state";
4579
- var VALIDATOR_BOND_SEED = "validator_bond";
4580
- var STANDARD_BOND_SEED = "standard";
4581
- var CROWDFUNDING_BOND_SEED = "crowdfunding";
4582
- var ENV_PROGRAM_ID = {
4583
- ["dev" /* DEV */]: "Fo17edWRJewZNTRibgx9iTfjywCW6dzS81VwBLmPFVq1",
4584
- ["stage" /* STAGE */]: "Fo17edWRJewZNTRibgx9iTfjywCW6dzS81VwBLmPFVq1",
4585
- ["prod" /* PROD */]: "BondQ7KqZreTcW2UbeTNDcLCJQ3aXAtLn2Fm6ftaJDU"
4586
- };
4587
- var JSOL_MINT = new PublicKey("7Q2afV64in6N6SeZsAAB81TJzwDoD6zpqmHkzi9Dcavn");
4588
- var JPOOL_POOL_ADDRESS = new PublicKey("CtMyWsrUtAwXWiGr9WjHT5fC3p3fgV8cyGpLTo2LJzG1");
4578
+ // src/history.ts
4589
4579
  var { bs58 } = utils.bytes;
4590
4580
  var HistoryManager = class {
4591
4581
  constructor(client) {
@@ -4607,8 +4597,7 @@ var HistoryManager = class {
4607
4597
  }
4608
4598
  async getHistory(bondType, bondName, vote, opts) {
4609
4599
  const [validatorBondAccount] = this.client.pda.validatorBond(bondType, bondName, vote);
4610
- const validatorBondAccount58 = validatorBondAccount.toBase58();
4611
- this.debug(`Fetching history for validator bond account: ${validatorBondAccount58}`);
4600
+ this.debug(`Fetching history for validator bond account: ${validatorBondAccount.toBase58()}`);
4612
4601
  const signatures = await this.fetchSignaturesForAddress(validatorBondAccount, {
4613
4602
  limit: opts?.limit,
4614
4603
  before: opts?.before,
@@ -4649,11 +4638,8 @@ var HistoryManager = class {
4649
4638
  if (ix.parsed) {
4650
4639
  continue;
4651
4640
  }
4652
- if (!this.instructionReferencesBondAccount(ix, validatorBondAccount, validatorBondAccount58)) {
4653
- continue;
4654
- }
4655
4641
  const { type, amount } = this.decodeInstructionData(ix.data);
4656
- if (!type || amount <= 0 && type !== "registered" /* Registered */) {
4642
+ if (!type || amount <= 0) {
4657
4643
  continue;
4658
4644
  }
4659
4645
  history.push({
@@ -4667,27 +4653,13 @@ var HistoryManager = class {
4667
4653
  }
4668
4654
  return history.sort((a, b) => b.slot - a.slot);
4669
4655
  }
4670
- instructionReferencesBondAccount(ix, validatorBondAccount, validatorBondAccount58) {
4671
- if (!Array.isArray(ix.accounts) || ix.accounts.length === 0) {
4672
- return false;
4673
- }
4674
- return ix.accounts.some((account) => {
4675
- if (typeof account === "string") {
4676
- return account === validatorBondAccount58;
4677
- }
4678
- if (account instanceof PublicKey) {
4679
- return account.equals(validatorBondAccount);
4680
- }
4681
- const account58 = account?.toBase58?.();
4682
- return typeof account58 === "string" && account58 === validatorBondAccount58;
4683
- });
4684
- }
4685
4656
  async fetchSignaturesForAddress(address, options) {
4686
4657
  const sigs = await this.connection.getSignaturesForAddress(address, {
4687
4658
  limit: options?.limit || 1e3,
4688
4659
  before: options?.before,
4689
4660
  until: options?.until
4690
4661
  }, "confirmed");
4662
+ console.log(sigs);
4691
4663
  return sigs.filter((s) => !s.err);
4692
4664
  }
4693
4665
  async fetchParsedTransactions(sigs, batchSize = 100) {
@@ -4709,7 +4681,7 @@ var HistoryManager = class {
4709
4681
  }
4710
4682
  const ix = this.program.idl.instructions.find((i) => i.name === name);
4711
4683
  if (!ix || !Array.isArray(ix.discriminator)) {
4712
- return new Uint8Array();
4684
+ throw new Error(`Discriminator not found for instruction ${name}`);
4713
4685
  }
4714
4686
  const disc = new Uint8Array(ix.discriminator);
4715
4687
  this.discCache.set(name, disc);
@@ -4717,45 +4689,47 @@ var HistoryManager = class {
4717
4689
  }
4718
4690
  decodeInstructionData(data) {
4719
4691
  if (!data) {
4720
- return { type: null, amount: 0 };
4692
+ return {
4693
+ type: null,
4694
+ amount: 0
4695
+ };
4721
4696
  }
4722
4697
  try {
4723
4698
  const buf = bs58.decode(data);
4724
- let type = null;
4725
- const disc = buf.subarray(0, 8);
4726
- const amountBytes = buf.subarray(8, 16);
4727
- let amount = 0;
4728
- let noAmount = false;
4729
- try {
4730
- amount = new BN(amountBytes, "le").toNumber() / LAMPORTS_PER_SOL;
4731
- } catch {
4732
- noAmount = true;
4733
- }
4734
- const bondRegisterDiscriminator = this.getInstructionDiscriminator("bondRegister");
4735
- const bondTopUpDiscriminator = this.getInstructionDiscriminator("bondTopUp");
4736
- const bondClaimDiscriminator = this.getInstructionDiscriminator("bondClaim");
4737
- const bondWithdrawDiscriminator = this.getInstructionDiscriminator("bondWithdraw");
4738
- if (Buffer.from(disc).equals(Buffer.from(bondRegisterDiscriminator))) {
4739
- type = "registered" /* Registered */;
4740
- } else if (!noAmount) {
4741
- if (Buffer.from(disc).equals(Buffer.from(bondTopUpDiscriminator))) {
4742
- type = "deposit" /* Deposit */;
4743
- } else if (Buffer.from(disc).equals(Buffer.from(bondClaimDiscriminator))) {
4744
- type = "compensation" /* Compensation */;
4745
- } else if (Buffer.from(disc).equals(Buffer.from(bondWithdrawDiscriminator))) {
4746
- type = "withdrawal" /* Withdrawal */;
4747
- }
4748
- }
4749
- return { type, amount };
4750
- } catch (error) {
4751
- console.error("Failed to decode instruction data:", error);
4699
+ if (buf.length < 16) {
4700
+ return {
4701
+ type: null,
4702
+ amount: 0
4703
+ };
4704
+ }
4705
+ const disc = buf.slice(0, 8);
4706
+ const amountBytes = buf.slice(8, 16);
4707
+ const amount = new BN(amountBytes, "le").toNumber() / LAMPORTS_PER_SOL;
4708
+ const perfRegister = this.getInstructionDiscriminator("perfBondRegister");
4709
+ const perfTopUp = this.getInstructionDiscriminator("perfBondTopUp");
4710
+ const perfClaim = this.getInstructionDiscriminator("perfBondClaim");
4711
+ const perfWithdraw = this.getInstructionDiscriminator("perfBondWithdraw");
4712
+ if (Buffer.from(disc).equals(Buffer.from(perfRegister))) {
4713
+ return { type: "deposit" /* Deposit */, amount };
4714
+ }
4715
+ if (Buffer.from(disc).equals(Buffer.from(perfTopUp))) {
4716
+ return { type: "deposit" /* Deposit */, amount };
4717
+ }
4718
+ if (Buffer.from(disc).equals(Buffer.from(perfClaim))) {
4719
+ return { type: "compensation" /* Compensation */, amount };
4720
+ }
4721
+ if (Buffer.from(disc).equals(Buffer.from(perfWithdraw))) {
4722
+ return { type: "withdrawal" /* Withdrawal */, amount };
4723
+ }
4724
+ return { type: null, amount: 0 };
4725
+ } catch {
4752
4726
  return { type: null, amount: 0 };
4753
4727
  }
4754
4728
  }
4755
4729
  };
4756
4730
  function slotToEpoch(slot, cluster) {
4757
- const isDevnet = cluster?.includes("devnet") || cluster?.includes("localnet");
4758
- const slotsPerEpoch = isDevnet ? 4e5 : 432e3;
4731
+ const isMainnet = !cluster || cluster === "mainnet-beta";
4732
+ const slotsPerEpoch = isMainnet ? 432e3 : 4e5;
4759
4733
  return Math.floor(slot / slotsPerEpoch);
4760
4734
  }
4761
4735
 
@@ -4764,7 +4738,7 @@ var jbond_default = {
4764
4738
  address: "BondQ7KqZreTcW2UbeTNDcLCJQ3aXAtLn2Fm6ftaJDU",
4765
4739
  metadata: {
4766
4740
  name: "jbond",
4767
- version: "0.2.6",
4741
+ version: "0.2.1",
4768
4742
  spec: "0.1.0",
4769
4743
  description: "Jpool Bond Program"
4770
4744
  },
@@ -4839,10 +4813,7 @@ var jbond_default = {
4839
4813
  },
4840
4814
  {
4841
4815
  name: "authority",
4842
- signer: true,
4843
- relations: [
4844
- "bond_state"
4845
- ]
4816
+ signer: true
4846
4817
  },
4847
4818
  {
4848
4819
  name: "bond_token_account",
@@ -5013,84 +4984,6 @@ var jbond_default = {
5013
4984
  }
5014
4985
  ]
5015
4986
  },
5016
- {
5017
- name: "bond_lock_funds",
5018
- docs: [
5019
- "Locks funds immediately, making them unavailable for withdrawal.",
5020
- "The locked amount takes effect immediately in the current epoch.",
5021
- "",
5022
- "# Errors",
5023
- "Fails if the bond type is not lockable, if the amount is zero,",
5024
- "or if there are insufficient available funds."
5025
- ],
5026
- discriminator: [
5027
- 117,
5028
- 166,
5029
- 195,
5030
- 99,
5031
- 103,
5032
- 45,
5033
- 195,
5034
- 2
5035
- ],
5036
- accounts: [
5037
- {
5038
- name: "bond_state",
5039
- writable: true
5040
- },
5041
- {
5042
- name: "validator_bond",
5043
- writable: true,
5044
- pda: {
5045
- seeds: [
5046
- {
5047
- kind: "const",
5048
- value: [
5049
- 118,
5050
- 97,
5051
- 108,
5052
- 105,
5053
- 100,
5054
- 97,
5055
- 116,
5056
- 111,
5057
- 114,
5058
- 95,
5059
- 98,
5060
- 111,
5061
- 110,
5062
- 100
5063
- ]
5064
- },
5065
- {
5066
- kind: "account",
5067
- path: "bond_state"
5068
- },
5069
- {
5070
- kind: "account",
5071
- path: "validator_bond.vote_account",
5072
- account: "ValidatorBond"
5073
- }
5074
- ]
5075
- }
5076
- },
5077
- {
5078
- name: "bond_token_account",
5079
- optional: true
5080
- },
5081
- {
5082
- name: "payer",
5083
- writable: true,
5084
- signer: true
5085
- }
5086
- ],
5087
- args: [
5088
- {
5089
- name: "amount",
5090
- type: "u64"
5091
- }
5092
- ]
5093
- },
5094
4987
  {
5095
4988
  name: "bond_register",
5096
4989
  docs: [
@@ -5118,34 +5011,7 @@ var jbond_default = {
5118
5011
  accounts: [
5119
5012
  {
5120
5013
  name: "bond_state",
5121
- writable: true,
5122
- pda: {
5123
- seeds: [
5124
- {
5125
- kind: "const",
5126
- value: [
5127
- 98,
5128
- 111,
5129
- 110,
5130
- 100,
5131
- 95,
5132
- 115,
5133
- 116,
5134
- 97,
5135
- 116,
5136
- 101
5137
- ]
5138
- },
5139
- {
5140
- kind: "arg",
5141
- path: "bond_type"
5142
- },
5143
- {
5144
- kind: "arg",
5145
- path: "bond_name"
5146
- }
5147
- ]
5148
- }
5014
+ writable: true
5149
5015
  },
5150
5016
  {
5151
5017
  name: "validator_bond",
@@ -5230,112 +5096,6 @@ var jbond_default = {
5230
5096
  }
5231
5097
  ]
5232
5098
  },
5233
- {
5234
- name: "bond_release_funds",
5235
- docs: [
5236
- "Queues funds for unlock in the next epoch.",
5237
- "The unlock is delayed by one epoch for security - funds remain locked",
5238
- "in the current epoch but will be available after epoch transition.",
5239
- "",
5240
- "# Errors",
5241
- "Fails if the bond type is not lockable, if the amount is zero,",
5242
- "or if the amount exceeds currently locked funds."
5243
- ],
5244
- discriminator: [
5245
- 184,
5246
- 224,
5247
- 14,
5248
- 24,
5249
- 76,
5250
- 14,
5251
- 226,
5252
- 190
5253
- ],
5254
- accounts: [
5255
- {
5256
- name: "bond_state",
5257
- writable: true
5258
- },
5259
- {
5260
- name: "validator_bond",
5261
- writable: true,
5262
- pda: {
5263
- seeds: [
5264
- {
5265
- kind: "const",
5266
- value: [
5267
- 118,
5268
- 97,
5269
- 108,
5270
- 105,
5271
- 100,
5272
- 97,
5273
- 116,
5274
- 111,
5275
- 114,
5276
- 95,
5277
- 98,
5278
- 111,
5279
- 110,
5280
- 100
5281
- ]
5282
- },
5283
- {
5284
- kind: "account",
5285
- path: "bond_state"
5286
- },
5287
- {
5288
- kind: "account",
5289
- path: "validator_bond.vote_account",
5290
- account: "ValidatorBond"
5291
- }
5292
- ]
5293
- }
5294
- },
5295
- {
5296
- name: "payer",
5297
- writable: true,
5298
- signer: true
5299
- }
5300
- ],
5301
- args: [
5302
- {
5303
- name: "amount",
5304
- type: "u64"
5305
- }
5306
- ]
5307
- },
5308
- {
5309
- name: "bond_remove",
5310
- docs: [
5311
- "Removes bond state"
5312
- ],
5313
- discriminator: [
5314
- 121,
5315
- 112,
5316
- 246,
5317
- 177,
5318
- 181,
5319
- 8,
5320
- 18,
5321
- 220
5322
- ],
5323
- accounts: [
5324
- {
5325
- name: "bond_state",
5326
- writable: true
5327
- },
5328
- {
5329
- name: "authority",
5330
- writable: true,
5331
- signer: true,
5332
- relations: [
5333
- "bond_state"
5334
- ]
5335
- }
5336
- ],
5337
- args: []
5338
- },
5339
5099
  {
5340
5100
  name: "bond_set_withdraw_authority",
5341
5101
  docs: [
@@ -5626,113 +5386,16 @@ var jbond_default = {
5626
5386
  ]
5627
5387
  },
5628
5388
  {
5629
- name: "close_validator_bond",
5630
- docs: [
5631
- "Closes a validator bond account and transfers remaining balance to the rent receiver.",
5632
- "",
5633
- "# Security",
5634
- "- Only the validator identity or withdrawal authority can close the bond",
5635
- "- All funds must be unlocked (locked == 0 and pending_unlock == 0)",
5636
- "- For token collateral, closes the associated token account as well",
5637
- "- Decrements the bond state's total_members counter",
5638
- "",
5639
- "# Errors",
5640
- "Fails if the signer is not authorized, if funds are still locked,",
5641
- "or if the rent receiver is not the identity or withdrawal authority."
5642
- ],
5389
+ name: "global_configure",
5643
5390
  discriminator: [
5644
- 51,
5645
- 235,
5646
- 111,
5647
- 163,
5648
- 176,
5649
- 239,
5650
- 95,
5651
- 122
5652
- ],
5653
- accounts: [
5654
- {
5655
- name: "bond_state",
5656
- writable: true
5657
- },
5658
- {
5659
- name: "validator_bond",
5660
- writable: true,
5661
- pda: {
5662
- seeds: [
5663
- {
5664
- kind: "const",
5665
- value: [
5666
- 118,
5667
- 97,
5668
- 108,
5669
- 105,
5670
- 100,
5671
- 97,
5672
- 116,
5673
- 111,
5674
- 114,
5675
- 95,
5676
- 98,
5677
- 111,
5678
- 110,
5679
- 100
5680
- ]
5681
- },
5682
- {
5683
- kind: "account",
5684
- path: "bond_state"
5685
- },
5686
- {
5687
- kind: "account",
5688
- path: "validator_bond.vote_account",
5689
- account: "ValidatorBond"
5690
- }
5691
- ]
5692
- }
5693
- },
5694
- {
5695
- name: "authority",
5696
- writable: true,
5697
- signer: true
5698
- },
5699
- {
5700
- name: "rent_receiver",
5701
- writable: true
5702
- },
5703
- {
5704
- name: "bond_token_account",
5705
- writable: true,
5706
- optional: true
5707
- },
5708
- {
5709
- name: "destination_token_account",
5710
- writable: true,
5711
- optional: true
5712
- },
5713
- {
5714
- name: "system_program",
5715
- address: "11111111111111111111111111111111"
5716
- },
5717
- {
5718
- name: "token_program",
5719
- optional: true,
5720
- address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
5721
- }
5722
- ],
5723
- args: []
5724
- },
5725
- {
5726
- name: "global_configure",
5727
- discriminator: [
5728
- 67,
5729
- 142,
5730
- 164,
5731
- 250,
5732
- 90,
5733
- 233,
5734
- 144,
5735
- 187
5391
+ 67,
5392
+ 142,
5393
+ 164,
5394
+ 250,
5395
+ 90,
5396
+ 233,
5397
+ 144,
5398
+ 187
5736
5399
  ],
5737
5400
  accounts: [
5738
5401
  {
@@ -5829,6 +5492,80 @@ var jbond_default = {
5829
5492
  ],
5830
5493
  args: []
5831
5494
  },
5495
+ {
5496
+ name: "migrate_bond",
5497
+ docs: [
5498
+ "Migrates validator bond data from legacy structure to new structure."
5499
+ ],
5500
+ discriminator: [
5501
+ 107,
5502
+ 119,
5503
+ 59,
5504
+ 110,
5505
+ 76,
5506
+ 18,
5507
+ 37,
5508
+ 163
5509
+ ],
5510
+ accounts: [
5511
+ {
5512
+ name: "bond_state",
5513
+ writable: true
5514
+ },
5515
+ {
5516
+ name: "legacy_validator_bond",
5517
+ writable: true
5518
+ },
5519
+ {
5520
+ name: "legacy_vote_account"
5521
+ },
5522
+ {
5523
+ name: "validator_bond",
5524
+ writable: true,
5525
+ pda: {
5526
+ seeds: [
5527
+ {
5528
+ kind: "const",
5529
+ value: [
5530
+ 118,
5531
+ 97,
5532
+ 108,
5533
+ 105,
5534
+ 100,
5535
+ 97,
5536
+ 116,
5537
+ 111,
5538
+ 114,
5539
+ 95,
5540
+ 98,
5541
+ 111,
5542
+ 110,
5543
+ 100
5544
+ ]
5545
+ },
5546
+ {
5547
+ kind: "account",
5548
+ path: "bond_state"
5549
+ },
5550
+ {
5551
+ kind: "account",
5552
+ path: "legacy_vote_account"
5553
+ }
5554
+ ]
5555
+ }
5556
+ },
5557
+ {
5558
+ name: "creator",
5559
+ writable: true,
5560
+ signer: true
5561
+ },
5562
+ {
5563
+ name: "system_program",
5564
+ address: "11111111111111111111111111111111"
5565
+ }
5566
+ ],
5567
+ args: []
5568
+ },
5832
5569
  {
5833
5570
  name: "session_finish",
5834
5571
  docs: [
@@ -5939,19 +5676,6 @@ var jbond_default = {
5939
5676
  }
5940
5677
  ],
5941
5678
  events: [
5942
- {
5943
- name: "BondConfigured",
5944
- discriminator: [
5945
- 141,
5946
- 252,
5947
- 43,
5948
- 54,
5949
- 45,
5950
- 157,
5951
- 81,
5952
- 14
5953
- ]
5954
- },
5955
5679
  {
5956
5680
  name: "BondFinished",
5957
5681
  discriminator: [
@@ -5965,32 +5689,6 @@ var jbond_default = {
5965
5689
  191
5966
5690
  ]
5967
5691
  },
5968
- {
5969
- name: "BondInitialized",
5970
- discriminator: [
5971
- 73,
5972
- 68,
5973
- 161,
5974
- 2,
5975
- 214,
5976
- 12,
5977
- 169,
5978
- 53
5979
- ]
5980
- },
5981
- {
5982
- name: "BondRemoved",
5983
- discriminator: [
5984
- 177,
5985
- 200,
5986
- 116,
5987
- 123,
5988
- 1,
5989
- 244,
5990
- 161,
5991
- 240
5992
- ]
5993
- },
5994
5692
  {
5995
5693
  name: "BondStarted",
5996
5694
  discriminator: [
@@ -6005,16 +5703,16 @@ var jbond_default = {
6005
5703
  ]
6006
5704
  },
6007
5705
  {
6008
- name: "CollateralDeposited",
5706
+ name: "CollateralToppedUp",
6009
5707
  discriminator: [
6010
- 244,
6011
- 62,
6012
- 77,
6013
- 11,
5708
+ 189,
5709
+ 137,
5710
+ 204,
5711
+ 58,
6014
5712
  135,
6015
- 112,
6016
- 61,
6017
- 96
5713
+ 182,
5714
+ 19,
5715
+ 176
6018
5716
  ]
6019
5717
  },
6020
5718
  {
@@ -6030,19 +5728,6 @@ var jbond_default = {
6030
5728
  82
6031
5729
  ]
6032
5730
  },
6033
- {
6034
- name: "CompensationBurned",
6035
- discriminator: [
6036
- 177,
6037
- 198,
6038
- 90,
6039
- 188,
6040
- 47,
6041
- 95,
6042
- 20,
6043
- 174
6044
- ]
6045
- },
6046
5731
  {
6047
5732
  name: "CompensationClaimed",
6048
5733
  discriminator: [
@@ -6056,45 +5741,6 @@ var jbond_default = {
6056
5741
  32
6057
5742
  ]
6058
5743
  },
6059
- {
6060
- name: "FundsLocked",
6061
- discriminator: [
6062
- 227,
6063
- 93,
6064
- 162,
6065
- 69,
6066
- 181,
6067
- 4,
6068
- 71,
6069
- 157
6070
- ]
6071
- },
6072
- {
6073
- name: "FundsUnlocked",
6074
- discriminator: [
6075
- 11,
6076
- 240,
6077
- 184,
6078
- 107,
6079
- 86,
6080
- 187,
6081
- 196,
6082
- 128
6083
- ]
6084
- },
6085
- {
6086
- name: "ValidatorBondClosed",
6087
- discriminator: [
6088
- 71,
6089
- 54,
6090
- 59,
6091
- 241,
6092
- 91,
6093
- 35,
6094
- 123,
6095
- 123
6096
- ]
6097
- },
6098
5744
  {
6099
5745
  name: "ValidatorRegistered",
6100
5746
  discriminator: [
@@ -6107,46 +5753,33 @@ var jbond_default = {
6107
5753
  95,
6108
5754
  72
6109
5755
  ]
6110
- },
6111
- {
6112
- name: "WithdrawAuthorityChanged",
6113
- discriminator: [
6114
- 91,
6115
- 149,
6116
- 224,
6117
- 49,
6118
- 187,
6119
- 48,
6120
- 190,
6121
- 100
6122
- ]
6123
5756
  }
6124
5757
  ],
6125
5758
  errors: [
6126
5759
  {
6127
5760
  code: 6e3,
6128
- name: "Forbidden",
6129
- msg: "Forbidden"
5761
+ name: "InvalidVoteAccount",
5762
+ msg: "Invalid vote account"
6130
5763
  },
6131
5764
  {
6132
5765
  code: 6001,
6133
- name: "Unauthorized",
6134
- msg: "Unauthorized"
5766
+ name: "IdentityMismatch",
5767
+ msg: "Identity does not match vote account"
6135
5768
  },
6136
5769
  {
6137
5770
  code: 6002,
6138
- name: "InvalidVoteAccount",
6139
- msg: "Invalid vote account"
5771
+ name: "InsufficientCollateral",
5772
+ msg: "Insufficient collateral amount"
6140
5773
  },
6141
5774
  {
6142
5775
  code: 6003,
6143
- name: "IdentityMismatch",
6144
- msg: "Vote account identity mismatch"
5776
+ name: "TargetAprTooLow",
5777
+ msg: "Target APR is below minimum threshold"
6145
5778
  },
6146
5779
  {
6147
5780
  code: 6004,
6148
- name: "InvalidMint",
6149
- msg: "Invalid mint address"
5781
+ name: "MathOverflow",
5782
+ msg: "Math overflow"
6150
5783
  },
6151
5784
  {
6152
5785
  code: 6005,
@@ -6155,53 +5788,93 @@ var jbond_default = {
6155
5788
  },
6156
5789
  {
6157
5790
  code: 6006,
6158
- name: "InvalidArgument",
6159
- msg: "Invalid argument"
5791
+ name: "ValidatorNotActive",
5792
+ msg: "Validator bond account is not active"
6160
5793
  },
6161
5794
  {
6162
5795
  code: 6007,
6163
- name: "InsufficientBalance",
6164
- msg: "Insufficient balance"
5796
+ name: "ValidatorAlreadyRegistered",
5797
+ msg: "Validator already registered"
6165
5798
  },
6166
5799
  {
6167
5800
  code: 6008,
6168
- name: "MathOverflow",
6169
- msg: "Math overflow"
5801
+ name: "Unauthorized",
5802
+ msg: "Unauthorized"
6170
5803
  },
6171
5804
  {
6172
5805
  code: 6009,
6173
- name: "Overflow",
6174
- msg: "Arithmetic overflow"
5806
+ name: "WithdrawalLockedNearEpochEnd",
5807
+ msg: "Withdrawals are locked near the end of the epoch."
6175
5808
  },
6176
5809
  {
6177
5810
  code: 6010,
6178
- name: "BondNotRemovable",
6179
- msg: "Bond cannot be removed"
5811
+ name: "MissingTokenAccounts",
5812
+ msg: "Missing token accounts for token collateral type"
6180
5813
  },
6181
5814
  {
6182
5815
  code: 6011,
6183
- name: "MissingTokenAccounts",
6184
- msg: "Missing token accounts"
5816
+ name: "MissingTokenProgram",
5817
+ msg: "Token program is required for token collateral type"
6185
5818
  },
6186
5819
  {
6187
5820
  code: 6012,
6188
- name: "MissingTokenProgram",
6189
- msg: "Missing token program"
5821
+ name: "InvalidMint",
5822
+ msg: "Invalid mint for token collateral type"
6190
5823
  },
6191
5824
  {
6192
5825
  code: 6013,
6193
5826
  name: "MissingStakeAccount",
6194
- msg: "Missing stake account"
5827
+ msg: "Stake account is required for stake account collateral type"
6195
5828
  },
6196
5829
  {
6197
5830
  code: 6014,
6198
5831
  name: "MissingStakeProgram",
6199
- msg: "Missing stake program"
5832
+ msg: "Stake program is required for stake account collateral type"
6200
5833
  },
6201
5834
  {
6202
5835
  code: 6015,
5836
+ name: "BondFinished",
5837
+ msg: "Bond is finished (deposits/withdrawals disabled)"
5838
+ },
5839
+ {
5840
+ code: 6016,
5841
+ name: "BondNotFinished",
5842
+ msg: "Bond is not finished"
5843
+ },
5844
+ {
5845
+ code: 6017,
6203
5846
  name: "UnsupportedCollateralType",
6204
5847
  msg: "Unsupported collateral type"
5848
+ },
5849
+ {
5850
+ code: 6018,
5851
+ name: "Overflow",
5852
+ msg: "Math operation overflowed"
5853
+ },
5854
+ {
5855
+ code: 6019,
5856
+ name: "IncorrectBondType",
5857
+ msg: "Incorrect bond type for this operation"
5858
+ },
5859
+ {
5860
+ code: 6020,
5861
+ name: "BondNotFinishable",
5862
+ msg: "This bond type can't be finished"
5863
+ },
5864
+ {
5865
+ code: 6021,
5866
+ name: "InvalidArgument",
5867
+ msg: "Invalid argument provided"
5868
+ },
5869
+ {
5870
+ code: 6022,
5871
+ name: "BondNotDisabled",
5872
+ msg: "Bond is not disabled"
5873
+ },
5874
+ {
5875
+ code: 6023,
5876
+ name: "BondNotEnabled",
5877
+ msg: "Bond is not enabled"
6205
5878
  }
6206
5879
  ],
6207
5880
  types: [
@@ -6235,26 +5908,6 @@ var jbond_default = {
6235
5908
  ]
6236
5909
  }
6237
5910
  },
6238
- {
6239
- name: "BondConfigured",
6240
- type: {
6241
- kind: "struct",
6242
- fields: [
6243
- {
6244
- name: "bond",
6245
- type: "pubkey"
6246
- },
6247
- {
6248
- name: "authority",
6249
- type: "pubkey"
6250
- },
6251
- {
6252
- name: "timestamp",
6253
- type: "i64"
6254
- }
6255
- ]
6256
- }
6257
- },
6258
5911
  {
6259
5912
  name: "BondFinished",
6260
5913
  type: {
@@ -6310,46 +5963,6 @@ var jbond_default = {
6310
5963
  ]
6311
5964
  }
6312
5965
  },
6313
- {
6314
- name: "BondInitialized",
6315
- type: {
6316
- kind: "struct",
6317
- fields: [
6318
- {
6319
- name: "bond",
6320
- type: "pubkey"
6321
- },
6322
- {
6323
- name: "authority",
6324
- type: "pubkey"
6325
- },
6326
- {
6327
- name: "timestamp",
6328
- type: "i64"
6329
- }
6330
- ]
6331
- }
6332
- },
6333
- {
6334
- name: "BondRemoved",
6335
- type: {
6336
- kind: "struct",
6337
- fields: [
6338
- {
6339
- name: "bond",
6340
- type: "pubkey"
6341
- },
6342
- {
6343
- name: "authority",
6344
- type: "pubkey"
6345
- },
6346
- {
6347
- name: "timestamp",
6348
- type: "i64"
6349
- }
6350
- ]
6351
- }
6352
- },
6353
5966
  {
6354
5967
  name: "BondStarted",
6355
5968
  type: {
@@ -6503,7 +6116,7 @@ var jbond_default = {
6503
6116
  }
6504
6117
  },
6505
6118
  {
6506
- name: "CollateralDeposited",
6119
+ name: "CollateralToppedUp",
6507
6120
  type: {
6508
6121
  kind: "struct",
6509
6122
  fields: [
@@ -6573,34 +6186,6 @@ var jbond_default = {
6573
6186
  ]
6574
6187
  }
6575
6188
  },
6576
- {
6577
- name: "CompensationBurned",
6578
- type: {
6579
- kind: "struct",
6580
- fields: [
6581
- {
6582
- name: "validator",
6583
- type: "pubkey"
6584
- },
6585
- {
6586
- name: "amount",
6587
- type: "u64"
6588
- },
6589
- {
6590
- name: "post_balance",
6591
- type: "u64"
6592
- },
6593
- {
6594
- name: "epoch",
6595
- type: "u64"
6596
- },
6597
- {
6598
- name: "timestamp",
6599
- type: "i64"
6600
- }
6601
- ]
6602
- }
6603
- },
6604
6189
  {
6605
6190
  name: "CompensationClaimed",
6606
6191
  type: {
@@ -6629,54 +6214,6 @@ var jbond_default = {
6629
6214
  ]
6630
6215
  }
6631
6216
  },
6632
- {
6633
- name: "FundsLocked",
6634
- type: {
6635
- kind: "struct",
6636
- fields: [
6637
- {
6638
- name: "validator",
6639
- type: "pubkey"
6640
- },
6641
- {
6642
- name: "amount",
6643
- type: "u64"
6644
- },
6645
- {
6646
- name: "total_locked",
6647
- type: "u64"
6648
- },
6649
- {
6650
- name: "epoch",
6651
- type: "u64"
6652
- }
6653
- ]
6654
- }
6655
- },
6656
- {
6657
- name: "FundsUnlocked",
6658
- type: {
6659
- kind: "struct",
6660
- fields: [
6661
- {
6662
- name: "validator",
6663
- type: "pubkey"
6664
- },
6665
- {
6666
- name: "amount",
6667
- type: "u64"
6668
- },
6669
- {
6670
- name: "pending_unlock",
6671
- type: "u64"
6672
- },
6673
- {
6674
- name: "epoch",
6675
- type: "u64"
6676
- }
6677
- ]
6678
- }
6679
- },
6680
6217
  {
6681
6218
  name: "GlobalConfigureData",
6682
6219
  type: {
@@ -6697,71 +6234,11 @@ var jbond_default = {
6697
6234
  kind: "struct",
6698
6235
  fields: [
6699
6236
  {
6700
- name: "authority",
6701
- docs: [
6702
- "The authority allowed to manage the program"
6703
- ],
6704
- type: "pubkey"
6705
- },
6706
- {
6707
- name: "bump",
6708
- docs: [
6709
- "Bump for the PDA"
6710
- ],
6711
- type: "u8"
6712
- }
6713
- ]
6714
- }
6715
- },
6716
- {
6717
- name: "ValidatorBond",
6718
- type: {
6719
- kind: "struct",
6720
- fields: [
6721
- {
6722
- name: "state",
6723
- docs: [
6724
- "The bond state address"
6725
- ],
6726
- type: "pubkey"
6727
- },
6728
- {
6729
- name: "identity",
6730
- docs: [
6731
- "Validator identity pubkey"
6732
- ],
6733
- type: "pubkey"
6734
- },
6735
- {
6736
- name: "vote_account",
6737
- docs: [
6738
- "Validator vote account pubkey"
6739
- ],
6740
- type: "pubkey"
6741
- },
6742
- {
6743
- name: "creator",
6744
- docs: [
6745
- "The bond creator pubkey"
6746
- ],
6747
- type: "pubkey"
6748
- },
6749
- {
6750
- name: "withdrawal_authority",
6751
- docs: [
6752
- "Optional withdrawal authority pubkey (if set, can withdraw on behalf of the validator,",
6753
- "otherwise only identity can withdraw)"
6754
- ],
6755
- type: {
6756
- option: "pubkey"
6757
- }
6758
- },
6759
- {
6760
- name: "created_at",
6237
+ name: "authority",
6761
6238
  docs: [
6762
- "Bond creation timestamp"
6239
+ "The authority allowed to manage the program"
6763
6240
  ],
6764
- type: "i64"
6241
+ type: "pubkey"
6765
6242
  },
6766
6243
  {
6767
6244
  name: "bump",
@@ -6769,38 +6246,21 @@ var jbond_default = {
6769
6246
  "Bump for the PDA"
6770
6247
  ],
6771
6248
  type: "u8"
6772
- },
6773
- {
6774
- name: "locked",
6775
- docs: [
6776
- "Amount of collateral currently locked (unavailable for withdrawal)"
6777
- ],
6778
- type: "u64"
6779
- },
6780
- {
6781
- name: "pending_unlock",
6782
- docs: [
6783
- "Pending unlock amount (will reduce `locked` next epoch)"
6784
- ],
6785
- type: "u64"
6786
- },
6787
- {
6788
- name: "pending_unlock_epoch",
6789
- docs: [
6790
- "Epoch when pending_unlock was queued"
6791
- ],
6792
- type: "u64"
6793
6249
  }
6794
6250
  ]
6795
6251
  }
6796
6252
  },
6797
6253
  {
6798
- name: "ValidatorBondClosed",
6254
+ name: "ValidatorBond",
6799
6255
  type: {
6800
6256
  kind: "struct",
6801
6257
  fields: [
6802
6258
  {
6803
- name: "validator",
6259
+ name: "state",
6260
+ type: "pubkey"
6261
+ },
6262
+ {
6263
+ name: "identity",
6804
6264
  type: "pubkey"
6805
6265
  },
6806
6266
  {
@@ -6808,16 +6268,22 @@ var jbond_default = {
6808
6268
  type: "pubkey"
6809
6269
  },
6810
6270
  {
6811
- name: "rent_receiver",
6271
+ name: "creator",
6812
6272
  type: "pubkey"
6813
6273
  },
6814
6274
  {
6815
- name: "final_balance",
6816
- type: "u64"
6275
+ name: "withdrawal_authority",
6276
+ type: {
6277
+ option: "pubkey"
6278
+ }
6817
6279
  },
6818
6280
  {
6819
- name: "timestamp",
6281
+ name: "created_at",
6820
6282
  type: "i64"
6283
+ },
6284
+ {
6285
+ name: "bump",
6286
+ type: "u8"
6821
6287
  }
6822
6288
  ]
6823
6289
  }
@@ -6828,7 +6294,7 @@ var jbond_default = {
6828
6294
  kind: "struct",
6829
6295
  fields: [
6830
6296
  {
6831
- name: "validator",
6297
+ name: "identity",
6832
6298
  type: "pubkey"
6833
6299
  },
6834
6300
  {
@@ -6841,30 +6307,6 @@ var jbond_default = {
6841
6307
  }
6842
6308
  ]
6843
6309
  }
6844
- },
6845
- {
6846
- name: "WithdrawAuthorityChanged",
6847
- type: {
6848
- kind: "struct",
6849
- fields: [
6850
- {
6851
- name: "validator",
6852
- type: "pubkey"
6853
- },
6854
- {
6855
- name: "old_authority",
6856
- type: {
6857
- option: "pubkey"
6858
- }
6859
- },
6860
- {
6861
- name: "new_authority",
6862
- type: {
6863
- option: "pubkey"
6864
- }
6865
- }
6866
- ]
6867
- }
6868
6310
  }
6869
6311
  ],
6870
6312
  constants: [
@@ -6923,22 +6365,6 @@ function bondTypeToAnchor(type, payload) {
6923
6365
  function anchorToBondType(variant) {
6924
6366
  return fromAnchor(variant);
6925
6367
  }
6926
- async function getStakePoolAccountData(connection, stakePoolAddress) {
6927
- const stakePoolAccount = await getStakePoolAccount(connection, stakePoolAddress);
6928
- if (!stakePoolAccount) {
6929
- throw new Error(`Stake pool account not found: ${stakePoolAddress.toBase58()}`);
6930
- }
6931
- return stakePoolAccount.account.data;
6932
- }
6933
- function lamportsToPoolTokenLamports(lamports, stakePool) {
6934
- if (stakePool.totalLamports.isZero()) {
6935
- throw new Error("Stake pool has zero total lamports");
6936
- }
6937
- if (stakePool.poolTokenSupply.isZero()) {
6938
- throw new Error("Stake pool has zero pool token supply");
6939
- }
6940
- return lamports.mul(stakePool.poolTokenSupply).div(stakePool.totalLamports);
6941
- }
6942
6368
 
6943
6369
  // src/utils/wallet.ts
6944
6370
  function isVersionedTransaction(tx) {
@@ -6971,20 +6397,6 @@ var NodeWallet = class {
6971
6397
  }
6972
6398
  };
6973
6399
  var SOL_DECIMALS = Math.log10(LAMPORTS_PER_SOL);
6974
- function lamportsToSol(lamports) {
6975
- if (typeof lamports === "number") {
6976
- return Math.abs(lamports) / LAMPORTS_PER_SOL;
6977
- }
6978
- let signMultiplier = 1;
6979
- if (lamports.isNeg()) {
6980
- signMultiplier = -1;
6981
- }
6982
- const absLamports = lamports.abs();
6983
- const lamportsString = absLamports.toString(10).padStart(10, "0");
6984
- const splitIndex = lamportsString.length - SOL_DECIMALS;
6985
- const solString = `${lamportsString.slice(0, splitIndex)}.${lamportsString.slice(splitIndex)}`;
6986
- return signMultiplier * Number.parseFloat(solString);
6987
- }
6988
6400
  function solToLamports(amount) {
6989
6401
  if (Number.isNaN(amount)) {
6990
6402
  return new BN(0);
@@ -7005,13 +6417,20 @@ function getBondTypeSeed(type) {
7005
6417
  }
7006
6418
 
7007
6419
  // src/client.ts
6420
+ var JBondClientEnv = /* @__PURE__ */ ((JBondClientEnv2) => {
6421
+ JBondClientEnv2["DEV"] = "dev";
6422
+ JBondClientEnv2["STAGE"] = "stage";
6423
+ JBondClientEnv2["PROD"] = "prod";
6424
+ return JBondClientEnv2;
6425
+ })(JBondClientEnv || {});
7008
6426
  var JBondClient = class _JBondClient {
7009
6427
  constructor(provider, options) {
7010
6428
  this.provider = provider;
7011
6429
  this.options = options ?? {};
6430
+ this.program = new Program(jbond_default, this.provider);
7012
6431
  }
7013
6432
  options;
7014
- _program = null;
6433
+ program;
7015
6434
  get history() {
7016
6435
  return new HistoryManager(this);
7017
6436
  }
@@ -7040,24 +6459,11 @@ var JBondClient = class _JBondClient {
7040
6459
  static fromKeypair(connection, keypair, options) {
7041
6460
  return _JBondClient.fromWallet(connection, new NodeWallet(keypair), options);
7042
6461
  }
7043
- /**
7044
- * Get or create the program instance
7045
- */
7046
- get program() {
7047
- if (!this._program) {
7048
- jbond_default.address = this.programId.toBase58();
7049
- this._program = new Program(jbond_default, this.provider);
7050
- }
7051
- return this._program;
7052
- }
7053
6462
  /**
7054
6463
  * Get the current program ID.
7055
6464
  */
7056
6465
  get programId() {
7057
- if (this.options.programId) {
7058
- return this.options.programId;
7059
- }
7060
- return new PublicKey(ENV_PROGRAM_ID["prod" /* PROD */]);
6466
+ return this.options.programId ?? this.program.programId;
7061
6467
  }
7062
6468
  /**
7063
6469
  * Get the current connection.
@@ -7069,22 +6475,13 @@ var JBondClient = class _JBondClient {
7069
6475
  * Set the environment.
7070
6476
  */
7071
6477
  env(env) {
7072
- const envProgramId = ENV_PROGRAM_ID[env];
7073
- if (!envProgramId) {
7074
- throw new Error(`Invalid environment: ${env}`);
7075
- }
7076
- this._program = null;
7077
- this.debug(`Set environment to ${env} with program ID: ${envProgramId.toString()}`);
7078
- return this.configure("programId", new PublicKey(envProgramId));
6478
+ return this.configure("programId", ENV_PROGRAM_ID[env]);
7079
6479
  }
7080
6480
  /**
7081
6481
  * Configure a specific option.
7082
6482
  */
7083
6483
  configure(key, val) {
7084
6484
  this.options[key] = val;
7085
- if (key === "programId") {
7086
- this._program = null;
7087
- }
7088
6485
  return this;
7089
6486
  }
7090
6487
  /**
@@ -7143,8 +6540,8 @@ var JBondClient = class _JBondClient {
7143
6540
  * Top up collateral
7144
6541
  */
7145
6542
  async topUpCollateral(props) {
7146
- const { instructions, signers } = await this.getTopUpIxs(props);
7147
- return this.provider.sendAndConfirm?.(new Transaction().add(...instructions), signers);
6543
+ const ixs = await this.getTopUpIxs(props);
6544
+ return this.provider.sendAndConfirm?.(new Transaction().add(...ixs));
7148
6545
  }
7149
6546
  /**
7150
6547
  * Withdraw collateral
@@ -7154,14 +6551,7 @@ var JBondClient = class _JBondClient {
7154
6551
  return this.provider.sendAndConfirm?.(new Transaction().add(ix));
7155
6552
  }
7156
6553
  /**
7157
- * Migrate SOL collateral from one bond account to JSOL collateral in another bond account
7158
- */
7159
- async migrateBond(props) {
7160
- const { instructions, signers } = await this.getMigrateBondIx(props);
7161
- return this.provider.sendAndConfirm?.(new Transaction().add(...instructions), signers);
7162
- }
7163
- /**
7164
- * Claim compensation for a validator
6554
+ * Claim compensation
7165
6555
  */
7166
6556
  async claimCompensation(props) {
7167
6557
  const ix = await this.getClaimIx(props);
@@ -7202,14 +6592,6 @@ var JBondClient = class _JBondClient {
7202
6592
  const ix = await this.getBondSessionFinishIx(props);
7203
6593
  return this.provider.sendAndConfirm?.(new Transaction().add(ix));
7204
6594
  }
7205
- async bondRemove(props) {
7206
- const ix = await this.getBondRemoveIx(props);
7207
- return this.provider.sendAndConfirm?.(new Transaction().add(ix));
7208
- }
7209
- async closeValidatorBond(props) {
7210
- const ix = await this.getCloseValidatorBondIx(props);
7211
- return this.provider.sendAndConfirm?.(new Transaction().add(ix));
7212
- }
7213
6595
  /**
7214
6596
  * Build global state initialize instruction
7215
6597
  */
@@ -7320,9 +6702,6 @@ var JBondClient = class _JBondClient {
7320
6702
  collateralType = bondState2.collateralType;
7321
6703
  }
7322
6704
  const instructions = [];
7323
- const signers = [];
7324
- const amountLamports = solToLamports(amount);
7325
- let topUpAmount = amountLamports;
7326
6705
  try {
7327
6706
  await this.getValidatorBond(props.bondType, props.name, props.voteAccount);
7328
6707
  } catch {
@@ -7354,33 +6733,10 @@ var JBondClient = class _JBondClient {
7354
6733
  accounts.bondTokenAccount = getAssociatedTokenAddressSync(mint, validatorBond, true);
7355
6734
  }
7356
6735
  });
7357
- if (props.solUsage) {
7358
- let usesJsolCollateral = false;
7359
- matchVariant(collateralType, {
7360
- token: (mint) => {
7361
- usesJsolCollateral = mint.equals(JSOL_MINT);
7362
- }
7363
- });
7364
- if (usesJsolCollateral) {
7365
- const stakePool = await getStakePoolAccountData(this.connection, JPOOL_POOL_ADDRESS);
7366
- const deposit = await depositSol(
7367
- this.connection,
7368
- JPOOL_POOL_ADDRESS,
7369
- payer,
7370
- amountLamports.toNumber(),
7371
- void 0,
7372
- void 0,
7373
- void 0
7374
- );
7375
- instructions.push(...deposit.instructions);
7376
- signers.push(...deposit.signers);
7377
- topUpAmount = lamportsToPoolTokenLamports(amountLamports, stakePool);
7378
- }
7379
- }
7380
6736
  instructions.push(
7381
- await this.program.methods.bondTopUp(topUpAmount).accountsPartial(accounts).instruction()
6737
+ await this.program.methods.bondTopUp(solToLamports(amount)).accountsPartial(accounts).instruction()
7382
6738
  );
7383
- return { instructions, signers };
6739
+ return instructions;
7384
6740
  }
7385
6741
  /**
7386
6742
  * Build withdraw collateral instruction
@@ -7419,139 +6775,6 @@ var JBondClient = class _JBondClient {
7419
6775
  });
7420
6776
  return this.program.methods.bondWithdraw(solToLamports(amount)).accountsPartial(accounts).instruction();
7421
6777
  }
7422
- /**
7423
- * Build instructions for migrating SOL bond collateral into JSOL bond collateral in a single transaction
7424
- */
7425
- async getMigrateBondIx(props) {
7426
- const {
7427
- bondType,
7428
- voteAccount,
7429
- identity,
7430
- withdrawName = "performance",
7431
- topUpName = "perf",
7432
- stakePoolAddress = JPOOL_POOL_ADDRESS
7433
- } = props;
7434
- const payer = props.payer ?? this.provider.wallet?.publicKey;
7435
- const destination = props.destination ?? payer;
7436
- if (!payer || !destination) {
7437
- throw new Error("Missing payer/destination");
7438
- }
7439
- const withdrawBondState = await this.getBondState(bondType, withdrawName);
7440
- await matchVariant(withdrawBondState.collateralType, {
7441
- native: () => {
7442
- },
7443
- token: () => {
7444
- throw new Error("Withdraw bond collateral type must be native SOL for migration");
7445
- }
7446
- });
7447
- const availableLamports = await this.getAvailableCollateral(bondType, withdrawName, voteAccount);
7448
- if (!availableLamports || availableLamports <= 0) {
7449
- throw new Error("No available balance to migrate");
7450
- }
7451
- const amount = lamportsToSol(availableLamports);
7452
- const amountLamports = solToLamports(amount);
7453
- const withdrawIx = await this.getWithdrawIx({
7454
- bondType,
7455
- name: withdrawName,
7456
- amount,
7457
- voteAccount,
7458
- destination,
7459
- withdrawalAuthority: props.withdrawalAuthority
7460
- });
7461
- const deposit = await this.getDepositSolIxsWithoutBalanceCheck(
7462
- stakePoolAddress,
7463
- payer,
7464
- amountLamports.toNumber()
7465
- );
7466
- const topUpBondState = await this.getBondState(bondType, topUpName);
7467
- const topUpCollateralType = topUpBondState.collateralType;
7468
- const instructions = [withdrawIx, ...deposit.instructions];
7469
- const signers = [...deposit.signers];
7470
- try {
7471
- await this.getValidatorBond(bondType, topUpName, voteAccount);
7472
- } catch {
7473
- instructions.push(
7474
- await this.getRegisterValidatorIx({
7475
- bondType,
7476
- name: topUpName,
7477
- voteAccount,
7478
- identity,
7479
- creator: payer,
7480
- collateralType: topUpCollateralType
7481
- })
7482
- );
7483
- }
7484
- const [topUpBondStateAddress] = this.pda.bondState(bondType, topUpName);
7485
- const [topUpValidatorBond] = this.pda.validatorBond(bondType, topUpName, voteAccount);
7486
- await matchVariant(topUpCollateralType, {
7487
- native: () => {
7488
- throw new Error("Top up bond collateral type must be token for migration");
7489
- },
7490
- token: async (mint) => {
7491
- const stakePool = await getStakePoolAccountData(this.connection, stakePoolAddress);
7492
- const topUpAmount = lamportsToPoolTokenLamports(amountLamports, stakePool);
7493
- const topUpIx = await this.program.methods.bondTopUp(topUpAmount).accountsPartial({
7494
- bondState: topUpBondStateAddress,
7495
- validatorBond: topUpValidatorBond,
7496
- payer,
7497
- payerTokenAccount: getAssociatedTokenAddressSync(mint, payer),
7498
- bondTokenAccount: getAssociatedTokenAddressSync(mint, topUpValidatorBond, true),
7499
- stakeAccount: null,
7500
- stakeProgram: null
7501
- }).instruction();
7502
- instructions.push(topUpIx);
7503
- }
7504
- });
7505
- return { instructions, signers };
7506
- }
7507
- /**
7508
- * Build stake-pool SOL deposit instructions without pre-checking payer balance.
7509
- * This allows composing withdraw->deposit in a single transaction where SOL is obtained by the prior instruction.
7510
- */
7511
- async getDepositSolIxsWithoutBalanceCheck(stakePoolAddress, payer, lamports, destinationTokenAccount, referrerTokenAccount, depositAuthority) {
7512
- const stakePool = await getStakePoolAccountData(this.connection, stakePoolAddress);
7513
- const transferSigner = new Keypair();
7514
- const signers = [transferSigner];
7515
- const instructions = [
7516
- SystemProgram.transfer({
7517
- fromPubkey: payer,
7518
- toPubkey: transferSigner.publicKey,
7519
- lamports
7520
- })
7521
- ];
7522
- let destinationPoolAccount = destinationTokenAccount;
7523
- if (!destinationPoolAccount) {
7524
- const associatedAddress = getAssociatedTokenAddressSync(stakePool.poolMint, payer);
7525
- instructions.push(
7526
- createAssociatedTokenAccountIdempotentInstruction(
7527
- payer,
7528
- associatedAddress,
7529
- payer,
7530
- stakePool.poolMint
7531
- )
7532
- );
7533
- destinationPoolAccount = associatedAddress;
7534
- }
7535
- const [withdrawAuthority] = PublicKey.findProgramAddressSync(
7536
- [stakePoolAddress.toBuffer(), Buffer.from("withdraw")],
7537
- STAKE_POOL_PROGRAM_ID
7538
- );
7539
- instructions.push(
7540
- StakePoolInstruction.depositSol({
7541
- stakePool: stakePoolAddress,
7542
- reserveStake: stakePool.reserveStake,
7543
- fundingAccount: transferSigner.publicKey,
7544
- destinationPoolAccount,
7545
- managerFeeAccount: stakePool.managerFeeAccount,
7546
- referralPoolAccount: referrerTokenAccount ?? destinationPoolAccount,
7547
- poolMint: stakePool.poolMint,
7548
- lamports,
7549
- withdrawAuthority,
7550
- depositAuthority
7551
- })
7552
- );
7553
- return { instructions, signers };
7554
- }
7555
6778
  /**
7556
6779
  * Build claim instruction
7557
6780
  */
@@ -7582,47 +6805,13 @@ var JBondClient = class _JBondClient {
7582
6805
  native: () => {
7583
6806
  },
7584
6807
  token: (mint) => {
6808
+ accounts.destinationTokenAccount = getAssociatedTokenAddressSync(mint, reserve, true);
7585
6809
  accounts.bondTokenAccount = getAssociatedTokenAddressSync(mint, validatorBond, true);
7586
- if (reserve.equals(mint)) {
7587
- accounts.reserveTokenAccount = null;
7588
- accounts.destinationTokenAccount = null;
7589
- } else {
7590
- accounts.destinationTokenAccount = getAssociatedTokenAddressSync(mint, reserve, true);
7591
- accounts.reserveTokenAccount = getAssociatedTokenAddressSync(mint, reserve, true);
7592
- }
6810
+ accounts.reserveTokenAccount = getAssociatedTokenAddressSync(mint, reserve, true);
7593
6811
  }
7594
6812
  });
7595
6813
  return this.program.methods.bondClaim(solToLamports(amount)).accountsPartial(accounts).instruction();
7596
6814
  }
7597
- /**
7598
- * Build claim all compensations instructions
7599
- */
7600
- async getClaimAllCompensationsIxs(props) {
7601
- const ixs = [];
7602
- const validatorBondBalances = await this.getBondStateValidatorBondBalances(
7603
- props.bondType,
7604
- props.name
7605
- );
7606
- for (const bond_balance of validatorBondBalances) {
7607
- const amountToClaim = lamportsToSol(bond_balance.balance);
7608
- if (amountToClaim <= 0) {
7609
- this.debug("No balance to claim for validator:", bond_balance.voteAccount.toBase58());
7610
- continue;
7611
- }
7612
- this.debug("Amount to claim:", amountToClaim);
7613
- const ix = await this.getClaimIx({
7614
- bondType: props.bondType,
7615
- name: props.name,
7616
- amount: amountToClaim,
7617
- collateralType: props.collateralType,
7618
- reserve: props.reserve,
7619
- authority: props.authority,
7620
- voteAccount: bond_balance.voteAccount
7621
- });
7622
- ixs.push(ix);
7623
- }
7624
- return ixs;
7625
- }
7626
6815
  /**
7627
6816
  * Build set withdraw authority instruction
7628
6817
  */
@@ -7651,150 +6840,23 @@ var JBondClient = class _JBondClient {
7651
6840
  const authority = this.provider.wallet?.publicKey;
7652
6841
  return this.program.methods.sessionStart(new import_bn.BN(props.duration)).accountsPartial({ bondState, authority }).instruction();
7653
6842
  }
7654
- async lockFunds(props) {
7655
- const ix = await this.getLockFundsIx(props);
7656
- return this.provider.sendAndConfirm?.(new Transaction().add(ix));
7657
- }
7658
- async releaseFunds(props) {
7659
- const ix = await this.getReleaseFundsIx(props);
7660
- return this.provider.sendAndConfirm?.(new Transaction().add(ix));
7661
- }
7662
- /**
7663
- * Build bond remove instruction
7664
- */
7665
- async getBondRemoveIx(props) {
7666
- const { bondType, name } = props;
7667
- const [bondState] = this.pda.bondState(bondType, name);
7668
- const authority = props.authority ?? this.provider.wallet?.publicKey;
7669
- return this.program.methods.bondRemove().accountsPartial({ bondState, authority }).instruction();
7670
- }
7671
- /**
7672
- * Build close validator bond instruction
7673
- */
7674
- async getCloseValidatorBondIx(props) {
7675
- const { bondType, name, voteAccount } = props;
7676
- const [bondState] = this.pda.bondState(bondType, name);
7677
- const [validatorBond] = this.pda.validatorBond(bondType, name, voteAccount);
7678
- const authority = props.authority ?? this.provider.wallet?.publicKey;
7679
- const rentReceiver = props.rentReceiver ?? authority;
7680
- if (!authority || !rentReceiver) {
7681
- throw new Error("Missing authority or rentReceiver");
7682
- }
7683
- let collateralType = props.collateralType;
7684
- if (!collateralType) {
7685
- const state = await this.getBondState(bondType, name);
7686
- collateralType = state.collateralType;
7687
- }
7688
- const accounts = {
7689
- bondState,
7690
- validatorBond,
7691
- authority,
7692
- rentReceiver,
7693
- bondTokenAccount: null,
7694
- destinationTokenAccount: null
7695
- };
7696
- matchVariant(collateralType, {
7697
- native: () => {
7698
- },
7699
- token: (mint) => {
7700
- accounts.bondTokenAccount = getAssociatedTokenAddressSync(mint, validatorBond, true);
7701
- accounts.destinationTokenAccount = getAssociatedTokenAddressSync(mint, rentReceiver, true);
7702
- }
7703
- });
7704
- return this.program.methods.closeValidatorBond().accountsPartial(accounts).instruction();
7705
- }
7706
- /**
7707
- * Build test set last update epoch instruction
7708
- * NOTE!: This instruction is for testing purposes only.
7709
- * It allows direct manipulation of the validator bond's last epoch update.
7710
- * This should not be used in production environments.
7711
- */
7712
- // async getTestSetLastUpdateEpochIx(props: { bondType: BondType, bondName: string, voteAccount: PublicKeyInitData, payer: PublicKey, epoch: number }) {
7713
- // const { bondType, bondName, voteAccount, payer, epoch } = props
7714
- // const [validatorBond, _] = this.pda.validatorBond(bondType, bondName, voteAccount)
7715
- // return this.program.methods
7716
- // .testSetLastUpdateEpoch(new BN(epoch))
7717
- // .accountsPartial({ validatorBond, payer })
7718
- // .instruction()
7719
- // }
7720
- /**
7721
- * Build lock funds instruction
7722
- */
7723
- async getLockFundsIx(props) {
7724
- const { bondType, name, voteAccount, amount, withdrawAuthority } = props;
7725
- const [bondState] = this.pda.bondState(bondType, name);
7726
- let collateralType = props.collateralType;
7727
- if (!collateralType) {
7728
- const bondState2 = await this.getBondState(bondType, name);
7729
- collateralType = bondState2.collateralType;
7730
- }
7731
- const [validatorBond] = this.pda.validatorBond(bondType, name, voteAccount);
7732
- const accounts = {
7733
- bondState,
7734
- validatorBond,
7735
- payer: withdrawAuthority,
7736
- bondTokenAccount: null
7737
- };
7738
- matchVariant(collateralType, {
7739
- native: () => {
7740
- },
7741
- token: (mint) => {
7742
- const bondTokenAccount = getAssociatedTokenAddressSync(mint, validatorBond, true);
7743
- accounts.bondTokenAccount = bondTokenAccount;
7744
- }
7745
- });
7746
- return this.program.methods.bondLockFunds(solToLamports(amount)).accountsPartial(accounts).instruction();
7747
- }
7748
- /**
7749
- * Build release funds instruction
7750
- */
7751
- async getReleaseFundsIx(props) {
7752
- const { bondType, name, voteAccount, amount, withdrawAuthority } = props;
7753
- const [bondState] = this.pda.bondState(bondType, name);
7754
- const [validatorBond] = this.pda.validatorBond(bondType, name, voteAccount);
7755
- const accounts = {
7756
- bondState,
7757
- validatorBond,
7758
- payer: withdrawAuthority
7759
- };
7760
- return this.program.methods.bondReleaseFunds(solToLamports(amount)).accountsPartial(accounts).instruction();
7761
- }
7762
- /**
7763
- * Get available collateral for withdrawal (taking into account locked funds)
7764
- */
7765
- async getAvailableCollateral(bondType, bondName, voteAccount) {
7766
- const validatorBond = await this.getValidatorBond(bondType, bondName, voteAccount);
7767
- return await this.getValidatorBondBalance(bondType, bondName, voteAccount) - validatorBond.locked.toNumber();
7768
- }
7769
6843
  /**
7770
6844
  * Get all bond states with total collected collateral
7771
6845
  */
7772
- async getAllBondStates(bondType, sessionStatus, options) {
7773
- const includeStats = options?.includeStats ?? true;
7774
- const targetBondType = bondTypeToAnchor(bondType);
6846
+ async getAllBondStates(bondType, sessionStatus) {
6847
+ const result = [];
7775
6848
  const accounts = await this.program.account.bondState.all();
7776
- const filteredAccounts = accounts.filter(({ account }) => {
7777
- if (!sameVariant(account.bondType, targetBondType)) {
7778
- return false;
6849
+ for (const { publicKey, account } of accounts) {
6850
+ if (!sameVariant(account.bondType, bondTypeToAnchor(bondType))) {
6851
+ continue;
7779
6852
  }
7780
6853
  if (sessionStatus !== void 0 && this.getBondStateSessionStatus(account) !== sessionStatus) {
7781
- return false;
6854
+ continue;
7782
6855
  }
7783
- return true;
7784
- });
7785
- if (!includeStats) {
7786
- return filteredAccounts.map(({ publicKey, account }) => ({
7787
- publicKey,
7788
- bondState: account,
7789
- stateStats: null
7790
- }));
6856
+ const stateStats = await this.getBondStateStats(account);
6857
+ result.push({ publicKey, bondState: account, stateStats });
7791
6858
  }
7792
- return Promise.all(
7793
- filteredAccounts.map(async ({ publicKey, account }) => {
7794
- const stateStats = await this.getBondStateStats(account);
7795
- return { publicKey, bondState: account, stateStats };
7796
- })
7797
- );
6859
+ return result;
7798
6860
  }
7799
6861
  /**
7800
6862
  * Fetch global state or throw if not found
@@ -7815,28 +6877,16 @@ var JBondClient = class _JBondClient {
7815
6877
  return { publicKey, ...data };
7816
6878
  }
7817
6879
  /**
7818
- * Fetch validator bond data or error if not found
6880
+ * Fetch validator bond data or null if not found
7819
6881
  */
7820
6882
  async getValidatorBond(bondType, bondName, vote) {
7821
6883
  const [publicKey] = this.pda.validatorBond(bondType, bondName, new PublicKey(vote));
7822
- this.debug(`Fetching validator bond ${publicKey}...`);
7823
6884
  const data = await this.program.account.validatorBond.fetch(publicKey);
7824
6885
  return { publicKey, ...data };
7825
6886
  }
7826
6887
  /**
7827
- * Fetch validator bond data or null if not found
7828
- */
7829
- async getValidatorBondNullable(bondType, bondName, vote) {
7830
- const [publicKey] = this.pda.validatorBond(bondType, bondName, new PublicKey(vote));
7831
- this.debug(`Fetching validator bond ${publicKey}...`);
7832
- const data = await this.program.account.validatorBond.fetchNullable(publicKey);
7833
- if (!data) {
7834
- return null;
7835
- }
7836
- return { publicKey, ...data };
7837
- }
7838
- /**
7839
- * Get validator bond account balance (in SOL)
6888
+ * Get validator bond account balance, in the collateral's base units
6889
+ * (lamports for native bonds, token base units for token bonds).
7840
6890
  */
7841
6891
  async getValidatorBondBalance(bondType, bondName, vote) {
7842
6892
  const [address] = this.pda.validatorBond(bondType, bondName, new PublicKey(vote));
@@ -7848,8 +6898,8 @@ var JBondClient = class _JBondClient {
7848
6898
  if (!accountInfo) {
7849
6899
  return 0;
7850
6900
  }
7851
- const { lamports } = accountInfo;
7852
- const rentExempt = await this.validatorBondRentExempt();
6901
+ const { data, lamports } = accountInfo;
6902
+ const rentExempt = await this.connection.getMinimumBalanceForRentExemption(data.length);
7853
6903
  return Math.max(0, lamports - rentExempt);
7854
6904
  },
7855
6905
  token: async (mint) => {
@@ -7863,13 +6913,12 @@ var JBondClient = class _JBondClient {
7863
6913
  }
7864
6914
  });
7865
6915
  }
7866
- async getBondStateValidatorBondBalances(bondType, bondName, bondState) {
7867
- const state = bondState ?? await this.getBondState(bondType, bondName);
7868
- const collateralType = state.collateralType;
7869
- const validatorBonds = await this.getValidatorBondsForState(bondType, bondName);
7870
- if (!validatorBonds.length) {
7871
- return [];
7872
- }
6916
+ /**
6917
+ * Get total collected collateral for a bond state
6918
+ */
6919
+ async getBondStateTotalCollected(bondType, bondName, votes) {
6920
+ const bondState = await this.getBondState(bondType, bondName);
6921
+ const collateralType = bondState.collateralType;
7873
6922
  const chunk = (arr, n = 100) => {
7874
6923
  const res = [];
7875
6924
  for (let i = 0; i < arr.length; i += n) {
@@ -7879,79 +6928,76 @@ var JBondClient = class _JBondClient {
7879
6928
  };
7880
6929
  return await matchVariant(collateralType, {
7881
6930
  native: async () => {
7882
- const addresses = validatorBonds.map((vb) => vb.publicKey);
6931
+ const addresses = votes.map((vote) => {
6932
+ const [address] = this.pda.validatorBond(bondType, bondName, new PublicKey(vote));
6933
+ return address;
6934
+ });
7883
6935
  const accountInfos = await this.connection.getMultipleAccountsInfo(addresses);
7884
- const rentExempt = await this.validatorBondRentExempt();
7885
- return validatorBonds.map((vb, idx) => ({
7886
- voteAccount: vb.voteAccount,
7887
- balance: Math.max(0, (accountInfos[idx]?.lamports ?? 0) - rentExempt)
7888
- }));
6936
+ const balances = await Promise.all(
6937
+ accountInfos.map(async (accountInfo) => {
6938
+ if (!accountInfo) {
6939
+ return 0;
6940
+ }
6941
+ const { lamports } = accountInfo;
6942
+ return lamports;
6943
+ })
6944
+ );
6945
+ return balances.reduce((sum, v) => sum + v, 0);
7889
6946
  },
7890
6947
  token: async (mint) => {
7891
- const items = validatorBonds.map((vb) => ({
7892
- voteAccount: vb.voteAccount,
7893
- tokenAccount: getAssociatedTokenAddressSync(mint, vb.publicKey, true)
7894
- }));
7895
- const balances = [];
7896
- for (const part of chunk(items, 100)) {
7897
- const infos = await this.connection.getMultipleAccountsInfo(part.map((i) => i.tokenAccount)).catch(() => []);
7898
- for (let i = 0; i < part.length; i++) {
6948
+ const tokenAccounts = votes.map((vote) => {
6949
+ const [validatorBondAddress] = this.pda.validatorBond(bondType, bondName, new PublicKey(vote));
6950
+ return getAssociatedTokenAddressSync(mint, validatorBondAddress, true);
6951
+ });
6952
+ if (tokenAccounts.length === 0) {
6953
+ return 0;
6954
+ }
6955
+ let total = 0n;
6956
+ for (const part of chunk(tokenAccounts, 100)) {
6957
+ const infos = await this.connection.getMultipleAccountsInfo(part).catch(() => []);
6958
+ for (let i = 0; i < infos.length; i++) {
7899
6959
  const info = infos[i];
7900
- const voteAccount = part[i].voteAccount;
7901
- if (!info || info.data.length !== ACCOUNT_SIZE) {
7902
- balances.push({ voteAccount, balance: 0 });
6960
+ if (!info) {
6961
+ continue;
6962
+ }
6963
+ if (info.data.length !== ACCOUNT_SIZE) {
7903
6964
  continue;
7904
6965
  }
7905
6966
  try {
7906
6967
  const acc = AccountLayout.decode(info.data);
7907
6968
  const raw = BigInt(acc.amount.toString());
7908
- const asNumber = Number(raw);
7909
- balances.push({
7910
- voteAccount,
7911
- balance: Number.isFinite(asNumber) ? asNumber : Number.MAX_SAFE_INTEGER
7912
- });
6969
+ total += raw;
7913
6970
  } catch {
7914
- balances.push({ voteAccount, balance: 0 });
7915
6971
  }
7916
6972
  }
7917
6973
  }
7918
- return balances;
6974
+ const asNumber = Number(total);
6975
+ return Number.isFinite(asNumber) ? asNumber : Number.MAX_SAFE_INTEGER;
7919
6976
  }
7920
6977
  });
7921
6978
  }
7922
- /**
7923
- * Get total collected collateral for a bond state
7924
- */
7925
- async getBondStateTotalCollected(bondType, bondName, bondState) {
7926
- const allBalances = await this.getBondStateValidatorBondBalances(bondType, bondName, bondState);
7927
- return allBalances.reduce((sum, vb) => sum + vb.balance, 0);
7928
- }
7929
6979
  /**
7930
6980
  * Get bond state stats
7931
6981
  * @param state
6982
+ * @private
7932
6983
  */
7933
6984
  async getBondStateStats(state) {
7934
6985
  const bondType = anchorToBondType(state.bondType);
6986
+ const validatorBonds = await this.getBondValidatorStates(bondType, state.name);
7935
6987
  const totalCollected = await this.getBondStateTotalCollected(
7936
6988
  bondType,
7937
6989
  state.name,
7938
- state
6990
+ validatorBonds.map((vb) => vb.voteAccount)
7939
6991
  );
7940
6992
  return {
7941
6993
  totalCollected,
7942
6994
  status: this.getBondStateSessionStatus(state)
7943
6995
  };
7944
6996
  }
7945
- /**
7946
- * Get validator bond rent exempt amount
7947
- */
7948
- validatorBondRentExempt = async () => {
7949
- return this.connection.getMinimumBalanceForRentExemption(this.program.account.validatorBond.size);
7950
- };
7951
6997
  /**
7952
6998
  * Get all validator bonds for a given bond state
7953
6999
  */
7954
- async getValidatorBondsForState(bondType, bondName) {
7000
+ async getBondValidatorStates(bondType, bondName) {
7955
7001
  const [bondState] = this.pda.bondState(bondType, bondName);
7956
7002
  const accounts = await this.program.account.validatorBond.all([
7957
7003
  {
@@ -7994,6 +7040,6 @@ buffer/index.js:
7994
7040
  *)
7995
7041
  */
7996
7042
 
7997
- export { BOND_STATE_SEED, BondTransactionType, BondType, CROWDFUNDING_BOND_SEED, ENV_PROGRAM_ID, GLOBAL_STATE_SEED, JBondClient, JBondClientEnv, JPOOL_POOL_ADDRESS, JSOL_MINT, NodeWallet, STANDARD_BOND_SEED, SessionStatus, VALIDATOR_BOND_SEED, lamportsToSol };
7043
+ export { BOND_STATE_SEED, BondTransactionType, BondType, CROWDFUNDING_BOND_SEED, ENV_PROGRAM_ID, GLOBAL_STATE_SEED, JBondClient, JBondClientEnv, NodeWallet, STANDARD_BOND_SEED, SessionStatus, VALIDATOR_BOND_SEED };
7998
7044
  //# sourceMappingURL=index.mjs.map
7999
7045
  //# sourceMappingURL=index.mjs.map