@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.d.mts
CHANGED
|
@@ -1858,8 +1858,8 @@ declare class JBondClient {
|
|
|
1858
1858
|
* @param withStats
|
|
1859
1859
|
*/
|
|
1860
1860
|
getBondState(bondType: BondType, bondName: string, withStats?: boolean): Promise<{
|
|
1861
|
-
|
|
1862
|
-
|
|
1861
|
+
bondState: BondState;
|
|
1862
|
+
stateStats: BondStateStats | null;
|
|
1863
1863
|
}>;
|
|
1864
1864
|
/**
|
|
1865
1865
|
* Get all bond states with total collected collateral
|
package/dist/index.d.ts
CHANGED
|
@@ -1858,8 +1858,8 @@ declare class JBondClient {
|
|
|
1858
1858
|
* @param withStats
|
|
1859
1859
|
*/
|
|
1860
1860
|
getBondState(bondType: BondType, bondName: string, withStats?: boolean): Promise<{
|
|
1861
|
-
|
|
1862
|
-
|
|
1861
|
+
bondState: BondState;
|
|
1862
|
+
stateStats: BondStateStats | null;
|
|
1863
1863
|
}>;
|
|
1864
1864
|
/**
|
|
1865
1865
|
* Get all bond states with total collected collateral
|
package/dist/index.js
CHANGED
|
@@ -6668,7 +6668,7 @@ var JBondClient = class _JBondClient {
|
|
|
6668
6668
|
if (!creator) {
|
|
6669
6669
|
throw new Error("Missing creator");
|
|
6670
6670
|
}
|
|
6671
|
-
const collateralType = (await this.getBondState(bondType, name)).
|
|
6671
|
+
const collateralType = (await this.getBondState(bondType, name)).bondState.collateralType;
|
|
6672
6672
|
const accounts = {
|
|
6673
6673
|
bondState,
|
|
6674
6674
|
validatorBond,
|
|
@@ -6711,7 +6711,7 @@ var JBondClient = class _JBondClient {
|
|
|
6711
6711
|
creator: props.payer
|
|
6712
6712
|
}));
|
|
6713
6713
|
}
|
|
6714
|
-
const collateralType = (await this.getBondState(bondType, name)).
|
|
6714
|
+
const collateralType = (await this.getBondState(bondType, name)).bondState.collateralType;
|
|
6715
6715
|
const accounts = {
|
|
6716
6716
|
bondState,
|
|
6717
6717
|
validatorBond,
|
|
@@ -6748,7 +6748,7 @@ var JBondClient = class _JBondClient {
|
|
|
6748
6748
|
if (!payer || !destination) {
|
|
6749
6749
|
throw new Error("Missing payer/destination");
|
|
6750
6750
|
}
|
|
6751
|
-
const collateralType = (await this.getBondState(bondType, name)).
|
|
6751
|
+
const collateralType = (await this.getBondState(bondType, name)).bondState.collateralType;
|
|
6752
6752
|
const accounts = {
|
|
6753
6753
|
bondState,
|
|
6754
6754
|
validatorBond,
|
|
@@ -6776,12 +6776,12 @@ var JBondClient = class _JBondClient {
|
|
|
6776
6776
|
const { bondType, name } = props;
|
|
6777
6777
|
const [bondState] = this.pda.bondState(bondType, name);
|
|
6778
6778
|
const [validatorBond] = this.pda.validatorBond(bondType, name, props.voteAccount);
|
|
6779
|
-
const reserve = props.reserve ?? (await this.getBondState(bondType, name)).
|
|
6779
|
+
const reserve = props.reserve ?? (await this.getBondState(bondType, name)).bondState.reserve;
|
|
6780
6780
|
const authority = props.authority ?? this.program.provider.wallet?.publicKey;
|
|
6781
6781
|
if (!reserve) {
|
|
6782
6782
|
throw new Error("Reserve not set");
|
|
6783
6783
|
}
|
|
6784
|
-
const collateralType = (await this.getBondState(bondType, name)).
|
|
6784
|
+
const collateralType = (await this.getBondState(bondType, name)).bondState.collateralType;
|
|
6785
6785
|
const accounts = {
|
|
6786
6786
|
bondState,
|
|
6787
6787
|
validatorBond,
|
|
@@ -6846,8 +6846,8 @@ var JBondClient = class _JBondClient {
|
|
|
6846
6846
|
async getBondState(bondType, bondName, withStats = false) {
|
|
6847
6847
|
const bondState = await this.program.account.bondState.fetch(this.pda.bondState(bondType, bondName)[0]);
|
|
6848
6848
|
return {
|
|
6849
|
-
|
|
6850
|
-
|
|
6849
|
+
bondState,
|
|
6850
|
+
stateStats: withStats ? await this.getBondStateStats(bondState) : null
|
|
6851
6851
|
};
|
|
6852
6852
|
}
|
|
6853
6853
|
/**
|
|
@@ -6919,7 +6919,7 @@ var JBondClient = class _JBondClient {
|
|
|
6919
6919
|
*/
|
|
6920
6920
|
async getBondCollateralType(bondType, bondName) {
|
|
6921
6921
|
const bondState = await this.getBondState(bondType, bondName);
|
|
6922
|
-
return bondState.
|
|
6922
|
+
return bondState.bondState.collateralType;
|
|
6923
6923
|
}
|
|
6924
6924
|
/**
|
|
6925
6925
|
* Get validator bond account balance (in SOL)
|
|
@@ -6931,7 +6931,7 @@ var JBondClient = class _JBondClient {
|
|
|
6931
6931
|
async getValidatorBondBalance(bondType, bondName, vote) {
|
|
6932
6932
|
const [address] = this.pda.validatorBond(bondType, bondName, new web3_js.PublicKey(vote));
|
|
6933
6933
|
const bondStateData = await this.getBondState(bondType, bondName);
|
|
6934
|
-
const bondStateCollateralType = bondStateData.
|
|
6934
|
+
const bondStateCollateralType = bondStateData.bondState.collateralType;
|
|
6935
6935
|
return await matchVariant(bondStateCollateralType, {
|
|
6936
6936
|
native: async () => {
|
|
6937
6937
|
const accountInfo = await this.connection.getAccountInfo(address).catch(() => null);
|
|
@@ -6958,7 +6958,7 @@ var JBondClient = class _JBondClient {
|
|
|
6958
6958
|
*/
|
|
6959
6959
|
async getBondStateTotalCollected(bondType, bondName, votes) {
|
|
6960
6960
|
const bondStateData = await this.getBondState(bondType, bondName);
|
|
6961
|
-
const bondStateCollateralType = bondStateData.
|
|
6961
|
+
const bondStateCollateralType = bondStateData.bondState.collateralType;
|
|
6962
6962
|
const chunk = (arr, n = 100) => {
|
|
6963
6963
|
const res = [];
|
|
6964
6964
|
for (let i = 0; i < arr.length; i += n) {
|