@jpool/bond-sdk 0.11.0-next.4 → 0.11.0-next.7
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 +167 -1
- package/dist/index.d.ts +167 -1
- package/dist/index.js +184 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +184 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -260,6 +260,50 @@ type Jbond = {
|
|
|
260
260
|
}
|
|
261
261
|
];
|
|
262
262
|
},
|
|
263
|
+
{
|
|
264
|
+
"name": "bondLockFunds";
|
|
265
|
+
"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 the current and next epoch.",
|
|
268
|
+
"# Errors",
|
|
269
|
+
"Fails if the validator is not active, or if there are insufficient available funds."
|
|
270
|
+
];
|
|
271
|
+
"discriminator": [
|
|
272
|
+
117,
|
|
273
|
+
166,
|
|
274
|
+
195,
|
|
275
|
+
99,
|
|
276
|
+
103,
|
|
277
|
+
45,
|
|
278
|
+
195,
|
|
279
|
+
2
|
|
280
|
+
];
|
|
281
|
+
"accounts": [
|
|
282
|
+
{
|
|
283
|
+
"name": "bondState";
|
|
284
|
+
"writable": true;
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
"name": "validatorBond";
|
|
288
|
+
"writable": true;
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
"name": "bondTokenAccount";
|
|
292
|
+
"optional": true;
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
"name": "payer";
|
|
296
|
+
"writable": true;
|
|
297
|
+
"signer": true;
|
|
298
|
+
}
|
|
299
|
+
];
|
|
300
|
+
"args": [
|
|
301
|
+
{
|
|
302
|
+
"name": "amount";
|
|
303
|
+
"type": "u64";
|
|
304
|
+
}
|
|
305
|
+
];
|
|
306
|
+
},
|
|
263
307
|
{
|
|
264
308
|
"name": "bondRegister";
|
|
265
309
|
"docs": [
|
|
@@ -372,6 +416,42 @@ type Jbond = {
|
|
|
372
416
|
}
|
|
373
417
|
];
|
|
374
418
|
},
|
|
419
|
+
{
|
|
420
|
+
"name": "bondReleaseFunds";
|
|
421
|
+
"docs": [
|
|
422
|
+
"Releases locked funds after an epoch ends.",
|
|
423
|
+
"Moves collateral from locked back to available state, allowing withdrawals.",
|
|
424
|
+
"# Errors",
|
|
425
|
+
"Fails if the validator is not active, or if there are insufficient locked funds."
|
|
426
|
+
];
|
|
427
|
+
"discriminator": [
|
|
428
|
+
184,
|
|
429
|
+
224,
|
|
430
|
+
14,
|
|
431
|
+
24,
|
|
432
|
+
76,
|
|
433
|
+
14,
|
|
434
|
+
226,
|
|
435
|
+
190
|
|
436
|
+
];
|
|
437
|
+
"accounts": [
|
|
438
|
+
{
|
|
439
|
+
"name": "validatorBond";
|
|
440
|
+
"writable": true;
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
"name": "payer";
|
|
444
|
+
"writable": true;
|
|
445
|
+
"signer": true;
|
|
446
|
+
}
|
|
447
|
+
];
|
|
448
|
+
"args": [
|
|
449
|
+
{
|
|
450
|
+
"name": "amount";
|
|
451
|
+
"type": "u64";
|
|
452
|
+
}
|
|
453
|
+
];
|
|
454
|
+
},
|
|
375
455
|
{
|
|
376
456
|
"name": "bondSetWithdrawAuthority";
|
|
377
457
|
"docs": [
|
|
@@ -551,6 +631,42 @@ type Jbond = {
|
|
|
551
631
|
}
|
|
552
632
|
];
|
|
553
633
|
},
|
|
634
|
+
{
|
|
635
|
+
"name": "bondUpdate";
|
|
636
|
+
"docs": [
|
|
637
|
+
"Transitions locked funds between epochs for a validator bond.",
|
|
638
|
+
"",
|
|
639
|
+
"This function should be called at epoch boundaries to update the bond's",
|
|
640
|
+
"`last_update_epoch` and move the `next_epoch_locked` amount into",
|
|
641
|
+
"`current_epoch_locked`. It ensures that the update only occurs once per epoch.",
|
|
642
|
+
"",
|
|
643
|
+
"# Errors",
|
|
644
|
+
"Returns [`BondError::InvalidEpoch`] if called more than once in the same epoch,",
|
|
645
|
+
"or if the system clock cannot be accessed."
|
|
646
|
+
];
|
|
647
|
+
"discriminator": [
|
|
648
|
+
237,
|
|
649
|
+
102,
|
|
650
|
+
183,
|
|
651
|
+
192,
|
|
652
|
+
94,
|
|
653
|
+
83,
|
|
654
|
+
52,
|
|
655
|
+
82
|
|
656
|
+
];
|
|
657
|
+
"accounts": [
|
|
658
|
+
{
|
|
659
|
+
"name": "validatorBond";
|
|
660
|
+
"writable": true;
|
|
661
|
+
},
|
|
662
|
+
{
|
|
663
|
+
"name": "payer";
|
|
664
|
+
"writable": true;
|
|
665
|
+
"signer": true;
|
|
666
|
+
}
|
|
667
|
+
];
|
|
668
|
+
"args": [];
|
|
669
|
+
},
|
|
554
670
|
{
|
|
555
671
|
"name": "bondWithdraw";
|
|
556
672
|
"docs": [
|
|
@@ -1151,6 +1267,11 @@ type Jbond = {
|
|
|
1151
1267
|
"code": 6023;
|
|
1152
1268
|
"name": "bondNotEnabled";
|
|
1153
1269
|
"msg": "Bond is not enabled";
|
|
1270
|
+
},
|
|
1271
|
+
{
|
|
1272
|
+
"code": 6024;
|
|
1273
|
+
"name": "invalidEpoch";
|
|
1274
|
+
"msg": "Invalid epoch for this operation";
|
|
1154
1275
|
}
|
|
1155
1276
|
];
|
|
1156
1277
|
"types": [
|
|
@@ -1582,6 +1703,27 @@ type Jbond = {
|
|
|
1582
1703
|
"Bump for the PDA"
|
|
1583
1704
|
];
|
|
1584
1705
|
"type": "u8";
|
|
1706
|
+
},
|
|
1707
|
+
{
|
|
1708
|
+
"name": "nextEpochLocked";
|
|
1709
|
+
"docs": [
|
|
1710
|
+
"Amount of collateral locked for the next epoch"
|
|
1711
|
+
];
|
|
1712
|
+
"type": "u64";
|
|
1713
|
+
},
|
|
1714
|
+
{
|
|
1715
|
+
"name": "currentEpochLocked";
|
|
1716
|
+
"docs": [
|
|
1717
|
+
"Amount of collateral locked for the current epoch"
|
|
1718
|
+
];
|
|
1719
|
+
"type": "u64";
|
|
1720
|
+
},
|
|
1721
|
+
{
|
|
1722
|
+
"name": "lastUpdateEpoch";
|
|
1723
|
+
"docs": [
|
|
1724
|
+
"The last epoch when the bond was updated"
|
|
1725
|
+
];
|
|
1726
|
+
"type": "u64";
|
|
1585
1727
|
}
|
|
1586
1728
|
];
|
|
1587
1729
|
};
|
|
@@ -1686,6 +1828,19 @@ type ClaimProps = {
|
|
|
1686
1828
|
reserve?: PublicKey;
|
|
1687
1829
|
authority?: PublicKey;
|
|
1688
1830
|
};
|
|
1831
|
+
type BondLockFunds = {
|
|
1832
|
+
bondType: BondType;
|
|
1833
|
+
name: string;
|
|
1834
|
+
amount: number;
|
|
1835
|
+
voteAccount: PublicKey;
|
|
1836
|
+
collateralType?: CollateralType;
|
|
1837
|
+
};
|
|
1838
|
+
type BondReleaseFunds = {
|
|
1839
|
+
bondType: BondType;
|
|
1840
|
+
name: string;
|
|
1841
|
+
amount: number;
|
|
1842
|
+
voteAccount: PublicKey;
|
|
1843
|
+
};
|
|
1689
1844
|
type ClaimAllProps = {
|
|
1690
1845
|
bondType: BondType;
|
|
1691
1846
|
name: string;
|
|
@@ -1936,6 +2091,14 @@ declare class JBondClient {
|
|
|
1936
2091
|
* Build start crowdfunding session instruction
|
|
1937
2092
|
*/
|
|
1938
2093
|
getBondSessionStartIx(props: BondStartProps): Promise<TransactionInstruction>;
|
|
2094
|
+
/**
|
|
2095
|
+
* Build lock funds instruction
|
|
2096
|
+
*/
|
|
2097
|
+
getLockFundsIx(props: BondLockFunds): Promise<TransactionInstruction>;
|
|
2098
|
+
/**
|
|
2099
|
+
* Build release funds instruction
|
|
2100
|
+
*/
|
|
2101
|
+
getReleaseFundsIx(props: BondReleaseFunds): Promise<TransactionInstruction>;
|
|
1939
2102
|
/**
|
|
1940
2103
|
* Get all bond states with total collected collateral
|
|
1941
2104
|
*/
|
|
@@ -2063,6 +2226,9 @@ declare class JBondClient {
|
|
|
2063
2226
|
withdrawalAuthority: PublicKey | null;
|
|
2064
2227
|
createdAt: bn_js;
|
|
2065
2228
|
bump: number;
|
|
2229
|
+
nextEpochLocked: bn_js;
|
|
2230
|
+
currentEpochLocked: bn_js;
|
|
2231
|
+
lastUpdateEpoch: bn_js;
|
|
2066
2232
|
publicKey: PublicKey;
|
|
2067
2233
|
}>;
|
|
2068
2234
|
/**
|
|
@@ -2107,4 +2273,4 @@ declare const CROWDFUNDING_BOND_SEED = "crowdfunding";
|
|
|
2107
2273
|
*/
|
|
2108
2274
|
declare const ENV_PROGRAM_ID: Record<string, PublicKey>;
|
|
2109
2275
|
|
|
2110
|
-
export { BOND_STATE_SEED, type BondConfigureProps, type BondFinishProps, type BondInitializeProps, 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 };
|
|
2276
|
+
export { BOND_STATE_SEED, type BondConfigureProps, type BondFinishProps, type BondInitializeProps, type BondLockFunds, type BondReleaseFunds, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -260,6 +260,50 @@ type Jbond = {
|
|
|
260
260
|
}
|
|
261
261
|
];
|
|
262
262
|
},
|
|
263
|
+
{
|
|
264
|
+
"name": "bondLockFunds";
|
|
265
|
+
"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 the current and next epoch.",
|
|
268
|
+
"# Errors",
|
|
269
|
+
"Fails if the validator is not active, or if there are insufficient available funds."
|
|
270
|
+
];
|
|
271
|
+
"discriminator": [
|
|
272
|
+
117,
|
|
273
|
+
166,
|
|
274
|
+
195,
|
|
275
|
+
99,
|
|
276
|
+
103,
|
|
277
|
+
45,
|
|
278
|
+
195,
|
|
279
|
+
2
|
|
280
|
+
];
|
|
281
|
+
"accounts": [
|
|
282
|
+
{
|
|
283
|
+
"name": "bondState";
|
|
284
|
+
"writable": true;
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
"name": "validatorBond";
|
|
288
|
+
"writable": true;
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
"name": "bondTokenAccount";
|
|
292
|
+
"optional": true;
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
"name": "payer";
|
|
296
|
+
"writable": true;
|
|
297
|
+
"signer": true;
|
|
298
|
+
}
|
|
299
|
+
];
|
|
300
|
+
"args": [
|
|
301
|
+
{
|
|
302
|
+
"name": "amount";
|
|
303
|
+
"type": "u64";
|
|
304
|
+
}
|
|
305
|
+
];
|
|
306
|
+
},
|
|
263
307
|
{
|
|
264
308
|
"name": "bondRegister";
|
|
265
309
|
"docs": [
|
|
@@ -372,6 +416,42 @@ type Jbond = {
|
|
|
372
416
|
}
|
|
373
417
|
];
|
|
374
418
|
},
|
|
419
|
+
{
|
|
420
|
+
"name": "bondReleaseFunds";
|
|
421
|
+
"docs": [
|
|
422
|
+
"Releases locked funds after an epoch ends.",
|
|
423
|
+
"Moves collateral from locked back to available state, allowing withdrawals.",
|
|
424
|
+
"# Errors",
|
|
425
|
+
"Fails if the validator is not active, or if there are insufficient locked funds."
|
|
426
|
+
];
|
|
427
|
+
"discriminator": [
|
|
428
|
+
184,
|
|
429
|
+
224,
|
|
430
|
+
14,
|
|
431
|
+
24,
|
|
432
|
+
76,
|
|
433
|
+
14,
|
|
434
|
+
226,
|
|
435
|
+
190
|
|
436
|
+
];
|
|
437
|
+
"accounts": [
|
|
438
|
+
{
|
|
439
|
+
"name": "validatorBond";
|
|
440
|
+
"writable": true;
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
"name": "payer";
|
|
444
|
+
"writable": true;
|
|
445
|
+
"signer": true;
|
|
446
|
+
}
|
|
447
|
+
];
|
|
448
|
+
"args": [
|
|
449
|
+
{
|
|
450
|
+
"name": "amount";
|
|
451
|
+
"type": "u64";
|
|
452
|
+
}
|
|
453
|
+
];
|
|
454
|
+
},
|
|
375
455
|
{
|
|
376
456
|
"name": "bondSetWithdrawAuthority";
|
|
377
457
|
"docs": [
|
|
@@ -551,6 +631,42 @@ type Jbond = {
|
|
|
551
631
|
}
|
|
552
632
|
];
|
|
553
633
|
},
|
|
634
|
+
{
|
|
635
|
+
"name": "bondUpdate";
|
|
636
|
+
"docs": [
|
|
637
|
+
"Transitions locked funds between epochs for a validator bond.",
|
|
638
|
+
"",
|
|
639
|
+
"This function should be called at epoch boundaries to update the bond's",
|
|
640
|
+
"`last_update_epoch` and move the `next_epoch_locked` amount into",
|
|
641
|
+
"`current_epoch_locked`. It ensures that the update only occurs once per epoch.",
|
|
642
|
+
"",
|
|
643
|
+
"# Errors",
|
|
644
|
+
"Returns [`BondError::InvalidEpoch`] if called more than once in the same epoch,",
|
|
645
|
+
"or if the system clock cannot be accessed."
|
|
646
|
+
];
|
|
647
|
+
"discriminator": [
|
|
648
|
+
237,
|
|
649
|
+
102,
|
|
650
|
+
183,
|
|
651
|
+
192,
|
|
652
|
+
94,
|
|
653
|
+
83,
|
|
654
|
+
52,
|
|
655
|
+
82
|
|
656
|
+
];
|
|
657
|
+
"accounts": [
|
|
658
|
+
{
|
|
659
|
+
"name": "validatorBond";
|
|
660
|
+
"writable": true;
|
|
661
|
+
},
|
|
662
|
+
{
|
|
663
|
+
"name": "payer";
|
|
664
|
+
"writable": true;
|
|
665
|
+
"signer": true;
|
|
666
|
+
}
|
|
667
|
+
];
|
|
668
|
+
"args": [];
|
|
669
|
+
},
|
|
554
670
|
{
|
|
555
671
|
"name": "bondWithdraw";
|
|
556
672
|
"docs": [
|
|
@@ -1151,6 +1267,11 @@ type Jbond = {
|
|
|
1151
1267
|
"code": 6023;
|
|
1152
1268
|
"name": "bondNotEnabled";
|
|
1153
1269
|
"msg": "Bond is not enabled";
|
|
1270
|
+
},
|
|
1271
|
+
{
|
|
1272
|
+
"code": 6024;
|
|
1273
|
+
"name": "invalidEpoch";
|
|
1274
|
+
"msg": "Invalid epoch for this operation";
|
|
1154
1275
|
}
|
|
1155
1276
|
];
|
|
1156
1277
|
"types": [
|
|
@@ -1582,6 +1703,27 @@ type Jbond = {
|
|
|
1582
1703
|
"Bump for the PDA"
|
|
1583
1704
|
];
|
|
1584
1705
|
"type": "u8";
|
|
1706
|
+
},
|
|
1707
|
+
{
|
|
1708
|
+
"name": "nextEpochLocked";
|
|
1709
|
+
"docs": [
|
|
1710
|
+
"Amount of collateral locked for the next epoch"
|
|
1711
|
+
];
|
|
1712
|
+
"type": "u64";
|
|
1713
|
+
},
|
|
1714
|
+
{
|
|
1715
|
+
"name": "currentEpochLocked";
|
|
1716
|
+
"docs": [
|
|
1717
|
+
"Amount of collateral locked for the current epoch"
|
|
1718
|
+
];
|
|
1719
|
+
"type": "u64";
|
|
1720
|
+
},
|
|
1721
|
+
{
|
|
1722
|
+
"name": "lastUpdateEpoch";
|
|
1723
|
+
"docs": [
|
|
1724
|
+
"The last epoch when the bond was updated"
|
|
1725
|
+
];
|
|
1726
|
+
"type": "u64";
|
|
1585
1727
|
}
|
|
1586
1728
|
];
|
|
1587
1729
|
};
|
|
@@ -1686,6 +1828,19 @@ type ClaimProps = {
|
|
|
1686
1828
|
reserve?: PublicKey;
|
|
1687
1829
|
authority?: PublicKey;
|
|
1688
1830
|
};
|
|
1831
|
+
type BondLockFunds = {
|
|
1832
|
+
bondType: BondType;
|
|
1833
|
+
name: string;
|
|
1834
|
+
amount: number;
|
|
1835
|
+
voteAccount: PublicKey;
|
|
1836
|
+
collateralType?: CollateralType;
|
|
1837
|
+
};
|
|
1838
|
+
type BondReleaseFunds = {
|
|
1839
|
+
bondType: BondType;
|
|
1840
|
+
name: string;
|
|
1841
|
+
amount: number;
|
|
1842
|
+
voteAccount: PublicKey;
|
|
1843
|
+
};
|
|
1689
1844
|
type ClaimAllProps = {
|
|
1690
1845
|
bondType: BondType;
|
|
1691
1846
|
name: string;
|
|
@@ -1936,6 +2091,14 @@ declare class JBondClient {
|
|
|
1936
2091
|
* Build start crowdfunding session instruction
|
|
1937
2092
|
*/
|
|
1938
2093
|
getBondSessionStartIx(props: BondStartProps): Promise<TransactionInstruction>;
|
|
2094
|
+
/**
|
|
2095
|
+
* Build lock funds instruction
|
|
2096
|
+
*/
|
|
2097
|
+
getLockFundsIx(props: BondLockFunds): Promise<TransactionInstruction>;
|
|
2098
|
+
/**
|
|
2099
|
+
* Build release funds instruction
|
|
2100
|
+
*/
|
|
2101
|
+
getReleaseFundsIx(props: BondReleaseFunds): Promise<TransactionInstruction>;
|
|
1939
2102
|
/**
|
|
1940
2103
|
* Get all bond states with total collected collateral
|
|
1941
2104
|
*/
|
|
@@ -2063,6 +2226,9 @@ declare class JBondClient {
|
|
|
2063
2226
|
withdrawalAuthority: PublicKey | null;
|
|
2064
2227
|
createdAt: bn_js;
|
|
2065
2228
|
bump: number;
|
|
2229
|
+
nextEpochLocked: bn_js;
|
|
2230
|
+
currentEpochLocked: bn_js;
|
|
2231
|
+
lastUpdateEpoch: bn_js;
|
|
2066
2232
|
publicKey: PublicKey;
|
|
2067
2233
|
}>;
|
|
2068
2234
|
/**
|
|
@@ -2107,4 +2273,4 @@ declare const CROWDFUNDING_BOND_SEED = "crowdfunding";
|
|
|
2107
2273
|
*/
|
|
2108
2274
|
declare const ENV_PROGRAM_ID: Record<string, PublicKey>;
|
|
2109
2275
|
|
|
2110
|
-
export { BOND_STATE_SEED, type BondConfigureProps, type BondFinishProps, type BondInitializeProps, 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 };
|
|
2276
|
+
export { BOND_STATE_SEED, type BondConfigureProps, type BondFinishProps, type BondInitializeProps, type BondLockFunds, type BondReleaseFunds, 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 };
|
package/dist/index.js
CHANGED
|
@@ -5008,6 +5008,50 @@ var jbond_default = {
|
|
|
5008
5008
|
}
|
|
5009
5009
|
]
|
|
5010
5010
|
},
|
|
5011
|
+
{
|
|
5012
|
+
name: "bond_lock_funds",
|
|
5013
|
+
docs: [
|
|
5014
|
+
"Locks funds for both the current and upcoming epoch.",
|
|
5015
|
+
"Moves collateral from available to locked state, making it unavailable for withdrawal for the current and next epoch.",
|
|
5016
|
+
"# Errors",
|
|
5017
|
+
"Fails if the validator is not active, or if there are insufficient available funds."
|
|
5018
|
+
],
|
|
5019
|
+
discriminator: [
|
|
5020
|
+
117,
|
|
5021
|
+
166,
|
|
5022
|
+
195,
|
|
5023
|
+
99,
|
|
5024
|
+
103,
|
|
5025
|
+
45,
|
|
5026
|
+
195,
|
|
5027
|
+
2
|
|
5028
|
+
],
|
|
5029
|
+
accounts: [
|
|
5030
|
+
{
|
|
5031
|
+
name: "bond_state",
|
|
5032
|
+
writable: true
|
|
5033
|
+
},
|
|
5034
|
+
{
|
|
5035
|
+
name: "validator_bond",
|
|
5036
|
+
writable: true
|
|
5037
|
+
},
|
|
5038
|
+
{
|
|
5039
|
+
name: "bond_token_account",
|
|
5040
|
+
optional: true
|
|
5041
|
+
},
|
|
5042
|
+
{
|
|
5043
|
+
name: "payer",
|
|
5044
|
+
writable: true,
|
|
5045
|
+
signer: true
|
|
5046
|
+
}
|
|
5047
|
+
],
|
|
5048
|
+
args: [
|
|
5049
|
+
{
|
|
5050
|
+
name: "amount",
|
|
5051
|
+
type: "u64"
|
|
5052
|
+
}
|
|
5053
|
+
]
|
|
5054
|
+
},
|
|
5011
5055
|
{
|
|
5012
5056
|
name: "bond_register",
|
|
5013
5057
|
docs: [
|
|
@@ -5120,6 +5164,42 @@ var jbond_default = {
|
|
|
5120
5164
|
}
|
|
5121
5165
|
]
|
|
5122
5166
|
},
|
|
5167
|
+
{
|
|
5168
|
+
name: "bond_release_funds",
|
|
5169
|
+
docs: [
|
|
5170
|
+
"Releases locked funds after an epoch ends.",
|
|
5171
|
+
"Moves collateral from locked back to available state, allowing withdrawals.",
|
|
5172
|
+
"# Errors",
|
|
5173
|
+
"Fails if the validator is not active, or if there are insufficient locked funds."
|
|
5174
|
+
],
|
|
5175
|
+
discriminator: [
|
|
5176
|
+
184,
|
|
5177
|
+
224,
|
|
5178
|
+
14,
|
|
5179
|
+
24,
|
|
5180
|
+
76,
|
|
5181
|
+
14,
|
|
5182
|
+
226,
|
|
5183
|
+
190
|
|
5184
|
+
],
|
|
5185
|
+
accounts: [
|
|
5186
|
+
{
|
|
5187
|
+
name: "validator_bond",
|
|
5188
|
+
writable: true
|
|
5189
|
+
},
|
|
5190
|
+
{
|
|
5191
|
+
name: "payer",
|
|
5192
|
+
writable: true,
|
|
5193
|
+
signer: true
|
|
5194
|
+
}
|
|
5195
|
+
],
|
|
5196
|
+
args: [
|
|
5197
|
+
{
|
|
5198
|
+
name: "amount",
|
|
5199
|
+
type: "u64"
|
|
5200
|
+
}
|
|
5201
|
+
]
|
|
5202
|
+
},
|
|
5123
5203
|
{
|
|
5124
5204
|
name: "bond_set_withdraw_authority",
|
|
5125
5205
|
docs: [
|
|
@@ -5299,6 +5379,42 @@ var jbond_default = {
|
|
|
5299
5379
|
}
|
|
5300
5380
|
]
|
|
5301
5381
|
},
|
|
5382
|
+
{
|
|
5383
|
+
name: "bond_update",
|
|
5384
|
+
docs: [
|
|
5385
|
+
"Transitions locked funds between epochs for a validator bond.",
|
|
5386
|
+
"",
|
|
5387
|
+
"This function should be called at epoch boundaries to update the bond's",
|
|
5388
|
+
"`last_update_epoch` and move the `next_epoch_locked` amount into",
|
|
5389
|
+
"`current_epoch_locked`. It ensures that the update only occurs once per epoch.",
|
|
5390
|
+
"",
|
|
5391
|
+
"# Errors",
|
|
5392
|
+
"Returns [`BondError::InvalidEpoch`] if called more than once in the same epoch,",
|
|
5393
|
+
"or if the system clock cannot be accessed."
|
|
5394
|
+
],
|
|
5395
|
+
discriminator: [
|
|
5396
|
+
237,
|
|
5397
|
+
102,
|
|
5398
|
+
183,
|
|
5399
|
+
192,
|
|
5400
|
+
94,
|
|
5401
|
+
83,
|
|
5402
|
+
52,
|
|
5403
|
+
82
|
|
5404
|
+
],
|
|
5405
|
+
accounts: [
|
|
5406
|
+
{
|
|
5407
|
+
name: "validator_bond",
|
|
5408
|
+
writable: true
|
|
5409
|
+
},
|
|
5410
|
+
{
|
|
5411
|
+
name: "payer",
|
|
5412
|
+
writable: true,
|
|
5413
|
+
signer: true
|
|
5414
|
+
}
|
|
5415
|
+
],
|
|
5416
|
+
args: []
|
|
5417
|
+
},
|
|
5302
5418
|
{
|
|
5303
5419
|
name: "bond_withdraw",
|
|
5304
5420
|
docs: [
|
|
@@ -5899,6 +6015,11 @@ var jbond_default = {
|
|
|
5899
6015
|
code: 6023,
|
|
5900
6016
|
name: "BondNotEnabled",
|
|
5901
6017
|
msg: "Bond is not enabled"
|
|
6018
|
+
},
|
|
6019
|
+
{
|
|
6020
|
+
code: 6024,
|
|
6021
|
+
name: "InvalidEpoch",
|
|
6022
|
+
msg: "Invalid epoch for this operation"
|
|
5902
6023
|
}
|
|
5903
6024
|
],
|
|
5904
6025
|
types: [
|
|
@@ -6330,6 +6451,27 @@ var jbond_default = {
|
|
|
6330
6451
|
"Bump for the PDA"
|
|
6331
6452
|
],
|
|
6332
6453
|
type: "u8"
|
|
6454
|
+
},
|
|
6455
|
+
{
|
|
6456
|
+
name: "next_epoch_locked",
|
|
6457
|
+
docs: [
|
|
6458
|
+
"Amount of collateral locked for the next epoch"
|
|
6459
|
+
],
|
|
6460
|
+
type: "u64"
|
|
6461
|
+
},
|
|
6462
|
+
{
|
|
6463
|
+
name: "current_epoch_locked",
|
|
6464
|
+
docs: [
|
|
6465
|
+
"Amount of collateral locked for the current epoch"
|
|
6466
|
+
],
|
|
6467
|
+
type: "u64"
|
|
6468
|
+
},
|
|
6469
|
+
{
|
|
6470
|
+
name: "last_update_epoch",
|
|
6471
|
+
docs: [
|
|
6472
|
+
"The last epoch when the bond was updated"
|
|
6473
|
+
],
|
|
6474
|
+
type: "u64"
|
|
6333
6475
|
}
|
|
6334
6476
|
]
|
|
6335
6477
|
}
|
|
@@ -6937,6 +7079,48 @@ var JBondClient = class _JBondClient {
|
|
|
6937
7079
|
const authority = this.provider.wallet?.publicKey;
|
|
6938
7080
|
return this.program.methods.sessionStart(new import_bn.BN(props.duration)).accountsPartial({ bondState, authority }).instruction();
|
|
6939
7081
|
}
|
|
7082
|
+
/**
|
|
7083
|
+
* Build lock funds instruction
|
|
7084
|
+
*/
|
|
7085
|
+
async getLockFundsIx(props) {
|
|
7086
|
+
const { bondType, name, voteAccount, amount } = props;
|
|
7087
|
+
const [bondState] = this.pda.bondState(bondType, name);
|
|
7088
|
+
let collateralType = props.collateralType;
|
|
7089
|
+
if (!collateralType) {
|
|
7090
|
+
const bondState2 = await this.getBondState(bondType, name);
|
|
7091
|
+
collateralType = bondState2.collateralType;
|
|
7092
|
+
}
|
|
7093
|
+
const [validatorBond] = this.pda.validatorBond(bondType, name, voteAccount);
|
|
7094
|
+
const authority = this.provider.wallet?.publicKey;
|
|
7095
|
+
const accounts = {
|
|
7096
|
+
bondState,
|
|
7097
|
+
validatorBond,
|
|
7098
|
+
payer: authority,
|
|
7099
|
+
bondTokenAccount: null
|
|
7100
|
+
};
|
|
7101
|
+
matchVariant(collateralType, {
|
|
7102
|
+
native: () => {
|
|
7103
|
+
},
|
|
7104
|
+
token: (mint) => {
|
|
7105
|
+
const bondTokenAccount = splToken.getAssociatedTokenAddressSync(mint, validatorBond, true);
|
|
7106
|
+
accounts.bondTokenAccount = bondTokenAccount;
|
|
7107
|
+
}
|
|
7108
|
+
});
|
|
7109
|
+
return this.program.methods.bondLockFunds(solToLamports(amount)).accountsPartial(accounts).instruction();
|
|
7110
|
+
}
|
|
7111
|
+
/**
|
|
7112
|
+
* Build release funds instruction
|
|
7113
|
+
*/
|
|
7114
|
+
async getReleaseFundsIx(props) {
|
|
7115
|
+
const { bondType, name, voteAccount, amount } = props;
|
|
7116
|
+
const [validatorBond] = this.pda.validatorBond(bondType, name, voteAccount);
|
|
7117
|
+
const authority = this.provider.wallet?.publicKey;
|
|
7118
|
+
const accounts = {
|
|
7119
|
+
validatorBond,
|
|
7120
|
+
payer: authority
|
|
7121
|
+
};
|
|
7122
|
+
return this.program.methods.bondReleaseFunds(solToLamports(amount)).accountsPartial(accounts).instruction();
|
|
7123
|
+
}
|
|
6940
7124
|
/**
|
|
6941
7125
|
* Get all bond states with total collected collateral
|
|
6942
7126
|
*/
|