@jpool/bond-sdk 0.9.0-next.21 → 0.9.0-next.23

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
@@ -4553,7 +4553,7 @@ var Seeds = /* @__PURE__ */ ((Seeds2) => {
4553
4553
  Seeds2["GlobalState"] = "global_state";
4554
4554
  Seeds2["BondState"] = "bond_state";
4555
4555
  Seeds2["ValidatorBond"] = "validator_bond";
4556
- Seeds2["PerformanceBond"] = "performance";
4556
+ Seeds2["StandardBond"] = "standard";
4557
4557
  Seeds2["CrowdFundingBond"] = "crowdfunding";
4558
4558
  return Seeds2;
4559
4559
  })(Seeds || {});
@@ -4563,11 +4563,11 @@ var ENV_PROGRAM_ID = {
4563
4563
 
4564
4564
  // src/types/index.ts
4565
4565
  var bondTypeToSeed = {
4566
- performance: "performance" /* PerformanceBond */,
4566
+ standard: "standard" /* StandardBond */,
4567
4567
  crowdfunding: "crowdfunding" /* CrowdFundingBond */
4568
4568
  };
4569
4569
  var BondTypeVariant = {
4570
- Performance: { performance: {} },
4570
+ Standard: { standard: {} },
4571
4571
  Crowdfunding: { crowdfunding: {} }
4572
4572
  };
4573
4573
  var BondStateStatusVariant = {
@@ -4984,9 +4984,6 @@ var jbond_default = {
4984
4984
  210
4985
4985
  ],
4986
4986
  accounts: [
4987
- {
4988
- name: "global_state"
4989
- },
4990
4987
  {
4991
4988
  name: "bond_state",
4992
4989
  writable: true,
@@ -5021,10 +5018,7 @@ var jbond_default = {
5021
5018
  {
5022
5019
  name: "authority",
5023
5020
  writable: true,
5024
- signer: true,
5025
- relations: [
5026
- "global_state"
5027
- ]
5021
+ signer: true
5028
5022
  },
5029
5023
  {
5030
5024
  name: "reserve"
@@ -5573,6 +5567,80 @@ var jbond_default = {
5573
5567
  ],
5574
5568
  args: []
5575
5569
  },
5570
+ {
5571
+ name: "migrate_bond",
5572
+ docs: [
5573
+ "Migrates validator bond data from legacy structure to new structure."
5574
+ ],
5575
+ discriminator: [
5576
+ 107,
5577
+ 119,
5578
+ 59,
5579
+ 110,
5580
+ 76,
5581
+ 18,
5582
+ 37,
5583
+ 163
5584
+ ],
5585
+ accounts: [
5586
+ {
5587
+ name: "bond_state",
5588
+ writable: true
5589
+ },
5590
+ {
5591
+ name: "legacy_validator_bond",
5592
+ writable: true
5593
+ },
5594
+ {
5595
+ name: "legacy_vote_account"
5596
+ },
5597
+ {
5598
+ name: "validator_bond",
5599
+ writable: true,
5600
+ pda: {
5601
+ seeds: [
5602
+ {
5603
+ kind: "const",
5604
+ value: [
5605
+ 118,
5606
+ 97,
5607
+ 108,
5608
+ 105,
5609
+ 100,
5610
+ 97,
5611
+ 116,
5612
+ 111,
5613
+ 114,
5614
+ 95,
5615
+ 98,
5616
+ 111,
5617
+ 110,
5618
+ 100
5619
+ ]
5620
+ },
5621
+ {
5622
+ kind: "account",
5623
+ path: "bond_state"
5624
+ },
5625
+ {
5626
+ kind: "account",
5627
+ path: "legacy_vote_account"
5628
+ }
5629
+ ]
5630
+ }
5631
+ },
5632
+ {
5633
+ name: "creator",
5634
+ writable: true,
5635
+ signer: true
5636
+ },
5637
+ {
5638
+ name: "system_program",
5639
+ address: "11111111111111111111111111111111"
5640
+ }
5641
+ ],
5642
+ args: []
5643
+ },
5576
5644
  {
5577
5645
  name: "session_finish",
5578
5646
  docs: [
@@ -5938,7 +6006,7 @@ var jbond_default = {
5938
6006
  {
5939
6007
  name: "BondInitializeData",
5940
6008
  docs: [
5941
- "Data required to initialize a performance bond"
6009
+ "Data required to initialize a standard bond"
5942
6010
  ],
5943
6011
  type: {
5944
6012
  kind: "struct",
@@ -6002,7 +6070,7 @@ var jbond_default = {
6002
6070
  {
6003
6071
  name: "bond_type",
6004
6072
  docs: [
6005
- "The type of bond (e.g., Performance, Crowdfunding)"
6073
+ "The type of bond (e.g., Standard, Crowdfunding)"
6006
6074
  ],
6007
6075
  type: {
6008
6076
  defined: {
@@ -6114,7 +6182,7 @@ var jbond_default = {
6114
6182
  kind: "enum",
6115
6183
  variants: [
6116
6184
  {
6117
- name: "Performance"
6185
+ name: "Standard"
6118
6186
  },
6119
6187
  {
6120
6188
  name: "Crowdfunding"
@@ -6584,10 +6652,8 @@ var JBondClient = class _JBondClient {
6584
6652
  * Build initialize instruction
6585
6653
  */
6586
6654
  async buildBondInitializeIx(props) {
6587
- const [globalState] = this.pda.globalState();
6588
6655
  const [bondState] = this.pda.bondState(props.bondType, props.name);
6589
6656
  const accounts = {
6590
- globalState,
6591
6657
  bondState,
6592
6658
  authority: props.authority ?? this.program.provider.wallet?.publicKey,
6593
6659
  reserve: props.reserve,
@@ -6787,6 +6853,28 @@ var JBondClient = class _JBondClient {
6787
6853
  authority: this.program.provider.wallet?.publicKey
6788
6854
  }).instruction();
6789
6855
  }
6856
+ async migrateBond(props) {
6857
+ const ix = await this.buildBondMigrateIx(props);
6858
+ return this.provider.sendAndConfirm?.(new Transaction().add(ix));
6859
+ }
6860
+ async buildBondMigrateIx(props) {
6861
+ const [bondState] = this.pda.bondState(props.bondType, props.name);
6862
+ const [legacyValidatorBond] = PublicKey.findProgramAddressSync(
6863
+ [
6864
+ Buffer.from("validator_bond"),
6865
+ new PublicKey(props.voteAccount).toBuffer()
6866
+ ],
6867
+ this.programId
6868
+ );
6869
+ const [validatorBond] = this.pda.validatorBond(props.bondType, props.name, props.voteAccount);
6870
+ return this.program.methods.migrateBond().accountsPartial({
6871
+ bondState,
6872
+ legacyValidatorBond,
6873
+ legacyVoteAccount: new PublicKey(props.voteAccount),
6874
+ validatorBond,
6875
+ creator: this.program.provider.wallet?.publicKey
6876
+ }).instruction();
6877
+ }
6790
6878
  async buildBondStartIx(props) {
6791
6879
  const [bondState] = this.pda.bondState(props.bondType, props.name);
6792
6880
  return this.program.methods.sessionStart(new import_bn2.BN(props.duration_secs)).accountsPartial({