@kamino-finance/klend-sdk 5.10.28-beta.1 → 5.10.29
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/classes/index.d.ts +0 -3
- package/dist/classes/index.d.ts.map +1 -1
- package/dist/classes/index.js +0 -3
- package/dist/classes/index.js.map +1 -1
- package/dist/classes/manager.d.ts +6 -0
- package/dist/classes/manager.d.ts.map +1 -1
- package/dist/classes/manager.js +8 -0
- package/dist/classes/manager.js.map +1 -1
- package/dist/classes/reserve.d.ts +1 -1
- package/dist/classes/reserve.d.ts.map +1 -1
- package/dist/classes/reserve.js +13 -10
- package/dist/classes/reserve.js.map +1 -1
- package/dist/classes/types.d.ts +1 -13
- package/dist/classes/types.d.ts.map +1 -1
- package/dist/classes/vault.d.ts +7 -0
- package/dist/classes/vault.d.ts.map +1 -1
- package/dist/classes/vault.js +18 -0
- package/dist/classes/vault.js.map +1 -1
- package/package.json +1 -4
- package/src/classes/index.ts +0 -3
- package/src/classes/manager.ts +9 -0
- package/src/classes/reserve.ts +14 -13
- package/src/classes/types.ts +1 -17
- package/src/classes/vault.ts +21 -1
- package/dist/classes/stakePool.d.ts +0 -8
- package/dist/classes/stakePool.d.ts.map +0 -1
- package/dist/classes/stakePool.js +0 -18
- package/dist/classes/stakePool.js.map +0 -1
- package/dist/classes/standardStakePool.d.ts +0 -174
- package/dist/classes/standardStakePool.d.ts.map +0 -1
- package/dist/classes/standardStakePool.js +0 -275
- package/dist/classes/standardStakePool.js.map +0 -1
- package/dist/classes/unstakingPool.d.ts +0 -117
- package/dist/classes/unstakingPool.d.ts.map +0 -1
- package/dist/classes/unstakingPool.js +0 -448
- package/dist/classes/unstakingPool.js.map +0 -1
- package/dist/idl_codegen_unstaking_pool/accounts/PoolState.d.ts +0 -50
- package/dist/idl_codegen_unstaking_pool/accounts/PoolState.d.ts.map +0 -1
- package/dist/idl_codegen_unstaking_pool/accounts/PoolState.js +0 -156
- package/dist/idl_codegen_unstaking_pool/accounts/PoolState.js.map +0 -1
- package/dist/idl_codegen_unstaking_pool/accounts/index.d.ts +0 -3
- package/dist/idl_codegen_unstaking_pool/accounts/index.d.ts.map +0 -1
- package/dist/idl_codegen_unstaking_pool/accounts/index.js +0 -6
- package/dist/idl_codegen_unstaking_pool/accounts/index.js.map +0 -1
- package/dist/idl_codegen_unstaking_pool/errors/anchor.d.ts +0 -435
- package/dist/idl_codegen_unstaking_pool/errors/anchor.d.ts.map +0 -1
- package/dist/idl_codegen_unstaking_pool/errors/anchor.js +0 -767
- package/dist/idl_codegen_unstaking_pool/errors/anchor.js.map +0 -1
- package/dist/idl_codegen_unstaking_pool/errors/custom.d.ts +0 -163
- package/dist/idl_codegen_unstaking_pool/errors/custom.d.ts.map +0 -1
- package/dist/idl_codegen_unstaking_pool/errors/custom.js +0 -290
- package/dist/idl_codegen_unstaking_pool/errors/custom.js.map +0 -1
- package/dist/idl_codegen_unstaking_pool/errors/index.d.ts +0 -6
- package/dist/idl_codegen_unstaking_pool/errors/index.d.ts.map +0 -1
- package/dist/idl_codegen_unstaking_pool/errors/index.js +0 -75
- package/dist/idl_codegen_unstaking_pool/errors/index.js.map +0 -1
- package/dist/idl_codegen_unstaking_pool/instructions/burn.d.ts +0 -21
- package/dist/idl_codegen_unstaking_pool/instructions/burn.d.ts.map +0 -1
- package/dist/idl_codegen_unstaking_pool/instructions/burn.js +0 -73
- package/dist/idl_codegen_unstaking_pool/instructions/burn.js.map +0 -1
- package/dist/idl_codegen_unstaking_pool/instructions/collect.d.ts +0 -16
- package/dist/idl_codegen_unstaking_pool/instructions/collect.d.ts.map +0 -1
- package/dist/idl_codegen_unstaking_pool/instructions/collect.js +0 -29
- package/dist/idl_codegen_unstaking_pool/instructions/collect.js.map +0 -1
- package/dist/idl_codegen_unstaking_pool/instructions/index.d.ts +0 -11
- package/dist/idl_codegen_unstaking_pool/instructions/index.d.ts.map +0 -1
- package/dist/idl_codegen_unstaking_pool/instructions/index.js +0 -14
- package/dist/idl_codegen_unstaking_pool/instructions/index.js.map +0 -1
- package/dist/idl_codegen_unstaking_pool/instructions/initializePool.d.ts +0 -15
- package/dist/idl_codegen_unstaking_pool/instructions/initializePool.d.ts.map +0 -1
- package/dist/idl_codegen_unstaking_pool/instructions/initializePool.js +0 -28
- package/dist/idl_codegen_unstaking_pool/instructions/initializePool.js.map +0 -1
- package/dist/idl_codegen_unstaking_pool/instructions/mint.d.ts +0 -21
- package/dist/idl_codegen_unstaking_pool/instructions/mint.d.ts.map +0 -1
- package/dist/idl_codegen_unstaking_pool/instructions/mint.js +0 -77
- package/dist/idl_codegen_unstaking_pool/instructions/mint.js.map +0 -1
- package/dist/idl_codegen_unstaking_pool/instructions/updatePoolConfig.d.ts +0 -13
- package/dist/idl_codegen_unstaking_pool/instructions/updatePoolConfig.d.ts.map +0 -1
- package/dist/idl_codegen_unstaking_pool/instructions/updatePoolConfig.js +0 -58
- package/dist/idl_codegen_unstaking_pool/instructions/updatePoolConfig.js.map +0 -1
- package/dist/idl_codegen_unstaking_pool/programId.d.ts +0 -4
- package/dist/idl_codegen_unstaking_pool/programId.d.ts.map +0 -1
- package/dist/idl_codegen_unstaking_pool/programId.js +0 -9
- package/dist/idl_codegen_unstaking_pool/programId.js.map +0 -1
- package/dist/idl_codegen_unstaking_pool/types/PoolConfigField.d.ts +0 -32
- package/dist/idl_codegen_unstaking_pool/types/PoolConfigField.d.ts.map +0 -1
- package/dist/idl_codegen_unstaking_pool/types/PoolConfigField.js +0 -105
- package/dist/idl_codegen_unstaking_pool/types/PoolConfigField.js.map +0 -1
- package/dist/idl_codegen_unstaking_pool/types/index.d.ts +0 -5
- package/dist/idl_codegen_unstaking_pool/types/index.d.ts.map +0 -1
- package/dist/idl_codegen_unstaking_pool/types/index.js +0 -39
- package/dist/idl_codegen_unstaking_pool/types/index.js.map +0 -1
- package/src/classes/stakePool.ts +0 -21
- package/src/classes/standardStakePool.ts +0 -358
- package/src/classes/unstakingPool.ts +0 -577
- package/src/idl_codegen_unstaking_pool/accounts/PoolState.ts +0 -163
- package/src/idl_codegen_unstaking_pool/accounts/index.ts +0 -2
- package/src/idl_codegen_unstaking_pool/errors/anchor.ts +0 -764
- package/src/idl_codegen_unstaking_pool/errors/custom.ts +0 -288
- package/src/idl_codegen_unstaking_pool/errors/index.ts +0 -49
- package/src/idl_codegen_unstaking_pool/instructions/burn.ts +0 -60
- package/src/idl_codegen_unstaking_pool/instructions/collect.ts +0 -43
- package/src/idl_codegen_unstaking_pool/instructions/index.ts +0 -10
- package/src/idl_codegen_unstaking_pool/instructions/initializePool.ts +0 -41
- package/src/idl_codegen_unstaking_pool/instructions/mint.ts +0 -64
- package/src/idl_codegen_unstaking_pool/instructions/updatePoolConfig.ts +0 -40
- package/src/idl_codegen_unstaking_pool/programId.ts +0 -7
- package/src/idl_codegen_unstaking_pool/types/PoolConfigField.ts +0 -85
- package/src/idl_codegen_unstaking_pool/types/index.ts +0 -6
- package/src/idl_unstaking_pool.json +0 -456
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import { ValidatorList } from '@solana/spl-stake-pool';
|
|
2
|
-
import { StakePool } from '@solana/spl-stake-pool';
|
|
3
|
-
import { AccountMeta, Connection, Keypair, PublicKey } from '@solana/web3.js';
|
|
4
|
-
import BN from 'bn.js';
|
|
5
|
-
import { Infer } from 'superstruct';
|
|
6
|
-
export declare const TRANSIENT_STAKE_SEED_PREFIX: Buffer<ArrayBuffer>;
|
|
7
|
-
export declare const STAKE_ACCOUNT_RENT_EXEMPTION = 2282880;
|
|
8
|
-
export declare function getStandardPoolState(address: PublicKey, connection: Connection): Promise<StakePool>;
|
|
9
|
-
export declare function getValidatorList(address: PublicKey, connection: Connection): Promise<ValidatorList>;
|
|
10
|
-
export declare function maybeGetStakedPoolByMint(connection: Connection, mint: PublicKey): Promise<[StakePool, PublicKey] | undefined>;
|
|
11
|
-
export declare function getStandardPoolMintRemainingAccounts(connection: Connection, stakedSolPool: StakePool, stakedSolPoolPk: PublicKey, stakedSolToDeposit: BN): Promise<[Array<AccountMeta>, Array<Keypair>]>;
|
|
12
|
-
export declare function getWithdrawCandidates(connection: Connection, stakedSolPool: StakePool, stakedSolPoolPk: PublicKey, stakedSolToDeposit: BN): Promise<Array<PublicKey>>;
|
|
13
|
-
/**
|
|
14
|
-
* Generates the withdraw authority program address for the stake pool
|
|
15
|
-
*/
|
|
16
|
-
export declare function findWithdrawAuthorityProgramAddress(programId: PublicKey, stakePoolAddress: PublicKey): Promise<PublicKey>;
|
|
17
|
-
export declare function findStakeProgramAddress(programId: PublicKey, voteAccountAddress: PublicKey, stakedSolPoolPk: PublicKey, seed: number): Promise<PublicKey>;
|
|
18
|
-
export declare function findTransientStakeProgramAddress(programId: PublicKey, voteAccountAddress: PublicKey, stakePoolAddress: PublicKey, seed: BN): Promise<PublicKey>;
|
|
19
|
-
export declare function calcLamportsWithdrawAmount(stakePool: StakePool, poolTokens: BN): BN;
|
|
20
|
-
export declare const BigNumFromString: import('superstruct').Struct<BN, null>;
|
|
21
|
-
export declare const PublicKeyFromString: import('superstruct').Struct<PublicKey, null>;
|
|
22
|
-
export declare const StakeAccountType: import("superstruct").Struct<"uninitialized" | "initialized" | "delegated" | "rewardsPool", {
|
|
23
|
-
uninitialized: "uninitialized";
|
|
24
|
-
initialized: "initialized";
|
|
25
|
-
delegated: "delegated";
|
|
26
|
-
rewardsPool: "rewardsPool";
|
|
27
|
-
}>;
|
|
28
|
-
export type StakeMeta = Infer<typeof StakeMeta>;
|
|
29
|
-
export declare const StakeMeta: import("superstruct").Struct<{
|
|
30
|
-
rentExemptReserve: BN;
|
|
31
|
-
authorized: {
|
|
32
|
-
staker: PublicKey;
|
|
33
|
-
withdrawer: PublicKey;
|
|
34
|
-
};
|
|
35
|
-
lockup: {
|
|
36
|
-
unixTimestamp: number;
|
|
37
|
-
epoch: number;
|
|
38
|
-
custodian: PublicKey;
|
|
39
|
-
};
|
|
40
|
-
}, {
|
|
41
|
-
rentExemptReserve: import("superstruct").Struct<BN, null>;
|
|
42
|
-
authorized: import("superstruct").Struct<{
|
|
43
|
-
staker: PublicKey;
|
|
44
|
-
withdrawer: PublicKey;
|
|
45
|
-
}, {
|
|
46
|
-
staker: import("superstruct").Struct<PublicKey, null>;
|
|
47
|
-
withdrawer: import("superstruct").Struct<PublicKey, null>;
|
|
48
|
-
}>;
|
|
49
|
-
lockup: import("superstruct").Struct<{
|
|
50
|
-
unixTimestamp: number;
|
|
51
|
-
epoch: number;
|
|
52
|
-
custodian: PublicKey;
|
|
53
|
-
}, {
|
|
54
|
-
unixTimestamp: import("superstruct").Struct<number, null>;
|
|
55
|
-
epoch: import("superstruct").Struct<number, null>;
|
|
56
|
-
custodian: import("superstruct").Struct<PublicKey, null>;
|
|
57
|
-
}>;
|
|
58
|
-
}>;
|
|
59
|
-
export type StakeAccount = Infer<typeof StakeAccount>;
|
|
60
|
-
export declare const StakeAccount: import("superstruct").Struct<{
|
|
61
|
-
type: "uninitialized" | "initialized" | "delegated" | "rewardsPool";
|
|
62
|
-
info: {
|
|
63
|
-
meta: {
|
|
64
|
-
rentExemptReserve: BN;
|
|
65
|
-
authorized: {
|
|
66
|
-
staker: PublicKey;
|
|
67
|
-
withdrawer: PublicKey;
|
|
68
|
-
};
|
|
69
|
-
lockup: {
|
|
70
|
-
unixTimestamp: number;
|
|
71
|
-
epoch: number;
|
|
72
|
-
custodian: PublicKey;
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
stake: {
|
|
76
|
-
delegation: {
|
|
77
|
-
stake: BN;
|
|
78
|
-
voter: PublicKey;
|
|
79
|
-
activationEpoch: BN;
|
|
80
|
-
deactivationEpoch: BN;
|
|
81
|
-
warmupCooldownRate: number;
|
|
82
|
-
};
|
|
83
|
-
creditsObserved: number;
|
|
84
|
-
} | null;
|
|
85
|
-
};
|
|
86
|
-
}, {
|
|
87
|
-
type: import("superstruct").Struct<"uninitialized" | "initialized" | "delegated" | "rewardsPool", {
|
|
88
|
-
uninitialized: "uninitialized";
|
|
89
|
-
initialized: "initialized";
|
|
90
|
-
delegated: "delegated";
|
|
91
|
-
rewardsPool: "rewardsPool";
|
|
92
|
-
}>;
|
|
93
|
-
info: import("superstruct").Struct<{
|
|
94
|
-
meta: {
|
|
95
|
-
rentExemptReserve: BN;
|
|
96
|
-
authorized: {
|
|
97
|
-
staker: PublicKey;
|
|
98
|
-
withdrawer: PublicKey;
|
|
99
|
-
};
|
|
100
|
-
lockup: {
|
|
101
|
-
unixTimestamp: number;
|
|
102
|
-
epoch: number;
|
|
103
|
-
custodian: PublicKey;
|
|
104
|
-
};
|
|
105
|
-
};
|
|
106
|
-
stake: {
|
|
107
|
-
delegation: {
|
|
108
|
-
stake: BN;
|
|
109
|
-
voter: PublicKey;
|
|
110
|
-
activationEpoch: BN;
|
|
111
|
-
deactivationEpoch: BN;
|
|
112
|
-
warmupCooldownRate: number;
|
|
113
|
-
};
|
|
114
|
-
creditsObserved: number;
|
|
115
|
-
} | null;
|
|
116
|
-
}, {
|
|
117
|
-
meta: import("superstruct").Struct<{
|
|
118
|
-
rentExemptReserve: BN;
|
|
119
|
-
authorized: {
|
|
120
|
-
staker: PublicKey;
|
|
121
|
-
withdrawer: PublicKey;
|
|
122
|
-
};
|
|
123
|
-
lockup: {
|
|
124
|
-
unixTimestamp: number;
|
|
125
|
-
epoch: number;
|
|
126
|
-
custodian: PublicKey;
|
|
127
|
-
};
|
|
128
|
-
}, {
|
|
129
|
-
rentExemptReserve: import("superstruct").Struct<BN, null>;
|
|
130
|
-
authorized: import("superstruct").Struct<{
|
|
131
|
-
staker: PublicKey;
|
|
132
|
-
withdrawer: PublicKey;
|
|
133
|
-
}, {
|
|
134
|
-
staker: import("superstruct").Struct<PublicKey, null>;
|
|
135
|
-
withdrawer: import("superstruct").Struct<PublicKey, null>;
|
|
136
|
-
}>;
|
|
137
|
-
lockup: import("superstruct").Struct<{
|
|
138
|
-
unixTimestamp: number;
|
|
139
|
-
epoch: number;
|
|
140
|
-
custodian: PublicKey;
|
|
141
|
-
}, {
|
|
142
|
-
unixTimestamp: import("superstruct").Struct<number, null>;
|
|
143
|
-
epoch: import("superstruct").Struct<number, null>;
|
|
144
|
-
custodian: import("superstruct").Struct<PublicKey, null>;
|
|
145
|
-
}>;
|
|
146
|
-
}>;
|
|
147
|
-
stake: import("superstruct").Struct<{
|
|
148
|
-
delegation: {
|
|
149
|
-
stake: BN;
|
|
150
|
-
voter: PublicKey;
|
|
151
|
-
activationEpoch: BN;
|
|
152
|
-
deactivationEpoch: BN;
|
|
153
|
-
warmupCooldownRate: number;
|
|
154
|
-
};
|
|
155
|
-
creditsObserved: number;
|
|
156
|
-
} | null, {
|
|
157
|
-
delegation: import("superstruct").Struct<{
|
|
158
|
-
stake: BN;
|
|
159
|
-
voter: PublicKey;
|
|
160
|
-
activationEpoch: BN;
|
|
161
|
-
deactivationEpoch: BN;
|
|
162
|
-
warmupCooldownRate: number;
|
|
163
|
-
}, {
|
|
164
|
-
voter: import("superstruct").Struct<PublicKey, null>;
|
|
165
|
-
stake: import("superstruct").Struct<BN, null>;
|
|
166
|
-
activationEpoch: import("superstruct").Struct<BN, null>;
|
|
167
|
-
deactivationEpoch: import("superstruct").Struct<BN, null>;
|
|
168
|
-
warmupCooldownRate: import("superstruct").Struct<number, null>;
|
|
169
|
-
}>;
|
|
170
|
-
creditsObserved: import("superstruct").Struct<number, null>;
|
|
171
|
-
}>;
|
|
172
|
-
}>;
|
|
173
|
-
}>;
|
|
174
|
-
//# sourceMappingURL=standardStakePool.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"standardStakePool.d.ts","sourceRoot":"","sources":["../../src/classes/standardStakePool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,aAAa,EAAuB,MAAM,wBAAwB,CAAC;AACnG,OAAO,EAAE,SAAS,EAAmB,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,C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S,EACpB,kBAAkB,EAAE,SAAS,EAC7B,gBAAgB,EAAE,SAAS,EAC3B,IAAI,EAAE,EAAE,sBAYT;AAUD,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,GAAG,EAAE,CAOnF;AAED,MAAM,CAAC,OAAO,CAAC,MAAM,gBAAgB,EAAE,OAAO,aAAa,EAAE,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;AAC9E,MAAM,CAAC,OAAO,CAAC,MAAM,mBAAmB,EAAE,OAAO,aAAa,EAAE,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AACxF,eAAO,MAAM,gBAAgB;;;;;EAAsE,CAAC;AAEpG,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAChD,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWpB,CAAC;AAmBH,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AACtD,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGvB,CAAC"}
|
|
@@ -1,275 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.StakeAccount = exports.StakeMeta = exports.StakeAccountType = exports.STAKE_ACCOUNT_RENT_EXEMPTION = exports.TRANSIENT_STAKE_SEED_PREFIX = void 0;
|
|
7
|
-
exports.getStandardPoolState = getStandardPoolState;
|
|
8
|
-
exports.getValidatorList = getValidatorList;
|
|
9
|
-
exports.maybeGetStakedPoolByMint = maybeGetStakedPoolByMint;
|
|
10
|
-
exports.getStandardPoolMintRemainingAccounts = getStandardPoolMintRemainingAccounts;
|
|
11
|
-
exports.getWithdrawCandidates = getWithdrawCandidates;
|
|
12
|
-
exports.findWithdrawAuthorityProgramAddress = findWithdrawAuthorityProgramAddress;
|
|
13
|
-
exports.findStakeProgramAddress = findStakeProgramAddress;
|
|
14
|
-
exports.findTransientStakeProgramAddress = findTransientStakeProgramAddress;
|
|
15
|
-
exports.calcLamportsWithdrawAmount = calcLamportsWithdrawAmount;
|
|
16
|
-
const spl_stake_pool_1 = require("@solana/spl-stake-pool");
|
|
17
|
-
const spl_stake_pool_2 = require("@solana/spl-stake-pool");
|
|
18
|
-
const web3_js_1 = require("@solana/web3.js");
|
|
19
|
-
const unstakingPool_1 = require("./unstakingPool");
|
|
20
|
-
const bn_js_1 = __importDefault(require("bn.js"));
|
|
21
|
-
const assert_1 = __importDefault(require("assert"));
|
|
22
|
-
const superstruct_1 = require("superstruct");
|
|
23
|
-
exports.TRANSIENT_STAKE_SEED_PREFIX = Buffer.from('transient');
|
|
24
|
-
exports.STAKE_ACCOUNT_RENT_EXEMPTION = 2_282_880;
|
|
25
|
-
const MINIMUM_ACTIVE_STAKE = 1_000_000;
|
|
26
|
-
// This represents the minimum each validator stake account must have and cannot be withdrawn
|
|
27
|
-
const TRANSIENT_STAKE_ACCOUNT_RENT_EXEMPTION = exports.STAKE_ACCOUNT_RENT_EXEMPTION + MINIMUM_ACTIVE_STAKE;
|
|
28
|
-
async function getStandardPoolState(address, connection) {
|
|
29
|
-
const accountInfo = await connection.getAccountInfo(address);
|
|
30
|
-
if (!accountInfo) {
|
|
31
|
-
throw new Error(`Cannot fetch standard stake pool account ${address.toString()}`);
|
|
32
|
-
}
|
|
33
|
-
return spl_stake_pool_2.StakePoolLayout.decode(accountInfo.data);
|
|
34
|
-
}
|
|
35
|
-
async function getValidatorList(address, connection) {
|
|
36
|
-
const accountInfo = await connection.getAccountInfo(address);
|
|
37
|
-
if (!accountInfo) {
|
|
38
|
-
throw new Error(`Cannot fetch standard stake pool account ${address.toString()}`);
|
|
39
|
-
}
|
|
40
|
-
return spl_stake_pool_1.ValidatorListLayout.decode(accountInfo.data);
|
|
41
|
-
}
|
|
42
|
-
async function maybeGetStakedPoolByMint(connection, mint) {
|
|
43
|
-
const results = await connection.getProgramAccounts(spl_stake_pool_1.STAKE_POOL_PROGRAM_ID, {
|
|
44
|
-
filters: [{ memcmp: { offset: 162, bytes: mint.toBase58() } }],
|
|
45
|
-
});
|
|
46
|
-
// There should be only 1 stake pool for mint
|
|
47
|
-
if (results.length === 0) {
|
|
48
|
-
return undefined;
|
|
49
|
-
}
|
|
50
|
-
if (results.length === 1) {
|
|
51
|
-
return [spl_stake_pool_2.StakePoolLayout.decode(results[0].account.data), results[0].pubkey];
|
|
52
|
-
}
|
|
53
|
-
throw new Error(`Got ${results.length} stake pools for mint ${mint.toString()} and not sure which one is correct.`);
|
|
54
|
-
}
|
|
55
|
-
async function getStandardPoolMintRemainingAccounts(connection, stakedSolPool, stakedSolPoolPk, stakedSolToDeposit) {
|
|
56
|
-
const withdrawAuthority = await findWithdrawAuthorityProgramAddress(spl_stake_pool_1.STAKE_POOL_PROGRAM_ID, stakedSolPoolPk);
|
|
57
|
-
const remainingAccounts = [
|
|
58
|
-
{ pubkey: stakedSolPoolPk, isSigner: false, isWritable: true },
|
|
59
|
-
{ pubkey: stakedSolPool.validatorList, isSigner: false, isWritable: true },
|
|
60
|
-
{ pubkey: withdrawAuthority, isSigner: false, isWritable: true },
|
|
61
|
-
{ pubkey: stakedSolPool.managerFeeAccount, isSigner: false, isWritable: true },
|
|
62
|
-
{ pubkey: unstakingPool_1.CLOCK_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
63
|
-
{ pubkey: unstakingPool_1.STAKE_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
64
|
-
{ pubkey: spl_stake_pool_1.STAKE_POOL_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
65
|
-
];
|
|
66
|
-
const withdrawCandidates = await getWithdrawCandidates(connection, stakedSolPool, stakedSolPoolPk, stakedSolToDeposit);
|
|
67
|
-
// Each withdraw candidate should also create a new keypair for the stake account
|
|
68
|
-
const withdrawCandidatesTo = [];
|
|
69
|
-
for (const withdrawCandidateFrom of withdrawCandidates) {
|
|
70
|
-
remainingAccounts.push({ pubkey: withdrawCandidateFrom, isSigner: false, isWritable: true });
|
|
71
|
-
const withdrawCandidateTo = web3_js_1.Keypair.generate();
|
|
72
|
-
remainingAccounts.push({ pubkey: withdrawCandidateTo.publicKey, isSigner: true, isWritable: true });
|
|
73
|
-
withdrawCandidatesTo.push(withdrawCandidateTo);
|
|
74
|
-
}
|
|
75
|
-
return [remainingAccounts, withdrawCandidatesTo];
|
|
76
|
-
}
|
|
77
|
-
async function getAllWithdrawCandidatesSorted(connection, stakedSolPool, stakedSolPoolPk) {
|
|
78
|
-
const activeValidators = [];
|
|
79
|
-
const transientValidators = [];
|
|
80
|
-
const validatorList = await getValidatorList(stakedSolPool.validatorList, connection);
|
|
81
|
-
const accountsToFetch = [];
|
|
82
|
-
// Add all accounts to be fetched to an array so that we can use getMultipleAccounts
|
|
83
|
-
for (const validator of validatorList.validators) {
|
|
84
|
-
const stakeAccount = await findStakeProgramAddress(spl_stake_pool_1.STAKE_POOL_PROGRAM_ID, validator.voteAccountAddress, stakedSolPoolPk, validator.transientSeedSuffixStart.toNumber());
|
|
85
|
-
const transientAccount = await findTransientStakeProgramAddress(spl_stake_pool_1.STAKE_POOL_PROGRAM_ID, validator.voteAccountAddress, stakedSolPoolPk, validator.transientSeedSuffixEnd);
|
|
86
|
-
accountsToFetch.push(stakeAccount);
|
|
87
|
-
accountsToFetch.push(transientAccount);
|
|
88
|
-
}
|
|
89
|
-
let accountsBalances = [];
|
|
90
|
-
// TODO: if this is still too slow we can also start all getMultipleAccounts in parallel and do Promise.all
|
|
91
|
-
for (let i = 0; i < accountsToFetch.length; i += 100) {
|
|
92
|
-
const accountInfos = await connection.getMultipleAccountsInfo(accountsToFetch.slice(i, i + 100));
|
|
93
|
-
accountsBalances = accountsBalances.concat(accountInfos.map((accountInfo) => (accountInfo ? accountInfo.lamports : 0)));
|
|
94
|
-
}
|
|
95
|
-
(0, assert_1.default)(accountsBalances.length === accountsToFetch.length);
|
|
96
|
-
let i = 0;
|
|
97
|
-
for (const validator of validatorList.validators) {
|
|
98
|
-
const isPreferred = stakedSolPool.preferredWithdrawValidatorVoteAddress
|
|
99
|
-
? validator.voteAccountAddress.equals(stakedSolPool.preferredWithdrawValidatorVoteAddress)
|
|
100
|
-
: false;
|
|
101
|
-
const stakeAccount = accountsToFetch[i];
|
|
102
|
-
const stakeAccountBalance = accountsBalances[i] - TRANSIENT_STAKE_ACCOUNT_RENT_EXEMPTION;
|
|
103
|
-
if (stakeAccountBalance > 0) {
|
|
104
|
-
activeValidators.push({ isPreferred, balance: stakeAccountBalance, pk: stakeAccount });
|
|
105
|
-
}
|
|
106
|
-
const transientAccount = accountsToFetch[i + 1];
|
|
107
|
-
const transientAccountBalance = accountsBalances[i + 1] - TRANSIENT_STAKE_ACCOUNT_RENT_EXEMPTION;
|
|
108
|
-
if (transientAccountBalance > 0) {
|
|
109
|
-
transientValidators.push({ isPreferred, balance: transientAccountBalance, pk: transientAccount });
|
|
110
|
-
}
|
|
111
|
-
i += 2;
|
|
112
|
-
}
|
|
113
|
-
// Sorting descending based on balance, but preferred validators should always be used first
|
|
114
|
-
activeValidators.sort((a, b) => {
|
|
115
|
-
if (a.isPreferred) {
|
|
116
|
-
return -1;
|
|
117
|
-
}
|
|
118
|
-
if (b.isPreferred) {
|
|
119
|
-
return 1;
|
|
120
|
-
}
|
|
121
|
-
return b.balance - a.balance;
|
|
122
|
-
});
|
|
123
|
-
transientValidators.sort((a, b) => {
|
|
124
|
-
if (a.isPreferred) {
|
|
125
|
-
return -1;
|
|
126
|
-
}
|
|
127
|
-
if (b.isPreferred) {
|
|
128
|
-
return 1;
|
|
129
|
-
}
|
|
130
|
-
return b.balance - a.balance;
|
|
131
|
-
});
|
|
132
|
-
const allCandidates = activeValidators.concat(transientValidators);
|
|
133
|
-
// Add reserve stake account at the end as that should be used only if no validators have enough stake
|
|
134
|
-
const reserveStakeBalance = (await connection.getBalance(stakedSolPool.reserveStake)) - exports.STAKE_ACCOUNT_RENT_EXEMPTION;
|
|
135
|
-
if (reserveStakeBalance > 0) {
|
|
136
|
-
allCandidates.push({
|
|
137
|
-
isPreferred: false,
|
|
138
|
-
balance: reserveStakeBalance,
|
|
139
|
-
pk: stakedSolPool.reserveStake,
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
return allCandidates;
|
|
143
|
-
}
|
|
144
|
-
async function getWithdrawCandidates(connection, stakedSolPool, stakedSolPoolPk, stakedSolToDeposit) {
|
|
145
|
-
const allCandidates = await getAllWithdrawCandidatesSorted(connection, stakedSolPool, stakedSolPoolPk);
|
|
146
|
-
let stakedSolRemaining = stakedSolToDeposit;
|
|
147
|
-
let solToWithdraw = new bn_js_1.default(0);
|
|
148
|
-
const withdrawCandidates = [];
|
|
149
|
-
// Try to withdraw all of the SOL from validators' active/transient accounts
|
|
150
|
-
for (const candidate of allCandidates) {
|
|
151
|
-
if (stakedSolRemaining.isZero()) {
|
|
152
|
-
break;
|
|
153
|
-
}
|
|
154
|
-
// See how much the validator balance is worth in staked sol
|
|
155
|
-
// but limit to amount of needed stake sol
|
|
156
|
-
let stakedSolAmountToWithdraw = bn_js_1.default.min(stakedSolRemaining, solToStakePoolTokensWithInverseFee(stakedSolPool, new bn_js_1.default(candidate.balance)));
|
|
157
|
-
// Convert it back to staked sol so we get the real amount
|
|
158
|
-
let actualSolAmount = calcLamportsWithdrawAmount(stakedSolPool, stakedSolAmountToWithdraw);
|
|
159
|
-
const remainingSolAmount = calcLamportsWithdrawAmount(stakedSolPool, stakedSolRemaining.sub(stakedSolAmountToWithdraw));
|
|
160
|
-
// If the current validator uses up all of the remaining staked sol except some minimum that we need
|
|
161
|
-
// in order to split_stake, then leave at least the minimum required to be consumed by another validator
|
|
162
|
-
if (!remainingSolAmount.isZero() && remainingSolAmount < new bn_js_1.default(MINIMUM_ACTIVE_STAKE)) {
|
|
163
|
-
stakedSolAmountToWithdraw = stakedSolAmountToWithdraw.sub(solToStakePoolTokensWithInverseFee(stakedSolPool, new bn_js_1.default(MINIMUM_ACTIVE_STAKE)));
|
|
164
|
-
actualSolAmount = calcLamportsWithdrawAmount(stakedSolPool, stakedSolAmountToWithdraw);
|
|
165
|
-
}
|
|
166
|
-
if (actualSolAmount < new bn_js_1.default(MINIMUM_ACTIVE_STAKE) && !candidate.pk.equals(stakedSolPool.reserveStake)) {
|
|
167
|
-
// Skip if the amount to withdraw is less than the minimum required for a valid stake
|
|
168
|
-
continue;
|
|
169
|
-
}
|
|
170
|
-
// Update stake_pool so simulation stays true to what happens on chain
|
|
171
|
-
stakedSolRemaining = stakedSolRemaining.sub(stakedSolAmountToWithdraw);
|
|
172
|
-
solToWithdraw = solToWithdraw.add(actualSolAmount);
|
|
173
|
-
stakedSolPool.totalLamports = stakedSolPool.totalLamports.sub(actualSolAmount);
|
|
174
|
-
stakedSolPool.poolTokenSupply = stakedSolPool.poolTokenSupply.sub(stakePoolTokensMinusFee(stakedSolPool, stakedSolAmountToWithdraw));
|
|
175
|
-
withdrawCandidates.push(candidate.pk);
|
|
176
|
-
}
|
|
177
|
-
return withdrawCandidates;
|
|
178
|
-
}
|
|
179
|
-
function calcPoolTokensStakeWithdrawalFee(stakedSolPool, stakedSolAmountToWithdraw) {
|
|
180
|
-
const denominator = stakedSolPool.stakeWithdrawalFee.denominator;
|
|
181
|
-
if (denominator.isZero()) {
|
|
182
|
-
return new bn_js_1.default(0);
|
|
183
|
-
}
|
|
184
|
-
const numerator = stakedSolAmountToWithdraw.mul(stakedSolPool.stakeWithdrawalFee.numerator);
|
|
185
|
-
const poolTokens = numerator.add(denominator).sub(new bn_js_1.default(1)).div(denominator);
|
|
186
|
-
return poolTokens;
|
|
187
|
-
}
|
|
188
|
-
function stakePoolTokensMinusFee(stakedSolPool, stakedSolAmountToWithdraw) {
|
|
189
|
-
const stakedSolFee = calcPoolTokensStakeWithdrawalFee(stakedSolPool, stakedSolAmountToWithdraw);
|
|
190
|
-
return stakedSolAmountToWithdraw.sub(stakedSolFee);
|
|
191
|
-
}
|
|
192
|
-
function solToStakePoolTokensWithInverseFee(stakedSolPool, sol) {
|
|
193
|
-
let poolTokens = calcPoolTokensForDeposit(stakedSolPool, sol);
|
|
194
|
-
if (!stakedSolPool.stakeWithdrawalFee.numerator.isZero()) {
|
|
195
|
-
const numerator = poolTokens.mul(stakedSolPool.stakeWithdrawalFee.denominator);
|
|
196
|
-
const denominator = stakedSolPool.stakeWithdrawalFee.denominator.sub(stakedSolPool.stakeWithdrawalFee.numerator);
|
|
197
|
-
if (denominator.isZero()) {
|
|
198
|
-
// If the pool has 100% fee for some reason just fail it, we cannot compute the inverse
|
|
199
|
-
throw new Error('Pool fee cannot be 100%');
|
|
200
|
-
}
|
|
201
|
-
poolTokens = numerator.div(denominator);
|
|
202
|
-
}
|
|
203
|
-
return poolTokens;
|
|
204
|
-
}
|
|
205
|
-
// Below functions/types are not exported from spl-stake-pool
|
|
206
|
-
/**
|
|
207
|
-
* Generates the withdraw authority program address for the stake pool
|
|
208
|
-
*/
|
|
209
|
-
async function findWithdrawAuthorityProgramAddress(programId, stakePoolAddress) {
|
|
210
|
-
const [publicKey] = await web3_js_1.PublicKey.findProgramAddress([stakePoolAddress.toBuffer(), Buffer.from('withdraw')], programId);
|
|
211
|
-
return publicKey;
|
|
212
|
-
}
|
|
213
|
-
async function findStakeProgramAddress(programId, voteAccountAddress, stakedSolPoolPk, seed) {
|
|
214
|
-
const [publicKey] = await web3_js_1.PublicKey.findProgramAddress([
|
|
215
|
-
voteAccountAddress.toBuffer(),
|
|
216
|
-
stakedSolPoolPk.toBuffer(),
|
|
217
|
-
seed ? new bn_js_1.default(seed).toArrayLike(Buffer, 'le', 4) : Buffer.alloc(0),
|
|
218
|
-
], programId);
|
|
219
|
-
return publicKey;
|
|
220
|
-
}
|
|
221
|
-
async function findTransientStakeProgramAddress(programId, voteAccountAddress, stakePoolAddress, seed) {
|
|
222
|
-
const [publicKey] = await web3_js_1.PublicKey.findProgramAddress([
|
|
223
|
-
exports.TRANSIENT_STAKE_SEED_PREFIX,
|
|
224
|
-
voteAccountAddress.toBuffer(),
|
|
225
|
-
stakePoolAddress.toBuffer(),
|
|
226
|
-
seed.toArrayLike(Buffer, 'le', 8),
|
|
227
|
-
], programId);
|
|
228
|
-
return publicKey;
|
|
229
|
-
}
|
|
230
|
-
function calcPoolTokensForDeposit(stakePool, stakeLamports) {
|
|
231
|
-
if (stakePool.poolTokenSupply.isZero() || stakePool.totalLamports.isZero()) {
|
|
232
|
-
return stakeLamports;
|
|
233
|
-
}
|
|
234
|
-
const numerator = stakeLamports.mul(stakePool.poolTokenSupply);
|
|
235
|
-
return numerator.div(stakePool.totalLamports);
|
|
236
|
-
}
|
|
237
|
-
function calcLamportsWithdrawAmount(stakePool, poolTokens) {
|
|
238
|
-
const numerator = poolTokens.mul(stakePool.totalLamports);
|
|
239
|
-
const denominator = stakePool.poolTokenSupply;
|
|
240
|
-
if (numerator.lt(denominator)) {
|
|
241
|
-
return new bn_js_1.default(0);
|
|
242
|
-
}
|
|
243
|
-
return numerator.div(denominator);
|
|
244
|
-
}
|
|
245
|
-
exports.StakeAccountType = (0, superstruct_1.enums)(['uninitialized', 'initialized', 'delegated', 'rewardsPool']);
|
|
246
|
-
exports.StakeMeta = (0, superstruct_1.type)({
|
|
247
|
-
rentExemptReserve: exports.BigNumFromString,
|
|
248
|
-
authorized: (0, superstruct_1.type)({
|
|
249
|
-
staker: exports.PublicKeyFromString,
|
|
250
|
-
withdrawer: exports.PublicKeyFromString,
|
|
251
|
-
}),
|
|
252
|
-
lockup: (0, superstruct_1.type)({
|
|
253
|
-
unixTimestamp: (0, superstruct_1.number)(),
|
|
254
|
-
epoch: (0, superstruct_1.number)(),
|
|
255
|
-
custodian: exports.PublicKeyFromString,
|
|
256
|
-
}),
|
|
257
|
-
});
|
|
258
|
-
const StakeAccountInfo = (0, superstruct_1.type)({
|
|
259
|
-
meta: exports.StakeMeta,
|
|
260
|
-
stake: (0, superstruct_1.nullable)((0, superstruct_1.type)({
|
|
261
|
-
delegation: (0, superstruct_1.type)({
|
|
262
|
-
voter: exports.PublicKeyFromString,
|
|
263
|
-
stake: exports.BigNumFromString,
|
|
264
|
-
activationEpoch: exports.BigNumFromString,
|
|
265
|
-
deactivationEpoch: exports.BigNumFromString,
|
|
266
|
-
warmupCooldownRate: (0, superstruct_1.number)(),
|
|
267
|
-
}),
|
|
268
|
-
creditsObserved: (0, superstruct_1.number)(),
|
|
269
|
-
})),
|
|
270
|
-
});
|
|
271
|
-
exports.StakeAccount = (0, superstruct_1.type)({
|
|
272
|
-
type: exports.StakeAccountType,
|
|
273
|
-
info: StakeAccountInfo,
|
|
274
|
-
});
|
|
275
|
-
//# sourceMappingURL=standardStakePool.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"standardStakePool.js","sourceRoot":"","sources":["../../src/classes/standardStakePool.ts"],"names":[],"mappings":";;;;;;AAcA,oDAMC;AAED,4CAMC;AAED,4DAeC;AAED,oFA+BC;AAuFD,sDAyDC;AAoCD,kFAMC;AAED,0DAeC;AAED,4EAgBC;AAUD,gEAOC;AA5TD,2DAAmG;AACnG,2DAAoE;AACpE,6CAA8E;AAC9E,mDAAqE;AACrE,kDAAuB;AACvB,oDAA4B;AAC5B,6CAAmE;AAEtD,QAAA,2BAA2B,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AACvD,QAAA,4BAA4B,GAAG,SAAS,CAAC;AACtD,MAAM,oBAAoB,GAAG,SAAS,CAAC;AACvC,6FAA6F;AAC7F,MAAM,sCAAsC,GAAG,oCAA4B,GAAG,oBAAoB,CAAC;AAE5F,KAAK,UAAU,oBAAoB,CAAC,OAAkB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AC;AAIY,QAAA,gBAAgB,GAAG,IAAA,mBAAK,EAAC,CAAC,eAAe,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC;AAGvF,QAAA,SAAS,GAAG,IAAA,kBAAI,EAAC;IAC5B,iBAAiB,EAAE,wBAAgB;IACnC,UAAU,EAAE,IAAA,kBAAI,EAAC;QACf,MAAM,EAAE,2BAAmB;QAC3B,UAAU,EAAE,2BAAmB;KAChC,CAAC;IACF,MAAM,EAAE,IAAA,kBAAI,EAAC;QACX,aAAa,EAAE,IAAA,oBAAM,GAAE;QACvB,KAAK,EAAE,IAAA,oBAAM,GAAE;QACf,SAAS,EAAE,2BAAmB;KAC/B,CAAC;CACH,CAAC,CAAC;AAGH,MAAM,gBAAgB,GAAG,IAAA,kBAAI,EAAC;IAC5B,IAAI,EAAE,iBAAS;IACf,KAAK,EAAE,IAAA,sBAAQ,EACb,IAAA,kBAAI,EAAC;QACH,UAAU,EAAE,IAAA,kBAAI,EAAC;YACf,KAAK,EAAE,2BAAmB;YAC1B,KAAK,EAAE,wBAAgB;YACvB,eAAe,EAAE,wBAAgB;YACjC,iBAAiB,EAAE,wBAAgB;YACnC,kBAAkB,EAAE,IAAA,oBAAM,GAAE;SAC7B,CAAC;QACF,eAAe,EAAE,IAAA,oBAAM,GAAE;KAC1B,CAAC,CACH;CACF,CAAC,CAAC;AAGU,QAAA,YAAY,GAAG,IAAA,kBAAI,EAAC;IAC/B,IAAI,EAAE,wBAAgB;IACtB,IAAI,EAAE,gBAAgB;CACvB,CAAC,CAAC"}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { Connection, Keypair, PublicKey, TransactionInstruction } from '@solana/web3.js';
|
|
2
|
-
import { PoolState } from '../idl_codegen_unstaking_pool/accounts';
|
|
3
|
-
import { InitPoolIxs, MintIxs, SyncVaultLUTIxs, UpdatePoolConfigIxs } from './types';
|
|
4
|
-
import { PoolConfigFieldKind } from '../idl_codegen_unstaking_pool/types';
|
|
5
|
-
import BN from 'bn.js';
|
|
6
|
-
import { StakeAccount } from './standardStakePool';
|
|
7
|
-
export declare const unstakingPoolId: PublicKey;
|
|
8
|
-
export declare const unstakingPoolStagingId: PublicKey;
|
|
9
|
-
export declare const STAKE_PROGRAM_ID: PublicKey;
|
|
10
|
-
export declare const CLOCK_PROGRAM_ID: PublicKey;
|
|
11
|
-
/**
|
|
12
|
-
* KaminoPoolClient is a class that provides a high-level interface to interact with the Kamino Pool program.
|
|
13
|
-
*/
|
|
14
|
-
export declare class UnstakingPoolClient {
|
|
15
|
-
private readonly _connection;
|
|
16
|
-
private readonly _unstakingPoolProgramId;
|
|
17
|
-
constructor(connection: Connection, unstakingPoolprogramId?: PublicKey);
|
|
18
|
-
getConnection(): Connection;
|
|
19
|
-
getProgramID(): PublicKey;
|
|
20
|
-
/**
|
|
21
|
-
* This method will create a pool with a given config. The config can be changed later on, but it is recommended to set it up correctly from the start
|
|
22
|
-
* @param poolConfig - the config object used to create a pool
|
|
23
|
-
* @returns pool - keypair, should be used to sign the transaction which creates the pool account
|
|
24
|
-
* @returns pool: the keypair of the pool, used to sign the initialization transaction; initPoolIxs: a struct with ixs to initialize the pool and its lookup table + populateLUTIxs, a list to populate the lookup table which has to be executed in a separate transaction
|
|
25
|
-
*/
|
|
26
|
-
createPoolIxs(poolConfig: UnstakingPoolConfig): Promise<{
|
|
27
|
-
pool: Keypair;
|
|
28
|
-
initPoolIxs: InitPoolIxs;
|
|
29
|
-
}>;
|
|
30
|
-
/**
|
|
31
|
-
* Update pool configuration such as admin authority (or fees/minimum depositable in the future)
|
|
32
|
-
* @param poolState - the pool to update and set the LUT for if needed or only the pool pubkey if updating LUT is not needed
|
|
33
|
-
* @param admin - admin of the specified pool
|
|
34
|
-
* @param mode - what field to update for pool
|
|
35
|
-
* @param value - new value that is converted .toString()
|
|
36
|
-
* @returns a struct that contains a list of ix to update the pool config + a list of ixs to insert all new accounts in the LUT
|
|
37
|
-
*/
|
|
38
|
-
updatePoolConfigIxs(poolState: UnstakingPool | PublicKey, admin: PublicKey, mode: PoolConfigFieldKind, value: string): Promise<UpdatePoolConfigIxs>;
|
|
39
|
-
/**
|
|
40
|
-
* Collect a stake account SOL if the needed epoch was reached
|
|
41
|
-
* @param poolState - the pool to collect SOL into
|
|
42
|
-
* @param payer - payer for the operation (ix is permissionless)
|
|
43
|
-
* @param stakeAccount - stake account that was deactivated this epoch and has base pool authority as owner
|
|
44
|
-
* @returns collect instruction
|
|
45
|
-
*/
|
|
46
|
-
collectIx(poolState: UnstakingPool, payer: PublicKey, stakeAccount: PublicKey): Promise<TransactionInstruction>;
|
|
47
|
-
/**
|
|
48
|
-
* Burn a number of shares (USOL) in exchange for SOL
|
|
49
|
-
* @param poolState - the pool to burn USOL from
|
|
50
|
-
* @param user - user that burns (ix is not gated by action authority)
|
|
51
|
-
* @param sharesToBurn - number of shares that are equivalent 1:1 with SOL
|
|
52
|
-
* @returns burn instruction
|
|
53
|
-
*/
|
|
54
|
-
burnIx(poolState: UnstakingPool, user: PublicKey, sharesToBurn: BN): Promise<TransactionInstruction>;
|
|
55
|
-
/**
|
|
56
|
-
* Mints a number of unstaking sol (USOL) in exchange for staked SOL
|
|
57
|
-
* NOTE: this ix is permissioned by action authority
|
|
58
|
-
* @param poolState - the pool to mint USOL from
|
|
59
|
-
* @param user - user that mints
|
|
60
|
-
* @param stakedSolMint - staked sol mint
|
|
61
|
-
* @param stakedSolToDeposit - staked sol to convert to USOL (at the pool ratio)
|
|
62
|
-
* @returns burn instruction
|
|
63
|
-
*/
|
|
64
|
-
mintIx(poolState: UnstakingPool, user: PublicKey, stakedSolMint: PublicKey, stakedSolToDeposit: BN): Promise<MintIxs>;
|
|
65
|
-
/**
|
|
66
|
-
* Sync a pool for lookup table; create and set the LUT for the pool if needed and fill it with all the needed accounts
|
|
67
|
-
* @param pool the pool to sync and set the LUT for if needed
|
|
68
|
-
* @param poolReserves optional; the state of the reserves in the pool allocation
|
|
69
|
-
* @returns a struct that contains a list of ix to create the LUT and assign it to the pool if needed + a list of ixs to insert all the accounts in the LUT
|
|
70
|
-
*/
|
|
71
|
-
syncPoolLookupTable(pool: UnstakingPool): Promise<SyncVaultLUTIxs>;
|
|
72
|
-
getInitLookupTableIx(payer: PublicKey, slot: number): [TransactionInstruction, PublicKey];
|
|
73
|
-
insertIntoLookupTableIxs(payer: PublicKey, lookupTable: PublicKey, keys: PublicKey[], accountsInLUT?: PublicKey[]): Promise<TransactionInstruction[]>;
|
|
74
|
-
/**
|
|
75
|
-
*
|
|
76
|
-
* @param connection
|
|
77
|
-
* @param lookupTable
|
|
78
|
-
* @returns
|
|
79
|
-
*/
|
|
80
|
-
getAccountsInLUT(lookupTable: PublicKey): Promise<PublicKey[]>;
|
|
81
|
-
deactivateLookupTableIx(payer: PublicKey, lookupTable: PublicKey): TransactionInstruction;
|
|
82
|
-
closeLookupTableIx(payer: PublicKey, lookupTable: PublicKey): TransactionInstruction;
|
|
83
|
-
/**
|
|
84
|
-
* Get all pools
|
|
85
|
-
* @returns an array of all pools
|
|
86
|
-
*/
|
|
87
|
-
getAllPools(): Promise<UnstakingPool[]>;
|
|
88
|
-
}
|
|
89
|
-
export declare class UnstakingPool {
|
|
90
|
-
readonly address: PublicKey;
|
|
91
|
-
state: PoolState | undefined | null;
|
|
92
|
-
programId: PublicKey;
|
|
93
|
-
constructor(poolAddress: PublicKey, state?: PoolState, programId?: PublicKey);
|
|
94
|
-
getState(connection: Connection): Promise<PoolState>;
|
|
95
|
-
reloadState(connection: Connection): Promise<PoolState>;
|
|
96
|
-
getStakeAccountsForPool(connection: Connection): Promise<Array<StakeAccountInfo>>;
|
|
97
|
-
}
|
|
98
|
-
export declare class StakeAccountInfo {
|
|
99
|
-
readonly pk: PublicKey;
|
|
100
|
-
readonly stakeAccount: StakeAccount;
|
|
101
|
-
readonly lamports: number;
|
|
102
|
-
constructor(pk: PublicKey, stakeAccount: StakeAccount, lamports: number);
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Used to initialize a Kamino Pool
|
|
106
|
-
*/
|
|
107
|
-
export declare class UnstakingPoolConfig {
|
|
108
|
-
/** The admin of the pool */
|
|
109
|
-
readonly admin: PublicKey;
|
|
110
|
-
/** Pubkey that can mint new tokens */
|
|
111
|
-
readonly actionAuthority: PublicKey | null;
|
|
112
|
-
constructor(args: {
|
|
113
|
-
admin: PublicKey;
|
|
114
|
-
actionAuthority: PublicKey | null;
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
//# sourceMappingURL=unstakingPool.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unstakingPool.d.ts","sourceRoot":"","sources":["../../src/classes/unstakingPool.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EAEV,OAAO,EACP,SAAS,EAKT,sBAAsB,EACvB,MAAM,iBAAiB,CAAC;AAkBzB,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AAInE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AACrF,OAAO,EAAmB,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC3F,OAAO,EAAE,MAAM,OAAO,CAAC;AAGvB,OAAO,EAAwC,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACzF,eAAO,MAAM,eAAe,WAA+D,CAAC;AAC5F,eAAO,MAAM,sBAAsB,WAA+D,CAAC;AACnG,eAAO,MAAM,gBAAgB,WAA+D,CAAC;AAC7F,eAAO,MAAM,gBAAgB,WAA+D,CAAC;AAM7F;;GAEG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAa;IACzC,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAY;gBAExC,UAAU,EAAE,UAAU,EAAE,sBAAsB,CAAC,EAAE,SAAS;IAKtE,aAAa;IAIb,YAAY;IAIZ;;;;;OAKG;IACG,aAAa,CAAC,UAAU,EAA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