@jpool/bond-sdk 0.11.0-next.19 → 0.11.0-next.20
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 +15 -11
- package/dist/index.d.ts +15 -11
- package/dist/index.js +35 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -20
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1821,6 +1821,14 @@ type Jbond = {
|
|
|
1821
1821
|
];
|
|
1822
1822
|
};
|
|
1823
1823
|
|
|
1824
|
+
/**
|
|
1825
|
+
* Enum for different client environments.
|
|
1826
|
+
*/
|
|
1827
|
+
declare enum JBondClientEnv {
|
|
1828
|
+
DEV = "dev",
|
|
1829
|
+
STAGE = "stage",
|
|
1830
|
+
PROD = "prod"
|
|
1831
|
+
}
|
|
1824
1832
|
type GlobalState = IdlAccounts<Jbond>['globalState'];
|
|
1825
1833
|
type BondState = IdlAccounts<Jbond>['bondState'];
|
|
1826
1834
|
type ValidatorBond = IdlAccounts<Jbond>['validatorBond'];
|
|
@@ -1981,7 +1989,7 @@ declare class HistoryManager {
|
|
|
1981
1989
|
private discCache;
|
|
1982
1990
|
constructor(client: JBondClient);
|
|
1983
1991
|
get program(): _coral_xyz_anchor.Program<Jbond>;
|
|
1984
|
-
get programId():
|
|
1992
|
+
get programId(): PublicKey;
|
|
1985
1993
|
get connection(): _solana_web3_js.Connection;
|
|
1986
1994
|
debug(...args: any[]): void;
|
|
1987
1995
|
getHistory(bondType: BondType, bondName: string, vote: PublicKeyInitData, opts?: GetHistoryOpts): Promise<TransactionHistoryItem[]>;
|
|
@@ -2005,14 +2013,6 @@ declare class NodeWallet implements Wallet {
|
|
|
2005
2013
|
get publicKey(): PublicKey;
|
|
2006
2014
|
}
|
|
2007
2015
|
|
|
2008
|
-
/**
|
|
2009
|
-
* Enum for different client environments.
|
|
2010
|
-
*/
|
|
2011
|
-
declare enum JBondClientEnv {
|
|
2012
|
-
DEV = "dev",
|
|
2013
|
-
STAGE = "stage",
|
|
2014
|
-
PROD = "prod"
|
|
2015
|
-
}
|
|
2016
2016
|
/**
|
|
2017
2017
|
* Options for configuring the JBondClient.
|
|
2018
2018
|
*/
|
|
@@ -2022,7 +2022,7 @@ type JBondClientOptions = {
|
|
|
2022
2022
|
declare class JBondClient {
|
|
2023
2023
|
readonly provider: Provider;
|
|
2024
2024
|
readonly options: JBondClientOptions;
|
|
2025
|
-
|
|
2025
|
+
private _program;
|
|
2026
2026
|
constructor(provider: Provider, options?: JBondClientOptions);
|
|
2027
2027
|
get history(): HistoryManager;
|
|
2028
2028
|
/**
|
|
@@ -2037,10 +2037,14 @@ declare class JBondClient {
|
|
|
2037
2037
|
* Creates an instance of `JBondClient` using the provided connection and keypair.
|
|
2038
2038
|
*/
|
|
2039
2039
|
static fromKeypair(connection: Connection, keypair: Keypair, options?: JBondClientOptions): JBondClient;
|
|
2040
|
+
/**
|
|
2041
|
+
* Get or create the program instance
|
|
2042
|
+
*/
|
|
2043
|
+
get program(): Program<Jbond>;
|
|
2040
2044
|
/**
|
|
2041
2045
|
* Get the current program ID.
|
|
2042
2046
|
*/
|
|
2043
|
-
get programId():
|
|
2047
|
+
get programId(): PublicKey;
|
|
2044
2048
|
/**
|
|
2045
2049
|
* Get the current connection.
|
|
2046
2050
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1821,6 +1821,14 @@ type Jbond = {
|
|
|
1821
1821
|
];
|
|
1822
1822
|
};
|
|
1823
1823
|
|
|
1824
|
+
/**
|
|
1825
|
+
* Enum for different client environments.
|
|
1826
|
+
*/
|
|
1827
|
+
declare enum JBondClientEnv {
|
|
1828
|
+
DEV = "dev",
|
|
1829
|
+
STAGE = "stage",
|
|
1830
|
+
PROD = "prod"
|
|
1831
|
+
}
|
|
1824
1832
|
type GlobalState = IdlAccounts<Jbond>['globalState'];
|
|
1825
1833
|
type BondState = IdlAccounts<Jbond>['bondState'];
|
|
1826
1834
|
type ValidatorBond = IdlAccounts<Jbond>['validatorBond'];
|
|
@@ -1981,7 +1989,7 @@ declare class HistoryManager {
|
|
|
1981
1989
|
private discCache;
|
|
1982
1990
|
constructor(client: JBondClient);
|
|
1983
1991
|
get program(): _coral_xyz_anchor.Program<Jbond>;
|
|
1984
|
-
get programId():
|
|
1992
|
+
get programId(): PublicKey;
|
|
1985
1993
|
get connection(): _solana_web3_js.Connection;
|
|
1986
1994
|
debug(...args: any[]): void;
|
|
1987
1995
|
getHistory(bondType: BondType, bondName: string, vote: PublicKeyInitData, opts?: GetHistoryOpts): Promise<TransactionHistoryItem[]>;
|
|
@@ -2005,14 +2013,6 @@ declare class NodeWallet implements Wallet {
|
|
|
2005
2013
|
get publicKey(): PublicKey;
|
|
2006
2014
|
}
|
|
2007
2015
|
|
|
2008
|
-
/**
|
|
2009
|
-
* Enum for different client environments.
|
|
2010
|
-
*/
|
|
2011
|
-
declare enum JBondClientEnv {
|
|
2012
|
-
DEV = "dev",
|
|
2013
|
-
STAGE = "stage",
|
|
2014
|
-
PROD = "prod"
|
|
2015
|
-
}
|
|
2016
2016
|
/**
|
|
2017
2017
|
* Options for configuring the JBondClient.
|
|
2018
2018
|
*/
|
|
@@ -2022,7 +2022,7 @@ type JBondClientOptions = {
|
|
|
2022
2022
|
declare class JBondClient {
|
|
2023
2023
|
readonly provider: Provider;
|
|
2024
2024
|
readonly options: JBondClientOptions;
|
|
2025
|
-
|
|
2025
|
+
private _program;
|
|
2026
2026
|
constructor(provider: Provider, options?: JBondClientOptions);
|
|
2027
2027
|
get history(): HistoryManager;
|
|
2028
2028
|
/**
|
|
@@ -2037,10 +2037,14 @@ declare class JBondClient {
|
|
|
2037
2037
|
* Creates an instance of `JBondClient` using the provided connection and keypair.
|
|
2038
2038
|
*/
|
|
2039
2039
|
static fromKeypair(connection: Connection, keypair: Keypair, options?: JBondClientOptions): JBondClient;
|
|
2040
|
+
/**
|
|
2041
|
+
* Get or create the program instance
|
|
2042
|
+
*/
|
|
2043
|
+
get program(): Program<Jbond>;
|
|
2040
2044
|
/**
|
|
2041
2045
|
* Get the current program ID.
|
|
2042
2046
|
*/
|
|
2043
|
-
get programId():
|
|
2047
|
+
get programId(): PublicKey;
|
|
2044
2048
|
/**
|
|
2045
2049
|
* Get the current connection.
|
|
2046
2050
|
*/
|
package/dist/index.js
CHANGED
|
@@ -4568,21 +4568,15 @@ var import_bn = __toESM(require_bn());
|
|
|
4568
4568
|
|
|
4569
4569
|
// src/constants.ts
|
|
4570
4570
|
init_cjs_shims();
|
|
4571
|
-
var GLOBAL_STATE_SEED = "global_state";
|
|
4572
|
-
var BOND_STATE_SEED = "bond_state";
|
|
4573
|
-
var VALIDATOR_BOND_SEED = "validator_bond";
|
|
4574
|
-
var STANDARD_BOND_SEED = "standard";
|
|
4575
|
-
var CROWDFUNDING_BOND_SEED = "crowdfunding";
|
|
4576
|
-
var ENV_PROGRAM_ID = {
|
|
4577
|
-
["dev" /* DEV */]: new web3_js.PublicKey("Fo17edWRJewZNTRibgx9iTfjywCW6dzS81VwBLmPFVq1"),
|
|
4578
|
-
["prod" /* PROD */]: new web3_js.PublicKey("BondQ7KqZreTcW2UbeTNDcLCJQ3aXAtLn2Fm6ftaJDU")
|
|
4579
|
-
};
|
|
4580
|
-
|
|
4581
|
-
// src/history.ts
|
|
4582
|
-
init_cjs_shims();
|
|
4583
4571
|
|
|
4584
4572
|
// src/types/index.ts
|
|
4585
4573
|
init_cjs_shims();
|
|
4574
|
+
var JBondClientEnv = /* @__PURE__ */ ((JBondClientEnv2) => {
|
|
4575
|
+
JBondClientEnv2["DEV"] = "dev";
|
|
4576
|
+
JBondClientEnv2["STAGE"] = "stage";
|
|
4577
|
+
JBondClientEnv2["PROD"] = "prod";
|
|
4578
|
+
return JBondClientEnv2;
|
|
4579
|
+
})(JBondClientEnv || {});
|
|
4586
4580
|
var SessionStatus = /* @__PURE__ */ ((SessionStatus2) => {
|
|
4587
4581
|
SessionStatus2[SessionStatus2["Live"] = 0] = "Live";
|
|
4588
4582
|
SessionStatus2[SessionStatus2["Finished"] = 1] = "Finished";
|
|
@@ -4600,7 +4594,19 @@ var BondTransactionType = /* @__PURE__ */ ((BondTransactionType2) => {
|
|
|
4600
4594
|
return BondTransactionType2;
|
|
4601
4595
|
})(BondTransactionType || {});
|
|
4602
4596
|
|
|
4597
|
+
// src/constants.ts
|
|
4598
|
+
var GLOBAL_STATE_SEED = "global_state";
|
|
4599
|
+
var BOND_STATE_SEED = "bond_state";
|
|
4600
|
+
var VALIDATOR_BOND_SEED = "validator_bond";
|
|
4601
|
+
var STANDARD_BOND_SEED = "standard";
|
|
4602
|
+
var CROWDFUNDING_BOND_SEED = "crowdfunding";
|
|
4603
|
+
var ENV_PROGRAM_ID = {
|
|
4604
|
+
["dev" /* DEV */]: new web3_js.PublicKey("Fo17edWRJewZNTRibgx9iTfjywCW6dzS81VwBLmPFVq1"),
|
|
4605
|
+
["prod" /* PROD */]: new web3_js.PublicKey("BondQ7KqZreTcW2UbeTNDcLCJQ3aXAtLn2Fm6ftaJDU")
|
|
4606
|
+
};
|
|
4607
|
+
|
|
4603
4608
|
// src/history.ts
|
|
4609
|
+
init_cjs_shims();
|
|
4604
4610
|
var { bs58 } = anchor.utils.bytes;
|
|
4605
4611
|
var HistoryManager = class {
|
|
4606
4612
|
constructor(client) {
|
|
@@ -6688,20 +6694,13 @@ function getBondTypeSeed(type) {
|
|
|
6688
6694
|
}
|
|
6689
6695
|
|
|
6690
6696
|
// src/client.ts
|
|
6691
|
-
var JBondClientEnv = /* @__PURE__ */ ((JBondClientEnv2) => {
|
|
6692
|
-
JBondClientEnv2["DEV"] = "dev";
|
|
6693
|
-
JBondClientEnv2["STAGE"] = "stage";
|
|
6694
|
-
JBondClientEnv2["PROD"] = "prod";
|
|
6695
|
-
return JBondClientEnv2;
|
|
6696
|
-
})(JBondClientEnv || {});
|
|
6697
6697
|
var JBondClient = class _JBondClient {
|
|
6698
6698
|
constructor(provider, options) {
|
|
6699
6699
|
this.provider = provider;
|
|
6700
6700
|
this.options = options ?? {};
|
|
6701
|
-
this.program = new anchor.Program(jbond_default, this.provider);
|
|
6702
6701
|
}
|
|
6703
6702
|
options;
|
|
6704
|
-
|
|
6703
|
+
_program = null;
|
|
6705
6704
|
get history() {
|
|
6706
6705
|
return new HistoryManager(this);
|
|
6707
6706
|
}
|
|
@@ -6730,11 +6729,24 @@ var JBondClient = class _JBondClient {
|
|
|
6730
6729
|
static fromKeypair(connection, keypair, options) {
|
|
6731
6730
|
return _JBondClient.fromWallet(connection, new NodeWallet(keypair), options);
|
|
6732
6731
|
}
|
|
6732
|
+
/**
|
|
6733
|
+
* Get or create the program instance
|
|
6734
|
+
*/
|
|
6735
|
+
get program() {
|
|
6736
|
+
if (!this._program) {
|
|
6737
|
+
jbond_default.address = this.programId.toBase58();
|
|
6738
|
+
this._program = new anchor.Program(jbond_default, this.provider);
|
|
6739
|
+
}
|
|
6740
|
+
return this._program;
|
|
6741
|
+
}
|
|
6733
6742
|
/**
|
|
6734
6743
|
* Get the current program ID.
|
|
6735
6744
|
*/
|
|
6736
6745
|
get programId() {
|
|
6737
|
-
|
|
6746
|
+
if (this.options.programId) {
|
|
6747
|
+
return this.options.programId;
|
|
6748
|
+
}
|
|
6749
|
+
return ENV_PROGRAM_ID["prod" /* PROD */];
|
|
6738
6750
|
}
|
|
6739
6751
|
/**
|
|
6740
6752
|
* Get the current connection.
|
|
@@ -6750,6 +6762,8 @@ var JBondClient = class _JBondClient {
|
|
|
6750
6762
|
if (!envProgramId) {
|
|
6751
6763
|
throw new Error(`Invalid environment: ${env}`);
|
|
6752
6764
|
}
|
|
6765
|
+
this._program = null;
|
|
6766
|
+
this.debug(`Set environment to ${env} with program ID: ${envProgramId.toString()}`);
|
|
6753
6767
|
return this.configure("programId", envProgramId);
|
|
6754
6768
|
}
|
|
6755
6769
|
/**
|