@exponent-labs/exponent-sdk 0.9.0 → 0.9.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/build/client/vaults/index.d.ts +2 -0
- package/build/client/vaults/index.js +2 -0
- package/build/client/vaults/index.js.map +1 -1
- package/build/client/vaults/types/index.d.ts +2 -0
- package/build/client/vaults/types/index.js +2 -0
- package/build/client/vaults/types/index.js.map +1 -1
- package/build/client/vaults/types/kaminoFarmEntry.d.ts +15 -0
- package/build/client/vaults/types/kaminoFarmEntry.js +17 -0
- package/build/client/vaults/types/kaminoFarmEntry.js.map +1 -0
- package/build/client/vaults/types/kaminoObligationEntry.d.ts +21 -4
- package/build/client/vaults/types/kaminoObligationEntry.js +2 -1
- package/build/client/vaults/types/kaminoObligationEntry.js.map +1 -1
- package/build/client/vaults/types/positionUpdate.d.ts +9 -0
- package/build/client/vaults/types/positionUpdate.js +23 -0
- package/build/client/vaults/types/positionUpdate.js.map +1 -1
- package/build/client/vaults/types/proposalAction.js +0 -3
- package/build/client/vaults/types/proposalAction.js.map +1 -1
- package/build/client/vaults/types/reserveFarmMapping.d.ts +19 -0
- package/build/client/vaults/types/reserveFarmMapping.js +18 -0
- package/build/client/vaults/types/reserveFarmMapping.js.map +1 -0
- package/build/client/vaults/types/strategyPosition.d.ts +5 -0
- package/build/client/vaults/types/strategyPosition.js +5 -0
- package/build/client/vaults/types/strategyPosition.js.map +1 -1
- package/build/exponentVaults/aumCalculator.d.ts +25 -4
- package/build/exponentVaults/aumCalculator.js +236 -15
- package/build/exponentVaults/aumCalculator.js.map +1 -1
- package/build/exponentVaults/fetcher.d.ts +52 -0
- package/build/exponentVaults/fetcher.js +199 -0
- package/build/exponentVaults/fetcher.js.map +1 -0
- package/build/exponentVaults/index.d.ts +10 -9
- package/build/exponentVaults/index.js +26 -8
- package/build/exponentVaults/index.js.map +1 -1
- package/build/exponentVaults/kamino-farms.d.ts +144 -0
- package/build/exponentVaults/kamino-farms.js +396 -0
- package/build/exponentVaults/kamino-farms.js.map +1 -0
- package/build/exponentVaults/loopscale/client.d.ts +240 -0
- package/build/exponentVaults/loopscale/client.js +590 -0
- package/build/exponentVaults/loopscale/client.js.map +1 -0
- package/build/exponentVaults/loopscale/client.test.d.ts +1 -0
- package/build/exponentVaults/loopscale/client.test.js +183 -0
- package/build/exponentVaults/loopscale/client.test.js.map +1 -0
- package/build/exponentVaults/loopscale/helpers.d.ts +29 -0
- package/build/exponentVaults/loopscale/helpers.js +119 -0
- package/build/exponentVaults/loopscale/helpers.js.map +1 -0
- package/build/exponentVaults/loopscale/index.d.ts +3 -0
- package/build/exponentVaults/loopscale/index.js +12 -0
- package/build/exponentVaults/loopscale/index.js.map +1 -0
- package/build/exponentVaults/loopscale/prepared-transactions.d.ts +13 -0
- package/build/exponentVaults/loopscale/prepared-transactions.js +271 -0
- package/build/exponentVaults/loopscale/prepared-transactions.js.map +1 -0
- package/build/exponentVaults/loopscale/prepared-transactions.test.d.ts +1 -0
- package/build/exponentVaults/loopscale/prepared-transactions.test.js +400 -0
- package/build/exponentVaults/loopscale/prepared-transactions.test.js.map +1 -0
- package/build/exponentVaults/loopscale/prepared-types.d.ts +62 -0
- package/build/exponentVaults/loopscale/prepared-types.js +3 -0
- package/build/exponentVaults/loopscale/prepared-types.js.map +1 -0
- package/build/exponentVaults/loopscale/response-plan.d.ts +69 -0
- package/build/exponentVaults/loopscale/response-plan.js +141 -0
- package/build/exponentVaults/loopscale/response-plan.js.map +1 -0
- package/build/exponentVaults/loopscale/response-plan.test.d.ts +1 -0
- package/build/exponentVaults/loopscale/response-plan.test.js +139 -0
- package/build/exponentVaults/loopscale/response-plan.test.js.map +1 -0
- package/build/exponentVaults/loopscale/send-plan.d.ts +75 -0
- package/build/exponentVaults/loopscale/send-plan.js +235 -0
- package/build/exponentVaults/loopscale/send-plan.js.map +1 -0
- package/build/exponentVaults/loopscale/types.d.ts +443 -0
- package/build/exponentVaults/loopscale/types.js +3 -0
- package/build/exponentVaults/loopscale/types.js.map +1 -0
- package/build/exponentVaults/loopscale-client.d.ts +113 -524
- package/build/exponentVaults/loopscale-client.js +296 -539
- package/build/exponentVaults/loopscale-client.js.map +1 -1
- package/build/exponentVaults/loopscale-client.test.d.ts +1 -0
- package/build/exponentVaults/loopscale-client.test.js +162 -0
- package/build/exponentVaults/loopscale-client.test.js.map +1 -0
- package/build/exponentVaults/loopscale-client.types.d.ts +425 -0
- package/build/exponentVaults/loopscale-client.types.js +3 -0
- package/build/exponentVaults/loopscale-client.types.js.map +1 -0
- package/build/exponentVaults/loopscale-execution.d.ts +125 -0
- package/build/exponentVaults/loopscale-execution.js +341 -0
- package/build/exponentVaults/loopscale-execution.js.map +1 -0
- package/build/exponentVaults/loopscale-execution.test.d.ts +1 -0
- package/build/exponentVaults/loopscale-execution.test.js +139 -0
- package/build/exponentVaults/loopscale-execution.test.js.map +1 -0
- package/build/exponentVaults/loopscale-vault.d.ts +115 -0
- package/build/exponentVaults/loopscale-vault.js +275 -0
- package/build/exponentVaults/loopscale-vault.js.map +1 -0
- package/build/exponentVaults/loopscale-vault.test.d.ts +1 -0
- package/build/exponentVaults/loopscale-vault.test.js +102 -0
- package/build/exponentVaults/loopscale-vault.test.js.map +1 -0
- package/build/exponentVaults/policyBuilders.d.ts +62 -0
- package/build/exponentVaults/policyBuilders.js +119 -2
- package/build/exponentVaults/policyBuilders.js.map +1 -1
- package/build/exponentVaults/pricePathResolver.d.ts +45 -0
- package/build/exponentVaults/pricePathResolver.js +198 -0
- package/build/exponentVaults/pricePathResolver.js.map +1 -0
- package/build/exponentVaults/pricePathResolver.test.d.ts +1 -0
- package/build/exponentVaults/pricePathResolver.test.js +369 -0
- package/build/exponentVaults/pricePathResolver.test.js.map +1 -0
- package/build/exponentVaults/syncTransaction.js +4 -1
- package/build/exponentVaults/syncTransaction.js.map +1 -1
- package/build/exponentVaults/titan-quote.js +170 -36
- package/build/exponentVaults/titan-quote.js.map +1 -1
- package/build/exponentVaults/vault-instruction-types.d.ts +363 -0
- package/build/exponentVaults/vault-instruction-types.js +128 -0
- package/build/exponentVaults/vault-instruction-types.js.map +1 -0
- package/build/exponentVaults/vault-interaction.d.ts +203 -343
- package/build/exponentVaults/vault-interaction.js +1894 -426
- package/build/exponentVaults/vault-interaction.js.map +1 -1
- package/build/exponentVaults/vault-interaction.kamino-vault.test.d.ts +1 -0
- package/build/exponentVaults/vault-interaction.kamino-vault.test.js +143 -0
- package/build/exponentVaults/vault-interaction.kamino-vault.test.js.map +1 -0
- package/build/exponentVaults/vault.d.ts +51 -2
- package/build/exponentVaults/vault.js +324 -48
- package/build/exponentVaults/vault.js.map +1 -1
- package/build/exponentVaults/vaultTransactionBuilder.d.ts +100 -134
- package/build/exponentVaults/vaultTransactionBuilder.js +383 -285
- package/build/exponentVaults/vaultTransactionBuilder.js.map +1 -1
- package/build/exponentVaults/vaultTransactionBuilder.test.d.ts +1 -0
- package/build/exponentVaults/vaultTransactionBuilder.test.js +297 -0
- package/build/exponentVaults/vaultTransactionBuilder.test.js.map +1 -0
- package/build/marketThree.d.ts +6 -2
- package/build/marketThree.js +10 -8
- package/build/marketThree.js.map +1 -1
- package/package.json +34 -32
- package/src/client/vaults/index.ts +2 -0
- package/src/client/vaults/types/index.ts +2 -0
- package/src/client/vaults/types/kaminoFarmEntry.ts +32 -0
- package/src/client/vaults/types/kaminoObligationEntry.ts +6 -3
- package/src/client/vaults/types/positionUpdate.ts +62 -0
- package/src/client/vaults/types/proposalAction.ts +0 -3
- package/src/client/vaults/types/reserveFarmMapping.ts +35 -0
- package/src/client/vaults/types/strategyPosition.ts +18 -1
- package/src/exponentVaults/aumCalculator.ts +353 -16
- package/src/exponentVaults/fetcher.ts +257 -0
- package/src/exponentVaults/index.ts +65 -40
- package/src/exponentVaults/kamino-farms.ts +538 -0
- package/src/exponentVaults/loopscale/client.ts +808 -0
- package/src/exponentVaults/loopscale/helpers.ts +172 -0
- package/src/exponentVaults/loopscale/index.ts +57 -0
- package/src/exponentVaults/loopscale/prepared-transactions.ts +435 -0
- package/src/exponentVaults/loopscale/prepared-types.ts +73 -0
- package/src/exponentVaults/loopscale/types.ts +466 -0
- package/src/exponentVaults/policyBuilders.ts +170 -0
- package/src/exponentVaults/pricePathResolver.test.ts +466 -0
- package/src/exponentVaults/pricePathResolver.ts +273 -0
- package/src/exponentVaults/syncTransaction.ts +6 -1
- package/src/exponentVaults/titan-quote.ts +231 -45
- package/src/exponentVaults/vault-instruction-types.ts +493 -0
- package/src/exponentVaults/vault-interaction.kamino-vault.test.ts +149 -0
- package/src/exponentVaults/vault-interaction.ts +2818 -799
- package/src/exponentVaults/vault.ts +474 -63
- package/src/exponentVaults/vaultTransactionBuilder.test.ts +349 -0
- package/src/exponentVaults/vaultTransactionBuilder.ts +581 -433
- package/src/marketThree.ts +14 -6
- package/src/exponentVaults/loopscale-client.ts +0 -1373
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ActionProposal,
|
|
3
|
+
ExponentPrices,
|
|
4
|
+
ExponentVault,
|
|
5
|
+
WithdrawalAccount,
|
|
6
|
+
} from "@exponent-labs/exponent-vaults-fetcher"
|
|
7
|
+
import {
|
|
8
|
+
ExponentVaultsFetcher as AnchorExponentVaultsFetcher,
|
|
9
|
+
IGNORED_VAULTS,
|
|
10
|
+
} from "@exponent-labs/exponent-vaults-fetcher"
|
|
11
|
+
import { PROGRAM_ID } from "@exponent-labs/exponent-vaults-idl"
|
|
12
|
+
import { Connection, PublicKey, type GetProgramAccountsFilter } from "@solana/web3.js"
|
|
13
|
+
|
|
14
|
+
import { deserializeActionProposalAccount } from "../client/vaults/accounts/actionProposal"
|
|
15
|
+
import { deserializeExponentStrategyVaultAccount } from "../client/vaults/accounts/exponentStrategyVault"
|
|
16
|
+
import { deserializeWithdrawalAccountAccount } from "../client/vaults/accounts/withdrawalAccount"
|
|
17
|
+
|
|
18
|
+
const VAULT_DISCRIMINATOR_BYTES = "HYNPjgfkiFc"
|
|
19
|
+
const ACTION_PROPOSAL_DISCRIMINATOR_BYTES = "RDHYHK5bgsA"
|
|
20
|
+
const WITHDRAWAL_ACCOUNT_DISCRIMINATOR_BYTES = "Hg45oo8yvEZ"
|
|
21
|
+
const TOKEN_ENTRIES_VEC_OFFSET = 104
|
|
22
|
+
const MAX_TOKEN_ENTRIES = 64
|
|
23
|
+
|
|
24
|
+
function isPublicKey(value: unknown): value is PublicKey {
|
|
25
|
+
return value instanceof PublicKey
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function toAnchorVariantKey(kind: string): string {
|
|
29
|
+
return kind.charAt(0).toLowerCase() + kind.slice(1)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function transformGeneratedData(value: unknown): unknown {
|
|
33
|
+
if (isPublicKey(value) || value instanceof Uint8Array) {
|
|
34
|
+
return value
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (Array.isArray(value)) {
|
|
38
|
+
return value.map(transformGeneratedData)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (!value || typeof value !== "object") {
|
|
42
|
+
return value
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const record = value as Record<string, unknown>
|
|
46
|
+
if (typeof record.__kind === "string") {
|
|
47
|
+
const variantKey = toAnchorVariantKey(record.__kind)
|
|
48
|
+
if (Array.isArray(record.fields)) {
|
|
49
|
+
return {
|
|
50
|
+
[variantKey]: record.fields.map(transformGeneratedData),
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const transformedEntries = Object.entries(record)
|
|
55
|
+
.filter(([key]) => key !== "__kind")
|
|
56
|
+
.map(([key, nestedValue]) => [key, transformGeneratedData(nestedValue)] as const)
|
|
57
|
+
|
|
58
|
+
if (transformedEntries.length === 0) {
|
|
59
|
+
return variantKey
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return {
|
|
63
|
+
[variantKey]: Object.fromEntries(transformedEntries),
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return Object.fromEntries(
|
|
68
|
+
Object.entries(record).map(([key, nestedValue]) => [key, transformGeneratedData(nestedValue)]),
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function deserializeExponentStrategyVaultFetcherShape(data: Uint8Array): ExponentVault {
|
|
73
|
+
return transformGeneratedData(deserializeExponentStrategyVaultAccount(data)) as ExponentVault
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function deserializeActionProposalFetcherShape(data: Uint8Array): ActionProposal {
|
|
77
|
+
return transformGeneratedData(deserializeActionProposalAccount(data)) as ActionProposal
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function deserializeWithdrawalAccountFetcherShape(data: Uint8Array): WithdrawalAccount {
|
|
81
|
+
return transformGeneratedData(deserializeWithdrawalAccountAccount(data)) as WithdrawalAccount
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export class ExponentVaultsFetcher {
|
|
85
|
+
public readonly programId: PublicKey
|
|
86
|
+
public readonly program
|
|
87
|
+
private readonly anchorFetcher: AnchorExponentVaultsFetcher
|
|
88
|
+
private readonly connection: Connection
|
|
89
|
+
|
|
90
|
+
constructor(connection: Connection, programId: PublicKey | string = PROGRAM_ID) {
|
|
91
|
+
this.connection = connection
|
|
92
|
+
this.anchorFetcher = new AnchorExponentVaultsFetcher(connection, programId)
|
|
93
|
+
this.programId = this.anchorFetcher.programId
|
|
94
|
+
this.program = this.anchorFetcher.program
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
async fetchVault(address: PublicKey): Promise<ExponentVault> {
|
|
98
|
+
return this.fetchVaultDeserialized(address)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
async fetchWithdrawalAccount(address: PublicKey): Promise<WithdrawalAccount> {
|
|
102
|
+
return this.fetchWithdrawalAccountDeserialized(address)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
async fetchActionProposal(address: PublicKey): Promise<ActionProposal> {
|
|
106
|
+
return this.fetchActionProposalDeserialized(address)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
async fetchAllVaults(filters?: GetProgramAccountsFilter[]): Promise<Array<{ publicKey: PublicKey; account: ExponentVault }>> {
|
|
110
|
+
const rawAccounts = await this.connection.getProgramAccounts(this.programId, {
|
|
111
|
+
filters: [{ memcmp: { offset: 0, bytes: VAULT_DISCRIMINATOR_BYTES } }, ...(filters ?? [])],
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
const decoded: Array<{ publicKey: PublicKey; account: ExponentVault }> = []
|
|
115
|
+
for (const { pubkey, account } of rawAccounts) {
|
|
116
|
+
if (IGNORED_VAULTS.has(pubkey.toBase58())) continue
|
|
117
|
+
if (account.data.length < TOKEN_ENTRIES_VEC_OFFSET + 4) continue
|
|
118
|
+
|
|
119
|
+
const tokenEntriesLen = account.data.readUInt32LE(TOKEN_ENTRIES_VEC_OFFSET)
|
|
120
|
+
if (tokenEntriesLen > MAX_TOKEN_ENTRIES) continue
|
|
121
|
+
|
|
122
|
+
try {
|
|
123
|
+
decoded.push({
|
|
124
|
+
publicKey: pubkey,
|
|
125
|
+
account: deserializeExponentStrategyVaultFetcherShape(account.data),
|
|
126
|
+
})
|
|
127
|
+
} catch {
|
|
128
|
+
// Skip accounts that fail to deserialize.
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return decoded
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
async fetchAllActionProposals(
|
|
136
|
+
filters?: GetProgramAccountsFilter[],
|
|
137
|
+
): Promise<Array<{ publicKey: PublicKey; account: ActionProposal }>> {
|
|
138
|
+
const rawAccounts = await this.connection.getProgramAccounts(this.programId, {
|
|
139
|
+
filters: [{ memcmp: { offset: 0, bytes: ACTION_PROPOSAL_DISCRIMINATOR_BYTES } }, ...(filters ?? [])],
|
|
140
|
+
})
|
|
141
|
+
|
|
142
|
+
const decoded: Array<{ publicKey: PublicKey; account: ActionProposal }> = []
|
|
143
|
+
for (const { pubkey, account } of rawAccounts) {
|
|
144
|
+
try {
|
|
145
|
+
decoded.push({
|
|
146
|
+
publicKey: pubkey,
|
|
147
|
+
account: deserializeActionProposalFetcherShape(account.data),
|
|
148
|
+
})
|
|
149
|
+
} catch {
|
|
150
|
+
// Skip accounts that fail to deserialize.
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return decoded
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
async fetchAllWithdrawalAccounts(
|
|
158
|
+
filters?: GetProgramAccountsFilter[],
|
|
159
|
+
): Promise<Array<{ publicKey: PublicKey; account: WithdrawalAccount }>> {
|
|
160
|
+
const rawAccounts = await this.connection.getProgramAccounts(this.programId, {
|
|
161
|
+
filters: [{ memcmp: { offset: 0, bytes: WITHDRAWAL_ACCOUNT_DISCRIMINATOR_BYTES } }, ...(filters ?? [])],
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
const decoded: Array<{ publicKey: PublicKey; account: WithdrawalAccount }> = []
|
|
165
|
+
for (const { pubkey, account } of rawAccounts) {
|
|
166
|
+
try {
|
|
167
|
+
decoded.push({
|
|
168
|
+
publicKey: pubkey,
|
|
169
|
+
account: deserializeWithdrawalAccountFetcherShape(account.data),
|
|
170
|
+
})
|
|
171
|
+
} catch {
|
|
172
|
+
// Skip accounts that fail to deserialize.
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return decoded
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
async fetchAllActionProposalsForVault(
|
|
180
|
+
vaultAddress: PublicKey,
|
|
181
|
+
filters?: GetProgramAccountsFilter[],
|
|
182
|
+
): Promise<Array<{ publicKey: PublicKey; account: ActionProposal }>> {
|
|
183
|
+
return this.fetchAllActionProposals([
|
|
184
|
+
{
|
|
185
|
+
memcmp: {
|
|
186
|
+
offset: 8,
|
|
187
|
+
bytes: vaultAddress.toBase58(),
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
...(filters ?? []),
|
|
191
|
+
])
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
async fetchVaultDeserialized(address: PublicKey): Promise<ExponentVault> {
|
|
195
|
+
if (IGNORED_VAULTS.has(address.toBase58())) {
|
|
196
|
+
throw new Error(`Vault ${address.toBase58()} is in the ignore list and cannot be fetched`)
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const accountInfo = await this.connection.getAccountInfo(address)
|
|
200
|
+
if (!accountInfo) {
|
|
201
|
+
throw new Error(`ExponentStrategyVault account not found at address: ${address.toBase58()}`)
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
return deserializeExponentStrategyVaultFetcherShape(accountInfo.data)
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
async fetchActionProposalDeserialized(address: PublicKey): Promise<ActionProposal> {
|
|
208
|
+
const accountInfo = await this.connection.getAccountInfo(address)
|
|
209
|
+
if (!accountInfo) {
|
|
210
|
+
throw new Error(`ActionProposal account not found at address: ${address.toBase58()}`)
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return deserializeActionProposalFetcherShape(accountInfo.data)
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
async fetchWithdrawalAccountDeserialized(address: PublicKey): Promise<WithdrawalAccount> {
|
|
217
|
+
const accountInfo = await this.connection.getAccountInfo(address)
|
|
218
|
+
if (!accountInfo) {
|
|
219
|
+
throw new Error(`WithdrawalAccount account not found at address: ${address.toBase58()}`)
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
return deserializeWithdrawalAccountFetcherShape(accountInfo.data)
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
async fetchAllVaultsDeserialized(
|
|
226
|
+
filters?: GetProgramAccountsFilter[],
|
|
227
|
+
): Promise<Array<{ publicKey: PublicKey; account: ExponentVault }>> {
|
|
228
|
+
return this.fetchAllVaults(filters)
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
async fetchAllActionProposalsDeserialized(
|
|
232
|
+
filters?: GetProgramAccountsFilter[],
|
|
233
|
+
): Promise<Array<{ publicKey: PublicKey; account: ActionProposal }>> {
|
|
234
|
+
return this.fetchAllActionProposals(filters)
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
async fetchAllActionProposalsForVaultDeserialized(
|
|
238
|
+
vaultAddress: PublicKey,
|
|
239
|
+
filters?: GetProgramAccountsFilter[],
|
|
240
|
+
): Promise<Array<{ publicKey: PublicKey; account: ActionProposal }>> {
|
|
241
|
+
return this.fetchAllActionProposalsForVault(vaultAddress, filters)
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
async fetchAllWithdrawalAccountsDeserialized(
|
|
245
|
+
filters?: GetProgramAccountsFilter[],
|
|
246
|
+
): Promise<Array<{ publicKey: PublicKey; account: WithdrawalAccount }>> {
|
|
247
|
+
return this.fetchAllWithdrawalAccounts(filters)
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
async fetchExponentPrices(): Promise<ExponentPrices> {
|
|
251
|
+
return this.anchorFetcher.fetchExponentPrices()
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
getRequiredPriceIds(vault: ExponentVault): Set<bigint> {
|
|
255
|
+
return this.anchorFetcher.getRequiredPriceIds(vault)
|
|
256
|
+
}
|
|
257
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { ExponentVault } from "./vault"
|
|
2
|
+
export { ExponentVaultsFetcher } from "./fetcher"
|
|
2
3
|
export {
|
|
3
4
|
SYNTHETIC_USD_DECIMALS,
|
|
4
5
|
SYNTHETIC_USD_MINT,
|
|
@@ -8,7 +9,6 @@ export {
|
|
|
8
9
|
} from "./vault"
|
|
9
10
|
export { AumCalculator, PositionType } from "./aumCalculator"
|
|
10
11
|
export type { AumResult } from "./aumCalculator"
|
|
11
|
-
export { ExponentVaultsFetcher } from "@exponent-labs/exponent-vaults-fetcher"
|
|
12
12
|
export { PROGRAM_ID as EXPONENT_VAULTS_PROGRAM_ID } from "@exponent-labs/exponent-vaults-idl"
|
|
13
13
|
export {
|
|
14
14
|
createActivateProposalInstruction,
|
|
@@ -68,8 +68,14 @@ export * as vaultsEvents from "./events"
|
|
|
68
68
|
export {
|
|
69
69
|
// Constants
|
|
70
70
|
KAMINO_LENDING_PROGRAM_ID,
|
|
71
|
+
KAMINO_VAULT_PROGRAM_ID,
|
|
72
|
+
KAMINO_FARMS_PROGRAM_ID,
|
|
71
73
|
KAMINO_DISCRIMINATORS,
|
|
74
|
+
KAMINO_VAULT_DISCRIMINATORS,
|
|
75
|
+
KAMINO_FARM_DISCRIMINATORS,
|
|
72
76
|
KAMINO_ACCOUNT_INDICES,
|
|
77
|
+
KAMINO_VAULT_ACCOUNT_INDICES,
|
|
78
|
+
KAMINO_FARM_ACCOUNT_INDICES,
|
|
73
79
|
// Generic policy builders
|
|
74
80
|
createProgramInteractionPolicy,
|
|
75
81
|
createInstructionConstraint,
|
|
@@ -83,6 +89,8 @@ export {
|
|
|
83
89
|
createKaminoRepayPolicy,
|
|
84
90
|
createKaminoFullAccessPolicy,
|
|
85
91
|
createKaminoPolicy,
|
|
92
|
+
createKaminoVaultPolicy,
|
|
93
|
+
createKaminoFarmPolicy,
|
|
86
94
|
// Orderbook policy builders
|
|
87
95
|
EXPONENT_ORDERBOOK_PROGRAM_ID,
|
|
88
96
|
MARGINFI_STANDARD_PROGRAM_ID,
|
|
@@ -133,6 +141,8 @@ export type {
|
|
|
133
141
|
OrderbookPolicyAction,
|
|
134
142
|
CorePolicyAction,
|
|
135
143
|
KaminoPolicyAction,
|
|
144
|
+
KaminoVaultPolicyAction,
|
|
145
|
+
KaminoFarmPolicyAction,
|
|
136
146
|
StandardProgramPolicyAction,
|
|
137
147
|
AllowedSyMintProgram,
|
|
138
148
|
LoopscalePolicyAction,
|
|
@@ -141,8 +151,11 @@ export type {
|
|
|
141
151
|
// Vault interaction builders (Kamino + Orderbook + Core)
|
|
142
152
|
export {
|
|
143
153
|
createVaultSyncTransaction,
|
|
154
|
+
createVaultSyncTransactions,
|
|
144
155
|
createOrderbookSyncTransaction,
|
|
145
156
|
kaminoAction,
|
|
157
|
+
kaminoVaultAction,
|
|
158
|
+
kaminoFarmAction,
|
|
146
159
|
orderbookAction,
|
|
147
160
|
coreAction,
|
|
148
161
|
syAction,
|
|
@@ -150,6 +163,8 @@ export {
|
|
|
150
163
|
clmmAction,
|
|
151
164
|
loopscaleAction,
|
|
152
165
|
VaultAction,
|
|
166
|
+
KaminoVaultAction,
|
|
167
|
+
KaminoFarmAction,
|
|
153
168
|
OrderbookAction,
|
|
154
169
|
OrderbookTradeDirection,
|
|
155
170
|
CoreAction,
|
|
@@ -162,6 +177,15 @@ export type {
|
|
|
162
177
|
VaultInstruction,
|
|
163
178
|
MarketInstruction,
|
|
164
179
|
ReserveInstruction,
|
|
180
|
+
KaminoVaultInstruction,
|
|
181
|
+
KaminoVaultDepositInstruction,
|
|
182
|
+
KaminoVaultWithdrawInstruction,
|
|
183
|
+
KaminoFarmInstruction,
|
|
184
|
+
KaminoFarmInitializeUserInstruction,
|
|
185
|
+
KaminoFarmStakeInstruction,
|
|
186
|
+
KaminoFarmUnstakeInstruction,
|
|
187
|
+
KaminoFarmWithdrawUnstakedDepositsInstruction,
|
|
188
|
+
KaminoFarmHarvestRewardInstruction,
|
|
165
189
|
OrderbookInstruction,
|
|
166
190
|
OrderbookPostOfferInstruction,
|
|
167
191
|
OrderbookMarketOfferInstruction,
|
|
@@ -194,24 +218,38 @@ export { getTitanQuote } from "./titan-quote"
|
|
|
194
218
|
export type { TitanQuoteResult } from "./titan-quote"
|
|
195
219
|
|
|
196
220
|
// Loopscale Client
|
|
197
|
-
export {
|
|
221
|
+
export {
|
|
222
|
+
LoopscaleClient,
|
|
223
|
+
deserializeLoopscaleTransactionResponse,
|
|
224
|
+
deserializeLoopscaleTransactionBatchResponse,
|
|
225
|
+
extractCreatedStrategyAddress,
|
|
226
|
+
extractCreatedStrategyNonce,
|
|
227
|
+
getLoopscaleTransactionResponses,
|
|
228
|
+
identifyLoopscaleInstruction,
|
|
229
|
+
} from "./loopscale"
|
|
198
230
|
export type {
|
|
199
231
|
LoopscaleClientConfig,
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
LoopscaleGeneratedInstruction,
|
|
210
|
-
LoopscaleGeneratedInstructionBundle,
|
|
232
|
+
LoopscaleTransactionSignature,
|
|
233
|
+
LoopscaleVersionedTransactionResponse,
|
|
234
|
+
LoopscaleVersionedTransactionBatchResponse,
|
|
235
|
+
LoopscaleExpectedLoanInfo,
|
|
236
|
+
LoopscaleTransactionsResponse,
|
|
237
|
+
LoopscaleLoanTransactionResponse,
|
|
238
|
+
LoopscaleCreateLoanResponse,
|
|
239
|
+
LoopscaleTransactionResponse,
|
|
240
|
+
LoopscaleInstructionName,
|
|
211
241
|
LoopscaleQuoteParams,
|
|
242
|
+
LoopscaleQuote,
|
|
243
|
+
LoopscaleMaxQuoteParams,
|
|
244
|
+
LoopscaleMaxQuote,
|
|
245
|
+
LoopscaleLoanInfoParams,
|
|
246
|
+
LoopscaleLoanInfoResponse,
|
|
247
|
+
LoopscaleGetStrategiesParams,
|
|
248
|
+
LoopscaleStrategyInfoResponse,
|
|
212
249
|
LoopscaleCreateStrategyParams,
|
|
213
250
|
LoopscaleDepositStrategyParams,
|
|
214
251
|
LoopscaleWithdrawStrategyParams,
|
|
252
|
+
LoopscaleCloseLoanParams,
|
|
215
253
|
LoopscaleCloseStrategyParams,
|
|
216
254
|
ExternalYieldSourceParams,
|
|
217
255
|
TxnExternalYieldSourceArgs,
|
|
@@ -223,33 +261,18 @@ export type {
|
|
|
223
261
|
StrategyCollateralUpdates,
|
|
224
262
|
EditStrategySettingsArgs,
|
|
225
263
|
LoopscaleUpdateStrategyParams,
|
|
226
|
-
LoopscaleBorrowPrincipalParams,
|
|
227
|
-
LoopscaleRepayLoanParams,
|
|
228
|
-
LoopscaleCloseLoanParams,
|
|
229
|
-
LoopscaleQuote,
|
|
230
264
|
LoopscaleCreateLoanParams,
|
|
231
|
-
|
|
265
|
+
LoopscaleBorrowPrincipalParams,
|
|
232
266
|
LoopscaleDepositCollateralParams,
|
|
267
|
+
LoopscaleRepayLoanSimpleParams,
|
|
233
268
|
LoopscaleWithdrawCollateralParams,
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
LoopscaleStrategyInfoResponse,
|
|
242
|
-
LoopscaleCollateralHoldersParams,
|
|
243
|
-
LoopscaleCollateralHolder,
|
|
244
|
-
LoopscaleHistoricalCollateralHoldersParams,
|
|
245
|
-
LoopscaleHistoricalCollateralHolder,
|
|
246
|
-
LoopscaleVaultDepositorsParams,
|
|
247
|
-
LoopscaleVaultDepositor,
|
|
248
|
-
LoopscaleVaultInfoParams,
|
|
249
|
-
LoopscaleVaultInfoResponse,
|
|
250
|
-
LoopscaleLoopInfoParams,
|
|
251
|
-
LoopscaleLoopVaultInfo,
|
|
252
|
-
} from "./loopscale-client"
|
|
269
|
+
} from "./loopscale"
|
|
270
|
+
export type {
|
|
271
|
+
LoopscaleBuildTransactionsContext,
|
|
272
|
+
LoopscaleBuiltTransaction,
|
|
273
|
+
LoopscalePreparedTransaction,
|
|
274
|
+
LoopscaleVaultPreparationContext,
|
|
275
|
+
} from "./loopscale"
|
|
253
276
|
|
|
254
277
|
export { KaminoMarket, KAMINO_MARKETS, KAMINO_RESERVES, getKaminoReserves } from "./kamino-markets"
|
|
255
278
|
export type { KaminoReserveInfo } from "./kamino-markets"
|
|
@@ -287,12 +310,14 @@ export {
|
|
|
287
310
|
} from "./squadsVaultTxnResolver"
|
|
288
311
|
|
|
289
312
|
// Vault Transaction Builder
|
|
290
|
-
export { VaultTransactionBuilder
|
|
313
|
+
export { VaultTransactionBuilder } from "./vaultTransactionBuilder"
|
|
291
314
|
export type {
|
|
292
315
|
VaultTransactionBuilderConfig,
|
|
316
|
+
VaultTransactionBuilderLoopscaleConfig,
|
|
317
|
+
LoopscaleStepOptions,
|
|
293
318
|
StepOptions,
|
|
294
319
|
TransactionSet,
|
|
295
320
|
VaultTransactionBuildResult,
|
|
296
|
-
|
|
297
|
-
|
|
321
|
+
SendOptions,
|
|
322
|
+
SendResult,
|
|
298
323
|
} from "./vaultTransactionBuilder"
|