@streamflow/staking 7.4.17 → 7.5.0
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/README.md +7 -1
- package/dist/cjs/solana/client.js +2 -16
- package/dist/esm/solana/client.d.ts +1 -1
- package/dist/esm/solana/client.js +3 -17
- package/dist/esm/solana/types.d.ts +2 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -152,12 +152,18 @@ const rewardMint = REWARD_MINT_ADDRESS; // rewarding token
|
|
|
152
152
|
*/
|
|
153
153
|
const permissionless = true;
|
|
154
154
|
|
|
155
|
+
/*
|
|
156
|
+
Whether to create stake mint token accounts in frozen state by default - in this case stakers won't be able to send or burn these tokens
|
|
157
|
+
*/
|
|
158
|
+
const freezeStakeMint = true;
|
|
159
|
+
|
|
155
160
|
client.createRewardPool({
|
|
156
161
|
nonce,
|
|
157
162
|
rewardAmount,
|
|
158
163
|
rewardPeriod,
|
|
159
164
|
rewardMint,
|
|
160
|
-
permissionless
|
|
165
|
+
permissionless,
|
|
166
|
+
freezeStakeMint,
|
|
161
167
|
stakePool: stakePoolPda,
|
|
162
168
|
stakePoolMint: MINT_ADDRESS,
|
|
163
169
|
})
|
|
@@ -102,12 +102,12 @@ class SolanaStakingClient {
|
|
|
102
102
|
metadataId: publicKey,
|
|
103
103
|
};
|
|
104
104
|
}
|
|
105
|
-
async prepareCreateStakePoolInstructions({ maxWeight, maxDuration, minDuration, mint, permissionless = false, nonce, tokenProgramId = spl_token_1.TOKEN_PROGRAM_ID, }, extParams) {
|
|
105
|
+
async prepareCreateStakePoolInstructions({ maxWeight, maxDuration, minDuration, mint, permissionless = false, freezeStakeMint = null, unstakePeriod = null, nonce, tokenProgramId = spl_token_1.TOKEN_PROGRAM_ID, }, extParams) {
|
|
106
106
|
const { stakePoolProgram } = this.programs;
|
|
107
107
|
const creator = extParams.invoker.publicKey;
|
|
108
108
|
(0, common_1.invariant)(creator, "Undefined invoker publicKey");
|
|
109
109
|
const createInstruction = await stakePoolProgram.methods
|
|
110
|
-
.createPool(nonce, maxWeight, minDuration, maxDuration, permissionless,
|
|
110
|
+
.createPool(nonce, maxWeight, minDuration, maxDuration, permissionless, freezeStakeMint, unstakePeriod)
|
|
111
111
|
.accounts({
|
|
112
112
|
creator,
|
|
113
113
|
mint,
|
|
@@ -143,20 +143,6 @@ class SolanaStakingClient {
|
|
|
143
143
|
payer: staker,
|
|
144
144
|
})
|
|
145
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
|
-
}
|
|
160
146
|
return { ixs: [instruction] };
|
|
161
147
|
}
|
|
162
148
|
async unstake(data, extParams) {
|
|
@@ -46,7 +46,7 @@ export declare class SolanaStakingClient {
|
|
|
46
46
|
getDefaultFeeValue(): Promise<DefaultFeeValueConfig>;
|
|
47
47
|
getFeeValueIfExists(target: string | PublicKey): Promise<FeeValue | null>;
|
|
48
48
|
createStakePool(data: CreateStakePoolArgs, extParams: IInteractSolanaExt): Promise<CreationResult>;
|
|
49
|
-
prepareCreateStakePoolInstructions({ maxWeight, maxDuration, minDuration, mint, permissionless, nonce, tokenProgramId, }: CreateStakePoolArgs, extParams: IInteractSolanaExt): Promise<{
|
|
49
|
+
prepareCreateStakePoolInstructions({ maxWeight, maxDuration, minDuration, mint, permissionless, freezeStakeMint, unstakePeriod, nonce, tokenProgramId, }: CreateStakePoolArgs, extParams: IInteractSolanaExt): Promise<{
|
|
50
50
|
ixs: TransactionInstruction[];
|
|
51
51
|
publicKey: PublicKey;
|
|
52
52
|
}>;
|
|
@@ -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
|
|
3
|
+
import { Connection, PublicKey } 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";
|
|
@@ -101,12 +101,12 @@ export class SolanaStakingClient {
|
|
|
101
101
|
metadataId: publicKey,
|
|
102
102
|
};
|
|
103
103
|
}
|
|
104
|
-
async prepareCreateStakePoolInstructions({ maxWeight, maxDuration, minDuration, mint, permissionless = false, nonce, tokenProgramId = TOKEN_PROGRAM_ID, }, extParams) {
|
|
104
|
+
async prepareCreateStakePoolInstructions({ maxWeight, maxDuration, minDuration, mint, permissionless = false, freezeStakeMint = null, unstakePeriod = null, nonce, tokenProgramId = TOKEN_PROGRAM_ID, }, extParams) {
|
|
105
105
|
const { stakePoolProgram } = this.programs;
|
|
106
106
|
const creator = extParams.invoker.publicKey;
|
|
107
107
|
invariant(creator, "Undefined invoker publicKey");
|
|
108
108
|
const createInstruction = await stakePoolProgram.methods
|
|
109
|
-
.createPool(nonce, maxWeight, minDuration, maxDuration, permissionless,
|
|
109
|
+
.createPool(nonce, maxWeight, minDuration, maxDuration, permissionless, freezeStakeMint, unstakePeriod)
|
|
110
110
|
.accounts({
|
|
111
111
|
creator,
|
|
112
112
|
mint,
|
|
@@ -142,20 +142,6 @@ export class SolanaStakingClient {
|
|
|
142
142
|
payer: staker,
|
|
143
143
|
})
|
|
144
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
|
-
}
|
|
159
145
|
return { ixs: [instruction] };
|
|
160
146
|
}
|
|
161
147
|
async unstake(data, extParams) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamflow/staking",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.5.0",
|
|
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": "a17f597d53b6caff7fed8bfdf054a2a755431948",
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@streamflow/eslint-config": "7.
|
|
32
|
+
"@streamflow/eslint-config": "7.5.0",
|
|
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.
|
|
43
|
+
"@streamflow/common": "7.5.0",
|
|
44
44
|
"bn.js": "5.2.1",
|
|
45
45
|
"borsh": "^2.0.0",
|
|
46
46
|
"bs58": "5.0.0",
|