@kamino-finance/klend-sdk 7.1.1 → 7.1.2
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/@codegen/unstaking_pool/accounts/PoolState.d.ts +53 -0
- package/dist/@codegen/unstaking_pool/accounts/PoolState.d.ts.map +1 -0
- package/dist/@codegen/unstaking_pool/accounts/PoolState.js +167 -0
- package/dist/@codegen/unstaking_pool/accounts/PoolState.js.map +1 -0
- package/dist/@codegen/unstaking_pool/accounts/UnstakeTicket.d.ts +41 -0
- package/dist/@codegen/unstaking_pool/accounts/UnstakeTicket.d.ts.map +1 -0
- package/dist/@codegen/unstaking_pool/accounts/UnstakeTicket.js +143 -0
- package/dist/@codegen/unstaking_pool/accounts/UnstakeTicket.js.map +1 -0
- package/dist/@codegen/unstaking_pool/accounts/index.d.ts +5 -0
- package/dist/@codegen/unstaking_pool/accounts/index.d.ts.map +1 -0
- package/dist/@codegen/unstaking_pool/accounts/index.js +8 -0
- package/dist/@codegen/unstaking_pool/accounts/index.js.map +1 -0
- package/dist/@codegen/unstaking_pool/errors/anchor.d.ts +435 -0
- package/dist/@codegen/unstaking_pool/errors/anchor.d.ts.map +1 -0
- package/dist/@codegen/unstaking_pool/errors/anchor.js +767 -0
- package/dist/@codegen/unstaking_pool/errors/anchor.js.map +1 -0
- package/dist/@codegen/unstaking_pool/errors/custom.d.ts +259 -0
- package/dist/@codegen/unstaking_pool/errors/custom.d.ts.map +1 -0
- package/dist/@codegen/unstaking_pool/errors/custom.js +458 -0
- package/dist/@codegen/unstaking_pool/errors/custom.js.map +1 -0
- package/dist/@codegen/unstaking_pool/errors/index.d.ts +6 -0
- package/dist/@codegen/unstaking_pool/errors/index.d.ts.map +1 -0
- package/dist/@codegen/unstaking_pool/errors/index.js +86 -0
- package/dist/@codegen/unstaking_pool/errors/index.js.map +1 -0
- package/dist/@codegen/unstaking_pool/instructions/burn.d.ts +21 -0
- package/dist/@codegen/unstaking_pool/instructions/burn.d.ts.map +1 -0
- package/dist/@codegen/unstaking_pool/instructions/burn.js +67 -0
- package/dist/@codegen/unstaking_pool/instructions/burn.js.map +1 -0
- package/dist/@codegen/unstaking_pool/instructions/changeTicketAuthority.d.ts +8 -0
- package/dist/@codegen/unstaking_pool/instructions/changeTicketAuthority.d.ts.map +1 -0
- package/dist/@codegen/unstaking_pool/instructions/changeTicketAuthority.js +16 -0
- package/dist/@codegen/unstaking_pool/instructions/changeTicketAuthority.js.map +1 -0
- package/dist/@codegen/unstaking_pool/instructions/collect.d.ts +16 -0
- package/dist/@codegen/unstaking_pool/instructions/collect.d.ts.map +1 -0
- package/dist/@codegen/unstaking_pool/instructions/collect.js +24 -0
- package/dist/@codegen/unstaking_pool/instructions/collect.js.map +1 -0
- package/dist/@codegen/unstaking_pool/instructions/index.d.ts +17 -0
- package/dist/@codegen/unstaking_pool/instructions/index.d.ts.map +1 -0
- package/dist/@codegen/unstaking_pool/instructions/index.js +20 -0
- package/dist/@codegen/unstaking_pool/instructions/index.js.map +1 -0
- package/dist/@codegen/unstaking_pool/instructions/initializePool.d.ts +14 -0
- package/dist/@codegen/unstaking_pool/instructions/initializePool.d.ts.map +1 -0
- package/dist/@codegen/unstaking_pool/instructions/initializePool.js +22 -0
- package/dist/@codegen/unstaking_pool/instructions/initializePool.js.map +1 -0
- package/dist/@codegen/unstaking_pool/instructions/mint.d.ts +24 -0
- package/dist/@codegen/unstaking_pool/instructions/mint.d.ts.map +1 -0
- package/dist/@codegen/unstaking_pool/instructions/mint.js +74 -0
- package/dist/@codegen/unstaking_pool/instructions/mint.js.map +1 -0
- package/dist/@codegen/unstaking_pool/instructions/splitTicket.d.ts +15 -0
- package/dist/@codegen/unstaking_pool/instructions/splitTicket.d.ts.map +1 -0
- package/dist/@codegen/unstaking_pool/instructions/splitTicket.js +62 -0
- package/dist/@codegen/unstaking_pool/instructions/splitTicket.js.map +1 -0
- package/dist/@codegen/unstaking_pool/instructions/updateAdmin.d.ts +7 -0
- package/dist/@codegen/unstaking_pool/instructions/updateAdmin.d.ts.map +1 -0
- package/dist/@codegen/unstaking_pool/instructions/updateAdmin.js +19 -0
- package/dist/@codegen/unstaking_pool/instructions/updateAdmin.js.map +1 -0
- package/dist/@codegen/unstaking_pool/instructions/updatePoolConfig.d.ts +13 -0
- package/dist/@codegen/unstaking_pool/instructions/updatePoolConfig.d.ts.map +1 -0
- package/dist/@codegen/unstaking_pool/instructions/updatePoolConfig.js +60 -0
- package/dist/@codegen/unstaking_pool/instructions/updatePoolConfig.js.map +1 -0
- package/dist/@codegen/unstaking_pool/programId.d.ts +4 -0
- package/dist/@codegen/unstaking_pool/programId.d.ts.map +1 -0
- package/dist/@codegen/unstaking_pool/programId.js +9 -0
- package/dist/@codegen/unstaking_pool/programId.js.map +1 -0
- package/dist/@codegen/unstaking_pool/types/PoolConfigField.d.ts +45 -0
- package/dist/@codegen/unstaking_pool/types/PoolConfigField.d.ts.map +1 -0
- package/dist/@codegen/unstaking_pool/types/PoolConfigField.js +132 -0
- package/dist/@codegen/unstaking_pool/types/PoolConfigField.js.map +1 -0
- package/dist/@codegen/unstaking_pool/types/index.d.ts +5 -0
- package/dist/@codegen/unstaking_pool/types/index.d.ts.map +1 -0
- package/dist/@codegen/unstaking_pool/types/index.js +39 -0
- package/dist/@codegen/unstaking_pool/types/index.js.map +1 -0
- package/dist/@codegen/unstaking_pool/utils/borshAddress.d.ts +4 -0
- package/dist/@codegen/unstaking_pool/utils/borshAddress.d.ts.map +1 -0
- package/dist/@codegen/unstaking_pool/utils/borshAddress.js +30 -0
- package/dist/@codegen/unstaking_pool/utils/borshAddress.js.map +1 -0
- package/dist/@codegen/unstaking_pool/utils/index.d.ts +2 -0
- package/dist/@codegen/unstaking_pool/utils/index.d.ts.map +1 -0
- package/dist/@codegen/unstaking_pool/utils/index.js +18 -0
- package/dist/@codegen/unstaking_pool/utils/index.js.map +1 -0
- package/dist/classes/action.d.ts.map +1 -1
- package/dist/classes/action.js +5 -5
- package/dist/classes/action.js.map +1 -1
- package/dist/classes/index.d.ts +5 -0
- package/dist/classes/index.d.ts.map +1 -1
- package/dist/classes/index.js +5 -0
- package/dist/classes/index.js.map +1 -1
- package/dist/classes/manager.d.ts.map +1 -1
- package/dist/classes/manager.js +2 -3
- package/dist/classes/manager.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 +76 -0
- package/dist/classes/standardStakePool.d.ts.map +1 -0
- package/dist/classes/standardStakePool.js +400 -0
- package/dist/classes/standardStakePool.js.map +1 -0
- package/dist/classes/unstakingPool.d.ts +115 -0
- package/dist/classes/unstakingPool.d.ts.map +1 -0
- package/dist/classes/unstakingPool.js +372 -0
- package/dist/classes/unstakingPool.js.map +1 -0
- package/dist/classes/unstakingPoolTypes.d.ts +10 -0
- package/dist/classes/unstakingPoolTypes.d.ts.map +1 -0
- package/dist/classes/unstakingPoolTypes.js +3 -0
- package/dist/classes/unstakingPoolTypes.js.map +1 -0
- package/dist/classes/vault.d.ts +0 -9
- package/dist/classes/vault.d.ts.map +1 -1
- package/dist/classes/vault.js +6 -41
- package/dist/classes/vault.js.map +1 -1
- package/dist/lib.d.ts +1 -0
- package/dist/lib.d.ts.map +1 -1
- package/dist/lib.js +3 -1
- package/dist/lib.js.map +1 -1
- package/dist/utils/lookupTable.d.ts +9 -0
- package/dist/utils/lookupTable.d.ts.map +1 -1
- package/dist/utils/lookupTable.js +37 -0
- package/dist/utils/lookupTable.js.map +1 -1
- package/package.json +3 -1
- package/src/@codegen/unstaking_pool/accounts/PoolState.ts +188 -0
- package/src/@codegen/unstaking_pool/accounts/UnstakeTicket.ts +156 -0
- package/src/@codegen/unstaking_pool/accounts/index.ts +4 -0
- package/src/@codegen/unstaking_pool/errors/anchor.ts +773 -0
- package/src/@codegen/unstaking_pool/errors/custom.ts +477 -0
- package/src/@codegen/unstaking_pool/errors/index.ts +68 -0
- package/src/@codegen/unstaking_pool/instructions/burn.ts +70 -0
- package/src/@codegen/unstaking_pool/instructions/changeTicketAuthority.ts +37 -0
- package/src/@codegen/unstaking_pool/instructions/collect.ts +53 -0
- package/src/@codegen/unstaking_pool/instructions/index.ts +19 -0
- package/src/@codegen/unstaking_pool/instructions/initializePool.ts +49 -0
- package/src/@codegen/unstaking_pool/instructions/mint.ts +80 -0
- package/src/@codegen/unstaking_pool/instructions/splitTicket.ts +59 -0
- package/src/@codegen/unstaking_pool/instructions/updateAdmin.ts +39 -0
- package/src/@codegen/unstaking_pool/instructions/updatePoolConfig.ts +58 -0
- package/src/@codegen/unstaking_pool/programId.ts +9 -0
- package/src/@codegen/unstaking_pool/types/PoolConfigField.ts +121 -0
- package/src/@codegen/unstaking_pool/types/index.ts +12 -0
- package/src/@codegen/unstaking_pool/utils/borshAddress.ts +43 -0
- package/src/@codegen/unstaking_pool/utils/index.ts +1 -0
- package/src/classes/action.ts +10 -5
- package/src/classes/index.ts +5 -0
- package/src/classes/manager.ts +3 -4
- package/src/classes/stakePool.ts +21 -0
- package/src/classes/standardStakePool.ts +487 -0
- package/src/classes/unstakingPool.ts +504 -0
- package/src/classes/unstakingPoolTypes.ts +12 -0
- package/src/classes/vault.ts +43 -56
- package/src/idl/unstaking_pool.json +662 -0
- package/src/lib.ts +1 -0
- package/src/utils/lookupTable.ts +48 -0
package/dist/lib.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,gEAA8C;AAC9C,4DAA0C;AAC1C,6DAA2C;AAC3C,gEAA8C;AAE9C,iEAA+C;AAC/C,6GAA6G;AAC7G,wEAAsD;AACtD,0DAAwC;AACxC,yDAA+E;AAAtE,+GAAA,UAAU,OAAsB;
|
|
1
|
+
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,gEAA8C;AAC9C,4DAA0C;AAC1C,6DAA2C;AAC3C,gEAA8C;AAE9C,iEAA+C;AAC/C,6GAA6G;AAC7G,wEAAsD;AACtD,0DAAwC;AACxC,yDAA+E;AAAtE,+GAAA,UAAU,OAAsB;AACzC,iEAAsF;AAA7E,8GAAA,UAAU,OAAqB;AAExC,4CAA0B;AAC1B,0CAAwB;AACxB,6CAA2B;AAC3B,8CAA4B;AAC5B,uDAAqC;AACrC,sDAAoC"}
|
|
@@ -31,4 +31,13 @@ export declare function closeLookupTableIx(authority: TransactionSigner, lookupT
|
|
|
31
31
|
* @returns - an array of accounts in the lookup table
|
|
32
32
|
*/
|
|
33
33
|
export declare function getAccountsInLut(rpc: Rpc<GetAccountInfoApi>, lookupTable: Address): Promise<Address[]>;
|
|
34
|
+
/**
|
|
35
|
+
* This method inserts the missing keys from the provided keys into an existent lookup table
|
|
36
|
+
* @param authority - payer wallet pubkey
|
|
37
|
+
* @param lookupTable - lookup table to insert the keys into
|
|
38
|
+
* @param keys - keys to insert into the lookup table
|
|
39
|
+
* @param [accountsInLut] - the existent accounts in the lookup table. Optional. If provided, the function will not fetch the accounts in the lookup table
|
|
40
|
+
* @returns - an array of instructions to insert the missing keys into the lookup table
|
|
41
|
+
*/
|
|
42
|
+
export declare function insertIntoLookupTableIxs(rpc: Rpc<GetAccountInfoApi>, authority: TransactionSigner, lookupTable: Address, keys: Address[], accountsInLut?: Address[]): Promise<Instruction[]>;
|
|
34
43
|
//# sourceMappingURL=lookupTable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lookupTable.d.ts","sourceRoot":"","sources":["../../src/utils/lookupTable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG,EAAE,IAAI,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,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AAO,CAAC,OAAO,EAAE,CAAC,CAG5G;AACD;;;;;;;GAOG;AACH,wBAAsB,wBAAwB,CAC5C,GAAG,EAAE,GAAG,CAAC,iBAAiB,CAAC,EAC3B,SAAS,EAAE,iBAAiB,EAC5B,WAAW,EAAE,OAAO,EACpB,IAAI,EAAE,OAAO,EAAE,EACf,aAAa,CAAC,EAAE,OAAO,EAAE,GACxB,OAAO,CAAC,WAAW,EAAE,CAAC,CA+BxB"}
|
|
@@ -8,7 +8,10 @@ exports.initLookupTableIx = initLookupTableIx;
|
|
|
8
8
|
exports.deactivateLookupTableIx = deactivateLookupTableIx;
|
|
9
9
|
exports.closeLookupTableIx = closeLookupTableIx;
|
|
10
10
|
exports.getAccountsInLut = getAccountsInLut;
|
|
11
|
+
exports.insertIntoLookupTableIxs = insertIntoLookupTableIxs;
|
|
11
12
|
const address_lookup_table_1 = require("@solana-program/address-lookup-table");
|
|
13
|
+
const pubkey_1 = require("./pubkey");
|
|
14
|
+
const system_1 = require("@solana-program/system");
|
|
12
15
|
async function printAddressLookupTable(rpc, lookupTablePk) {
|
|
13
16
|
const lookupTableAccount = (await (0, address_lookup_table_1.fetchAddressLookupTable)(rpc, lookupTablePk)).data;
|
|
14
17
|
if (!lookupTableAccount) {
|
|
@@ -93,4 +96,38 @@ async function getAccountsInLut(rpc, lookupTable) {
|
|
|
93
96
|
const lutState = await (0, address_lookup_table_1.fetchAddressLookupTable)(rpc, lookupTable);
|
|
94
97
|
return lutState.data.addresses;
|
|
95
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* This method inserts the missing keys from the provided keys into an existent lookup table
|
|
101
|
+
* @param authority - payer wallet pubkey
|
|
102
|
+
* @param lookupTable - lookup table to insert the keys into
|
|
103
|
+
* @param keys - keys to insert into the lookup table
|
|
104
|
+
* @param [accountsInLut] - the existent accounts in the lookup table. Optional. If provided, the function will not fetch the accounts in the lookup table
|
|
105
|
+
* @returns - an array of instructions to insert the missing keys into the lookup table
|
|
106
|
+
*/
|
|
107
|
+
async function insertIntoLookupTableIxs(rpc, authority, lookupTable, keys, accountsInLut) {
|
|
108
|
+
let lutContentsList = accountsInLut;
|
|
109
|
+
if (!accountsInLut) {
|
|
110
|
+
lutContentsList = await getAccountsInLut(rpc, lookupTable);
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
lutContentsList = accountsInLut;
|
|
114
|
+
}
|
|
115
|
+
const lutContents = new Set(lutContentsList);
|
|
116
|
+
const missingAccounts = keys.filter((key) => !lutContents.has(key) && key !== pubkey_1.DEFAULT_PUBLIC_KEY);
|
|
117
|
+
// deduplicate missing accounts and remove default accounts and convert it back to an array
|
|
118
|
+
const missingAccountsList = [...new Set(missingAccounts)];
|
|
119
|
+
const chunkSize = 20;
|
|
120
|
+
const ixs = [];
|
|
121
|
+
for (let i = 0; i < missingAccountsList.length; i += chunkSize) {
|
|
122
|
+
const chunk = missingAccountsList.slice(i, i + chunkSize);
|
|
123
|
+
ixs.push((0, address_lookup_table_1.getExtendLookupTableInstruction)({
|
|
124
|
+
payer: authority,
|
|
125
|
+
authority,
|
|
126
|
+
address: lookupTable,
|
|
127
|
+
systemProgram: system_1.SYSTEM_PROGRAM_ADDRESS,
|
|
128
|
+
addresses: chunk,
|
|
129
|
+
}));
|
|
130
|
+
}
|
|
131
|
+
return ixs;
|
|
132
|
+
}
|
|
96
133
|
//# sourceMappingURL=lookupTable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lookupTable.js","sourceRoot":"","sources":["../../src/utils/lookupTable.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"lookupTable.js","sourceRoot":"","sources":["../../src/utils/lookupTable.ts"],"names":[],"mappings":";;;AAYA,0DASC;AAED,kDAMC;AAED,4DAYC;AAuBD,8CAYC;AAQD,0DAKC;AASD,gDAMC;AAQD,4CAGC;AASD,4DAqCC;AAlKD,+EAO8C;AAC9C,qCAA8C;AAC9C,mDAAgE;AAEzD,KAAK,UAAU,uBAAu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1
1
|
{
|
|
2
2
|
"name": "@kamino-finance/klend-sdk",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.2",
|
|
4
4
|
"description": "Typescript SDK for interacting with the Kamino Lending (klend) protocol",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"codegen:jupiter-perps": "yarn anchor-client-gen src/idl/jupiter_perps.json ./src/@codegen/jupiter_perps --program-id PERPHjGBqRHArX4DySjwM6UJHiR3sWAatqfdBS2qQJu",
|
|
49
49
|
"codegen:pyth-solana-receiver": "yarn anchor-client-gen src/idl/pyth_rec.json './src/@codegen/pyth_rec' --program-id rec5EKMGg6MxZYaMdyBfgwp4d5rB9T1VQH5pJv5LtFJ",
|
|
50
50
|
"codegen:switchboard": "yarn anchor-client-gen src/idl/switchboard_v2.json ./src/@codegen/switchboard_v2 --program-id SW1TCH7qEPTdLsDHRgPuMQjbQxKdH2aBStViMFnt64f",
|
|
51
|
+
"codegen-unstaking-pool": "yarn anchor-client-gen src/idl/unstaking_pool.json ./src/@codegen/unstaking_pool/ --program-id USo1uB8RsRuM8y8e8vbL3mwR22EzSTLyZqaJPoZvn3a",
|
|
51
52
|
"start-validator": "solana-test-validator $(./deps/test-validator-params.sh)",
|
|
52
53
|
"start-validator-and-server": "yarn start-server-and-test 'yarn start-validator' http://127.0.0.1:8899/health",
|
|
53
54
|
"start-validator-and-test": "yarn start-validator-and-server test",
|
|
@@ -72,6 +73,7 @@
|
|
|
72
73
|
"@solana/buffer-layout": "^4.0.1",
|
|
73
74
|
"@solana/compat": "^2.3.0",
|
|
74
75
|
"@solana/kit": "^2.3.0",
|
|
76
|
+
"@solana/spl-stake-pool": "^1.1.8",
|
|
75
77
|
"@solana/sysvars": "^2.3.0",
|
|
76
78
|
"@solana/web3.js": "^1.98.2",
|
|
77
79
|
"axios": "^1.6.8",
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
+
import {
|
|
3
|
+
address,
|
|
4
|
+
Address,
|
|
5
|
+
fetchEncodedAccount,
|
|
6
|
+
fetchEncodedAccounts,
|
|
7
|
+
GetAccountInfoApi,
|
|
8
|
+
GetMultipleAccountsApi,
|
|
9
|
+
Rpc,
|
|
10
|
+
} from "@solana/kit"
|
|
11
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
12
|
+
import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
13
|
+
import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
14
|
+
import { borshAddress } from "../utils" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
15
|
+
import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
16
|
+
import { PROGRAM_ID } from "../programId"
|
|
17
|
+
|
|
18
|
+
export interface PoolStateFields {
|
|
19
|
+
admin: Address
|
|
20
|
+
pendingAdmin: Address
|
|
21
|
+
basePoolAuthority: Address
|
|
22
|
+
basePoolAuthorityBump: BN
|
|
23
|
+
unstakingSolMint: Address
|
|
24
|
+
wsolVault: Address
|
|
25
|
+
actionAuthority: Address
|
|
26
|
+
poolLookupTable: Address
|
|
27
|
+
sharesIssued: BN
|
|
28
|
+
wsolUnstaking: BN
|
|
29
|
+
wsolInVault: BN
|
|
30
|
+
padding: Array<BN>
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface PoolStateJSON {
|
|
34
|
+
admin: string
|
|
35
|
+
pendingAdmin: string
|
|
36
|
+
basePoolAuthority: string
|
|
37
|
+
basePoolAuthorityBump: string
|
|
38
|
+
unstakingSolMint: string
|
|
39
|
+
wsolVault: string
|
|
40
|
+
actionAuthority: string
|
|
41
|
+
poolLookupTable: string
|
|
42
|
+
sharesIssued: string
|
|
43
|
+
wsolUnstaking: string
|
|
44
|
+
wsolInVault: string
|
|
45
|
+
padding: Array<string>
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export class PoolState {
|
|
49
|
+
readonly admin: Address
|
|
50
|
+
readonly pendingAdmin: Address
|
|
51
|
+
readonly basePoolAuthority: Address
|
|
52
|
+
readonly basePoolAuthorityBump: BN
|
|
53
|
+
readonly unstakingSolMint: Address
|
|
54
|
+
readonly wsolVault: Address
|
|
55
|
+
readonly actionAuthority: Address
|
|
56
|
+
readonly poolLookupTable: Address
|
|
57
|
+
readonly sharesIssued: BN
|
|
58
|
+
readonly wsolUnstaking: BN
|
|
59
|
+
readonly wsolInVault: BN
|
|
60
|
+
readonly padding: Array<BN>
|
|
61
|
+
|
|
62
|
+
static readonly discriminator = Buffer.from([
|
|
63
|
+
247, 237, 227, 245, 215, 195, 222, 70,
|
|
64
|
+
])
|
|
65
|
+
|
|
66
|
+
static readonly layout = borsh.struct<PoolState>([
|
|
67
|
+
borshAddress("admin"),
|
|
68
|
+
borshAddress("pendingAdmin"),
|
|
69
|
+
borshAddress("basePoolAuthority"),
|
|
70
|
+
borsh.u64("basePoolAuthorityBump"),
|
|
71
|
+
borshAddress("unstakingSolMint"),
|
|
72
|
+
borshAddress("wsolVault"),
|
|
73
|
+
borshAddress("actionAuthority"),
|
|
74
|
+
borshAddress("poolLookupTable"),
|
|
75
|
+
borsh.u64("sharesIssued"),
|
|
76
|
+
borsh.u64("wsolUnstaking"),
|
|
77
|
+
borsh.u64("wsolInVault"),
|
|
78
|
+
borsh.array(borsh.u128(), 256, "padding"),
|
|
79
|
+
])
|
|
80
|
+
|
|
81
|
+
constructor(fields: PoolStateFields) {
|
|
82
|
+
this.admin = fields.admin
|
|
83
|
+
this.pendingAdmin = fields.pendingAdmin
|
|
84
|
+
this.basePoolAuthority = fields.basePoolAuthority
|
|
85
|
+
this.basePoolAuthorityBump = fields.basePoolAuthorityBump
|
|
86
|
+
this.unstakingSolMint = fields.unstakingSolMint
|
|
87
|
+
this.wsolVault = fields.wsolVault
|
|
88
|
+
this.actionAuthority = fields.actionAuthority
|
|
89
|
+
this.poolLookupTable = fields.poolLookupTable
|
|
90
|
+
this.sharesIssued = fields.sharesIssued
|
|
91
|
+
this.wsolUnstaking = fields.wsolUnstaking
|
|
92
|
+
this.wsolInVault = fields.wsolInVault
|
|
93
|
+
this.padding = fields.padding
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
static async fetch(
|
|
97
|
+
rpc: Rpc<GetAccountInfoApi>,
|
|
98
|
+
address: Address,
|
|
99
|
+
programId: Address = PROGRAM_ID
|
|
100
|
+
): Promise<PoolState | null> {
|
|
101
|
+
const info = await fetchEncodedAccount(rpc, address)
|
|
102
|
+
|
|
103
|
+
if (!info.exists) {
|
|
104
|
+
return null
|
|
105
|
+
}
|
|
106
|
+
if (info.programAddress !== programId) {
|
|
107
|
+
throw new Error("account doesn't belong to this program")
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return this.decode(Buffer.from(info.data))
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
static async fetchMultiple(
|
|
114
|
+
rpc: Rpc<GetMultipleAccountsApi>,
|
|
115
|
+
addresses: Address[],
|
|
116
|
+
programId: Address = PROGRAM_ID
|
|
117
|
+
): Promise<Array<PoolState | null>> {
|
|
118
|
+
const infos = await fetchEncodedAccounts(rpc, addresses)
|
|
119
|
+
|
|
120
|
+
return infos.map((info) => {
|
|
121
|
+
if (!info.exists) {
|
|
122
|
+
return null
|
|
123
|
+
}
|
|
124
|
+
if (info.programAddress !== programId) {
|
|
125
|
+
throw new Error("account doesn't belong to this program")
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return this.decode(Buffer.from(info.data))
|
|
129
|
+
})
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
static decode(data: Buffer): PoolState {
|
|
133
|
+
if (!data.slice(0, 8).equals(PoolState.discriminator)) {
|
|
134
|
+
throw new Error("invalid account discriminator")
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const dec = PoolState.layout.decode(data.slice(8))
|
|
138
|
+
|
|
139
|
+
return new PoolState({
|
|
140
|
+
admin: dec.admin,
|
|
141
|
+
pendingAdmin: dec.pendingAdmin,
|
|
142
|
+
basePoolAuthority: dec.basePoolAuthority,
|
|
143
|
+
basePoolAuthorityBump: dec.basePoolAuthorityBump,
|
|
144
|
+
unstakingSolMint: dec.unstakingSolMint,
|
|
145
|
+
wsolVault: dec.wsolVault,
|
|
146
|
+
actionAuthority: dec.actionAuthority,
|
|
147
|
+
poolLookupTable: dec.poolLookupTable,
|
|
148
|
+
sharesIssued: dec.sharesIssued,
|
|
149
|
+
wsolUnstaking: dec.wsolUnstaking,
|
|
150
|
+
wsolInVault: dec.wsolInVault,
|
|
151
|
+
padding: dec.padding,
|
|
152
|
+
})
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
toJSON(): PoolStateJSON {
|
|
156
|
+
return {
|
|
157
|
+
admin: this.admin,
|
|
158
|
+
pendingAdmin: this.pendingAdmin,
|
|
159
|
+
basePoolAuthority: this.basePoolAuthority,
|
|
160
|
+
basePoolAuthorityBump: this.basePoolAuthorityBump.toString(),
|
|
161
|
+
unstakingSolMint: this.unstakingSolMint,
|
|
162
|
+
wsolVault: this.wsolVault,
|
|
163
|
+
actionAuthority: this.actionAuthority,
|
|
164
|
+
poolLookupTable: this.poolLookupTable,
|
|
165
|
+
sharesIssued: this.sharesIssued.toString(),
|
|
166
|
+
wsolUnstaking: this.wsolUnstaking.toString(),
|
|
167
|
+
wsolInVault: this.wsolInVault.toString(),
|
|
168
|
+
padding: this.padding.map((item) => item.toString()),
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
static fromJSON(obj: PoolStateJSON): PoolState {
|
|
173
|
+
return new PoolState({
|
|
174
|
+
admin: address(obj.admin),
|
|
175
|
+
pendingAdmin: address(obj.pendingAdmin),
|
|
176
|
+
basePoolAuthority: address(obj.basePoolAuthority),
|
|
177
|
+
basePoolAuthorityBump: new BN(obj.basePoolAuthorityBump),
|
|
178
|
+
unstakingSolMint: address(obj.unstakingSolMint),
|
|
179
|
+
wsolVault: address(obj.wsolVault),
|
|
180
|
+
actionAuthority: address(obj.actionAuthority),
|
|
181
|
+
poolLookupTable: address(obj.poolLookupTable),
|
|
182
|
+
sharesIssued: new BN(obj.sharesIssued),
|
|
183
|
+
wsolUnstaking: new BN(obj.wsolUnstaking),
|
|
184
|
+
wsolInVault: new BN(obj.wsolInVault),
|
|
185
|
+
padding: obj.padding.map((item) => new BN(item)),
|
|
186
|
+
})
|
|
187
|
+
}
|
|
188
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
+
import {
|
|
3
|
+
address,
|
|
4
|
+
Address,
|
|
5
|
+
fetchEncodedAccount,
|
|
6
|
+
fetchEncodedAccounts,
|
|
7
|
+
GetAccountInfoApi,
|
|
8
|
+
GetMultipleAccountsApi,
|
|
9
|
+
Rpc,
|
|
10
|
+
} from "@solana/kit"
|
|
11
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
12
|
+
import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
13
|
+
import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
14
|
+
import { borshAddress } from "../utils" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
15
|
+
import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
16
|
+
import { PROGRAM_ID } from "../programId"
|
|
17
|
+
|
|
18
|
+
export interface UnstakeTicketFields {
|
|
19
|
+
authority: Address
|
|
20
|
+
poolState: Address
|
|
21
|
+
obligationMetadata: Address
|
|
22
|
+
initialUsol: BN
|
|
23
|
+
remainingUsol: BN
|
|
24
|
+
minimumEpochToBurn: BN
|
|
25
|
+
padding0: Array<BN>
|
|
26
|
+
padding: Array<BN>
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface UnstakeTicketJSON {
|
|
30
|
+
authority: string
|
|
31
|
+
poolState: string
|
|
32
|
+
obligationMetadata: string
|
|
33
|
+
initialUsol: string
|
|
34
|
+
remainingUsol: string
|
|
35
|
+
minimumEpochToBurn: string
|
|
36
|
+
padding0: Array<string>
|
|
37
|
+
padding: Array<string>
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export class UnstakeTicket {
|
|
41
|
+
readonly authority: Address
|
|
42
|
+
readonly poolState: Address
|
|
43
|
+
readonly obligationMetadata: Address
|
|
44
|
+
readonly initialUsol: BN
|
|
45
|
+
readonly remainingUsol: BN
|
|
46
|
+
readonly minimumEpochToBurn: BN
|
|
47
|
+
readonly padding0: Array<BN>
|
|
48
|
+
readonly padding: Array<BN>
|
|
49
|
+
|
|
50
|
+
static readonly discriminator = Buffer.from([
|
|
51
|
+
131, 84, 209, 38, 145, 157, 181, 127,
|
|
52
|
+
])
|
|
53
|
+
|
|
54
|
+
static readonly layout = borsh.struct<UnstakeTicket>([
|
|
55
|
+
borshAddress("authority"),
|
|
56
|
+
borshAddress("poolState"),
|
|
57
|
+
borshAddress("obligationMetadata"),
|
|
58
|
+
borsh.u64("initialUsol"),
|
|
59
|
+
borsh.u64("remainingUsol"),
|
|
60
|
+
borsh.u64("minimumEpochToBurn"),
|
|
61
|
+
borsh.array(borsh.u64(), 1, "padding0"),
|
|
62
|
+
borsh.array(borsh.u128(), 16, "padding"),
|
|
63
|
+
])
|
|
64
|
+
|
|
65
|
+
constructor(fields: UnstakeTicketFields) {
|
|
66
|
+
this.authority = fields.authority
|
|
67
|
+
this.poolState = fields.poolState
|
|
68
|
+
this.obligationMetadata = fields.obligationMetadata
|
|
69
|
+
this.initialUsol = fields.initialUsol
|
|
70
|
+
this.remainingUsol = fields.remainingUsol
|
|
71
|
+
this.minimumEpochToBurn = fields.minimumEpochToBurn
|
|
72
|
+
this.padding0 = fields.padding0
|
|
73
|
+
this.padding = fields.padding
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
static async fetch(
|
|
77
|
+
rpc: Rpc<GetAccountInfoApi>,
|
|
78
|
+
address: Address,
|
|
79
|
+
programId: Address = PROGRAM_ID
|
|
80
|
+
): Promise<UnstakeTicket | null> {
|
|
81
|
+
const info = await fetchEncodedAccount(rpc, address)
|
|
82
|
+
|
|
83
|
+
if (!info.exists) {
|
|
84
|
+
return null
|
|
85
|
+
}
|
|
86
|
+
if (info.programAddress !== programId) {
|
|
87
|
+
throw new Error("account doesn't belong to this program")
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return this.decode(Buffer.from(info.data))
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
static async fetchMultiple(
|
|
94
|
+
rpc: Rpc<GetMultipleAccountsApi>,
|
|
95
|
+
addresses: Address[],
|
|
96
|
+
programId: Address = PROGRAM_ID
|
|
97
|
+
): Promise<Array<UnstakeTicket | null>> {
|
|
98
|
+
const infos = await fetchEncodedAccounts(rpc, addresses)
|
|
99
|
+
|
|
100
|
+
return infos.map((info) => {
|
|
101
|
+
if (!info.exists) {
|
|
102
|
+
return null
|
|
103
|
+
}
|
|
104
|
+
if (info.programAddress !== programId) {
|
|
105
|
+
throw new Error("account doesn't belong to this program")
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return this.decode(Buffer.from(info.data))
|
|
109
|
+
})
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
static decode(data: Buffer): UnstakeTicket {
|
|
113
|
+
if (!data.slice(0, 8).equals(UnstakeTicket.discriminator)) {
|
|
114
|
+
throw new Error("invalid account discriminator")
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const dec = UnstakeTicket.layout.decode(data.slice(8))
|
|
118
|
+
|
|
119
|
+
return new UnstakeTicket({
|
|
120
|
+
authority: dec.authority,
|
|
121
|
+
poolState: dec.poolState,
|
|
122
|
+
obligationMetadata: dec.obligationMetadata,
|
|
123
|
+
initialUsol: dec.initialUsol,
|
|
124
|
+
remainingUsol: dec.remainingUsol,
|
|
125
|
+
minimumEpochToBurn: dec.minimumEpochToBurn,
|
|
126
|
+
padding0: dec.padding0,
|
|
127
|
+
padding: dec.padding,
|
|
128
|
+
})
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
toJSON(): UnstakeTicketJSON {
|
|
132
|
+
return {
|
|
133
|
+
authority: this.authority,
|
|
134
|
+
poolState: this.poolState,
|
|
135
|
+
obligationMetadata: this.obligationMetadata,
|
|
136
|
+
initialUsol: this.initialUsol.toString(),
|
|
137
|
+
remainingUsol: this.remainingUsol.toString(),
|
|
138
|
+
minimumEpochToBurn: this.minimumEpochToBurn.toString(),
|
|
139
|
+
padding0: this.padding0.map((item) => item.toString()),
|
|
140
|
+
padding: this.padding.map((item) => item.toString()),
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
static fromJSON(obj: UnstakeTicketJSON): UnstakeTicket {
|
|
145
|
+
return new UnstakeTicket({
|
|
146
|
+
authority: address(obj.authority),
|
|
147
|
+
poolState: address(obj.poolState),
|
|
148
|
+
obligationMetadata: address(obj.obligationMetadata),
|
|
149
|
+
initialUsol: new BN(obj.initialUsol),
|
|
150
|
+
remainingUsol: new BN(obj.remainingUsol),
|
|
151
|
+
minimumEpochToBurn: new BN(obj.minimumEpochToBurn),
|
|
152
|
+
padding0: obj.padding0.map((item) => new BN(item)),
|
|
153
|
+
padding: obj.padding.map((item) => new BN(item)),
|
|
154
|
+
})
|
|
155
|
+
}
|
|
156
|
+
}
|