@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.d.mts CHANGED
@@ -17,7 +17,7 @@ declare enum Seeds {
17
17
  GlobalState = "global_state",
18
18
  BondState = "bond_state",
19
19
  ValidatorBond = "validator_bond",
20
- PerformanceBond = "performance",
20
+ StandardBond = "standard",
21
21
  CrowdFundingBond = "crowdfunding"
22
22
  }
23
23
  /**
@@ -209,9 +209,6 @@ type Jbond = {
209
209
  210
210
210
  ];
211
211
  "accounts": [
212
- {
213
- "name": "globalState";
214
- },
215
212
  {
216
213
  "name": "bondState";
217
214
  "writable": true;
@@ -247,9 +244,6 @@ type Jbond = {
247
244
  "name": "authority";
248
245
  "writable": true;
249
246
  "signer": true;
250
- "relations": [
251
- "globalState"
252
- ];
253
247
  },
254
248
  {
255
249
  "name": "reserve";
@@ -798,6 +792,80 @@ type Jbond = {
798
792
  ];
799
793
  "args": [];
800
794
  },
795
+ {
796
+ "name": "migrateBond";
797
+ "docs": [
798
+ "Migrates validator bond data from legacy structure to new structure."
799
+ ];
800
+ "discriminator": [
801
+ 107,
802
+ 119,
803
+ 59,
804
+ 110,
805
+ 76,
806
+ 18,
807
+ 37,
808
+ 163
809
+ ];
810
+ "accounts": [
811
+ {
812
+ "name": "bondState";
813
+ "writable": true;
814
+ },
815
+ {
816
+ "name": "legacyValidatorBond";
817
+ "writable": true;
818
+ },
819
+ {
820
+ "name": "legacyVoteAccount";
821
+ },
822
+ {
823
+ "name": "validatorBond";
824
+ "writable": true;
825
+ "pda": {
826
+ "seeds": [
827
+ {
828
+ "kind": "const";
829
+ "value": [
830
+ 118,
831
+ 97,
832
+ 108,
833
+ 105,
834
+ 100,
835
+ 97,
836
+ 116,
837
+ 111,
838
+ 114,
839
+ 95,
840
+ 98,
841
+ 111,
842
+ 110,
843
+ 100
844
+ ];
845
+ },
846
+ {
847
+ "kind": "account";
848
+ "path": "bondState";
849
+ },
850
+ {
851
+ "kind": "account";
852
+ "path": "legacyVoteAccount";
853
+ }
854
+ ];
855
+ };
856
+ },
857
+ {
858
+ "name": "creator";
859
+ "writable": true;
860
+ "signer": true;
861
+ },
862
+ {
863
+ "name": "systemProgram";
864
+ "address": "11111111111111111111111111111111";
865
+ }
866
+ ];
867
+ "args": [];
868
+ },
801
869
  {
802
870
  "name": "sessionFinish";
803
871
  "docs": [
@@ -1163,7 +1231,7 @@ type Jbond = {
1163
1231
  {
1164
1232
  "name": "bondInitializeData";
1165
1233
  "docs": [
1166
- "Data required to initialize a performance bond"
1234
+ "Data required to initialize a standard bond"
1167
1235
  ];
1168
1236
  "type": {
1169
1237
  "kind": "struct";
@@ -1227,7 +1295,7 @@ type Jbond = {
1227
1295
  {
1228
1296
  "name": "bondType";
1229
1297
  "docs": [
1230
- "The type of bond (e.g., Performance, Crowdfunding)"
1298
+ "The type of bond (e.g., Standard, Crowdfunding)"
1231
1299
  ];
1232
1300
  "type": {
1233
1301
  "defined": {
@@ -1339,7 +1407,7 @@ type Jbond = {
1339
1407
  "kind": "enum";
1340
1408
  "variants": [
1341
1409
  {
1342
- "name": "performance";
1410
+ "name": "standard";
1343
1411
  },
1344
1412
  {
1345
1413
  "name": "crowdfunding";
@@ -1564,11 +1632,11 @@ type BondStateStats = {
1564
1632
  status: SessionStatus;
1565
1633
  };
1566
1634
  declare const bondTypeToSeed: {
1567
- performance: Seeds;
1635
+ standard: Seeds;
1568
1636
  crowdfunding: Seeds;
1569
1637
  };
1570
1638
  declare const BondTypeVariant: {
1571
- Performance: BondType;
1639
+ Standard: BondType;
1572
1640
  Crowdfunding: BondType;
1573
1641
  };
1574
1642
  declare const BondStateStatusVariant: {
@@ -1842,6 +1910,16 @@ declare class JBondClient {
1842
1910
  bondType: BondType;
1843
1911
  name: string;
1844
1912
  }): Promise<TransactionInstruction>;
1913
+ migrateBond(props: {
1914
+ bondType: BondType;
1915
+ name: string;
1916
+ voteAccount: PublicKeyInitData;
1917
+ }): Promise<string | undefined>;
1918
+ buildBondMigrateIx(props: {
1919
+ bondType: BondType;
1920
+ name: string;
1921
+ voteAccount: PublicKeyInitData;
1922
+ }): Promise<TransactionInstruction>;
1845
1923
  buildBondStartIx(props: {
1846
1924
  bondType: BondType;
1847
1925
  name: string;
@@ -1870,9 +1948,9 @@ declare class JBondClient {
1870
1948
  bondType: ({
1871
1949
  crowdfunding?: undefined;
1872
1950
  } & {
1873
- performance: Record<string, never>;
1951
+ standard: Record<string, never>;
1874
1952
  }) | ({
1875
- performance?: undefined;
1953
+ standard?: undefined;
1876
1954
  } & {
1877
1955
  crowdfunding: Record<string, never>;
1878
1956
  });
package/dist/index.d.ts CHANGED
@@ -17,7 +17,7 @@ declare enum Seeds {
17
17
  GlobalState = "global_state",
18
18
  BondState = "bond_state",
19
19
  ValidatorBond = "validator_bond",
20
- PerformanceBond = "performance",
20
+ StandardBond = "standard",
21
21
  CrowdFundingBond = "crowdfunding"
22
22
  }
23
23
  /**
@@ -209,9 +209,6 @@ type Jbond = {
209
209
  210
210
210
  ];
211
211
  "accounts": [
212
- {
213
- "name": "globalState";
214
- },
215
212
  {
216
213
  "name": "bondState";
217
214
  "writable": true;
@@ -247,9 +244,6 @@ type Jbond = {
247
244
  "name": "authority";
248
245
  "writable": true;
249
246
  "signer": true;
250
- "relations": [
251
- "globalState"
252
- ];
253
247
  },
254
248
  {
255
249
  "name": "reserve";
@@ -798,6 +792,80 @@ type Jbond = {
798
792
  ];
799
793
  "args": [];
800
794
  },
795
+ {
796
+ "name": "migrateBond";
797
+ "docs": [
798
+ "Migrates validator bond data from legacy structure to new structure."
799
+ ];
800
+ "discriminator": [
801
+ 107,
802
+ 119,
803
+ 59,
804
+ 110,
805
+ 76,
806
+ 18,
807
+ 37,
808
+ 163
809
+ ];
810
+ "accounts": [
811
+ {
812
+ "name": "bondState";
813
+ "writable": true;
814
+ },
815
+ {
816
+ "name": "legacyValidatorBond";
817
+ "writable": true;
818
+ },
819
+ {
820
+ "name": "legacyVoteAccount";
821
+ },
822
+ {
823
+ "name": "validatorBond";
824
+ "writable": true;
825
+ "pda": {
826
+ "seeds": [
827
+ {
828
+ "kind": "const";
829
+ "value": [
830
+ 118,
831
+ 97,
832
+ 108,
833
+ 105,
834
+ 100,
835
+ 97,
836
+ 116,
837
+ 111,
838
+ 114,
839
+ 95,
840
+ 98,
841
+ 111,
842
+ 110,
843
+ 100
844
+ ];
845
+ },
846
+ {
847
+ "kind": "account";
848
+ "path": "bondState";
849
+ },
850
+ {
851
+ "kind": "account";
852
+ "path": "legacyVoteAccount";
853
+ }
854
+ ];
855
+ };
856
+ },
857
+ {
858
+ "name": "creator";
859
+ "writable": true;
860
+ "signer": true;
861
+ },
862
+ {
863
+ "name": "systemProgram";
864
+ "address": "11111111111111111111111111111111";
865
+ }
866
+ ];
867
+ "args": [];
868
+ },
801
869
  {
802
870
  "name": "sessionFinish";
803
871
  "docs": [
@@ -1163,7 +1231,7 @@ type Jbond = {
1163
1231
  {
1164
1232
  "name": "bondInitializeData";
1165
1233
  "docs": [
1166
- "Data required to initialize a performance bond"
1234
+ "Data required to initialize a standard bond"
1167
1235
  ];
1168
1236
  "type": {
1169
1237
  "kind": "struct";
@@ -1227,7 +1295,7 @@ type Jbond = {
1227
1295
  {
1228
1296
  "name": "bondType";
1229
1297
  "docs": [
1230
- "The type of bond (e.g., Performance, Crowdfunding)"
1298
+ "The type of bond (e.g., Standard, Crowdfunding)"
1231
1299
  ];
1232
1300
  "type": {
1233
1301
  "defined": {
@@ -1339,7 +1407,7 @@ type Jbond = {
1339
1407
  "kind": "enum";
1340
1408
  "variants": [
1341
1409
  {
1342
- "name": "performance";
1410
+ "name": "standard";
1343
1411
  },
1344
1412
  {
1345
1413
  "name": "crowdfunding";
@@ -1564,11 +1632,11 @@ type BondStateStats = {
1564
1632
  status: SessionStatus;
1565
1633
  };
1566
1634
  declare const bondTypeToSeed: {
1567
- performance: Seeds;
1635
+ standard: Seeds;
1568
1636
  crowdfunding: Seeds;
1569
1637
  };
1570
1638
  declare const BondTypeVariant: {
1571
- Performance: BondType;
1639
+ Standard: BondType;
1572
1640
  Crowdfunding: BondType;
1573
1641
  };
1574
1642
  declare const BondStateStatusVariant: {
@@ -1842,6 +1910,16 @@ declare class JBondClient {
1842
1910
  bondType: BondType;
1843
1911
  name: string;
1844
1912
  }): Promise<TransactionInstruction>;
1913
+ migrateBond(props: {
1914
+ bondType: BondType;
1915
+ name: string;
1916
+ voteAccount: PublicKeyInitData;
1917
+ }): Promise<string | undefined>;
1918
+ buildBondMigrateIx(props: {
1919
+ bondType: BondType;
1920
+ name: string;
1921
+ voteAccount: PublicKeyInitData;
1922
+ }): Promise<TransactionInstruction>;
1845
1923
  buildBondStartIx(props: {
1846
1924
  bondType: BondType;
1847
1925
  name: string;
@@ -1870,9 +1948,9 @@ declare class JBondClient {
1870
1948
  bondType: ({
1871
1949
  crowdfunding?: undefined;
1872
1950
  } & {
1873
- performance: Record<string, never>;
1951
+ standard: Record<string, never>;
1874
1952
  }) | ({
1875
- performance?: undefined;
1953
+ standard?: undefined;
1876
1954
  } & {
1877
1955
  crowdfunding: Record<string, never>;
1878
1956
  });
package/dist/index.js CHANGED
@@ -4579,7 +4579,7 @@ var Seeds = /* @__PURE__ */ ((Seeds2) => {
4579
4579
  Seeds2["GlobalState"] = "global_state";
4580
4580
  Seeds2["BondState"] = "bond_state";
4581
4581
  Seeds2["ValidatorBond"] = "validator_bond";
4582
- Seeds2["PerformanceBond"] = "performance";
4582
+ Seeds2["StandardBond"] = "standard";
4583
4583
  Seeds2["CrowdFundingBond"] = "crowdfunding";
4584
4584
  return Seeds2;
4585
4585
  })(Seeds || {});
@@ -4593,11 +4593,11 @@ init_cjs_shims();
4593
4593
  // src/types/index.ts
4594
4594
  init_cjs_shims();
4595
4595
  var bondTypeToSeed = {
4596
- performance: "performance" /* PerformanceBond */,
4596
+ standard: "standard" /* StandardBond */,
4597
4597
  crowdfunding: "crowdfunding" /* CrowdFundingBond */
4598
4598
  };
4599
4599
  var BondTypeVariant = {
4600
- Performance: { performance: {} },
4600
+ Standard: { standard: {} },
4601
4601
  Crowdfunding: { crowdfunding: {} }
4602
4602
  };
4603
4603
  var BondStateStatusVariant = {
@@ -5019,9 +5019,6 @@ var jbond_default = {
5019
5019
  210
5020
5020
  ],
5021
5021
  accounts: [
5022
- {
5023
- name: "global_state"
5024
- },
5025
5022
  {
5026
5023
  name: "bond_state",
5027
5024
  writable: true,
@@ -5056,10 +5053,7 @@ var jbond_default = {
5056
5053
  {
5057
5054
  name: "authority",
5058
5055
  writable: true,
5059
- signer: true,
5060
- relations: [
5061
- "global_state"
5062
- ]
5056
+ signer: true
5063
5057
  },
5064
5058
  {
5065
5059
  name: "reserve"
@@ -5608,6 +5602,80 @@ var jbond_default = {
5608
5602
  ],
5609
5603
  args: []
5610
5604
  },
5605
+ {
5606
+ name: "migrate_bond",
5607
+ docs: [
5608
+ "Migrates validator bond data from legacy structure to new structure."
5609
+ ],
5610
+ discriminator: [
5611
+ 107,
5612
+ 119,
5613
+ 59,
5614
+ 110,
5615
+ 76,
5616
+ 18,
5617
+ 37,
5618
+ 163
5619
+ ],
5620
+ accounts: [
5621
+ {
5622
+ name: "bond_state",
5623
+ writable: true
5624
+ },
5625
+ {
5626
+ name: "legacy_validator_bond",
5627
+ writable: true
5628
+ },
5629
+ {
5630
+ name: "legacy_vote_account"
5631
+ },
5632
+ {
5633
+ name: "validator_bond",
5634
+ writable: true,
5635
+ pda: {
5636
+ seeds: [
5637
+ {
5638
+ kind: "const",
5639
+ value: [
5640
+ 118,
5641
+ 97,
5642
+ 108,
5643
+ 105,
5644
+ 100,
5645
+ 97,
5646
+ 116,
5647
+ 111,
5648
+ 114,
5649
+ 95,
5650
+ 98,
5651
+ 111,
5652
+ 110,
5653
+ 100
5654
+ ]
5655
+ },
5656
+ {
5657
+ kind: "account",
5658
+ path: "bond_state"
5659
+ },
5660
+ {
5661
+ kind: "account",
5662
+ path: "legacy_vote_account"
5663
+ }
5664
+ ]
5665
+ }
5666
+ },
5667
+ {
5668
+ name: "creator",
5669
+ writable: true,
5670
+ signer: true
5671
+ },
5672
+ {
5673
+ name: "system_program",
5674
+ address: "11111111111111111111111111111111"
5675
+ }
5676
+ ],
5677
+ args: []
5678
+ },
5611
5679
  {
5612
5680
  name: "session_finish",
5613
5681
  docs: [
@@ -5973,7 +6041,7 @@ var jbond_default = {
5973
6041
  {
5974
6042
  name: "BondInitializeData",
5975
6043
  docs: [
5976
- "Data required to initialize a performance bond"
6044
+ "Data required to initialize a standard bond"
5977
6045
  ],
5978
6046
  type: {
5979
6047
  kind: "struct",
@@ -6037,7 +6105,7 @@ var jbond_default = {
6037
6105
  {
6038
6106
  name: "bond_type",
6039
6107
  docs: [
6040
- "The type of bond (e.g., Performance, Crowdfunding)"
6108
+ "The type of bond (e.g., Standard, Crowdfunding)"
6041
6109
  ],
6042
6110
  type: {
6043
6111
  defined: {
@@ -6149,7 +6217,7 @@ var jbond_default = {
6149
6217
  kind: "enum",
6150
6218
  variants: [
6151
6219
  {
6152
- name: "Performance"
6220
+ name: "Standard"
6153
6221
  },
6154
6222
  {
6155
6223
  name: "Crowdfunding"
@@ -6620,10 +6688,8 @@ var JBondClient = class _JBondClient {
6620
6688
  * Build initialize instruction
6621
6689
  */
6622
6690
  async buildBondInitializeIx(props) {
6623
- const [globalState] = this.pda.globalState();
6624
6691
  const [bondState] = this.pda.bondState(props.bondType, props.name);
6625
6692
  const accounts = {
6626
- globalState,
6627
6693
  bondState,
6628
6694
  authority: props.authority ?? this.program.provider.wallet?.publicKey,
6629
6695
  reserve: props.reserve,
@@ -6823,6 +6889,28 @@ var JBondClient = class _JBondClient {
6823
6889
  authority: this.program.provider.wallet?.publicKey
6824
6890
  }).instruction();
6825
6891
  }
6892
+ async migrateBond(props) {
6893
+ const ix = await this.buildBondMigrateIx(props);
6894
+ return this.provider.sendAndConfirm?.(new web3_js.Transaction().add(ix));
6895
+ }
6896
+ async buildBondMigrateIx(props) {
6897
+ const [bondState] = this.pda.bondState(props.bondType, props.name);
6898
+ const [legacyValidatorBond] = web3_js.PublicKey.findProgramAddressSync(
6899
+ [
6900
+ Buffer.from("validator_bond"),
6901
+ new web3_js.PublicKey(props.voteAccount).toBuffer()
6902
+ ],
6903
+ this.programId
6904
+ );
6905
+ const [validatorBond] = this.pda.validatorBond(props.bondType, props.name, props.voteAccount);
6906
+ return this.program.methods.migrateBond().accountsPartial({
6907
+ bondState,
6908
+ legacyValidatorBond,
6909
+ legacyVoteAccount: new web3_js.PublicKey(props.voteAccount),
6910
+ validatorBond,
6911
+ creator: this.program.provider.wallet?.publicKey
6912
+ }).instruction();
6913
+ }
6826
6914
  async buildBondStartIx(props) {
6827
6915
  const [bondState] = this.pda.bondState(props.bondType, props.name);
6828
6916
  return this.program.methods.sessionStart(new import_bn2.BN(props.duration_secs)).accountsPartial({