@jpool/bond-sdk 0.9.0-next.10 → 0.9.0-next.12

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.js CHANGED
@@ -4838,7 +4838,7 @@ var HistoryManager = class {
4838
4838
 
4839
4839
  // src/idl/jbond.json
4840
4840
  var jbond_default = {
4841
- address: "DBuUGWbLz8CkAMQiagMfrQzj8SSg1rHQJWrTSc97HWfR",
4841
+ address: "93BH9J99hQS3YinydR6SVjHuAEECoA9kR1BHwnXeDzQe",
4842
4842
  metadata: {
4843
4843
  name: "jbond",
4844
4844
  version: "0.2.1",
@@ -4994,6 +4994,68 @@ var jbond_default = {
4994
4994
  }
4995
4995
  ]
4996
4996
  },
4997
+ {
4998
+ name: "bond_disable",
4999
+ docs: [
5000
+ "Disables a validator's bond, preventing it from participating further."
5001
+ ],
5002
+ discriminator: [
5003
+ 159,
5004
+ 156,
5005
+ 97,
5006
+ 253,
5007
+ 70,
5008
+ 122,
5009
+ 117,
5010
+ 129
5011
+ ],
5012
+ accounts: [
5013
+ {
5014
+ name: "bond_state",
5015
+ writable: true
5016
+ },
5017
+ {
5018
+ name: "authority",
5019
+ writable: true,
5020
+ signer: true,
5021
+ relations: [
5022
+ "bond_state"
5023
+ ]
5024
+ }
5025
+ ],
5026
+ args: []
5027
+ },
5028
+ {
5029
+ name: "bond_enable",
5030
+ docs: [
5031
+ "Enables a previously disabled validator's bond."
5032
+ ],
5033
+ discriminator: [
5034
+ 133,
5035
+ 48,
5036
+ 84,
5037
+ 9,
5038
+ 117,
5039
+ 131,
5040
+ 164,
5041
+ 128
5042
+ ],
5043
+ accounts: [
5044
+ {
5045
+ name: "bond_state",
5046
+ writable: true
5047
+ },
5048
+ {
5049
+ name: "authority",
5050
+ writable: true,
5051
+ signer: true,
5052
+ relations: [
5053
+ "bond_state"
5054
+ ]
5055
+ }
5056
+ ],
5057
+ args: []
5058
+ },
4997
5059
  {
4998
5060
  name: "bond_initialize",
4999
5061
  docs: [
@@ -5602,6 +5664,37 @@ var jbond_default = {
5602
5664
  ],
5603
5665
  args: []
5604
5666
  },
5667
+ {
5668
+ name: "session_finish",
5669
+ docs: [
5670
+ "Finishes a bond, preventing further deposits and withdrawals."
5671
+ ],
5672
+ discriminator: [
5673
+ 230,
5674
+ 209,
5675
+ 54,
5676
+ 205,
5677
+ 127,
5678
+ 141,
5679
+ 137,
5680
+ 113
5681
+ ],
5682
+ accounts: [
5683
+ {
5684
+ name: "bond_state",
5685
+ writable: true
5686
+ },
5687
+ {
5688
+ name: "authority",
5689
+ writable: true,
5690
+ signer: true,
5691
+ relations: [
5692
+ "bond_state"
5693
+ ]
5694
+ }
5695
+ ],
5696
+ args: []
5697
+ },
5605
5698
  {
5606
5699
  name: "session_start",
5607
5700
  docs: [
@@ -5870,6 +5963,16 @@ var jbond_default = {
5870
5963
  code: 6021,
5871
5964
  name: "InvalidArgument",
5872
5965
  msg: "Invalid argument provided"
5966
+ },
5967
+ {
5968
+ code: 6022,
5969
+ name: "BondNotDisabled",
5970
+ msg: "Bond is not disabled"
5971
+ },
5972
+ {
5973
+ code: 6023,
5974
+ name: "BondNotEnabled",
5975
+ msg: "Bond is not enabled"
5873
5976
  }
5874
5977
  ],
5875
5978
  types: [
@@ -6048,6 +6151,14 @@ var jbond_default = {
6048
6151
  ],
6049
6152
  type: "i64"
6050
6153
  },
6154
+ {
6155
+ name: "status",
6156
+ type: {
6157
+ defined: {
6158
+ name: "BondStatus"
6159
+ }
6160
+ }
6161
+ },
6051
6162
  {
6052
6163
  name: "bump",
6053
6164
  docs: [
@@ -6058,6 +6169,20 @@ var jbond_default = {
6058
6169
  ]
6059
6170
  }
6060
6171
  },
6172
+ {
6173
+ name: "BondStatus",
6174
+ type: {
6175
+ kind: "enum",
6176
+ variants: [
6177
+ {
6178
+ name: "Active"
6179
+ },
6180
+ {
6181
+ name: "Disabled"
6182
+ }
6183
+ ]
6184
+ }
6185
+ },
6061
6186
  {
6062
6187
  name: "BondType",
6063
6188
  docs: [
@@ -6193,15 +6318,6 @@ var jbond_default = {
6193
6318
  type: {
6194
6319
  kind: "struct",
6195
6320
  fields: [
6196
- {
6197
- name: "bonds",
6198
- docs: [
6199
- "List of all registered bonds"
6200
- ],
6201
- type: {
6202
- vec: "pubkey"
6203
- }
6204
- },
6205
6321
  {
6206
6322
  name: "authority",
6207
6323
  docs: [
@@ -6225,7 +6341,7 @@ var jbond_default = {
6225
6341
  kind: "struct",
6226
6342
  fields: [
6227
6343
  {
6228
- name: "bond",
6344
+ name: "state",
6229
6345
  type: "pubkey"
6230
6346
  },
6231
6347
  {
@@ -6246,26 +6362,10 @@ var jbond_default = {
6246
6362
  option: "pubkey"
6247
6363
  }
6248
6364
  },
6249
- {
6250
- name: "total_compensation_amount",
6251
- type: "u64"
6252
- },
6253
- {
6254
- name: "last_compensation_amount",
6255
- type: "u64"
6256
- },
6257
- {
6258
- name: "last_compensation_epoch",
6259
- type: "u64"
6260
- },
6261
6365
  {
6262
6366
  name: "created_at",
6263
6367
  type: "i64"
6264
6368
  },
6265
- {
6266
- name: "is_active",
6267
- type: "bool"
6268
- },
6269
6369
  {
6270
6370
  name: "bump",
6271
6371
  type: "u8"
@@ -6538,6 +6638,14 @@ var JBondClient = class _JBondClient {
6538
6638
  const ix = await this.buildBondFinishIx(props);
6539
6639
  return this.provider.sendAndConfirm?.(new web3_js.Transaction().add(ix));
6540
6640
  }
6641
+ async bondEnable(props) {
6642
+ const ix = await this.buildBondEnableIx(props);
6643
+ return this.provider.sendAndConfirm?.(new web3_js.Transaction().add(ix));
6644
+ }
6645
+ async bondDisable(props) {
6646
+ const ix = await this.buildBondDisableIx(props);
6647
+ return this.provider.sendAndConfirm?.(new web3_js.Transaction().add(ix));
6648
+ }
6541
6649
  async buildBondGlobalStateInitializeIx(props) {
6542
6650
  const [globalState] = this.pda.globalState();
6543
6651
  const authority = props.authority ?? this.provider.wallet?.publicKey;
@@ -6784,8 +6892,12 @@ var JBondClient = class _JBondClient {
6784
6892
  newWithdrawAuthority: props.newWithdrawAuthority ?? null
6785
6893
  }).instruction();
6786
6894
  }
6787
- async buildBondFinishIx(_props) {
6788
- throw new Error("Crowdfunding bond currently does not support finish operation");
6895
+ async buildBondFinishIx(props) {
6896
+ const [bondState] = this.pda.bondState(props.bondType, props.name);
6897
+ return this.program.methods.sessionFinish().accountsPartial({
6898
+ bondState,
6899
+ authority: this.program.provider.wallet?.publicKey
6900
+ }).instruction();
6789
6901
  }
6790
6902
  async buildBondStartIx(props) {
6791
6903
  const [bondState] = this.pda.bondState(props.bondType, props.name);
@@ -6794,6 +6906,20 @@ var JBondClient = class _JBondClient {
6794
6906
  authority: this.program.provider.wallet?.publicKey
6795
6907
  }).instruction();
6796
6908
  }
6909
+ async buildBondEnableIx(props) {
6910
+ const [bondState] = this.pda.bondState(props.bondType, props.name);
6911
+ return this.program.methods.bondEnable().accountsPartial({
6912
+ bondState,
6913
+ authority: this.program.provider.wallet?.publicKey
6914
+ }).instruction();
6915
+ }
6916
+ async buildBondDisableIx(props) {
6917
+ const [bondState] = this.pda.bondState(props.bondType, props.name);
6918
+ return this.program.methods.bondDisable().accountsPartial({
6919
+ bondState,
6920
+ authority: this.program.provider.wallet?.publicKey
6921
+ }).instruction();
6922
+ }
6797
6923
  /**
6798
6924
  * Fetch global state or throw if not found
6799
6925
  */