@exponent-labs/exponent-types 0.1.7 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/common.d.ts +8 -7
- package/build/cpi.d.ts +34 -2
- package/build/cpi.js +2 -2
- package/build/cpi.js.map +1 -1
- package/build/exponent-vaults.d.ts +107 -0
- package/build/exponent-vaults.js +6 -0
- package/build/exponent-vaults.js.map +1 -0
- package/build/flavor.d.ts +23 -23
- package/build/generic.d.ts +94 -30
- package/build/generic.js +99 -9
- package/build/generic.js.map +1 -1
- package/build/index.d.ts +2 -1
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/jito-restaking.d.ts +13 -12
- package/build/kamino.d.ts +27 -25
- package/build/marginfi.d.ts +18 -17
- package/build/orderbook.d.ts +151 -0
- package/build/orderbook.js +13 -0
- package/build/orderbook.js.map +1 -0
- package/build/perena.d.ts +13 -12
- package/build/vault.d.ts +53 -15
- package/package.json +4 -2
- package/src/common.ts +9 -8
- package/src/cpi.ts +43 -3
- package/src/flavor.ts +21 -22
- package/src/generic.ts +192 -35
- package/src/index.ts +3 -2
- package/src/jito-restaking.ts +14 -14
- package/src/kamino.ts +28 -26
- package/src/marginfi.ts +19 -19
- package/src/orderbook.ts +195 -0
- package/src/perena.ts +14 -14
- package/src/vault.ts +82 -17
package/build/vault.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { BN, web3 } from "@coral-xyz/anchor";
|
|
2
1
|
import { IFlavorStateJson, Flavor } from "./flavor";
|
|
3
2
|
import { CpiAccountsRaw, CpiAccountsRawJson } from "./cpi";
|
|
4
3
|
import { AnchorizedPNum, AnchorizedPNumJson } from "./common";
|
|
4
|
+
import { PublicKey } from "@solana/web3.js";
|
|
5
|
+
import BN from 'bn.js';
|
|
5
6
|
export type VaultJson = {
|
|
6
7
|
/** When does the vault start, as a UNIX timestamp */
|
|
7
8
|
startTs: number;
|
|
@@ -55,6 +56,7 @@ export type VaultJson = {
|
|
|
55
56
|
flavor: IFlavorStateJson;
|
|
56
57
|
emissions: VaultEmissionJson[];
|
|
57
58
|
maxPySupply: string;
|
|
59
|
+
state: VaultStateJson;
|
|
58
60
|
};
|
|
59
61
|
export interface VaultState {
|
|
60
62
|
/** supply of PT */
|
|
@@ -65,26 +67,26 @@ export interface VaultState {
|
|
|
65
67
|
/** For how long is the vault active */
|
|
66
68
|
durationSeconds: number;
|
|
67
69
|
/** Vault signer for token accounts, mints, SY position etc */
|
|
68
|
-
authority:
|
|
69
|
-
addressLookupTable:
|
|
70
|
+
authority: PublicKey;
|
|
71
|
+
addressLookupTable: PublicKey;
|
|
70
72
|
lastSeenSyExchangeRate: number;
|
|
71
73
|
allTimeHighSyExchangeRate: number;
|
|
72
74
|
/** Vault-owned account for passing SY between SY program and user */
|
|
73
|
-
escrowSy:
|
|
75
|
+
escrowSy: PublicKey;
|
|
74
76
|
/** Escrow account for holding deposited YT */
|
|
75
|
-
escrowYt:
|
|
77
|
+
escrowYt: PublicKey;
|
|
76
78
|
/** Key to SY Program */
|
|
77
|
-
syProgram:
|
|
79
|
+
syProgram: PublicKey;
|
|
78
80
|
syPosition: SyPosition;
|
|
79
81
|
cpiAccounts: CpiAccountsRaw;
|
|
80
|
-
mintPt:
|
|
82
|
+
mintPt: PublicKey;
|
|
81
83
|
status: number;
|
|
82
84
|
minOperationSizeStrip: bigint;
|
|
83
85
|
minOperationSizeMerge: bigint;
|
|
84
|
-
mintYt:
|
|
85
|
-
mintSy:
|
|
86
|
-
yieldPositonAddress:
|
|
87
|
-
treasurySyTokenAccount:
|
|
86
|
+
mintYt: PublicKey;
|
|
87
|
+
mintSy: PublicKey;
|
|
88
|
+
yieldPositonAddress: PublicKey;
|
|
89
|
+
treasurySyTokenAccount: PublicKey;
|
|
88
90
|
interestBpsFee: number;
|
|
89
91
|
totalSyInEscrow: bigint;
|
|
90
92
|
flavor: Flavor;
|
|
@@ -92,6 +94,42 @@ export interface VaultState {
|
|
|
92
94
|
emissions: VaultEmission[];
|
|
93
95
|
maxPySupply: bigint;
|
|
94
96
|
}
|
|
97
|
+
export interface VaultStateJson {
|
|
98
|
+
/** supply of PT */
|
|
99
|
+
ptSupply: string;
|
|
100
|
+
syForPt: string;
|
|
101
|
+
/** When does the vault start, as a UNIX timestamp */
|
|
102
|
+
startTs: number;
|
|
103
|
+
/** For how long is the vault active */
|
|
104
|
+
durationSeconds: number;
|
|
105
|
+
/** Vault signer for token accounts, mints, SY position etc */
|
|
106
|
+
authority: string;
|
|
107
|
+
addressLookupTable: string;
|
|
108
|
+
lastSeenSyExchangeRate: number;
|
|
109
|
+
allTimeHighSyExchangeRate: number;
|
|
110
|
+
/** Vault-owned account for passing SY between SY program and user */
|
|
111
|
+
escrowSy: string;
|
|
112
|
+
/** Escrow account for holding deposited YT */
|
|
113
|
+
escrowYt: string;
|
|
114
|
+
/** Key to SY Program */
|
|
115
|
+
syProgram: string;
|
|
116
|
+
syPosition: SyPositionJson;
|
|
117
|
+
cpiAccounts: CpiAccountsRawJson;
|
|
118
|
+
mintPt: string;
|
|
119
|
+
status: number;
|
|
120
|
+
minOperationSizeStrip: string;
|
|
121
|
+
minOperationSizeMerge: string;
|
|
122
|
+
mintYt: string;
|
|
123
|
+
mintSy: string;
|
|
124
|
+
yieldPositonAddress: string;
|
|
125
|
+
treasurySyTokenAccount: string;
|
|
126
|
+
interestBpsFee: number;
|
|
127
|
+
totalSyInEscrow: string;
|
|
128
|
+
flavor: IFlavorStateJson;
|
|
129
|
+
finalSyExchangeRate: number;
|
|
130
|
+
emissions: VaultEmissionJson[];
|
|
131
|
+
maxPySupply: string;
|
|
132
|
+
}
|
|
95
133
|
export interface SyPositionJson {
|
|
96
134
|
balanceSy: string;
|
|
97
135
|
owner: string;
|
|
@@ -103,22 +141,22 @@ export interface SyPositionJson {
|
|
|
103
141
|
}
|
|
104
142
|
export interface SyPosition {
|
|
105
143
|
balanceSy: bigint;
|
|
106
|
-
owner:
|
|
144
|
+
owner: PublicKey;
|
|
107
145
|
emissions: {
|
|
108
146
|
/** Last seen index for SY-to-emission exchange rate */
|
|
109
147
|
lastSeenIndex: number;
|
|
110
148
|
/** mint of emission token */
|
|
111
|
-
mint:
|
|
149
|
+
mint: PublicKey;
|
|
112
150
|
/** How many emissions are staged to claim */
|
|
113
151
|
staged: bigint;
|
|
114
152
|
}[];
|
|
115
153
|
}
|
|
116
154
|
export interface VaultEmission {
|
|
117
|
-
tokenAccount:
|
|
155
|
+
tokenAccount: PublicKey;
|
|
118
156
|
initialIndex: AnchorizedPNum;
|
|
119
157
|
lastSeenIndex: AnchorizedPNum;
|
|
120
158
|
finalIndex: AnchorizedPNum;
|
|
121
|
-
treasuryTokenAccount:
|
|
159
|
+
treasuryTokenAccount: PublicKey;
|
|
122
160
|
feeBps: number;
|
|
123
161
|
treasuryEmission: BN;
|
|
124
162
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exponent-labs/exponent-types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"main": "build/index.js",
|
|
5
5
|
"types": "build/index.d.ts",
|
|
6
6
|
"license": "AGPL-3.0",
|
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
"build": "tsc --build"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@
|
|
11
|
+
"@solana/web3.js": "1.98.4",
|
|
12
|
+
"@solana/spl-stake-pool": "1.1.8",
|
|
13
|
+
"bn.js": "5.2.2"
|
|
12
14
|
},
|
|
13
15
|
"devDependencies": {
|
|
14
16
|
"typescript": "5.4.5"
|
package/src/common.ts
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PublicKey } from '@solana/web3.js';
|
|
2
|
+
import BN from 'bn.js';
|
|
2
3
|
|
|
3
4
|
export interface SyEmissionRaw {
|
|
4
|
-
mint:
|
|
5
|
+
mint: PublicKey
|
|
5
6
|
index: AnchorizedPNum
|
|
6
7
|
lastSeenTotalAccruedEmissions: BN
|
|
7
8
|
totalClaimedEmissions: BN
|
|
8
|
-
tokenProgram:
|
|
9
|
-
escrowAccount:
|
|
9
|
+
tokenProgram: PublicKey
|
|
10
|
+
escrowAccount: PublicKey
|
|
10
11
|
treasuryEmission: BN
|
|
11
12
|
lastSeenIndex: AnchorizedPNum
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
export interface SyEmissionRaw2 {
|
|
15
|
-
mint:
|
|
16
|
+
mint: PublicKey
|
|
16
17
|
index: AnchorizedPNum
|
|
17
18
|
last_seen_total_accrued_emissions: BN
|
|
18
19
|
total_claimed_emissions: BN
|
|
19
|
-
token_program:
|
|
20
|
-
escrow_account:
|
|
20
|
+
token_program: PublicKey
|
|
21
|
+
escrow_account: PublicKey
|
|
21
22
|
treasury_emission: BN
|
|
22
23
|
last_seen_index: AnchorizedPNum
|
|
23
24
|
}
|
|
@@ -34,4 +35,4 @@ export interface SyEmissionJson {
|
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
export type AnchorizedPNum = { 0: BN[] }
|
|
37
|
-
export type AnchorizedPNumJson = { 0: string[] }
|
|
38
|
+
export type AnchorizedPNumJson = { 0: string[] }
|
package/src/cpi.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PublicKey } from "@solana/web3.js"
|
|
2
2
|
|
|
3
3
|
export interface AccountInfo {
|
|
4
|
-
pubkey:
|
|
4
|
+
pubkey: PublicKey
|
|
5
5
|
isSigner: boolean
|
|
6
6
|
isWritable: boolean
|
|
7
7
|
}
|
|
@@ -15,6 +15,15 @@ export interface CpiMeta<T> {
|
|
|
15
15
|
getPositionState: T[]
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
/** Generic container for ExponentCore CPI account lists */
|
|
19
|
+
export interface ExponentCoreCpiMeta<T> {
|
|
20
|
+
depositYt: T[]
|
|
21
|
+
withdrawYt: T[]
|
|
22
|
+
stripSy: T[]
|
|
23
|
+
mergeSy: T[]
|
|
24
|
+
collectInterest: T[]
|
|
25
|
+
}
|
|
26
|
+
|
|
18
27
|
/** The on-chain storage for CPI accounts, which references an ALT */
|
|
19
28
|
export interface CpiAccountIndex {
|
|
20
29
|
/** Index in the Address Lookup Table */
|
|
@@ -26,9 +35,15 @@ export interface CpiAccountIndex {
|
|
|
26
35
|
/** Raw account infos for CPI that include the Pubkey */
|
|
27
36
|
export type CpiAccountsRaw = CpiMeta<AccountInfo>
|
|
28
37
|
|
|
38
|
+
/** Raw account infos for CPI that include the Pubkey */
|
|
39
|
+
export type ExponentCoreCpiAccountsRaw = ExponentCoreCpiMeta<AccountInfo>
|
|
40
|
+
|
|
29
41
|
/** This account is stored in state on the vault/market to track indexes in the ALT */
|
|
30
42
|
export type CpiAccountIndexes = CpiMeta<CpiAccountIndex>
|
|
31
43
|
|
|
44
|
+
/** This account is stored in state on the vault/market to track indexes in the ALT */
|
|
45
|
+
export type ExponentCoreCpiIndexes = ExponentCoreCpiMeta<CpiAccountIndex>
|
|
46
|
+
|
|
32
47
|
export interface CpiAccountsRawJson {
|
|
33
48
|
getSyState: AccountInfoJson[]
|
|
34
49
|
withdrawSy: AccountInfoJson[]
|
|
@@ -37,6 +52,14 @@ export interface CpiAccountsRawJson {
|
|
|
37
52
|
getPositionState: AccountInfoJson[]
|
|
38
53
|
}
|
|
39
54
|
|
|
55
|
+
export interface ExponentCoreCpiAccountsRawJson {
|
|
56
|
+
depositYt: AccountInfoJson[]
|
|
57
|
+
withdrawYt: AccountInfoJson[]
|
|
58
|
+
stripSy: AccountInfoJson[]
|
|
59
|
+
mergeSy: AccountInfoJson[]
|
|
60
|
+
collectInterest: AccountInfoJson[]
|
|
61
|
+
}
|
|
62
|
+
|
|
40
63
|
export type AccountInfoJson = {
|
|
41
64
|
pubkey: string
|
|
42
65
|
isSigner: boolean
|
|
@@ -45,7 +68,7 @@ export type AccountInfoJson = {
|
|
|
45
68
|
|
|
46
69
|
export function deserializeCpiAccountsRaw(serialized: CpiAccountsRawJson): CpiAccountsRaw {
|
|
47
70
|
const deserializeAccountInfo = (accountInfo: AccountInfoJson): AccountInfo => ({
|
|
48
|
-
pubkey: new
|
|
71
|
+
pubkey: new PublicKey(accountInfo.pubkey),
|
|
49
72
|
isSigner: accountInfo.isSigner,
|
|
50
73
|
isWritable: accountInfo.isWritable,
|
|
51
74
|
})
|
|
@@ -73,3 +96,20 @@ export function serializeCpiAccountsRaw(cpiAccounts: CpiAccountsRaw): CpiAccount
|
|
|
73
96
|
getPositionState: cpiAccounts.getPositionState.map(serializeAccountInfo),
|
|
74
97
|
}
|
|
75
98
|
}
|
|
99
|
+
|
|
100
|
+
/** MarketThree/CLMM only uses a subset of ExponentCore CPI accounts (strip and merge) */
|
|
101
|
+
export interface MarketCpiCoreMeta<T> {
|
|
102
|
+
stripSy: T[]
|
|
103
|
+
mergeSy: T[]
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface MarketCpiCoreAccountsRawJson {
|
|
107
|
+
stripSy: AccountInfoJson[]
|
|
108
|
+
mergeSy: AccountInfoJson[]
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** Type alias for MarketThree's CPI core accounts with pubkeys */
|
|
112
|
+
export type MarketCpiCoreAccountsRaw = MarketCpiCoreMeta<AccountInfo>
|
|
113
|
+
|
|
114
|
+
/** Type alias for MarketThree's CPI core accounts stored in state */
|
|
115
|
+
export type MarketCpiCoreIndexes = MarketCpiCoreMeta<CpiAccountIndex>
|
package/src/flavor.ts
CHANGED
|
@@ -1,41 +1,40 @@
|
|
|
1
|
-
import { web3 } from "@coral-xyz/anchor"
|
|
2
1
|
import { MfiSyStateJson, MfiSyState } from "./marginfi"
|
|
3
2
|
import { KaminoSyState, KaminoSyStateJson } from "./kamino"
|
|
4
3
|
import { JitoRestakingSyState, JitoRestakingSyStateJson } from "./jito-restaking"
|
|
5
4
|
import { AnchorizedPNum } from "./common"
|
|
6
5
|
import { PerenaSyState, PerenaSyStateJson } from "./perena"
|
|
7
6
|
import { GenericSyState, GenericSyStateJson } from "./generic"
|
|
8
|
-
|
|
7
|
+
import {PublicKey, TransactionInstruction} from "@solana/web3.js"
|
|
9
8
|
export type FlavorDiscriminator = "marginfi" | "kamino" | "jitoRestaking" | "perena" | "generic"
|
|
10
9
|
|
|
11
10
|
export type MintSyArgs = {
|
|
12
11
|
amountBase: string
|
|
13
|
-
depositor:
|
|
14
|
-
depositorBaseTokenAccount:
|
|
15
|
-
depositorSyTokenAccount:
|
|
12
|
+
depositor: PublicKey
|
|
13
|
+
depositorBaseTokenAccount: PublicKey
|
|
14
|
+
depositorSyTokenAccount: PublicKey
|
|
16
15
|
}
|
|
17
16
|
|
|
18
17
|
export type RedeemSyArgs = {
|
|
19
18
|
amountSy: string
|
|
20
|
-
redeemer:
|
|
21
|
-
redeemerBaseTokenAccount:
|
|
22
|
-
redeemerSyTokenAccount:
|
|
19
|
+
redeemer: PublicKey
|
|
20
|
+
redeemerBaseTokenAccount: PublicKey
|
|
21
|
+
redeemerSyTokenAccount: PublicKey
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
export type InterfaceInstructionArgs = {
|
|
26
|
-
signer:
|
|
25
|
+
signer: PublicKey
|
|
27
26
|
amountBase: string
|
|
28
27
|
}
|
|
29
28
|
|
|
30
29
|
type BaseFlavorState = {
|
|
31
30
|
flavor: FlavorDiscriminator
|
|
32
31
|
currentSyExchangeRate: number
|
|
33
|
-
mintBase:
|
|
34
|
-
baseTokenProgram:
|
|
32
|
+
mintBase: PublicKey
|
|
33
|
+
baseTokenProgram: PublicKey
|
|
35
34
|
emissions: {
|
|
36
35
|
exchangeRate: AnchorizedPNum
|
|
37
|
-
mint:
|
|
38
|
-
tokenProgram:
|
|
36
|
+
mint: PublicKey
|
|
37
|
+
tokenProgram: PublicKey
|
|
39
38
|
}[]
|
|
40
39
|
}
|
|
41
40
|
|
|
@@ -52,12 +51,12 @@ type BaseFlavorStateJson = {
|
|
|
52
51
|
}
|
|
53
52
|
|
|
54
53
|
interface BaseFlavorTrait {
|
|
55
|
-
ixMintSy: (args: MintSyArgs) => Promise<
|
|
56
|
-
ixRedeemSy: (args: RedeemSyArgs) => Promise<
|
|
57
|
-
preIxs: (args: { signer:
|
|
58
|
-
postIxs: (args: { signer:
|
|
59
|
-
preMintSyIx?: (args: InterfaceInstructionArgs) => Promise<
|
|
60
|
-
postRedeemSyIx?: (args: InterfaceInstructionArgs) => Promise<
|
|
54
|
+
ixMintSy: (args: MintSyArgs) => Promise<TransactionInstruction>
|
|
55
|
+
ixRedeemSy: (args: RedeemSyArgs) => Promise<TransactionInstruction>
|
|
56
|
+
preIxs: (args: { signer: PublicKey }) => Promise<TransactionInstruction[]>
|
|
57
|
+
postIxs: (args: { signer: PublicKey }) => Promise<TransactionInstruction[]>
|
|
58
|
+
preMintSyIx?: (args: InterfaceInstructionArgs) => Promise<TransactionInstruction[]>
|
|
59
|
+
postRedeemSyIx?: (args: InterfaceInstructionArgs) => Promise<TransactionInstruction[]>
|
|
61
60
|
}
|
|
62
61
|
|
|
63
62
|
export interface FlavorKaminoState extends BaseFlavorState {
|
|
@@ -67,9 +66,9 @@ export interface FlavorKaminoState extends BaseFlavorState {
|
|
|
67
66
|
|
|
68
67
|
export interface FlavorMarginfiState extends BaseFlavorState {
|
|
69
68
|
flavor: "marginfi"
|
|
70
|
-
bank:
|
|
71
|
-
emissionMint?:
|
|
72
|
-
emissionTokenProgram?:
|
|
69
|
+
bank: PublicKey
|
|
70
|
+
emissionMint?: PublicKey
|
|
71
|
+
emissionTokenProgram?: PublicKey
|
|
73
72
|
mfiSyState: MfiSyState
|
|
74
73
|
}
|
|
75
74
|
|
package/src/generic.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { PublicKey } from "@solana/web3.js"
|
|
3
2
|
import { AnchorizedPNum, SyEmissionJson, SyEmissionRaw } from "./common"
|
|
4
|
-
|
|
3
|
+
import { StakePoolAccount } from "@solana/spl-stake-pool"
|
|
4
|
+
import BN from 'bn.js'
|
|
5
5
|
export type InterfaceTypeGeneric =
|
|
6
6
|
| {
|
|
7
7
|
pyth: {
|
|
@@ -58,6 +58,19 @@ export type InterfaceTypeGeneric =
|
|
|
58
58
|
padding: number[]
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
+
| {
|
|
62
|
+
reflect: {
|
|
63
|
+
padding: number[]
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
| {
|
|
67
|
+
ore: Record<string, never>
|
|
68
|
+
}
|
|
69
|
+
| {
|
|
70
|
+
chainlink: {
|
|
71
|
+
padding: number[]
|
|
72
|
+
}
|
|
73
|
+
}
|
|
61
74
|
export type InterfaceTypeGenericJson =
|
|
62
75
|
| {
|
|
63
76
|
pyth: {
|
|
@@ -114,29 +127,51 @@ export type InterfaceTypeGenericJson =
|
|
|
114
127
|
padding: number[]
|
|
115
128
|
}
|
|
116
129
|
}
|
|
130
|
+
| {
|
|
131
|
+
reflect: {
|
|
132
|
+
padding: number[]
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
| {
|
|
136
|
+
ore: Record<string, never>
|
|
137
|
+
}
|
|
138
|
+
| {
|
|
139
|
+
chainlink: {
|
|
140
|
+
padding: number[]
|
|
141
|
+
}
|
|
142
|
+
}
|
|
117
143
|
/** Additional data that different interface types may need */
|
|
118
144
|
export interface AdditionalDataGeneric {
|
|
119
145
|
fragmetricData?: {
|
|
120
|
-
receiptTokenMint:
|
|
121
|
-
wrappedTokenMint:
|
|
146
|
+
receiptTokenMint: PublicKey
|
|
147
|
+
wrappedTokenMint: PublicKey
|
|
122
148
|
}
|
|
123
149
|
jupiterLendData?: {
|
|
124
|
-
baseTokenMint:
|
|
125
|
-
tokenReservesLiquidity:
|
|
126
|
-
lendingSupplyPosition:
|
|
127
|
-
rewardsRateModel:
|
|
128
|
-
rateModel:
|
|
150
|
+
baseTokenMint: PublicKey
|
|
151
|
+
tokenReservesLiquidity: PublicKey
|
|
152
|
+
lendingSupplyPosition: PublicKey
|
|
153
|
+
rewardsRateModel: PublicKey
|
|
154
|
+
rateModel: PublicKey
|
|
129
155
|
}
|
|
130
156
|
kaminoVaultData?: {
|
|
131
|
-
vault:
|
|
157
|
+
vault: PublicKey
|
|
132
158
|
reserves: {
|
|
133
|
-
reserveAddress:
|
|
134
|
-
marketAddress:
|
|
159
|
+
reserveAddress: PublicKey
|
|
160
|
+
marketAddress: PublicKey
|
|
135
161
|
}[]
|
|
136
|
-
tokenVault:
|
|
137
|
-
tokenMint:
|
|
138
|
-
baseVaultAuthority:
|
|
139
|
-
sharesMint:
|
|
162
|
+
tokenVault: PublicKey
|
|
163
|
+
tokenMint: PublicKey
|
|
164
|
+
baseVaultAuthority: PublicKey
|
|
165
|
+
sharesMint: PublicKey
|
|
166
|
+
}
|
|
167
|
+
splStakePoolData?: {
|
|
168
|
+
stakePoolAccount?: StakePoolAccount // Optional because it is expensive to serialize / not always needed on clients
|
|
169
|
+
stakePoolAddress: PublicKey
|
|
170
|
+
stakePoolProgramId: PublicKey // Dynamic program ID from account owner
|
|
171
|
+
validatorList: PublicKey
|
|
172
|
+
reserveStake: PublicKey
|
|
173
|
+
managerFeeAccount: PublicKey
|
|
174
|
+
poolMint: PublicKey
|
|
140
175
|
}
|
|
141
176
|
// Add other interface-specific data here as needed
|
|
142
177
|
// meteoraData?: { ... }
|
|
@@ -153,6 +188,28 @@ export interface AdditionalDataGenericJson {
|
|
|
153
188
|
jupiterLendData?: {
|
|
154
189
|
baseTokenMint: string
|
|
155
190
|
tokenReservesLiquidity: string
|
|
191
|
+
lendingSupplyPosition: string
|
|
192
|
+
rewardsRateModel: string
|
|
193
|
+
rateModel: string
|
|
194
|
+
}
|
|
195
|
+
kaminoVaultData?: {
|
|
196
|
+
vault: string
|
|
197
|
+
reserves: {
|
|
198
|
+
reserveAddress: string
|
|
199
|
+
marketAddress: string
|
|
200
|
+
}[]
|
|
201
|
+
tokenVault: string
|
|
202
|
+
tokenMint: string
|
|
203
|
+
baseVaultAuthority: string
|
|
204
|
+
sharesMint: string
|
|
205
|
+
}
|
|
206
|
+
splStakePoolData?: {
|
|
207
|
+
stakePoolAddress: string
|
|
208
|
+
stakePoolProgramId: string
|
|
209
|
+
validatorList: string
|
|
210
|
+
reserveStake: string
|
|
211
|
+
managerFeeAccount: string
|
|
212
|
+
poolMint: string
|
|
156
213
|
}
|
|
157
214
|
// Add other interface-specific data here as needed
|
|
158
215
|
// meteoraData?: { ... }
|
|
@@ -163,7 +220,15 @@ export interface AdditionalDataGenericJson {
|
|
|
163
220
|
export interface Hook {
|
|
164
221
|
enabled: boolean
|
|
165
222
|
interfaceEmissionsAccountsUntil: number
|
|
166
|
-
programId:
|
|
223
|
+
programId: PublicKey
|
|
224
|
+
preMintHookDiscriminator: number[]
|
|
225
|
+
postRedeemHookDiscriminator: number[]
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export interface HookJson {
|
|
229
|
+
enabled: boolean
|
|
230
|
+
interfaceEmissionsAccountsUntil: number
|
|
231
|
+
programId: string
|
|
167
232
|
preMintHookDiscriminator: number[]
|
|
168
233
|
postRedeemHookDiscriminator: number[]
|
|
169
234
|
}
|
|
@@ -173,13 +238,13 @@ export interface HookRaw {
|
|
|
173
238
|
interfaceEmissionsAccountsUntil: number
|
|
174
239
|
preMintHookDiscriminator: Buffer
|
|
175
240
|
postRedeemHookDiscriminator: Buffer
|
|
176
|
-
programId:
|
|
241
|
+
programId: PublicKey
|
|
177
242
|
}
|
|
178
243
|
|
|
179
244
|
export interface GenericSyState {
|
|
180
|
-
selfAddress:
|
|
245
|
+
selfAddress: PublicKey
|
|
181
246
|
account: GenericSyMetaAccount
|
|
182
|
-
tokenProgramBase:
|
|
247
|
+
tokenProgramBase: PublicKey
|
|
183
248
|
syRate: number
|
|
184
249
|
additionalData?: AdditionalDataGeneric
|
|
185
250
|
}
|
|
@@ -206,16 +271,16 @@ export interface GenericSyMetaAccountJson {
|
|
|
206
271
|
maxSySupply: string
|
|
207
272
|
minMintSize: string
|
|
208
273
|
minRedeemSize: string
|
|
209
|
-
hook:
|
|
274
|
+
hook: HookJson
|
|
210
275
|
emissions: SyEmissionJson[]
|
|
211
276
|
index: number
|
|
212
277
|
}
|
|
213
278
|
|
|
214
279
|
export interface GenericSyMetaAccount {
|
|
215
|
-
mintSy:
|
|
216
|
-
yieldBearingMint:
|
|
217
|
-
tokenSyEscrow:
|
|
218
|
-
interfaceAccounts:
|
|
280
|
+
mintSy: PublicKey
|
|
281
|
+
yieldBearingMint: PublicKey
|
|
282
|
+
tokenSyEscrow: PublicKey
|
|
283
|
+
interfaceAccounts: PublicKey[]
|
|
219
284
|
interfaceType: InterfaceTypeGeneric
|
|
220
285
|
maxSySupply: BN
|
|
221
286
|
minMintSize: BN
|
|
@@ -226,15 +291,15 @@ export interface GenericSyMetaAccount {
|
|
|
226
291
|
}
|
|
227
292
|
|
|
228
293
|
export interface GenericSyMetaAccountRaw {
|
|
229
|
-
mintSy:
|
|
230
|
-
yieldBearingMint:
|
|
231
|
-
tokenSyEscrow:
|
|
294
|
+
mintSy: PublicKey
|
|
295
|
+
yieldBearingMint: PublicKey
|
|
296
|
+
tokenSyEscrow: PublicKey
|
|
232
297
|
maxSySupply: BN
|
|
233
298
|
minMintSize: BN
|
|
234
299
|
minRedeemSize: BN
|
|
235
300
|
selfAddressBump: number[]
|
|
236
301
|
emissions: SyEmissionRaw[]
|
|
237
|
-
interfaceAccounts:
|
|
302
|
+
interfaceAccounts: PublicKey[]
|
|
238
303
|
interfaceType: InterfaceTypeGeneric
|
|
239
304
|
index: AnchorizedPNum
|
|
240
305
|
hook: HookRaw
|
|
@@ -351,6 +416,28 @@ export function fromInterfaceTypeGenericJson(json: InterfaceTypeGenericJson): In
|
|
|
351
416
|
return json as InterfaceTypeGeneric
|
|
352
417
|
}
|
|
353
418
|
|
|
419
|
+
/** Convert Hook to HookJson */
|
|
420
|
+
export function toHookJson(hook: Hook): HookJson {
|
|
421
|
+
return {
|
|
422
|
+
enabled: hook.enabled,
|
|
423
|
+
interfaceEmissionsAccountsUntil: hook.interfaceEmissionsAccountsUntil,
|
|
424
|
+
programId: hook.programId.toString(),
|
|
425
|
+
preMintHookDiscriminator: hook.preMintHookDiscriminator,
|
|
426
|
+
postRedeemHookDiscriminator: hook.postRedeemHookDiscriminator,
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
/** Convert HookJson to Hook */
|
|
431
|
+
export function fromHookJson(json: HookJson): Hook {
|
|
432
|
+
return {
|
|
433
|
+
enabled: json.enabled,
|
|
434
|
+
interfaceEmissionsAccountsUntil: json.interfaceEmissionsAccountsUntil,
|
|
435
|
+
programId: new PublicKey(json.programId),
|
|
436
|
+
preMintHookDiscriminator: json.preMintHookDiscriminator,
|
|
437
|
+
postRedeemHookDiscriminator: json.postRedeemHookDiscriminator,
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
|
|
354
441
|
/** Convert AdditionalDataGeneric to AdditionalDataGenericJson */
|
|
355
442
|
export function toAdditionalDataGenericJson(additionalData: AdditionalDataGeneric): AdditionalDataGenericJson {
|
|
356
443
|
const result: AdditionalDataGenericJson = {}
|
|
@@ -362,6 +449,41 @@ export function toAdditionalDataGenericJson(additionalData: AdditionalDataGeneri
|
|
|
362
449
|
}
|
|
363
450
|
}
|
|
364
451
|
|
|
452
|
+
if (additionalData.jupiterLendData) {
|
|
453
|
+
result.jupiterLendData = {
|
|
454
|
+
baseTokenMint: additionalData.jupiterLendData.baseTokenMint.toString(),
|
|
455
|
+
tokenReservesLiquidity: additionalData.jupiterLendData.tokenReservesLiquidity.toString(),
|
|
456
|
+
lendingSupplyPosition: additionalData.jupiterLendData.lendingSupplyPosition.toString(),
|
|
457
|
+
rewardsRateModel: additionalData.jupiterLendData.rewardsRateModel.toString(),
|
|
458
|
+
rateModel: additionalData.jupiterLendData.rateModel.toString(),
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
if (additionalData.kaminoVaultData) {
|
|
463
|
+
result.kaminoVaultData = {
|
|
464
|
+
vault: additionalData.kaminoVaultData.vault.toString(),
|
|
465
|
+
reserves: additionalData.kaminoVaultData.reserves.map((r) => ({
|
|
466
|
+
reserveAddress: r.reserveAddress.toString(),
|
|
467
|
+
marketAddress: r.marketAddress.toString(),
|
|
468
|
+
})),
|
|
469
|
+
tokenVault: additionalData.kaminoVaultData.tokenVault.toString(),
|
|
470
|
+
tokenMint: additionalData.kaminoVaultData.tokenMint.toString(),
|
|
471
|
+
baseVaultAuthority: additionalData.kaminoVaultData.baseVaultAuthority.toString(),
|
|
472
|
+
sharesMint: additionalData.kaminoVaultData.sharesMint.toString(),
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
if (additionalData.splStakePoolData) {
|
|
477
|
+
result.splStakePoolData = {
|
|
478
|
+
stakePoolAddress: additionalData.splStakePoolData.stakePoolAddress.toString(),
|
|
479
|
+
stakePoolProgramId: additionalData.splStakePoolData.stakePoolProgramId.toString(),
|
|
480
|
+
validatorList: additionalData.splStakePoolData.validatorList.toString(),
|
|
481
|
+
reserveStake: additionalData.splStakePoolData.reserveStake.toString(),
|
|
482
|
+
managerFeeAccount: additionalData.splStakePoolData.managerFeeAccount.toString(),
|
|
483
|
+
poolMint: additionalData.splStakePoolData.poolMint.toString(),
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
|
|
365
487
|
return result
|
|
366
488
|
}
|
|
367
489
|
|
|
@@ -371,8 +493,43 @@ export function fromAdditionalDataGenericJson(json: AdditionalDataGenericJson):
|
|
|
371
493
|
|
|
372
494
|
if (json.fragmetricData) {
|
|
373
495
|
result.fragmetricData = {
|
|
374
|
-
receiptTokenMint: new
|
|
375
|
-
wrappedTokenMint: new
|
|
496
|
+
receiptTokenMint: new PublicKey(json.fragmetricData.receiptTokenMint),
|
|
497
|
+
wrappedTokenMint: new PublicKey(json.fragmetricData.wrappedTokenMint),
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
if (json.jupiterLendData) {
|
|
502
|
+
result.jupiterLendData = {
|
|
503
|
+
baseTokenMint: new PublicKey(json.jupiterLendData.baseTokenMint),
|
|
504
|
+
tokenReservesLiquidity: new PublicKey(json.jupiterLendData.tokenReservesLiquidity),
|
|
505
|
+
lendingSupplyPosition: new PublicKey(json.jupiterLendData.lendingSupplyPosition),
|
|
506
|
+
rewardsRateModel: new PublicKey(json.jupiterLendData.rewardsRateModel),
|
|
507
|
+
rateModel: new PublicKey(json.jupiterLendData.rateModel),
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
if (json.kaminoVaultData) {
|
|
512
|
+
result.kaminoVaultData = {
|
|
513
|
+
vault: new PublicKey(json.kaminoVaultData.vault),
|
|
514
|
+
reserves: json.kaminoVaultData.reserves.map((r) => ({
|
|
515
|
+
reserveAddress: new PublicKey(r.reserveAddress),
|
|
516
|
+
marketAddress: new PublicKey(r.marketAddress),
|
|
517
|
+
})),
|
|
518
|
+
tokenVault: new PublicKey(json.kaminoVaultData.tokenVault),
|
|
519
|
+
tokenMint: new PublicKey(json.kaminoVaultData.tokenMint),
|
|
520
|
+
baseVaultAuthority: new PublicKey(json.kaminoVaultData.baseVaultAuthority),
|
|
521
|
+
sharesMint: new PublicKey(json.kaminoVaultData.sharesMint),
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
if (json.splStakePoolData) {
|
|
526
|
+
result.splStakePoolData = {
|
|
527
|
+
stakePoolAddress: new PublicKey(json.splStakePoolData.stakePoolAddress),
|
|
528
|
+
stakePoolProgramId: new PublicKey(json.splStakePoolData.stakePoolProgramId),
|
|
529
|
+
validatorList: new PublicKey(json.splStakePoolData.validatorList),
|
|
530
|
+
reserveStake: new PublicKey(json.splStakePoolData.reserveStake),
|
|
531
|
+
managerFeeAccount: new PublicKey(json.splStakePoolData.managerFeeAccount),
|
|
532
|
+
poolMint: new PublicKey(json.splStakePoolData.poolMint),
|
|
376
533
|
}
|
|
377
534
|
}
|
|
378
535
|
|
|
@@ -382,11 +539,11 @@ export function fromAdditionalDataGenericJson(json: AdditionalDataGenericJson):
|
|
|
382
539
|
/** Helper function to extract fragmetric data from additional data */
|
|
383
540
|
export function getFragmetricDataFromAdditionalData(additionalData?: AdditionalDataGeneric):
|
|
384
541
|
| {
|
|
385
|
-
receiptTokenMint:
|
|
386
|
-
wrappedTokenMint:
|
|
542
|
+
receiptTokenMint: PublicKey
|
|
543
|
+
wrappedTokenMint: PublicKey
|
|
387
544
|
}
|
|
388
545
|
| undefined {
|
|
389
546
|
if (!additionalData) return undefined
|
|
390
547
|
|
|
391
548
|
return additionalData.fragmetricData
|
|
392
|
-
}
|
|
549
|
+
}
|