@jpool/bond-sdk 0.11.0-next.8 → 0.11.1
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 +505 -194
- package/dist/index.d.ts +505 -194
- package/dist/index.js +543 -207
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +540 -206
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { utils,
|
|
1
|
+
import { utils, AnchorProvider, Program, BN } from '@coral-xyz/anchor';
|
|
2
2
|
import { getAssociatedTokenAddressSync, ACCOUNT_SIZE, AccountLayout } from '@solana/spl-token';
|
|
3
3
|
import { PublicKey, Transaction, LAMPORTS_PER_SOL } from '@solana/web3.js';
|
|
4
4
|
|
|
@@ -4547,17 +4547,13 @@ var require_bn = __commonJS({
|
|
|
4547
4547
|
// src/client.ts
|
|
4548
4548
|
var import_bn = __toESM(require_bn());
|
|
4549
4549
|
|
|
4550
|
-
// src/constants.ts
|
|
4551
|
-
var GLOBAL_STATE_SEED = "global_state";
|
|
4552
|
-
var BOND_STATE_SEED = "bond_state";
|
|
4553
|
-
var VALIDATOR_BOND_SEED = "validator_bond";
|
|
4554
|
-
var STANDARD_BOND_SEED = "standard";
|
|
4555
|
-
var CROWDFUNDING_BOND_SEED = "crowdfunding";
|
|
4556
|
-
var ENV_PROGRAM_ID = {
|
|
4557
|
-
// [BondClientEnv.DEV]: new PublicKey('...'),
|
|
4558
|
-
};
|
|
4559
|
-
|
|
4560
4550
|
// src/types/index.ts
|
|
4551
|
+
var JBondClientEnv = /* @__PURE__ */ ((JBondClientEnv2) => {
|
|
4552
|
+
JBondClientEnv2["DEV"] = "dev";
|
|
4553
|
+
JBondClientEnv2["STAGE"] = "stage";
|
|
4554
|
+
JBondClientEnv2["PROD"] = "prod";
|
|
4555
|
+
return JBondClientEnv2;
|
|
4556
|
+
})(JBondClientEnv || {});
|
|
4561
4557
|
var SessionStatus = /* @__PURE__ */ ((SessionStatus2) => {
|
|
4562
4558
|
SessionStatus2[SessionStatus2["Live"] = 0] = "Live";
|
|
4563
4559
|
SessionStatus2[SessionStatus2["Finished"] = 1] = "Finished";
|
|
@@ -4575,7 +4571,17 @@ var BondTransactionType = /* @__PURE__ */ ((BondTransactionType2) => {
|
|
|
4575
4571
|
return BondTransactionType2;
|
|
4576
4572
|
})(BondTransactionType || {});
|
|
4577
4573
|
|
|
4578
|
-
// src/
|
|
4574
|
+
// src/constants.ts
|
|
4575
|
+
var GLOBAL_STATE_SEED = "global_state";
|
|
4576
|
+
var BOND_STATE_SEED = "bond_state";
|
|
4577
|
+
var VALIDATOR_BOND_SEED = "validator_bond";
|
|
4578
|
+
var STANDARD_BOND_SEED = "standard";
|
|
4579
|
+
var CROWDFUNDING_BOND_SEED = "crowdfunding";
|
|
4580
|
+
var ENV_PROGRAM_ID = {
|
|
4581
|
+
["dev" /* DEV */]: "Fo17edWRJewZNTRibgx9iTfjywCW6dzS81VwBLmPFVq1",
|
|
4582
|
+
["stage" /* STAGE */]: "Fo17edWRJewZNTRibgx9iTfjywCW6dzS81VwBLmPFVq1",
|
|
4583
|
+
["prod" /* PROD */]: "BondQ7KqZreTcW2UbeTNDcLCJQ3aXAtLn2Fm6ftaJDU"
|
|
4584
|
+
};
|
|
4579
4585
|
var { bs58 } = utils.bytes;
|
|
4580
4586
|
var HistoryManager = class {
|
|
4581
4587
|
constructor(client) {
|
|
@@ -4735,10 +4741,10 @@ function slotToEpoch(slot, cluster) {
|
|
|
4735
4741
|
|
|
4736
4742
|
// src/idl/jbond.json
|
|
4737
4743
|
var jbond_default = {
|
|
4738
|
-
address: "
|
|
4744
|
+
address: "BondQ7KqZreTcW2UbeTNDcLCJQ3aXAtLn2Fm6ftaJDU",
|
|
4739
4745
|
metadata: {
|
|
4740
4746
|
name: "jbond",
|
|
4741
|
-
version: "0.2.
|
|
4747
|
+
version: "0.2.5",
|
|
4742
4748
|
spec: "0.1.0",
|
|
4743
4749
|
description: "Jpool Bond Program"
|
|
4744
4750
|
},
|
|
@@ -4813,7 +4819,10 @@ var jbond_default = {
|
|
|
4813
4819
|
},
|
|
4814
4820
|
{
|
|
4815
4821
|
name: "authority",
|
|
4816
|
-
signer: true
|
|
4822
|
+
signer: true,
|
|
4823
|
+
relations: [
|
|
4824
|
+
"bond_state"
|
|
4825
|
+
]
|
|
4817
4826
|
},
|
|
4818
4827
|
{
|
|
4819
4828
|
name: "bond_token_account",
|
|
@@ -4987,10 +4996,12 @@ var jbond_default = {
|
|
|
4987
4996
|
{
|
|
4988
4997
|
name: "bond_lock_funds",
|
|
4989
4998
|
docs: [
|
|
4990
|
-
"Locks funds
|
|
4991
|
-
"
|
|
4999
|
+
"Locks funds immediately, making them unavailable for withdrawal.",
|
|
5000
|
+
"The locked amount takes effect immediately in the current epoch.",
|
|
5001
|
+
"",
|
|
4992
5002
|
"# Errors",
|
|
4993
|
-
"Fails if the
|
|
5003
|
+
"Fails if the bond type is not lockable, if the amount is zero,",
|
|
5004
|
+
"or if there are insufficient available funds."
|
|
4994
5005
|
],
|
|
4995
5006
|
discriminator: [
|
|
4996
5007
|
117,
|
|
@@ -5009,7 +5020,39 @@ var jbond_default = {
|
|
|
5009
5020
|
},
|
|
5010
5021
|
{
|
|
5011
5022
|
name: "validator_bond",
|
|
5012
|
-
writable: true
|
|
5023
|
+
writable: true,
|
|
5024
|
+
pda: {
|
|
5025
|
+
seeds: [
|
|
5026
|
+
{
|
|
5027
|
+
kind: "const",
|
|
5028
|
+
value: [
|
|
5029
|
+
118,
|
|
5030
|
+
97,
|
|
5031
|
+
108,
|
|
5032
|
+
105,
|
|
5033
|
+
100,
|
|
5034
|
+
97,
|
|
5035
|
+
116,
|
|
5036
|
+
111,
|
|
5037
|
+
114,
|
|
5038
|
+
95,
|
|
5039
|
+
98,
|
|
5040
|
+
111,
|
|
5041
|
+
110,
|
|
5042
|
+
100
|
|
5043
|
+
]
|
|
5044
|
+
},
|
|
5045
|
+
{
|
|
5046
|
+
kind: "account",
|
|
5047
|
+
path: "bond_state"
|
|
5048
|
+
},
|
|
5049
|
+
{
|
|
5050
|
+
kind: "account",
|
|
5051
|
+
path: "validator_bond.vote_account",
|
|
5052
|
+
account: "ValidatorBond"
|
|
5053
|
+
}
|
|
5054
|
+
]
|
|
5055
|
+
}
|
|
5013
5056
|
},
|
|
5014
5057
|
{
|
|
5015
5058
|
name: "bond_token_account",
|
|
@@ -5055,7 +5098,34 @@ var jbond_default = {
|
|
|
5055
5098
|
accounts: [
|
|
5056
5099
|
{
|
|
5057
5100
|
name: "bond_state",
|
|
5058
|
-
writable: true
|
|
5101
|
+
writable: true,
|
|
5102
|
+
pda: {
|
|
5103
|
+
seeds: [
|
|
5104
|
+
{
|
|
5105
|
+
kind: "const",
|
|
5106
|
+
value: [
|
|
5107
|
+
98,
|
|
5108
|
+
111,
|
|
5109
|
+
110,
|
|
5110
|
+
100,
|
|
5111
|
+
95,
|
|
5112
|
+
115,
|
|
5113
|
+
116,
|
|
5114
|
+
97,
|
|
5115
|
+
116,
|
|
5116
|
+
101
|
|
5117
|
+
]
|
|
5118
|
+
},
|
|
5119
|
+
{
|
|
5120
|
+
kind: "arg",
|
|
5121
|
+
path: "bond_type"
|
|
5122
|
+
},
|
|
5123
|
+
{
|
|
5124
|
+
kind: "arg",
|
|
5125
|
+
path: "bond_name"
|
|
5126
|
+
}
|
|
5127
|
+
]
|
|
5128
|
+
}
|
|
5059
5129
|
},
|
|
5060
5130
|
{
|
|
5061
5131
|
name: "validator_bond",
|
|
@@ -5143,10 +5213,13 @@ var jbond_default = {
|
|
|
5143
5213
|
{
|
|
5144
5214
|
name: "bond_release_funds",
|
|
5145
5215
|
docs: [
|
|
5146
|
-
"
|
|
5147
|
-
"
|
|
5216
|
+
"Queues funds for unlock in the next epoch.",
|
|
5217
|
+
"The unlock is delayed by one epoch for security - funds remain locked",
|
|
5218
|
+
"in the current epoch but will be available after epoch transition.",
|
|
5219
|
+
"",
|
|
5148
5220
|
"# Errors",
|
|
5149
|
-
"Fails if the
|
|
5221
|
+
"Fails if the bond type is not lockable, if the amount is zero,",
|
|
5222
|
+
"or if the amount exceeds currently locked funds."
|
|
5150
5223
|
],
|
|
5151
5224
|
discriminator: [
|
|
5152
5225
|
184,
|
|
@@ -5160,9 +5233,45 @@ var jbond_default = {
|
|
|
5160
5233
|
],
|
|
5161
5234
|
accounts: [
|
|
5162
5235
|
{
|
|
5163
|
-
name: "
|
|
5236
|
+
name: "bond_state",
|
|
5164
5237
|
writable: true
|
|
5165
5238
|
},
|
|
5239
|
+
{
|
|
5240
|
+
name: "validator_bond",
|
|
5241
|
+
writable: true,
|
|
5242
|
+
pda: {
|
|
5243
|
+
seeds: [
|
|
5244
|
+
{
|
|
5245
|
+
kind: "const",
|
|
5246
|
+
value: [
|
|
5247
|
+
118,
|
|
5248
|
+
97,
|
|
5249
|
+
108,
|
|
5250
|
+
105,
|
|
5251
|
+
100,
|
|
5252
|
+
97,
|
|
5253
|
+
116,
|
|
5254
|
+
111,
|
|
5255
|
+
114,
|
|
5256
|
+
95,
|
|
5257
|
+
98,
|
|
5258
|
+
111,
|
|
5259
|
+
110,
|
|
5260
|
+
100
|
|
5261
|
+
]
|
|
5262
|
+
},
|
|
5263
|
+
{
|
|
5264
|
+
kind: "account",
|
|
5265
|
+
path: "bond_state"
|
|
5266
|
+
},
|
|
5267
|
+
{
|
|
5268
|
+
kind: "account",
|
|
5269
|
+
path: "validator_bond.vote_account",
|
|
5270
|
+
account: "ValidatorBond"
|
|
5271
|
+
}
|
|
5272
|
+
]
|
|
5273
|
+
}
|
|
5274
|
+
},
|
|
5166
5275
|
{
|
|
5167
5276
|
name: "payer",
|
|
5168
5277
|
writable: true,
|
|
@@ -5176,6 +5285,37 @@ var jbond_default = {
|
|
|
5176
5285
|
}
|
|
5177
5286
|
]
|
|
5178
5287
|
},
|
|
5288
|
+
{
|
|
5289
|
+
name: "bond_remove",
|
|
5290
|
+
docs: [
|
|
5291
|
+
"Removes bond state"
|
|
5292
|
+
],
|
|
5293
|
+
discriminator: [
|
|
5294
|
+
121,
|
|
5295
|
+
112,
|
|
5296
|
+
246,
|
|
5297
|
+
177,
|
|
5298
|
+
181,
|
|
5299
|
+
8,
|
|
5300
|
+
18,
|
|
5301
|
+
220
|
|
5302
|
+
],
|
|
5303
|
+
accounts: [
|
|
5304
|
+
{
|
|
5305
|
+
name: "bond_state",
|
|
5306
|
+
writable: true
|
|
5307
|
+
},
|
|
5308
|
+
{
|
|
5309
|
+
name: "authority",
|
|
5310
|
+
writable: true,
|
|
5311
|
+
signer: true,
|
|
5312
|
+
relations: [
|
|
5313
|
+
"bond_state"
|
|
5314
|
+
]
|
|
5315
|
+
}
|
|
5316
|
+
],
|
|
5317
|
+
args: []
|
|
5318
|
+
},
|
|
5179
5319
|
{
|
|
5180
5320
|
name: "bond_set_withdraw_authority",
|
|
5181
5321
|
docs: [
|
|
@@ -5358,15 +5498,12 @@ var jbond_default = {
|
|
|
5358
5498
|
{
|
|
5359
5499
|
name: "bond_update",
|
|
5360
5500
|
docs: [
|
|
5361
|
-
"
|
|
5501
|
+
"Applies any pending unlocks from previous epochs.",
|
|
5362
5502
|
"",
|
|
5363
|
-
"This
|
|
5364
|
-
"
|
|
5365
|
-
"
|
|
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."
|
|
5503
|
+
"This instruction is optional - all other operations now automatically",
|
|
5504
|
+
"sync the epoch state. It is kept for backwards compatibility and can",
|
|
5505
|
+
"be used to explicitly trigger epoch synchronization without performing",
|
|
5506
|
+
"another operation."
|
|
5370
5507
|
],
|
|
5371
5508
|
discriminator: [
|
|
5372
5509
|
237,
|
|
@@ -5385,7 +5522,6 @@ var jbond_default = {
|
|
|
5385
5522
|
},
|
|
5386
5523
|
{
|
|
5387
5524
|
name: "payer",
|
|
5388
|
-
writable: true,
|
|
5389
5525
|
signer: true
|
|
5390
5526
|
}
|
|
5391
5527
|
],
|
|
@@ -5608,80 +5744,6 @@ var jbond_default = {
|
|
|
5608
5744
|
],
|
|
5609
5745
|
args: []
|
|
5610
5746
|
},
|
|
5611
|
-
{
|
|
5612
|
-
name: "migrate_bond",
|
|
5613
|
-
docs: [
|
|
5614
|
-
"Migrates validator bond data from legacy structure to new structure."
|
|
5615
|
-
],
|
|
5616
|
-
discriminator: [
|
|
5617
|
-
107,
|
|
5618
|
-
119,
|
|
5619
|
-
59,
|
|
5620
|
-
110,
|
|
5621
|
-
76,
|
|
5622
|
-
18,
|
|
5623
|
-
37,
|
|
5624
|
-
163
|
|
5625
|
-
],
|
|
5626
|
-
accounts: [
|
|
5627
|
-
{
|
|
5628
|
-
name: "bond_state",
|
|
5629
|
-
writable: true
|
|
5630
|
-
},
|
|
5631
|
-
{
|
|
5632
|
-
name: "legacy_validator_bond",
|
|
5633
|
-
writable: true
|
|
5634
|
-
},
|
|
5635
|
-
{
|
|
5636
|
-
name: "legacy_vote_account"
|
|
5637
|
-
},
|
|
5638
|
-
{
|
|
5639
|
-
name: "validator_bond",
|
|
5640
|
-
writable: true,
|
|
5641
|
-
pda: {
|
|
5642
|
-
seeds: [
|
|
5643
|
-
{
|
|
5644
|
-
kind: "const",
|
|
5645
|
-
value: [
|
|
5646
|
-
118,
|
|
5647
|
-
97,
|
|
5648
|
-
108,
|
|
5649
|
-
105,
|
|
5650
|
-
100,
|
|
5651
|
-
97,
|
|
5652
|
-
116,
|
|
5653
|
-
111,
|
|
5654
|
-
114,
|
|
5655
|
-
95,
|
|
5656
|
-
98,
|
|
5657
|
-
111,
|
|
5658
|
-
110,
|
|
5659
|
-
100
|
|
5660
|
-
]
|
|
5661
|
-
},
|
|
5662
|
-
{
|
|
5663
|
-
kind: "account",
|
|
5664
|
-
path: "bond_state"
|
|
5665
|
-
},
|
|
5666
|
-
{
|
|
5667
|
-
kind: "account",
|
|
5668
|
-
path: "legacy_vote_account"
|
|
5669
|
-
}
|
|
5670
|
-
]
|
|
5671
|
-
}
|
|
5672
|
-
},
|
|
5673
|
-
{
|
|
5674
|
-
name: "creator",
|
|
5675
|
-
writable: true,
|
|
5676
|
-
signer: true
|
|
5677
|
-
},
|
|
5678
|
-
{
|
|
5679
|
-
name: "system_program",
|
|
5680
|
-
address: "11111111111111111111111111111111"
|
|
5681
|
-
}
|
|
5682
|
-
],
|
|
5683
|
-
args: []
|
|
5684
|
-
},
|
|
5685
5747
|
{
|
|
5686
5748
|
name: "session_finish",
|
|
5687
5749
|
docs: [
|
|
@@ -5792,6 +5854,19 @@ var jbond_default = {
|
|
|
5792
5854
|
}
|
|
5793
5855
|
],
|
|
5794
5856
|
events: [
|
|
5857
|
+
{
|
|
5858
|
+
name: "BondConfigured",
|
|
5859
|
+
discriminator: [
|
|
5860
|
+
141,
|
|
5861
|
+
252,
|
|
5862
|
+
43,
|
|
5863
|
+
54,
|
|
5864
|
+
45,
|
|
5865
|
+
157,
|
|
5866
|
+
81,
|
|
5867
|
+
14
|
|
5868
|
+
]
|
|
5869
|
+
},
|
|
5795
5870
|
{
|
|
5796
5871
|
name: "BondFinished",
|
|
5797
5872
|
discriminator: [
|
|
@@ -5805,6 +5880,32 @@ var jbond_default = {
|
|
|
5805
5880
|
191
|
|
5806
5881
|
]
|
|
5807
5882
|
},
|
|
5883
|
+
{
|
|
5884
|
+
name: "BondInitialized",
|
|
5885
|
+
discriminator: [
|
|
5886
|
+
73,
|
|
5887
|
+
68,
|
|
5888
|
+
161,
|
|
5889
|
+
2,
|
|
5890
|
+
214,
|
|
5891
|
+
12,
|
|
5892
|
+
169,
|
|
5893
|
+
53
|
|
5894
|
+
]
|
|
5895
|
+
},
|
|
5896
|
+
{
|
|
5897
|
+
name: "BondRemoved",
|
|
5898
|
+
discriminator: [
|
|
5899
|
+
177,
|
|
5900
|
+
200,
|
|
5901
|
+
116,
|
|
5902
|
+
123,
|
|
5903
|
+
1,
|
|
5904
|
+
244,
|
|
5905
|
+
161,
|
|
5906
|
+
240
|
|
5907
|
+
]
|
|
5908
|
+
},
|
|
5808
5909
|
{
|
|
5809
5910
|
name: "BondStarted",
|
|
5810
5911
|
discriminator: [
|
|
@@ -5819,16 +5920,16 @@ var jbond_default = {
|
|
|
5819
5920
|
]
|
|
5820
5921
|
},
|
|
5821
5922
|
{
|
|
5822
|
-
name: "
|
|
5923
|
+
name: "CollateralDeposited",
|
|
5823
5924
|
discriminator: [
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
|
|
5925
|
+
244,
|
|
5926
|
+
62,
|
|
5927
|
+
77,
|
|
5928
|
+
11,
|
|
5828
5929
|
135,
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5930
|
+
112,
|
|
5931
|
+
61,
|
|
5932
|
+
96
|
|
5832
5933
|
]
|
|
5833
5934
|
},
|
|
5834
5935
|
{
|
|
@@ -5844,6 +5945,19 @@ var jbond_default = {
|
|
|
5844
5945
|
82
|
|
5845
5946
|
]
|
|
5846
5947
|
},
|
|
5948
|
+
{
|
|
5949
|
+
name: "CompensationBurned",
|
|
5950
|
+
discriminator: [
|
|
5951
|
+
177,
|
|
5952
|
+
198,
|
|
5953
|
+
90,
|
|
5954
|
+
188,
|
|
5955
|
+
47,
|
|
5956
|
+
95,
|
|
5957
|
+
20,
|
|
5958
|
+
174
|
|
5959
|
+
]
|
|
5960
|
+
},
|
|
5847
5961
|
{
|
|
5848
5962
|
name: "CompensationClaimed",
|
|
5849
5963
|
discriminator: [
|
|
@@ -5857,6 +5971,32 @@ var jbond_default = {
|
|
|
5857
5971
|
32
|
|
5858
5972
|
]
|
|
5859
5973
|
},
|
|
5974
|
+
{
|
|
5975
|
+
name: "FundsLocked",
|
|
5976
|
+
discriminator: [
|
|
5977
|
+
227,
|
|
5978
|
+
93,
|
|
5979
|
+
162,
|
|
5980
|
+
69,
|
|
5981
|
+
181,
|
|
5982
|
+
4,
|
|
5983
|
+
71,
|
|
5984
|
+
157
|
|
5985
|
+
]
|
|
5986
|
+
},
|
|
5987
|
+
{
|
|
5988
|
+
name: "FundsUnlocked",
|
|
5989
|
+
discriminator: [
|
|
5990
|
+
11,
|
|
5991
|
+
240,
|
|
5992
|
+
184,
|
|
5993
|
+
107,
|
|
5994
|
+
86,
|
|
5995
|
+
187,
|
|
5996
|
+
196,
|
|
5997
|
+
128
|
|
5998
|
+
]
|
|
5999
|
+
},
|
|
5860
6000
|
{
|
|
5861
6001
|
name: "ValidatorRegistered",
|
|
5862
6002
|
discriminator: [
|
|
@@ -5869,33 +6009,46 @@ var jbond_default = {
|
|
|
5869
6009
|
95,
|
|
5870
6010
|
72
|
|
5871
6011
|
]
|
|
6012
|
+
},
|
|
6013
|
+
{
|
|
6014
|
+
name: "WithdrawAuthorityChanged",
|
|
6015
|
+
discriminator: [
|
|
6016
|
+
91,
|
|
6017
|
+
149,
|
|
6018
|
+
224,
|
|
6019
|
+
49,
|
|
6020
|
+
187,
|
|
6021
|
+
48,
|
|
6022
|
+
190,
|
|
6023
|
+
100
|
|
6024
|
+
]
|
|
5872
6025
|
}
|
|
5873
6026
|
],
|
|
5874
6027
|
errors: [
|
|
5875
6028
|
{
|
|
5876
6029
|
code: 6e3,
|
|
5877
|
-
name: "
|
|
5878
|
-
msg: "
|
|
6030
|
+
name: "Forbidden",
|
|
6031
|
+
msg: "Forbidden"
|
|
5879
6032
|
},
|
|
5880
6033
|
{
|
|
5881
6034
|
code: 6001,
|
|
5882
|
-
name: "
|
|
5883
|
-
msg: "
|
|
6035
|
+
name: "Unauthorized",
|
|
6036
|
+
msg: "Unauthorized"
|
|
5884
6037
|
},
|
|
5885
6038
|
{
|
|
5886
6039
|
code: 6002,
|
|
5887
|
-
name: "
|
|
5888
|
-
msg: "
|
|
6040
|
+
name: "InvalidVoteAccount",
|
|
6041
|
+
msg: "Invalid vote account"
|
|
5889
6042
|
},
|
|
5890
6043
|
{
|
|
5891
6044
|
code: 6003,
|
|
5892
|
-
name: "
|
|
5893
|
-
msg: "
|
|
6045
|
+
name: "IdentityMismatch",
|
|
6046
|
+
msg: "Vote account identity mismatch"
|
|
5894
6047
|
},
|
|
5895
6048
|
{
|
|
5896
6049
|
code: 6004,
|
|
5897
|
-
name: "
|
|
5898
|
-
msg: "
|
|
6050
|
+
name: "InvalidMint",
|
|
6051
|
+
msg: "Invalid mint address"
|
|
5899
6052
|
},
|
|
5900
6053
|
{
|
|
5901
6054
|
code: 6005,
|
|
@@ -5904,98 +6057,53 @@ var jbond_default = {
|
|
|
5904
6057
|
},
|
|
5905
6058
|
{
|
|
5906
6059
|
code: 6006,
|
|
5907
|
-
name: "
|
|
5908
|
-
msg: "
|
|
6060
|
+
name: "InvalidArgument",
|
|
6061
|
+
msg: "Invalid argument"
|
|
5909
6062
|
},
|
|
5910
6063
|
{
|
|
5911
6064
|
code: 6007,
|
|
5912
|
-
name: "
|
|
5913
|
-
msg: "
|
|
6065
|
+
name: "InsufficientBalance",
|
|
6066
|
+
msg: "Insufficient balance"
|
|
5914
6067
|
},
|
|
5915
6068
|
{
|
|
5916
6069
|
code: 6008,
|
|
5917
|
-
name: "
|
|
5918
|
-
msg: "
|
|
6070
|
+
name: "MathOverflow",
|
|
6071
|
+
msg: "Math overflow"
|
|
5919
6072
|
},
|
|
5920
6073
|
{
|
|
5921
6074
|
code: 6009,
|
|
5922
|
-
name: "
|
|
5923
|
-
msg: "
|
|
6075
|
+
name: "Overflow",
|
|
6076
|
+
msg: "Arithmetic overflow"
|
|
5924
6077
|
},
|
|
5925
6078
|
{
|
|
5926
6079
|
code: 6010,
|
|
5927
|
-
name: "
|
|
5928
|
-
msg: "
|
|
6080
|
+
name: "BondNotRemovable",
|
|
6081
|
+
msg: "Bond cannot be removed"
|
|
5929
6082
|
},
|
|
5930
6083
|
{
|
|
5931
6084
|
code: 6011,
|
|
5932
|
-
name: "
|
|
5933
|
-
msg: "
|
|
6085
|
+
name: "MissingTokenAccounts",
|
|
6086
|
+
msg: "Missing token accounts"
|
|
5934
6087
|
},
|
|
5935
6088
|
{
|
|
5936
6089
|
code: 6012,
|
|
5937
|
-
name: "
|
|
5938
|
-
msg: "
|
|
6090
|
+
name: "MissingTokenProgram",
|
|
6091
|
+
msg: "Missing token program"
|
|
5939
6092
|
},
|
|
5940
6093
|
{
|
|
5941
6094
|
code: 6013,
|
|
5942
6095
|
name: "MissingStakeAccount",
|
|
5943
|
-
msg: "
|
|
6096
|
+
msg: "Missing stake account"
|
|
5944
6097
|
},
|
|
5945
6098
|
{
|
|
5946
6099
|
code: 6014,
|
|
5947
6100
|
name: "MissingStakeProgram",
|
|
5948
|
-
msg: "
|
|
6101
|
+
msg: "Missing stake program"
|
|
5949
6102
|
},
|
|
5950
6103
|
{
|
|
5951
6104
|
code: 6015,
|
|
5952
|
-
name: "BondFinished",
|
|
5953
|
-
msg: "Bond is finished (deposits/withdrawals disabled)"
|
|
5954
|
-
},
|
|
5955
|
-
{
|
|
5956
|
-
code: 6016,
|
|
5957
|
-
name: "BondNotFinished",
|
|
5958
|
-
msg: "Bond is not finished"
|
|
5959
|
-
},
|
|
5960
|
-
{
|
|
5961
|
-
code: 6017,
|
|
5962
6105
|
name: "UnsupportedCollateralType",
|
|
5963
6106
|
msg: "Unsupported collateral type"
|
|
5964
|
-
},
|
|
5965
|
-
{
|
|
5966
|
-
code: 6018,
|
|
5967
|
-
name: "Overflow",
|
|
5968
|
-
msg: "Math operation overflowed"
|
|
5969
|
-
},
|
|
5970
|
-
{
|
|
5971
|
-
code: 6019,
|
|
5972
|
-
name: "IncorrectBondType",
|
|
5973
|
-
msg: "Incorrect bond type for this operation"
|
|
5974
|
-
},
|
|
5975
|
-
{
|
|
5976
|
-
code: 6020,
|
|
5977
|
-
name: "BondNotFinishable",
|
|
5978
|
-
msg: "This bond type can't be finished"
|
|
5979
|
-
},
|
|
5980
|
-
{
|
|
5981
|
-
code: 6021,
|
|
5982
|
-
name: "InvalidArgument",
|
|
5983
|
-
msg: "Invalid argument provided"
|
|
5984
|
-
},
|
|
5985
|
-
{
|
|
5986
|
-
code: 6022,
|
|
5987
|
-
name: "BondNotDisabled",
|
|
5988
|
-
msg: "Bond is not disabled"
|
|
5989
|
-
},
|
|
5990
|
-
{
|
|
5991
|
-
code: 6023,
|
|
5992
|
-
name: "BondNotEnabled",
|
|
5993
|
-
msg: "Bond is not enabled"
|
|
5994
|
-
},
|
|
5995
|
-
{
|
|
5996
|
-
code: 6024,
|
|
5997
|
-
name: "InvalidEpoch",
|
|
5998
|
-
msg: "Invalid epoch for this operation"
|
|
5999
6107
|
}
|
|
6000
6108
|
],
|
|
6001
6109
|
types: [
|
|
@@ -6029,6 +6137,26 @@ var jbond_default = {
|
|
|
6029
6137
|
]
|
|
6030
6138
|
}
|
|
6031
6139
|
},
|
|
6140
|
+
{
|
|
6141
|
+
name: "BondConfigured",
|
|
6142
|
+
type: {
|
|
6143
|
+
kind: "struct",
|
|
6144
|
+
fields: [
|
|
6145
|
+
{
|
|
6146
|
+
name: "bond",
|
|
6147
|
+
type: "pubkey"
|
|
6148
|
+
},
|
|
6149
|
+
{
|
|
6150
|
+
name: "authority",
|
|
6151
|
+
type: "pubkey"
|
|
6152
|
+
},
|
|
6153
|
+
{
|
|
6154
|
+
name: "timestamp",
|
|
6155
|
+
type: "i64"
|
|
6156
|
+
}
|
|
6157
|
+
]
|
|
6158
|
+
}
|
|
6159
|
+
},
|
|
6032
6160
|
{
|
|
6033
6161
|
name: "BondFinished",
|
|
6034
6162
|
type: {
|
|
@@ -6084,6 +6212,46 @@ var jbond_default = {
|
|
|
6084
6212
|
]
|
|
6085
6213
|
}
|
|
6086
6214
|
},
|
|
6215
|
+
{
|
|
6216
|
+
name: "BondInitialized",
|
|
6217
|
+
type: {
|
|
6218
|
+
kind: "struct",
|
|
6219
|
+
fields: [
|
|
6220
|
+
{
|
|
6221
|
+
name: "bond",
|
|
6222
|
+
type: "pubkey"
|
|
6223
|
+
},
|
|
6224
|
+
{
|
|
6225
|
+
name: "authority",
|
|
6226
|
+
type: "pubkey"
|
|
6227
|
+
},
|
|
6228
|
+
{
|
|
6229
|
+
name: "timestamp",
|
|
6230
|
+
type: "i64"
|
|
6231
|
+
}
|
|
6232
|
+
]
|
|
6233
|
+
}
|
|
6234
|
+
},
|
|
6235
|
+
{
|
|
6236
|
+
name: "BondRemoved",
|
|
6237
|
+
type: {
|
|
6238
|
+
kind: "struct",
|
|
6239
|
+
fields: [
|
|
6240
|
+
{
|
|
6241
|
+
name: "bond",
|
|
6242
|
+
type: "pubkey"
|
|
6243
|
+
},
|
|
6244
|
+
{
|
|
6245
|
+
name: "authority",
|
|
6246
|
+
type: "pubkey"
|
|
6247
|
+
},
|
|
6248
|
+
{
|
|
6249
|
+
name: "timestamp",
|
|
6250
|
+
type: "i64"
|
|
6251
|
+
}
|
|
6252
|
+
]
|
|
6253
|
+
}
|
|
6254
|
+
},
|
|
6087
6255
|
{
|
|
6088
6256
|
name: "BondStarted",
|
|
6089
6257
|
type: {
|
|
@@ -6237,7 +6405,7 @@ var jbond_default = {
|
|
|
6237
6405
|
}
|
|
6238
6406
|
},
|
|
6239
6407
|
{
|
|
6240
|
-
name: "
|
|
6408
|
+
name: "CollateralDeposited",
|
|
6241
6409
|
type: {
|
|
6242
6410
|
kind: "struct",
|
|
6243
6411
|
fields: [
|
|
@@ -6307,6 +6475,34 @@ var jbond_default = {
|
|
|
6307
6475
|
]
|
|
6308
6476
|
}
|
|
6309
6477
|
},
|
|
6478
|
+
{
|
|
6479
|
+
name: "CompensationBurned",
|
|
6480
|
+
type: {
|
|
6481
|
+
kind: "struct",
|
|
6482
|
+
fields: [
|
|
6483
|
+
{
|
|
6484
|
+
name: "validator",
|
|
6485
|
+
type: "pubkey"
|
|
6486
|
+
},
|
|
6487
|
+
{
|
|
6488
|
+
name: "amount",
|
|
6489
|
+
type: "u64"
|
|
6490
|
+
},
|
|
6491
|
+
{
|
|
6492
|
+
name: "post_balance",
|
|
6493
|
+
type: "u64"
|
|
6494
|
+
},
|
|
6495
|
+
{
|
|
6496
|
+
name: "epoch",
|
|
6497
|
+
type: "u64"
|
|
6498
|
+
},
|
|
6499
|
+
{
|
|
6500
|
+
name: "timestamp",
|
|
6501
|
+
type: "i64"
|
|
6502
|
+
}
|
|
6503
|
+
]
|
|
6504
|
+
}
|
|
6505
|
+
},
|
|
6310
6506
|
{
|
|
6311
6507
|
name: "CompensationClaimed",
|
|
6312
6508
|
type: {
|
|
@@ -6335,6 +6531,54 @@ var jbond_default = {
|
|
|
6335
6531
|
]
|
|
6336
6532
|
}
|
|
6337
6533
|
},
|
|
6534
|
+
{
|
|
6535
|
+
name: "FundsLocked",
|
|
6536
|
+
type: {
|
|
6537
|
+
kind: "struct",
|
|
6538
|
+
fields: [
|
|
6539
|
+
{
|
|
6540
|
+
name: "validator",
|
|
6541
|
+
type: "pubkey"
|
|
6542
|
+
},
|
|
6543
|
+
{
|
|
6544
|
+
name: "amount",
|
|
6545
|
+
type: "u64"
|
|
6546
|
+
},
|
|
6547
|
+
{
|
|
6548
|
+
name: "total_locked",
|
|
6549
|
+
type: "u64"
|
|
6550
|
+
},
|
|
6551
|
+
{
|
|
6552
|
+
name: "epoch",
|
|
6553
|
+
type: "u64"
|
|
6554
|
+
}
|
|
6555
|
+
]
|
|
6556
|
+
}
|
|
6557
|
+
},
|
|
6558
|
+
{
|
|
6559
|
+
name: "FundsUnlocked",
|
|
6560
|
+
type: {
|
|
6561
|
+
kind: "struct",
|
|
6562
|
+
fields: [
|
|
6563
|
+
{
|
|
6564
|
+
name: "validator",
|
|
6565
|
+
type: "pubkey"
|
|
6566
|
+
},
|
|
6567
|
+
{
|
|
6568
|
+
name: "amount",
|
|
6569
|
+
type: "u64"
|
|
6570
|
+
},
|
|
6571
|
+
{
|
|
6572
|
+
name: "pending_unlock",
|
|
6573
|
+
type: "u64"
|
|
6574
|
+
},
|
|
6575
|
+
{
|
|
6576
|
+
name: "epoch",
|
|
6577
|
+
type: "u64"
|
|
6578
|
+
}
|
|
6579
|
+
]
|
|
6580
|
+
}
|
|
6581
|
+
},
|
|
6338
6582
|
{
|
|
6339
6583
|
name: "GlobalConfigureData",
|
|
6340
6584
|
type: {
|
|
@@ -6429,23 +6673,23 @@ var jbond_default = {
|
|
|
6429
6673
|
type: "u8"
|
|
6430
6674
|
},
|
|
6431
6675
|
{
|
|
6432
|
-
name: "
|
|
6676
|
+
name: "locked",
|
|
6433
6677
|
docs: [
|
|
6434
|
-
"Amount of collateral locked for
|
|
6678
|
+
"Amount of collateral currently locked (unavailable for withdrawal)"
|
|
6435
6679
|
],
|
|
6436
6680
|
type: "u64"
|
|
6437
6681
|
},
|
|
6438
6682
|
{
|
|
6439
|
-
name: "
|
|
6683
|
+
name: "pending_unlock",
|
|
6440
6684
|
docs: [
|
|
6441
|
-
"
|
|
6685
|
+
"Pending unlock amount (will reduce `locked` next epoch)"
|
|
6442
6686
|
],
|
|
6443
6687
|
type: "u64"
|
|
6444
6688
|
},
|
|
6445
6689
|
{
|
|
6446
|
-
name: "
|
|
6690
|
+
name: "pending_unlock_epoch",
|
|
6447
6691
|
docs: [
|
|
6448
|
-
"
|
|
6692
|
+
"Epoch when pending_unlock was queued"
|
|
6449
6693
|
],
|
|
6450
6694
|
type: "u64"
|
|
6451
6695
|
}
|
|
@@ -6458,7 +6702,7 @@ var jbond_default = {
|
|
|
6458
6702
|
kind: "struct",
|
|
6459
6703
|
fields: [
|
|
6460
6704
|
{
|
|
6461
|
-
name: "
|
|
6705
|
+
name: "validator",
|
|
6462
6706
|
type: "pubkey"
|
|
6463
6707
|
},
|
|
6464
6708
|
{
|
|
@@ -6471,6 +6715,30 @@ var jbond_default = {
|
|
|
6471
6715
|
}
|
|
6472
6716
|
]
|
|
6473
6717
|
}
|
|
6718
|
+
},
|
|
6719
|
+
{
|
|
6720
|
+
name: "WithdrawAuthorityChanged",
|
|
6721
|
+
type: {
|
|
6722
|
+
kind: "struct",
|
|
6723
|
+
fields: [
|
|
6724
|
+
{
|
|
6725
|
+
name: "validator",
|
|
6726
|
+
type: "pubkey"
|
|
6727
|
+
},
|
|
6728
|
+
{
|
|
6729
|
+
name: "old_authority",
|
|
6730
|
+
type: {
|
|
6731
|
+
option: "pubkey"
|
|
6732
|
+
}
|
|
6733
|
+
},
|
|
6734
|
+
{
|
|
6735
|
+
name: "new_authority",
|
|
6736
|
+
type: {
|
|
6737
|
+
option: "pubkey"
|
|
6738
|
+
}
|
|
6739
|
+
}
|
|
6740
|
+
]
|
|
6741
|
+
}
|
|
6474
6742
|
}
|
|
6475
6743
|
],
|
|
6476
6744
|
constants: [
|
|
@@ -6595,20 +6863,13 @@ function getBondTypeSeed(type) {
|
|
|
6595
6863
|
}
|
|
6596
6864
|
|
|
6597
6865
|
// src/client.ts
|
|
6598
|
-
var JBondClientEnv = /* @__PURE__ */ ((JBondClientEnv2) => {
|
|
6599
|
-
JBondClientEnv2["DEV"] = "dev";
|
|
6600
|
-
JBondClientEnv2["STAGE"] = "stage";
|
|
6601
|
-
JBondClientEnv2["PROD"] = "prod";
|
|
6602
|
-
return JBondClientEnv2;
|
|
6603
|
-
})(JBondClientEnv || {});
|
|
6604
6866
|
var JBondClient = class _JBondClient {
|
|
6605
6867
|
constructor(provider, options) {
|
|
6606
6868
|
this.provider = provider;
|
|
6607
6869
|
this.options = options ?? {};
|
|
6608
|
-
this.program = new Program(jbond_default, this.provider);
|
|
6609
6870
|
}
|
|
6610
6871
|
options;
|
|
6611
|
-
|
|
6872
|
+
_program = null;
|
|
6612
6873
|
get history() {
|
|
6613
6874
|
return new HistoryManager(this);
|
|
6614
6875
|
}
|
|
@@ -6637,11 +6898,24 @@ var JBondClient = class _JBondClient {
|
|
|
6637
6898
|
static fromKeypair(connection, keypair, options) {
|
|
6638
6899
|
return _JBondClient.fromWallet(connection, new NodeWallet(keypair), options);
|
|
6639
6900
|
}
|
|
6901
|
+
/**
|
|
6902
|
+
* Get or create the program instance
|
|
6903
|
+
*/
|
|
6904
|
+
get program() {
|
|
6905
|
+
if (!this._program) {
|
|
6906
|
+
jbond_default.address = this.programId.toBase58();
|
|
6907
|
+
this._program = new Program(jbond_default, this.provider);
|
|
6908
|
+
}
|
|
6909
|
+
return this._program;
|
|
6910
|
+
}
|
|
6640
6911
|
/**
|
|
6641
6912
|
* Get the current program ID.
|
|
6642
6913
|
*/
|
|
6643
6914
|
get programId() {
|
|
6644
|
-
|
|
6915
|
+
if (this.options.programId) {
|
|
6916
|
+
return this.options.programId;
|
|
6917
|
+
}
|
|
6918
|
+
return new PublicKey(ENV_PROGRAM_ID["prod" /* PROD */]);
|
|
6645
6919
|
}
|
|
6646
6920
|
/**
|
|
6647
6921
|
* Get the current connection.
|
|
@@ -6653,7 +6927,13 @@ var JBondClient = class _JBondClient {
|
|
|
6653
6927
|
* Set the environment.
|
|
6654
6928
|
*/
|
|
6655
6929
|
env(env) {
|
|
6656
|
-
|
|
6930
|
+
const envProgramId = ENV_PROGRAM_ID[env];
|
|
6931
|
+
if (!envProgramId) {
|
|
6932
|
+
throw new Error(`Invalid environment: ${env}`);
|
|
6933
|
+
}
|
|
6934
|
+
this._program = null;
|
|
6935
|
+
this.debug(`Set environment to ${env} with program ID: ${envProgramId.toString()}`);
|
|
6936
|
+
return this.configure("programId", new PublicKey(envProgramId));
|
|
6657
6937
|
}
|
|
6658
6938
|
/**
|
|
6659
6939
|
* Configure a specific option.
|
|
@@ -6770,6 +7050,10 @@ var JBondClient = class _JBondClient {
|
|
|
6770
7050
|
const ix = await this.getBondSessionFinishIx(props);
|
|
6771
7051
|
return this.provider.sendAndConfirm?.(new Transaction().add(ix));
|
|
6772
7052
|
}
|
|
7053
|
+
async bondRemove(props) {
|
|
7054
|
+
const ix = await this.getBondRemoveIx(props);
|
|
7055
|
+
return this.provider.sendAndConfirm?.(new Transaction().add(ix));
|
|
7056
|
+
}
|
|
6773
7057
|
/**
|
|
6774
7058
|
* Build global state initialize instruction
|
|
6775
7059
|
*/
|
|
@@ -6983,9 +7267,14 @@ var JBondClient = class _JBondClient {
|
|
|
6983
7267
|
native: () => {
|
|
6984
7268
|
},
|
|
6985
7269
|
token: (mint) => {
|
|
6986
|
-
accounts.destinationTokenAccount = getAssociatedTokenAddressSync(mint, reserve, true);
|
|
6987
7270
|
accounts.bondTokenAccount = getAssociatedTokenAddressSync(mint, validatorBond, true);
|
|
6988
|
-
|
|
7271
|
+
if (reserve.equals(mint)) {
|
|
7272
|
+
accounts.reserveTokenAccount = null;
|
|
7273
|
+
accounts.destinationTokenAccount = null;
|
|
7274
|
+
} else {
|
|
7275
|
+
accounts.destinationTokenAccount = getAssociatedTokenAddressSync(mint, reserve, true);
|
|
7276
|
+
accounts.reserveTokenAccount = getAssociatedTokenAddressSync(mint, reserve, true);
|
|
7277
|
+
}
|
|
6989
7278
|
}
|
|
6990
7279
|
});
|
|
6991
7280
|
return this.program.methods.bondClaim(solToLamports(amount)).accountsPartial(accounts).instruction();
|
|
@@ -7055,6 +7344,42 @@ var JBondClient = class _JBondClient {
|
|
|
7055
7344
|
const ix = await this.getReleaseFundsIx(props);
|
|
7056
7345
|
return this.provider.sendAndConfirm?.(new Transaction().add(ix));
|
|
7057
7346
|
}
|
|
7347
|
+
/**
|
|
7348
|
+
* Update epoch locks
|
|
7349
|
+
*/
|
|
7350
|
+
async updateEpochLocks(props) {
|
|
7351
|
+
const { bondType, bondName, voteAccount, payer } = props;
|
|
7352
|
+
const ix = await this.getUpdateEpochLocksIx({ bondType, bondName, voteAccount, payer });
|
|
7353
|
+
return this.provider.sendAndConfirm?.(new Transaction().add(ix));
|
|
7354
|
+
}
|
|
7355
|
+
/**
|
|
7356
|
+
* Build update epoch locks instruction
|
|
7357
|
+
*/
|
|
7358
|
+
async getUpdateEpochLocksIx(props) {
|
|
7359
|
+
const { bondType, bondName, voteAccount, payer } = props;
|
|
7360
|
+
const [validatorBond, _] = this.pda.validatorBond(bondType, bondName, voteAccount);
|
|
7361
|
+
return this.program.methods.bondUpdate().accountsPartial({ validatorBond, payer }).instruction();
|
|
7362
|
+
}
|
|
7363
|
+
/**
|
|
7364
|
+
* Build bond remove instruction
|
|
7365
|
+
*/
|
|
7366
|
+
async getBondRemoveIx(props) {
|
|
7367
|
+
const { bondType, name } = props;
|
|
7368
|
+
const [bondState] = this.pda.bondState(bondType, name);
|
|
7369
|
+
const authority = props.authority ?? this.provider.wallet?.publicKey;
|
|
7370
|
+
return this.program.methods.bondRemove().accountsPartial({ bondState, authority }).instruction();
|
|
7371
|
+
}
|
|
7372
|
+
/**
|
|
7373
|
+
* Build test set last update epoch instruction
|
|
7374
|
+
* NOTE!: This instruction is for testing purposes only.
|
|
7375
|
+
* It allows direct manipulation of the validator bond's last epoch update.
|
|
7376
|
+
* This should not be used in production environments.
|
|
7377
|
+
*/
|
|
7378
|
+
async getTestSetLastUpdateEpochIx(props) {
|
|
7379
|
+
const { bondType, bondName, voteAccount, payer, epoch } = props;
|
|
7380
|
+
const [validatorBond, _] = this.pda.validatorBond(bondType, bondName, voteAccount);
|
|
7381
|
+
return this.program.methods.testSetLastUpdateEpoch(new import_bn.BN(epoch)).accountsPartial({ validatorBond, payer }).instruction();
|
|
7382
|
+
}
|
|
7058
7383
|
/**
|
|
7059
7384
|
* Build lock funds instruction
|
|
7060
7385
|
*/
|
|
@@ -7088,13 +7413,22 @@ var JBondClient = class _JBondClient {
|
|
|
7088
7413
|
*/
|
|
7089
7414
|
async getReleaseFundsIx(props) {
|
|
7090
7415
|
const { bondType, name, voteAccount, amount, withdrawAuthority } = props;
|
|
7416
|
+
const [bondState] = this.pda.bondState(bondType, name);
|
|
7091
7417
|
const [validatorBond] = this.pda.validatorBond(bondType, name, voteAccount);
|
|
7092
7418
|
const accounts = {
|
|
7419
|
+
bondState,
|
|
7093
7420
|
validatorBond,
|
|
7094
7421
|
payer: withdrawAuthority
|
|
7095
7422
|
};
|
|
7096
7423
|
return this.program.methods.bondReleaseFunds(solToLamports(amount)).accountsPartial(accounts).instruction();
|
|
7097
7424
|
}
|
|
7425
|
+
/**
|
|
7426
|
+
* Get available collateral for withdrawal (taking into account locked funds)
|
|
7427
|
+
*/
|
|
7428
|
+
async getAvailableCollateral(bondType, bondName, voteAccount) {
|
|
7429
|
+
const validatorBond = await this.getValidatorBond(bondType, bondName, voteAccount);
|
|
7430
|
+
return await this.getValidatorBondBalance(bondType, bondName, voteAccount) - validatorBond.locked.toNumber();
|
|
7431
|
+
}
|
|
7098
7432
|
/**
|
|
7099
7433
|
* Get all bond states with total collected collateral
|
|
7100
7434
|
*/
|