@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.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { utils,
|
|
1
|
+
import { utils, AnchorProvider, Program, BN } from '@coral-xyz/anchor';
|
|
2
2
|
import { getAssociatedTokenAddressSync, ACCOUNT_SIZE, AccountLayout } from '@solana/spl-token';
|
|
3
3
|
import { PublicKey, Transaction, LAMPORTS_PER_SOL } from '@solana/web3.js';
|
|
4
4
|
|
|
@@ -4546,17 +4546,14 @@ var require_bn = __commonJS({
|
|
|
4546
4546
|
|
|
4547
4547
|
// src/client.ts
|
|
4548
4548
|
var import_bn = __toESM(require_bn());
|
|
4549
|
-
var GLOBAL_STATE_SEED = "global_state";
|
|
4550
|
-
var BOND_STATE_SEED = "bond_state";
|
|
4551
|
-
var VALIDATOR_BOND_SEED = "validator_bond";
|
|
4552
|
-
var STANDARD_BOND_SEED = "standard";
|
|
4553
|
-
var CROWDFUNDING_BOND_SEED = "crowdfunding";
|
|
4554
|
-
var ENV_PROGRAM_ID = {
|
|
4555
|
-
["dev" /* DEV */]: new PublicKey("Fo17edWRJewZNTRibgx9iTfjywCW6dzS81VwBLmPFVq1"),
|
|
4556
|
-
["prod" /* PROD */]: new PublicKey("BondQ7KqZreTcW2UbeTNDcLCJQ3aXAtLn2Fm6ftaJDU")
|
|
4557
|
-
};
|
|
4558
4549
|
|
|
4559
4550
|
// src/types/index.ts
|
|
4551
|
+
var JBondClientEnv = /* @__PURE__ */ ((JBondClientEnv2) => {
|
|
4552
|
+
JBondClientEnv2["DEV"] = "dev";
|
|
4553
|
+
JBondClientEnv2["STAGE"] = "stage";
|
|
4554
|
+
JBondClientEnv2["PROD"] = "prod";
|
|
4555
|
+
return JBondClientEnv2;
|
|
4556
|
+
})(JBondClientEnv || {});
|
|
4560
4557
|
var SessionStatus = /* @__PURE__ */ ((SessionStatus2) => {
|
|
4561
4558
|
SessionStatus2[SessionStatus2["Live"] = 0] = "Live";
|
|
4562
4559
|
SessionStatus2[SessionStatus2["Finished"] = 1] = "Finished";
|
|
@@ -4574,7 +4571,16 @@ var BondTransactionType = /* @__PURE__ */ ((BondTransactionType2) => {
|
|
|
4574
4571
|
return BondTransactionType2;
|
|
4575
4572
|
})(BondTransactionType || {});
|
|
4576
4573
|
|
|
4577
|
-
// src/
|
|
4574
|
+
// src/constants.ts
|
|
4575
|
+
var GLOBAL_STATE_SEED = "global_state";
|
|
4576
|
+
var BOND_STATE_SEED = "bond_state";
|
|
4577
|
+
var VALIDATOR_BOND_SEED = "validator_bond";
|
|
4578
|
+
var STANDARD_BOND_SEED = "standard";
|
|
4579
|
+
var CROWDFUNDING_BOND_SEED = "crowdfunding";
|
|
4580
|
+
var ENV_PROGRAM_ID = {
|
|
4581
|
+
["dev" /* DEV */]: new PublicKey("Fo17edWRJewZNTRibgx9iTfjywCW6dzS81VwBLmPFVq1"),
|
|
4582
|
+
["prod" /* PROD */]: new PublicKey("BondQ7KqZreTcW2UbeTNDcLCJQ3aXAtLn2Fm6ftaJDU")
|
|
4583
|
+
};
|
|
4578
4584
|
var { bs58 } = utils.bytes;
|
|
4579
4585
|
var HistoryManager = class {
|
|
4580
4586
|
constructor(client) {
|
|
@@ -6654,20 +6660,13 @@ function getBondTypeSeed(type) {
|
|
|
6654
6660
|
}
|
|
6655
6661
|
|
|
6656
6662
|
// src/client.ts
|
|
6657
|
-
var JBondClientEnv = /* @__PURE__ */ ((JBondClientEnv2) => {
|
|
6658
|
-
JBondClientEnv2["DEV"] = "dev";
|
|
6659
|
-
JBondClientEnv2["STAGE"] = "stage";
|
|
6660
|
-
JBondClientEnv2["PROD"] = "prod";
|
|
6661
|
-
return JBondClientEnv2;
|
|
6662
|
-
})(JBondClientEnv || {});
|
|
6663
6663
|
var JBondClient = class _JBondClient {
|
|
6664
6664
|
constructor(provider, options) {
|
|
6665
6665
|
this.provider = provider;
|
|
6666
6666
|
this.options = options ?? {};
|
|
6667
|
-
this.program = new Program(jbond_default, this.provider);
|
|
6668
6667
|
}
|
|
6669
6668
|
options;
|
|
6670
|
-
|
|
6669
|
+
_program = null;
|
|
6671
6670
|
get history() {
|
|
6672
6671
|
return new HistoryManager(this);
|
|
6673
6672
|
}
|
|
@@ -6696,11 +6695,24 @@ var JBondClient = class _JBondClient {
|
|
|
6696
6695
|
static fromKeypair(connection, keypair, options) {
|
|
6697
6696
|
return _JBondClient.fromWallet(connection, new NodeWallet(keypair), options);
|
|
6698
6697
|
}
|
|
6698
|
+
/**
|
|
6699
|
+
* Get or create the program instance
|
|
6700
|
+
*/
|
|
6701
|
+
get program() {
|
|
6702
|
+
if (!this._program) {
|
|
6703
|
+
jbond_default.address = this.programId.toBase58();
|
|
6704
|
+
this._program = new Program(jbond_default, this.provider);
|
|
6705
|
+
}
|
|
6706
|
+
return this._program;
|
|
6707
|
+
}
|
|
6699
6708
|
/**
|
|
6700
6709
|
* Get the current program ID.
|
|
6701
6710
|
*/
|
|
6702
6711
|
get programId() {
|
|
6703
|
-
|
|
6712
|
+
if (this.options.programId) {
|
|
6713
|
+
return this.options.programId;
|
|
6714
|
+
}
|
|
6715
|
+
return ENV_PROGRAM_ID["prod" /* PROD */];
|
|
6704
6716
|
}
|
|
6705
6717
|
/**
|
|
6706
6718
|
* Get the current connection.
|
|
@@ -6716,6 +6728,8 @@ var JBondClient = class _JBondClient {
|
|
|
6716
6728
|
if (!envProgramId) {
|
|
6717
6729
|
throw new Error(`Invalid environment: ${env}`);
|
|
6718
6730
|
}
|
|
6731
|
+
this._program = null;
|
|
6732
|
+
this.debug(`Set environment to ${env} with program ID: ${envProgramId.toString()}`);
|
|
6719
6733
|
return this.configure("programId", envProgramId);
|
|
6720
6734
|
}
|
|
6721
6735
|
/**
|