@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.d.mts
CHANGED
|
@@ -263,8 +263,8 @@ type Jbond = {
|
|
|
263
263
|
{
|
|
264
264
|
"name": "bondLockFunds";
|
|
265
265
|
"docs": [
|
|
266
|
-
"Locks funds for the upcoming epoch.",
|
|
267
|
-
"Moves collateral from available to locked state
|
|
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
268
|
"# Errors",
|
|
269
269
|
"Fails if the validator is not active, or if there are insufficient available funds."
|
|
270
270
|
];
|
|
@@ -633,6 +633,17 @@ type Jbond = {
|
|
|
633
633
|
},
|
|
634
634
|
{
|
|
635
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
|
+
];
|
|
636
647
|
"discriminator": [
|
|
637
648
|
237,
|
|
638
649
|
102,
|
|
@@ -1821,6 +1832,7 @@ type BondLockFunds = {
|
|
|
1821
1832
|
bondType: BondType;
|
|
1822
1833
|
name: string;
|
|
1823
1834
|
amount: number;
|
|
1835
|
+
withdrawAuthority: PublicKey;
|
|
1824
1836
|
voteAccount: PublicKey;
|
|
1825
1837
|
collateralType?: CollateralType;
|
|
1826
1838
|
};
|
|
@@ -1828,6 +1840,7 @@ type BondReleaseFunds = {
|
|
|
1828
1840
|
bondType: BondType;
|
|
1829
1841
|
name: string;
|
|
1830
1842
|
amount: number;
|
|
1843
|
+
withdrawAuthority: PublicKey;
|
|
1831
1844
|
voteAccount: PublicKey;
|
|
1832
1845
|
};
|
|
1833
1846
|
type ClaimAllProps = {
|
|
@@ -2080,6 +2093,8 @@ declare class JBondClient {
|
|
|
2080
2093
|
* Build start crowdfunding session instruction
|
|
2081
2094
|
*/
|
|
2082
2095
|
getBondSessionStartIx(props: BondStartProps): Promise<TransactionInstruction>;
|
|
2096
|
+
lockFunds(props: BondLockFunds): Promise<string | undefined>;
|
|
2097
|
+
releaseFunds(props: BondReleaseFunds): Promise<string | undefined>;
|
|
2083
2098
|
/**
|
|
2084
2099
|
* Build lock funds instruction
|
|
2085
2100
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -263,8 +263,8 @@ type Jbond = {
|
|
|
263
263
|
{
|
|
264
264
|
"name": "bondLockFunds";
|
|
265
265
|
"docs": [
|
|
266
|
-
"Locks funds for the upcoming epoch.",
|
|
267
|
-
"Moves collateral from available to locked state
|
|
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
268
|
"# Errors",
|
|
269
269
|
"Fails if the validator is not active, or if there are insufficient available funds."
|
|
270
270
|
];
|
|
@@ -633,6 +633,17 @@ type Jbond = {
|
|
|
633
633
|
},
|
|
634
634
|
{
|
|
635
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
|
+
];
|
|
636
647
|
"discriminator": [
|
|
637
648
|
237,
|
|
638
649
|
102,
|
|
@@ -1821,6 +1832,7 @@ type BondLockFunds = {
|
|
|
1821
1832
|
bondType: BondType;
|
|
1822
1833
|
name: string;
|
|
1823
1834
|
amount: number;
|
|
1835
|
+
withdrawAuthority: PublicKey;
|
|
1824
1836
|
voteAccount: PublicKey;
|
|
1825
1837
|
collateralType?: CollateralType;
|
|
1826
1838
|
};
|
|
@@ -1828,6 +1840,7 @@ type BondReleaseFunds = {
|
|
|
1828
1840
|
bondType: BondType;
|
|
1829
1841
|
name: string;
|
|
1830
1842
|
amount: number;
|
|
1843
|
+
withdrawAuthority: PublicKey;
|
|
1831
1844
|
voteAccount: PublicKey;
|
|
1832
1845
|
};
|
|
1833
1846
|
type ClaimAllProps = {
|
|
@@ -2080,6 +2093,8 @@ declare class JBondClient {
|
|
|
2080
2093
|
* Build start crowdfunding session instruction
|
|
2081
2094
|
*/
|
|
2082
2095
|
getBondSessionStartIx(props: BondStartProps): Promise<TransactionInstruction>;
|
|
2096
|
+
lockFunds(props: BondLockFunds): Promise<string | undefined>;
|
|
2097
|
+
releaseFunds(props: BondReleaseFunds): Promise<string | undefined>;
|
|
2083
2098
|
/**
|
|
2084
2099
|
* Build lock funds instruction
|
|
2085
2100
|
*/
|
package/dist/index.js
CHANGED
|
@@ -5011,8 +5011,8 @@ var jbond_default = {
|
|
|
5011
5011
|
{
|
|
5012
5012
|
name: "bond_lock_funds",
|
|
5013
5013
|
docs: [
|
|
5014
|
-
"Locks funds for the upcoming epoch.",
|
|
5015
|
-
"Moves collateral from available to locked state
|
|
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
5016
|
"# Errors",
|
|
5017
5017
|
"Fails if the validator is not active, or if there are insufficient available funds."
|
|
5018
5018
|
],
|
|
@@ -5381,6 +5381,17 @@ var jbond_default = {
|
|
|
5381
5381
|
},
|
|
5382
5382
|
{
|
|
5383
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
|
+
],
|
|
5384
5395
|
discriminator: [
|
|
5385
5396
|
237,
|
|
5386
5397
|
102,
|
|
@@ -7068,11 +7079,19 @@ var JBondClient = class _JBondClient {
|
|
|
7068
7079
|
const authority = this.provider.wallet?.publicKey;
|
|
7069
7080
|
return this.program.methods.sessionStart(new import_bn.BN(props.duration)).accountsPartial({ bondState, authority }).instruction();
|
|
7070
7081
|
}
|
|
7082
|
+
async lockFunds(props) {
|
|
7083
|
+
const ix = await this.getLockFundsIx(props);
|
|
7084
|
+
return this.provider.sendAndConfirm?.(new web3_js.Transaction().add(ix));
|
|
7085
|
+
}
|
|
7086
|
+
async releaseFunds(props) {
|
|
7087
|
+
const ix = await this.getReleaseFundsIx(props);
|
|
7088
|
+
return this.provider.sendAndConfirm?.(new web3_js.Transaction().add(ix));
|
|
7089
|
+
}
|
|
7071
7090
|
/**
|
|
7072
7091
|
* Build lock funds instruction
|
|
7073
7092
|
*/
|
|
7074
7093
|
async getLockFundsIx(props) {
|
|
7075
|
-
const { bondType, name, voteAccount, amount } = props;
|
|
7094
|
+
const { bondType, name, voteAccount, amount, withdrawAuthority } = props;
|
|
7076
7095
|
const [bondState] = this.pda.bondState(bondType, name);
|
|
7077
7096
|
let collateralType = props.collateralType;
|
|
7078
7097
|
if (!collateralType) {
|
|
@@ -7080,11 +7099,10 @@ var JBondClient = class _JBondClient {
|
|
|
7080
7099
|
collateralType = bondState2.collateralType;
|
|
7081
7100
|
}
|
|
7082
7101
|
const [validatorBond] = this.pda.validatorBond(bondType, name, voteAccount);
|
|
7083
|
-
const authority = this.provider.wallet?.publicKey;
|
|
7084
7102
|
const accounts = {
|
|
7085
7103
|
bondState,
|
|
7086
7104
|
validatorBond,
|
|
7087
|
-
payer:
|
|
7105
|
+
payer: withdrawAuthority,
|
|
7088
7106
|
bondTokenAccount: null
|
|
7089
7107
|
};
|
|
7090
7108
|
matchVariant(collateralType, {
|
|
@@ -7101,12 +7119,11 @@ var JBondClient = class _JBondClient {
|
|
|
7101
7119
|
* Build release funds instruction
|
|
7102
7120
|
*/
|
|
7103
7121
|
async getReleaseFundsIx(props) {
|
|
7104
|
-
const { bondType, name, voteAccount, amount } = props;
|
|
7122
|
+
const { bondType, name, voteAccount, amount, withdrawAuthority } = props;
|
|
7105
7123
|
const [validatorBond] = this.pda.validatorBond(bondType, name, voteAccount);
|
|
7106
|
-
const authority = this.provider.wallet?.publicKey;
|
|
7107
7124
|
const accounts = {
|
|
7108
7125
|
validatorBond,
|
|
7109
|
-
payer:
|
|
7126
|
+
payer: withdrawAuthority
|
|
7110
7127
|
};
|
|
7111
7128
|
return this.program.methods.bondReleaseFunds(solToLamports(amount)).accountsPartial(accounts).instruction();
|
|
7112
7129
|
}
|