@jpool/bond-sdk 0.11.6 → 0.11.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +799 -1521
- package/dist/index.d.ts +799 -1521
- package/dist/index.js +301 -1244
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +310 -1245
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var anchor = require('@coral-xyz/anchor');
|
|
4
|
-
var splStakePool = require('@solana/spl-stake-pool');
|
|
5
4
|
var splToken = require('@solana/spl-token');
|
|
6
5
|
var web3_js = require('@solana/web3.js');
|
|
7
6
|
|
|
@@ -4569,15 +4568,20 @@ var import_bn = __toESM(require_bn());
|
|
|
4569
4568
|
|
|
4570
4569
|
// src/constants.ts
|
|
4571
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();
|
|
4572
4582
|
|
|
4573
4583
|
// src/types/index.ts
|
|
4574
4584
|
init_cjs_shims();
|
|
4575
|
-
var JBondClientEnv = /* @__PURE__ */ ((JBondClientEnv2) => {
|
|
4576
|
-
JBondClientEnv2["DEV"] = "dev";
|
|
4577
|
-
JBondClientEnv2["STAGE"] = "stage";
|
|
4578
|
-
JBondClientEnv2["PROD"] = "prod";
|
|
4579
|
-
return JBondClientEnv2;
|
|
4580
|
-
})(JBondClientEnv || {});
|
|
4581
4585
|
var SessionStatus = /* @__PURE__ */ ((SessionStatus2) => {
|
|
4582
4586
|
SessionStatus2[SessionStatus2["Live"] = 0] = "Live";
|
|
4583
4587
|
SessionStatus2[SessionStatus2["Finished"] = 1] = "Finished";
|
|
@@ -4589,29 +4593,13 @@ var BondType = /* @__PURE__ */ ((BondType2) => {
|
|
|
4589
4593
|
return BondType2;
|
|
4590
4594
|
})(BondType || {});
|
|
4591
4595
|
var BondTransactionType = /* @__PURE__ */ ((BondTransactionType2) => {
|
|
4592
|
-
BondTransactionType2["Registered"] = "registered";
|
|
4593
4596
|
BondTransactionType2["Deposit"] = "deposit";
|
|
4594
4597
|
BondTransactionType2["Withdrawal"] = "withdrawal";
|
|
4595
4598
|
BondTransactionType2["Compensation"] = "compensation";
|
|
4596
4599
|
return BondTransactionType2;
|
|
4597
4600
|
})(BondTransactionType || {});
|
|
4598
4601
|
|
|
4599
|
-
// src/constants.ts
|
|
4600
|
-
var GLOBAL_STATE_SEED = "global_state";
|
|
4601
|
-
var BOND_STATE_SEED = "bond_state";
|
|
4602
|
-
var VALIDATOR_BOND_SEED = "validator_bond";
|
|
4603
|
-
var STANDARD_BOND_SEED = "standard";
|
|
4604
|
-
var CROWDFUNDING_BOND_SEED = "crowdfunding";
|
|
4605
|
-
var ENV_PROGRAM_ID = {
|
|
4606
|
-
["dev" /* DEV */]: "Fo17edWRJewZNTRibgx9iTfjywCW6dzS81VwBLmPFVq1",
|
|
4607
|
-
["stage" /* STAGE */]: "Fo17edWRJewZNTRibgx9iTfjywCW6dzS81VwBLmPFVq1",
|
|
4608
|
-
["prod" /* PROD */]: "BondQ7KqZreTcW2UbeTNDcLCJQ3aXAtLn2Fm6ftaJDU"
|
|
4609
|
-
};
|
|
4610
|
-
var JSOL_MINT = new web3_js.PublicKey("7Q2afV64in6N6SeZsAAB81TJzwDoD6zpqmHkzi9Dcavn");
|
|
4611
|
-
var JPOOL_POOL_ADDRESS = new web3_js.PublicKey("CtMyWsrUtAwXWiGr9WjHT5fC3p3fgV8cyGpLTo2LJzG1");
|
|
4612
|
-
|
|
4613
4602
|
// src/history.ts
|
|
4614
|
-
init_cjs_shims();
|
|
4615
4603
|
var { bs58 } = anchor.utils.bytes;
|
|
4616
4604
|
var HistoryManager = class {
|
|
4617
4605
|
constructor(client) {
|
|
@@ -4675,7 +4663,7 @@ var HistoryManager = class {
|
|
|
4675
4663
|
continue;
|
|
4676
4664
|
}
|
|
4677
4665
|
const { type, amount } = this.decodeInstructionData(ix.data);
|
|
4678
|
-
if (!type || amount <= 0
|
|
4666
|
+
if (!type || amount <= 0) {
|
|
4679
4667
|
continue;
|
|
4680
4668
|
}
|
|
4681
4669
|
history.push({
|
|
@@ -4695,6 +4683,7 @@ var HistoryManager = class {
|
|
|
4695
4683
|
before: options?.before,
|
|
4696
4684
|
until: options?.until
|
|
4697
4685
|
}, "confirmed");
|
|
4686
|
+
console.log(sigs);
|
|
4698
4687
|
return sigs.filter((s) => !s.err);
|
|
4699
4688
|
}
|
|
4700
4689
|
async fetchParsedTransactions(sigs, batchSize = 100) {
|
|
@@ -4716,7 +4705,7 @@ var HistoryManager = class {
|
|
|
4716
4705
|
}
|
|
4717
4706
|
const ix = this.program.idl.instructions.find((i) => i.name === name);
|
|
4718
4707
|
if (!ix || !Array.isArray(ix.discriminator)) {
|
|
4719
|
-
|
|
4708
|
+
throw new Error(`Discriminator not found for instruction ${name}`);
|
|
4720
4709
|
}
|
|
4721
4710
|
const disc = new Uint8Array(ix.discriminator);
|
|
4722
4711
|
this.discCache.set(name, disc);
|
|
@@ -4724,45 +4713,47 @@ var HistoryManager = class {
|
|
|
4724
4713
|
}
|
|
4725
4714
|
decodeInstructionData(data) {
|
|
4726
4715
|
if (!data) {
|
|
4727
|
-
return {
|
|
4716
|
+
return {
|
|
4717
|
+
type: null,
|
|
4718
|
+
amount: 0
|
|
4719
|
+
};
|
|
4728
4720
|
}
|
|
4729
4721
|
try {
|
|
4730
4722
|
const buf = bs58.decode(data);
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
const
|
|
4742
|
-
const
|
|
4743
|
-
const
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
}
|
|
4755
|
-
}
|
|
4756
|
-
return { type, amount };
|
|
4757
|
-
} catch
|
|
4758
|
-
console.error("Failed to decode instruction data:", error);
|
|
4723
|
+
if (buf.length < 16) {
|
|
4724
|
+
return {
|
|
4725
|
+
type: null,
|
|
4726
|
+
amount: 0
|
|
4727
|
+
};
|
|
4728
|
+
}
|
|
4729
|
+
const disc = buf.slice(0, 8);
|
|
4730
|
+
const amountBytes = buf.slice(8, 16);
|
|
4731
|
+
const amount = new anchor.BN(amountBytes, "le").toNumber() / web3_js.LAMPORTS_PER_SOL;
|
|
4732
|
+
const perfRegister = this.getInstructionDiscriminator("perfBondRegister");
|
|
4733
|
+
const perfTopUp = this.getInstructionDiscriminator("perfBondTopUp");
|
|
4734
|
+
const perfClaim = this.getInstructionDiscriminator("perfBondClaim");
|
|
4735
|
+
const perfWithdraw = this.getInstructionDiscriminator("perfBondWithdraw");
|
|
4736
|
+
if (Buffer.from(disc).equals(Buffer.from(perfRegister))) {
|
|
4737
|
+
return { type: "deposit" /* Deposit */, amount };
|
|
4738
|
+
}
|
|
4739
|
+
if (Buffer.from(disc).equals(Buffer.from(perfTopUp))) {
|
|
4740
|
+
return { type: "deposit" /* Deposit */, amount };
|
|
4741
|
+
}
|
|
4742
|
+
if (Buffer.from(disc).equals(Buffer.from(perfClaim))) {
|
|
4743
|
+
return { type: "compensation" /* Compensation */, amount };
|
|
4744
|
+
}
|
|
4745
|
+
if (Buffer.from(disc).equals(Buffer.from(perfWithdraw))) {
|
|
4746
|
+
return { type: "withdrawal" /* Withdrawal */, amount };
|
|
4747
|
+
}
|
|
4748
|
+
return { type: null, amount: 0 };
|
|
4749
|
+
} catch {
|
|
4759
4750
|
return { type: null, amount: 0 };
|
|
4760
4751
|
}
|
|
4761
4752
|
}
|
|
4762
4753
|
};
|
|
4763
4754
|
function slotToEpoch(slot, cluster) {
|
|
4764
|
-
const
|
|
4765
|
-
const slotsPerEpoch =
|
|
4755
|
+
const isMainnet = !cluster || cluster === "mainnet-beta";
|
|
4756
|
+
const slotsPerEpoch = isMainnet ? 432e3 : 4e5;
|
|
4766
4757
|
return Math.floor(slot / slotsPerEpoch);
|
|
4767
4758
|
}
|
|
4768
4759
|
|
|
@@ -4771,7 +4762,7 @@ var jbond_default = {
|
|
|
4771
4762
|
address: "BondQ7KqZreTcW2UbeTNDcLCJQ3aXAtLn2Fm6ftaJDU",
|
|
4772
4763
|
metadata: {
|
|
4773
4764
|
name: "jbond",
|
|
4774
|
-
version: "0.2.
|
|
4765
|
+
version: "0.2.1",
|
|
4775
4766
|
spec: "0.1.0",
|
|
4776
4767
|
description: "Jpool Bond Program"
|
|
4777
4768
|
},
|
|
@@ -4846,10 +4837,7 @@ var jbond_default = {
|
|
|
4846
4837
|
},
|
|
4847
4838
|
{
|
|
4848
4839
|
name: "authority",
|
|
4849
|
-
signer: true
|
|
4850
|
-
relations: [
|
|
4851
|
-
"bond_state"
|
|
4852
|
-
]
|
|
4840
|
+
signer: true
|
|
4853
4841
|
},
|
|
4854
4842
|
{
|
|
4855
4843
|
name: "bond_token_account",
|
|
@@ -5020,84 +5008,6 @@ var jbond_default = {
|
|
|
5020
5008
|
}
|
|
5021
5009
|
]
|
|
5022
5010
|
},
|
|
5023
|
-
{
|
|
5024
|
-
name: "bond_lock_funds",
|
|
5025
|
-
docs: [
|
|
5026
|
-
"Locks funds immediately, making them unavailable for withdrawal.",
|
|
5027
|
-
"The locked amount takes effect immediately in the current epoch.",
|
|
5028
|
-
"",
|
|
5029
|
-
"# Errors",
|
|
5030
|
-
"Fails if the bond type is not lockable, if the amount is zero,",
|
|
5031
|
-
"or if there are insufficient available funds."
|
|
5032
|
-
],
|
|
5033
|
-
discriminator: [
|
|
5034
|
-
117,
|
|
5035
|
-
166,
|
|
5036
|
-
195,
|
|
5037
|
-
99,
|
|
5038
|
-
103,
|
|
5039
|
-
45,
|
|
5040
|
-
195,
|
|
5041
|
-
2
|
|
5042
|
-
],
|
|
5043
|
-
accounts: [
|
|
5044
|
-
{
|
|
5045
|
-
name: "bond_state",
|
|
5046
|
-
writable: true
|
|
5047
|
-
},
|
|
5048
|
-
{
|
|
5049
|
-
name: "validator_bond",
|
|
5050
|
-
writable: true,
|
|
5051
|
-
pda: {
|
|
5052
|
-
seeds: [
|
|
5053
|
-
{
|
|
5054
|
-
kind: "const",
|
|
5055
|
-
value: [
|
|
5056
|
-
118,
|
|
5057
|
-
97,
|
|
5058
|
-
108,
|
|
5059
|
-
105,
|
|
5060
|
-
100,
|
|
5061
|
-
97,
|
|
5062
|
-
116,
|
|
5063
|
-
111,
|
|
5064
|
-
114,
|
|
5065
|
-
95,
|
|
5066
|
-
98,
|
|
5067
|
-
111,
|
|
5068
|
-
110,
|
|
5069
|
-
100
|
|
5070
|
-
]
|
|
5071
|
-
},
|
|
5072
|
-
{
|
|
5073
|
-
kind: "account",
|
|
5074
|
-
path: "bond_state"
|
|
5075
|
-
},
|
|
5076
|
-
{
|
|
5077
|
-
kind: "account",
|
|
5078
|
-
path: "validator_bond.vote_account",
|
|
5079
|
-
account: "ValidatorBond"
|
|
5080
|
-
}
|
|
5081
|
-
]
|
|
5082
|
-
}
|
|
5083
|
-
},
|
|
5084
|
-
{
|
|
5085
|
-
name: "bond_token_account",
|
|
5086
|
-
optional: true
|
|
5087
|
-
},
|
|
5088
|
-
{
|
|
5089
|
-
name: "payer",
|
|
5090
|
-
writable: true,
|
|
5091
|
-
signer: true
|
|
5092
|
-
}
|
|
5093
|
-
],
|
|
5094
|
-
args: [
|
|
5095
|
-
{
|
|
5096
|
-
name: "amount",
|
|
5097
|
-
type: "u64"
|
|
5098
|
-
}
|
|
5099
|
-
]
|
|
5100
|
-
},
|
|
5101
5011
|
{
|
|
5102
5012
|
name: "bond_register",
|
|
5103
5013
|
docs: [
|
|
@@ -5125,34 +5035,7 @@ var jbond_default = {
|
|
|
5125
5035
|
accounts: [
|
|
5126
5036
|
{
|
|
5127
5037
|
name: "bond_state",
|
|
5128
|
-
writable: true
|
|
5129
|
-
pda: {
|
|
5130
|
-
seeds: [
|
|
5131
|
-
{
|
|
5132
|
-
kind: "const",
|
|
5133
|
-
value: [
|
|
5134
|
-
98,
|
|
5135
|
-
111,
|
|
5136
|
-
110,
|
|
5137
|
-
100,
|
|
5138
|
-
95,
|
|
5139
|
-
115,
|
|
5140
|
-
116,
|
|
5141
|
-
97,
|
|
5142
|
-
116,
|
|
5143
|
-
101
|
|
5144
|
-
]
|
|
5145
|
-
},
|
|
5146
|
-
{
|
|
5147
|
-
kind: "arg",
|
|
5148
|
-
path: "bond_type"
|
|
5149
|
-
},
|
|
5150
|
-
{
|
|
5151
|
-
kind: "arg",
|
|
5152
|
-
path: "bond_name"
|
|
5153
|
-
}
|
|
5154
|
-
]
|
|
5155
|
-
}
|
|
5038
|
+
writable: true
|
|
5156
5039
|
},
|
|
5157
5040
|
{
|
|
5158
5041
|
name: "validator_bond",
|
|
@@ -5237,112 +5120,6 @@ var jbond_default = {
|
|
|
5237
5120
|
}
|
|
5238
5121
|
]
|
|
5239
5122
|
},
|
|
5240
|
-
{
|
|
5241
|
-
name: "bond_release_funds",
|
|
5242
|
-
docs: [
|
|
5243
|
-
"Queues funds for unlock in the next epoch.",
|
|
5244
|
-
"The unlock is delayed by one epoch for security - funds remain locked",
|
|
5245
|
-
"in the current epoch but will be available after epoch transition.",
|
|
5246
|
-
"",
|
|
5247
|
-
"# Errors",
|
|
5248
|
-
"Fails if the bond type is not lockable, if the amount is zero,",
|
|
5249
|
-
"or if the amount exceeds currently locked funds."
|
|
5250
|
-
],
|
|
5251
|
-
discriminator: [
|
|
5252
|
-
184,
|
|
5253
|
-
224,
|
|
5254
|
-
14,
|
|
5255
|
-
24,
|
|
5256
|
-
76,
|
|
5257
|
-
14,
|
|
5258
|
-
226,
|
|
5259
|
-
190
|
|
5260
|
-
],
|
|
5261
|
-
accounts: [
|
|
5262
|
-
{
|
|
5263
|
-
name: "bond_state",
|
|
5264
|
-
writable: true
|
|
5265
|
-
},
|
|
5266
|
-
{
|
|
5267
|
-
name: "validator_bond",
|
|
5268
|
-
writable: true,
|
|
5269
|
-
pda: {
|
|
5270
|
-
seeds: [
|
|
5271
|
-
{
|
|
5272
|
-
kind: "const",
|
|
5273
|
-
value: [
|
|
5274
|
-
118,
|
|
5275
|
-
97,
|
|
5276
|
-
108,
|
|
5277
|
-
105,
|
|
5278
|
-
100,
|
|
5279
|
-
97,
|
|
5280
|
-
116,
|
|
5281
|
-
111,
|
|
5282
|
-
114,
|
|
5283
|
-
95,
|
|
5284
|
-
98,
|
|
5285
|
-
111,
|
|
5286
|
-
110,
|
|
5287
|
-
100
|
|
5288
|
-
]
|
|
5289
|
-
},
|
|
5290
|
-
{
|
|
5291
|
-
kind: "account",
|
|
5292
|
-
path: "bond_state"
|
|
5293
|
-
},
|
|
5294
|
-
{
|
|
5295
|
-
kind: "account",
|
|
5296
|
-
path: "validator_bond.vote_account",
|
|
5297
|
-
account: "ValidatorBond"
|
|
5298
|
-
}
|
|
5299
|
-
]
|
|
5300
|
-
}
|
|
5301
|
-
},
|
|
5302
|
-
{
|
|
5303
|
-
name: "payer",
|
|
5304
|
-
writable: true,
|
|
5305
|
-
signer: true
|
|
5306
|
-
}
|
|
5307
|
-
],
|
|
5308
|
-
args: [
|
|
5309
|
-
{
|
|
5310
|
-
name: "amount",
|
|
5311
|
-
type: "u64"
|
|
5312
|
-
}
|
|
5313
|
-
]
|
|
5314
|
-
},
|
|
5315
|
-
{
|
|
5316
|
-
name: "bond_remove",
|
|
5317
|
-
docs: [
|
|
5318
|
-
"Removes bond state"
|
|
5319
|
-
],
|
|
5320
|
-
discriminator: [
|
|
5321
|
-
121,
|
|
5322
|
-
112,
|
|
5323
|
-
246,
|
|
5324
|
-
177,
|
|
5325
|
-
181,
|
|
5326
|
-
8,
|
|
5327
|
-
18,
|
|
5328
|
-
220
|
|
5329
|
-
],
|
|
5330
|
-
accounts: [
|
|
5331
|
-
{
|
|
5332
|
-
name: "bond_state",
|
|
5333
|
-
writable: true
|
|
5334
|
-
},
|
|
5335
|
-
{
|
|
5336
|
-
name: "authority",
|
|
5337
|
-
writable: true,
|
|
5338
|
-
signer: true,
|
|
5339
|
-
relations: [
|
|
5340
|
-
"bond_state"
|
|
5341
|
-
]
|
|
5342
|
-
}
|
|
5343
|
-
],
|
|
5344
|
-
args: []
|
|
5345
|
-
},
|
|
5346
5123
|
{
|
|
5347
5124
|
name: "bond_set_withdraw_authority",
|
|
5348
5125
|
docs: [
|
|
@@ -5633,117 +5410,20 @@ var jbond_default = {
|
|
|
5633
5410
|
]
|
|
5634
5411
|
},
|
|
5635
5412
|
{
|
|
5636
|
-
name: "
|
|
5637
|
-
docs: [
|
|
5638
|
-
"Closes a validator bond account and transfers remaining balance to the rent receiver.",
|
|
5639
|
-
"",
|
|
5640
|
-
"# Security",
|
|
5641
|
-
"- Only the validator identity or withdrawal authority can close the bond",
|
|
5642
|
-
"- All funds must be unlocked (locked == 0 and pending_unlock == 0)",
|
|
5643
|
-
"- For token collateral, closes the associated token account as well",
|
|
5644
|
-
"- Decrements the bond state's total_members counter",
|
|
5645
|
-
"",
|
|
5646
|
-
"# Errors",
|
|
5647
|
-
"Fails if the signer is not authorized, if funds are still locked,",
|
|
5648
|
-
"or if the rent receiver is not the identity or withdrawal authority."
|
|
5649
|
-
],
|
|
5413
|
+
name: "global_configure",
|
|
5650
5414
|
discriminator: [
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5415
|
+
67,
|
|
5416
|
+
142,
|
|
5417
|
+
164,
|
|
5418
|
+
250,
|
|
5419
|
+
90,
|
|
5420
|
+
233,
|
|
5421
|
+
144,
|
|
5422
|
+
187
|
|
5659
5423
|
],
|
|
5660
5424
|
accounts: [
|
|
5661
5425
|
{
|
|
5662
|
-
name: "
|
|
5663
|
-
writable: true
|
|
5664
|
-
},
|
|
5665
|
-
{
|
|
5666
|
-
name: "validator_bond",
|
|
5667
|
-
writable: true,
|
|
5668
|
-
pda: {
|
|
5669
|
-
seeds: [
|
|
5670
|
-
{
|
|
5671
|
-
kind: "const",
|
|
5672
|
-
value: [
|
|
5673
|
-
118,
|
|
5674
|
-
97,
|
|
5675
|
-
108,
|
|
5676
|
-
105,
|
|
5677
|
-
100,
|
|
5678
|
-
97,
|
|
5679
|
-
116,
|
|
5680
|
-
111,
|
|
5681
|
-
114,
|
|
5682
|
-
95,
|
|
5683
|
-
98,
|
|
5684
|
-
111,
|
|
5685
|
-
110,
|
|
5686
|
-
100
|
|
5687
|
-
]
|
|
5688
|
-
},
|
|
5689
|
-
{
|
|
5690
|
-
kind: "account",
|
|
5691
|
-
path: "bond_state"
|
|
5692
|
-
},
|
|
5693
|
-
{
|
|
5694
|
-
kind: "account",
|
|
5695
|
-
path: "validator_bond.vote_account",
|
|
5696
|
-
account: "ValidatorBond"
|
|
5697
|
-
}
|
|
5698
|
-
]
|
|
5699
|
-
}
|
|
5700
|
-
},
|
|
5701
|
-
{
|
|
5702
|
-
name: "authority",
|
|
5703
|
-
writable: true,
|
|
5704
|
-
signer: true
|
|
5705
|
-
},
|
|
5706
|
-
{
|
|
5707
|
-
name: "rent_receiver",
|
|
5708
|
-
writable: true
|
|
5709
|
-
},
|
|
5710
|
-
{
|
|
5711
|
-
name: "bond_token_account",
|
|
5712
|
-
writable: true,
|
|
5713
|
-
optional: true
|
|
5714
|
-
},
|
|
5715
|
-
{
|
|
5716
|
-
name: "destination_token_account",
|
|
5717
|
-
writable: true,
|
|
5718
|
-
optional: true
|
|
5719
|
-
},
|
|
5720
|
-
{
|
|
5721
|
-
name: "system_program",
|
|
5722
|
-
address: "11111111111111111111111111111111"
|
|
5723
|
-
},
|
|
5724
|
-
{
|
|
5725
|
-
name: "token_program",
|
|
5726
|
-
optional: true,
|
|
5727
|
-
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
5728
|
-
}
|
|
5729
|
-
],
|
|
5730
|
-
args: []
|
|
5731
|
-
},
|
|
5732
|
-
{
|
|
5733
|
-
name: "global_configure",
|
|
5734
|
-
discriminator: [
|
|
5735
|
-
67,
|
|
5736
|
-
142,
|
|
5737
|
-
164,
|
|
5738
|
-
250,
|
|
5739
|
-
90,
|
|
5740
|
-
233,
|
|
5741
|
-
144,
|
|
5742
|
-
187
|
|
5743
|
-
],
|
|
5744
|
-
accounts: [
|
|
5745
|
-
{
|
|
5746
|
-
name: "global_state",
|
|
5426
|
+
name: "global_state",
|
|
5747
5427
|
writable: true,
|
|
5748
5428
|
pda: {
|
|
5749
5429
|
seeds: [
|
|
@@ -5836,6 +5516,80 @@ var jbond_default = {
|
|
|
5836
5516
|
],
|
|
5837
5517
|
args: []
|
|
5838
5518
|
},
|
|
5519
|
+
{
|
|
5520
|
+
name: "migrate_bond",
|
|
5521
|
+
docs: [
|
|
5522
|
+
"Migrates validator bond data from legacy structure to new structure."
|
|
5523
|
+
],
|
|
5524
|
+
discriminator: [
|
|
5525
|
+
107,
|
|
5526
|
+
119,
|
|
5527
|
+
59,
|
|
5528
|
+
110,
|
|
5529
|
+
76,
|
|
5530
|
+
18,
|
|
5531
|
+
37,
|
|
5532
|
+
163
|
|
5533
|
+
],
|
|
5534
|
+
accounts: [
|
|
5535
|
+
{
|
|
5536
|
+
name: "bond_state",
|
|
5537
|
+
writable: true
|
|
5538
|
+
},
|
|
5539
|
+
{
|
|
5540
|
+
name: "legacy_validator_bond",
|
|
5541
|
+
writable: true
|
|
5542
|
+
},
|
|
5543
|
+
{
|
|
5544
|
+
name: "legacy_vote_account"
|
|
5545
|
+
},
|
|
5546
|
+
{
|
|
5547
|
+
name: "validator_bond",
|
|
5548
|
+
writable: true,
|
|
5549
|
+
pda: {
|
|
5550
|
+
seeds: [
|
|
5551
|
+
{
|
|
5552
|
+
kind: "const",
|
|
5553
|
+
value: [
|
|
5554
|
+
118,
|
|
5555
|
+
97,
|
|
5556
|
+
108,
|
|
5557
|
+
105,
|
|
5558
|
+
100,
|
|
5559
|
+
97,
|
|
5560
|
+
116,
|
|
5561
|
+
111,
|
|
5562
|
+
114,
|
|
5563
|
+
95,
|
|
5564
|
+
98,
|
|
5565
|
+
111,
|
|
5566
|
+
110,
|
|
5567
|
+
100
|
|
5568
|
+
]
|
|
5569
|
+
},
|
|
5570
|
+
{
|
|
5571
|
+
kind: "account",
|
|
5572
|
+
path: "bond_state"
|
|
5573
|
+
},
|
|
5574
|
+
{
|
|
5575
|
+
kind: "account",
|
|
5576
|
+
path: "legacy_vote_account"
|
|
5577
|
+
}
|
|
5578
|
+
]
|
|
5579
|
+
}
|
|
5580
|
+
},
|
|
5581
|
+
{
|
|
5582
|
+
name: "creator",
|
|
5583
|
+
writable: true,
|
|
5584
|
+
signer: true
|
|
5585
|
+
},
|
|
5586
|
+
{
|
|
5587
|
+
name: "system_program",
|
|
5588
|
+
address: "11111111111111111111111111111111"
|
|
5589
|
+
}
|
|
5590
|
+
],
|
|
5591
|
+
args: []
|
|
5592
|
+
},
|
|
5839
5593
|
{
|
|
5840
5594
|
name: "session_finish",
|
|
5841
5595
|
docs: [
|
|
@@ -5946,19 +5700,6 @@ var jbond_default = {
|
|
|
5946
5700
|
}
|
|
5947
5701
|
],
|
|
5948
5702
|
events: [
|
|
5949
|
-
{
|
|
5950
|
-
name: "BondConfigured",
|
|
5951
|
-
discriminator: [
|
|
5952
|
-
141,
|
|
5953
|
-
252,
|
|
5954
|
-
43,
|
|
5955
|
-
54,
|
|
5956
|
-
45,
|
|
5957
|
-
157,
|
|
5958
|
-
81,
|
|
5959
|
-
14
|
|
5960
|
-
]
|
|
5961
|
-
},
|
|
5962
5703
|
{
|
|
5963
5704
|
name: "BondFinished",
|
|
5964
5705
|
discriminator: [
|
|
@@ -5972,32 +5713,6 @@ var jbond_default = {
|
|
|
5972
5713
|
191
|
|
5973
5714
|
]
|
|
5974
5715
|
},
|
|
5975
|
-
{
|
|
5976
|
-
name: "BondInitialized",
|
|
5977
|
-
discriminator: [
|
|
5978
|
-
73,
|
|
5979
|
-
68,
|
|
5980
|
-
161,
|
|
5981
|
-
2,
|
|
5982
|
-
214,
|
|
5983
|
-
12,
|
|
5984
|
-
169,
|
|
5985
|
-
53
|
|
5986
|
-
]
|
|
5987
|
-
},
|
|
5988
|
-
{
|
|
5989
|
-
name: "BondRemoved",
|
|
5990
|
-
discriminator: [
|
|
5991
|
-
177,
|
|
5992
|
-
200,
|
|
5993
|
-
116,
|
|
5994
|
-
123,
|
|
5995
|
-
1,
|
|
5996
|
-
244,
|
|
5997
|
-
161,
|
|
5998
|
-
240
|
|
5999
|
-
]
|
|
6000
|
-
},
|
|
6001
5716
|
{
|
|
6002
5717
|
name: "BondStarted",
|
|
6003
5718
|
discriminator: [
|
|
@@ -6012,16 +5727,16 @@ var jbond_default = {
|
|
|
6012
5727
|
]
|
|
6013
5728
|
},
|
|
6014
5729
|
{
|
|
6015
|
-
name: "
|
|
5730
|
+
name: "CollateralToppedUp",
|
|
6016
5731
|
discriminator: [
|
|
6017
|
-
|
|
6018
|
-
|
|
6019
|
-
|
|
6020
|
-
|
|
5732
|
+
189,
|
|
5733
|
+
137,
|
|
5734
|
+
204,
|
|
5735
|
+
58,
|
|
6021
5736
|
135,
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
5737
|
+
182,
|
|
5738
|
+
19,
|
|
5739
|
+
176
|
|
6025
5740
|
]
|
|
6026
5741
|
},
|
|
6027
5742
|
{
|
|
@@ -6037,19 +5752,6 @@ var jbond_default = {
|
|
|
6037
5752
|
82
|
|
6038
5753
|
]
|
|
6039
5754
|
},
|
|
6040
|
-
{
|
|
6041
|
-
name: "CompensationBurned",
|
|
6042
|
-
discriminator: [
|
|
6043
|
-
177,
|
|
6044
|
-
198,
|
|
6045
|
-
90,
|
|
6046
|
-
188,
|
|
6047
|
-
47,
|
|
6048
|
-
95,
|
|
6049
|
-
20,
|
|
6050
|
-
174
|
|
6051
|
-
]
|
|
6052
|
-
},
|
|
6053
5755
|
{
|
|
6054
5756
|
name: "CompensationClaimed",
|
|
6055
5757
|
discriminator: [
|
|
@@ -6063,45 +5765,6 @@ var jbond_default = {
|
|
|
6063
5765
|
32
|
|
6064
5766
|
]
|
|
6065
5767
|
},
|
|
6066
|
-
{
|
|
6067
|
-
name: "FundsLocked",
|
|
6068
|
-
discriminator: [
|
|
6069
|
-
227,
|
|
6070
|
-
93,
|
|
6071
|
-
162,
|
|
6072
|
-
69,
|
|
6073
|
-
181,
|
|
6074
|
-
4,
|
|
6075
|
-
71,
|
|
6076
|
-
157
|
|
6077
|
-
]
|
|
6078
|
-
},
|
|
6079
|
-
{
|
|
6080
|
-
name: "FundsUnlocked",
|
|
6081
|
-
discriminator: [
|
|
6082
|
-
11,
|
|
6083
|
-
240,
|
|
6084
|
-
184,
|
|
6085
|
-
107,
|
|
6086
|
-
86,
|
|
6087
|
-
187,
|
|
6088
|
-
196,
|
|
6089
|
-
128
|
|
6090
|
-
]
|
|
6091
|
-
},
|
|
6092
|
-
{
|
|
6093
|
-
name: "ValidatorBondClosed",
|
|
6094
|
-
discriminator: [
|
|
6095
|
-
71,
|
|
6096
|
-
54,
|
|
6097
|
-
59,
|
|
6098
|
-
241,
|
|
6099
|
-
91,
|
|
6100
|
-
35,
|
|
6101
|
-
123,
|
|
6102
|
-
123
|
|
6103
|
-
]
|
|
6104
|
-
},
|
|
6105
5768
|
{
|
|
6106
5769
|
name: "ValidatorRegistered",
|
|
6107
5770
|
discriminator: [
|
|
@@ -6114,46 +5777,33 @@ var jbond_default = {
|
|
|
6114
5777
|
95,
|
|
6115
5778
|
72
|
|
6116
5779
|
]
|
|
6117
|
-
},
|
|
6118
|
-
{
|
|
6119
|
-
name: "WithdrawAuthorityChanged",
|
|
6120
|
-
discriminator: [
|
|
6121
|
-
91,
|
|
6122
|
-
149,
|
|
6123
|
-
224,
|
|
6124
|
-
49,
|
|
6125
|
-
187,
|
|
6126
|
-
48,
|
|
6127
|
-
190,
|
|
6128
|
-
100
|
|
6129
|
-
]
|
|
6130
5780
|
}
|
|
6131
5781
|
],
|
|
6132
5782
|
errors: [
|
|
6133
5783
|
{
|
|
6134
5784
|
code: 6e3,
|
|
6135
|
-
name: "
|
|
6136
|
-
msg: "
|
|
5785
|
+
name: "InvalidVoteAccount",
|
|
5786
|
+
msg: "Invalid vote account"
|
|
6137
5787
|
},
|
|
6138
5788
|
{
|
|
6139
5789
|
code: 6001,
|
|
6140
|
-
name: "
|
|
6141
|
-
msg: "
|
|
5790
|
+
name: "IdentityMismatch",
|
|
5791
|
+
msg: "Identity does not match vote account"
|
|
6142
5792
|
},
|
|
6143
5793
|
{
|
|
6144
5794
|
code: 6002,
|
|
6145
|
-
name: "
|
|
6146
|
-
msg: "
|
|
5795
|
+
name: "InsufficientCollateral",
|
|
5796
|
+
msg: "Insufficient collateral amount"
|
|
6147
5797
|
},
|
|
6148
5798
|
{
|
|
6149
5799
|
code: 6003,
|
|
6150
|
-
name: "
|
|
6151
|
-
msg: "
|
|
5800
|
+
name: "TargetAprTooLow",
|
|
5801
|
+
msg: "Target APR is below minimum threshold"
|
|
6152
5802
|
},
|
|
6153
5803
|
{
|
|
6154
5804
|
code: 6004,
|
|
6155
|
-
name: "
|
|
6156
|
-
msg: "
|
|
5805
|
+
name: "MathOverflow",
|
|
5806
|
+
msg: "Math overflow"
|
|
6157
5807
|
},
|
|
6158
5808
|
{
|
|
6159
5809
|
code: 6005,
|
|
@@ -6162,53 +5812,93 @@ var jbond_default = {
|
|
|
6162
5812
|
},
|
|
6163
5813
|
{
|
|
6164
5814
|
code: 6006,
|
|
6165
|
-
name: "
|
|
6166
|
-
msg: "
|
|
5815
|
+
name: "ValidatorNotActive",
|
|
5816
|
+
msg: "Validator bond account is not active"
|
|
6167
5817
|
},
|
|
6168
5818
|
{
|
|
6169
5819
|
code: 6007,
|
|
6170
|
-
name: "
|
|
6171
|
-
msg: "
|
|
5820
|
+
name: "ValidatorAlreadyRegistered",
|
|
5821
|
+
msg: "Validator already registered"
|
|
6172
5822
|
},
|
|
6173
5823
|
{
|
|
6174
5824
|
code: 6008,
|
|
6175
|
-
name: "
|
|
6176
|
-
msg: "
|
|
5825
|
+
name: "Unauthorized",
|
|
5826
|
+
msg: "Unauthorized"
|
|
6177
5827
|
},
|
|
6178
5828
|
{
|
|
6179
5829
|
code: 6009,
|
|
6180
|
-
name: "
|
|
6181
|
-
msg: "
|
|
5830
|
+
name: "WithdrawalLockedNearEpochEnd",
|
|
5831
|
+
msg: "Withdrawals are locked near the end of the epoch."
|
|
6182
5832
|
},
|
|
6183
5833
|
{
|
|
6184
5834
|
code: 6010,
|
|
6185
|
-
name: "
|
|
6186
|
-
msg: "
|
|
5835
|
+
name: "MissingTokenAccounts",
|
|
5836
|
+
msg: "Missing token accounts for token collateral type"
|
|
6187
5837
|
},
|
|
6188
5838
|
{
|
|
6189
5839
|
code: 6011,
|
|
6190
|
-
name: "
|
|
6191
|
-
msg: "
|
|
5840
|
+
name: "MissingTokenProgram",
|
|
5841
|
+
msg: "Token program is required for token collateral type"
|
|
6192
5842
|
},
|
|
6193
5843
|
{
|
|
6194
5844
|
code: 6012,
|
|
6195
|
-
name: "
|
|
6196
|
-
msg: "
|
|
5845
|
+
name: "InvalidMint",
|
|
5846
|
+
msg: "Invalid mint for token collateral type"
|
|
6197
5847
|
},
|
|
6198
5848
|
{
|
|
6199
5849
|
code: 6013,
|
|
6200
5850
|
name: "MissingStakeAccount",
|
|
6201
|
-
msg: "
|
|
5851
|
+
msg: "Stake account is required for stake account collateral type"
|
|
6202
5852
|
},
|
|
6203
5853
|
{
|
|
6204
5854
|
code: 6014,
|
|
6205
5855
|
name: "MissingStakeProgram",
|
|
6206
|
-
msg: "
|
|
5856
|
+
msg: "Stake program is required for stake account collateral type"
|
|
6207
5857
|
},
|
|
6208
5858
|
{
|
|
6209
5859
|
code: 6015,
|
|
5860
|
+
name: "BondFinished",
|
|
5861
|
+
msg: "Bond is finished (deposits/withdrawals disabled)"
|
|
5862
|
+
},
|
|
5863
|
+
{
|
|
5864
|
+
code: 6016,
|
|
5865
|
+
name: "BondNotFinished",
|
|
5866
|
+
msg: "Bond is not finished"
|
|
5867
|
+
},
|
|
5868
|
+
{
|
|
5869
|
+
code: 6017,
|
|
6210
5870
|
name: "UnsupportedCollateralType",
|
|
6211
5871
|
msg: "Unsupported collateral type"
|
|
5872
|
+
},
|
|
5873
|
+
{
|
|
5874
|
+
code: 6018,
|
|
5875
|
+
name: "Overflow",
|
|
5876
|
+
msg: "Math operation overflowed"
|
|
5877
|
+
},
|
|
5878
|
+
{
|
|
5879
|
+
code: 6019,
|
|
5880
|
+
name: "IncorrectBondType",
|
|
5881
|
+
msg: "Incorrect bond type for this operation"
|
|
5882
|
+
},
|
|
5883
|
+
{
|
|
5884
|
+
code: 6020,
|
|
5885
|
+
name: "BondNotFinishable",
|
|
5886
|
+
msg: "This bond type can't be finished"
|
|
5887
|
+
},
|
|
5888
|
+
{
|
|
5889
|
+
code: 6021,
|
|
5890
|
+
name: "InvalidArgument",
|
|
5891
|
+
msg: "Invalid argument provided"
|
|
5892
|
+
},
|
|
5893
|
+
{
|
|
5894
|
+
code: 6022,
|
|
5895
|
+
name: "BondNotDisabled",
|
|
5896
|
+
msg: "Bond is not disabled"
|
|
5897
|
+
},
|
|
5898
|
+
{
|
|
5899
|
+
code: 6023,
|
|
5900
|
+
name: "BondNotEnabled",
|
|
5901
|
+
msg: "Bond is not enabled"
|
|
6212
5902
|
}
|
|
6213
5903
|
],
|
|
6214
5904
|
types: [
|
|
@@ -6242,26 +5932,6 @@ var jbond_default = {
|
|
|
6242
5932
|
]
|
|
6243
5933
|
}
|
|
6244
5934
|
},
|
|
6245
|
-
{
|
|
6246
|
-
name: "BondConfigured",
|
|
6247
|
-
type: {
|
|
6248
|
-
kind: "struct",
|
|
6249
|
-
fields: [
|
|
6250
|
-
{
|
|
6251
|
-
name: "bond",
|
|
6252
|
-
type: "pubkey"
|
|
6253
|
-
},
|
|
6254
|
-
{
|
|
6255
|
-
name: "authority",
|
|
6256
|
-
type: "pubkey"
|
|
6257
|
-
},
|
|
6258
|
-
{
|
|
6259
|
-
name: "timestamp",
|
|
6260
|
-
type: "i64"
|
|
6261
|
-
}
|
|
6262
|
-
]
|
|
6263
|
-
}
|
|
6264
|
-
},
|
|
6265
5935
|
{
|
|
6266
5936
|
name: "BondFinished",
|
|
6267
5937
|
type: {
|
|
@@ -6317,46 +5987,6 @@ var jbond_default = {
|
|
|
6317
5987
|
]
|
|
6318
5988
|
}
|
|
6319
5989
|
},
|
|
6320
|
-
{
|
|
6321
|
-
name: "BondInitialized",
|
|
6322
|
-
type: {
|
|
6323
|
-
kind: "struct",
|
|
6324
|
-
fields: [
|
|
6325
|
-
{
|
|
6326
|
-
name: "bond",
|
|
6327
|
-
type: "pubkey"
|
|
6328
|
-
},
|
|
6329
|
-
{
|
|
6330
|
-
name: "authority",
|
|
6331
|
-
type: "pubkey"
|
|
6332
|
-
},
|
|
6333
|
-
{
|
|
6334
|
-
name: "timestamp",
|
|
6335
|
-
type: "i64"
|
|
6336
|
-
}
|
|
6337
|
-
]
|
|
6338
|
-
}
|
|
6339
|
-
},
|
|
6340
|
-
{
|
|
6341
|
-
name: "BondRemoved",
|
|
6342
|
-
type: {
|
|
6343
|
-
kind: "struct",
|
|
6344
|
-
fields: [
|
|
6345
|
-
{
|
|
6346
|
-
name: "bond",
|
|
6347
|
-
type: "pubkey"
|
|
6348
|
-
},
|
|
6349
|
-
{
|
|
6350
|
-
name: "authority",
|
|
6351
|
-
type: "pubkey"
|
|
6352
|
-
},
|
|
6353
|
-
{
|
|
6354
|
-
name: "timestamp",
|
|
6355
|
-
type: "i64"
|
|
6356
|
-
}
|
|
6357
|
-
]
|
|
6358
|
-
}
|
|
6359
|
-
},
|
|
6360
5990
|
{
|
|
6361
5991
|
name: "BondStarted",
|
|
6362
5992
|
type: {
|
|
@@ -6510,7 +6140,7 @@ var jbond_default = {
|
|
|
6510
6140
|
}
|
|
6511
6141
|
},
|
|
6512
6142
|
{
|
|
6513
|
-
name: "
|
|
6143
|
+
name: "CollateralToppedUp",
|
|
6514
6144
|
type: {
|
|
6515
6145
|
kind: "struct",
|
|
6516
6146
|
fields: [
|
|
@@ -6580,34 +6210,6 @@ var jbond_default = {
|
|
|
6580
6210
|
]
|
|
6581
6211
|
}
|
|
6582
6212
|
},
|
|
6583
|
-
{
|
|
6584
|
-
name: "CompensationBurned",
|
|
6585
|
-
type: {
|
|
6586
|
-
kind: "struct",
|
|
6587
|
-
fields: [
|
|
6588
|
-
{
|
|
6589
|
-
name: "validator",
|
|
6590
|
-
type: "pubkey"
|
|
6591
|
-
},
|
|
6592
|
-
{
|
|
6593
|
-
name: "amount",
|
|
6594
|
-
type: "u64"
|
|
6595
|
-
},
|
|
6596
|
-
{
|
|
6597
|
-
name: "post_balance",
|
|
6598
|
-
type: "u64"
|
|
6599
|
-
},
|
|
6600
|
-
{
|
|
6601
|
-
name: "epoch",
|
|
6602
|
-
type: "u64"
|
|
6603
|
-
},
|
|
6604
|
-
{
|
|
6605
|
-
name: "timestamp",
|
|
6606
|
-
type: "i64"
|
|
6607
|
-
}
|
|
6608
|
-
]
|
|
6609
|
-
}
|
|
6610
|
-
},
|
|
6611
6213
|
{
|
|
6612
6214
|
name: "CompensationClaimed",
|
|
6613
6215
|
type: {
|
|
@@ -6636,54 +6238,6 @@ var jbond_default = {
|
|
|
6636
6238
|
]
|
|
6637
6239
|
}
|
|
6638
6240
|
},
|
|
6639
|
-
{
|
|
6640
|
-
name: "FundsLocked",
|
|
6641
|
-
type: {
|
|
6642
|
-
kind: "struct",
|
|
6643
|
-
fields: [
|
|
6644
|
-
{
|
|
6645
|
-
name: "validator",
|
|
6646
|
-
type: "pubkey"
|
|
6647
|
-
},
|
|
6648
|
-
{
|
|
6649
|
-
name: "amount",
|
|
6650
|
-
type: "u64"
|
|
6651
|
-
},
|
|
6652
|
-
{
|
|
6653
|
-
name: "total_locked",
|
|
6654
|
-
type: "u64"
|
|
6655
|
-
},
|
|
6656
|
-
{
|
|
6657
|
-
name: "epoch",
|
|
6658
|
-
type: "u64"
|
|
6659
|
-
}
|
|
6660
|
-
]
|
|
6661
|
-
}
|
|
6662
|
-
},
|
|
6663
|
-
{
|
|
6664
|
-
name: "FundsUnlocked",
|
|
6665
|
-
type: {
|
|
6666
|
-
kind: "struct",
|
|
6667
|
-
fields: [
|
|
6668
|
-
{
|
|
6669
|
-
name: "validator",
|
|
6670
|
-
type: "pubkey"
|
|
6671
|
-
},
|
|
6672
|
-
{
|
|
6673
|
-
name: "amount",
|
|
6674
|
-
type: "u64"
|
|
6675
|
-
},
|
|
6676
|
-
{
|
|
6677
|
-
name: "pending_unlock",
|
|
6678
|
-
type: "u64"
|
|
6679
|
-
},
|
|
6680
|
-
{
|
|
6681
|
-
name: "epoch",
|
|
6682
|
-
type: "u64"
|
|
6683
|
-
}
|
|
6684
|
-
]
|
|
6685
|
-
}
|
|
6686
|
-
},
|
|
6687
6241
|
{
|
|
6688
6242
|
name: "GlobalConfigureData",
|
|
6689
6243
|
type: {
|
|
@@ -6706,69 +6260,9 @@ var jbond_default = {
|
|
|
6706
6260
|
{
|
|
6707
6261
|
name: "authority",
|
|
6708
6262
|
docs: [
|
|
6709
|
-
"The authority allowed to manage the program"
|
|
6710
|
-
],
|
|
6711
|
-
type: "pubkey"
|
|
6712
|
-
},
|
|
6713
|
-
{
|
|
6714
|
-
name: "bump",
|
|
6715
|
-
docs: [
|
|
6716
|
-
"Bump for the PDA"
|
|
6717
|
-
],
|
|
6718
|
-
type: "u8"
|
|
6719
|
-
}
|
|
6720
|
-
]
|
|
6721
|
-
}
|
|
6722
|
-
},
|
|
6723
|
-
{
|
|
6724
|
-
name: "ValidatorBond",
|
|
6725
|
-
type: {
|
|
6726
|
-
kind: "struct",
|
|
6727
|
-
fields: [
|
|
6728
|
-
{
|
|
6729
|
-
name: "state",
|
|
6730
|
-
docs: [
|
|
6731
|
-
"The bond state address"
|
|
6732
|
-
],
|
|
6733
|
-
type: "pubkey"
|
|
6734
|
-
},
|
|
6735
|
-
{
|
|
6736
|
-
name: "identity",
|
|
6737
|
-
docs: [
|
|
6738
|
-
"Validator identity pubkey"
|
|
6739
|
-
],
|
|
6740
|
-
type: "pubkey"
|
|
6741
|
-
},
|
|
6742
|
-
{
|
|
6743
|
-
name: "vote_account",
|
|
6744
|
-
docs: [
|
|
6745
|
-
"Validator vote account pubkey"
|
|
6746
|
-
],
|
|
6747
|
-
type: "pubkey"
|
|
6748
|
-
},
|
|
6749
|
-
{
|
|
6750
|
-
name: "creator",
|
|
6751
|
-
docs: [
|
|
6752
|
-
"The bond creator pubkey"
|
|
6753
|
-
],
|
|
6754
|
-
type: "pubkey"
|
|
6755
|
-
},
|
|
6756
|
-
{
|
|
6757
|
-
name: "withdrawal_authority",
|
|
6758
|
-
docs: [
|
|
6759
|
-
"Optional withdrawal authority pubkey (if set, can withdraw on behalf of the validator,",
|
|
6760
|
-
"otherwise only identity can withdraw)"
|
|
6761
|
-
],
|
|
6762
|
-
type: {
|
|
6763
|
-
option: "pubkey"
|
|
6764
|
-
}
|
|
6765
|
-
},
|
|
6766
|
-
{
|
|
6767
|
-
name: "created_at",
|
|
6768
|
-
docs: [
|
|
6769
|
-
"Bond creation timestamp"
|
|
6263
|
+
"The authority allowed to manage the program"
|
|
6770
6264
|
],
|
|
6771
|
-
type: "
|
|
6265
|
+
type: "pubkey"
|
|
6772
6266
|
},
|
|
6773
6267
|
{
|
|
6774
6268
|
name: "bump",
|
|
@@ -6776,38 +6270,21 @@ var jbond_default = {
|
|
|
6776
6270
|
"Bump for the PDA"
|
|
6777
6271
|
],
|
|
6778
6272
|
type: "u8"
|
|
6779
|
-
},
|
|
6780
|
-
{
|
|
6781
|
-
name: "locked",
|
|
6782
|
-
docs: [
|
|
6783
|
-
"Amount of collateral currently locked (unavailable for withdrawal)"
|
|
6784
|
-
],
|
|
6785
|
-
type: "u64"
|
|
6786
|
-
},
|
|
6787
|
-
{
|
|
6788
|
-
name: "pending_unlock",
|
|
6789
|
-
docs: [
|
|
6790
|
-
"Pending unlock amount (will reduce `locked` next epoch)"
|
|
6791
|
-
],
|
|
6792
|
-
type: "u64"
|
|
6793
|
-
},
|
|
6794
|
-
{
|
|
6795
|
-
name: "pending_unlock_epoch",
|
|
6796
|
-
docs: [
|
|
6797
|
-
"Epoch when pending_unlock was queued"
|
|
6798
|
-
],
|
|
6799
|
-
type: "u64"
|
|
6800
6273
|
}
|
|
6801
6274
|
]
|
|
6802
6275
|
}
|
|
6803
6276
|
},
|
|
6804
6277
|
{
|
|
6805
|
-
name: "
|
|
6278
|
+
name: "ValidatorBond",
|
|
6806
6279
|
type: {
|
|
6807
6280
|
kind: "struct",
|
|
6808
6281
|
fields: [
|
|
6809
6282
|
{
|
|
6810
|
-
name: "
|
|
6283
|
+
name: "state",
|
|
6284
|
+
type: "pubkey"
|
|
6285
|
+
},
|
|
6286
|
+
{
|
|
6287
|
+
name: "identity",
|
|
6811
6288
|
type: "pubkey"
|
|
6812
6289
|
},
|
|
6813
6290
|
{
|
|
@@ -6815,16 +6292,22 @@ var jbond_default = {
|
|
|
6815
6292
|
type: "pubkey"
|
|
6816
6293
|
},
|
|
6817
6294
|
{
|
|
6818
|
-
name: "
|
|
6295
|
+
name: "creator",
|
|
6819
6296
|
type: "pubkey"
|
|
6820
6297
|
},
|
|
6821
6298
|
{
|
|
6822
|
-
name: "
|
|
6823
|
-
type:
|
|
6299
|
+
name: "withdrawal_authority",
|
|
6300
|
+
type: {
|
|
6301
|
+
option: "pubkey"
|
|
6302
|
+
}
|
|
6824
6303
|
},
|
|
6825
6304
|
{
|
|
6826
|
-
name: "
|
|
6305
|
+
name: "created_at",
|
|
6827
6306
|
type: "i64"
|
|
6307
|
+
},
|
|
6308
|
+
{
|
|
6309
|
+
name: "bump",
|
|
6310
|
+
type: "u8"
|
|
6828
6311
|
}
|
|
6829
6312
|
]
|
|
6830
6313
|
}
|
|
@@ -6835,7 +6318,7 @@ var jbond_default = {
|
|
|
6835
6318
|
kind: "struct",
|
|
6836
6319
|
fields: [
|
|
6837
6320
|
{
|
|
6838
|
-
name: "
|
|
6321
|
+
name: "identity",
|
|
6839
6322
|
type: "pubkey"
|
|
6840
6323
|
},
|
|
6841
6324
|
{
|
|
@@ -6848,30 +6331,6 @@ var jbond_default = {
|
|
|
6848
6331
|
}
|
|
6849
6332
|
]
|
|
6850
6333
|
}
|
|
6851
|
-
},
|
|
6852
|
-
{
|
|
6853
|
-
name: "WithdrawAuthorityChanged",
|
|
6854
|
-
type: {
|
|
6855
|
-
kind: "struct",
|
|
6856
|
-
fields: [
|
|
6857
|
-
{
|
|
6858
|
-
name: "validator",
|
|
6859
|
-
type: "pubkey"
|
|
6860
|
-
},
|
|
6861
|
-
{
|
|
6862
|
-
name: "old_authority",
|
|
6863
|
-
type: {
|
|
6864
|
-
option: "pubkey"
|
|
6865
|
-
}
|
|
6866
|
-
},
|
|
6867
|
-
{
|
|
6868
|
-
name: "new_authority",
|
|
6869
|
-
type: {
|
|
6870
|
-
option: "pubkey"
|
|
6871
|
-
}
|
|
6872
|
-
}
|
|
6873
|
-
]
|
|
6874
|
-
}
|
|
6875
6334
|
}
|
|
6876
6335
|
],
|
|
6877
6336
|
constants: [
|
|
@@ -6935,25 +6394,6 @@ function anchorToBondType(variant) {
|
|
|
6935
6394
|
return fromAnchor(variant);
|
|
6936
6395
|
}
|
|
6937
6396
|
|
|
6938
|
-
// src/utils/stake-pool.ts
|
|
6939
|
-
init_cjs_shims();
|
|
6940
|
-
async function getStakePoolAccountData(connection, stakePoolAddress) {
|
|
6941
|
-
const stakePoolAccount = await splStakePool.getStakePoolAccount(connection, stakePoolAddress);
|
|
6942
|
-
if (!stakePoolAccount) {
|
|
6943
|
-
throw new Error(`Stake pool account not found: ${stakePoolAddress.toBase58()}`);
|
|
6944
|
-
}
|
|
6945
|
-
return stakePoolAccount.account.data;
|
|
6946
|
-
}
|
|
6947
|
-
function lamportsToPoolTokenLamports(lamports, stakePool) {
|
|
6948
|
-
if (stakePool.totalLamports.isZero()) {
|
|
6949
|
-
throw new Error("Stake pool has zero total lamports");
|
|
6950
|
-
}
|
|
6951
|
-
if (stakePool.poolTokenSupply.isZero()) {
|
|
6952
|
-
throw new Error("Stake pool has zero pool token supply");
|
|
6953
|
-
}
|
|
6954
|
-
return lamports.mul(stakePool.poolTokenSupply).div(stakePool.totalLamports);
|
|
6955
|
-
}
|
|
6956
|
-
|
|
6957
6397
|
// src/utils/wallet.ts
|
|
6958
6398
|
init_cjs_shims();
|
|
6959
6399
|
function isVersionedTransaction(tx) {
|
|
@@ -6989,20 +6429,6 @@ var NodeWallet = class {
|
|
|
6989
6429
|
// src/utils/web3.ts
|
|
6990
6430
|
init_cjs_shims();
|
|
6991
6431
|
var SOL_DECIMALS = Math.log10(web3_js.LAMPORTS_PER_SOL);
|
|
6992
|
-
function lamportsToSol(lamports) {
|
|
6993
|
-
if (typeof lamports === "number") {
|
|
6994
|
-
return Math.abs(lamports) / web3_js.LAMPORTS_PER_SOL;
|
|
6995
|
-
}
|
|
6996
|
-
let signMultiplier = 1;
|
|
6997
|
-
if (lamports.isNeg()) {
|
|
6998
|
-
signMultiplier = -1;
|
|
6999
|
-
}
|
|
7000
|
-
const absLamports = lamports.abs();
|
|
7001
|
-
const lamportsString = absLamports.toString(10).padStart(10, "0");
|
|
7002
|
-
const splitIndex = lamportsString.length - SOL_DECIMALS;
|
|
7003
|
-
const solString = `${lamportsString.slice(0, splitIndex)}.${lamportsString.slice(splitIndex)}`;
|
|
7004
|
-
return signMultiplier * Number.parseFloat(solString);
|
|
7005
|
-
}
|
|
7006
6432
|
function solToLamports(amount) {
|
|
7007
6433
|
if (Number.isNaN(amount)) {
|
|
7008
6434
|
return new anchor.BN(0);
|
|
@@ -7023,13 +6449,20 @@ function getBondTypeSeed(type) {
|
|
|
7023
6449
|
}
|
|
7024
6450
|
|
|
7025
6451
|
// src/client.ts
|
|
6452
|
+
var JBondClientEnv = /* @__PURE__ */ ((JBondClientEnv2) => {
|
|
6453
|
+
JBondClientEnv2["DEV"] = "dev";
|
|
6454
|
+
JBondClientEnv2["STAGE"] = "stage";
|
|
6455
|
+
JBondClientEnv2["PROD"] = "prod";
|
|
6456
|
+
return JBondClientEnv2;
|
|
6457
|
+
})(JBondClientEnv || {});
|
|
7026
6458
|
var JBondClient = class _JBondClient {
|
|
7027
6459
|
constructor(provider, options) {
|
|
7028
6460
|
this.provider = provider;
|
|
7029
6461
|
this.options = options ?? {};
|
|
6462
|
+
this.program = new anchor.Program(jbond_default, this.provider);
|
|
7030
6463
|
}
|
|
7031
6464
|
options;
|
|
7032
|
-
|
|
6465
|
+
program;
|
|
7033
6466
|
get history() {
|
|
7034
6467
|
return new HistoryManager(this);
|
|
7035
6468
|
}
|
|
@@ -7058,24 +6491,11 @@ var JBondClient = class _JBondClient {
|
|
|
7058
6491
|
static fromKeypair(connection, keypair, options) {
|
|
7059
6492
|
return _JBondClient.fromWallet(connection, new NodeWallet(keypair), options);
|
|
7060
6493
|
}
|
|
7061
|
-
/**
|
|
7062
|
-
* Get or create the program instance
|
|
7063
|
-
*/
|
|
7064
|
-
get program() {
|
|
7065
|
-
if (!this._program) {
|
|
7066
|
-
jbond_default.address = this.programId.toBase58();
|
|
7067
|
-
this._program = new anchor.Program(jbond_default, this.provider);
|
|
7068
|
-
}
|
|
7069
|
-
return this._program;
|
|
7070
|
-
}
|
|
7071
6494
|
/**
|
|
7072
6495
|
* Get the current program ID.
|
|
7073
6496
|
*/
|
|
7074
6497
|
get programId() {
|
|
7075
|
-
|
|
7076
|
-
return this.options.programId;
|
|
7077
|
-
}
|
|
7078
|
-
return new web3_js.PublicKey(ENV_PROGRAM_ID["prod" /* PROD */]);
|
|
6498
|
+
return this.options.programId ?? this.program.programId;
|
|
7079
6499
|
}
|
|
7080
6500
|
/**
|
|
7081
6501
|
* Get the current connection.
|
|
@@ -7087,22 +6507,13 @@ var JBondClient = class _JBondClient {
|
|
|
7087
6507
|
* Set the environment.
|
|
7088
6508
|
*/
|
|
7089
6509
|
env(env) {
|
|
7090
|
-
|
|
7091
|
-
if (!envProgramId) {
|
|
7092
|
-
throw new Error(`Invalid environment: ${env}`);
|
|
7093
|
-
}
|
|
7094
|
-
this._program = null;
|
|
7095
|
-
this.debug(`Set environment to ${env} with program ID: ${envProgramId.toString()}`);
|
|
7096
|
-
return this.configure("programId", new web3_js.PublicKey(envProgramId));
|
|
6510
|
+
return this.configure("programId", ENV_PROGRAM_ID[env]);
|
|
7097
6511
|
}
|
|
7098
6512
|
/**
|
|
7099
6513
|
* Configure a specific option.
|
|
7100
6514
|
*/
|
|
7101
6515
|
configure(key, val) {
|
|
7102
6516
|
this.options[key] = val;
|
|
7103
|
-
if (key === "programId") {
|
|
7104
|
-
this._program = null;
|
|
7105
|
-
}
|
|
7106
6517
|
return this;
|
|
7107
6518
|
}
|
|
7108
6519
|
/**
|
|
@@ -7161,8 +6572,8 @@ var JBondClient = class _JBondClient {
|
|
|
7161
6572
|
* Top up collateral
|
|
7162
6573
|
*/
|
|
7163
6574
|
async topUpCollateral(props) {
|
|
7164
|
-
const
|
|
7165
|
-
return this.provider.sendAndConfirm?.(new web3_js.Transaction().add(...
|
|
6575
|
+
const ixs = await this.getTopUpIxs(props);
|
|
6576
|
+
return this.provider.sendAndConfirm?.(new web3_js.Transaction().add(...ixs));
|
|
7166
6577
|
}
|
|
7167
6578
|
/**
|
|
7168
6579
|
* Withdraw collateral
|
|
@@ -7172,14 +6583,7 @@ var JBondClient = class _JBondClient {
|
|
|
7172
6583
|
return this.provider.sendAndConfirm?.(new web3_js.Transaction().add(ix));
|
|
7173
6584
|
}
|
|
7174
6585
|
/**
|
|
7175
|
-
*
|
|
7176
|
-
*/
|
|
7177
|
-
async migrateBond(props) {
|
|
7178
|
-
const { instructions, signers } = await this.getMigrateBondIx(props);
|
|
7179
|
-
return this.provider.sendAndConfirm?.(new web3_js.Transaction().add(...instructions), signers);
|
|
7180
|
-
}
|
|
7181
|
-
/**
|
|
7182
|
-
* Claim compensation for a validator
|
|
6586
|
+
* Claim compensation
|
|
7183
6587
|
*/
|
|
7184
6588
|
async claimCompensation(props) {
|
|
7185
6589
|
const ix = await this.getClaimIx(props);
|
|
@@ -7220,14 +6624,6 @@ var JBondClient = class _JBondClient {
|
|
|
7220
6624
|
const ix = await this.getBondSessionFinishIx(props);
|
|
7221
6625
|
return this.provider.sendAndConfirm?.(new web3_js.Transaction().add(ix));
|
|
7222
6626
|
}
|
|
7223
|
-
async bondRemove(props) {
|
|
7224
|
-
const ix = await this.getBondRemoveIx(props);
|
|
7225
|
-
return this.provider.sendAndConfirm?.(new web3_js.Transaction().add(ix));
|
|
7226
|
-
}
|
|
7227
|
-
async closeValidatorBond(props) {
|
|
7228
|
-
const ix = await this.getCloseValidatorBondIx(props);
|
|
7229
|
-
return this.provider.sendAndConfirm?.(new web3_js.Transaction().add(ix));
|
|
7230
|
-
}
|
|
7231
6627
|
/**
|
|
7232
6628
|
* Build global state initialize instruction
|
|
7233
6629
|
*/
|
|
@@ -7338,9 +6734,6 @@ var JBondClient = class _JBondClient {
|
|
|
7338
6734
|
collateralType = bondState2.collateralType;
|
|
7339
6735
|
}
|
|
7340
6736
|
const instructions = [];
|
|
7341
|
-
const signers = [];
|
|
7342
|
-
const amountLamports = solToLamports(amount);
|
|
7343
|
-
let topUpAmount = amountLamports;
|
|
7344
6737
|
try {
|
|
7345
6738
|
await this.getValidatorBond(props.bondType, props.name, props.voteAccount);
|
|
7346
6739
|
} catch {
|
|
@@ -7372,33 +6765,10 @@ var JBondClient = class _JBondClient {
|
|
|
7372
6765
|
accounts.bondTokenAccount = splToken.getAssociatedTokenAddressSync(mint, validatorBond, true);
|
|
7373
6766
|
}
|
|
7374
6767
|
});
|
|
7375
|
-
if (props.solUsage) {
|
|
7376
|
-
let usesJsolCollateral = false;
|
|
7377
|
-
matchVariant(collateralType, {
|
|
7378
|
-
token: (mint) => {
|
|
7379
|
-
usesJsolCollateral = mint.equals(JSOL_MINT);
|
|
7380
|
-
}
|
|
7381
|
-
});
|
|
7382
|
-
if (usesJsolCollateral) {
|
|
7383
|
-
const stakePool = await getStakePoolAccountData(this.connection, JPOOL_POOL_ADDRESS);
|
|
7384
|
-
const deposit = await splStakePool.depositSol(
|
|
7385
|
-
this.connection,
|
|
7386
|
-
JPOOL_POOL_ADDRESS,
|
|
7387
|
-
payer,
|
|
7388
|
-
amountLamports.toNumber(),
|
|
7389
|
-
void 0,
|
|
7390
|
-
void 0,
|
|
7391
|
-
void 0
|
|
7392
|
-
);
|
|
7393
|
-
instructions.push(...deposit.instructions);
|
|
7394
|
-
signers.push(...deposit.signers);
|
|
7395
|
-
topUpAmount = lamportsToPoolTokenLamports(amountLamports, stakePool);
|
|
7396
|
-
}
|
|
7397
|
-
}
|
|
7398
6768
|
instructions.push(
|
|
7399
|
-
await this.program.methods.bondTopUp(
|
|
6769
|
+
await this.program.methods.bondTopUp(solToLamports(amount)).accountsPartial(accounts).instruction()
|
|
7400
6770
|
);
|
|
7401
|
-
return
|
|
6771
|
+
return instructions;
|
|
7402
6772
|
}
|
|
7403
6773
|
/**
|
|
7404
6774
|
* Build withdraw collateral instruction
|
|
@@ -7437,139 +6807,6 @@ var JBondClient = class _JBondClient {
|
|
|
7437
6807
|
});
|
|
7438
6808
|
return this.program.methods.bondWithdraw(solToLamports(amount)).accountsPartial(accounts).instruction();
|
|
7439
6809
|
}
|
|
7440
|
-
/**
|
|
7441
|
-
* Build instructions for migrating SOL bond collateral into JSOL bond collateral in a single transaction
|
|
7442
|
-
*/
|
|
7443
|
-
async getMigrateBondIx(props) {
|
|
7444
|
-
const {
|
|
7445
|
-
bondType,
|
|
7446
|
-
voteAccount,
|
|
7447
|
-
identity,
|
|
7448
|
-
withdrawName = "performance",
|
|
7449
|
-
topUpName = "perf",
|
|
7450
|
-
stakePoolAddress = JPOOL_POOL_ADDRESS
|
|
7451
|
-
} = props;
|
|
7452
|
-
const payer = props.payer ?? this.provider.wallet?.publicKey;
|
|
7453
|
-
const destination = props.destination ?? payer;
|
|
7454
|
-
if (!payer || !destination) {
|
|
7455
|
-
throw new Error("Missing payer/destination");
|
|
7456
|
-
}
|
|
7457
|
-
const withdrawBondState = await this.getBondState(bondType, withdrawName);
|
|
7458
|
-
await matchVariant(withdrawBondState.collateralType, {
|
|
7459
|
-
native: () => {
|
|
7460
|
-
},
|
|
7461
|
-
token: () => {
|
|
7462
|
-
throw new Error("Withdraw bond collateral type must be native SOL for migration");
|
|
7463
|
-
}
|
|
7464
|
-
});
|
|
7465
|
-
const availableLamports = await this.getAvailableCollateral(bondType, withdrawName, voteAccount);
|
|
7466
|
-
if (!availableLamports || availableLamports <= 0) {
|
|
7467
|
-
throw new Error("No available balance to migrate");
|
|
7468
|
-
}
|
|
7469
|
-
const amount = lamportsToSol(availableLamports);
|
|
7470
|
-
const amountLamports = solToLamports(amount);
|
|
7471
|
-
const withdrawIx = await this.getWithdrawIx({
|
|
7472
|
-
bondType,
|
|
7473
|
-
name: withdrawName,
|
|
7474
|
-
amount,
|
|
7475
|
-
voteAccount,
|
|
7476
|
-
destination,
|
|
7477
|
-
withdrawalAuthority: props.withdrawalAuthority
|
|
7478
|
-
});
|
|
7479
|
-
const deposit = await this.getDepositSolIxsWithoutBalanceCheck(
|
|
7480
|
-
stakePoolAddress,
|
|
7481
|
-
payer,
|
|
7482
|
-
amountLamports.toNumber()
|
|
7483
|
-
);
|
|
7484
|
-
const topUpBondState = await this.getBondState(bondType, topUpName);
|
|
7485
|
-
const topUpCollateralType = topUpBondState.collateralType;
|
|
7486
|
-
const instructions = [withdrawIx, ...deposit.instructions];
|
|
7487
|
-
const signers = [...deposit.signers];
|
|
7488
|
-
try {
|
|
7489
|
-
await this.getValidatorBond(bondType, topUpName, voteAccount);
|
|
7490
|
-
} catch {
|
|
7491
|
-
instructions.push(
|
|
7492
|
-
await this.getRegisterValidatorIx({
|
|
7493
|
-
bondType,
|
|
7494
|
-
name: topUpName,
|
|
7495
|
-
voteAccount,
|
|
7496
|
-
identity,
|
|
7497
|
-
creator: payer,
|
|
7498
|
-
collateralType: topUpCollateralType
|
|
7499
|
-
})
|
|
7500
|
-
);
|
|
7501
|
-
}
|
|
7502
|
-
const [topUpBondStateAddress] = this.pda.bondState(bondType, topUpName);
|
|
7503
|
-
const [topUpValidatorBond] = this.pda.validatorBond(bondType, topUpName, voteAccount);
|
|
7504
|
-
await matchVariant(topUpCollateralType, {
|
|
7505
|
-
native: () => {
|
|
7506
|
-
throw new Error("Top up bond collateral type must be token for migration");
|
|
7507
|
-
},
|
|
7508
|
-
token: async (mint) => {
|
|
7509
|
-
const stakePool = await getStakePoolAccountData(this.connection, stakePoolAddress);
|
|
7510
|
-
const topUpAmount = lamportsToPoolTokenLamports(amountLamports, stakePool);
|
|
7511
|
-
const topUpIx = await this.program.methods.bondTopUp(topUpAmount).accountsPartial({
|
|
7512
|
-
bondState: topUpBondStateAddress,
|
|
7513
|
-
validatorBond: topUpValidatorBond,
|
|
7514
|
-
payer,
|
|
7515
|
-
payerTokenAccount: splToken.getAssociatedTokenAddressSync(mint, payer),
|
|
7516
|
-
bondTokenAccount: splToken.getAssociatedTokenAddressSync(mint, topUpValidatorBond, true),
|
|
7517
|
-
stakeAccount: null,
|
|
7518
|
-
stakeProgram: null
|
|
7519
|
-
}).instruction();
|
|
7520
|
-
instructions.push(topUpIx);
|
|
7521
|
-
}
|
|
7522
|
-
});
|
|
7523
|
-
return { instructions, signers };
|
|
7524
|
-
}
|
|
7525
|
-
/**
|
|
7526
|
-
* Build stake-pool SOL deposit instructions without pre-checking payer balance.
|
|
7527
|
-
* This allows composing withdraw->deposit in a single transaction where SOL is obtained by the prior instruction.
|
|
7528
|
-
*/
|
|
7529
|
-
async getDepositSolIxsWithoutBalanceCheck(stakePoolAddress, payer, lamports, destinationTokenAccount, referrerTokenAccount, depositAuthority) {
|
|
7530
|
-
const stakePool = await getStakePoolAccountData(this.connection, stakePoolAddress);
|
|
7531
|
-
const transferSigner = new web3_js.Keypair();
|
|
7532
|
-
const signers = [transferSigner];
|
|
7533
|
-
const instructions = [
|
|
7534
|
-
web3_js.SystemProgram.transfer({
|
|
7535
|
-
fromPubkey: payer,
|
|
7536
|
-
toPubkey: transferSigner.publicKey,
|
|
7537
|
-
lamports
|
|
7538
|
-
})
|
|
7539
|
-
];
|
|
7540
|
-
let destinationPoolAccount = destinationTokenAccount;
|
|
7541
|
-
if (!destinationPoolAccount) {
|
|
7542
|
-
const associatedAddress = splToken.getAssociatedTokenAddressSync(stakePool.poolMint, payer);
|
|
7543
|
-
instructions.push(
|
|
7544
|
-
splToken.createAssociatedTokenAccountIdempotentInstruction(
|
|
7545
|
-
payer,
|
|
7546
|
-
associatedAddress,
|
|
7547
|
-
payer,
|
|
7548
|
-
stakePool.poolMint
|
|
7549
|
-
)
|
|
7550
|
-
);
|
|
7551
|
-
destinationPoolAccount = associatedAddress;
|
|
7552
|
-
}
|
|
7553
|
-
const [withdrawAuthority] = web3_js.PublicKey.findProgramAddressSync(
|
|
7554
|
-
[stakePoolAddress.toBuffer(), Buffer.from("withdraw")],
|
|
7555
|
-
splStakePool.STAKE_POOL_PROGRAM_ID
|
|
7556
|
-
);
|
|
7557
|
-
instructions.push(
|
|
7558
|
-
splStakePool.StakePoolInstruction.depositSol({
|
|
7559
|
-
stakePool: stakePoolAddress,
|
|
7560
|
-
reserveStake: stakePool.reserveStake,
|
|
7561
|
-
fundingAccount: transferSigner.publicKey,
|
|
7562
|
-
destinationPoolAccount,
|
|
7563
|
-
managerFeeAccount: stakePool.managerFeeAccount,
|
|
7564
|
-
referralPoolAccount: referrerTokenAccount ?? destinationPoolAccount,
|
|
7565
|
-
poolMint: stakePool.poolMint,
|
|
7566
|
-
lamports,
|
|
7567
|
-
withdrawAuthority,
|
|
7568
|
-
depositAuthority
|
|
7569
|
-
})
|
|
7570
|
-
);
|
|
7571
|
-
return { instructions, signers };
|
|
7572
|
-
}
|
|
7573
6810
|
/**
|
|
7574
6811
|
* Build claim instruction
|
|
7575
6812
|
*/
|
|
@@ -7600,47 +6837,13 @@ var JBondClient = class _JBondClient {
|
|
|
7600
6837
|
native: () => {
|
|
7601
6838
|
},
|
|
7602
6839
|
token: (mint) => {
|
|
6840
|
+
accounts.destinationTokenAccount = splToken.getAssociatedTokenAddressSync(mint, reserve, true);
|
|
7603
6841
|
accounts.bondTokenAccount = splToken.getAssociatedTokenAddressSync(mint, validatorBond, true);
|
|
7604
|
-
|
|
7605
|
-
accounts.reserveTokenAccount = null;
|
|
7606
|
-
accounts.destinationTokenAccount = null;
|
|
7607
|
-
} else {
|
|
7608
|
-
accounts.destinationTokenAccount = splToken.getAssociatedTokenAddressSync(mint, reserve, true);
|
|
7609
|
-
accounts.reserveTokenAccount = splToken.getAssociatedTokenAddressSync(mint, reserve, true);
|
|
7610
|
-
}
|
|
6842
|
+
accounts.reserveTokenAccount = splToken.getAssociatedTokenAddressSync(mint, reserve, true);
|
|
7611
6843
|
}
|
|
7612
6844
|
});
|
|
7613
6845
|
return this.program.methods.bondClaim(solToLamports(amount)).accountsPartial(accounts).instruction();
|
|
7614
6846
|
}
|
|
7615
|
-
/**
|
|
7616
|
-
* Build claim all compensations instructions
|
|
7617
|
-
*/
|
|
7618
|
-
async getClaimAllCompensationsIxs(props) {
|
|
7619
|
-
const ixs = [];
|
|
7620
|
-
const validatorBondBalances = await this.getBondStateValidatorBondBalances(
|
|
7621
|
-
props.bondType,
|
|
7622
|
-
props.name
|
|
7623
|
-
);
|
|
7624
|
-
for (const bond_balance of validatorBondBalances) {
|
|
7625
|
-
const amountToClaim = lamportsToSol(bond_balance.balance);
|
|
7626
|
-
if (amountToClaim <= 0) {
|
|
7627
|
-
this.debug("No balance to claim for validator:", bond_balance.voteAccount.toBase58());
|
|
7628
|
-
continue;
|
|
7629
|
-
}
|
|
7630
|
-
this.debug("Amount to claim:", amountToClaim);
|
|
7631
|
-
const ix = await this.getClaimIx({
|
|
7632
|
-
bondType: props.bondType,
|
|
7633
|
-
name: props.name,
|
|
7634
|
-
amount: amountToClaim,
|
|
7635
|
-
collateralType: props.collateralType,
|
|
7636
|
-
reserve: props.reserve,
|
|
7637
|
-
authority: props.authority,
|
|
7638
|
-
voteAccount: bond_balance.voteAccount
|
|
7639
|
-
});
|
|
7640
|
-
ixs.push(ix);
|
|
7641
|
-
}
|
|
7642
|
-
return ixs;
|
|
7643
|
-
}
|
|
7644
6847
|
/**
|
|
7645
6848
|
* Build set withdraw authority instruction
|
|
7646
6849
|
*/
|
|
@@ -7669,150 +6872,23 @@ var JBondClient = class _JBondClient {
|
|
|
7669
6872
|
const authority = this.provider.wallet?.publicKey;
|
|
7670
6873
|
return this.program.methods.sessionStart(new import_bn.BN(props.duration)).accountsPartial({ bondState, authority }).instruction();
|
|
7671
6874
|
}
|
|
7672
|
-
async lockFunds(props) {
|
|
7673
|
-
const ix = await this.getLockFundsIx(props);
|
|
7674
|
-
return this.provider.sendAndConfirm?.(new web3_js.Transaction().add(ix));
|
|
7675
|
-
}
|
|
7676
|
-
async releaseFunds(props) {
|
|
7677
|
-
const ix = await this.getReleaseFundsIx(props);
|
|
7678
|
-
return this.provider.sendAndConfirm?.(new web3_js.Transaction().add(ix));
|
|
7679
|
-
}
|
|
7680
|
-
/**
|
|
7681
|
-
* Build bond remove instruction
|
|
7682
|
-
*/
|
|
7683
|
-
async getBondRemoveIx(props) {
|
|
7684
|
-
const { bondType, name } = props;
|
|
7685
|
-
const [bondState] = this.pda.bondState(bondType, name);
|
|
7686
|
-
const authority = props.authority ?? this.provider.wallet?.publicKey;
|
|
7687
|
-
return this.program.methods.bondRemove().accountsPartial({ bondState, authority }).instruction();
|
|
7688
|
-
}
|
|
7689
|
-
/**
|
|
7690
|
-
* Build close validator bond instruction
|
|
7691
|
-
*/
|
|
7692
|
-
async getCloseValidatorBondIx(props) {
|
|
7693
|
-
const { bondType, name, voteAccount } = props;
|
|
7694
|
-
const [bondState] = this.pda.bondState(bondType, name);
|
|
7695
|
-
const [validatorBond] = this.pda.validatorBond(bondType, name, voteAccount);
|
|
7696
|
-
const authority = props.authority ?? this.provider.wallet?.publicKey;
|
|
7697
|
-
const rentReceiver = props.rentReceiver ?? authority;
|
|
7698
|
-
if (!authority || !rentReceiver) {
|
|
7699
|
-
throw new Error("Missing authority or rentReceiver");
|
|
7700
|
-
}
|
|
7701
|
-
let collateralType = props.collateralType;
|
|
7702
|
-
if (!collateralType) {
|
|
7703
|
-
const state = await this.getBondState(bondType, name);
|
|
7704
|
-
collateralType = state.collateralType;
|
|
7705
|
-
}
|
|
7706
|
-
const accounts = {
|
|
7707
|
-
bondState,
|
|
7708
|
-
validatorBond,
|
|
7709
|
-
authority,
|
|
7710
|
-
rentReceiver,
|
|
7711
|
-
bondTokenAccount: null,
|
|
7712
|
-
destinationTokenAccount: null
|
|
7713
|
-
};
|
|
7714
|
-
matchVariant(collateralType, {
|
|
7715
|
-
native: () => {
|
|
7716
|
-
},
|
|
7717
|
-
token: (mint) => {
|
|
7718
|
-
accounts.bondTokenAccount = splToken.getAssociatedTokenAddressSync(mint, validatorBond, true);
|
|
7719
|
-
accounts.destinationTokenAccount = splToken.getAssociatedTokenAddressSync(mint, rentReceiver, true);
|
|
7720
|
-
}
|
|
7721
|
-
});
|
|
7722
|
-
return this.program.methods.closeValidatorBond().accountsPartial(accounts).instruction();
|
|
7723
|
-
}
|
|
7724
|
-
/**
|
|
7725
|
-
* Build test set last update epoch instruction
|
|
7726
|
-
* NOTE!: This instruction is for testing purposes only.
|
|
7727
|
-
* It allows direct manipulation of the validator bond's last epoch update.
|
|
7728
|
-
* This should not be used in production environments.
|
|
7729
|
-
*/
|
|
7730
|
-
// async getTestSetLastUpdateEpochIx(props: { bondType: BondType, bondName: string, voteAccount: PublicKeyInitData, payer: PublicKey, epoch: number }) {
|
|
7731
|
-
// const { bondType, bondName, voteAccount, payer, epoch } = props
|
|
7732
|
-
// const [validatorBond, _] = this.pda.validatorBond(bondType, bondName, voteAccount)
|
|
7733
|
-
// return this.program.methods
|
|
7734
|
-
// .testSetLastUpdateEpoch(new BN(epoch))
|
|
7735
|
-
// .accountsPartial({ validatorBond, payer })
|
|
7736
|
-
// .instruction()
|
|
7737
|
-
// }
|
|
7738
|
-
/**
|
|
7739
|
-
* Build lock funds instruction
|
|
7740
|
-
*/
|
|
7741
|
-
async getLockFundsIx(props) {
|
|
7742
|
-
const { bondType, name, voteAccount, amount, withdrawAuthority } = props;
|
|
7743
|
-
const [bondState] = this.pda.bondState(bondType, name);
|
|
7744
|
-
let collateralType = props.collateralType;
|
|
7745
|
-
if (!collateralType) {
|
|
7746
|
-
const bondState2 = await this.getBondState(bondType, name);
|
|
7747
|
-
collateralType = bondState2.collateralType;
|
|
7748
|
-
}
|
|
7749
|
-
const [validatorBond] = this.pda.validatorBond(bondType, name, voteAccount);
|
|
7750
|
-
const accounts = {
|
|
7751
|
-
bondState,
|
|
7752
|
-
validatorBond,
|
|
7753
|
-
payer: withdrawAuthority,
|
|
7754
|
-
bondTokenAccount: null
|
|
7755
|
-
};
|
|
7756
|
-
matchVariant(collateralType, {
|
|
7757
|
-
native: () => {
|
|
7758
|
-
},
|
|
7759
|
-
token: (mint) => {
|
|
7760
|
-
const bondTokenAccount = splToken.getAssociatedTokenAddressSync(mint, validatorBond, true);
|
|
7761
|
-
accounts.bondTokenAccount = bondTokenAccount;
|
|
7762
|
-
}
|
|
7763
|
-
});
|
|
7764
|
-
return this.program.methods.bondLockFunds(solToLamports(amount)).accountsPartial(accounts).instruction();
|
|
7765
|
-
}
|
|
7766
|
-
/**
|
|
7767
|
-
* Build release funds instruction
|
|
7768
|
-
*/
|
|
7769
|
-
async getReleaseFundsIx(props) {
|
|
7770
|
-
const { bondType, name, voteAccount, amount, withdrawAuthority } = props;
|
|
7771
|
-
const [bondState] = this.pda.bondState(bondType, name);
|
|
7772
|
-
const [validatorBond] = this.pda.validatorBond(bondType, name, voteAccount);
|
|
7773
|
-
const accounts = {
|
|
7774
|
-
bondState,
|
|
7775
|
-
validatorBond,
|
|
7776
|
-
payer: withdrawAuthority
|
|
7777
|
-
};
|
|
7778
|
-
return this.program.methods.bondReleaseFunds(solToLamports(amount)).accountsPartial(accounts).instruction();
|
|
7779
|
-
}
|
|
7780
|
-
/**
|
|
7781
|
-
* Get available collateral for withdrawal (taking into account locked funds)
|
|
7782
|
-
*/
|
|
7783
|
-
async getAvailableCollateral(bondType, bondName, voteAccount) {
|
|
7784
|
-
const validatorBond = await this.getValidatorBond(bondType, bondName, voteAccount);
|
|
7785
|
-
return await this.getValidatorBondBalance(bondType, bondName, voteAccount) - validatorBond.locked.toNumber();
|
|
7786
|
-
}
|
|
7787
6875
|
/**
|
|
7788
6876
|
* Get all bond states with total collected collateral
|
|
7789
6877
|
*/
|
|
7790
|
-
async getAllBondStates(bondType, sessionStatus
|
|
7791
|
-
const
|
|
7792
|
-
const targetBondType = bondTypeToAnchor(bondType);
|
|
6878
|
+
async getAllBondStates(bondType, sessionStatus) {
|
|
6879
|
+
const result = [];
|
|
7793
6880
|
const accounts = await this.program.account.bondState.all();
|
|
7794
|
-
const
|
|
7795
|
-
if (!sameVariant(account.bondType,
|
|
7796
|
-
|
|
6881
|
+
for (const { publicKey, account } of accounts) {
|
|
6882
|
+
if (!sameVariant(account.bondType, bondTypeToAnchor(bondType))) {
|
|
6883
|
+
continue;
|
|
7797
6884
|
}
|
|
7798
6885
|
if (sessionStatus !== void 0 && this.getBondStateSessionStatus(account) !== sessionStatus) {
|
|
7799
|
-
|
|
6886
|
+
continue;
|
|
7800
6887
|
}
|
|
7801
|
-
|
|
7802
|
-
|
|
7803
|
-
if (!includeStats) {
|
|
7804
|
-
return filteredAccounts.map(({ publicKey, account }) => ({
|
|
7805
|
-
publicKey,
|
|
7806
|
-
bondState: account,
|
|
7807
|
-
stateStats: null
|
|
7808
|
-
}));
|
|
6888
|
+
const stateStats = await this.getBondStateStats(account);
|
|
6889
|
+
result.push({ publicKey, bondState: account, stateStats });
|
|
7809
6890
|
}
|
|
7810
|
-
return
|
|
7811
|
-
filteredAccounts.map(async ({ publicKey, account }) => {
|
|
7812
|
-
const stateStats = await this.getBondStateStats(account);
|
|
7813
|
-
return { publicKey, bondState: account, stateStats };
|
|
7814
|
-
})
|
|
7815
|
-
);
|
|
6891
|
+
return result;
|
|
7816
6892
|
}
|
|
7817
6893
|
/**
|
|
7818
6894
|
* Fetch global state or throw if not found
|
|
@@ -7833,28 +6909,16 @@ var JBondClient = class _JBondClient {
|
|
|
7833
6909
|
return { publicKey, ...data };
|
|
7834
6910
|
}
|
|
7835
6911
|
/**
|
|
7836
|
-
* Fetch validator bond data or
|
|
6912
|
+
* Fetch validator bond data or null if not found
|
|
7837
6913
|
*/
|
|
7838
6914
|
async getValidatorBond(bondType, bondName, vote) {
|
|
7839
6915
|
const [publicKey] = this.pda.validatorBond(bondType, bondName, new web3_js.PublicKey(vote));
|
|
7840
|
-
this.debug(`Fetching validator bond ${publicKey}...`);
|
|
7841
6916
|
const data = await this.program.account.validatorBond.fetch(publicKey);
|
|
7842
6917
|
return { publicKey, ...data };
|
|
7843
6918
|
}
|
|
7844
6919
|
/**
|
|
7845
|
-
*
|
|
7846
|
-
|
|
7847
|
-
async getValidatorBondNullable(bondType, bondName, vote) {
|
|
7848
|
-
const [publicKey] = this.pda.validatorBond(bondType, bondName, new web3_js.PublicKey(vote));
|
|
7849
|
-
this.debug(`Fetching validator bond ${publicKey}...`);
|
|
7850
|
-
const data = await this.program.account.validatorBond.fetchNullable(publicKey);
|
|
7851
|
-
if (!data) {
|
|
7852
|
-
return null;
|
|
7853
|
-
}
|
|
7854
|
-
return { publicKey, ...data };
|
|
7855
|
-
}
|
|
7856
|
-
/**
|
|
7857
|
-
* Get validator bond account balance (in SOL)
|
|
6920
|
+
* Get validator bond account balance, in the collateral's base units
|
|
6921
|
+
* (lamports for native bonds, token base units for token bonds).
|
|
7858
6922
|
*/
|
|
7859
6923
|
async getValidatorBondBalance(bondType, bondName, vote) {
|
|
7860
6924
|
const [address] = this.pda.validatorBond(bondType, bondName, new web3_js.PublicKey(vote));
|
|
@@ -7866,8 +6930,8 @@ var JBondClient = class _JBondClient {
|
|
|
7866
6930
|
if (!accountInfo) {
|
|
7867
6931
|
return 0;
|
|
7868
6932
|
}
|
|
7869
|
-
const { lamports } = accountInfo;
|
|
7870
|
-
const rentExempt = await this.
|
|
6933
|
+
const { data, lamports } = accountInfo;
|
|
6934
|
+
const rentExempt = await this.connection.getMinimumBalanceForRentExemption(data.length);
|
|
7871
6935
|
return Math.max(0, lamports - rentExempt);
|
|
7872
6936
|
},
|
|
7873
6937
|
token: async (mint) => {
|
|
@@ -7881,13 +6945,12 @@ var JBondClient = class _JBondClient {
|
|
|
7881
6945
|
}
|
|
7882
6946
|
});
|
|
7883
6947
|
}
|
|
7884
|
-
|
|
7885
|
-
|
|
7886
|
-
|
|
7887
|
-
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
}
|
|
6948
|
+
/**
|
|
6949
|
+
* Get total collected collateral for a bond state
|
|
6950
|
+
*/
|
|
6951
|
+
async getBondStateTotalCollected(bondType, bondName, votes) {
|
|
6952
|
+
const bondState = await this.getBondState(bondType, bondName);
|
|
6953
|
+
const collateralType = bondState.collateralType;
|
|
7891
6954
|
const chunk = (arr, n = 100) => {
|
|
7892
6955
|
const res = [];
|
|
7893
6956
|
for (let i = 0; i < arr.length; i += n) {
|
|
@@ -7897,79 +6960,76 @@ var JBondClient = class _JBondClient {
|
|
|
7897
6960
|
};
|
|
7898
6961
|
return await matchVariant(collateralType, {
|
|
7899
6962
|
native: async () => {
|
|
7900
|
-
const addresses =
|
|
6963
|
+
const addresses = votes.map((vote) => {
|
|
6964
|
+
const [address] = this.pda.validatorBond(bondType, bondName, new web3_js.PublicKey(vote));
|
|
6965
|
+
return address;
|
|
6966
|
+
});
|
|
7901
6967
|
const accountInfos = await this.connection.getMultipleAccountsInfo(addresses);
|
|
7902
|
-
const
|
|
7903
|
-
|
|
7904
|
-
|
|
7905
|
-
|
|
7906
|
-
|
|
6968
|
+
const balances = await Promise.all(
|
|
6969
|
+
accountInfos.map(async (accountInfo) => {
|
|
6970
|
+
if (!accountInfo) {
|
|
6971
|
+
return 0;
|
|
6972
|
+
}
|
|
6973
|
+
const { lamports } = accountInfo;
|
|
6974
|
+
return lamports;
|
|
6975
|
+
})
|
|
6976
|
+
);
|
|
6977
|
+
return balances.reduce((sum, v) => sum + v, 0);
|
|
7907
6978
|
},
|
|
7908
6979
|
token: async (mint) => {
|
|
7909
|
-
const
|
|
7910
|
-
|
|
7911
|
-
|
|
7912
|
-
})
|
|
7913
|
-
|
|
7914
|
-
|
|
7915
|
-
|
|
7916
|
-
|
|
6980
|
+
const tokenAccounts = votes.map((vote) => {
|
|
6981
|
+
const [validatorBondAddress] = this.pda.validatorBond(bondType, bondName, new web3_js.PublicKey(vote));
|
|
6982
|
+
return splToken.getAssociatedTokenAddressSync(mint, validatorBondAddress, true);
|
|
6983
|
+
});
|
|
6984
|
+
if (tokenAccounts.length === 0) {
|
|
6985
|
+
return 0;
|
|
6986
|
+
}
|
|
6987
|
+
let total = 0n;
|
|
6988
|
+
for (const part of chunk(tokenAccounts, 100)) {
|
|
6989
|
+
const infos = await this.connection.getMultipleAccountsInfo(part).catch(() => []);
|
|
6990
|
+
for (let i = 0; i < infos.length; i++) {
|
|
7917
6991
|
const info = infos[i];
|
|
7918
|
-
|
|
7919
|
-
|
|
7920
|
-
|
|
6992
|
+
if (!info) {
|
|
6993
|
+
continue;
|
|
6994
|
+
}
|
|
6995
|
+
if (info.data.length !== splToken.ACCOUNT_SIZE) {
|
|
7921
6996
|
continue;
|
|
7922
6997
|
}
|
|
7923
6998
|
try {
|
|
7924
6999
|
const acc = splToken.AccountLayout.decode(info.data);
|
|
7925
7000
|
const raw = BigInt(acc.amount.toString());
|
|
7926
|
-
|
|
7927
|
-
balances.push({
|
|
7928
|
-
voteAccount,
|
|
7929
|
-
balance: Number.isFinite(asNumber) ? asNumber : Number.MAX_SAFE_INTEGER
|
|
7930
|
-
});
|
|
7001
|
+
total += raw;
|
|
7931
7002
|
} catch {
|
|
7932
|
-
balances.push({ voteAccount, balance: 0 });
|
|
7933
7003
|
}
|
|
7934
7004
|
}
|
|
7935
7005
|
}
|
|
7936
|
-
|
|
7006
|
+
const asNumber = Number(total);
|
|
7007
|
+
return Number.isFinite(asNumber) ? asNumber : Number.MAX_SAFE_INTEGER;
|
|
7937
7008
|
}
|
|
7938
7009
|
});
|
|
7939
7010
|
}
|
|
7940
|
-
/**
|
|
7941
|
-
* Get total collected collateral for a bond state
|
|
7942
|
-
*/
|
|
7943
|
-
async getBondStateTotalCollected(bondType, bondName, bondState) {
|
|
7944
|
-
const allBalances = await this.getBondStateValidatorBondBalances(bondType, bondName, bondState);
|
|
7945
|
-
return allBalances.reduce((sum, vb) => sum + vb.balance, 0);
|
|
7946
|
-
}
|
|
7947
7011
|
/**
|
|
7948
7012
|
* Get bond state stats
|
|
7949
7013
|
* @param state
|
|
7014
|
+
* @private
|
|
7950
7015
|
*/
|
|
7951
7016
|
async getBondStateStats(state) {
|
|
7952
7017
|
const bondType = anchorToBondType(state.bondType);
|
|
7018
|
+
const validatorBonds = await this.getBondValidatorStates(bondType, state.name);
|
|
7953
7019
|
const totalCollected = await this.getBondStateTotalCollected(
|
|
7954
7020
|
bondType,
|
|
7955
7021
|
state.name,
|
|
7956
|
-
|
|
7022
|
+
validatorBonds.map((vb) => vb.voteAccount)
|
|
7957
7023
|
);
|
|
7958
7024
|
return {
|
|
7959
7025
|
totalCollected,
|
|
7960
7026
|
status: this.getBondStateSessionStatus(state)
|
|
7961
7027
|
};
|
|
7962
7028
|
}
|
|
7963
|
-
/**
|
|
7964
|
-
* Get validator bond rent exempt amount
|
|
7965
|
-
*/
|
|
7966
|
-
validatorBondRentExempt = async () => {
|
|
7967
|
-
return this.connection.getMinimumBalanceForRentExemption(this.program.account.validatorBond.size);
|
|
7968
|
-
};
|
|
7969
7029
|
/**
|
|
7970
7030
|
* Get all validator bonds for a given bond state
|
|
7971
7031
|
*/
|
|
7972
|
-
async
|
|
7032
|
+
async getBondValidatorStates(bondType, bondName) {
|
|
7973
7033
|
const [bondState] = this.pda.bondState(bondType, bondName);
|
|
7974
7034
|
const accounts = await this.program.account.validatorBond.all([
|
|
7975
7035
|
{
|
|
@@ -8020,12 +7080,9 @@ exports.ENV_PROGRAM_ID = ENV_PROGRAM_ID;
|
|
|
8020
7080
|
exports.GLOBAL_STATE_SEED = GLOBAL_STATE_SEED;
|
|
8021
7081
|
exports.JBondClient = JBondClient;
|
|
8022
7082
|
exports.JBondClientEnv = JBondClientEnv;
|
|
8023
|
-
exports.JPOOL_POOL_ADDRESS = JPOOL_POOL_ADDRESS;
|
|
8024
|
-
exports.JSOL_MINT = JSOL_MINT;
|
|
8025
7083
|
exports.NodeWallet = NodeWallet;
|
|
8026
7084
|
exports.STANDARD_BOND_SEED = STANDARD_BOND_SEED;
|
|
8027
7085
|
exports.SessionStatus = SessionStatus;
|
|
8028
7086
|
exports.VALIDATOR_BOND_SEED = VALIDATOR_BOND_SEED;
|
|
8029
|
-
exports.lamportsToSol = lamportsToSol;
|
|
8030
7087
|
//# sourceMappingURL=index.js.map
|
|
8031
7088
|
//# sourceMappingURL=index.js.map
|