@jpool/bond-sdk 0.9.0-next.21 → 0.9.0-next.22
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 +84 -6
- package/dist/index.d.ts +84 -6
- package/dist/index.js +97 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +97 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -209,9 +209,6 @@ type Jbond = {
|
|
|
209
209
|
210
|
|
210
210
|
];
|
|
211
211
|
"accounts": [
|
|
212
|
-
{
|
|
213
|
-
"name": "globalState";
|
|
214
|
-
},
|
|
215
212
|
{
|
|
216
213
|
"name": "bondState";
|
|
217
214
|
"writable": true;
|
|
@@ -247,9 +244,6 @@ type Jbond = {
|
|
|
247
244
|
"name": "authority";
|
|
248
245
|
"writable": true;
|
|
249
246
|
"signer": true;
|
|
250
|
-
"relations": [
|
|
251
|
-
"globalState"
|
|
252
|
-
];
|
|
253
247
|
},
|
|
254
248
|
{
|
|
255
249
|
"name": "reserve";
|
|
@@ -798,6 +792,80 @@ type Jbond = {
|
|
|
798
792
|
];
|
|
799
793
|
"args": [];
|
|
800
794
|
},
|
|
795
|
+
{
|
|
796
|
+
"name": "migrateBond";
|
|
797
|
+
"docs": [
|
|
798
|
+
"Migrates validator bond data from legacy structure to new structure."
|
|
799
|
+
];
|
|
800
|
+
"discriminator": [
|
|
801
|
+
107,
|
|
802
|
+
119,
|
|
803
|
+
59,
|
|
804
|
+
110,
|
|
805
|
+
76,
|
|
806
|
+
18,
|
|
807
|
+
37,
|
|
808
|
+
163
|
|
809
|
+
];
|
|
810
|
+
"accounts": [
|
|
811
|
+
{
|
|
812
|
+
"name": "bondState";
|
|
813
|
+
"writable": true;
|
|
814
|
+
},
|
|
815
|
+
{
|
|
816
|
+
"name": "legacyValidatorBond";
|
|
817
|
+
"writable": true;
|
|
818
|
+
},
|
|
819
|
+
{
|
|
820
|
+
"name": "legacyVoteAccount";
|
|
821
|
+
},
|
|
822
|
+
{
|
|
823
|
+
"name": "validatorBond";
|
|
824
|
+
"writable": true;
|
|
825
|
+
"pda": {
|
|
826
|
+
"seeds": [
|
|
827
|
+
{
|
|
828
|
+
"kind": "const";
|
|
829
|
+
"value": [
|
|
830
|
+
118,
|
|
831
|
+
97,
|
|
832
|
+
108,
|
|
833
|
+
105,
|
|
834
|
+
100,
|
|
835
|
+
97,
|
|
836
|
+
116,
|
|
837
|
+
111,
|
|
838
|
+
114,
|
|
839
|
+
95,
|
|
840
|
+
98,
|
|
841
|
+
111,
|
|
842
|
+
110,
|
|
843
|
+
100
|
|
844
|
+
];
|
|
845
|
+
},
|
|
846
|
+
{
|
|
847
|
+
"kind": "account";
|
|
848
|
+
"path": "bondState";
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
"kind": "account";
|
|
852
|
+
"path": "legacyVoteAccount";
|
|
853
|
+
}
|
|
854
|
+
];
|
|
855
|
+
};
|
|
856
|
+
},
|
|
857
|
+
{
|
|
858
|
+
"name": "creator";
|
|
859
|
+
"writable": true;
|
|
860
|
+
"signer": true;
|
|
861
|
+
},
|
|
862
|
+
{
|
|
863
|
+
"name": "systemProgram";
|
|
864
|
+
"address": "11111111111111111111111111111111";
|
|
865
|
+
}
|
|
866
|
+
];
|
|
867
|
+
"args": [];
|
|
868
|
+
},
|
|
801
869
|
{
|
|
802
870
|
"name": "sessionFinish";
|
|
803
871
|
"docs": [
|
|
@@ -1842,6 +1910,16 @@ declare class JBondClient {
|
|
|
1842
1910
|
bondType: BondType;
|
|
1843
1911
|
name: string;
|
|
1844
1912
|
}): Promise<TransactionInstruction>;
|
|
1913
|
+
migrateBond(props: {
|
|
1914
|
+
bondType: BondType;
|
|
1915
|
+
name: string;
|
|
1916
|
+
voteAccount: PublicKeyInitData;
|
|
1917
|
+
}): Promise<string | undefined>;
|
|
1918
|
+
buildBondMigrateIx(props: {
|
|
1919
|
+
bondType: BondType;
|
|
1920
|
+
name: string;
|
|
1921
|
+
voteAccount: PublicKeyInitData;
|
|
1922
|
+
}): Promise<TransactionInstruction>;
|
|
1845
1923
|
buildBondStartIx(props: {
|
|
1846
1924
|
bondType: BondType;
|
|
1847
1925
|
name: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -209,9 +209,6 @@ type Jbond = {
|
|
|
209
209
|
210
|
|
210
210
|
];
|
|
211
211
|
"accounts": [
|
|
212
|
-
{
|
|
213
|
-
"name": "globalState";
|
|
214
|
-
},
|
|
215
212
|
{
|
|
216
213
|
"name": "bondState";
|
|
217
214
|
"writable": true;
|
|
@@ -247,9 +244,6 @@ type Jbond = {
|
|
|
247
244
|
"name": "authority";
|
|
248
245
|
"writable": true;
|
|
249
246
|
"signer": true;
|
|
250
|
-
"relations": [
|
|
251
|
-
"globalState"
|
|
252
|
-
];
|
|
253
247
|
},
|
|
254
248
|
{
|
|
255
249
|
"name": "reserve";
|
|
@@ -798,6 +792,80 @@ type Jbond = {
|
|
|
798
792
|
];
|
|
799
793
|
"args": [];
|
|
800
794
|
},
|
|
795
|
+
{
|
|
796
|
+
"name": "migrateBond";
|
|
797
|
+
"docs": [
|
|
798
|
+
"Migrates validator bond data from legacy structure to new structure."
|
|
799
|
+
];
|
|
800
|
+
"discriminator": [
|
|
801
|
+
107,
|
|
802
|
+
119,
|
|
803
|
+
59,
|
|
804
|
+
110,
|
|
805
|
+
76,
|
|
806
|
+
18,
|
|
807
|
+
37,
|
|
808
|
+
163
|
|
809
|
+
];
|
|
810
|
+
"accounts": [
|
|
811
|
+
{
|
|
812
|
+
"name": "bondState";
|
|
813
|
+
"writable": true;
|
|
814
|
+
},
|
|
815
|
+
{
|
|
816
|
+
"name": "legacyValidatorBond";
|
|
817
|
+
"writable": true;
|
|
818
|
+
},
|
|
819
|
+
{
|
|
820
|
+
"name": "legacyVoteAccount";
|
|
821
|
+
},
|
|
822
|
+
{
|
|
823
|
+
"name": "validatorBond";
|
|
824
|
+
"writable": true;
|
|
825
|
+
"pda": {
|
|
826
|
+
"seeds": [
|
|
827
|
+
{
|
|
828
|
+
"kind": "const";
|
|
829
|
+
"value": [
|
|
830
|
+
118,
|
|
831
|
+
97,
|
|
832
|
+
108,
|
|
833
|
+
105,
|
|
834
|
+
100,
|
|
835
|
+
97,
|
|
836
|
+
116,
|
|
837
|
+
111,
|
|
838
|
+
114,
|
|
839
|
+
95,
|
|
840
|
+
98,
|
|
841
|
+
111,
|
|
842
|
+
110,
|
|
843
|
+
100
|
|
844
|
+
];
|
|
845
|
+
},
|
|
846
|
+
{
|
|
847
|
+
"kind": "account";
|
|
848
|
+
"path": "bondState";
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
"kind": "account";
|
|
852
|
+
"path": "legacyVoteAccount";
|
|
853
|
+
}
|
|
854
|
+
];
|
|
855
|
+
};
|
|
856
|
+
},
|
|
857
|
+
{
|
|
858
|
+
"name": "creator";
|
|
859
|
+
"writable": true;
|
|
860
|
+
"signer": true;
|
|
861
|
+
},
|
|
862
|
+
{
|
|
863
|
+
"name": "systemProgram";
|
|
864
|
+
"address": "11111111111111111111111111111111";
|
|
865
|
+
}
|
|
866
|
+
];
|
|
867
|
+
"args": [];
|
|
868
|
+
},
|
|
801
869
|
{
|
|
802
870
|
"name": "sessionFinish";
|
|
803
871
|
"docs": [
|
|
@@ -1842,6 +1910,16 @@ declare class JBondClient {
|
|
|
1842
1910
|
bondType: BondType;
|
|
1843
1911
|
name: string;
|
|
1844
1912
|
}): Promise<TransactionInstruction>;
|
|
1913
|
+
migrateBond(props: {
|
|
1914
|
+
bondType: BondType;
|
|
1915
|
+
name: string;
|
|
1916
|
+
voteAccount: PublicKeyInitData;
|
|
1917
|
+
}): Promise<string | undefined>;
|
|
1918
|
+
buildBondMigrateIx(props: {
|
|
1919
|
+
bondType: BondType;
|
|
1920
|
+
name: string;
|
|
1921
|
+
voteAccount: PublicKeyInitData;
|
|
1922
|
+
}): Promise<TransactionInstruction>;
|
|
1845
1923
|
buildBondStartIx(props: {
|
|
1846
1924
|
bondType: BondType;
|
|
1847
1925
|
name: string;
|
package/dist/index.js
CHANGED
|
@@ -5019,9 +5019,6 @@ var jbond_default = {
|
|
|
5019
5019
|
210
|
|
5020
5020
|
],
|
|
5021
5021
|
accounts: [
|
|
5022
|
-
{
|
|
5023
|
-
name: "global_state"
|
|
5024
|
-
},
|
|
5025
5022
|
{
|
|
5026
5023
|
name: "bond_state",
|
|
5027
5024
|
writable: true,
|
|
@@ -5056,10 +5053,7 @@ var jbond_default = {
|
|
|
5056
5053
|
{
|
|
5057
5054
|
name: "authority",
|
|
5058
5055
|
writable: true,
|
|
5059
|
-
signer: true
|
|
5060
|
-
relations: [
|
|
5061
|
-
"global_state"
|
|
5062
|
-
]
|
|
5056
|
+
signer: true
|
|
5063
5057
|
},
|
|
5064
5058
|
{
|
|
5065
5059
|
name: "reserve"
|
|
@@ -5608,6 +5602,80 @@ var jbond_default = {
|
|
|
5608
5602
|
],
|
|
5609
5603
|
args: []
|
|
5610
5604
|
},
|
|
5605
|
+
{
|
|
5606
|
+
name: "migrate_bond",
|
|
5607
|
+
docs: [
|
|
5608
|
+
"Migrates validator bond data from legacy structure to new structure."
|
|
5609
|
+
],
|
|
5610
|
+
discriminator: [
|
|
5611
|
+
107,
|
|
5612
|
+
119,
|
|
5613
|
+
59,
|
|
5614
|
+
110,
|
|
5615
|
+
76,
|
|
5616
|
+
18,
|
|
5617
|
+
37,
|
|
5618
|
+
163
|
|
5619
|
+
],
|
|
5620
|
+
accounts: [
|
|
5621
|
+
{
|
|
5622
|
+
name: "bond_state",
|
|
5623
|
+
writable: true
|
|
5624
|
+
},
|
|
5625
|
+
{
|
|
5626
|
+
name: "legacy_validator_bond",
|
|
5627
|
+
writable: true
|
|
5628
|
+
},
|
|
5629
|
+
{
|
|
5630
|
+
name: "legacy_vote_account"
|
|
5631
|
+
},
|
|
5632
|
+
{
|
|
5633
|
+
name: "validator_bond",
|
|
5634
|
+
writable: true,
|
|
5635
|
+
pda: {
|
|
5636
|
+
seeds: [
|
|
5637
|
+
{
|
|
5638
|
+
kind: "const",
|
|
5639
|
+
value: [
|
|
5640
|
+
118,
|
|
5641
|
+
97,
|
|
5642
|
+
108,
|
|
5643
|
+
105,
|
|
5644
|
+
100,
|
|
5645
|
+
97,
|
|
5646
|
+
116,
|
|
5647
|
+
111,
|
|
5648
|
+
114,
|
|
5649
|
+
95,
|
|
5650
|
+
98,
|
|
5651
|
+
111,
|
|
5652
|
+
110,
|
|
5653
|
+
100
|
|
5654
|
+
]
|
|
5655
|
+
},
|
|
5656
|
+
{
|
|
5657
|
+
kind: "account",
|
|
5658
|
+
path: "bond_state"
|
|
5659
|
+
},
|
|
5660
|
+
{
|
|
5661
|
+
kind: "account",
|
|
5662
|
+
path: "legacy_vote_account"
|
|
5663
|
+
}
|
|
5664
|
+
]
|
|
5665
|
+
}
|
|
5666
|
+
},
|
|
5667
|
+
{
|
|
5668
|
+
name: "creator",
|
|
5669
|
+
writable: true,
|
|
5670
|
+
signer: true
|
|
5671
|
+
},
|
|
5672
|
+
{
|
|
5673
|
+
name: "system_program",
|
|
5674
|
+
address: "11111111111111111111111111111111"
|
|
5675
|
+
}
|
|
5676
|
+
],
|
|
5677
|
+
args: []
|
|
5678
|
+
},
|
|
5611
5679
|
{
|
|
5612
5680
|
name: "session_finish",
|
|
5613
5681
|
docs: [
|
|
@@ -6620,10 +6688,8 @@ var JBondClient = class _JBondClient {
|
|
|
6620
6688
|
* Build initialize instruction
|
|
6621
6689
|
*/
|
|
6622
6690
|
async buildBondInitializeIx(props) {
|
|
6623
|
-
const [globalState] = this.pda.globalState();
|
|
6624
6691
|
const [bondState] = this.pda.bondState(props.bondType, props.name);
|
|
6625
6692
|
const accounts = {
|
|
6626
|
-
globalState,
|
|
6627
6693
|
bondState,
|
|
6628
6694
|
authority: props.authority ?? this.program.provider.wallet?.publicKey,
|
|
6629
6695
|
reserve: props.reserve,
|
|
@@ -6823,6 +6889,28 @@ var JBondClient = class _JBondClient {
|
|
|
6823
6889
|
authority: this.program.provider.wallet?.publicKey
|
|
6824
6890
|
}).instruction();
|
|
6825
6891
|
}
|
|
6892
|
+
async migrateBond(props) {
|
|
6893
|
+
const ix = await this.buildBondMigrateIx(props);
|
|
6894
|
+
return this.provider.sendAndConfirm?.(new web3_js.Transaction().add(ix));
|
|
6895
|
+
}
|
|
6896
|
+
async buildBondMigrateIx(props) {
|
|
6897
|
+
const [bondState] = this.pda.bondState(props.bondType, props.name);
|
|
6898
|
+
const [legacyValidatorBond] = web3_js.PublicKey.findProgramAddressSync(
|
|
6899
|
+
[
|
|
6900
|
+
Buffer.from("validator_bond"),
|
|
6901
|
+
new web3_js.PublicKey(props.voteAccount).toBuffer()
|
|
6902
|
+
],
|
|
6903
|
+
this.programId
|
|
6904
|
+
);
|
|
6905
|
+
const [validatorBond] = this.pda.validatorBond(props.bondType, props.name, props.voteAccount);
|
|
6906
|
+
return this.program.methods.migrateBond().accountsPartial({
|
|
6907
|
+
bondState,
|
|
6908
|
+
legacyValidatorBond,
|
|
6909
|
+
legacyVoteAccount: new web3_js.PublicKey(props.voteAccount),
|
|
6910
|
+
validatorBond,
|
|
6911
|
+
creator: this.program.provider.wallet?.publicKey
|
|
6912
|
+
}).instruction();
|
|
6913
|
+
}
|
|
6826
6914
|
async buildBondStartIx(props) {
|
|
6827
6915
|
const [bondState] = this.pda.bondState(props.bondType, props.name);
|
|
6828
6916
|
return this.program.methods.sessionStart(new import_bn2.BN(props.duration_secs)).accountsPartial({
|