@streamflow/staking 7.4.16 → 7.4.17
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.
|
@@ -16,6 +16,7 @@ const stake_pool_json_1 = __importDefault(require("./descriptor/idl/stake_pool.j
|
|
|
16
16
|
const derive_accounts_js_1 = require("./lib/derive-accounts.js");
|
|
17
17
|
class SolanaStakingClient {
|
|
18
18
|
constructor({ clusterUrl, cluster = common_1.ICluster.Mainnet, commitment = "confirmed", programIds, sendRate = 1, sendThrottler, }) {
|
|
19
|
+
this.cluster = cluster;
|
|
19
20
|
this.commitment = commitment;
|
|
20
21
|
this.connection = new web3_js_1.Connection(clusterUrl, this.commitment);
|
|
21
22
|
this.sendThrottler = sendThrottler ?? (0, solana_1.buildSendThrottler)(sendRate);
|
|
@@ -142,6 +143,20 @@ class SolanaStakingClient {
|
|
|
142
143
|
payer: staker,
|
|
143
144
|
})
|
|
144
145
|
.instruction();
|
|
146
|
+
if (this.cluster == common_1.ICluster.Mainnet) {
|
|
147
|
+
// TODO: remove when staking on mainnet is upgraded
|
|
148
|
+
instruction.keys.pop();
|
|
149
|
+
instruction.keys.push({
|
|
150
|
+
pubkey: web3_js_1.SYSVAR_RENT_PUBKEY,
|
|
151
|
+
isSigner: false,
|
|
152
|
+
isWritable: false,
|
|
153
|
+
});
|
|
154
|
+
instruction.keys.push({
|
|
155
|
+
pubkey: web3_js_1.SystemProgram.programId,
|
|
156
|
+
isSigner: false,
|
|
157
|
+
isWritable: false,
|
|
158
|
+
});
|
|
159
|
+
}
|
|
145
160
|
return { ixs: [instruction] };
|
|
146
161
|
}
|
|
147
162
|
async unstake(data, extParams) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Program, parseIdlErrors, translateError, } from "@coral-xyz/anchor";
|
|
2
2
|
import { TOKEN_PROGRAM_ID, getAssociatedTokenAddressSync } from "@solana/spl-token";
|
|
3
|
-
import { Connection, PublicKey } from "@solana/web3.js";
|
|
3
|
+
import { Connection, PublicKey, SystemProgram, SYSVAR_RENT_PUBKEY, } from "@solana/web3.js";
|
|
4
4
|
import { ContractError, ICluster, invariant } from "@streamflow/common";
|
|
5
5
|
import { buildSendThrottler, checkOrCreateAtaBatch, getFilters, pk, prepareBaseInstructions, prepareTransaction, signAndExecuteTransaction, } from "@streamflow/common/solana";
|
|
6
6
|
import { REWARD_ENTRY_BYTE_OFFSETS, REWARD_POOL_BYTE_OFFSETS, REWARD_POOL_PROGRAM_ID, STAKE_ENTRY_BYTE_OFFSETS, STAKE_POOL_BYTE_OFFSETS, STAKE_POOL_PROGRAM_ID, STREAMFLOW_TREASURY_PUBLIC_KEY, } from "./constants.js";
|
|
@@ -10,10 +10,12 @@ import StakePoolIDL from "./descriptor/idl/stake_pool.json";
|
|
|
10
10
|
import { deriveConfigPDA, deriveFeeValuePDA, deriveRewardPoolPDA, deriveRewardVaultPDA, deriveStakeEntryPDA, deriveStakeMintPDA, deriveStakePoolPDA, } from "./lib/derive-accounts.js";
|
|
11
11
|
export class SolanaStakingClient {
|
|
12
12
|
connection;
|
|
13
|
+
cluster;
|
|
13
14
|
commitment;
|
|
14
15
|
sendThrottler;
|
|
15
16
|
programs;
|
|
16
17
|
constructor({ clusterUrl, cluster = ICluster.Mainnet, commitment = "confirmed", programIds, sendRate = 1, sendThrottler, }) {
|
|
18
|
+
this.cluster = cluster;
|
|
17
19
|
this.commitment = commitment;
|
|
18
20
|
this.connection = new Connection(clusterUrl, this.commitment);
|
|
19
21
|
this.sendThrottler = sendThrottler ?? buildSendThrottler(sendRate);
|
|
@@ -140,6 +142,20 @@ export class SolanaStakingClient {
|
|
|
140
142
|
payer: staker,
|
|
141
143
|
})
|
|
142
144
|
.instruction();
|
|
145
|
+
if (this.cluster == ICluster.Mainnet) {
|
|
146
|
+
// TODO: remove when staking on mainnet is upgraded
|
|
147
|
+
instruction.keys.pop();
|
|
148
|
+
instruction.keys.push({
|
|
149
|
+
pubkey: SYSVAR_RENT_PUBKEY,
|
|
150
|
+
isSigner: false,
|
|
151
|
+
isWritable: false,
|
|
152
|
+
});
|
|
153
|
+
instruction.keys.push({
|
|
154
|
+
pubkey: SystemProgram.programId,
|
|
155
|
+
isSigner: false,
|
|
156
|
+
isWritable: false,
|
|
157
|
+
});
|
|
158
|
+
}
|
|
143
159
|
return { ixs: [instruction] };
|
|
144
160
|
}
|
|
145
161
|
async unstake(data, extParams) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamflow/staking",
|
|
3
|
-
"version": "7.4.
|
|
3
|
+
"version": "7.4.17",
|
|
4
4
|
"description": "JavaScript SDK to interact with Streamflow Staking protocol.",
|
|
5
5
|
"homepage": "https://github.com/streamflow-finance/js-sdk/",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"test": "vitest",
|
|
28
28
|
"prepublishOnly": "pnpm run lint && pnpm run test run && pnpm run build"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "087be41783b46f904ac73f084c4fb92ab42d32e9",
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@streamflow/eslint-config": "7.4.
|
|
32
|
+
"@streamflow/eslint-config": "7.4.17",
|
|
33
33
|
"@types/bn.js": "5.1.1",
|
|
34
34
|
"typescript": "^5.6.3"
|
|
35
35
|
},
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@solana/spl-token": "0.4.9",
|
|
41
41
|
"@solana/wallet-adapter-base": "0.9.19",
|
|
42
42
|
"@solana/web3.js": "1.95.4",
|
|
43
|
-
"@streamflow/common": "7.4.
|
|
43
|
+
"@streamflow/common": "7.4.17",
|
|
44
44
|
"bn.js": "5.2.1",
|
|
45
45
|
"borsh": "^2.0.0",
|
|
46
46
|
"bs58": "5.0.0",
|