@jpool/bond-sdk 0.9.0-next.11 → 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.d.mts CHANGED
@@ -31,7 +31,7 @@ declare const ENV_PROGRAM_ID: Record<string, PublicKey>;
31
31
  * IDL can be found at `target/idl/jbond.json`.
32
32
  */
33
33
  type Jbond = {
34
- "address": "DBuUGWbLz8CkAMQiagMfrQzj8SSg1rHQJWrTSc97HWfR";
34
+ "address": "93BH9J99hQS3YinydR6SVjHuAEECoA9kR1BHwnXeDzQe";
35
35
  "metadata": {
36
36
  "name": "jbond";
37
37
  "version": "0.2.1";
@@ -187,6 +187,68 @@ type Jbond = {
187
187
  }
188
188
  ];
189
189
  },
190
+ {
191
+ "name": "bondDisable";
192
+ "docs": [
193
+ "Disables a validator's bond, preventing it from participating further."
194
+ ];
195
+ "discriminator": [
196
+ 159,
197
+ 156,
198
+ 97,
199
+ 253,
200
+ 70,
201
+ 122,
202
+ 117,
203
+ 129
204
+ ];
205
+ "accounts": [
206
+ {
207
+ "name": "bondState";
208
+ "writable": true;
209
+ },
210
+ {
211
+ "name": "authority";
212
+ "writable": true;
213
+ "signer": true;
214
+ "relations": [
215
+ "bondState"
216
+ ];
217
+ }
218
+ ];
219
+ "args": [];
220
+ },
221
+ {
222
+ "name": "bondEnable";
223
+ "docs": [
224
+ "Enables a previously disabled validator's bond."
225
+ ];
226
+ "discriminator": [
227
+ 133,
228
+ 48,
229
+ 84,
230
+ 9,
231
+ 117,
232
+ 131,
233
+ 164,
234
+ 128
235
+ ];
236
+ "accounts": [
237
+ {
238
+ "name": "bondState";
239
+ "writable": true;
240
+ },
241
+ {
242
+ "name": "authority";
243
+ "writable": true;
244
+ "signer": true;
245
+ "relations": [
246
+ "bondState"
247
+ ];
248
+ }
249
+ ];
250
+ "args": [];
251
+ },
190
252
  {
191
253
  "name": "bondInitialize";
192
254
  "docs": [
@@ -1094,6 +1156,16 @@ type Jbond = {
1094
1156
  "code": 6021;
1095
1157
  "name": "invalidArgument";
1096
1158
  "msg": "Invalid argument provided";
1159
+ },
1160
+ {
1161
+ "code": 6022;
1162
+ "name": "bondNotDisabled";
1163
+ "msg": "Bond is not disabled";
1164
+ },
1165
+ {
1166
+ "code": 6023;
1167
+ "name": "bondNotEnabled";
1168
+ "msg": "Bond is not enabled";
1097
1169
  }
1098
1170
  ];
1099
1171
  "types": [
@@ -1272,6 +1344,14 @@ type Jbond = {
1272
1344
  ];
1273
1345
  "type": "i64";
1274
1346
  },
1347
+ {
1348
+ "name": "status";
1349
+ "type": {
1350
+ "defined": {
1351
+ "name": "bondStatus";
1352
+ };
1353
+ };
1354
+ },
1275
1355
  {
1276
1356
  "name": "bump";
1277
1357
  "docs": [
@@ -1282,6 +1362,20 @@ type Jbond = {
1282
1362
  ];
1283
1363
  };
1284
1364
  },
1365
+ {
1366
+ "name": "bondStatus";
1367
+ "type": {
1368
+ "kind": "enum";
1369
+ "variants": [
1370
+ {
1371
+ "name": "active";
1372
+ },
1373
+ {
1374
+ "name": "disabled";
1375
+ }
1376
+ ];
1377
+ };
1378
+ },
1285
1379
  {
1286
1380
  "name": "bondType";
1287
1381
  "docs": [
@@ -1417,15 +1511,6 @@ type Jbond = {
1417
1511
  "type": {
1418
1512
  "kind": "struct";
1419
1513
  "fields": [
1420
- {
1421
- "name": "bonds";
1422
- "docs": [
1423
- "List of all registered bonds"
1424
- ];
1425
- "type": {
1426
- "vec": "pubkey";
1427
- };
1428
- },
1429
1514
  {
1430
1515
  "name": "authority";
1431
1516
  "docs": [
@@ -1449,7 +1534,7 @@ type Jbond = {
1449
1534
  "kind": "struct";
1450
1535
  "fields": [
1451
1536
  {
1452
- "name": "bond";
1537
+ "name": "state";
1453
1538
  "type": "pubkey";
1454
1539
  },
1455
1540
  {
@@ -1470,26 +1555,10 @@ type Jbond = {
1470
1555
  "option": "pubkey";
1471
1556
  };
1472
1557
  },
1473
- {
1474
- "name": "totalCompensationAmount";
1475
- "type": "u64";
1476
- },
1477
- {
1478
- "name": "lastCompensationAmount";
1479
- "type": "u64";
1480
- },
1481
- {
1482
- "name": "lastCompensationEpoch";
1483
- "type": "u64";
1484
- },
1485
1558
  {
1486
1559
  "name": "createdAt";
1487
1560
  "type": "i64";
1488
1561
  },
1489
- {
1490
- "name": "isActive";
1491
- "type": "bool";
1492
- },
1493
1562
  {
1494
1563
  "name": "bump";
1495
1564
  "type": "u8";
@@ -1794,6 +1863,14 @@ declare class JBondClient {
1794
1863
  bondType: BondType;
1795
1864
  name: string;
1796
1865
  }): Promise<string | undefined>;
1866
+ bondEnable(props: {
1867
+ bondType: BondType;
1868
+ name: string;
1869
+ }): Promise<string | undefined>;
1870
+ bondDisable(props: {
1871
+ bondType: BondType;
1872
+ name: string;
1873
+ }): Promise<string | undefined>;
1797
1874
  buildBondGlobalStateInitializeIx(props: GlobalInitializeProps): Promise<TransactionInstruction>;
1798
1875
  /**
1799
1876
  * Build configure instruction
@@ -1818,6 +1895,14 @@ declare class JBondClient {
1818
1895
  name: string;
1819
1896
  duration_secs: number;
1820
1897
  }): Promise<TransactionInstruction>;
1898
+ buildBondEnableIx(props: {
1899
+ bondType: BondType;
1900
+ name: string;
1901
+ }): Promise<TransactionInstruction>;
1902
+ buildBondDisableIx(props: {
1903
+ bondType: BondType;
1904
+ name: string;
1905
+ }): Promise<TransactionInstruction>;
1821
1906
  /**
1822
1907
  * Fetch global state or throw if not found
1823
1908
  */
package/dist/index.d.ts CHANGED
@@ -31,7 +31,7 @@ declare const ENV_PROGRAM_ID: Record<string, PublicKey>;
31
31
  * IDL can be found at `target/idl/jbond.json`.
32
32
  */
33
33
  type Jbond = {
34
- "address": "DBuUGWbLz8CkAMQiagMfrQzj8SSg1rHQJWrTSc97HWfR";
34
+ "address": "93BH9J99hQS3YinydR6SVjHuAEECoA9kR1BHwnXeDzQe";
35
35
  "metadata": {
36
36
  "name": "jbond";
37
37
  "version": "0.2.1";
@@ -187,6 +187,68 @@ type Jbond = {
187
187
  }
188
188
  ];
189
189
  },
190
+ {
191
+ "name": "bondDisable";
192
+ "docs": [
193
+ "Disables a validator's bond, preventing it from participating further."
194
+ ];
195
+ "discriminator": [
196
+ 159,
197
+ 156,
198
+ 97,
199
+ 253,
200
+ 70,
201
+ 122,
202
+ 117,
203
+ 129
204
+ ];
205
+ "accounts": [
206
+ {
207
+ "name": "bondState";
208
+ "writable": true;
209
+ },
210
+ {
211
+ "name": "authority";
212
+ "writable": true;
213
+ "signer": true;
214
+ "relations": [
215
+ "bondState"
216
+ ];
217
+ }
218
+ ];
219
+ "args": [];
220
+ },
221
+ {
222
+ "name": "bondEnable";
223
+ "docs": [
224
+ "Enables a previously disabled validator's bond."
225
+ ];
226
+ "discriminator": [
227
+ 133,
228
+ 48,
229
+ 84,
230
+ 9,
231
+ 117,
232
+ 131,
233
+ 164,
234
+ 128
235
+ ];
236
+ "accounts": [
237
+ {
238
+ "name": "bondState";
239
+ "writable": true;
240
+ },
241
+ {
242
+ "name": "authority";
243
+ "writable": true;
244
+ "signer": true;
245
+ "relations": [
246
+ "bondState"
247
+ ];
248
+ }
249
+ ];
250
+ "args": [];
251
+ },
190
252
  {
191
253
  "name": "bondInitialize";
192
254
  "docs": [
@@ -1094,6 +1156,16 @@ type Jbond = {
1094
1156
  "code": 6021;
1095
1157
  "name": "invalidArgument";
1096
1158
  "msg": "Invalid argument provided";
1159
+ },
1160
+ {
1161
+ "code": 6022;
1162
+ "name": "bondNotDisabled";
1163
+ "msg": "Bond is not disabled";
1164
+ },
1165
+ {
1166
+ "code": 6023;
1167
+ "name": "bondNotEnabled";
1168
+ "msg": "Bond is not enabled";
1097
1169
  }
1098
1170
  ];
1099
1171
  "types": [
@@ -1272,6 +1344,14 @@ type Jbond = {
1272
1344
  ];
1273
1345
  "type": "i64";
1274
1346
  },
1347
+ {
1348
+ "name": "status";
1349
+ "type": {
1350
+ "defined": {
1351
+ "name": "bondStatus";
1352
+ };
1353
+ };
1354
+ },
1275
1355
  {
1276
1356
  "name": "bump";
1277
1357
  "docs": [
@@ -1282,6 +1362,20 @@ type Jbond = {
1282
1362
  ];
1283
1363
  };
1284
1364
  },
1365
+ {
1366
+ "name": "bondStatus";
1367
+ "type": {
1368
+ "kind": "enum";
1369
+ "variants": [
1370
+ {
1371
+ "name": "active";
1372
+ },
1373
+ {
1374
+ "name": "disabled";
1375
+ }
1376
+ ];
1377
+ };
1378
+ },
1285
1379
  {
1286
1380
  "name": "bondType";
1287
1381
  "docs": [
@@ -1417,15 +1511,6 @@ type Jbond = {
1417
1511
  "type": {
1418
1512
  "kind": "struct";
1419
1513
  "fields": [
1420
- {
1421
- "name": "bonds";
1422
- "docs": [
1423
- "List of all registered bonds"
1424
- ];
1425
- "type": {
1426
- "vec": "pubkey";
1427
- };
1428
- },
1429
1514
  {
1430
1515
  "name": "authority";
1431
1516
  "docs": [
@@ -1449,7 +1534,7 @@ type Jbond = {
1449
1534
  "kind": "struct";
1450
1535
  "fields": [
1451
1536
  {
1452
- "name": "bond";
1537
+ "name": "state";
1453
1538
  "type": "pubkey";
1454
1539
  },
1455
1540
  {
@@ -1470,26 +1555,10 @@ type Jbond = {
1470
1555
  "option": "pubkey";
1471
1556
  };
1472
1557
  },
1473
- {
1474
- "name": "totalCompensationAmount";
1475
- "type": "u64";
1476
- },
1477
- {
1478
- "name": "lastCompensationAmount";
1479
- "type": "u64";
1480
- },
1481
- {
1482
- "name": "lastCompensationEpoch";
1483
- "type": "u64";
1484
- },
1485
1558
  {
1486
1559
  "name": "createdAt";
1487
1560
  "type": "i64";
1488
1561
  },
1489
- {
1490
- "name": "isActive";
1491
- "type": "bool";
1492
- },
1493
1562
  {
1494
1563
  "name": "bump";
1495
1564
  "type": "u8";
@@ -1794,6 +1863,14 @@ declare class JBondClient {
1794
1863
  bondType: BondType;
1795
1864
  name: string;
1796
1865
  }): Promise<string | undefined>;
1866
+ bondEnable(props: {
1867
+ bondType: BondType;
1868
+ name: string;
1869
+ }): Promise<string | undefined>;
1870
+ bondDisable(props: {
1871
+ bondType: BondType;
1872
+ name: string;
1873
+ }): Promise<string | undefined>;
1797
1874
  buildBondGlobalStateInitializeIx(props: GlobalInitializeProps): Promise<TransactionInstruction>;
1798
1875
  /**
1799
1876
  * Build configure instruction
@@ -1818,6 +1895,14 @@ declare class JBondClient {
1818
1895
  name: string;
1819
1896
  duration_secs: number;
1820
1897
  }): Promise<TransactionInstruction>;
1898
+ buildBondEnableIx(props: {
1899
+ bondType: BondType;
1900
+ name: string;
1901
+ }): Promise<TransactionInstruction>;
1902
+ buildBondDisableIx(props: {
1903
+ bondType: BondType;
1904
+ name: string;
1905
+ }): Promise<TransactionInstruction>;
1821
1906
  /**
1822
1907
  * Fetch global state or throw if not found
1823
1908
  */
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: [
@@ -5901,6 +5963,16 @@ var jbond_default = {
5901
5963
  code: 6021,
5902
5964
  name: "InvalidArgument",
5903
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"
5904
5976
  }
5905
5977
  ],
5906
5978
  types: [
@@ -6079,6 +6151,14 @@ var jbond_default = {
6079
6151
  ],
6080
6152
  type: "i64"
6081
6153
  },
6154
+ {
6155
+ name: "status",
6156
+ type: {
6157
+ defined: {
6158
+ name: "BondStatus"
6159
+ }
6160
+ }
6161
+ },
6082
6162
  {
6083
6163
  name: "bump",
6084
6164
  docs: [
@@ -6089,6 +6169,20 @@ var jbond_default = {
6089
6169
  ]
6090
6170
  }
6091
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
+ },
6092
6186
  {
6093
6187
  name: "BondType",
6094
6188
  docs: [
@@ -6224,15 +6318,6 @@ var jbond_default = {
6224
6318
  type: {
6225
6319
  kind: "struct",
6226
6320
  fields: [
6227
- {
6228
- name: "bonds",
6229
- docs: [
6230
- "List of all registered bonds"
6231
- ],
6232
- type: {
6233
- vec: "pubkey"
6234
- }
6235
- },
6236
6321
  {
6237
6322
  name: "authority",
6238
6323
  docs: [
@@ -6256,7 +6341,7 @@ var jbond_default = {
6256
6341
  kind: "struct",
6257
6342
  fields: [
6258
6343
  {
6259
- name: "bond",
6344
+ name: "state",
6260
6345
  type: "pubkey"
6261
6346
  },
6262
6347
  {
@@ -6277,26 +6362,10 @@ var jbond_default = {
6277
6362
  option: "pubkey"
6278
6363
  }
6279
6364
  },
6280
- {
6281
- name: "total_compensation_amount",
6282
- type: "u64"
6283
- },
6284
- {
6285
- name: "last_compensation_amount",
6286
- type: "u64"
6287
- },
6288
- {
6289
- name: "last_compensation_epoch",
6290
- type: "u64"
6291
- },
6292
6365
  {
6293
6366
  name: "created_at",
6294
6367
  type: "i64"
6295
6368
  },
6296
- {
6297
- name: "is_active",
6298
- type: "bool"
6299
- },
6300
6369
  {
6301
6370
  name: "bump",
6302
6371
  type: "u8"
@@ -6569,6 +6638,14 @@ var JBondClient = class _JBondClient {
6569
6638
  const ix = await this.buildBondFinishIx(props);
6570
6639
  return this.provider.sendAndConfirm?.(new web3_js.Transaction().add(ix));
6571
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
+ }
6572
6649
  async buildBondGlobalStateInitializeIx(props) {
6573
6650
  const [globalState] = this.pda.globalState();
6574
6651
  const authority = props.authority ?? this.provider.wallet?.publicKey;
@@ -6829,6 +6906,20 @@ var JBondClient = class _JBondClient {
6829
6906
  authority: this.program.provider.wallet?.publicKey
6830
6907
  }).instruction();
6831
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
+ }
6832
6923
  /**
6833
6924
  * Fetch global state or throw if not found
6834
6925
  */