@jpool/bond-sdk 0.11.0-next.6 → 0.11.0-next.8
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 +17 -2
- package/dist/index.d.ts +17 -2
- package/dist/index.js +25 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4987,8 +4987,8 @@ var jbond_default = {
|
|
|
4987
4987
|
{
|
|
4988
4988
|
name: "bond_lock_funds",
|
|
4989
4989
|
docs: [
|
|
4990
|
-
"Locks funds for the upcoming epoch.",
|
|
4991
|
-
"Moves collateral from available to locked state
|
|
4990
|
+
"Locks funds for both the current and upcoming epoch.",
|
|
4991
|
+
"Moves collateral from available to locked state, making it unavailable for withdrawal for the current and next epoch.",
|
|
4992
4992
|
"# Errors",
|
|
4993
4993
|
"Fails if the validator is not active, or if there are insufficient available funds."
|
|
4994
4994
|
],
|
|
@@ -5357,6 +5357,17 @@ var jbond_default = {
|
|
|
5357
5357
|
},
|
|
5358
5358
|
{
|
|
5359
5359
|
name: "bond_update",
|
|
5360
|
+
docs: [
|
|
5361
|
+
"Transitions locked funds between epochs for a validator bond.",
|
|
5362
|
+
"",
|
|
5363
|
+
"This function should be called at epoch boundaries to update the bond's",
|
|
5364
|
+
"`last_update_epoch` and move the `next_epoch_locked` amount into",
|
|
5365
|
+
"`current_epoch_locked`. It ensures that the update only occurs once per epoch.",
|
|
5366
|
+
"",
|
|
5367
|
+
"# Errors",
|
|
5368
|
+
"Returns [`BondError::InvalidEpoch`] if called more than once in the same epoch,",
|
|
5369
|
+
"or if the system clock cannot be accessed."
|
|
5370
|
+
],
|
|
5360
5371
|
discriminator: [
|
|
5361
5372
|
237,
|
|
5362
5373
|
102,
|
|
@@ -7036,11 +7047,19 @@ var JBondClient = class _JBondClient {
|
|
|
7036
7047
|
const authority = this.provider.wallet?.publicKey;
|
|
7037
7048
|
return this.program.methods.sessionStart(new import_bn.BN(props.duration)).accountsPartial({ bondState, authority }).instruction();
|
|
7038
7049
|
}
|
|
7050
|
+
async lockFunds(props) {
|
|
7051
|
+
const ix = await this.getLockFundsIx(props);
|
|
7052
|
+
return this.provider.sendAndConfirm?.(new Transaction().add(ix));
|
|
7053
|
+
}
|
|
7054
|
+
async releaseFunds(props) {
|
|
7055
|
+
const ix = await this.getReleaseFundsIx(props);
|
|
7056
|
+
return this.provider.sendAndConfirm?.(new Transaction().add(ix));
|
|
7057
|
+
}
|
|
7039
7058
|
/**
|
|
7040
7059
|
* Build lock funds instruction
|
|
7041
7060
|
*/
|
|
7042
7061
|
async getLockFundsIx(props) {
|
|
7043
|
-
const { bondType, name, voteAccount, amount } = props;
|
|
7062
|
+
const { bondType, name, voteAccount, amount, withdrawAuthority } = props;
|
|
7044
7063
|
const [bondState] = this.pda.bondState(bondType, name);
|
|
7045
7064
|
let collateralType = props.collateralType;
|
|
7046
7065
|
if (!collateralType) {
|
|
@@ -7048,11 +7067,10 @@ var JBondClient = class _JBondClient {
|
|
|
7048
7067
|
collateralType = bondState2.collateralType;
|
|
7049
7068
|
}
|
|
7050
7069
|
const [validatorBond] = this.pda.validatorBond(bondType, name, voteAccount);
|
|
7051
|
-
const authority = this.provider.wallet?.publicKey;
|
|
7052
7070
|
const accounts = {
|
|
7053
7071
|
bondState,
|
|
7054
7072
|
validatorBond,
|
|
7055
|
-
payer:
|
|
7073
|
+
payer: withdrawAuthority,
|
|
7056
7074
|
bondTokenAccount: null
|
|
7057
7075
|
};
|
|
7058
7076
|
matchVariant(collateralType, {
|
|
@@ -7069,12 +7087,11 @@ var JBondClient = class _JBondClient {
|
|
|
7069
7087
|
* Build release funds instruction
|
|
7070
7088
|
*/
|
|
7071
7089
|
async getReleaseFundsIx(props) {
|
|
7072
|
-
const { bondType, name, voteAccount, amount } = props;
|
|
7090
|
+
const { bondType, name, voteAccount, amount, withdrawAuthority } = props;
|
|
7073
7091
|
const [validatorBond] = this.pda.validatorBond(bondType, name, voteAccount);
|
|
7074
|
-
const authority = this.provider.wallet?.publicKey;
|
|
7075
7092
|
const accounts = {
|
|
7076
7093
|
validatorBond,
|
|
7077
|
-
payer:
|
|
7094
|
+
payer: withdrawAuthority
|
|
7078
7095
|
};
|
|
7079
7096
|
return this.program.methods.bondReleaseFunds(solToLamports(amount)).accountsPartial(accounts).instruction();
|
|
7080
7097
|
}
|