@kamino-finance/klend-sdk 5.10.27 → 5.10.28-beta.1
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 +3 -0
- package/dist/classes/index.d.ts.map +1 -1
- package/dist/classes/index.js +3 -0
- package/dist/classes/index.js.map +1 -1
- package/dist/classes/stakePool.d.ts +8 -0
- package/dist/classes/stakePool.d.ts.map +1 -0
- package/dist/classes/stakePool.js +18 -0
- package/dist/classes/stakePool.js.map +1 -0
- package/dist/classes/standardStakePool.d.ts +174 -0
- package/dist/classes/standardStakePool.d.ts.map +1 -0
- package/dist/classes/standardStakePool.js +275 -0
- package/dist/classes/standardStakePool.js.map +1 -0
- package/dist/classes/types.d.ts +13 -1
- package/dist/classes/types.d.ts.map +1 -1
- package/dist/classes/unstakingPool.d.ts +117 -0
- package/dist/classes/unstakingPool.d.ts.map +1 -0
- package/dist/classes/unstakingPool.js +448 -0
- package/dist/classes/unstakingPool.js.map +1 -0
- package/dist/idl_codegen_unstaking_pool/accounts/PoolState.d.ts +50 -0
- package/dist/idl_codegen_unstaking_pool/accounts/PoolState.d.ts.map +1 -0
- package/dist/idl_codegen_unstaking_pool/accounts/PoolState.js +156 -0
- package/dist/idl_codegen_unstaking_pool/accounts/PoolState.js.map +1 -0
- package/dist/idl_codegen_unstaking_pool/accounts/index.d.ts +3 -0
- package/dist/idl_codegen_unstaking_pool/accounts/index.d.ts.map +1 -0
- package/dist/idl_codegen_unstaking_pool/accounts/index.js +6 -0
- package/dist/idl_codegen_unstaking_pool/accounts/index.js.map +1 -0
- package/dist/idl_codegen_unstaking_pool/errors/anchor.d.ts +435 -0
- package/dist/idl_codegen_unstaking_pool/errors/anchor.d.ts.map +1 -0
- package/dist/idl_codegen_unstaking_pool/errors/anchor.js +767 -0
- package/dist/idl_codegen_unstaking_pool/errors/anchor.js.map +1 -0
- package/dist/idl_codegen_unstaking_pool/errors/custom.d.ts +163 -0
- package/dist/idl_codegen_unstaking_pool/errors/custom.d.ts.map +1 -0
- package/dist/idl_codegen_unstaking_pool/errors/custom.js +290 -0
- package/dist/idl_codegen_unstaking_pool/errors/custom.js.map +1 -0
- package/dist/idl_codegen_unstaking_pool/errors/index.d.ts +6 -0
- package/dist/idl_codegen_unstaking_pool/errors/index.d.ts.map +1 -0
- package/dist/idl_codegen_unstaking_pool/errors/index.js +75 -0
- package/dist/idl_codegen_unstaking_pool/errors/index.js.map +1 -0
- package/dist/idl_codegen_unstaking_pool/instructions/burn.d.ts +21 -0
- package/dist/idl_codegen_unstaking_pool/instructions/burn.d.ts.map +1 -0
- package/dist/idl_codegen_unstaking_pool/instructions/burn.js +73 -0
- package/dist/idl_codegen_unstaking_pool/instructions/burn.js.map +1 -0
- package/dist/idl_codegen_unstaking_pool/instructions/collect.d.ts +16 -0
- package/dist/idl_codegen_unstaking_pool/instructions/collect.d.ts.map +1 -0
- package/dist/idl_codegen_unstaking_pool/instructions/collect.js +29 -0
- package/dist/idl_codegen_unstaking_pool/instructions/collect.js.map +1 -0
- package/dist/idl_codegen_unstaking_pool/instructions/index.d.ts +11 -0
- package/dist/idl_codegen_unstaking_pool/instructions/index.d.ts.map +1 -0
- package/dist/idl_codegen_unstaking_pool/instructions/index.js +14 -0
- package/dist/idl_codegen_unstaking_pool/instructions/index.js.map +1 -0
- package/dist/idl_codegen_unstaking_pool/instructions/initializePool.d.ts +15 -0
- package/dist/idl_codegen_unstaking_pool/instructions/initializePool.d.ts.map +1 -0
- package/dist/idl_codegen_unstaking_pool/instructions/initializePool.js +28 -0
- package/dist/idl_codegen_unstaking_pool/instructions/initializePool.js.map +1 -0
- package/dist/idl_codegen_unstaking_pool/instructions/mint.d.ts +21 -0
- package/dist/idl_codegen_unstaking_pool/instructions/mint.d.ts.map +1 -0
- package/dist/idl_codegen_unstaking_pool/instructions/mint.js +77 -0
- package/dist/idl_codegen_unstaking_pool/instructions/mint.js.map +1 -0
- package/dist/idl_codegen_unstaking_pool/instructions/updatePoolConfig.d.ts +13 -0
- package/dist/idl_codegen_unstaking_pool/instructions/updatePoolConfig.d.ts.map +1 -0
- package/dist/idl_codegen_unstaking_pool/instructions/updatePoolConfig.js +58 -0
- package/dist/idl_codegen_unstaking_pool/instructions/updatePoolConfig.js.map +1 -0
- package/dist/idl_codegen_unstaking_pool/programId.d.ts +4 -0
- package/dist/idl_codegen_unstaking_pool/programId.d.ts.map +1 -0
- package/dist/idl_codegen_unstaking_pool/programId.js +9 -0
- package/dist/idl_codegen_unstaking_pool/programId.js.map +1 -0
- package/dist/idl_codegen_unstaking_pool/types/PoolConfigField.d.ts +32 -0
- package/dist/idl_codegen_unstaking_pool/types/PoolConfigField.d.ts.map +1 -0
- package/dist/idl_codegen_unstaking_pool/types/PoolConfigField.js +105 -0
- package/dist/idl_codegen_unstaking_pool/types/PoolConfigField.js.map +1 -0
- package/dist/idl_codegen_unstaking_pool/types/index.d.ts +5 -0
- package/dist/idl_codegen_unstaking_pool/types/index.d.ts.map +1 -0
- package/dist/idl_codegen_unstaking_pool/types/index.js +39 -0
- package/dist/idl_codegen_unstaking_pool/types/index.js.map +1 -0
- package/package.json +4 -1
- package/src/classes/index.ts +3 -0
- package/src/classes/stakePool.ts +21 -0
- package/src/classes/standardStakePool.ts +358 -0
- package/src/classes/types.ts +17 -1
- package/src/classes/unstakingPool.ts +577 -0
- package/src/idl_codegen_unstaking_pool/accounts/PoolState.ts +163 -0
- package/src/idl_codegen_unstaking_pool/accounts/index.ts +2 -0
- package/src/idl_codegen_unstaking_pool/errors/anchor.ts +764 -0
- package/src/idl_codegen_unstaking_pool/errors/custom.ts +288 -0
- package/src/idl_codegen_unstaking_pool/errors/index.ts +49 -0
- package/src/idl_codegen_unstaking_pool/instructions/burn.ts +60 -0
- package/src/idl_codegen_unstaking_pool/instructions/collect.ts +43 -0
- package/src/idl_codegen_unstaking_pool/instructions/index.ts +10 -0
- package/src/idl_codegen_unstaking_pool/instructions/initializePool.ts +41 -0
- package/src/idl_codegen_unstaking_pool/instructions/mint.ts +64 -0
- package/src/idl_codegen_unstaking_pool/instructions/updatePoolConfig.ts +40 -0
- package/src/idl_codegen_unstaking_pool/programId.ts +7 -0
- package/src/idl_codegen_unstaking_pool/types/PoolConfigField.ts +85 -0
- package/src/idl_codegen_unstaking_pool/types/index.ts +6 -0
- package/src/idl_unstaking_pool.json +456 -0
package/dist/classes/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/classes/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/classes/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC"}
|
package/dist/classes/index.js
CHANGED
|
@@ -25,4 +25,7 @@ __exportStar(require("./jupiterPerps"), exports);
|
|
|
25
25
|
__exportStar(require("./manager"), exports);
|
|
26
26
|
__exportStar(require("./vault"), exports);
|
|
27
27
|
__exportStar(require("./fraction"), exports);
|
|
28
|
+
__exportStar(require("./standardStakePool"), exports);
|
|
29
|
+
__exportStar(require("./stakePool"), exports);
|
|
30
|
+
__exportStar(require("./unstakingPool"), exports);
|
|
28
31
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/classes/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,0CAAwB;AACxB,2CAAyB;AACzB,+CAA6B;AAC7B,4CAA0B;AAC1B,2CAAyB;AACzB,0CAAwB;AACxB,iDAA+B;AAC/B,4CAA0B;AAC1B,0CAAwB;AACxB,6CAA2B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/classes/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,0CAAwB;AACxB,2CAAyB;AACzB,+CAA6B;AAC7B,4CAA0B;AAC1B,2CAAyB;AACzB,0CAAwB;AACxB,iDAA+B;AAC/B,4CAA0B;AAC1B,0CAAwB;AACxB,6CAA2B;AAC3B,sDAAoC;AACpC,8CAA4B;AAC5B,kDAAgC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Connection, PublicKey } from '@solana/web3.js/lib';
|
|
2
|
+
import { StakePool as StandardStakePool } from '@solana/spl-stake-pool/dist/layouts';
|
|
3
|
+
export type GenericStakePool = StandardStakePool;
|
|
4
|
+
export declare enum StakePoolType {
|
|
5
|
+
Standard = 0
|
|
6
|
+
}
|
|
7
|
+
export declare function mapStakedSolMintToPool(connection: Connection, mint: PublicKey): Promise<[GenericStakePool, PublicKey, StakePoolType]>;
|
|
8
|
+
//# sourceMappingURL=stakePool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stakePool.d.ts","sourceRoot":"","sources":["../../src/classes/stakePool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,EAAE,SAAS,IAAI,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAGrF,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,CAAC;AACjD,oBAAY,aAAa;IACvB,QAAQ,IAAA;CACT;AAED,wBAAsB,sBAAsB,CAC1C,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,SAAS,GACd,OAAO,CAAC,CAAC,gBAAgB,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC,CAOvD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StakePoolType = void 0;
|
|
4
|
+
exports.mapStakedSolMintToPool = mapStakedSolMintToPool;
|
|
5
|
+
const standardStakePool_1 = require("./standardStakePool");
|
|
6
|
+
var StakePoolType;
|
|
7
|
+
(function (StakePoolType) {
|
|
8
|
+
StakePoolType[StakePoolType["Standard"] = 0] = "Standard";
|
|
9
|
+
})(StakePoolType || (exports.StakePoolType = StakePoolType = {}));
|
|
10
|
+
async function mapStakedSolMintToPool(connection, mint) {
|
|
11
|
+
// We cannot know which pool the mint corresponds to, so we fetch them program by program
|
|
12
|
+
const maybeStandardPoolAndKey = await (0, standardStakePool_1.maybeGetStakedPoolByMint)(connection, mint);
|
|
13
|
+
if (maybeStandardPoolAndKey) {
|
|
14
|
+
return [...maybeStandardPoolAndKey, StakePoolType.Standard];
|
|
15
|
+
}
|
|
16
|
+
throw new Error(`Cannot map mint ${mint} to staked sol pool`);
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=stakePool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stakePool.js","sourceRoot":"","sources":["../../src/classes/stakePool.ts"],"names":[],"mappings":";;;AAUA,wDAUC;AAnBD,2DAA+D;AAK/D,IAAY,aAEX;AAFD,WAAY,aAAa;IACvB,yDAAQ,CAAA;AACV,CAAC,EAFW,aAAa,6BAAb,aAAa,QAExB;AAEM,KAAK,UAAU,sBAAsB,CAC1C,UAAsB,EACtB,IAAe;IAEf,yFAAyF;IACzF,MAAM,uBAAuB,GAAG,MAAM,IAAA,4CAAwB,EAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACjF,IAAI,uBAAuB,EAAE,CAAC;QAC5B,OAAO,CAAC,GAAG,uBAAuB,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC9D,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,qBAAqB,CAAC,CAAC;AAChE,CAAC"}
|
|
@@ -0,0 +1,174 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,CAAC;AAE9E,OAAO,EAAE,MAAM,OAAO,CAAC;AAEvB,OAAO,EAAS,KAAK,EAA0B,MAAM,aAAa,CAAC;AAEnE,eAAO,MAAM,2BAA2B,qBAA2B,CAAC;AACpE,eAAO,MAAM,4BAA4B,UAAY,CAAC;AAKtD,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,UAA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AE,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"}
|
|
@@ -0,0 +1,275 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,EAAE,UAAsB;IACnF,MAAM,WAAW,GAAG,MAAM,UAAU,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IAC7D,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,4CAA4C,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IACpF,CAAC;IACD,OAAO,gCAAe,CAAC,M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,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"}
|
package/dist/classes/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TransactionInstruction } from '@solana/web3.js';
|
|
1
|
+
import { Keypair, TransactionInstruction } from '@solana/web3.js';
|
|
2
2
|
import Decimal from 'decimal.js/decimal';
|
|
3
3
|
/** the populateLUTIxs should be executed in a separate transaction as we cannot create and populate a lookup table in the same tx */
|
|
4
4
|
export type InitVaultIxs = {
|
|
@@ -45,4 +45,16 @@ export type ReserveAllocationOverview = {
|
|
|
45
45
|
tokenAllocationCap: Decimal;
|
|
46
46
|
ctokenAllocation: Decimal;
|
|
47
47
|
};
|
|
48
|
+
export type InitPoolIxs = {
|
|
49
|
+
initPoolIxs: TransactionInstruction[];
|
|
50
|
+
populateLUTIxs: TransactionInstruction[];
|
|
51
|
+
};
|
|
52
|
+
export type UpdatePoolConfigIxs = {
|
|
53
|
+
updatePoolConfigIx: TransactionInstruction;
|
|
54
|
+
updateLUTIxs: TransactionInstruction[];
|
|
55
|
+
};
|
|
56
|
+
export type MintIxs = {
|
|
57
|
+
mintIx: TransactionInstruction;
|
|
58
|
+
additionalSigners: Keypair[];
|
|
59
|
+
};
|
|
48
60
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/classes/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/classes/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,OAAO,MAAM,oBAAoB,CAAC;AAEzC,qIAAqI;AACrI,MAAM,MAAM,YAAY,GAAG;IACzB,YAAY,EAAE,sBAAsB,EAAE,CAAC;IACvC,WAAW,EAAE,sBAAsB,CAAC;IACpC,cAAc,EAAE,sBAAsB,EAAE,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,sBAAsB,EAAE,sBAAsB,CAAC;IAC/C,YAAY,EAAE,sBAAsB,CAAC;IACrC,YAAY,EAAE,sBAAsB,EAAE,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,yBAAyB,EAAE,sBAAsB,CAAC;IAClD,YAAY,EAAE,sBAAsB,EAAE,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,mBAAmB,EAAE,sBAAsB,CAAC;IAC5C,YAAY,EAAE,sBAAsB,EAAE,CAAC;CACxC,CAAC;AAEF,+IAA+I;AAC/I,MAAM,MAAM,eAAe,GAAG;IAC5B,mBAAmB,EAAE,sBAAsB,EAAE,CAAC;IAC9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