@exponent-labs/exponent-vaults-fetcher 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/src/types.ts ADDED
@@ -0,0 +1,160 @@
1
+ import { IdlTypes, web3 } from "@coral-xyz/anchor"
2
+
3
+ import { ExponentVaults } from "@exponent-labs/exponent-vaults-idl"
4
+
5
+ import { TransformedAnchorType } from "./typeUtils"
6
+
7
+ export type ExponentVaultsTypes = IdlTypes<ExponentVaults>
8
+
9
+ //? ExponentVaults types descriptions
10
+ //? ================================
11
+ type AnchorExponentVaultAccount = ExponentVaultsTypes["exponentStrategyVault"]
12
+ export type ExponentVaultRaw = TransformedAnchorType<AnchorExponentVaultAccount>
13
+
14
+ type AnchorActionProposalAccount = ExponentVaultsTypes["actionProposal"]
15
+ export type ActionProposalRaw = TransformedAnchorType<AnchorActionProposalAccount>
16
+
17
+ type AnchorVaultFinancials = ExponentVaultsTypes["vaultFinancials"]
18
+ export type VaultFinancials = TransformedAnchorType<AnchorVaultFinancials>
19
+
20
+ export type VaultRoles = ExponentVaultRaw["roles"]
21
+ export type ProposalVoteConfig = ExponentVaultRaw["proposalVoteConfig"]
22
+ export type ReservesConfig = ExponentVaultRaw["reservesConfig"]
23
+ export type ProposalStatus = ActionProposalRaw["status"]
24
+
25
+ export type AnchorPriceId = ExponentVaultsTypes["priceId"]
26
+ export type PriceId =
27
+ | {
28
+ simple: {
29
+ priceId: bigint
30
+ underlyingMint: web3.PublicKey
31
+ }
32
+ }
33
+ | {
34
+ multiply: {
35
+ priceIds: bigint[]
36
+ underlyingMint: web3.PublicKey
37
+ }
38
+ }
39
+ export type TokenAccountEntry = {
40
+ tokenMint: web3.PublicKey
41
+ balances: {
42
+ tokenAccount: web3.PublicKey
43
+ priceId: PriceId
44
+ }[]
45
+ }
46
+
47
+ export type OrderbookEntry = {
48
+ orderbook: web3.PublicKey
49
+ userEscrowIdx: number
50
+ mint: web3.PublicKey
51
+ offerIdxVec: number[]
52
+ priceIdPt: PriceId
53
+ baseMint: web3.PublicKey
54
+ totalLiquidity: bigint
55
+ orderbookFlag: number
56
+ }
57
+
58
+ export type TokenEntryInterfaceType = "generic" | "kamino" | "marginfi" | "jitoRestaking" | "perena"
59
+ export type TokenEntry = {
60
+ mint: web3.PublicKey
61
+ tokenSquadsAccount: web3.PublicKey
62
+ tokenAccountVault: web3.PublicKey
63
+ currentLiquidity: bigint
64
+ mintFlag: number
65
+ interfaceType: TokenEntryInterfaceType
66
+ forceDeallocatePolicyIds: bigint[]
67
+ priceId: PriceId
68
+ }
69
+
70
+ export type YieldPositionEntry = {
71
+ yieldPosition: web3.PublicKey
72
+ vault: web3.PublicKey
73
+ priceIdPt: PriceId
74
+ }
75
+
76
+ export type ClmmPositionEntry = {
77
+ lpPosition: web3.PublicKey
78
+ market: web3.PublicKey
79
+ priceIdPt: PriceId
80
+ priceIdSy: PriceId
81
+ }
82
+
83
+ export type StrategyPosition =
84
+ | { orderbook: { 0: OrderbookEntry } }
85
+ | { tokenAccount: { 0: TokenAccountEntry } }
86
+ | { obligation: { 0: unknown } } //TODO define obligation type when it's implemented on the program
87
+ | { yieldPosition: { 0: YieldPositionEntry } }
88
+ | { clmmPosition: { 0: ClmmPositionEntry } }
89
+
90
+ export type ExponentVault = {
91
+ addressLookupTable: web3.PublicKey
92
+ squadsSettings: web3.PublicKey
93
+ squadsVault: web3.PublicKey
94
+ tokenEntries: TokenEntry[]
95
+ underlyingMint: web3.PublicKey
96
+ mintLp: web3.PublicKey
97
+ tokenLpEscrow: web3.PublicKey
98
+ normalWithdrawalCutBp: number
99
+ selfAddress: web3.PublicKey
100
+ signerBump: number[]
101
+ statusFlags: number
102
+ financials: VaultFinancials
103
+ strategyPositions: StrategyPosition[]
104
+ maxAumSupply: bigint
105
+ seedId: number[]
106
+ feeTreasury: web3.PublicKey
107
+ roles: VaultRoles
108
+ proposalVoteConfig: ProposalVoteConfig
109
+ reservesConfig: ReservesConfig
110
+ }
111
+
112
+ export type ActionProposal = {
113
+ vault: web3.PublicKey
114
+ proposalId: bigint
115
+ proposer: web3.PublicKey
116
+ actionData: Uint8Array
117
+ createdAt: bigint
118
+ votingEndsAt: bigint
119
+ timelockSeconds: number
120
+ executableAt: bigint
121
+ status: ProposalStatus
122
+ rejectVotes: bigint
123
+ optOutVotes: bigint
124
+ bump: number
125
+ reserved: number[]
126
+ }
127
+
128
+ export type ExponentPrice = {
129
+ priceId: bigint
130
+ priceMint: web3.PublicKey
131
+ underlyingMint: web3.PublicKey
132
+ price: Array<Array<bigint | number | string>>
133
+ positionsAmount: bigint
134
+ lastUpdatedAt: bigint
135
+ lastUpdatedSlot: bigint
136
+ priceType: number
137
+ impliedApyBps: number | null
138
+ impliedApy: number | null
139
+ priceInterfaceAccounts: web3.PublicKey
140
+ interfaceAccounts: web3.PublicKey[]
141
+ }
142
+
143
+ export type ExponentPrices = {
144
+ /** Authorized price managers */
145
+ managers: web3.PublicKey[]
146
+ /**
147
+ * Price storage indexed by on-chain priceId (node index in allocator).
148
+ * Index 0 is unused; valid price ids start from 1.
149
+ */
150
+ prices: Array<ExponentPrice | null>
151
+ }
152
+ //? ================================
153
+ //? ExponentVaults types descriptions
154
+
155
+ //? Withdrawal types descriptions
156
+ //? ================================
157
+ type AnchorWithdrawalAccount = ExponentVaultsTypes["withdrawalAccount"]
158
+ export type WithdrawalAccount = TransformedAnchorType<AnchorWithdrawalAccount>
159
+ //? ================================
160
+ //? Withdrawal types descriptions
package/tsconfig.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "compilerOptions": {
3
+ "rootDir": "src",
4
+ "sourceMap": true,
5
+ "incremental": true,
6
+ "composite": true,
7
+ "target": "ESNext",
8
+ "module": "CommonJS",
9
+ "declaration": true,
10
+ "outDir": "./build",
11
+ "esModuleInterop": true,
12
+ "forceConsistentCasingInFileNames": true,
13
+ "skipLibCheck": true
14
+ },
15
+ "include": ["src"],
16
+ "exclude": ["build"],
17
+ "references": [
18
+ { "path": "../exponent-vaults-idl" },
19
+ { "path": "../exponent-vaults-pda" },
20
+ { "path": "../exponent-types" }
21
+ ]
22
+ }