@jpool/bond-sdk 0.11.0-next.15 → 0.11.0-next.17
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 +76 -8
- package/dist/index.d.ts +76 -8
- package/dist/index.js +81 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +81 -11
- 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": [
|
|
@@ -286,6 +286,38 @@ type Jbond = {
|
|
|
286
286
|
{
|
|
287
287
|
"name": "validatorBond";
|
|
288
288
|
"writable": true;
|
|
289
|
+
"pda": {
|
|
290
|
+
"seeds": [
|
|
291
|
+
{
|
|
292
|
+
"kind": "const";
|
|
293
|
+
"value": [
|
|
294
|
+
118,
|
|
295
|
+
97,
|
|
296
|
+
108,
|
|
297
|
+
105,
|
|
298
|
+
100,
|
|
299
|
+
97,
|
|
300
|
+
116,
|
|
301
|
+
111,
|
|
302
|
+
114,
|
|
303
|
+
95,
|
|
304
|
+
98,
|
|
305
|
+
111,
|
|
306
|
+
110,
|
|
307
|
+
100
|
|
308
|
+
];
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
"kind": "account";
|
|
312
|
+
"path": "bondState";
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
"kind": "account";
|
|
316
|
+
"path": "validator_bond.vote_account";
|
|
317
|
+
"account": "validatorBond";
|
|
318
|
+
}
|
|
319
|
+
];
|
|
320
|
+
};
|
|
289
321
|
},
|
|
290
322
|
{
|
|
291
323
|
"name": "bondTokenAccount";
|
|
@@ -435,9 +467,45 @@ type Jbond = {
|
|
|
435
467
|
190
|
|
436
468
|
];
|
|
437
469
|
"accounts": [
|
|
470
|
+
{
|
|
471
|
+
"name": "bondState";
|
|
472
|
+
"writable": true;
|
|
473
|
+
},
|
|
438
474
|
{
|
|
439
475
|
"name": "validatorBond";
|
|
440
476
|
"writable": true;
|
|
477
|
+
"pda": {
|
|
478
|
+
"seeds": [
|
|
479
|
+
{
|
|
480
|
+
"kind": "const";
|
|
481
|
+
"value": [
|
|
482
|
+
118,
|
|
483
|
+
97,
|
|
484
|
+
108,
|
|
485
|
+
105,
|
|
486
|
+
100,
|
|
487
|
+
97,
|
|
488
|
+
116,
|
|
489
|
+
111,
|
|
490
|
+
114,
|
|
491
|
+
95,
|
|
492
|
+
98,
|
|
493
|
+
111,
|
|
494
|
+
110,
|
|
495
|
+
100
|
|
496
|
+
];
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
"kind": "account";
|
|
500
|
+
"path": "bondState";
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
"kind": "account";
|
|
504
|
+
"path": "validator_bond.vote_account";
|
|
505
|
+
"account": "validatorBond";
|
|
506
|
+
}
|
|
507
|
+
];
|
|
508
|
+
};
|
|
441
509
|
},
|
|
442
510
|
{
|
|
443
511
|
"name": "payer";
|
|
@@ -638,7 +706,7 @@ type Jbond = {
|
|
|
638
706
|
"",
|
|
639
707
|
"This function should be called at epoch boundaries to update the bond's",
|
|
640
708
|
"`last_update_epoch` and move the `next_epoch_locked` amount into",
|
|
641
|
-
"`
|
|
709
|
+
"`locked`. It ensures that the update only occurs once per epoch.",
|
|
642
710
|
"",
|
|
643
711
|
"# Errors",
|
|
644
712
|
"Returns [`BondError::InvalidEpoch`] if called more than once in the same epoch,",
|
|
@@ -1666,16 +1734,16 @@ type Jbond = {
|
|
|
1666
1734
|
"type": "u8";
|
|
1667
1735
|
},
|
|
1668
1736
|
{
|
|
1669
|
-
"name": "
|
|
1737
|
+
"name": "locked";
|
|
1670
1738
|
"docs": [
|
|
1671
|
-
"Amount of collateral locked
|
|
1739
|
+
"Amount of collateral currently locked"
|
|
1672
1740
|
];
|
|
1673
1741
|
"type": "u64";
|
|
1674
1742
|
},
|
|
1675
1743
|
{
|
|
1676
|
-
"name": "
|
|
1744
|
+
"name": "nextEpochLocked";
|
|
1677
1745
|
"docs": [
|
|
1678
|
-
"Amount of collateral locked for the
|
|
1746
|
+
"Amount of collateral locked for the next epoch"
|
|
1679
1747
|
];
|
|
1680
1748
|
"type": "u64";
|
|
1681
1749
|
},
|
|
@@ -2226,8 +2294,8 @@ declare class JBondClient {
|
|
|
2226
2294
|
withdrawalAuthority: PublicKey | null;
|
|
2227
2295
|
createdAt: bn_js;
|
|
2228
2296
|
bump: number;
|
|
2297
|
+
locked: bn_js;
|
|
2229
2298
|
nextEpochLocked: bn_js;
|
|
2230
|
-
currentEpochLocked: bn_js;
|
|
2231
2299
|
lastUpdateEpoch: bn_js;
|
|
2232
2300
|
publicKey: PublicKey;
|
|
2233
2301
|
}>;
|
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": [
|
|
@@ -286,6 +286,38 @@ type Jbond = {
|
|
|
286
286
|
{
|
|
287
287
|
"name": "validatorBond";
|
|
288
288
|
"writable": true;
|
|
289
|
+
"pda": {
|
|
290
|
+
"seeds": [
|
|
291
|
+
{
|
|
292
|
+
"kind": "const";
|
|
293
|
+
"value": [
|
|
294
|
+
118,
|
|
295
|
+
97,
|
|
296
|
+
108,
|
|
297
|
+
105,
|
|
298
|
+
100,
|
|
299
|
+
97,
|
|
300
|
+
116,
|
|
301
|
+
111,
|
|
302
|
+
114,
|
|
303
|
+
95,
|
|
304
|
+
98,
|
|
305
|
+
111,
|
|
306
|
+
110,
|
|
307
|
+
100
|
|
308
|
+
];
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
"kind": "account";
|
|
312
|
+
"path": "bondState";
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
"kind": "account";
|
|
316
|
+
"path": "validator_bond.vote_account";
|
|
317
|
+
"account": "validatorBond";
|
|
318
|
+
}
|
|
319
|
+
];
|
|
320
|
+
};
|
|
289
321
|
},
|
|
290
322
|
{
|
|
291
323
|
"name": "bondTokenAccount";
|
|
@@ -435,9 +467,45 @@ type Jbond = {
|
|
|
435
467
|
190
|
|
436
468
|
];
|
|
437
469
|
"accounts": [
|
|
470
|
+
{
|
|
471
|
+
"name": "bondState";
|
|
472
|
+
"writable": true;
|
|
473
|
+
},
|
|
438
474
|
{
|
|
439
475
|
"name": "validatorBond";
|
|
440
476
|
"writable": true;
|
|
477
|
+
"pda": {
|
|
478
|
+
"seeds": [
|
|
479
|
+
{
|
|
480
|
+
"kind": "const";
|
|
481
|
+
"value": [
|
|
482
|
+
118,
|
|
483
|
+
97,
|
|
484
|
+
108,
|
|
485
|
+
105,
|
|
486
|
+
100,
|
|
487
|
+
97,
|
|
488
|
+
116,
|
|
489
|
+
111,
|
|
490
|
+
114,
|
|
491
|
+
95,
|
|
492
|
+
98,
|
|
493
|
+
111,
|
|
494
|
+
110,
|
|
495
|
+
100
|
|
496
|
+
];
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
"kind": "account";
|
|
500
|
+
"path": "bondState";
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
"kind": "account";
|
|
504
|
+
"path": "validator_bond.vote_account";
|
|
505
|
+
"account": "validatorBond";
|
|
506
|
+
}
|
|
507
|
+
];
|
|
508
|
+
};
|
|
441
509
|
},
|
|
442
510
|
{
|
|
443
511
|
"name": "payer";
|
|
@@ -638,7 +706,7 @@ type Jbond = {
|
|
|
638
706
|
"",
|
|
639
707
|
"This function should be called at epoch boundaries to update the bond's",
|
|
640
708
|
"`last_update_epoch` and move the `next_epoch_locked` amount into",
|
|
641
|
-
"`
|
|
709
|
+
"`locked`. It ensures that the update only occurs once per epoch.",
|
|
642
710
|
"",
|
|
643
711
|
"# Errors",
|
|
644
712
|
"Returns [`BondError::InvalidEpoch`] if called more than once in the same epoch,",
|
|
@@ -1666,16 +1734,16 @@ type Jbond = {
|
|
|
1666
1734
|
"type": "u8";
|
|
1667
1735
|
},
|
|
1668
1736
|
{
|
|
1669
|
-
"name": "
|
|
1737
|
+
"name": "locked";
|
|
1670
1738
|
"docs": [
|
|
1671
|
-
"Amount of collateral locked
|
|
1739
|
+
"Amount of collateral currently locked"
|
|
1672
1740
|
];
|
|
1673
1741
|
"type": "u64";
|
|
1674
1742
|
},
|
|
1675
1743
|
{
|
|
1676
|
-
"name": "
|
|
1744
|
+
"name": "nextEpochLocked";
|
|
1677
1745
|
"docs": [
|
|
1678
|
-
"Amount of collateral locked for the
|
|
1746
|
+
"Amount of collateral locked for the next epoch"
|
|
1679
1747
|
];
|
|
1680
1748
|
"type": "u64";
|
|
1681
1749
|
},
|
|
@@ -2226,8 +2294,8 @@ declare class JBondClient {
|
|
|
2226
2294
|
withdrawalAuthority: PublicKey | null;
|
|
2227
2295
|
createdAt: bn_js;
|
|
2228
2296
|
bump: number;
|
|
2297
|
+
locked: bn_js;
|
|
2229
2298
|
nextEpochLocked: bn_js;
|
|
2230
|
-
currentEpochLocked: bn_js;
|
|
2231
2299
|
lastUpdateEpoch: bn_js;
|
|
2232
2300
|
publicKey: PublicKey;
|
|
2233
2301
|
}>;
|
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: [
|
|
@@ -5033,7 +5033,39 @@ var jbond_default = {
|
|
|
5033
5033
|
},
|
|
5034
5034
|
{
|
|
5035
5035
|
name: "validator_bond",
|
|
5036
|
-
writable: true
|
|
5036
|
+
writable: true,
|
|
5037
|
+
pda: {
|
|
5038
|
+
seeds: [
|
|
5039
|
+
{
|
|
5040
|
+
kind: "const",
|
|
5041
|
+
value: [
|
|
5042
|
+
118,
|
|
5043
|
+
97,
|
|
5044
|
+
108,
|
|
5045
|
+
105,
|
|
5046
|
+
100,
|
|
5047
|
+
97,
|
|
5048
|
+
116,
|
|
5049
|
+
111,
|
|
5050
|
+
114,
|
|
5051
|
+
95,
|
|
5052
|
+
98,
|
|
5053
|
+
111,
|
|
5054
|
+
110,
|
|
5055
|
+
100
|
|
5056
|
+
]
|
|
5057
|
+
},
|
|
5058
|
+
{
|
|
5059
|
+
kind: "account",
|
|
5060
|
+
path: "bond_state"
|
|
5061
|
+
},
|
|
5062
|
+
{
|
|
5063
|
+
kind: "account",
|
|
5064
|
+
path: "validator_bond.vote_account",
|
|
5065
|
+
account: "ValidatorBond"
|
|
5066
|
+
}
|
|
5067
|
+
]
|
|
5068
|
+
}
|
|
5037
5069
|
},
|
|
5038
5070
|
{
|
|
5039
5071
|
name: "bond_token_account",
|
|
@@ -5184,9 +5216,45 @@ var jbond_default = {
|
|
|
5184
5216
|
],
|
|
5185
5217
|
accounts: [
|
|
5186
5218
|
{
|
|
5187
|
-
name: "
|
|
5219
|
+
name: "bond_state",
|
|
5188
5220
|
writable: true
|
|
5189
5221
|
},
|
|
5222
|
+
{
|
|
5223
|
+
name: "validator_bond",
|
|
5224
|
+
writable: true,
|
|
5225
|
+
pda: {
|
|
5226
|
+
seeds: [
|
|
5227
|
+
{
|
|
5228
|
+
kind: "const",
|
|
5229
|
+
value: [
|
|
5230
|
+
118,
|
|
5231
|
+
97,
|
|
5232
|
+
108,
|
|
5233
|
+
105,
|
|
5234
|
+
100,
|
|
5235
|
+
97,
|
|
5236
|
+
116,
|
|
5237
|
+
111,
|
|
5238
|
+
114,
|
|
5239
|
+
95,
|
|
5240
|
+
98,
|
|
5241
|
+
111,
|
|
5242
|
+
110,
|
|
5243
|
+
100
|
|
5244
|
+
]
|
|
5245
|
+
},
|
|
5246
|
+
{
|
|
5247
|
+
kind: "account",
|
|
5248
|
+
path: "bond_state"
|
|
5249
|
+
},
|
|
5250
|
+
{
|
|
5251
|
+
kind: "account",
|
|
5252
|
+
path: "validator_bond.vote_account",
|
|
5253
|
+
account: "ValidatorBond"
|
|
5254
|
+
}
|
|
5255
|
+
]
|
|
5256
|
+
}
|
|
5257
|
+
},
|
|
5190
5258
|
{
|
|
5191
5259
|
name: "payer",
|
|
5192
5260
|
writable: true,
|
|
@@ -5386,7 +5454,7 @@ var jbond_default = {
|
|
|
5386
5454
|
"",
|
|
5387
5455
|
"This function should be called at epoch boundaries to update the bond's",
|
|
5388
5456
|
"`last_update_epoch` and move the `next_epoch_locked` amount into",
|
|
5389
|
-
"`
|
|
5457
|
+
"`locked`. It ensures that the update only occurs once per epoch.",
|
|
5390
5458
|
"",
|
|
5391
5459
|
"# Errors",
|
|
5392
5460
|
"Returns [`BondError::InvalidEpoch`] if called more than once in the same epoch,",
|
|
@@ -6414,16 +6482,16 @@ var jbond_default = {
|
|
|
6414
6482
|
type: "u8"
|
|
6415
6483
|
},
|
|
6416
6484
|
{
|
|
6417
|
-
name: "
|
|
6485
|
+
name: "locked",
|
|
6418
6486
|
docs: [
|
|
6419
|
-
"Amount of collateral locked
|
|
6487
|
+
"Amount of collateral currently locked"
|
|
6420
6488
|
],
|
|
6421
6489
|
type: "u64"
|
|
6422
6490
|
},
|
|
6423
6491
|
{
|
|
6424
|
-
name: "
|
|
6492
|
+
name: "next_epoch_locked",
|
|
6425
6493
|
docs: [
|
|
6426
|
-
"Amount of collateral locked for the
|
|
6494
|
+
"Amount of collateral locked for the next epoch"
|
|
6427
6495
|
],
|
|
6428
6496
|
type: "u64"
|
|
6429
6497
|
},
|
|
@@ -7108,8 +7176,10 @@ var JBondClient = class _JBondClient {
|
|
|
7108
7176
|
*/
|
|
7109
7177
|
async getReleaseFundsIx(props) {
|
|
7110
7178
|
const { bondType, name, voteAccount, amount, withdrawAuthority } = props;
|
|
7179
|
+
const [bondState] = this.pda.bondState(bondType, name);
|
|
7111
7180
|
const [validatorBond] = this.pda.validatorBond(bondType, name, voteAccount);
|
|
7112
7181
|
const accounts = {
|
|
7182
|
+
bondState,
|
|
7113
7183
|
validatorBond,
|
|
7114
7184
|
payer: withdrawAuthority
|
|
7115
7185
|
};
|
|
@@ -7120,7 +7190,7 @@ var JBondClient = class _JBondClient {
|
|
|
7120
7190
|
*/
|
|
7121
7191
|
async getAvailableCollateral(bondType, bondName, voteAccount) {
|
|
7122
7192
|
const validatorBond = await this.getValidatorBond(bondType, bondName, voteAccount);
|
|
7123
|
-
return await this.getValidatorBondBalance(bondType, bondName, voteAccount) - validatorBond.
|
|
7193
|
+
return await this.getValidatorBondBalance(bondType, bondName, voteAccount) - validatorBond.locked.toNumber();
|
|
7124
7194
|
}
|
|
7125
7195
|
/**
|
|
7126
7196
|
* Get all bond states with total collected collateral
|