@jpool/bond-sdk 0.11.0-next.21 → 0.11.0-next.22
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 +48 -2
- package/dist/index.d.ts +48 -2
- package/dist/index.js +52 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +52 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4579,6 +4579,7 @@ var STANDARD_BOND_SEED = "standard";
|
|
|
4579
4579
|
var CROWDFUNDING_BOND_SEED = "crowdfunding";
|
|
4580
4580
|
var ENV_PROGRAM_ID = {
|
|
4581
4581
|
["dev" /* DEV */]: new PublicKey("Fo17edWRJewZNTRibgx9iTfjywCW6dzS81VwBLmPFVq1"),
|
|
4582
|
+
["stage" /* STAGE */]: new PublicKey("BondQ7KqZreTcW2UbeTNDcLCJQ3aXAtLn2Fm6ftaJDU"),
|
|
4582
4583
|
["prod" /* PROD */]: new PublicKey("BondQ7KqZreTcW2UbeTNDcLCJQ3aXAtLn2Fm6ftaJDU")
|
|
4583
4584
|
};
|
|
4584
4585
|
var { bs58 } = utils.bytes;
|
|
@@ -4743,7 +4744,7 @@ var jbond_default = {
|
|
|
4743
4744
|
address: "Fo17edWRJewZNTRibgx9iTfjywCW6dzS81VwBLmPFVq1",
|
|
4744
4745
|
metadata: {
|
|
4745
4746
|
name: "jbond",
|
|
4746
|
-
version: "0.2.
|
|
4747
|
+
version: "0.2.2",
|
|
4747
4748
|
spec: "0.1.0",
|
|
4748
4749
|
description: "Jpool Bond Program"
|
|
4749
4750
|
},
|
|
@@ -5712,6 +5713,38 @@ var jbond_default = {
|
|
|
5712
5713
|
],
|
|
5713
5714
|
args: []
|
|
5714
5715
|
},
|
|
5716
|
+
{
|
|
5717
|
+
name: "migrate_validator_bond",
|
|
5718
|
+
docs: [
|
|
5719
|
+
"migrate validator bond from legacy format to new format"
|
|
5720
|
+
],
|
|
5721
|
+
discriminator: [
|
|
5722
|
+
214,
|
|
5723
|
+
114,
|
|
5724
|
+
65,
|
|
5725
|
+
138,
|
|
5726
|
+
248,
|
|
5727
|
+
45,
|
|
5728
|
+
186,
|
|
5729
|
+
229
|
|
5730
|
+
],
|
|
5731
|
+
accounts: [
|
|
5732
|
+
{
|
|
5733
|
+
name: "validator_bond",
|
|
5734
|
+
writable: true
|
|
5735
|
+
},
|
|
5736
|
+
{
|
|
5737
|
+
name: "authority",
|
|
5738
|
+
writable: true,
|
|
5739
|
+
signer: true
|
|
5740
|
+
},
|
|
5741
|
+
{
|
|
5742
|
+
name: "system_program",
|
|
5743
|
+
address: "11111111111111111111111111111111"
|
|
5744
|
+
}
|
|
5745
|
+
],
|
|
5746
|
+
args: []
|
|
5747
|
+
},
|
|
5715
5748
|
{
|
|
5716
5749
|
name: "session_finish",
|
|
5717
5750
|
docs: [
|
|
@@ -6717,7 +6750,7 @@ var JBondClient = class _JBondClient {
|
|
|
6717
6750
|
if (this.options.programId) {
|
|
6718
6751
|
return this.options.programId;
|
|
6719
6752
|
}
|
|
6720
|
-
return ENV_PROGRAM_ID["prod" /* PROD */];
|
|
6753
|
+
return new PublicKey(ENV_PROGRAM_ID["prod" /* PROD */]);
|
|
6721
6754
|
}
|
|
6722
6755
|
/**
|
|
6723
6756
|
* Get the current connection.
|
|
@@ -6735,7 +6768,7 @@ var JBondClient = class _JBondClient {
|
|
|
6735
6768
|
}
|
|
6736
6769
|
this._program = null;
|
|
6737
6770
|
this.debug(`Set environment to ${env} with program ID: ${envProgramId.toString()}`);
|
|
6738
|
-
return this.configure("programId", envProgramId);
|
|
6771
|
+
return this.configure("programId", new PublicKey(envProgramId));
|
|
6739
6772
|
}
|
|
6740
6773
|
/**
|
|
6741
6774
|
* Configure a specific option.
|
|
@@ -7205,6 +7238,21 @@ var JBondClient = class _JBondClient {
|
|
|
7205
7238
|
});
|
|
7206
7239
|
return this.program.methods.bondLockFunds(solToLamports(amount)).accountsPartial(accounts).instruction();
|
|
7207
7240
|
}
|
|
7241
|
+
async migrateValidatorBond(props) {
|
|
7242
|
+
const ix = await this.getMigrateValidatorBondIx(props);
|
|
7243
|
+
return this.provider.sendAndConfirm?.(new Transaction().add(ix));
|
|
7244
|
+
}
|
|
7245
|
+
async getMigrateValidatorBondIx(props) {
|
|
7246
|
+
const { bondType, name, voteAccount } = props;
|
|
7247
|
+
const [bondState] = this.pda.bondState(bondType, name);
|
|
7248
|
+
const [validatorBond] = this.pda.validatorBond(bondType, name, voteAccount);
|
|
7249
|
+
const accounts = {
|
|
7250
|
+
bondState,
|
|
7251
|
+
validatorBond,
|
|
7252
|
+
systemProgram: PublicKey.default
|
|
7253
|
+
};
|
|
7254
|
+
return this.program.methods.migrateValidatorBond().accountsPartial(accounts).instruction();
|
|
7255
|
+
}
|
|
7208
7256
|
/**
|
|
7209
7257
|
* Build release funds instruction
|
|
7210
7258
|
*/
|
|
@@ -7291,7 +7339,7 @@ var JBondClient = class _JBondClient {
|
|
|
7291
7339
|
const tokenAccount = getAssociatedTokenAddressSync(mint, address, true);
|
|
7292
7340
|
try {
|
|
7293
7341
|
const balance = await this.connection.getTokenAccountBalance(tokenAccount);
|
|
7294
|
-
return
|
|
7342
|
+
return Number(balance.value.amount);
|
|
7295
7343
|
} catch {
|
|
7296
7344
|
return 0;
|
|
7297
7345
|
}
|