@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.mjs CHANGED
@@ -4803,7 +4803,7 @@ var HistoryManager = class {
4803
4803
 
4804
4804
  // src/idl/jbond.json
4805
4805
  var jbond_default = {
4806
- address: "DBuUGWbLz8CkAMQiagMfrQzj8SSg1rHQJWrTSc97HWfR",
4806
+ address: "93BH9J99hQS3YinydR6SVjHuAEECoA9kR1BHwnXeDzQe",
4807
4807
  metadata: {
4808
4808
  name: "jbond",
4809
4809
  version: "0.2.1",
@@ -4959,6 +4959,68 @@ var jbond_default = {
4959
4959
  }
4960
4960
  ]
4961
4961
  },
4962
+ {
4963
+ name: "bond_disable",
4964
+ docs: [
4965
+ "Disables a validator's bond, preventing it from participating further."
4966
+ ],
4967
+ discriminator: [
4968
+ 159,
4969
+ 156,
4970
+ 97,
4971
+ 253,
4972
+ 70,
4973
+ 122,
4974
+ 117,
4975
+ 129
4976
+ ],
4977
+ accounts: [
4978
+ {
4979
+ name: "bond_state",
4980
+ writable: true
4981
+ },
4982
+ {
4983
+ name: "authority",
4984
+ writable: true,
4985
+ signer: true,
4986
+ relations: [
4987
+ "bond_state"
4988
+ ]
4989
+ }
4990
+ ],
4991
+ args: []
4992
+ },
4993
+ {
4994
+ name: "bond_enable",
4995
+ docs: [
4996
+ "Enables a previously disabled validator's bond."
4997
+ ],
4998
+ discriminator: [
4999
+ 133,
5000
+ 48,
5001
+ 84,
5002
+ 9,
5003
+ 117,
5004
+ 131,
5005
+ 164,
5006
+ 128
5007
+ ],
5008
+ accounts: [
5009
+ {
5010
+ name: "bond_state",
5011
+ writable: true
5012
+ },
5013
+ {
5014
+ name: "authority",
5015
+ writable: true,
5016
+ signer: true,
5017
+ relations: [
5018
+ "bond_state"
5019
+ ]
5020
+ }
5021
+ ],
5022
+ args: []
5023
+ },
4962
5024
  {
4963
5025
  name: "bond_initialize",
4964
5026
  docs: [
@@ -5567,6 +5629,37 @@ var jbond_default = {
5567
5629
  ],
5568
5630
  args: []
5569
5631
  },
5632
+ {
5633
+ name: "session_finish",
5634
+ docs: [
5635
+ "Finishes a bond, preventing further deposits and withdrawals."
5636
+ ],
5637
+ discriminator: [
5638
+ 230,
5639
+ 209,
5640
+ 54,
5641
+ 205,
5642
+ 127,
5643
+ 141,
5644
+ 137,
5645
+ 113
5646
+ ],
5647
+ accounts: [
5648
+ {
5649
+ name: "bond_state",
5650
+ writable: true
5651
+ },
5652
+ {
5653
+ name: "authority",
5654
+ writable: true,
5655
+ signer: true,
5656
+ relations: [
5657
+ "bond_state"
5658
+ ]
5659
+ }
5660
+ ],
5661
+ args: []
5662
+ },
5570
5663
  {
5571
5664
  name: "session_start",
5572
5665
  docs: [
@@ -5835,6 +5928,16 @@ var jbond_default = {
5835
5928
  code: 6021,
5836
5929
  name: "InvalidArgument",
5837
5930
  msg: "Invalid argument provided"
5931
+ },
5932
+ {
5933
+ code: 6022,
5934
+ name: "BondNotDisabled",
5935
+ msg: "Bond is not disabled"
5936
+ },
5937
+ {
5938
+ code: 6023,
5939
+ name: "BondNotEnabled",
5940
+ msg: "Bond is not enabled"
5838
5941
  }
5839
5942
  ],
5840
5943
  types: [
@@ -6013,6 +6116,14 @@ var jbond_default = {
6013
6116
  ],
6014
6117
  type: "i64"
6015
6118
  },
6119
+ {
6120
+ name: "status",
6121
+ type: {
6122
+ defined: {
6123
+ name: "BondStatus"
6124
+ }
6125
+ }
6126
+ },
6016
6127
  {
6017
6128
  name: "bump",
6018
6129
  docs: [
@@ -6023,6 +6134,20 @@ var jbond_default = {
6023
6134
  ]
6024
6135
  }
6025
6136
  },
6137
+ {
6138
+ name: "BondStatus",
6139
+ type: {
6140
+ kind: "enum",
6141
+ variants: [
6142
+ {
6143
+ name: "Active"
6144
+ },
6145
+ {
6146
+ name: "Disabled"
6147
+ }
6148
+ ]
6149
+ }
6150
+ },
6026
6151
  {
6027
6152
  name: "BondType",
6028
6153
  docs: [
@@ -6158,15 +6283,6 @@ var jbond_default = {
6158
6283
  type: {
6159
6284
  kind: "struct",
6160
6285
  fields: [
6161
- {
6162
- name: "bonds",
6163
- docs: [
6164
- "List of all registered bonds"
6165
- ],
6166
- type: {
6167
- vec: "pubkey"
6168
- }
6169
- },
6170
6286
  {
6171
6287
  name: "authority",
6172
6288
  docs: [
@@ -6190,7 +6306,7 @@ var jbond_default = {
6190
6306
  kind: "struct",
6191
6307
  fields: [
6192
6308
  {
6193
- name: "bond",
6309
+ name: "state",
6194
6310
  type: "pubkey"
6195
6311
  },
6196
6312
  {
@@ -6211,26 +6327,10 @@ var jbond_default = {
6211
6327
  option: "pubkey"
6212
6328
  }
6213
6329
  },
6214
- {
6215
- name: "total_compensation_amount",
6216
- type: "u64"
6217
- },
6218
- {
6219
- name: "last_compensation_amount",
6220
- type: "u64"
6221
- },
6222
- {
6223
- name: "last_compensation_epoch",
6224
- type: "u64"
6225
- },
6226
6330
  {
6227
6331
  name: "created_at",
6228
6332
  type: "i64"
6229
6333
  },
6230
- {
6231
- name: "is_active",
6232
- type: "bool"
6233
- },
6234
6334
  {
6235
6335
  name: "bump",
6236
6336
  type: "u8"
@@ -6502,6 +6602,14 @@ var JBondClient = class _JBondClient {
6502
6602
  const ix = await this.buildBondFinishIx(props);
6503
6603
  return this.provider.sendAndConfirm?.(new Transaction().add(ix));
6504
6604
  }
6605
+ async bondEnable(props) {
6606
+ const ix = await this.buildBondEnableIx(props);
6607
+ return this.provider.sendAndConfirm?.(new Transaction().add(ix));
6608
+ }
6609
+ async bondDisable(props) {
6610
+ const ix = await this.buildBondDisableIx(props);
6611
+ return this.provider.sendAndConfirm?.(new Transaction().add(ix));
6612
+ }
6505
6613
  async buildBondGlobalStateInitializeIx(props) {
6506
6614
  const [globalState] = this.pda.globalState();
6507
6615
  const authority = props.authority ?? this.provider.wallet?.publicKey;
@@ -6748,8 +6856,12 @@ var JBondClient = class _JBondClient {
6748
6856
  newWithdrawAuthority: props.newWithdrawAuthority ?? null
6749
6857
  }).instruction();
6750
6858
  }
6751
- async buildBondFinishIx(_props) {
6752
- throw new Error("Crowdfunding bond currently does not support finish operation");
6859
+ async buildBondFinishIx(props) {
6860
+ const [bondState] = this.pda.bondState(props.bondType, props.name);
6861
+ return this.program.methods.sessionFinish().accountsPartial({
6862
+ bondState,
6863
+ authority: this.program.provider.wallet?.publicKey
6864
+ }).instruction();
6753
6865
  }
6754
6866
  async buildBondStartIx(props) {
6755
6867
  const [bondState] = this.pda.bondState(props.bondType, props.name);
@@ -6758,6 +6870,20 @@ var JBondClient = class _JBondClient {
6758
6870
  authority: this.program.provider.wallet?.publicKey
6759
6871
  }).instruction();
6760
6872
  }
6873
+ async buildBondEnableIx(props) {
6874
+ const [bondState] = this.pda.bondState(props.bondType, props.name);
6875
+ return this.program.methods.bondEnable().accountsPartial({
6876
+ bondState,
6877
+ authority: this.program.provider.wallet?.publicKey
6878
+ }).instruction();
6879
+ }
6880
+ async buildBondDisableIx(props) {
6881
+ const [bondState] = this.pda.bondState(props.bondType, props.name);
6882
+ return this.program.methods.bondDisable().accountsPartial({
6883
+ bondState,
6884
+ authority: this.program.provider.wallet?.publicKey
6885
+ }).instruction();
6886
+ }
6761
6887
  /**
6762
6888
  * Fetch global state or throw if not found
6763
6889
  */