@jpool/bond-sdk 0.11.0-next.21 → 0.11.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.ts CHANGED
@@ -14,7 +14,7 @@ type Jbond = {
14
14
  "address": "Fo17edWRJewZNTRibgx9iTfjywCW6dzS81VwBLmPFVq1";
15
15
  "metadata": {
16
16
  "name": "jbond";
17
- "version": "0.2.1";
17
+ "version": "0.2.3";
18
18
  "spec": "0.1.0";
19
19
  "description": "Jpool Bond Program";
20
20
  };
@@ -90,6 +90,9 @@ type Jbond = {
90
90
  {
91
91
  "name": "authority";
92
92
  "signer": true;
93
+ "relations": [
94
+ "bondState"
95
+ ];
93
96
  },
94
97
  {
95
98
  "name": "bondTokenAccount";
@@ -263,10 +266,12 @@ type Jbond = {
263
266
  {
264
267
  "name": "bondLockFunds";
265
268
  "docs": [
266
- "Locks funds for both the current and upcoming epoch.",
267
- "Moves collateral from available to locked state, making it unavailable for withdrawal for",
268
- "the current and next epoch. # Errors",
269
- "Fails if the validator is not active, or if there are insufficient available funds."
269
+ "Locks funds immediately, making them unavailable for withdrawal.",
270
+ "The locked amount takes effect immediately in the current epoch.",
271
+ "",
272
+ "# Errors",
273
+ "Fails if the bond type is not lockable, if the amount is zero,",
274
+ "or if there are insufficient available funds."
270
275
  ];
271
276
  "discriminator": [
272
277
  117,
@@ -364,6 +369,33 @@ type Jbond = {
364
369
  {
365
370
  "name": "bondState";
366
371
  "writable": true;
372
+ "pda": {
373
+ "seeds": [
374
+ {
375
+ "kind": "const";
376
+ "value": [
377
+ 98,
378
+ 111,
379
+ 110,
380
+ 100,
381
+ 95,
382
+ 115,
383
+ 116,
384
+ 97,
385
+ 116,
386
+ 101
387
+ ];
388
+ },
389
+ {
390
+ "kind": "arg";
391
+ "path": "bondType";
392
+ },
393
+ {
394
+ "kind": "arg";
395
+ "path": "bondName";
396
+ }
397
+ ];
398
+ };
367
399
  },
368
400
  {
369
401
  "name": "validatorBond";
@@ -451,10 +483,13 @@ type Jbond = {
451
483
  {
452
484
  "name": "bondReleaseFunds";
453
485
  "docs": [
454
- "Releases locked funds after an epoch ends.",
455
- "Moves collateral from locked back to available state, allowing withdrawals.",
486
+ "Queues funds for unlock in the next epoch.",
487
+ "The unlock is delayed by one epoch for security - funds remain locked",
488
+ "in the current epoch but will be available after epoch transition.",
489
+ "",
456
490
  "# Errors",
457
- "Fails if the validator is not active, or if there are insufficient locked funds."
491
+ "Fails if the bond type is not lockable, if the amount is zero,",
492
+ "or if the amount exceeds currently locked funds."
458
493
  ];
459
494
  "discriminator": [
460
495
  184,
@@ -733,15 +768,12 @@ type Jbond = {
733
768
  {
734
769
  "name": "bondUpdate";
735
770
  "docs": [
736
- "Transitions locked funds between epochs for a validator bond.",
737
- "",
738
- "This function should be called at epoch boundaries to update the bond's",
739
- "`last_update_epoch` and move the `next_epoch_locked` amount into",
740
- "`locked`. It ensures that the update only occurs once per epoch.",
771
+ "Applies any pending unlocks from previous epochs.",
741
772
  "",
742
- "# Errors",
743
- "Returns [`BondError::InvalidEpoch`] if called more than once in the same epoch,",
744
- "or if the system clock cannot be accessed."
773
+ "This instruction is optional - all other operations now automatically",
774
+ "sync the epoch state. It is kept for backwards compatibility and can",
775
+ "be used to explicitly trigger epoch synchronization without performing",
776
+ "another operation."
745
777
  ];
746
778
  "discriminator": [
747
779
  237,
@@ -760,7 +792,6 @@ type Jbond = {
760
792
  },
761
793
  {
762
794
  "name": "payer";
763
- "writable": true;
764
795
  "signer": true;
765
796
  }
766
797
  ];
@@ -1128,6 +1159,19 @@ type Jbond = {
1128
1159
  }
1129
1160
  ];
1130
1161
  "events": [
1162
+ {
1163
+ "name": "bondConfigured";
1164
+ "discriminator": [
1165
+ 141,
1166
+ 252,
1167
+ 43,
1168
+ 54,
1169
+ 45,
1170
+ 157,
1171
+ 81,
1172
+ 14
1173
+ ];
1174
+ },
1131
1175
  {
1132
1176
  "name": "bondFinished";
1133
1177
  "discriminator": [
@@ -1141,6 +1185,32 @@ type Jbond = {
1141
1185
  191
1142
1186
  ];
1143
1187
  },
1188
+ {
1189
+ "name": "bondInitialized";
1190
+ "discriminator": [
1191
+ 73,
1192
+ 68,
1193
+ 161,
1194
+ 2,
1195
+ 214,
1196
+ 12,
1197
+ 169,
1198
+ 53
1199
+ ];
1200
+ },
1201
+ {
1202
+ "name": "bondRemoved";
1203
+ "discriminator": [
1204
+ 177,
1205
+ 200,
1206
+ 116,
1207
+ 123,
1208
+ 1,
1209
+ 244,
1210
+ 161,
1211
+ 240
1212
+ ];
1213
+ },
1144
1214
  {
1145
1215
  "name": "bondStarted";
1146
1216
  "discriminator": [
@@ -1155,16 +1225,16 @@ type Jbond = {
1155
1225
  ];
1156
1226
  },
1157
1227
  {
1158
- "name": "collateralToppedUp";
1228
+ "name": "collateralDeposited";
1159
1229
  "discriminator": [
1160
- 189,
1161
- 137,
1162
- 204,
1163
- 58,
1230
+ 244,
1231
+ 62,
1232
+ 77,
1233
+ 11,
1164
1234
  135,
1165
- 182,
1166
- 19,
1167
- 176
1235
+ 112,
1236
+ 61,
1237
+ 96
1168
1238
  ];
1169
1239
  },
1170
1240
  {
@@ -1193,6 +1263,32 @@ type Jbond = {
1193
1263
  32
1194
1264
  ];
1195
1265
  },
1266
+ {
1267
+ "name": "fundsLocked";
1268
+ "discriminator": [
1269
+ 227,
1270
+ 93,
1271
+ 162,
1272
+ 69,
1273
+ 181,
1274
+ 4,
1275
+ 71,
1276
+ 157
1277
+ ];
1278
+ },
1279
+ {
1280
+ "name": "fundsUnlocked";
1281
+ "discriminator": [
1282
+ 11,
1283
+ 240,
1284
+ 184,
1285
+ 107,
1286
+ 86,
1287
+ 187,
1288
+ 196,
1289
+ 128
1290
+ ];
1291
+ },
1196
1292
  {
1197
1293
  "name": "validatorRegistered";
1198
1294
  "discriminator": [
@@ -1205,33 +1301,46 @@ type Jbond = {
1205
1301
  95,
1206
1302
  72
1207
1303
  ];
1304
+ },
1305
+ {
1306
+ "name": "withdrawAuthorityChanged";
1307
+ "discriminator": [
1308
+ 91,
1309
+ 149,
1310
+ 224,
1311
+ 49,
1312
+ 187,
1313
+ 48,
1314
+ 190,
1315
+ 100
1316
+ ];
1208
1317
  }
1209
1318
  ];
1210
1319
  "errors": [
1211
1320
  {
1212
1321
  "code": 6000;
1213
- "name": "invalidVoteAccount";
1214
- "msg": "Invalid vote account";
1322
+ "name": "forbidden";
1323
+ "msg": "forbidden";
1215
1324
  },
1216
1325
  {
1217
1326
  "code": 6001;
1218
- "name": "identityMismatch";
1219
- "msg": "Identity does not match vote account";
1327
+ "name": "unauthorized";
1328
+ "msg": "unauthorized";
1220
1329
  },
1221
1330
  {
1222
1331
  "code": 6002;
1223
- "name": "insufficientCollateral";
1224
- "msg": "Insufficient collateral amount";
1332
+ "name": "invalidVoteAccount";
1333
+ "msg": "Invalid vote account";
1225
1334
  },
1226
1335
  {
1227
1336
  "code": 6003;
1228
- "name": "targetAprTooLow";
1229
- "msg": "Target APR is below minimum threshold";
1337
+ "name": "identityMismatch";
1338
+ "msg": "Vote account identity mismatch";
1230
1339
  },
1231
1340
  {
1232
1341
  "code": 6004;
1233
- "name": "mathOverflow";
1234
- "msg": "Math overflow";
1342
+ "name": "invalidMint";
1343
+ "msg": "Invalid mint address";
1235
1344
  },
1236
1345
  {
1237
1346
  "code": 6005;
@@ -1240,103 +1349,53 @@ type Jbond = {
1240
1349
  },
1241
1350
  {
1242
1351
  "code": 6006;
1243
- "name": "validatorNotActive";
1244
- "msg": "Validator bond account is not active";
1352
+ "name": "invalidArgument";
1353
+ "msg": "Invalid argument";
1245
1354
  },
1246
1355
  {
1247
1356
  "code": 6007;
1248
- "name": "validatorAlreadyRegistered";
1249
- "msg": "Validator already registered";
1357
+ "name": "insufficientBalance";
1358
+ "msg": "Insufficient balance";
1250
1359
  },
1251
1360
  {
1252
1361
  "code": 6008;
1253
- "name": "unauthorized";
1254
- "msg": "unauthorized";
1362
+ "name": "mathOverflow";
1363
+ "msg": "Math overflow";
1255
1364
  },
1256
1365
  {
1257
1366
  "code": 6009;
1258
- "name": "withdrawalLockedNearEpochEnd";
1259
- "msg": "Withdrawals are locked near the end of the epoch.";
1367
+ "name": "overflow";
1368
+ "msg": "Arithmetic overflow";
1260
1369
  },
1261
1370
  {
1262
1371
  "code": 6010;
1263
- "name": "missingTokenAccounts";
1264
- "msg": "Missing token accounts for token collateral type";
1372
+ "name": "bondNotRemovable";
1373
+ "msg": "Bond cannot be removed";
1265
1374
  },
1266
1375
  {
1267
1376
  "code": 6011;
1268
- "name": "missingTokenProgram";
1269
- "msg": "Token program is required for token collateral type";
1377
+ "name": "missingTokenAccounts";
1378
+ "msg": "Missing token accounts";
1270
1379
  },
1271
1380
  {
1272
1381
  "code": 6012;
1273
- "name": "invalidMint";
1274
- "msg": "Invalid mint for token collateral type";
1382
+ "name": "missingTokenProgram";
1383
+ "msg": "Missing token program";
1275
1384
  },
1276
1385
  {
1277
1386
  "code": 6013;
1278
1387
  "name": "missingStakeAccount";
1279
- "msg": "Stake account is required for stake account collateral type";
1388
+ "msg": "Missing stake account";
1280
1389
  },
1281
1390
  {
1282
1391
  "code": 6014;
1283
1392
  "name": "missingStakeProgram";
1284
- "msg": "Stake program is required for stake account collateral type";
1393
+ "msg": "Missing stake program";
1285
1394
  },
1286
1395
  {
1287
1396
  "code": 6015;
1288
- "name": "bondFinished";
1289
- "msg": "Bond is finished (deposits/withdrawals disabled)";
1290
- },
1291
- {
1292
- "code": 6016;
1293
- "name": "bondNotFinished";
1294
- "msg": "Bond is not finished";
1295
- },
1296
- {
1297
- "code": 6017;
1298
1397
  "name": "unsupportedCollateralType";
1299
1398
  "msg": "Unsupported collateral type";
1300
- },
1301
- {
1302
- "code": 6018;
1303
- "name": "overflow";
1304
- "msg": "Math operation overflowed";
1305
- },
1306
- {
1307
- "code": 6019;
1308
- "name": "incorrectBondType";
1309
- "msg": "Incorrect bond type for this operation";
1310
- },
1311
- {
1312
- "code": 6020;
1313
- "name": "bondNotFinishable";
1314
- "msg": "This bond type can't be finished";
1315
- },
1316
- {
1317
- "code": 6021;
1318
- "name": "invalidArgument";
1319
- "msg": "Invalid argument provided";
1320
- },
1321
- {
1322
- "code": 6022;
1323
- "name": "bondNotDisabled";
1324
- "msg": "Bond is not disabled";
1325
- },
1326
- {
1327
- "code": 6023;
1328
- "name": "bondNotEnabled";
1329
- "msg": "Bond is not enabled";
1330
- },
1331
- {
1332
- "code": 6024;
1333
- "name": "invalidEpoch";
1334
- "msg": "Invalid epoch for this operation";
1335
- },
1336
- {
1337
- "code": 6025;
1338
- "name": "bondNotRemovable";
1339
- "msg": "Bond is not removable";
1340
1399
  }
1341
1400
  ];
1342
1401
  "types": [
@@ -1370,6 +1429,26 @@ type Jbond = {
1370
1429
  ];
1371
1430
  };
1372
1431
  },
1432
+ {
1433
+ "name": "bondConfigured";
1434
+ "type": {
1435
+ "kind": "struct";
1436
+ "fields": [
1437
+ {
1438
+ "name": "bond";
1439
+ "type": "pubkey";
1440
+ },
1441
+ {
1442
+ "name": "authority";
1443
+ "type": "pubkey";
1444
+ },
1445
+ {
1446
+ "name": "timestamp";
1447
+ "type": "i64";
1448
+ }
1449
+ ];
1450
+ };
1451
+ },
1373
1452
  {
1374
1453
  "name": "bondFinished";
1375
1454
  "type": {
@@ -1425,6 +1504,46 @@ type Jbond = {
1425
1504
  ];
1426
1505
  };
1427
1506
  },
1507
+ {
1508
+ "name": "bondInitialized";
1509
+ "type": {
1510
+ "kind": "struct";
1511
+ "fields": [
1512
+ {
1513
+ "name": "bond";
1514
+ "type": "pubkey";
1515
+ },
1516
+ {
1517
+ "name": "authority";
1518
+ "type": "pubkey";
1519
+ },
1520
+ {
1521
+ "name": "timestamp";
1522
+ "type": "i64";
1523
+ }
1524
+ ];
1525
+ };
1526
+ },
1527
+ {
1528
+ "name": "bondRemoved";
1529
+ "type": {
1530
+ "kind": "struct";
1531
+ "fields": [
1532
+ {
1533
+ "name": "bond";
1534
+ "type": "pubkey";
1535
+ },
1536
+ {
1537
+ "name": "authority";
1538
+ "type": "pubkey";
1539
+ },
1540
+ {
1541
+ "name": "timestamp";
1542
+ "type": "i64";
1543
+ }
1544
+ ];
1545
+ };
1546
+ },
1428
1547
  {
1429
1548
  "name": "bondStarted";
1430
1549
  "type": {
@@ -1578,7 +1697,7 @@ type Jbond = {
1578
1697
  };
1579
1698
  },
1580
1699
  {
1581
- "name": "collateralToppedUp";
1700
+ "name": "collateralDeposited";
1582
1701
  "type": {
1583
1702
  "kind": "struct";
1584
1703
  "fields": [
@@ -1676,6 +1795,54 @@ type Jbond = {
1676
1795
  ];
1677
1796
  };
1678
1797
  },
1798
+ {
1799
+ "name": "fundsLocked";
1800
+ "type": {
1801
+ "kind": "struct";
1802
+ "fields": [
1803
+ {
1804
+ "name": "validator";
1805
+ "type": "pubkey";
1806
+ },
1807
+ {
1808
+ "name": "amount";
1809
+ "type": "u64";
1810
+ },
1811
+ {
1812
+ "name": "totalLocked";
1813
+ "type": "u64";
1814
+ },
1815
+ {
1816
+ "name": "epoch";
1817
+ "type": "u64";
1818
+ }
1819
+ ];
1820
+ };
1821
+ },
1822
+ {
1823
+ "name": "fundsUnlocked";
1824
+ "type": {
1825
+ "kind": "struct";
1826
+ "fields": [
1827
+ {
1828
+ "name": "validator";
1829
+ "type": "pubkey";
1830
+ },
1831
+ {
1832
+ "name": "amount";
1833
+ "type": "u64";
1834
+ },
1835
+ {
1836
+ "name": "pendingUnlock";
1837
+ "type": "u64";
1838
+ },
1839
+ {
1840
+ "name": "epoch";
1841
+ "type": "u64";
1842
+ }
1843
+ ];
1844
+ };
1845
+ },
1679
1846
  {
1680
1847
  "name": "globalConfigureData";
1681
1848
  "type": {
@@ -1772,21 +1939,21 @@ type Jbond = {
1772
1939
  {
1773
1940
  "name": "locked";
1774
1941
  "docs": [
1775
- "Amount of collateral currently locked"
1942
+ "Amount of collateral currently locked (unavailable for withdrawal)"
1776
1943
  ];
1777
1944
  "type": "u64";
1778
1945
  },
1779
1946
  {
1780
- "name": "nextEpochLocked";
1947
+ "name": "pendingUnlock";
1781
1948
  "docs": [
1782
- "Amount of collateral locked for the next epoch"
1949
+ "Pending unlock amount (will reduce `locked` next epoch)"
1783
1950
  ];
1784
1951
  "type": "u64";
1785
1952
  },
1786
1953
  {
1787
- "name": "lastUpdateEpoch";
1954
+ "name": "pendingUnlockEpoch";
1788
1955
  "docs": [
1789
- "The last epoch when the bond was updated"
1956
+ "Epoch when pending_unlock was queued"
1790
1957
  ];
1791
1958
  "type": "u64";
1792
1959
  }
@@ -1799,7 +1966,7 @@ type Jbond = {
1799
1966
  "kind": "struct";
1800
1967
  "fields": [
1801
1968
  {
1802
- "name": "identity";
1969
+ "name": "validator";
1803
1970
  "type": "pubkey";
1804
1971
  },
1805
1972
  {
@@ -1812,6 +1979,30 @@ type Jbond = {
1812
1979
  }
1813
1980
  ];
1814
1981
  };
1982
+ },
1983
+ {
1984
+ "name": "withdrawAuthorityChanged";
1985
+ "type": {
1986
+ "kind": "struct";
1987
+ "fields": [
1988
+ {
1989
+ "name": "validator";
1990
+ "type": "pubkey";
1991
+ },
1992
+ {
1993
+ "name": "oldAuthority";
1994
+ "type": {
1995
+ "option": "pubkey";
1996
+ };
1997
+ },
1998
+ {
1999
+ "name": "newAuthority";
2000
+ "type": {
2001
+ "option": "pubkey";
2002
+ };
2003
+ }
2004
+ ];
2005
+ };
1815
2006
  }
1816
2007
  ];
1817
2008
  "constants": [
@@ -2170,24 +2361,6 @@ declare class JBondClient {
2170
2361
  getBondSessionStartIx(props: BondStartProps): Promise<TransactionInstruction>;
2171
2362
  lockFunds(props: BondLockFunds): Promise<string | undefined>;
2172
2363
  releaseFunds(props: BondReleaseFunds): Promise<string | undefined>;
2173
- /**
2174
- * Update epoch locks
2175
- */
2176
- updateEpochLocks(props: {
2177
- bondType: BondType;
2178
- bondName: string;
2179
- voteAccount: PublicKeyInitData;
2180
- payer: PublicKey;
2181
- }): Promise<string | undefined>;
2182
- /**
2183
- * Build update epoch locks instruction
2184
- */
2185
- getUpdateEpochLocksIx(props: {
2186
- bondType: BondType;
2187
- bondName: string;
2188
- voteAccount: PublicKeyInitData;
2189
- payer: PublicKey;
2190
- }): Promise<TransactionInstruction>;
2191
2364
  /**
2192
2365
  * Build bond remove instruction
2193
2366
  */
@@ -2345,8 +2518,8 @@ declare class JBondClient {
2345
2518
  createdAt: bn_js;
2346
2519
  bump: number;
2347
2520
  locked: bn_js;
2348
- nextEpochLocked: bn_js;
2349
- lastUpdateEpoch: bn_js;
2521
+ pendingUnlock: bn_js;
2522
+ pendingUnlockEpoch: bn_js;
2350
2523
  publicKey: PublicKey;
2351
2524
  }>;
2352
2525
  /**
@@ -2389,6 +2562,6 @@ declare const CROWDFUNDING_BOND_SEED = "crowdfunding";
2389
2562
  /**
2390
2563
  * Program IDs for different environments
2391
2564
  */
2392
- declare const ENV_PROGRAM_ID: Record<string, PublicKey>;
2565
+ declare const ENV_PROGRAM_ID: Record<JBondClientEnv, string>;
2393
2566
 
2394
2567
  export { BOND_STATE_SEED, type BondConfigureProps, type BondFinishProps, type BondInitializeProps, type BondLockFunds, type BondReleaseFunds, type BondRemoveProps, type BondStartProps, type BondState, type BondStateStats, type BondStateStatus, BondTransactionType, BondType, CROWDFUNDING_BOND_SEED, type ClaimAllProps, type ClaimProps, type CollateralType, ENV_PROGRAM_ID, type EpochHistoryItem, GLOBAL_STATE_SEED, type GetHistoryGroupedProps, type GetHistoryProps, type GlobalConfigureProps, type GlobalInitializeProps, type GlobalState, JBondClient, JBondClientEnv, type JBondClientOptions, type Jbond, NodeWallet, type RegisterValidatorProps, STANDARD_BOND_SEED, SessionStatus, type SetWithdrawAuthorityProps, type TopUpCollateralProps, type TransactionHistoryItem, VALIDATOR_BOND_SEED, type ValidatorBond, type WithdrawCollateralProps };