@marinade.finance/native-staking-sdk
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -14,3 +14,3 @@ "use strict"; | ||
exports.NATIVE_STAKING_API_URL_DEV = "https://native-staking-dev.marinade.finance"; | ||
exports.DEFAULT_PREPARE_FOR_REVOKE_COST = new bn_js_1.default("1000000"); | ||
exports.DEFAULT_PREPARE_FOR_REVOKE_COST = new bn_js_1.default("2300000"); | ||
class NativeStakingConfig { | ||
@@ -17,0 +17,0 @@ constructor(overrides = {}) { |
@@ -14,2 +14,10 @@ export interface Proxy { | ||
} | ||
export interface FragmentedRebalanceOrderMessage extends OrderMessage { | ||
FragmentedRebalance: { | ||
stake_authority: string; | ||
withdraw_authority: string; | ||
stake_fragment_size_bps: number; | ||
stake_proxy?: Proxy; | ||
}; | ||
} | ||
export interface MergeOrderMessage extends OrderMessage { | ||
@@ -22,2 +30,10 @@ Merge: { | ||
} | ||
export interface SoftMergeOrderMessage extends OrderMessage { | ||
SoftMerge: { | ||
stake_authority: string; | ||
withdraw_authority: string; | ||
max_stake_fragment_size_bps: number; | ||
stake_proxy?: Proxy; | ||
}; | ||
} | ||
export interface ClaimExtraBalanceOrderMessage extends OrderMessage { | ||
@@ -38,5 +54,14 @@ ClaimExtraBalance: { | ||
}; | ||
payment: string; | ||
stake_proxy?: Proxy; | ||
}; | ||
} | ||
export interface ResetUndelegatedMessage extends OrderMessage { | ||
ResetUndelegated: { | ||
stake_authority: string; | ||
withdraw_authority: string; | ||
temporary_validator: string; | ||
stake_proxy?: Proxy; | ||
}; | ||
} | ||
export declare const orderMessagesToStdin: (messages: OrderMessage[]) => string; |
import { Keypair, PublicKey, TransactionInstruction } from "@solana/web3.js"; | ||
import BN from 'bn.js'; | ||
import { NativeStakingConfig } from "./config"; | ||
import { ClaimExtraBalanceOrderMessage, ExitMessage, MergeOrderMessage, RebalanceOrderMessage } from "./messages"; | ||
import { ClaimExtraBalanceOrderMessage, ExitMessage, FragmentedRebalanceOrderMessage, MergeOrderMessage, RebalanceOrderMessage, ResetUndelegatedMessage, SoftMergeOrderMessage } from "./messages"; | ||
import { StakeDistribution } from "./utils"; | ||
@@ -46,9 +46,12 @@ export declare class NativeStakingSDK { | ||
buildRebalanceOrderMessage: (withdrawAuthority: PublicKey) => RebalanceOrderMessage; | ||
buildFragmentedRebalanceOrderMessage: (withdrawAuthority: PublicKey, stakeFragmentSizeBps: number) => FragmentedRebalanceOrderMessage; | ||
buildRebalanceOrderWithProxyMessage: (withdrawAuthority: PublicKey, root: PublicKey, operator: PublicKey) => RebalanceOrderMessage; | ||
buildMergeOrderMessage: (withdrawAuthority: PublicKey) => MergeOrderMessage; | ||
buildSoftMergeOrderMessage: (withdrawAuthority: PublicKey, maxStakeFragmentSizeBps: number) => SoftMergeOrderMessage; | ||
buildResetUndelegatedAccountsMessage: (withdrawAuthority: PublicKey, validator: PublicKey) => ResetUndelegatedMessage; | ||
buildMergeOrderWithProxyMessage: (withdrawAuthority: PublicKey, root: PublicKey, operator: PublicKey) => MergeOrderMessage; | ||
buildClaimExtraBalanceOrderMessage: (withdrawAuthority: PublicKey) => ClaimExtraBalanceOrderMessage; | ||
buildExitAllOrderMessage: (withdrawAuthority: PublicKey) => ExitMessage; | ||
buildExitPartOrderMessage: (withdrawAuthority: PublicKey, amount: BN) => ExitMessage; | ||
buildExitPartOrderWithProxyMessage: (withdrawAuthority: PublicKey, amount: BN, root: PublicKey, operator: PublicKey) => ExitMessage; | ||
buildExitAllOrderMessage: (withdrawAuthority: PublicKey, payment: string) => ExitMessage; | ||
buildExitPartOrderMessage: (withdrawAuthority: PublicKey, amount: BN, payment: string) => ExitMessage; | ||
buildExitPartOrderWithProxyMessage: (withdrawAuthority: PublicKey, amount: BN, payment: string, root: PublicKey, operator: PublicKey) => ExitMessage; | ||
} | ||
@@ -55,0 +58,0 @@ export type RewardsResponse = { |
@@ -50,9 +50,12 @@ "use strict"; | ||
this.buildRebalanceOrderMessage = (withdrawAuthority) => ({ "Rebalance": { "stake_authority": this.config.stakeAuthority.toBase58(), "withdraw_authority": withdrawAuthority.toBase58() } }); | ||
this.buildFragmentedRebalanceOrderMessage = (withdrawAuthority, stakeFragmentSizeBps) => ({ "FragmentedRebalance": { "stake_authority": this.config.stakeAuthority.toBase58(), "withdraw_authority": withdrawAuthority.toBase58(), "stake_fragment_size_bps": stakeFragmentSizeBps } }); | ||
this.buildRebalanceOrderWithProxyMessage = (withdrawAuthority, root, operator) => ({ "Rebalance": { "stake_authority": this.config.stakeAuthority.toBase58(), "withdraw_authority": withdrawAuthority.toBase58(), "stake_proxy": { root: root.toBase58(), operator: operator.toBase58() } } }); | ||
this.buildMergeOrderMessage = (withdrawAuthority) => ({ "Merge": { "stake_authority": this.config.stakeAuthority.toBase58(), "withdraw_authority": withdrawAuthority.toBase58() } }); | ||
this.buildSoftMergeOrderMessage = (withdrawAuthority, maxStakeFragmentSizeBps) => ({ "SoftMerge": { "stake_authority": this.config.stakeAuthority.toBase58(), "withdraw_authority": withdrawAuthority.toBase58(), "max_stake_fragment_size_bps": maxStakeFragmentSizeBps } }); | ||
this.buildResetUndelegatedAccountsMessage = (withdrawAuthority, validator) => ({ "ResetUndelegated": { "stake_authority": this.config.stakeAuthority.toBase58(), "withdraw_authority": withdrawAuthority.toBase58(), "temporary_validator": validator.toBase58() } }); | ||
this.buildMergeOrderWithProxyMessage = (withdrawAuthority, root, operator) => ({ "Merge": { "stake_authority": this.config.stakeAuthority.toBase58(), "withdraw_authority": withdrawAuthority.toBase58(), "stake_proxy": { root: root.toBase58(), operator: operator.toBase58() } } }); | ||
this.buildClaimExtraBalanceOrderMessage = (withdrawAuthority) => ({ "ClaimExtraBalance": { "stake_authority": this.config.stakeAuthority.toBase58(), "withdraw_authority": withdrawAuthority.toBase58() } }); | ||
this.buildExitAllOrderMessage = (withdrawAuthority) => ({ "Exit": { "stake_authority": this.config.stakeAuthority.toBase58(), "withdraw_authority": withdrawAuthority.toBase58(), "exit_authority": this.config.exitAuthority.toBase58(), "amount": "All" } }); | ||
this.buildExitPartOrderMessage = (withdrawAuthority, amount) => ({ "Exit": { "stake_authority": this.config.stakeAuthority.toBase58(), "withdraw_authority": withdrawAuthority.toBase58(), "exit_authority": this.config.exitAuthority.toBase58(), "amount": { "Part": amount.toNumber() } } }); | ||
this.buildExitPartOrderWithProxyMessage = (withdrawAuthority, amount, root, operator) => ({ "Exit": { "stake_authority": this.config.stakeAuthority.toBase58(), "withdraw_authority": withdrawAuthority.toBase58(), "exit_authority": this.config.exitAuthority.toBase58(), "amount": { "Part": amount.toNumber() }, "stake_proxy": { root: root.toBase58(), operator: operator.toBase58() } } }); | ||
this.buildExitAllOrderMessage = (withdrawAuthority, payment) => ({ "Exit": { "stake_authority": this.config.stakeAuthority.toBase58(), "withdraw_authority": withdrawAuthority.toBase58(), "exit_authority": this.config.exitAuthority.toBase58(), "amount": "All", payment } }); | ||
this.buildExitPartOrderMessage = (withdrawAuthority, amount, payment) => ({ "Exit": { "stake_authority": this.config.stakeAuthority.toBase58(), "withdraw_authority": withdrawAuthority.toBase58(), "exit_authority": this.config.exitAuthority.toBase58(), "amount": { "Part": amount.toNumber() }, payment } }); | ||
this.buildExitPartOrderWithProxyMessage = (withdrawAuthority, amount, payment, root, operator) => ({ "Exit": { "stake_authority": this.config.stakeAuthority.toBase58(), "withdraw_authority": withdrawAuthority.toBase58(), "exit_authority": this.config.exitAuthority.toBase58(), "amount": { "Part": amount.toNumber() }, payment, "stake_proxy": { root: root.toBase58(), operator: operator.toBase58() } } }); | ||
} | ||
@@ -59,0 +62,0 @@ buildCreateAuthorizedStakeInstructions(user, amount, stakeKeypair = web3_js_1.Keypair.generate()) { |
{ | ||
"name": "@marinade.finance/native-staking-sdk", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Marinade SDK for the Native Staking", | ||
@@ -5,0 +5,0 @@ "main": "dist/src/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
46953
493