@jpool/bond-sdk 0.11.0-next.16 → 0.11.0-next.18
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 +50 -9
- package/dist/index.d.ts +50 -9
- package/dist/index.js +53 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +53 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -264,8 +264,8 @@ type Jbond = {
|
|
|
264
264
|
"name": "bondLockFunds";
|
|
265
265
|
"docs": [
|
|
266
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
|
-
"# Errors",
|
|
267
|
+
"Moves collateral from available to locked state, making it unavailable for withdrawal for",
|
|
268
|
+
"the current and next epoch. # Errors",
|
|
269
269
|
"Fails if the validator is not active, or if there are insufficient available funds."
|
|
270
270
|
];
|
|
271
271
|
"discriminator": [
|
|
@@ -520,6 +520,37 @@ type Jbond = {
|
|
|
520
520
|
}
|
|
521
521
|
];
|
|
522
522
|
},
|
|
523
|
+
{
|
|
524
|
+
"name": "bondRemove";
|
|
525
|
+
"docs": [
|
|
526
|
+
"Removes bond state"
|
|
527
|
+
];
|
|
528
|
+
"discriminator": [
|
|
529
|
+
121,
|
|
530
|
+
112,
|
|
531
|
+
246,
|
|
532
|
+
177,
|
|
533
|
+
181,
|
|
534
|
+
8,
|
|
535
|
+
18,
|
|
536
|
+
220
|
|
537
|
+
];
|
|
538
|
+
"accounts": [
|
|
539
|
+
{
|
|
540
|
+
"name": "bondState";
|
|
541
|
+
"writable": true;
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
"name": "authority";
|
|
545
|
+
"writable": true;
|
|
546
|
+
"signer": true;
|
|
547
|
+
"relations": [
|
|
548
|
+
"bondState"
|
|
549
|
+
];
|
|
550
|
+
}
|
|
551
|
+
];
|
|
552
|
+
"args": [];
|
|
553
|
+
},
|
|
523
554
|
{
|
|
524
555
|
"name": "bondSetWithdrawAuthority";
|
|
525
556
|
"docs": [
|
|
@@ -706,7 +737,7 @@ type Jbond = {
|
|
|
706
737
|
"",
|
|
707
738
|
"This function should be called at epoch boundaries to update the bond's",
|
|
708
739
|
"`last_update_epoch` and move the `next_epoch_locked` amount into",
|
|
709
|
-
"`
|
|
740
|
+
"`locked`. It ensures that the update only occurs once per epoch.",
|
|
710
741
|
"",
|
|
711
742
|
"# Errors",
|
|
712
743
|
"Returns [`BondError::InvalidEpoch`] if called more than once in the same epoch,",
|
|
@@ -1734,16 +1765,16 @@ type Jbond = {
|
|
|
1734
1765
|
"type": "u8";
|
|
1735
1766
|
},
|
|
1736
1767
|
{
|
|
1737
|
-
"name": "
|
|
1768
|
+
"name": "locked";
|
|
1738
1769
|
"docs": [
|
|
1739
|
-
"Amount of collateral locked
|
|
1770
|
+
"Amount of collateral currently locked"
|
|
1740
1771
|
];
|
|
1741
1772
|
"type": "u64";
|
|
1742
1773
|
},
|
|
1743
1774
|
{
|
|
1744
|
-
"name": "
|
|
1775
|
+
"name": "nextEpochLocked";
|
|
1745
1776
|
"docs": [
|
|
1746
|
-
"Amount of collateral locked for the
|
|
1777
|
+
"Amount of collateral locked for the next epoch"
|
|
1747
1778
|
];
|
|
1748
1779
|
"type": "u64";
|
|
1749
1780
|
},
|
|
@@ -1933,6 +1964,11 @@ type BondFinishProps = {
|
|
|
1933
1964
|
bondType: BondType;
|
|
1934
1965
|
name: string;
|
|
1935
1966
|
};
|
|
1967
|
+
type BondRemoveProps = {
|
|
1968
|
+
bondType: BondType;
|
|
1969
|
+
name: string;
|
|
1970
|
+
authority?: PublicKey;
|
|
1971
|
+
};
|
|
1936
1972
|
|
|
1937
1973
|
type GetHistoryOpts = {
|
|
1938
1974
|
cluster?: Cluster;
|
|
@@ -2074,6 +2110,7 @@ declare class JBondClient {
|
|
|
2074
2110
|
* Finish crowdfunding bond session
|
|
2075
2111
|
*/
|
|
2076
2112
|
bondFinish(props: BondFinishProps): Promise<string | undefined>;
|
|
2113
|
+
bondRemove(props: BondRemoveProps): Promise<string | undefined>;
|
|
2077
2114
|
/**
|
|
2078
2115
|
* Build global state initialize instruction
|
|
2079
2116
|
*/
|
|
@@ -2142,6 +2179,10 @@ declare class JBondClient {
|
|
|
2142
2179
|
voteAccount: PublicKeyInitData;
|
|
2143
2180
|
payer: PublicKey;
|
|
2144
2181
|
}): Promise<TransactionInstruction>;
|
|
2182
|
+
/**
|
|
2183
|
+
* Build bond remove instruction
|
|
2184
|
+
*/
|
|
2185
|
+
getBondRemoveIx(props: BondRemoveProps): Promise<TransactionInstruction>;
|
|
2145
2186
|
/**
|
|
2146
2187
|
* Build test set last update epoch instruction
|
|
2147
2188
|
* NOTE!: This instruction is for testing purposes only.
|
|
@@ -2294,8 +2335,8 @@ declare class JBondClient {
|
|
|
2294
2335
|
withdrawalAuthority: PublicKey | null;
|
|
2295
2336
|
createdAt: bn_js;
|
|
2296
2337
|
bump: number;
|
|
2338
|
+
locked: bn_js;
|
|
2297
2339
|
nextEpochLocked: bn_js;
|
|
2298
|
-
currentEpochLocked: bn_js;
|
|
2299
2340
|
lastUpdateEpoch: bn_js;
|
|
2300
2341
|
publicKey: PublicKey;
|
|
2301
2342
|
}>;
|
|
@@ -2341,4 +2382,4 @@ declare const CROWDFUNDING_BOND_SEED = "crowdfunding";
|
|
|
2341
2382
|
*/
|
|
2342
2383
|
declare const ENV_PROGRAM_ID: Record<string, PublicKey>;
|
|
2343
2384
|
|
|
2344
|
-
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 };
|
|
2385
|
+
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -264,8 +264,8 @@ type Jbond = {
|
|
|
264
264
|
"name": "bondLockFunds";
|
|
265
265
|
"docs": [
|
|
266
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
|
-
"# Errors",
|
|
267
|
+
"Moves collateral from available to locked state, making it unavailable for withdrawal for",
|
|
268
|
+
"the current and next epoch. # Errors",
|
|
269
269
|
"Fails if the validator is not active, or if there are insufficient available funds."
|
|
270
270
|
];
|
|
271
271
|
"discriminator": [
|
|
@@ -520,6 +520,37 @@ type Jbond = {
|
|
|
520
520
|
}
|
|
521
521
|
];
|
|
522
522
|
},
|
|
523
|
+
{
|
|
524
|
+
"name": "bondRemove";
|
|
525
|
+
"docs": [
|
|
526
|
+
"Removes bond state"
|
|
527
|
+
];
|
|
528
|
+
"discriminator": [
|
|
529
|
+
121,
|
|
530
|
+
112,
|
|
531
|
+
246,
|
|
532
|
+
177,
|
|
533
|
+
181,
|
|
534
|
+
8,
|
|
535
|
+
18,
|
|
536
|
+
220
|
|
537
|
+
];
|
|
538
|
+
"accounts": [
|
|
539
|
+
{
|
|
540
|
+
"name": "bondState";
|
|
541
|
+
"writable": true;
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
"name": "authority";
|
|
545
|
+
"writable": true;
|
|
546
|
+
"signer": true;
|
|
547
|
+
"relations": [
|
|
548
|
+
"bondState"
|
|
549
|
+
];
|
|
550
|
+
}
|
|
551
|
+
];
|
|
552
|
+
"args": [];
|
|
553
|
+
},
|
|
523
554
|
{
|
|
524
555
|
"name": "bondSetWithdrawAuthority";
|
|
525
556
|
"docs": [
|
|
@@ -706,7 +737,7 @@ type Jbond = {
|
|
|
706
737
|
"",
|
|
707
738
|
"This function should be called at epoch boundaries to update the bond's",
|
|
708
739
|
"`last_update_epoch` and move the `next_epoch_locked` amount into",
|
|
709
|
-
"`
|
|
740
|
+
"`locked`. It ensures that the update only occurs once per epoch.",
|
|
710
741
|
"",
|
|
711
742
|
"# Errors",
|
|
712
743
|
"Returns [`BondError::InvalidEpoch`] if called more than once in the same epoch,",
|
|
@@ -1734,16 +1765,16 @@ type Jbond = {
|
|
|
1734
1765
|
"type": "u8";
|
|
1735
1766
|
},
|
|
1736
1767
|
{
|
|
1737
|
-
"name": "
|
|
1768
|
+
"name": "locked";
|
|
1738
1769
|
"docs": [
|
|
1739
|
-
"Amount of collateral locked
|
|
1770
|
+
"Amount of collateral currently locked"
|
|
1740
1771
|
];
|
|
1741
1772
|
"type": "u64";
|
|
1742
1773
|
},
|
|
1743
1774
|
{
|
|
1744
|
-
"name": "
|
|
1775
|
+
"name": "nextEpochLocked";
|
|
1745
1776
|
"docs": [
|
|
1746
|
-
"Amount of collateral locked for the
|
|
1777
|
+
"Amount of collateral locked for the next epoch"
|
|
1747
1778
|
];
|
|
1748
1779
|
"type": "u64";
|
|
1749
1780
|
},
|
|
@@ -1933,6 +1964,11 @@ type BondFinishProps = {
|
|
|
1933
1964
|
bondType: BondType;
|
|
1934
1965
|
name: string;
|
|
1935
1966
|
};
|
|
1967
|
+
type BondRemoveProps = {
|
|
1968
|
+
bondType: BondType;
|
|
1969
|
+
name: string;
|
|
1970
|
+
authority?: PublicKey;
|
|
1971
|
+
};
|
|
1936
1972
|
|
|
1937
1973
|
type GetHistoryOpts = {
|
|
1938
1974
|
cluster?: Cluster;
|
|
@@ -2074,6 +2110,7 @@ declare class JBondClient {
|
|
|
2074
2110
|
* Finish crowdfunding bond session
|
|
2075
2111
|
*/
|
|
2076
2112
|
bondFinish(props: BondFinishProps): Promise<string | undefined>;
|
|
2113
|
+
bondRemove(props: BondRemoveProps): Promise<string | undefined>;
|
|
2077
2114
|
/**
|
|
2078
2115
|
* Build global state initialize instruction
|
|
2079
2116
|
*/
|
|
@@ -2142,6 +2179,10 @@ declare class JBondClient {
|
|
|
2142
2179
|
voteAccount: PublicKeyInitData;
|
|
2143
2180
|
payer: PublicKey;
|
|
2144
2181
|
}): Promise<TransactionInstruction>;
|
|
2182
|
+
/**
|
|
2183
|
+
* Build bond remove instruction
|
|
2184
|
+
*/
|
|
2185
|
+
getBondRemoveIx(props: BondRemoveProps): Promise<TransactionInstruction>;
|
|
2145
2186
|
/**
|
|
2146
2187
|
* Build test set last update epoch instruction
|
|
2147
2188
|
* NOTE!: This instruction is for testing purposes only.
|
|
@@ -2294,8 +2335,8 @@ declare class JBondClient {
|
|
|
2294
2335
|
withdrawalAuthority: PublicKey | null;
|
|
2295
2336
|
createdAt: bn_js;
|
|
2296
2337
|
bump: number;
|
|
2338
|
+
locked: bn_js;
|
|
2297
2339
|
nextEpochLocked: bn_js;
|
|
2298
|
-
currentEpochLocked: bn_js;
|
|
2299
2340
|
lastUpdateEpoch: bn_js;
|
|
2300
2341
|
publicKey: PublicKey;
|
|
2301
2342
|
}>;
|
|
@@ -2341,4 +2382,4 @@ declare const CROWDFUNDING_BOND_SEED = "crowdfunding";
|
|
|
2341
2382
|
*/
|
|
2342
2383
|
declare const ENV_PROGRAM_ID: Record<string, PublicKey>;
|
|
2343
2384
|
|
|
2344
|
-
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 };
|
|
2385
|
+
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 };
|
package/dist/index.js
CHANGED
|
@@ -4574,7 +4574,7 @@ var VALIDATOR_BOND_SEED = "validator_bond";
|
|
|
4574
4574
|
var STANDARD_BOND_SEED = "standard";
|
|
4575
4575
|
var CROWDFUNDING_BOND_SEED = "crowdfunding";
|
|
4576
4576
|
var ENV_PROGRAM_ID = {
|
|
4577
|
-
//
|
|
4577
|
+
// [JBondClientEnv.DEV]: new PublicKey('...'),
|
|
4578
4578
|
};
|
|
4579
4579
|
|
|
4580
4580
|
// src/history.ts
|
|
@@ -5012,8 +5012,8 @@ var jbond_default = {
|
|
|
5012
5012
|
name: "bond_lock_funds",
|
|
5013
5013
|
docs: [
|
|
5014
5014
|
"Locks funds for both the current and upcoming epoch.",
|
|
5015
|
-
"Moves collateral from available to locked state, making it unavailable for withdrawal for
|
|
5016
|
-
"# Errors",
|
|
5015
|
+
"Moves collateral from available to locked state, making it unavailable for withdrawal for",
|
|
5016
|
+
"the current and next epoch. # Errors",
|
|
5017
5017
|
"Fails if the validator is not active, or if there are insufficient available funds."
|
|
5018
5018
|
],
|
|
5019
5019
|
discriminator: [
|
|
@@ -5268,6 +5268,37 @@ var jbond_default = {
|
|
|
5268
5268
|
}
|
|
5269
5269
|
]
|
|
5270
5270
|
},
|
|
5271
|
+
{
|
|
5272
|
+
name: "bond_remove",
|
|
5273
|
+
docs: [
|
|
5274
|
+
"Removes bond state"
|
|
5275
|
+
],
|
|
5276
|
+
discriminator: [
|
|
5277
|
+
121,
|
|
5278
|
+
112,
|
|
5279
|
+
246,
|
|
5280
|
+
177,
|
|
5281
|
+
181,
|
|
5282
|
+
8,
|
|
5283
|
+
18,
|
|
5284
|
+
220
|
|
5285
|
+
],
|
|
5286
|
+
accounts: [
|
|
5287
|
+
{
|
|
5288
|
+
name: "bond_state",
|
|
5289
|
+
writable: true
|
|
5290
|
+
},
|
|
5291
|
+
{
|
|
5292
|
+
name: "authority",
|
|
5293
|
+
writable: true,
|
|
5294
|
+
signer: true,
|
|
5295
|
+
relations: [
|
|
5296
|
+
"bond_state"
|
|
5297
|
+
]
|
|
5298
|
+
}
|
|
5299
|
+
],
|
|
5300
|
+
args: []
|
|
5301
|
+
},
|
|
5271
5302
|
{
|
|
5272
5303
|
name: "bond_set_withdraw_authority",
|
|
5273
5304
|
docs: [
|
|
@@ -5454,7 +5485,7 @@ var jbond_default = {
|
|
|
5454
5485
|
"",
|
|
5455
5486
|
"This function should be called at epoch boundaries to update the bond's",
|
|
5456
5487
|
"`last_update_epoch` and move the `next_epoch_locked` amount into",
|
|
5457
|
-
"`
|
|
5488
|
+
"`locked`. It ensures that the update only occurs once per epoch.",
|
|
5458
5489
|
"",
|
|
5459
5490
|
"# Errors",
|
|
5460
5491
|
"Returns [`BondError::InvalidEpoch`] if called more than once in the same epoch,",
|
|
@@ -6482,16 +6513,16 @@ var jbond_default = {
|
|
|
6482
6513
|
type: "u8"
|
|
6483
6514
|
},
|
|
6484
6515
|
{
|
|
6485
|
-
name: "
|
|
6516
|
+
name: "locked",
|
|
6486
6517
|
docs: [
|
|
6487
|
-
"Amount of collateral locked
|
|
6518
|
+
"Amount of collateral currently locked"
|
|
6488
6519
|
],
|
|
6489
6520
|
type: "u64"
|
|
6490
6521
|
},
|
|
6491
6522
|
{
|
|
6492
|
-
name: "
|
|
6523
|
+
name: "next_epoch_locked",
|
|
6493
6524
|
docs: [
|
|
6494
|
-
"Amount of collateral locked for the
|
|
6525
|
+
"Amount of collateral locked for the next epoch"
|
|
6495
6526
|
],
|
|
6496
6527
|
type: "u64"
|
|
6497
6528
|
},
|
|
@@ -6831,6 +6862,10 @@ var JBondClient = class _JBondClient {
|
|
|
6831
6862
|
const ix = await this.getBondSessionFinishIx(props);
|
|
6832
6863
|
return this.provider.sendAndConfirm?.(new web3_js.Transaction().add(ix));
|
|
6833
6864
|
}
|
|
6865
|
+
async bondRemove(props) {
|
|
6866
|
+
const ix = await this.getBondRemoveIx(props);
|
|
6867
|
+
return this.provider.sendAndConfirm?.(new web3_js.Transaction().add(ix));
|
|
6868
|
+
}
|
|
6834
6869
|
/**
|
|
6835
6870
|
* Build global state initialize instruction
|
|
6836
6871
|
*/
|
|
@@ -7132,6 +7167,15 @@ var JBondClient = class _JBondClient {
|
|
|
7132
7167
|
const [validatorBond, _] = this.pda.validatorBond(bondType, bondName, voteAccount);
|
|
7133
7168
|
return this.program.methods.bondUpdate().accountsPartial({ validatorBond, payer }).instruction();
|
|
7134
7169
|
}
|
|
7170
|
+
/**
|
|
7171
|
+
* Build bond remove instruction
|
|
7172
|
+
*/
|
|
7173
|
+
async getBondRemoveIx(props) {
|
|
7174
|
+
const { bondType, name } = props;
|
|
7175
|
+
const [bondState] = this.pda.bondState(bondType, name);
|
|
7176
|
+
const authority = props.authority ?? this.provider.wallet?.publicKey;
|
|
7177
|
+
return this.program.methods.bondRemove().accountsPartial({ bondState, authority }).instruction();
|
|
7178
|
+
}
|
|
7135
7179
|
/**
|
|
7136
7180
|
* Build test set last update epoch instruction
|
|
7137
7181
|
* NOTE!: This instruction is for testing purposes only.
|
|
@@ -7190,7 +7234,7 @@ var JBondClient = class _JBondClient {
|
|
|
7190
7234
|
*/
|
|
7191
7235
|
async getAvailableCollateral(bondType, bondName, voteAccount) {
|
|
7192
7236
|
const validatorBond = await this.getValidatorBond(bondType, bondName, voteAccount);
|
|
7193
|
-
return await this.getValidatorBondBalance(bondType, bondName, voteAccount) - validatorBond.
|
|
7237
|
+
return await this.getValidatorBondBalance(bondType, bondName, voteAccount) - validatorBond.locked.toNumber();
|
|
7194
7238
|
}
|
|
7195
7239
|
/**
|
|
7196
7240
|
* Get all bond states with total collected collateral
|