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

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
@@ -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: [
@@ -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({