@jpool/bond-sdk 0.9.0-next.16 → 0.9.0-next.18
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 +96 -89
- package/dist/index.d.ts +96 -89
- package/dist/index.js +56 -105
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +56 -106
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Fee } from '@solana/spl-stake-pool/src/layouts';
|
|
2
2
|
import { PublicKey, TransactionInstruction, Connection, PublicKeyInitData, Transaction, VersionedTransaction, Keypair } from '@solana/web3.js';
|
|
3
|
-
import
|
|
3
|
+
import * as bn_js from 'bn.js';
|
|
4
|
+
import bn_js__default from 'bn.js';
|
|
4
5
|
import { IdlTypes, IdlAccounts, Program, Provider } from '@coral-xyz/anchor';
|
|
5
6
|
|
|
6
7
|
type StakePoolManager = {
|
|
7
8
|
stakePoolAddress: PublicKey;
|
|
8
|
-
depositSol: (lamports:
|
|
9
|
-
withdrawSol: (poolTokens:
|
|
9
|
+
depositSol: (lamports: bn_js__default) => TransactionInstruction;
|
|
10
|
+
withdrawSol: (poolTokens: bn_js__default) => TransactionInstruction;
|
|
10
11
|
readonly exchangeRate: number;
|
|
11
12
|
readonly withdrawSolFee: Fee;
|
|
12
13
|
};
|
|
@@ -187,68 +188,6 @@ type Jbond = {
|
|
|
187
188
|
}
|
|
188
189
|
];
|
|
189
190
|
},
|
|
190
|
-
{
|
|
191
|
-
"name": "bondDisable";
|
|
192
|
-
"docs": [
|
|
193
|
-
"Disables a validator's bond, preventing it from participating further."
|
|
194
|
-
];
|
|
195
|
-
"discriminator": [
|
|
196
|
-
159,
|
|
197
|
-
156,
|
|
198
|
-
97,
|
|
199
|
-
253,
|
|
200
|
-
70,
|
|
201
|
-
122,
|
|
202
|
-
117,
|
|
203
|
-
129
|
|
204
|
-
];
|
|
205
|
-
"accounts": [
|
|
206
|
-
{
|
|
207
|
-
"name": "bondState";
|
|
208
|
-
"writable": true;
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
"name": "authority";
|
|
212
|
-
"writable": true;
|
|
213
|
-
"signer": true;
|
|
214
|
-
"relations": [
|
|
215
|
-
"bondState"
|
|
216
|
-
];
|
|
217
|
-
}
|
|
218
|
-
];
|
|
219
|
-
"args": [];
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
"name": "bondEnable";
|
|
223
|
-
"docs": [
|
|
224
|
-
"Enables a previously disabled validator's bond."
|
|
225
|
-
];
|
|
226
|
-
"discriminator": [
|
|
227
|
-
133,
|
|
228
|
-
48,
|
|
229
|
-
84,
|
|
230
|
-
9,
|
|
231
|
-
117,
|
|
232
|
-
131,
|
|
233
|
-
164,
|
|
234
|
-
128
|
|
235
|
-
];
|
|
236
|
-
"accounts": [
|
|
237
|
-
{
|
|
238
|
-
"name": "bondState";
|
|
239
|
-
"writable": true;
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
"name": "authority";
|
|
243
|
-
"writable": true;
|
|
244
|
-
"signer": true;
|
|
245
|
-
"relations": [
|
|
246
|
-
"bondState"
|
|
247
|
-
];
|
|
248
|
-
}
|
|
249
|
-
];
|
|
250
|
-
"args": [];
|
|
251
|
-
},
|
|
252
191
|
{
|
|
253
192
|
"name": "bondInitialize";
|
|
254
193
|
"docs": [
|
|
@@ -272,7 +211,6 @@ type Jbond = {
|
|
|
272
211
|
"accounts": [
|
|
273
212
|
{
|
|
274
213
|
"name": "globalState";
|
|
275
|
-
"writable": true;
|
|
276
214
|
},
|
|
277
215
|
{
|
|
278
216
|
"name": "bondState";
|
|
@@ -309,6 +247,9 @@ type Jbond = {
|
|
|
309
247
|
"name": "authority";
|
|
310
248
|
"writable": true;
|
|
311
249
|
"signer": true;
|
|
250
|
+
"relations": [
|
|
251
|
+
"globalState"
|
|
252
|
+
];
|
|
312
253
|
},
|
|
313
254
|
{
|
|
314
255
|
"name": "reserve";
|
|
@@ -1174,6 +1115,16 @@ type Jbond = {
|
|
|
1174
1115
|
"type": {
|
|
1175
1116
|
"kind": "struct";
|
|
1176
1117
|
"fields": [
|
|
1118
|
+
{
|
|
1119
|
+
"name": "status";
|
|
1120
|
+
"type": {
|
|
1121
|
+
"option": {
|
|
1122
|
+
"defined": {
|
|
1123
|
+
"name": "bondStatus";
|
|
1124
|
+
};
|
|
1125
|
+
};
|
|
1126
|
+
};
|
|
1127
|
+
},
|
|
1177
1128
|
{
|
|
1178
1129
|
"name": "newReserve";
|
|
1179
1130
|
"type": {
|
|
@@ -1346,6 +1297,9 @@ type Jbond = {
|
|
|
1346
1297
|
},
|
|
1347
1298
|
{
|
|
1348
1299
|
"name": "status";
|
|
1300
|
+
"docs": [
|
|
1301
|
+
"Current status of the bond"
|
|
1302
|
+
];
|
|
1349
1303
|
"type": {
|
|
1350
1304
|
"defined": {
|
|
1351
1305
|
"name": "bondStatus";
|
|
@@ -1604,6 +1558,7 @@ type BondState = IdlAccounts<Jbond>['bondState'];
|
|
|
1604
1558
|
type ValidatorBond = IdlAccounts<Jbond>['validatorBond'];
|
|
1605
1559
|
type BondType = IdlTypes<Jbond>['bondType'];
|
|
1606
1560
|
type CollateralType = IdlTypes<Jbond>['collateralType'];
|
|
1561
|
+
type BondStateStatus = IdlTypes<Jbond>['bondStatus'];
|
|
1607
1562
|
type BondStateStats = {
|
|
1608
1563
|
totalCollected: number;
|
|
1609
1564
|
status: SessionStatus;
|
|
@@ -1616,6 +1571,10 @@ declare const BondTypeVariant: {
|
|
|
1616
1571
|
Performance: BondType;
|
|
1617
1572
|
Crowdfunding: BondType;
|
|
1618
1573
|
};
|
|
1574
|
+
declare const BondStateStatusVariant: {
|
|
1575
|
+
Active: BondStateStatus;
|
|
1576
|
+
Disabled: BondStateStatus;
|
|
1577
|
+
};
|
|
1619
1578
|
type GlobalInitializeProps = {
|
|
1620
1579
|
authority?: PublicKey;
|
|
1621
1580
|
};
|
|
@@ -1673,6 +1632,7 @@ type BondConfigureProps = {
|
|
|
1673
1632
|
bondType: BondType;
|
|
1674
1633
|
name: string;
|
|
1675
1634
|
authority?: PublicKey;
|
|
1635
|
+
bondStateStatus?: BondStateStatus;
|
|
1676
1636
|
newAuthority?: PublicKey;
|
|
1677
1637
|
newReserve?: PublicKey;
|
|
1678
1638
|
};
|
|
@@ -1863,14 +1823,6 @@ declare class JBondClient {
|
|
|
1863
1823
|
bondType: BondType;
|
|
1864
1824
|
name: string;
|
|
1865
1825
|
}): Promise<string | undefined>;
|
|
1866
|
-
bondEnable(props: {
|
|
1867
|
-
bondType: BondType;
|
|
1868
|
-
name: string;
|
|
1869
|
-
}): Promise<string | undefined>;
|
|
1870
|
-
bondDisable(props: {
|
|
1871
|
-
bondType: BondType;
|
|
1872
|
-
name: string;
|
|
1873
|
-
}): Promise<string | undefined>;
|
|
1874
1826
|
buildBondGlobalStateInitializeIx(props: GlobalInitializeProps): Promise<TransactionInstruction>;
|
|
1875
1827
|
/**
|
|
1876
1828
|
* Build configure instruction
|
|
@@ -1895,14 +1847,6 @@ declare class JBondClient {
|
|
|
1895
1847
|
name: string;
|
|
1896
1848
|
duration_secs: number;
|
|
1897
1849
|
}): Promise<TransactionInstruction>;
|
|
1898
|
-
buildBondEnableIx(props: {
|
|
1899
|
-
bondType: BondType;
|
|
1900
|
-
name: string;
|
|
1901
|
-
}): Promise<TransactionInstruction>;
|
|
1902
|
-
buildBondDisableIx(props: {
|
|
1903
|
-
bondType: BondType;
|
|
1904
|
-
name: string;
|
|
1905
|
-
}): Promise<TransactionInstruction>;
|
|
1906
1850
|
/**
|
|
1907
1851
|
* Fetch global state or throw if not found
|
|
1908
1852
|
*/
|
|
@@ -1911,23 +1855,78 @@ declare class JBondClient {
|
|
|
1911
1855
|
* Fetch bond state with stats
|
|
1912
1856
|
* @param bondType - Type of the bond
|
|
1913
1857
|
* @param bondName - Name of the bond
|
|
1858
|
+
* @param withStats
|
|
1914
1859
|
*/
|
|
1915
|
-
getBondState(bondType: BondType, bondName: string, withStats?: boolean): Promise<
|
|
1860
|
+
getBondState(bondType: BondType, bondName: string, withStats?: boolean): Promise<{
|
|
1861
|
+
bond_state: BondState;
|
|
1862
|
+
state_stats: BondStateStats | null;
|
|
1863
|
+
}>;
|
|
1916
1864
|
/**
|
|
1917
1865
|
* Get all bond states with total collected collateral
|
|
1918
1866
|
*/
|
|
1919
|
-
getAllBondStates(bondType: BondType, session_status?: SessionStatus): Promise<
|
|
1867
|
+
getAllBondStates(bondType: BondType, session_status?: SessionStatus): Promise<{
|
|
1868
|
+
bond_state: {
|
|
1869
|
+
name: string;
|
|
1870
|
+
bondType: ({
|
|
1871
|
+
crowdfunding?: undefined;
|
|
1872
|
+
} & {
|
|
1873
|
+
performance: Record<string, never>;
|
|
1874
|
+
}) | ({
|
|
1875
|
+
performance?: undefined;
|
|
1876
|
+
} & {
|
|
1877
|
+
crowdfunding: Record<string, never>;
|
|
1878
|
+
});
|
|
1879
|
+
collateralType: ({
|
|
1880
|
+
native?: undefined;
|
|
1881
|
+
token?: undefined;
|
|
1882
|
+
} & {
|
|
1883
|
+
stakeAccount: Record<string, never>;
|
|
1884
|
+
}) | ({
|
|
1885
|
+
stakeAccount?: undefined;
|
|
1886
|
+
token?: undefined;
|
|
1887
|
+
} & {
|
|
1888
|
+
native: Record<string, never>;
|
|
1889
|
+
}) | ({
|
|
1890
|
+
stakeAccount?: undefined;
|
|
1891
|
+
native?: undefined;
|
|
1892
|
+
} & {
|
|
1893
|
+
token: {
|
|
1894
|
+
0: PublicKey;
|
|
1895
|
+
};
|
|
1896
|
+
});
|
|
1897
|
+
reserve: PublicKey;
|
|
1898
|
+
authority: PublicKey;
|
|
1899
|
+
sessionId: number;
|
|
1900
|
+
totalMembers: number;
|
|
1901
|
+
totalCompensationAmount: bn_js;
|
|
1902
|
+
sessionStartTs: bn_js;
|
|
1903
|
+
sessionFinishTs: bn_js;
|
|
1904
|
+
status: ({
|
|
1905
|
+
disabled?: undefined;
|
|
1906
|
+
} & {
|
|
1907
|
+
active: Record<string, never>;
|
|
1908
|
+
}) | ({
|
|
1909
|
+
active?: undefined;
|
|
1910
|
+
} & {
|
|
1911
|
+
disabled: Record<string, never>;
|
|
1912
|
+
});
|
|
1913
|
+
bump: number;
|
|
1914
|
+
};
|
|
1915
|
+
state_stats: {
|
|
1916
|
+
totalCollected: number;
|
|
1917
|
+
status: SessionStatus;
|
|
1918
|
+
};
|
|
1919
|
+
}[]>;
|
|
1920
1920
|
/**
|
|
1921
1921
|
* Get session status for bond state
|
|
1922
1922
|
*/
|
|
1923
1923
|
private getBondStateSessionStatus;
|
|
1924
|
-
/**
|
|
1924
|
+
/**
|
|
1925
|
+
* Get all validator bonds for a given bond state
|
|
1926
|
+
*/
|
|
1925
1927
|
private getValidatorBondsByState;
|
|
1926
1928
|
/**
|
|
1927
1929
|
* Fetch validator bond data or null if not found
|
|
1928
|
-
* @param bondType
|
|
1929
|
-
* @param bondName
|
|
1930
|
-
* @param vote
|
|
1931
1930
|
*/
|
|
1932
1931
|
getValidatorBond(bondType: BondType, bondName: string, vote: PublicKeyInitData): Promise<ValidatorBond | null>;
|
|
1933
1932
|
/**
|
|
@@ -1942,7 +1941,15 @@ declare class JBondClient {
|
|
|
1942
1941
|
* @return Balance in lamports
|
|
1943
1942
|
*/
|
|
1944
1943
|
getValidatorBondBalance(bondType: BondType, bondName: string, vote: PublicKeyInitData): Promise<number>;
|
|
1944
|
+
/**
|
|
1945
|
+
* Get total collected collateral for a bond state
|
|
1946
|
+
*/
|
|
1945
1947
|
getBondStateTotalCollected(bondType: BondType, bondName: string, votes: PublicKeyInitData[]): Promise<number>;
|
|
1948
|
+
/**
|
|
1949
|
+
* Get bond state stats
|
|
1950
|
+
* @param state
|
|
1951
|
+
* @private
|
|
1952
|
+
*/
|
|
1946
1953
|
private getBondStateStats;
|
|
1947
1954
|
/**
|
|
1948
1955
|
* Load stake pool account and cache it if not already cached
|
|
@@ -1964,4 +1971,4 @@ declare class JBondClient {
|
|
|
1964
1971
|
private lamports;
|
|
1965
1972
|
}
|
|
1966
1973
|
|
|
1967
|
-
export { BondClientEnv, type BondCollateral, type BondConfigureProps, type BondInitializeProps, type BondState, type BondStateStats, BondTransactionType, type BondType, BondTypeVariant, type ClaimProps, type ClientOptions, type CollateralType, ENV_PROGRAM_ID, type EpochHistoryItem, type GetHistoryGroupedProps, type GetHistoryProps, type GlobalConfigureProps, type GlobalInitializeProps, type GlobalState, JBondClient, JPOOL_STAKE_POOL, type Jbond, NodeWallet, type RegisterValidatorProps, Seeds, SessionStatus, type SetWithdrawAuthorityProps, type TopUpCollateralProps, type TransactionHistoryItem, type ValidatorBond, type WithdrawCollateralProps, bondTypeToSeed };
|
|
1974
|
+
export { BondClientEnv, type BondCollateral, type BondConfigureProps, type BondInitializeProps, type BondState, type BondStateStats, type BondStateStatus, BondStateStatusVariant, BondTransactionType, type BondType, BondTypeVariant, type ClaimProps, type ClientOptions, type CollateralType, ENV_PROGRAM_ID, type EpochHistoryItem, type GetHistoryGroupedProps, type GetHistoryProps, type GlobalConfigureProps, type GlobalInitializeProps, type GlobalState, JBondClient, JPOOL_STAKE_POOL, type Jbond, NodeWallet, type RegisterValidatorProps, Seeds, SessionStatus, type SetWithdrawAuthorityProps, type TopUpCollateralProps, type TransactionHistoryItem, type ValidatorBond, type WithdrawCollateralProps, bondTypeToSeed };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Fee } from '@solana/spl-stake-pool/src/layouts';
|
|
2
2
|
import { PublicKey, TransactionInstruction, Connection, PublicKeyInitData, Transaction, VersionedTransaction, Keypair } from '@solana/web3.js';
|
|
3
|
-
import
|
|
3
|
+
import * as bn_js from 'bn.js';
|
|
4
|
+
import bn_js__default from 'bn.js';
|
|
4
5
|
import { IdlTypes, IdlAccounts, Program, Provider } from '@coral-xyz/anchor';
|
|
5
6
|
|
|
6
7
|
type StakePoolManager = {
|
|
7
8
|
stakePoolAddress: PublicKey;
|
|
8
|
-
depositSol: (lamports:
|
|
9
|
-
withdrawSol: (poolTokens:
|
|
9
|
+
depositSol: (lamports: bn_js__default) => TransactionInstruction;
|
|
10
|
+
withdrawSol: (poolTokens: bn_js__default) => TransactionInstruction;
|
|
10
11
|
readonly exchangeRate: number;
|
|
11
12
|
readonly withdrawSolFee: Fee;
|
|
12
13
|
};
|
|
@@ -187,68 +188,6 @@ type Jbond = {
|
|
|
187
188
|
}
|
|
188
189
|
];
|
|
189
190
|
},
|
|
190
|
-
{
|
|
191
|
-
"name": "bondDisable";
|
|
192
|
-
"docs": [
|
|
193
|
-
"Disables a validator's bond, preventing it from participating further."
|
|
194
|
-
];
|
|
195
|
-
"discriminator": [
|
|
196
|
-
159,
|
|
197
|
-
156,
|
|
198
|
-
97,
|
|
199
|
-
253,
|
|
200
|
-
70,
|
|
201
|
-
122,
|
|
202
|
-
117,
|
|
203
|
-
129
|
|
204
|
-
];
|
|
205
|
-
"accounts": [
|
|
206
|
-
{
|
|
207
|
-
"name": "bondState";
|
|
208
|
-
"writable": true;
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
"name": "authority";
|
|
212
|
-
"writable": true;
|
|
213
|
-
"signer": true;
|
|
214
|
-
"relations": [
|
|
215
|
-
"bondState"
|
|
216
|
-
];
|
|
217
|
-
}
|
|
218
|
-
];
|
|
219
|
-
"args": [];
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
"name": "bondEnable";
|
|
223
|
-
"docs": [
|
|
224
|
-
"Enables a previously disabled validator's bond."
|
|
225
|
-
];
|
|
226
|
-
"discriminator": [
|
|
227
|
-
133,
|
|
228
|
-
48,
|
|
229
|
-
84,
|
|
230
|
-
9,
|
|
231
|
-
117,
|
|
232
|
-
131,
|
|
233
|
-
164,
|
|
234
|
-
128
|
|
235
|
-
];
|
|
236
|
-
"accounts": [
|
|
237
|
-
{
|
|
238
|
-
"name": "bondState";
|
|
239
|
-
"writable": true;
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
"name": "authority";
|
|
243
|
-
"writable": true;
|
|
244
|
-
"signer": true;
|
|
245
|
-
"relations": [
|
|
246
|
-
"bondState"
|
|
247
|
-
];
|
|
248
|
-
}
|
|
249
|
-
];
|
|
250
|
-
"args": [];
|
|
251
|
-
},
|
|
252
191
|
{
|
|
253
192
|
"name": "bondInitialize";
|
|
254
193
|
"docs": [
|
|
@@ -272,7 +211,6 @@ type Jbond = {
|
|
|
272
211
|
"accounts": [
|
|
273
212
|
{
|
|
274
213
|
"name": "globalState";
|
|
275
|
-
"writable": true;
|
|
276
214
|
},
|
|
277
215
|
{
|
|
278
216
|
"name": "bondState";
|
|
@@ -309,6 +247,9 @@ type Jbond = {
|
|
|
309
247
|
"name": "authority";
|
|
310
248
|
"writable": true;
|
|
311
249
|
"signer": true;
|
|
250
|
+
"relations": [
|
|
251
|
+
"globalState"
|
|
252
|
+
];
|
|
312
253
|
},
|
|
313
254
|
{
|
|
314
255
|
"name": "reserve";
|
|
@@ -1174,6 +1115,16 @@ type Jbond = {
|
|
|
1174
1115
|
"type": {
|
|
1175
1116
|
"kind": "struct";
|
|
1176
1117
|
"fields": [
|
|
1118
|
+
{
|
|
1119
|
+
"name": "status";
|
|
1120
|
+
"type": {
|
|
1121
|
+
"option": {
|
|
1122
|
+
"defined": {
|
|
1123
|
+
"name": "bondStatus";
|
|
1124
|
+
};
|
|
1125
|
+
};
|
|
1126
|
+
};
|
|
1127
|
+
},
|
|
1177
1128
|
{
|
|
1178
1129
|
"name": "newReserve";
|
|
1179
1130
|
"type": {
|
|
@@ -1346,6 +1297,9 @@ type Jbond = {
|
|
|
1346
1297
|
},
|
|
1347
1298
|
{
|
|
1348
1299
|
"name": "status";
|
|
1300
|
+
"docs": [
|
|
1301
|
+
"Current status of the bond"
|
|
1302
|
+
];
|
|
1349
1303
|
"type": {
|
|
1350
1304
|
"defined": {
|
|
1351
1305
|
"name": "bondStatus";
|
|
@@ -1604,6 +1558,7 @@ type BondState = IdlAccounts<Jbond>['bondState'];
|
|
|
1604
1558
|
type ValidatorBond = IdlAccounts<Jbond>['validatorBond'];
|
|
1605
1559
|
type BondType = IdlTypes<Jbond>['bondType'];
|
|
1606
1560
|
type CollateralType = IdlTypes<Jbond>['collateralType'];
|
|
1561
|
+
type BondStateStatus = IdlTypes<Jbond>['bondStatus'];
|
|
1607
1562
|
type BondStateStats = {
|
|
1608
1563
|
totalCollected: number;
|
|
1609
1564
|
status: SessionStatus;
|
|
@@ -1616,6 +1571,10 @@ declare const BondTypeVariant: {
|
|
|
1616
1571
|
Performance: BondType;
|
|
1617
1572
|
Crowdfunding: BondType;
|
|
1618
1573
|
};
|
|
1574
|
+
declare const BondStateStatusVariant: {
|
|
1575
|
+
Active: BondStateStatus;
|
|
1576
|
+
Disabled: BondStateStatus;
|
|
1577
|
+
};
|
|
1619
1578
|
type GlobalInitializeProps = {
|
|
1620
1579
|
authority?: PublicKey;
|
|
1621
1580
|
};
|
|
@@ -1673,6 +1632,7 @@ type BondConfigureProps = {
|
|
|
1673
1632
|
bondType: BondType;
|
|
1674
1633
|
name: string;
|
|
1675
1634
|
authority?: PublicKey;
|
|
1635
|
+
bondStateStatus?: BondStateStatus;
|
|
1676
1636
|
newAuthority?: PublicKey;
|
|
1677
1637
|
newReserve?: PublicKey;
|
|
1678
1638
|
};
|
|
@@ -1863,14 +1823,6 @@ declare class JBondClient {
|
|
|
1863
1823
|
bondType: BondType;
|
|
1864
1824
|
name: string;
|
|
1865
1825
|
}): Promise<string | undefined>;
|
|
1866
|
-
bondEnable(props: {
|
|
1867
|
-
bondType: BondType;
|
|
1868
|
-
name: string;
|
|
1869
|
-
}): Promise<string | undefined>;
|
|
1870
|
-
bondDisable(props: {
|
|
1871
|
-
bondType: BondType;
|
|
1872
|
-
name: string;
|
|
1873
|
-
}): Promise<string | undefined>;
|
|
1874
1826
|
buildBondGlobalStateInitializeIx(props: GlobalInitializeProps): Promise<TransactionInstruction>;
|
|
1875
1827
|
/**
|
|
1876
1828
|
* Build configure instruction
|
|
@@ -1895,14 +1847,6 @@ declare class JBondClient {
|
|
|
1895
1847
|
name: string;
|
|
1896
1848
|
duration_secs: number;
|
|
1897
1849
|
}): Promise<TransactionInstruction>;
|
|
1898
|
-
buildBondEnableIx(props: {
|
|
1899
|
-
bondType: BondType;
|
|
1900
|
-
name: string;
|
|
1901
|
-
}): Promise<TransactionInstruction>;
|
|
1902
|
-
buildBondDisableIx(props: {
|
|
1903
|
-
bondType: BondType;
|
|
1904
|
-
name: string;
|
|
1905
|
-
}): Promise<TransactionInstruction>;
|
|
1906
1850
|
/**
|
|
1907
1851
|
* Fetch global state or throw if not found
|
|
1908
1852
|
*/
|
|
@@ -1911,23 +1855,78 @@ declare class JBondClient {
|
|
|
1911
1855
|
* Fetch bond state with stats
|
|
1912
1856
|
* @param bondType - Type of the bond
|
|
1913
1857
|
* @param bondName - Name of the bond
|
|
1858
|
+
* @param withStats
|
|
1914
1859
|
*/
|
|
1915
|
-
getBondState(bondType: BondType, bondName: string, withStats?: boolean): Promise<
|
|
1860
|
+
getBondState(bondType: BondType, bondName: string, withStats?: boolean): Promise<{
|
|
1861
|
+
bond_state: BondState;
|
|
1862
|
+
state_stats: BondStateStats | null;
|
|
1863
|
+
}>;
|
|
1916
1864
|
/**
|
|
1917
1865
|
* Get all bond states with total collected collateral
|
|
1918
1866
|
*/
|
|
1919
|
-
getAllBondStates(bondType: BondType, session_status?: SessionStatus): Promise<
|
|
1867
|
+
getAllBondStates(bondType: BondType, session_status?: SessionStatus): Promise<{
|
|
1868
|
+
bond_state: {
|
|
1869
|
+
name: string;
|
|
1870
|
+
bondType: ({
|
|
1871
|
+
crowdfunding?: undefined;
|
|
1872
|
+
} & {
|
|
1873
|
+
performance: Record<string, never>;
|
|
1874
|
+
}) | ({
|
|
1875
|
+
performance?: undefined;
|
|
1876
|
+
} & {
|
|
1877
|
+
crowdfunding: Record<string, never>;
|
|
1878
|
+
});
|
|
1879
|
+
collateralType: ({
|
|
1880
|
+
native?: undefined;
|
|
1881
|
+
token?: undefined;
|
|
1882
|
+
} & {
|
|
1883
|
+
stakeAccount: Record<string, never>;
|
|
1884
|
+
}) | ({
|
|
1885
|
+
stakeAccount?: undefined;
|
|
1886
|
+
token?: undefined;
|
|
1887
|
+
} & {
|
|
1888
|
+
native: Record<string, never>;
|
|
1889
|
+
}) | ({
|
|
1890
|
+
stakeAccount?: undefined;
|
|
1891
|
+
native?: undefined;
|
|
1892
|
+
} & {
|
|
1893
|
+
token: {
|
|
1894
|
+
0: PublicKey;
|
|
1895
|
+
};
|
|
1896
|
+
});
|
|
1897
|
+
reserve: PublicKey;
|
|
1898
|
+
authority: PublicKey;
|
|
1899
|
+
sessionId: number;
|
|
1900
|
+
totalMembers: number;
|
|
1901
|
+
totalCompensationAmount: bn_js;
|
|
1902
|
+
sessionStartTs: bn_js;
|
|
1903
|
+
sessionFinishTs: bn_js;
|
|
1904
|
+
status: ({
|
|
1905
|
+
disabled?: undefined;
|
|
1906
|
+
} & {
|
|
1907
|
+
active: Record<string, never>;
|
|
1908
|
+
}) | ({
|
|
1909
|
+
active?: undefined;
|
|
1910
|
+
} & {
|
|
1911
|
+
disabled: Record<string, never>;
|
|
1912
|
+
});
|
|
1913
|
+
bump: number;
|
|
1914
|
+
};
|
|
1915
|
+
state_stats: {
|
|
1916
|
+
totalCollected: number;
|
|
1917
|
+
status: SessionStatus;
|
|
1918
|
+
};
|
|
1919
|
+
}[]>;
|
|
1920
1920
|
/**
|
|
1921
1921
|
* Get session status for bond state
|
|
1922
1922
|
*/
|
|
1923
1923
|
private getBondStateSessionStatus;
|
|
1924
|
-
/**
|
|
1924
|
+
/**
|
|
1925
|
+
* Get all validator bonds for a given bond state
|
|
1926
|
+
*/
|
|
1925
1927
|
private getValidatorBondsByState;
|
|
1926
1928
|
/**
|
|
1927
1929
|
* Fetch validator bond data or null if not found
|
|
1928
|
-
* @param bondType
|
|
1929
|
-
* @param bondName
|
|
1930
|
-
* @param vote
|
|
1931
1930
|
*/
|
|
1932
1931
|
getValidatorBond(bondType: BondType, bondName: string, vote: PublicKeyInitData): Promise<ValidatorBond | null>;
|
|
1933
1932
|
/**
|
|
@@ -1942,7 +1941,15 @@ declare class JBondClient {
|
|
|
1942
1941
|
* @return Balance in lamports
|
|
1943
1942
|
*/
|
|
1944
1943
|
getValidatorBondBalance(bondType: BondType, bondName: string, vote: PublicKeyInitData): Promise<number>;
|
|
1944
|
+
/**
|
|
1945
|
+
* Get total collected collateral for a bond state
|
|
1946
|
+
*/
|
|
1945
1947
|
getBondStateTotalCollected(bondType: BondType, bondName: string, votes: PublicKeyInitData[]): Promise<number>;
|
|
1948
|
+
/**
|
|
1949
|
+
* Get bond state stats
|
|
1950
|
+
* @param state
|
|
1951
|
+
* @private
|
|
1952
|
+
*/
|
|
1946
1953
|
private getBondStateStats;
|
|
1947
1954
|
/**
|
|
1948
1955
|
* Load stake pool account and cache it if not already cached
|
|
@@ -1964,4 +1971,4 @@ declare class JBondClient {
|
|
|
1964
1971
|
private lamports;
|
|
1965
1972
|
}
|
|
1966
1973
|
|
|
1967
|
-
export { BondClientEnv, type BondCollateral, type BondConfigureProps, type BondInitializeProps, type BondState, type BondStateStats, BondTransactionType, type BondType, BondTypeVariant, type ClaimProps, type ClientOptions, type CollateralType, ENV_PROGRAM_ID, type EpochHistoryItem, type GetHistoryGroupedProps, type GetHistoryProps, type GlobalConfigureProps, type GlobalInitializeProps, type GlobalState, JBondClient, JPOOL_STAKE_POOL, type Jbond, NodeWallet, type RegisterValidatorProps, Seeds, SessionStatus, type SetWithdrawAuthorityProps, type TopUpCollateralProps, type TransactionHistoryItem, type ValidatorBond, type WithdrawCollateralProps, bondTypeToSeed };
|
|
1974
|
+
export { BondClientEnv, type BondCollateral, type BondConfigureProps, type BondInitializeProps, type BondState, type BondStateStats, type BondStateStatus, BondStateStatusVariant, BondTransactionType, type BondType, BondTypeVariant, type ClaimProps, type ClientOptions, type CollateralType, ENV_PROGRAM_ID, type EpochHistoryItem, type GetHistoryGroupedProps, type GetHistoryProps, type GlobalConfigureProps, type GlobalInitializeProps, type GlobalState, JBondClient, JPOOL_STAKE_POOL, type Jbond, NodeWallet, type RegisterValidatorProps, Seeds, SessionStatus, type SetWithdrawAuthorityProps, type TopUpCollateralProps, type TransactionHistoryItem, type ValidatorBond, type WithdrawCollateralProps, bondTypeToSeed };
|