@jpool/bond-sdk 0.9.0-next.20 → 0.9.0-next.21
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 +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +10 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -6632,7 +6632,7 @@ var JBondClient = class _JBondClient {
|
|
|
6632
6632
|
if (!creator) {
|
|
6633
6633
|
throw new Error("Missing creator");
|
|
6634
6634
|
}
|
|
6635
|
-
const collateralType = (await this.getBondState(bondType, name)).
|
|
6635
|
+
const collateralType = (await this.getBondState(bondType, name)).bondState.collateralType;
|
|
6636
6636
|
const accounts = {
|
|
6637
6637
|
bondState,
|
|
6638
6638
|
validatorBond,
|
|
@@ -6675,7 +6675,7 @@ var JBondClient = class _JBondClient {
|
|
|
6675
6675
|
creator: props.payer
|
|
6676
6676
|
}));
|
|
6677
6677
|
}
|
|
6678
|
-
const collateralType = (await this.getBondState(bondType, name)).
|
|
6678
|
+
const collateralType = (await this.getBondState(bondType, name)).bondState.collateralType;
|
|
6679
6679
|
const accounts = {
|
|
6680
6680
|
bondState,
|
|
6681
6681
|
validatorBond,
|
|
@@ -6712,7 +6712,7 @@ var JBondClient = class _JBondClient {
|
|
|
6712
6712
|
if (!payer || !destination) {
|
|
6713
6713
|
throw new Error("Missing payer/destination");
|
|
6714
6714
|
}
|
|
6715
|
-
const collateralType = (await this.getBondState(bondType, name)).
|
|
6715
|
+
const collateralType = (await this.getBondState(bondType, name)).bondState.collateralType;
|
|
6716
6716
|
const accounts = {
|
|
6717
6717
|
bondState,
|
|
6718
6718
|
validatorBond,
|
|
@@ -6740,12 +6740,12 @@ var JBondClient = class _JBondClient {
|
|
|
6740
6740
|
const { bondType, name } = props;
|
|
6741
6741
|
const [bondState] = this.pda.bondState(bondType, name);
|
|
6742
6742
|
const [validatorBond] = this.pda.validatorBond(bondType, name, props.voteAccount);
|
|
6743
|
-
const reserve = props.reserve ?? (await this.getBondState(bondType, name)).
|
|
6743
|
+
const reserve = props.reserve ?? (await this.getBondState(bondType, name)).bondState.reserve;
|
|
6744
6744
|
const authority = props.authority ?? this.program.provider.wallet?.publicKey;
|
|
6745
6745
|
if (!reserve) {
|
|
6746
6746
|
throw new Error("Reserve not set");
|
|
6747
6747
|
}
|
|
6748
|
-
const collateralType = (await this.getBondState(bondType, name)).
|
|
6748
|
+
const collateralType = (await this.getBondState(bondType, name)).bondState.collateralType;
|
|
6749
6749
|
const accounts = {
|
|
6750
6750
|
bondState,
|
|
6751
6751
|
validatorBond,
|
|
@@ -6810,8 +6810,8 @@ var JBondClient = class _JBondClient {
|
|
|
6810
6810
|
async getBondState(bondType, bondName, withStats = false) {
|
|
6811
6811
|
const bondState = await this.program.account.bondState.fetch(this.pda.bondState(bondType, bondName)[0]);
|
|
6812
6812
|
return {
|
|
6813
|
-
|
|
6814
|
-
|
|
6813
|
+
bondState,
|
|
6814
|
+
stateStats: withStats ? await this.getBondStateStats(bondState) : null
|
|
6815
6815
|
};
|
|
6816
6816
|
}
|
|
6817
6817
|
/**
|
|
@@ -6883,7 +6883,7 @@ var JBondClient = class _JBondClient {
|
|
|
6883
6883
|
*/
|
|
6884
6884
|
async getBondCollateralType(bondType, bondName) {
|
|
6885
6885
|
const bondState = await this.getBondState(bondType, bondName);
|
|
6886
|
-
return bondState.
|
|
6886
|
+
return bondState.bondState.collateralType;
|
|
6887
6887
|
}
|
|
6888
6888
|
/**
|
|
6889
6889
|
* Get validator bond account balance (in SOL)
|
|
@@ -6895,7 +6895,7 @@ var JBondClient = class _JBondClient {
|
|
|
6895
6895
|
async getValidatorBondBalance(bondType, bondName, vote) {
|
|
6896
6896
|
const [address] = this.pda.validatorBond(bondType, bondName, new PublicKey(vote));
|
|
6897
6897
|
const bondStateData = await this.getBondState(bondType, bondName);
|
|
6898
|
-
const bondStateCollateralType = bondStateData.
|
|
6898
|
+
const bondStateCollateralType = bondStateData.bondState.collateralType;
|
|
6899
6899
|
return await matchVariant(bondStateCollateralType, {
|
|
6900
6900
|
native: async () => {
|
|
6901
6901
|
const accountInfo = await this.connection.getAccountInfo(address).catch(() => null);
|
|
@@ -6922,7 +6922,7 @@ var JBondClient = class _JBondClient {
|
|
|
6922
6922
|
*/
|
|
6923
6923
|
async getBondStateTotalCollected(bondType, bondName, votes) {
|
|
6924
6924
|
const bondStateData = await this.getBondState(bondType, bondName);
|
|
6925
|
-
const bondStateCollateralType = bondStateData.
|
|
6925
|
+
const bondStateCollateralType = bondStateData.bondState.collateralType;
|
|
6926
6926
|
const chunk = (arr, n = 100) => {
|
|
6927
6927
|
const res = [];
|
|
6928
6928
|
for (let i = 0; i < arr.length; i += n) {
|