@jpool/bond-sdk 0.9.0-next.5 → 0.9.0-next.7

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 CHANGED
@@ -1,5 +1,4 @@
1
1
  import { Fee } from '@solana/spl-stake-pool/src/layouts';
2
- import * as _solana_web3_js from '@solana/web3.js';
3
2
  import { PublicKey, TransactionInstruction, Connection, PublicKeyInitData, Transaction, VersionedTransaction, Keypair } from '@solana/web3.js';
4
3
  import BN from 'bn.js';
5
4
  import { IdlTypes, IdlAccounts, Program, Provider } from '@coral-xyz/anchor';
@@ -1533,6 +1532,10 @@ type BondState = IdlAccounts<Jbond>['bondState'];
1533
1532
  type ValidatorBond = IdlAccounts<Jbond>['validatorBond'];
1534
1533
  type BondType = IdlTypes<Jbond>['bondType'];
1535
1534
  type CollateralType = IdlTypes<Jbond>['collateralType'];
1535
+ type BondStateStats = {
1536
+ totalCollected: number;
1537
+ totalMembers: number;
1538
+ };
1536
1539
  declare const bondTypeToSeed: {
1537
1540
  performance: Seeds;
1538
1541
  crowdfunding: Seeds;
@@ -1561,6 +1564,7 @@ type RegisterValidatorProps = {
1561
1564
  type TopUpCollateralProps = {
1562
1565
  bondType: BondType;
1563
1566
  name: string;
1567
+ identity: PublicKey;
1564
1568
  voteAccount: PublicKey;
1565
1569
  collateral: BondCollateral;
1566
1570
  payer?: PublicKey;
@@ -1719,7 +1723,6 @@ declare class JBondClient {
1719
1723
  * Configure a specific option.
1720
1724
  */
1721
1725
  configureEnv<K extends keyof ClientOptions>(key: K, val: ClientOptions[K]): this;
1722
- private getAdapter;
1723
1726
  private getBondTypeSeed;
1724
1727
  /**
1725
1728
  * Program Derived Addresses (PDAs)
@@ -1788,55 +1791,40 @@ declare class JBondClient {
1788
1791
  bondType: BondType;
1789
1792
  name: string;
1790
1793
  }): Promise<string | undefined>;
1791
- buildBondGlobalStateInitializeInstruction(props: GlobalInitializeProps): Promise<_solana_web3_js.TransactionInstruction>;
1794
+ buildBondGlobalStateInitializeIx(props: GlobalInitializeProps): Promise<TransactionInstruction>;
1792
1795
  /**
1793
1796
  * Build configure instruction
1794
1797
  */
1795
- buildGlobalConfigureInstruction(props: GlobalConfigureProps): Promise<_solana_web3_js.TransactionInstruction>;
1798
+ buildGlobalConfigureInstruction(props: GlobalConfigureProps): Promise<TransactionInstruction>;
1796
1799
  /**
1797
1800
  * Build initialize instruction
1798
1801
  */
1799
- buildBondInitializeInstruction(props: BondInitializeProps): Promise<_solana_web3_js.TransactionInstruction>;
1800
- /**
1801
- * Build register validator instruction
1802
- */
1803
- buildRegisterValidatorInstruction(props: RegisterValidatorProps): Promise<_solana_web3_js.TransactionInstruction>;
1804
- /**
1805
- * Build top up collateral instruction
1806
- */
1807
- buildTopUpCollateralInstruction(props: TopUpCollateralProps): Promise<_solana_web3_js.TransactionInstruction>;
1808
- /**
1809
- * Build withdraw collateral instruction
1810
- */
1811
- buildWithdrawCollateralInstruction(props: WithdrawCollateralProps): Promise<_solana_web3_js.TransactionInstruction>;
1812
- /**
1813
- * Build claim compensation instruction
1814
- */
1815
- buildBondClaimInstruction(props: ClaimProps): Promise<_solana_web3_js.TransactionInstruction>;
1816
- /**
1817
- * Build configure instruction
1818
- */
1819
- buildConfigureInstruction(props: BondConfigureProps): Promise<_solana_web3_js.TransactionInstruction>;
1820
- /**
1821
- * Build set withdraw authority instruction
1822
- */
1823
- buildSetWithdrawAuthorityInstruction(props: SetWithdrawAuthorityProps): Promise<_solana_web3_js.TransactionInstruction>;
1824
- buildBondStartInstruction(props: {
1802
+ buildBondInitializeIx(props: BondInitializeProps): Promise<TransactionInstruction>;
1803
+ buildConfigureIx(props: BondConfigureProps): Promise<TransactionInstruction>;
1804
+ buildRegisterIx(props: RegisterValidatorProps): Promise<TransactionInstruction>;
1805
+ buildTopUpIXs(props: TopUpCollateralProps): Promise<TransactionInstruction[]>;
1806
+ buildWithdrawIx(props: WithdrawCollateralProps): Promise<TransactionInstruction>;
1807
+ buildClaimIx(props: ClaimProps): Promise<TransactionInstruction>;
1808
+ buildSetWithdrawAuthorityIx(props: SetWithdrawAuthorityProps): Promise<TransactionInstruction>;
1809
+ buildBondFinishIx(_props: {
1825
1810
  bondType: BondType;
1826
1811
  name: string;
1827
- duration_secs: number;
1828
- }): Promise<_solana_web3_js.TransactionInstruction>;
1829
- buildBondFinishInstruction(props: {
1812
+ }): Promise<TransactionInstruction>;
1813
+ buildBondStartIx(props: {
1830
1814
  bondType: BondType;
1831
1815
  name: string;
1832
- }): Promise<_solana_web3_js.TransactionInstruction>;
1816
+ duration_secs: number;
1817
+ }): Promise<TransactionInstruction>;
1833
1818
  /**
1834
1819
  * Fetch global state or throw if not found
1835
1820
  */
1836
1821
  getGlobalState(): Promise<GlobalState>;
1837
1822
  getBondState(bondType: BondType, bondName: string): Promise<BondState>;
1838
- getAllBondStates(_bondType: BondType): Promise<BondState[]>;
1839
- getBondStateSessionStatus(bondType: BondType, bondName: string): Promise<SessionStatus>;
1823
+ /**
1824
+ * Get all bond states with total collected collateral
1825
+ */
1826
+ getAllBondStates(_bondType: BondType): Promise<Array<[BondState, number]>>;
1827
+ private getValidatorBondsByState;
1840
1828
  /**
1841
1829
  * Fetch validator bond data or null if not found
1842
1830
  * @param bondType
@@ -1873,6 +1861,7 @@ declare class JBondClient {
1873
1861
  * Throws an error if no user is available.
1874
1862
  */
1875
1863
  private ensureUser;
1864
+ private lamports;
1876
1865
  }
1877
1866
 
1878
- export { BondClientEnv, type BondCollateral, type BondConfigureProps, type BondInitializeProps, type BondState, 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 };
1867
+ 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 };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { Fee } from '@solana/spl-stake-pool/src/layouts';
2
- import * as _solana_web3_js from '@solana/web3.js';
3
2
  import { PublicKey, TransactionInstruction, Connection, PublicKeyInitData, Transaction, VersionedTransaction, Keypair } from '@solana/web3.js';
4
3
  import BN from 'bn.js';
5
4
  import { IdlTypes, IdlAccounts, Program, Provider } from '@coral-xyz/anchor';
@@ -1533,6 +1532,10 @@ type BondState = IdlAccounts<Jbond>['bondState'];
1533
1532
  type ValidatorBond = IdlAccounts<Jbond>['validatorBond'];
1534
1533
  type BondType = IdlTypes<Jbond>['bondType'];
1535
1534
  type CollateralType = IdlTypes<Jbond>['collateralType'];
1535
+ type BondStateStats = {
1536
+ totalCollected: number;
1537
+ totalMembers: number;
1538
+ };
1536
1539
  declare const bondTypeToSeed: {
1537
1540
  performance: Seeds;
1538
1541
  crowdfunding: Seeds;
@@ -1561,6 +1564,7 @@ type RegisterValidatorProps = {
1561
1564
  type TopUpCollateralProps = {
1562
1565
  bondType: BondType;
1563
1566
  name: string;
1567
+ identity: PublicKey;
1564
1568
  voteAccount: PublicKey;
1565
1569
  collateral: BondCollateral;
1566
1570
  payer?: PublicKey;
@@ -1719,7 +1723,6 @@ declare class JBondClient {
1719
1723
  * Configure a specific option.
1720
1724
  */
1721
1725
  configureEnv<K extends keyof ClientOptions>(key: K, val: ClientOptions[K]): this;
1722
- private getAdapter;
1723
1726
  private getBondTypeSeed;
1724
1727
  /**
1725
1728
  * Program Derived Addresses (PDAs)
@@ -1788,55 +1791,40 @@ declare class JBondClient {
1788
1791
  bondType: BondType;
1789
1792
  name: string;
1790
1793
  }): Promise<string | undefined>;
1791
- buildBondGlobalStateInitializeInstruction(props: GlobalInitializeProps): Promise<_solana_web3_js.TransactionInstruction>;
1794
+ buildBondGlobalStateInitializeIx(props: GlobalInitializeProps): Promise<TransactionInstruction>;
1792
1795
  /**
1793
1796
  * Build configure instruction
1794
1797
  */
1795
- buildGlobalConfigureInstruction(props: GlobalConfigureProps): Promise<_solana_web3_js.TransactionInstruction>;
1798
+ buildGlobalConfigureInstruction(props: GlobalConfigureProps): Promise<TransactionInstruction>;
1796
1799
  /**
1797
1800
  * Build initialize instruction
1798
1801
  */
1799
- buildBondInitializeInstruction(props: BondInitializeProps): Promise<_solana_web3_js.TransactionInstruction>;
1800
- /**
1801
- * Build register validator instruction
1802
- */
1803
- buildRegisterValidatorInstruction(props: RegisterValidatorProps): Promise<_solana_web3_js.TransactionInstruction>;
1804
- /**
1805
- * Build top up collateral instruction
1806
- */
1807
- buildTopUpCollateralInstruction(props: TopUpCollateralProps): Promise<_solana_web3_js.TransactionInstruction>;
1808
- /**
1809
- * Build withdraw collateral instruction
1810
- */
1811
- buildWithdrawCollateralInstruction(props: WithdrawCollateralProps): Promise<_solana_web3_js.TransactionInstruction>;
1812
- /**
1813
- * Build claim compensation instruction
1814
- */
1815
- buildBondClaimInstruction(props: ClaimProps): Promise<_solana_web3_js.TransactionInstruction>;
1816
- /**
1817
- * Build configure instruction
1818
- */
1819
- buildConfigureInstruction(props: BondConfigureProps): Promise<_solana_web3_js.TransactionInstruction>;
1820
- /**
1821
- * Build set withdraw authority instruction
1822
- */
1823
- buildSetWithdrawAuthorityInstruction(props: SetWithdrawAuthorityProps): Promise<_solana_web3_js.TransactionInstruction>;
1824
- buildBondStartInstruction(props: {
1802
+ buildBondInitializeIx(props: BondInitializeProps): Promise<TransactionInstruction>;
1803
+ buildConfigureIx(props: BondConfigureProps): Promise<TransactionInstruction>;
1804
+ buildRegisterIx(props: RegisterValidatorProps): Promise<TransactionInstruction>;
1805
+ buildTopUpIXs(props: TopUpCollateralProps): Promise<TransactionInstruction[]>;
1806
+ buildWithdrawIx(props: WithdrawCollateralProps): Promise<TransactionInstruction>;
1807
+ buildClaimIx(props: ClaimProps): Promise<TransactionInstruction>;
1808
+ buildSetWithdrawAuthorityIx(props: SetWithdrawAuthorityProps): Promise<TransactionInstruction>;
1809
+ buildBondFinishIx(_props: {
1825
1810
  bondType: BondType;
1826
1811
  name: string;
1827
- duration_secs: number;
1828
- }): Promise<_solana_web3_js.TransactionInstruction>;
1829
- buildBondFinishInstruction(props: {
1812
+ }): Promise<TransactionInstruction>;
1813
+ buildBondStartIx(props: {
1830
1814
  bondType: BondType;
1831
1815
  name: string;
1832
- }): Promise<_solana_web3_js.TransactionInstruction>;
1816
+ duration_secs: number;
1817
+ }): Promise<TransactionInstruction>;
1833
1818
  /**
1834
1819
  * Fetch global state or throw if not found
1835
1820
  */
1836
1821
  getGlobalState(): Promise<GlobalState>;
1837
1822
  getBondState(bondType: BondType, bondName: string): Promise<BondState>;
1838
- getAllBondStates(_bondType: BondType): Promise<BondState[]>;
1839
- getBondStateSessionStatus(bondType: BondType, bondName: string): Promise<SessionStatus>;
1823
+ /**
1824
+ * Get all bond states with total collected collateral
1825
+ */
1826
+ getAllBondStates(_bondType: BondType): Promise<Array<[BondState, number]>>;
1827
+ private getValidatorBondsByState;
1840
1828
  /**
1841
1829
  * Fetch validator bond data or null if not found
1842
1830
  * @param bondType
@@ -1873,6 +1861,7 @@ declare class JBondClient {
1873
1861
  * Throws an error if no user is available.
1874
1862
  */
1875
1863
  private ensureUser;
1864
+ private lamports;
1876
1865
  }
1877
1866
 
1878
- export { BondClientEnv, type BondCollateral, type BondConfigureProps, type BondInitializeProps, type BondState, 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 };
1867
+ 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 };