@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.js
CHANGED
|
@@ -33,9 +33,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
33
33
|
mod
|
|
34
34
|
));
|
|
35
35
|
|
|
36
|
-
// ../../node_modules/.pnpm/tsup@8.5.0_@swc+core@1.13.5_@swc+helpers@0.5.17__jiti@2.5.1_postcss@8.5.
|
|
36
|
+
// ../../node_modules/.pnpm/tsup@8.5.0_@swc+core@1.13.5_@swc+helpers@0.5.17__jiti@2.5.1_postcss@8.5.8_tsx@4.20.5_typescript@5.9.3_yaml@2.8.1/node_modules/tsup/assets/cjs_shims.js
|
|
37
37
|
var init_cjs_shims = __esm({
|
|
38
|
-
"../../node_modules/.pnpm/tsup@8.5.0_@swc+core@1.13.5_@swc+helpers@0.5.17__jiti@2.5.1_postcss@8.5.
|
|
38
|
+
"../../node_modules/.pnpm/tsup@8.5.0_@swc+core@1.13.5_@swc+helpers@0.5.17__jiti@2.5.1_postcss@8.5.8_tsx@4.20.5_typescript@5.9.3_yaml@2.8.1/node_modules/tsup/assets/cjs_shims.js"() {
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
41
|
|
|
@@ -4568,20 +4568,15 @@ var import_bn = __toESM(require_bn());
|
|
|
4568
4568
|
|
|
4569
4569
|
// src/constants.ts
|
|
4570
4570
|
init_cjs_shims();
|
|
4571
|
-
var GLOBAL_STATE_SEED = "global_state";
|
|
4572
|
-
var BOND_STATE_SEED = "bond_state";
|
|
4573
|
-
var VALIDATOR_BOND_SEED = "validator_bond";
|
|
4574
|
-
var STANDARD_BOND_SEED = "standard";
|
|
4575
|
-
var CROWDFUNDING_BOND_SEED = "crowdfunding";
|
|
4576
|
-
var ENV_PROGRAM_ID = {
|
|
4577
|
-
// [BondClientEnv.DEV]: new PublicKey('...'),
|
|
4578
|
-
};
|
|
4579
|
-
|
|
4580
|
-
// src/history.ts
|
|
4581
|
-
init_cjs_shims();
|
|
4582
4571
|
|
|
4583
4572
|
// src/types/index.ts
|
|
4584
4573
|
init_cjs_shims();
|
|
4574
|
+
var JBondClientEnv = /* @__PURE__ */ ((JBondClientEnv2) => {
|
|
4575
|
+
JBondClientEnv2["DEV"] = "dev";
|
|
4576
|
+
JBondClientEnv2["STAGE"] = "stage";
|
|
4577
|
+
JBondClientEnv2["PROD"] = "prod";
|
|
4578
|
+
return JBondClientEnv2;
|
|
4579
|
+
})(JBondClientEnv || {});
|
|
4585
4580
|
var SessionStatus = /* @__PURE__ */ ((SessionStatus2) => {
|
|
4586
4581
|
SessionStatus2[SessionStatus2["Live"] = 0] = "Live";
|
|
4587
4582
|
SessionStatus2[SessionStatus2["Finished"] = 1] = "Finished";
|
|
@@ -4599,7 +4594,20 @@ var BondTransactionType = /* @__PURE__ */ ((BondTransactionType2) => {
|
|
|
4599
4594
|
return BondTransactionType2;
|
|
4600
4595
|
})(BondTransactionType || {});
|
|
4601
4596
|
|
|
4597
|
+
// src/constants.ts
|
|
4598
|
+
var GLOBAL_STATE_SEED = "global_state";
|
|
4599
|
+
var BOND_STATE_SEED = "bond_state";
|
|
4600
|
+
var VALIDATOR_BOND_SEED = "validator_bond";
|
|
4601
|
+
var STANDARD_BOND_SEED = "standard";
|
|
4602
|
+
var CROWDFUNDING_BOND_SEED = "crowdfunding";
|
|
4603
|
+
var ENV_PROGRAM_ID = {
|
|
4604
|
+
["dev" /* DEV */]: "Fo17edWRJewZNTRibgx9iTfjywCW6dzS81VwBLmPFVq1",
|
|
4605
|
+
["stage" /* STAGE */]: "Fo17edWRJewZNTRibgx9iTfjywCW6dzS81VwBLmPFVq1",
|
|
4606
|
+
["prod" /* PROD */]: "BondQ7KqZreTcW2UbeTNDcLCJQ3aXAtLn2Fm6ftaJDU"
|
|
4607
|
+
};
|
|
4608
|
+
|
|
4602
4609
|
// src/history.ts
|
|
4610
|
+
init_cjs_shims();
|
|
4603
4611
|
var { bs58 } = anchor.utils.bytes;
|
|
4604
4612
|
var HistoryManager = class {
|
|
4605
4613
|
constructor(client) {
|
|
@@ -4759,10 +4767,10 @@ function slotToEpoch(slot, cluster) {
|
|
|
4759
4767
|
|
|
4760
4768
|
// src/idl/jbond.json
|
|
4761
4769
|
var jbond_default = {
|
|
4762
|
-
address: "
|
|
4770
|
+
address: "BondQ7KqZreTcW2UbeTNDcLCJQ3aXAtLn2Fm6ftaJDU",
|
|
4763
4771
|
metadata: {
|
|
4764
4772
|
name: "jbond",
|
|
4765
|
-
version: "0.2.
|
|
4773
|
+
version: "0.2.5",
|
|
4766
4774
|
spec: "0.1.0",
|
|
4767
4775
|
description: "Jpool Bond Program"
|
|
4768
4776
|
},
|
|
@@ -4837,7 +4845,10 @@ var jbond_default = {
|
|
|
4837
4845
|
},
|
|
4838
4846
|
{
|
|
4839
4847
|
name: "authority",
|
|
4840
|
-
signer: true
|
|
4848
|
+
signer: true,
|
|
4849
|
+
relations: [
|
|
4850
|
+
"bond_state"
|
|
4851
|
+
]
|
|
4841
4852
|
},
|
|
4842
4853
|
{
|
|
4843
4854
|
name: "bond_token_account",
|
|
@@ -5011,10 +5022,12 @@ var jbond_default = {
|
|
|
5011
5022
|
{
|
|
5012
5023
|
name: "bond_lock_funds",
|
|
5013
5024
|
docs: [
|
|
5014
|
-
"Locks funds
|
|
5015
|
-
"
|
|
5025
|
+
"Locks funds immediately, making them unavailable for withdrawal.",
|
|
5026
|
+
"The locked amount takes effect immediately in the current epoch.",
|
|
5027
|
+
"",
|
|
5016
5028
|
"# Errors",
|
|
5017
|
-
"Fails if the
|
|
5029
|
+
"Fails if the bond type is not lockable, if the amount is zero,",
|
|
5030
|
+
"or if there are insufficient available funds."
|
|
5018
5031
|
],
|
|
5019
5032
|
discriminator: [
|
|
5020
5033
|
117,
|
|
@@ -5033,7 +5046,39 @@ var jbond_default = {
|
|
|
5033
5046
|
},
|
|
5034
5047
|
{
|
|
5035
5048
|
name: "validator_bond",
|
|
5036
|
-
writable: true
|
|
5049
|
+
writable: true,
|
|
5050
|
+
pda: {
|
|
5051
|
+
seeds: [
|
|
5052
|
+
{
|
|
5053
|
+
kind: "const",
|
|
5054
|
+
value: [
|
|
5055
|
+
118,
|
|
5056
|
+
97,
|
|
5057
|
+
108,
|
|
5058
|
+
105,
|
|
5059
|
+
100,
|
|
5060
|
+
97,
|
|
5061
|
+
116,
|
|
5062
|
+
111,
|
|
5063
|
+
114,
|
|
5064
|
+
95,
|
|
5065
|
+
98,
|
|
5066
|
+
111,
|
|
5067
|
+
110,
|
|
5068
|
+
100
|
|
5069
|
+
]
|
|
5070
|
+
},
|
|
5071
|
+
{
|
|
5072
|
+
kind: "account",
|
|
5073
|
+
path: "bond_state"
|
|
5074
|
+
},
|
|
5075
|
+
{
|
|
5076
|
+
kind: "account",
|
|
5077
|
+
path: "validator_bond.vote_account",
|
|
5078
|
+
account: "ValidatorBond"
|
|
5079
|
+
}
|
|
5080
|
+
]
|
|
5081
|
+
}
|
|
5037
5082
|
},
|
|
5038
5083
|
{
|
|
5039
5084
|
name: "bond_token_account",
|
|
@@ -5079,7 +5124,34 @@ var jbond_default = {
|
|
|
5079
5124
|
accounts: [
|
|
5080
5125
|
{
|
|
5081
5126
|
name: "bond_state",
|
|
5082
|
-
writable: true
|
|
5127
|
+
writable: true,
|
|
5128
|
+
pda: {
|
|
5129
|
+
seeds: [
|
|
5130
|
+
{
|
|
5131
|
+
kind: "const",
|
|
5132
|
+
value: [
|
|
5133
|
+
98,
|
|
5134
|
+
111,
|
|
5135
|
+
110,
|
|
5136
|
+
100,
|
|
5137
|
+
95,
|
|
5138
|
+
115,
|
|
5139
|
+
116,
|
|
5140
|
+
97,
|
|
5141
|
+
116,
|
|
5142
|
+
101
|
|
5143
|
+
]
|
|
5144
|
+
},
|
|
5145
|
+
{
|
|
5146
|
+
kind: "arg",
|
|
5147
|
+
path: "bond_type"
|
|
5148
|
+
},
|
|
5149
|
+
{
|
|
5150
|
+
kind: "arg",
|
|
5151
|
+
path: "bond_name"
|
|
5152
|
+
}
|
|
5153
|
+
]
|
|
5154
|
+
}
|
|
5083
5155
|
},
|
|
5084
5156
|
{
|
|
5085
5157
|
name: "validator_bond",
|
|
@@ -5167,10 +5239,13 @@ var jbond_default = {
|
|
|
5167
5239
|
{
|
|
5168
5240
|
name: "bond_release_funds",
|
|
5169
5241
|
docs: [
|
|
5170
|
-
"
|
|
5171
|
-
"
|
|
5242
|
+
"Queues funds for unlock in the next epoch.",
|
|
5243
|
+
"The unlock is delayed by one epoch for security - funds remain locked",
|
|
5244
|
+
"in the current epoch but will be available after epoch transition.",
|
|
5245
|
+
"",
|
|
5172
5246
|
"# Errors",
|
|
5173
|
-
"Fails if the
|
|
5247
|
+
"Fails if the bond type is not lockable, if the amount is zero,",
|
|
5248
|
+
"or if the amount exceeds currently locked funds."
|
|
5174
5249
|
],
|
|
5175
5250
|
discriminator: [
|
|
5176
5251
|
184,
|
|
@@ -5184,9 +5259,45 @@ var jbond_default = {
|
|
|
5184
5259
|
],
|
|
5185
5260
|
accounts: [
|
|
5186
5261
|
{
|
|
5187
|
-
name: "
|
|
5262
|
+
name: "bond_state",
|
|
5188
5263
|
writable: true
|
|
5189
5264
|
},
|
|
5265
|
+
{
|
|
5266
|
+
name: "validator_bond",
|
|
5267
|
+
writable: true,
|
|
5268
|
+
pda: {
|
|
5269
|
+
seeds: [
|
|
5270
|
+
{
|
|
5271
|
+
kind: "const",
|
|
5272
|
+
value: [
|
|
5273
|
+
118,
|
|
5274
|
+
97,
|
|
5275
|
+
108,
|
|
5276
|
+
105,
|
|
5277
|
+
100,
|
|
5278
|
+
97,
|
|
5279
|
+
116,
|
|
5280
|
+
111,
|
|
5281
|
+
114,
|
|
5282
|
+
95,
|
|
5283
|
+
98,
|
|
5284
|
+
111,
|
|
5285
|
+
110,
|
|
5286
|
+
100
|
|
5287
|
+
]
|
|
5288
|
+
},
|
|
5289
|
+
{
|
|
5290
|
+
kind: "account",
|
|
5291
|
+
path: "bond_state"
|
|
5292
|
+
},
|
|
5293
|
+
{
|
|
5294
|
+
kind: "account",
|
|
5295
|
+
path: "validator_bond.vote_account",
|
|
5296
|
+
account: "ValidatorBond"
|
|
5297
|
+
}
|
|
5298
|
+
]
|
|
5299
|
+
}
|
|
5300
|
+
},
|
|
5190
5301
|
{
|
|
5191
5302
|
name: "payer",
|
|
5192
5303
|
writable: true,
|
|
@@ -5200,6 +5311,37 @@ var jbond_default = {
|
|
|
5200
5311
|
}
|
|
5201
5312
|
]
|
|
5202
5313
|
},
|
|
5314
|
+
{
|
|
5315
|
+
name: "bond_remove",
|
|
5316
|
+
docs: [
|
|
5317
|
+
"Removes bond state"
|
|
5318
|
+
],
|
|
5319
|
+
discriminator: [
|
|
5320
|
+
121,
|
|
5321
|
+
112,
|
|
5322
|
+
246,
|
|
5323
|
+
177,
|
|
5324
|
+
181,
|
|
5325
|
+
8,
|
|
5326
|
+
18,
|
|
5327
|
+
220
|
|
5328
|
+
],
|
|
5329
|
+
accounts: [
|
|
5330
|
+
{
|
|
5331
|
+
name: "bond_state",
|
|
5332
|
+
writable: true
|
|
5333
|
+
},
|
|
5334
|
+
{
|
|
5335
|
+
name: "authority",
|
|
5336
|
+
writable: true,
|
|
5337
|
+
signer: true,
|
|
5338
|
+
relations: [
|
|
5339
|
+
"bond_state"
|
|
5340
|
+
]
|
|
5341
|
+
}
|
|
5342
|
+
],
|
|
5343
|
+
args: []
|
|
5344
|
+
},
|
|
5203
5345
|
{
|
|
5204
5346
|
name: "bond_set_withdraw_authority",
|
|
5205
5347
|
docs: [
|
|
@@ -5382,15 +5524,12 @@ var jbond_default = {
|
|
|
5382
5524
|
{
|
|
5383
5525
|
name: "bond_update",
|
|
5384
5526
|
docs: [
|
|
5385
|
-
"
|
|
5527
|
+
"Applies any pending unlocks from previous epochs.",
|
|
5386
5528
|
"",
|
|
5387
|
-
"This
|
|
5388
|
-
"
|
|
5389
|
-
"
|
|
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."
|
|
5529
|
+
"This instruction is optional - all other operations now automatically",
|
|
5530
|
+
"sync the epoch state. It is kept for backwards compatibility and can",
|
|
5531
|
+
"be used to explicitly trigger epoch synchronization without performing",
|
|
5532
|
+
"another operation."
|
|
5394
5533
|
],
|
|
5395
5534
|
discriminator: [
|
|
5396
5535
|
237,
|
|
@@ -5409,7 +5548,6 @@ var jbond_default = {
|
|
|
5409
5548
|
},
|
|
5410
5549
|
{
|
|
5411
5550
|
name: "payer",
|
|
5412
|
-
writable: true,
|
|
5413
5551
|
signer: true
|
|
5414
5552
|
}
|
|
5415
5553
|
],
|
|
@@ -5632,80 +5770,6 @@ var jbond_default = {
|
|
|
5632
5770
|
],
|
|
5633
5771
|
args: []
|
|
5634
5772
|
},
|
|
5635
|
-
{
|
|
5636
|
-
name: "migrate_bond",
|
|
5637
|
-
docs: [
|
|
5638
|
-
"Migrates validator bond data from legacy structure to new structure."
|
|
5639
|
-
],
|
|
5640
|
-
discriminator: [
|
|
5641
|
-
107,
|
|
5642
|
-
119,
|
|
5643
|
-
59,
|
|
5644
|
-
110,
|
|
5645
|
-
76,
|
|
5646
|
-
18,
|
|
5647
|
-
37,
|
|
5648
|
-
163
|
|
5649
|
-
],
|
|
5650
|
-
accounts: [
|
|
5651
|
-
{
|
|
5652
|
-
name: "bond_state",
|
|
5653
|
-
writable: true
|
|
5654
|
-
},
|
|
5655
|
-
{
|
|
5656
|
-
name: "legacy_validator_bond",
|
|
5657
|
-
writable: true
|
|
5658
|
-
},
|
|
5659
|
-
{
|
|
5660
|
-
name: "legacy_vote_account"
|
|
5661
|
-
},
|
|
5662
|
-
{
|
|
5663
|
-
name: "validator_bond",
|
|
5664
|
-
writable: true,
|
|
5665
|
-
pda: {
|
|
5666
|
-
seeds: [
|
|
5667
|
-
{
|
|
5668
|
-
kind: "const",
|
|
5669
|
-
value: [
|
|
5670
|
-
118,
|
|
5671
|
-
97,
|
|
5672
|
-
108,
|
|
5673
|
-
105,
|
|
5674
|
-
100,
|
|
5675
|
-
97,
|
|
5676
|
-
116,
|
|
5677
|
-
111,
|
|
5678
|
-
114,
|
|
5679
|
-
95,
|
|
5680
|
-
98,
|
|
5681
|
-
111,
|
|
5682
|
-
110,
|
|
5683
|
-
100
|
|
5684
|
-
]
|
|
5685
|
-
},
|
|
5686
|
-
{
|
|
5687
|
-
kind: "account",
|
|
5688
|
-
path: "bond_state"
|
|
5689
|
-
},
|
|
5690
|
-
{
|
|
5691
|
-
kind: "account",
|
|
5692
|
-
path: "legacy_vote_account"
|
|
5693
|
-
}
|
|
5694
|
-
]
|
|
5695
|
-
}
|
|
5696
|
-
},
|
|
5697
|
-
{
|
|
5698
|
-
name: "creator",
|
|
5699
|
-
writable: true,
|
|
5700
|
-
signer: true
|
|
5701
|
-
},
|
|
5702
|
-
{
|
|
5703
|
-
name: "system_program",
|
|
5704
|
-
address: "11111111111111111111111111111111"
|
|
5705
|
-
}
|
|
5706
|
-
],
|
|
5707
|
-
args: []
|
|
5708
|
-
},
|
|
5709
5773
|
{
|
|
5710
5774
|
name: "session_finish",
|
|
5711
5775
|
docs: [
|
|
@@ -5816,6 +5880,19 @@ var jbond_default = {
|
|
|
5816
5880
|
}
|
|
5817
5881
|
],
|
|
5818
5882
|
events: [
|
|
5883
|
+
{
|
|
5884
|
+
name: "BondConfigured",
|
|
5885
|
+
discriminator: [
|
|
5886
|
+
141,
|
|
5887
|
+
252,
|
|
5888
|
+
43,
|
|
5889
|
+
54,
|
|
5890
|
+
45,
|
|
5891
|
+
157,
|
|
5892
|
+
81,
|
|
5893
|
+
14
|
|
5894
|
+
]
|
|
5895
|
+
},
|
|
5819
5896
|
{
|
|
5820
5897
|
name: "BondFinished",
|
|
5821
5898
|
discriminator: [
|
|
@@ -5829,6 +5906,32 @@ var jbond_default = {
|
|
|
5829
5906
|
191
|
|
5830
5907
|
]
|
|
5831
5908
|
},
|
|
5909
|
+
{
|
|
5910
|
+
name: "BondInitialized",
|
|
5911
|
+
discriminator: [
|
|
5912
|
+
73,
|
|
5913
|
+
68,
|
|
5914
|
+
161,
|
|
5915
|
+
2,
|
|
5916
|
+
214,
|
|
5917
|
+
12,
|
|
5918
|
+
169,
|
|
5919
|
+
53
|
|
5920
|
+
]
|
|
5921
|
+
},
|
|
5922
|
+
{
|
|
5923
|
+
name: "BondRemoved",
|
|
5924
|
+
discriminator: [
|
|
5925
|
+
177,
|
|
5926
|
+
200,
|
|
5927
|
+
116,
|
|
5928
|
+
123,
|
|
5929
|
+
1,
|
|
5930
|
+
244,
|
|
5931
|
+
161,
|
|
5932
|
+
240
|
|
5933
|
+
]
|
|
5934
|
+
},
|
|
5832
5935
|
{
|
|
5833
5936
|
name: "BondStarted",
|
|
5834
5937
|
discriminator: [
|
|
@@ -5843,16 +5946,16 @@ var jbond_default = {
|
|
|
5843
5946
|
]
|
|
5844
5947
|
},
|
|
5845
5948
|
{
|
|
5846
|
-
name: "
|
|
5949
|
+
name: "CollateralDeposited",
|
|
5847
5950
|
discriminator: [
|
|
5848
|
-
|
|
5849
|
-
|
|
5850
|
-
|
|
5851
|
-
|
|
5951
|
+
244,
|
|
5952
|
+
62,
|
|
5953
|
+
77,
|
|
5954
|
+
11,
|
|
5852
5955
|
135,
|
|
5853
|
-
|
|
5854
|
-
|
|
5855
|
-
|
|
5956
|
+
112,
|
|
5957
|
+
61,
|
|
5958
|
+
96
|
|
5856
5959
|
]
|
|
5857
5960
|
},
|
|
5858
5961
|
{
|
|
@@ -5868,6 +5971,19 @@ var jbond_default = {
|
|
|
5868
5971
|
82
|
|
5869
5972
|
]
|
|
5870
5973
|
},
|
|
5974
|
+
{
|
|
5975
|
+
name: "CompensationBurned",
|
|
5976
|
+
discriminator: [
|
|
5977
|
+
177,
|
|
5978
|
+
198,
|
|
5979
|
+
90,
|
|
5980
|
+
188,
|
|
5981
|
+
47,
|
|
5982
|
+
95,
|
|
5983
|
+
20,
|
|
5984
|
+
174
|
|
5985
|
+
]
|
|
5986
|
+
},
|
|
5871
5987
|
{
|
|
5872
5988
|
name: "CompensationClaimed",
|
|
5873
5989
|
discriminator: [
|
|
@@ -5881,6 +5997,32 @@ var jbond_default = {
|
|
|
5881
5997
|
32
|
|
5882
5998
|
]
|
|
5883
5999
|
},
|
|
6000
|
+
{
|
|
6001
|
+
name: "FundsLocked",
|
|
6002
|
+
discriminator: [
|
|
6003
|
+
227,
|
|
6004
|
+
93,
|
|
6005
|
+
162,
|
|
6006
|
+
69,
|
|
6007
|
+
181,
|
|
6008
|
+
4,
|
|
6009
|
+
71,
|
|
6010
|
+
157
|
|
6011
|
+
]
|
|
6012
|
+
},
|
|
6013
|
+
{
|
|
6014
|
+
name: "FundsUnlocked",
|
|
6015
|
+
discriminator: [
|
|
6016
|
+
11,
|
|
6017
|
+
240,
|
|
6018
|
+
184,
|
|
6019
|
+
107,
|
|
6020
|
+
86,
|
|
6021
|
+
187,
|
|
6022
|
+
196,
|
|
6023
|
+
128
|
|
6024
|
+
]
|
|
6025
|
+
},
|
|
5884
6026
|
{
|
|
5885
6027
|
name: "ValidatorRegistered",
|
|
5886
6028
|
discriminator: [
|
|
@@ -5893,33 +6035,46 @@ var jbond_default = {
|
|
|
5893
6035
|
95,
|
|
5894
6036
|
72
|
|
5895
6037
|
]
|
|
6038
|
+
},
|
|
6039
|
+
{
|
|
6040
|
+
name: "WithdrawAuthorityChanged",
|
|
6041
|
+
discriminator: [
|
|
6042
|
+
91,
|
|
6043
|
+
149,
|
|
6044
|
+
224,
|
|
6045
|
+
49,
|
|
6046
|
+
187,
|
|
6047
|
+
48,
|
|
6048
|
+
190,
|
|
6049
|
+
100
|
|
6050
|
+
]
|
|
5896
6051
|
}
|
|
5897
6052
|
],
|
|
5898
6053
|
errors: [
|
|
5899
6054
|
{
|
|
5900
6055
|
code: 6e3,
|
|
5901
|
-
name: "
|
|
5902
|
-
msg: "
|
|
6056
|
+
name: "Forbidden",
|
|
6057
|
+
msg: "Forbidden"
|
|
5903
6058
|
},
|
|
5904
6059
|
{
|
|
5905
6060
|
code: 6001,
|
|
5906
|
-
name: "
|
|
5907
|
-
msg: "
|
|
6061
|
+
name: "Unauthorized",
|
|
6062
|
+
msg: "Unauthorized"
|
|
5908
6063
|
},
|
|
5909
6064
|
{
|
|
5910
6065
|
code: 6002,
|
|
5911
|
-
name: "
|
|
5912
|
-
msg: "
|
|
6066
|
+
name: "InvalidVoteAccount",
|
|
6067
|
+
msg: "Invalid vote account"
|
|
5913
6068
|
},
|
|
5914
6069
|
{
|
|
5915
6070
|
code: 6003,
|
|
5916
|
-
name: "
|
|
5917
|
-
msg: "
|
|
6071
|
+
name: "IdentityMismatch",
|
|
6072
|
+
msg: "Vote account identity mismatch"
|
|
5918
6073
|
},
|
|
5919
6074
|
{
|
|
5920
6075
|
code: 6004,
|
|
5921
|
-
name: "
|
|
5922
|
-
msg: "
|
|
6076
|
+
name: "InvalidMint",
|
|
6077
|
+
msg: "Invalid mint address"
|
|
5923
6078
|
},
|
|
5924
6079
|
{
|
|
5925
6080
|
code: 6005,
|
|
@@ -5928,98 +6083,53 @@ var jbond_default = {
|
|
|
5928
6083
|
},
|
|
5929
6084
|
{
|
|
5930
6085
|
code: 6006,
|
|
5931
|
-
name: "
|
|
5932
|
-
msg: "
|
|
6086
|
+
name: "InvalidArgument",
|
|
6087
|
+
msg: "Invalid argument"
|
|
5933
6088
|
},
|
|
5934
6089
|
{
|
|
5935
6090
|
code: 6007,
|
|
5936
|
-
name: "
|
|
5937
|
-
msg: "
|
|
6091
|
+
name: "InsufficientBalance",
|
|
6092
|
+
msg: "Insufficient balance"
|
|
5938
6093
|
},
|
|
5939
6094
|
{
|
|
5940
6095
|
code: 6008,
|
|
5941
|
-
name: "
|
|
5942
|
-
msg: "
|
|
6096
|
+
name: "MathOverflow",
|
|
6097
|
+
msg: "Math overflow"
|
|
5943
6098
|
},
|
|
5944
6099
|
{
|
|
5945
6100
|
code: 6009,
|
|
5946
|
-
name: "
|
|
5947
|
-
msg: "
|
|
6101
|
+
name: "Overflow",
|
|
6102
|
+
msg: "Arithmetic overflow"
|
|
5948
6103
|
},
|
|
5949
6104
|
{
|
|
5950
6105
|
code: 6010,
|
|
5951
|
-
name: "
|
|
5952
|
-
msg: "
|
|
6106
|
+
name: "BondNotRemovable",
|
|
6107
|
+
msg: "Bond cannot be removed"
|
|
5953
6108
|
},
|
|
5954
6109
|
{
|
|
5955
6110
|
code: 6011,
|
|
5956
|
-
name: "
|
|
5957
|
-
msg: "
|
|
6111
|
+
name: "MissingTokenAccounts",
|
|
6112
|
+
msg: "Missing token accounts"
|
|
5958
6113
|
},
|
|
5959
6114
|
{
|
|
5960
6115
|
code: 6012,
|
|
5961
|
-
name: "
|
|
5962
|
-
msg: "
|
|
6116
|
+
name: "MissingTokenProgram",
|
|
6117
|
+
msg: "Missing token program"
|
|
5963
6118
|
},
|
|
5964
6119
|
{
|
|
5965
6120
|
code: 6013,
|
|
5966
6121
|
name: "MissingStakeAccount",
|
|
5967
|
-
msg: "
|
|
6122
|
+
msg: "Missing stake account"
|
|
5968
6123
|
},
|
|
5969
6124
|
{
|
|
5970
6125
|
code: 6014,
|
|
5971
6126
|
name: "MissingStakeProgram",
|
|
5972
|
-
msg: "
|
|
6127
|
+
msg: "Missing stake program"
|
|
5973
6128
|
},
|
|
5974
6129
|
{
|
|
5975
6130
|
code: 6015,
|
|
5976
|
-
name: "BondFinished",
|
|
5977
|
-
msg: "Bond is finished (deposits/withdrawals disabled)"
|
|
5978
|
-
},
|
|
5979
|
-
{
|
|
5980
|
-
code: 6016,
|
|
5981
|
-
name: "BondNotFinished",
|
|
5982
|
-
msg: "Bond is not finished"
|
|
5983
|
-
},
|
|
5984
|
-
{
|
|
5985
|
-
code: 6017,
|
|
5986
6131
|
name: "UnsupportedCollateralType",
|
|
5987
6132
|
msg: "Unsupported collateral type"
|
|
5988
|
-
},
|
|
5989
|
-
{
|
|
5990
|
-
code: 6018,
|
|
5991
|
-
name: "Overflow",
|
|
5992
|
-
msg: "Math operation overflowed"
|
|
5993
|
-
},
|
|
5994
|
-
{
|
|
5995
|
-
code: 6019,
|
|
5996
|
-
name: "IncorrectBondType",
|
|
5997
|
-
msg: "Incorrect bond type for this operation"
|
|
5998
|
-
},
|
|
5999
|
-
{
|
|
6000
|
-
code: 6020,
|
|
6001
|
-
name: "BondNotFinishable",
|
|
6002
|
-
msg: "This bond type can't be finished"
|
|
6003
|
-
},
|
|
6004
|
-
{
|
|
6005
|
-
code: 6021,
|
|
6006
|
-
name: "InvalidArgument",
|
|
6007
|
-
msg: "Invalid argument provided"
|
|
6008
|
-
},
|
|
6009
|
-
{
|
|
6010
|
-
code: 6022,
|
|
6011
|
-
name: "BondNotDisabled",
|
|
6012
|
-
msg: "Bond is not disabled"
|
|
6013
|
-
},
|
|
6014
|
-
{
|
|
6015
|
-
code: 6023,
|
|
6016
|
-
name: "BondNotEnabled",
|
|
6017
|
-
msg: "Bond is not enabled"
|
|
6018
|
-
},
|
|
6019
|
-
{
|
|
6020
|
-
code: 6024,
|
|
6021
|
-
name: "InvalidEpoch",
|
|
6022
|
-
msg: "Invalid epoch for this operation"
|
|
6023
6133
|
}
|
|
6024
6134
|
],
|
|
6025
6135
|
types: [
|
|
@@ -6053,6 +6163,26 @@ var jbond_default = {
|
|
|
6053
6163
|
]
|
|
6054
6164
|
}
|
|
6055
6165
|
},
|
|
6166
|
+
{
|
|
6167
|
+
name: "BondConfigured",
|
|
6168
|
+
type: {
|
|
6169
|
+
kind: "struct",
|
|
6170
|
+
fields: [
|
|
6171
|
+
{
|
|
6172
|
+
name: "bond",
|
|
6173
|
+
type: "pubkey"
|
|
6174
|
+
},
|
|
6175
|
+
{
|
|
6176
|
+
name: "authority",
|
|
6177
|
+
type: "pubkey"
|
|
6178
|
+
},
|
|
6179
|
+
{
|
|
6180
|
+
name: "timestamp",
|
|
6181
|
+
type: "i64"
|
|
6182
|
+
}
|
|
6183
|
+
]
|
|
6184
|
+
}
|
|
6185
|
+
},
|
|
6056
6186
|
{
|
|
6057
6187
|
name: "BondFinished",
|
|
6058
6188
|
type: {
|
|
@@ -6108,6 +6238,46 @@ var jbond_default = {
|
|
|
6108
6238
|
]
|
|
6109
6239
|
}
|
|
6110
6240
|
},
|
|
6241
|
+
{
|
|
6242
|
+
name: "BondInitialized",
|
|
6243
|
+
type: {
|
|
6244
|
+
kind: "struct",
|
|
6245
|
+
fields: [
|
|
6246
|
+
{
|
|
6247
|
+
name: "bond",
|
|
6248
|
+
type: "pubkey"
|
|
6249
|
+
},
|
|
6250
|
+
{
|
|
6251
|
+
name: "authority",
|
|
6252
|
+
type: "pubkey"
|
|
6253
|
+
},
|
|
6254
|
+
{
|
|
6255
|
+
name: "timestamp",
|
|
6256
|
+
type: "i64"
|
|
6257
|
+
}
|
|
6258
|
+
]
|
|
6259
|
+
}
|
|
6260
|
+
},
|
|
6261
|
+
{
|
|
6262
|
+
name: "BondRemoved",
|
|
6263
|
+
type: {
|
|
6264
|
+
kind: "struct",
|
|
6265
|
+
fields: [
|
|
6266
|
+
{
|
|
6267
|
+
name: "bond",
|
|
6268
|
+
type: "pubkey"
|
|
6269
|
+
},
|
|
6270
|
+
{
|
|
6271
|
+
name: "authority",
|
|
6272
|
+
type: "pubkey"
|
|
6273
|
+
},
|
|
6274
|
+
{
|
|
6275
|
+
name: "timestamp",
|
|
6276
|
+
type: "i64"
|
|
6277
|
+
}
|
|
6278
|
+
]
|
|
6279
|
+
}
|
|
6280
|
+
},
|
|
6111
6281
|
{
|
|
6112
6282
|
name: "BondStarted",
|
|
6113
6283
|
type: {
|
|
@@ -6261,7 +6431,7 @@ var jbond_default = {
|
|
|
6261
6431
|
}
|
|
6262
6432
|
},
|
|
6263
6433
|
{
|
|
6264
|
-
name: "
|
|
6434
|
+
name: "CollateralDeposited",
|
|
6265
6435
|
type: {
|
|
6266
6436
|
kind: "struct",
|
|
6267
6437
|
fields: [
|
|
@@ -6331,6 +6501,34 @@ var jbond_default = {
|
|
|
6331
6501
|
]
|
|
6332
6502
|
}
|
|
6333
6503
|
},
|
|
6504
|
+
{
|
|
6505
|
+
name: "CompensationBurned",
|
|
6506
|
+
type: {
|
|
6507
|
+
kind: "struct",
|
|
6508
|
+
fields: [
|
|
6509
|
+
{
|
|
6510
|
+
name: "validator",
|
|
6511
|
+
type: "pubkey"
|
|
6512
|
+
},
|
|
6513
|
+
{
|
|
6514
|
+
name: "amount",
|
|
6515
|
+
type: "u64"
|
|
6516
|
+
},
|
|
6517
|
+
{
|
|
6518
|
+
name: "post_balance",
|
|
6519
|
+
type: "u64"
|
|
6520
|
+
},
|
|
6521
|
+
{
|
|
6522
|
+
name: "epoch",
|
|
6523
|
+
type: "u64"
|
|
6524
|
+
},
|
|
6525
|
+
{
|
|
6526
|
+
name: "timestamp",
|
|
6527
|
+
type: "i64"
|
|
6528
|
+
}
|
|
6529
|
+
]
|
|
6530
|
+
}
|
|
6531
|
+
},
|
|
6334
6532
|
{
|
|
6335
6533
|
name: "CompensationClaimed",
|
|
6336
6534
|
type: {
|
|
@@ -6359,6 +6557,54 @@ var jbond_default = {
|
|
|
6359
6557
|
]
|
|
6360
6558
|
}
|
|
6361
6559
|
},
|
|
6560
|
+
{
|
|
6561
|
+
name: "FundsLocked",
|
|
6562
|
+
type: {
|
|
6563
|
+
kind: "struct",
|
|
6564
|
+
fields: [
|
|
6565
|
+
{
|
|
6566
|
+
name: "validator",
|
|
6567
|
+
type: "pubkey"
|
|
6568
|
+
},
|
|
6569
|
+
{
|
|
6570
|
+
name: "amount",
|
|
6571
|
+
type: "u64"
|
|
6572
|
+
},
|
|
6573
|
+
{
|
|
6574
|
+
name: "total_locked",
|
|
6575
|
+
type: "u64"
|
|
6576
|
+
},
|
|
6577
|
+
{
|
|
6578
|
+
name: "epoch",
|
|
6579
|
+
type: "u64"
|
|
6580
|
+
}
|
|
6581
|
+
]
|
|
6582
|
+
}
|
|
6583
|
+
},
|
|
6584
|
+
{
|
|
6585
|
+
name: "FundsUnlocked",
|
|
6586
|
+
type: {
|
|
6587
|
+
kind: "struct",
|
|
6588
|
+
fields: [
|
|
6589
|
+
{
|
|
6590
|
+
name: "validator",
|
|
6591
|
+
type: "pubkey"
|
|
6592
|
+
},
|
|
6593
|
+
{
|
|
6594
|
+
name: "amount",
|
|
6595
|
+
type: "u64"
|
|
6596
|
+
},
|
|
6597
|
+
{
|
|
6598
|
+
name: "pending_unlock",
|
|
6599
|
+
type: "u64"
|
|
6600
|
+
},
|
|
6601
|
+
{
|
|
6602
|
+
name: "epoch",
|
|
6603
|
+
type: "u64"
|
|
6604
|
+
}
|
|
6605
|
+
]
|
|
6606
|
+
}
|
|
6607
|
+
},
|
|
6362
6608
|
{
|
|
6363
6609
|
name: "GlobalConfigureData",
|
|
6364
6610
|
type: {
|
|
@@ -6453,23 +6699,23 @@ var jbond_default = {
|
|
|
6453
6699
|
type: "u8"
|
|
6454
6700
|
},
|
|
6455
6701
|
{
|
|
6456
|
-
name: "
|
|
6702
|
+
name: "locked",
|
|
6457
6703
|
docs: [
|
|
6458
|
-
"Amount of collateral locked for
|
|
6704
|
+
"Amount of collateral currently locked (unavailable for withdrawal)"
|
|
6459
6705
|
],
|
|
6460
6706
|
type: "u64"
|
|
6461
6707
|
},
|
|
6462
6708
|
{
|
|
6463
|
-
name: "
|
|
6709
|
+
name: "pending_unlock",
|
|
6464
6710
|
docs: [
|
|
6465
|
-
"
|
|
6711
|
+
"Pending unlock amount (will reduce `locked` next epoch)"
|
|
6466
6712
|
],
|
|
6467
6713
|
type: "u64"
|
|
6468
6714
|
},
|
|
6469
6715
|
{
|
|
6470
|
-
name: "
|
|
6716
|
+
name: "pending_unlock_epoch",
|
|
6471
6717
|
docs: [
|
|
6472
|
-
"
|
|
6718
|
+
"Epoch when pending_unlock was queued"
|
|
6473
6719
|
],
|
|
6474
6720
|
type: "u64"
|
|
6475
6721
|
}
|
|
@@ -6482,7 +6728,7 @@ var jbond_default = {
|
|
|
6482
6728
|
kind: "struct",
|
|
6483
6729
|
fields: [
|
|
6484
6730
|
{
|
|
6485
|
-
name: "
|
|
6731
|
+
name: "validator",
|
|
6486
6732
|
type: "pubkey"
|
|
6487
6733
|
},
|
|
6488
6734
|
{
|
|
@@ -6495,6 +6741,30 @@ var jbond_default = {
|
|
|
6495
6741
|
}
|
|
6496
6742
|
]
|
|
6497
6743
|
}
|
|
6744
|
+
},
|
|
6745
|
+
{
|
|
6746
|
+
name: "WithdrawAuthorityChanged",
|
|
6747
|
+
type: {
|
|
6748
|
+
kind: "struct",
|
|
6749
|
+
fields: [
|
|
6750
|
+
{
|
|
6751
|
+
name: "validator",
|
|
6752
|
+
type: "pubkey"
|
|
6753
|
+
},
|
|
6754
|
+
{
|
|
6755
|
+
name: "old_authority",
|
|
6756
|
+
type: {
|
|
6757
|
+
option: "pubkey"
|
|
6758
|
+
}
|
|
6759
|
+
},
|
|
6760
|
+
{
|
|
6761
|
+
name: "new_authority",
|
|
6762
|
+
type: {
|
|
6763
|
+
option: "pubkey"
|
|
6764
|
+
}
|
|
6765
|
+
}
|
|
6766
|
+
]
|
|
6767
|
+
}
|
|
6498
6768
|
}
|
|
6499
6769
|
],
|
|
6500
6770
|
constants: [
|
|
@@ -6627,20 +6897,13 @@ function getBondTypeSeed(type) {
|
|
|
6627
6897
|
}
|
|
6628
6898
|
|
|
6629
6899
|
// src/client.ts
|
|
6630
|
-
var JBondClientEnv = /* @__PURE__ */ ((JBondClientEnv2) => {
|
|
6631
|
-
JBondClientEnv2["DEV"] = "dev";
|
|
6632
|
-
JBondClientEnv2["STAGE"] = "stage";
|
|
6633
|
-
JBondClientEnv2["PROD"] = "prod";
|
|
6634
|
-
return JBondClientEnv2;
|
|
6635
|
-
})(JBondClientEnv || {});
|
|
6636
6900
|
var JBondClient = class _JBondClient {
|
|
6637
6901
|
constructor(provider, options) {
|
|
6638
6902
|
this.provider = provider;
|
|
6639
6903
|
this.options = options ?? {};
|
|
6640
|
-
this.program = new anchor.Program(jbond_default, this.provider);
|
|
6641
6904
|
}
|
|
6642
6905
|
options;
|
|
6643
|
-
|
|
6906
|
+
_program = null;
|
|
6644
6907
|
get history() {
|
|
6645
6908
|
return new HistoryManager(this);
|
|
6646
6909
|
}
|
|
@@ -6669,11 +6932,24 @@ var JBondClient = class _JBondClient {
|
|
|
6669
6932
|
static fromKeypair(connection, keypair, options) {
|
|
6670
6933
|
return _JBondClient.fromWallet(connection, new NodeWallet(keypair), options);
|
|
6671
6934
|
}
|
|
6935
|
+
/**
|
|
6936
|
+
* Get or create the program instance
|
|
6937
|
+
*/
|
|
6938
|
+
get program() {
|
|
6939
|
+
if (!this._program) {
|
|
6940
|
+
jbond_default.address = this.programId.toBase58();
|
|
6941
|
+
this._program = new anchor.Program(jbond_default, this.provider);
|
|
6942
|
+
}
|
|
6943
|
+
return this._program;
|
|
6944
|
+
}
|
|
6672
6945
|
/**
|
|
6673
6946
|
* Get the current program ID.
|
|
6674
6947
|
*/
|
|
6675
6948
|
get programId() {
|
|
6676
|
-
|
|
6949
|
+
if (this.options.programId) {
|
|
6950
|
+
return this.options.programId;
|
|
6951
|
+
}
|
|
6952
|
+
return new web3_js.PublicKey(ENV_PROGRAM_ID["prod" /* PROD */]);
|
|
6677
6953
|
}
|
|
6678
6954
|
/**
|
|
6679
6955
|
* Get the current connection.
|
|
@@ -6685,7 +6961,13 @@ var JBondClient = class _JBondClient {
|
|
|
6685
6961
|
* Set the environment.
|
|
6686
6962
|
*/
|
|
6687
6963
|
env(env) {
|
|
6688
|
-
|
|
6964
|
+
const envProgramId = ENV_PROGRAM_ID[env];
|
|
6965
|
+
if (!envProgramId) {
|
|
6966
|
+
throw new Error(`Invalid environment: ${env}`);
|
|
6967
|
+
}
|
|
6968
|
+
this._program = null;
|
|
6969
|
+
this.debug(`Set environment to ${env} with program ID: ${envProgramId.toString()}`);
|
|
6970
|
+
return this.configure("programId", new web3_js.PublicKey(envProgramId));
|
|
6689
6971
|
}
|
|
6690
6972
|
/**
|
|
6691
6973
|
* Configure a specific option.
|
|
@@ -6802,6 +7084,10 @@ var JBondClient = class _JBondClient {
|
|
|
6802
7084
|
const ix = await this.getBondSessionFinishIx(props);
|
|
6803
7085
|
return this.provider.sendAndConfirm?.(new web3_js.Transaction().add(ix));
|
|
6804
7086
|
}
|
|
7087
|
+
async bondRemove(props) {
|
|
7088
|
+
const ix = await this.getBondRemoveIx(props);
|
|
7089
|
+
return this.provider.sendAndConfirm?.(new web3_js.Transaction().add(ix));
|
|
7090
|
+
}
|
|
6805
7091
|
/**
|
|
6806
7092
|
* Build global state initialize instruction
|
|
6807
7093
|
*/
|
|
@@ -7015,9 +7301,14 @@ var JBondClient = class _JBondClient {
|
|
|
7015
7301
|
native: () => {
|
|
7016
7302
|
},
|
|
7017
7303
|
token: (mint) => {
|
|
7018
|
-
accounts.destinationTokenAccount = splToken.getAssociatedTokenAddressSync(mint, reserve, true);
|
|
7019
7304
|
accounts.bondTokenAccount = splToken.getAssociatedTokenAddressSync(mint, validatorBond, true);
|
|
7020
|
-
|
|
7305
|
+
if (reserve.equals(mint)) {
|
|
7306
|
+
accounts.reserveTokenAccount = null;
|
|
7307
|
+
accounts.destinationTokenAccount = null;
|
|
7308
|
+
} else {
|
|
7309
|
+
accounts.destinationTokenAccount = splToken.getAssociatedTokenAddressSync(mint, reserve, true);
|
|
7310
|
+
accounts.reserveTokenAccount = splToken.getAssociatedTokenAddressSync(mint, reserve, true);
|
|
7311
|
+
}
|
|
7021
7312
|
}
|
|
7022
7313
|
});
|
|
7023
7314
|
return this.program.methods.bondClaim(solToLamports(amount)).accountsPartial(accounts).instruction();
|
|
@@ -7087,6 +7378,42 @@ var JBondClient = class _JBondClient {
|
|
|
7087
7378
|
const ix = await this.getReleaseFundsIx(props);
|
|
7088
7379
|
return this.provider.sendAndConfirm?.(new web3_js.Transaction().add(ix));
|
|
7089
7380
|
}
|
|
7381
|
+
/**
|
|
7382
|
+
* Update epoch locks
|
|
7383
|
+
*/
|
|
7384
|
+
async updateEpochLocks(props) {
|
|
7385
|
+
const { bondType, bondName, voteAccount, payer } = props;
|
|
7386
|
+
const ix = await this.getUpdateEpochLocksIx({ bondType, bondName, voteAccount, payer });
|
|
7387
|
+
return this.provider.sendAndConfirm?.(new web3_js.Transaction().add(ix));
|
|
7388
|
+
}
|
|
7389
|
+
/**
|
|
7390
|
+
* Build update epoch locks instruction
|
|
7391
|
+
*/
|
|
7392
|
+
async getUpdateEpochLocksIx(props) {
|
|
7393
|
+
const { bondType, bondName, voteAccount, payer } = props;
|
|
7394
|
+
const [validatorBond, _] = this.pda.validatorBond(bondType, bondName, voteAccount);
|
|
7395
|
+
return this.program.methods.bondUpdate().accountsPartial({ validatorBond, payer }).instruction();
|
|
7396
|
+
}
|
|
7397
|
+
/**
|
|
7398
|
+
* Build bond remove instruction
|
|
7399
|
+
*/
|
|
7400
|
+
async getBondRemoveIx(props) {
|
|
7401
|
+
const { bondType, name } = props;
|
|
7402
|
+
const [bondState] = this.pda.bondState(bondType, name);
|
|
7403
|
+
const authority = props.authority ?? this.provider.wallet?.publicKey;
|
|
7404
|
+
return this.program.methods.bondRemove().accountsPartial({ bondState, authority }).instruction();
|
|
7405
|
+
}
|
|
7406
|
+
/**
|
|
7407
|
+
* Build test set last update epoch instruction
|
|
7408
|
+
* NOTE!: This instruction is for testing purposes only.
|
|
7409
|
+
* It allows direct manipulation of the validator bond's last epoch update.
|
|
7410
|
+
* This should not be used in production environments.
|
|
7411
|
+
*/
|
|
7412
|
+
async getTestSetLastUpdateEpochIx(props) {
|
|
7413
|
+
const { bondType, bondName, voteAccount, payer, epoch } = props;
|
|
7414
|
+
const [validatorBond, _] = this.pda.validatorBond(bondType, bondName, voteAccount);
|
|
7415
|
+
return this.program.methods.testSetLastUpdateEpoch(new import_bn.BN(epoch)).accountsPartial({ validatorBond, payer }).instruction();
|
|
7416
|
+
}
|
|
7090
7417
|
/**
|
|
7091
7418
|
* Build lock funds instruction
|
|
7092
7419
|
*/
|
|
@@ -7120,13 +7447,22 @@ var JBondClient = class _JBondClient {
|
|
|
7120
7447
|
*/
|
|
7121
7448
|
async getReleaseFundsIx(props) {
|
|
7122
7449
|
const { bondType, name, voteAccount, amount, withdrawAuthority } = props;
|
|
7450
|
+
const [bondState] = this.pda.bondState(bondType, name);
|
|
7123
7451
|
const [validatorBond] = this.pda.validatorBond(bondType, name, voteAccount);
|
|
7124
7452
|
const accounts = {
|
|
7453
|
+
bondState,
|
|
7125
7454
|
validatorBond,
|
|
7126
7455
|
payer: withdrawAuthority
|
|
7127
7456
|
};
|
|
7128
7457
|
return this.program.methods.bondReleaseFunds(solToLamports(amount)).accountsPartial(accounts).instruction();
|
|
7129
7458
|
}
|
|
7459
|
+
/**
|
|
7460
|
+
* Get available collateral for withdrawal (taking into account locked funds)
|
|
7461
|
+
*/
|
|
7462
|
+
async getAvailableCollateral(bondType, bondName, voteAccount) {
|
|
7463
|
+
const validatorBond = await this.getValidatorBond(bondType, bondName, voteAccount);
|
|
7464
|
+
return await this.getValidatorBondBalance(bondType, bondName, voteAccount) - validatorBond.locked.toNumber();
|
|
7465
|
+
}
|
|
7130
7466
|
/**
|
|
7131
7467
|
* Get all bond states with total collected collateral
|
|
7132
7468
|
*/
|