@exponent-labs/exponent-types 0.1.8 → 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 +2 -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 +44 -35
- package/build/generic.js +31 -27
- package/build/generic.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/jito-restaking.d.ts +13 -12
- package/build/kamino.d.ts +26 -26
- package/build/marginfi.d.ts +18 -17
- package/build/orderbook.d.ts +33 -27
- package/build/orderbook.js +3 -3
- package/build/orderbook.js.map +1 -1
- package/build/perena.d.ts +13 -12
- package/build/vault.d.ts +16 -15
- package/package.json +4 -3
- package/src/common.ts +9 -8
- package/src/cpi.ts +3 -3
- package/src/flavor.ts +21 -22
- package/src/generic.ts +73 -64
- package/src/index.ts +1 -1
- package/src/jito-restaking.ts +14 -14
- package/src/kamino.ts +27 -27
- package/src/marginfi.ts +19 -19
- package/src/orderbook.ts +35 -27
- package/src/perena.ts +14 -14
- package/src/vault.ts +17 -17
package/src/generic.ts
CHANGED
|
@@ -1,8 +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"
|
|
5
|
-
|
|
4
|
+
import BN from 'bn.js'
|
|
6
5
|
export type InterfaceTypeGeneric =
|
|
7
6
|
| {
|
|
8
7
|
pyth: {
|
|
@@ -67,6 +66,11 @@ export type InterfaceTypeGeneric =
|
|
|
67
66
|
| {
|
|
68
67
|
ore: Record<string, never>
|
|
69
68
|
}
|
|
69
|
+
| {
|
|
70
|
+
chainlink: {
|
|
71
|
+
padding: number[]
|
|
72
|
+
}
|
|
73
|
+
}
|
|
70
74
|
export type InterfaceTypeGenericJson =
|
|
71
75
|
| {
|
|
72
76
|
pyth: {
|
|
@@ -124,45 +128,50 @@ export type InterfaceTypeGenericJson =
|
|
|
124
128
|
}
|
|
125
129
|
}
|
|
126
130
|
| {
|
|
127
|
-
|
|
128
|
-
|
|
131
|
+
reflect: {
|
|
132
|
+
padding: number[]
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
| {
|
|
136
|
+
ore: Record<string, never>
|
|
129
137
|
}
|
|
130
|
-
}
|
|
131
138
|
| {
|
|
132
|
-
|
|
133
|
-
|
|
139
|
+
chainlink: {
|
|
140
|
+
padding: number[]
|
|
141
|
+
}
|
|
142
|
+
}
|
|
134
143
|
/** Additional data that different interface types may need */
|
|
135
144
|
export interface AdditionalDataGeneric {
|
|
136
145
|
fragmetricData?: {
|
|
137
|
-
receiptTokenMint:
|
|
138
|
-
wrappedTokenMint:
|
|
146
|
+
receiptTokenMint: PublicKey
|
|
147
|
+
wrappedTokenMint: PublicKey
|
|
139
148
|
}
|
|
140
149
|
jupiterLendData?: {
|
|
141
|
-
baseTokenMint:
|
|
142
|
-
tokenReservesLiquidity:
|
|
143
|
-
lendingSupplyPosition:
|
|
144
|
-
rewardsRateModel:
|
|
145
|
-
rateModel:
|
|
150
|
+
baseTokenMint: PublicKey
|
|
151
|
+
tokenReservesLiquidity: PublicKey
|
|
152
|
+
lendingSupplyPosition: PublicKey
|
|
153
|
+
rewardsRateModel: PublicKey
|
|
154
|
+
rateModel: PublicKey
|
|
146
155
|
}
|
|
147
156
|
kaminoVaultData?: {
|
|
148
|
-
vault:
|
|
157
|
+
vault: PublicKey
|
|
149
158
|
reserves: {
|
|
150
|
-
reserveAddress:
|
|
151
|
-
marketAddress:
|
|
159
|
+
reserveAddress: PublicKey
|
|
160
|
+
marketAddress: PublicKey
|
|
152
161
|
}[]
|
|
153
|
-
tokenVault:
|
|
154
|
-
tokenMint:
|
|
155
|
-
baseVaultAuthority:
|
|
156
|
-
sharesMint:
|
|
162
|
+
tokenVault: PublicKey
|
|
163
|
+
tokenMint: PublicKey
|
|
164
|
+
baseVaultAuthority: PublicKey
|
|
165
|
+
sharesMint: PublicKey
|
|
157
166
|
}
|
|
158
167
|
splStakePoolData?: {
|
|
159
168
|
stakePoolAccount?: StakePoolAccount // Optional because it is expensive to serialize / not always needed on clients
|
|
160
|
-
stakePoolAddress:
|
|
161
|
-
stakePoolProgramId:
|
|
162
|
-
validatorList:
|
|
163
|
-
reserveStake:
|
|
164
|
-
managerFeeAccount:
|
|
165
|
-
poolMint:
|
|
169
|
+
stakePoolAddress: PublicKey
|
|
170
|
+
stakePoolProgramId: PublicKey // Dynamic program ID from account owner
|
|
171
|
+
validatorList: PublicKey
|
|
172
|
+
reserveStake: PublicKey
|
|
173
|
+
managerFeeAccount: PublicKey
|
|
174
|
+
poolMint: PublicKey
|
|
166
175
|
}
|
|
167
176
|
// Add other interface-specific data here as needed
|
|
168
177
|
// meteoraData?: { ... }
|
|
@@ -211,7 +220,7 @@ export interface AdditionalDataGenericJson {
|
|
|
211
220
|
export interface Hook {
|
|
212
221
|
enabled: boolean
|
|
213
222
|
interfaceEmissionsAccountsUntil: number
|
|
214
|
-
programId:
|
|
223
|
+
programId: PublicKey
|
|
215
224
|
preMintHookDiscriminator: number[]
|
|
216
225
|
postRedeemHookDiscriminator: number[]
|
|
217
226
|
}
|
|
@@ -229,13 +238,13 @@ export interface HookRaw {
|
|
|
229
238
|
interfaceEmissionsAccountsUntil: number
|
|
230
239
|
preMintHookDiscriminator: Buffer
|
|
231
240
|
postRedeemHookDiscriminator: Buffer
|
|
232
|
-
programId:
|
|
241
|
+
programId: PublicKey
|
|
233
242
|
}
|
|
234
243
|
|
|
235
244
|
export interface GenericSyState {
|
|
236
|
-
selfAddress:
|
|
245
|
+
selfAddress: PublicKey
|
|
237
246
|
account: GenericSyMetaAccount
|
|
238
|
-
tokenProgramBase:
|
|
247
|
+
tokenProgramBase: PublicKey
|
|
239
248
|
syRate: number
|
|
240
249
|
additionalData?: AdditionalDataGeneric
|
|
241
250
|
}
|
|
@@ -268,10 +277,10 @@ export interface GenericSyMetaAccountJson {
|
|
|
268
277
|
}
|
|
269
278
|
|
|
270
279
|
export interface GenericSyMetaAccount {
|
|
271
|
-
mintSy:
|
|
272
|
-
yieldBearingMint:
|
|
273
|
-
tokenSyEscrow:
|
|
274
|
-
interfaceAccounts:
|
|
280
|
+
mintSy: PublicKey
|
|
281
|
+
yieldBearingMint: PublicKey
|
|
282
|
+
tokenSyEscrow: PublicKey
|
|
283
|
+
interfaceAccounts: PublicKey[]
|
|
275
284
|
interfaceType: InterfaceTypeGeneric
|
|
276
285
|
maxSySupply: BN
|
|
277
286
|
minMintSize: BN
|
|
@@ -282,15 +291,15 @@ export interface GenericSyMetaAccount {
|
|
|
282
291
|
}
|
|
283
292
|
|
|
284
293
|
export interface GenericSyMetaAccountRaw {
|
|
285
|
-
mintSy:
|
|
286
|
-
yieldBearingMint:
|
|
287
|
-
tokenSyEscrow:
|
|
294
|
+
mintSy: PublicKey
|
|
295
|
+
yieldBearingMint: PublicKey
|
|
296
|
+
tokenSyEscrow: PublicKey
|
|
288
297
|
maxSySupply: BN
|
|
289
298
|
minMintSize: BN
|
|
290
299
|
minRedeemSize: BN
|
|
291
300
|
selfAddressBump: number[]
|
|
292
301
|
emissions: SyEmissionRaw[]
|
|
293
|
-
interfaceAccounts:
|
|
302
|
+
interfaceAccounts: PublicKey[]
|
|
294
303
|
interfaceType: InterfaceTypeGeneric
|
|
295
304
|
index: AnchorizedPNum
|
|
296
305
|
hook: HookRaw
|
|
@@ -423,7 +432,7 @@ export function fromHookJson(json: HookJson): Hook {
|
|
|
423
432
|
return {
|
|
424
433
|
enabled: json.enabled,
|
|
425
434
|
interfaceEmissionsAccountsUntil: json.interfaceEmissionsAccountsUntil,
|
|
426
|
-
programId: new
|
|
435
|
+
programId: new PublicKey(json.programId),
|
|
427
436
|
preMintHookDiscriminator: json.preMintHookDiscriminator,
|
|
428
437
|
postRedeemHookDiscriminator: json.postRedeemHookDiscriminator,
|
|
429
438
|
}
|
|
@@ -484,43 +493,43 @@ export function fromAdditionalDataGenericJson(json: AdditionalDataGenericJson):
|
|
|
484
493
|
|
|
485
494
|
if (json.fragmetricData) {
|
|
486
495
|
result.fragmetricData = {
|
|
487
|
-
receiptTokenMint: new
|
|
488
|
-
wrappedTokenMint: new
|
|
496
|
+
receiptTokenMint: new PublicKey(json.fragmetricData.receiptTokenMint),
|
|
497
|
+
wrappedTokenMint: new PublicKey(json.fragmetricData.wrappedTokenMint),
|
|
489
498
|
}
|
|
490
499
|
}
|
|
491
500
|
|
|
492
501
|
if (json.jupiterLendData) {
|
|
493
502
|
result.jupiterLendData = {
|
|
494
|
-
baseTokenMint: new
|
|
495
|
-
tokenReservesLiquidity: new
|
|
496
|
-
lendingSupplyPosition: new
|
|
497
|
-
rewardsRateModel: new
|
|
498
|
-
rateModel: new
|
|
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),
|
|
499
508
|
}
|
|
500
509
|
}
|
|
501
510
|
|
|
502
511
|
if (json.kaminoVaultData) {
|
|
503
512
|
result.kaminoVaultData = {
|
|
504
|
-
vault: new
|
|
513
|
+
vault: new PublicKey(json.kaminoVaultData.vault),
|
|
505
514
|
reserves: json.kaminoVaultData.reserves.map((r) => ({
|
|
506
|
-
reserveAddress: new
|
|
507
|
-
marketAddress: new
|
|
515
|
+
reserveAddress: new PublicKey(r.reserveAddress),
|
|
516
|
+
marketAddress: new PublicKey(r.marketAddress),
|
|
508
517
|
})),
|
|
509
|
-
tokenVault: new
|
|
510
|
-
tokenMint: new
|
|
511
|
-
baseVaultAuthority: new
|
|
512
|
-
sharesMint: new
|
|
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),
|
|
513
522
|
}
|
|
514
523
|
}
|
|
515
524
|
|
|
516
525
|
if (json.splStakePoolData) {
|
|
517
526
|
result.splStakePoolData = {
|
|
518
|
-
stakePoolAddress: new
|
|
519
|
-
stakePoolProgramId: new
|
|
520
|
-
validatorList: new
|
|
521
|
-
reserveStake: new
|
|
522
|
-
managerFeeAccount: new
|
|
523
|
-
poolMint: new
|
|
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),
|
|
524
533
|
}
|
|
525
534
|
}
|
|
526
535
|
|
|
@@ -530,11 +539,11 @@ export function fromAdditionalDataGenericJson(json: AdditionalDataGenericJson):
|
|
|
530
539
|
/** Helper function to extract fragmetric data from additional data */
|
|
531
540
|
export function getFragmetricDataFromAdditionalData(additionalData?: AdditionalDataGeneric):
|
|
532
541
|
| {
|
|
533
|
-
receiptTokenMint:
|
|
534
|
-
wrappedTokenMint:
|
|
542
|
+
receiptTokenMint: PublicKey
|
|
543
|
+
wrappedTokenMint: PublicKey
|
|
535
544
|
}
|
|
536
545
|
| undefined {
|
|
537
546
|
if (!additionalData) return undefined
|
|
538
547
|
|
|
539
548
|
return additionalData.fragmetricData
|
|
540
|
-
}
|
|
549
|
+
}
|
package/src/index.ts
CHANGED
package/src/jito-restaking.ts
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { BN, web3 } from "@coral-xyz/anchor"
|
|
2
1
|
import { AnchorizedPNum, AnchorizedPNumJson, SyEmissionRaw, SyEmissionJson } from "./common"
|
|
3
|
-
|
|
2
|
+
import { PublicKey } from "@solana/web3.js"
|
|
3
|
+
import BN from 'bn.js'
|
|
4
4
|
export interface InterfaceType {
|
|
5
5
|
splStakePool: {}
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
export interface JitoRestakingSyState {
|
|
9
|
-
selfAddress:
|
|
9
|
+
selfAddress: PublicKey
|
|
10
10
|
account: JitoRestakingSyMetaAccount
|
|
11
11
|
/** The value of SY tokens in terms of the base asset */
|
|
12
12
|
syRate: string
|
|
13
13
|
underlyingExchangeRate: number
|
|
14
|
-
mintBase:
|
|
15
|
-
tokenProgramBase:
|
|
14
|
+
mintBase: PublicKey
|
|
15
|
+
tokenProgramBase: PublicKey
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export interface JitoRestakingSyMetaAccountRaw {
|
|
19
|
-
jitoVault:
|
|
20
|
-
mintSy:
|
|
21
|
-
tokenSyEscrow:
|
|
19
|
+
jitoVault: PublicKey
|
|
20
|
+
mintSy: PublicKey
|
|
21
|
+
tokenSyEscrow: PublicKey
|
|
22
22
|
maxSySupply: BN
|
|
23
23
|
minMintSize: BN
|
|
24
24
|
minRedeemSize: BN
|
|
25
25
|
selfAddressBump: number[]
|
|
26
26
|
emissions: SyEmissionRaw[]
|
|
27
|
-
interfaceAccounts:
|
|
27
|
+
interfaceAccounts: PublicKey[]
|
|
28
28
|
interfaceType: InterfaceType
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export interface JitoRestakingSyMetaAccount {
|
|
32
|
-
jitoVault:
|
|
33
|
-
mintSy:
|
|
34
|
-
tokenSyEscrow:
|
|
35
|
-
interfaceAccounts:
|
|
32
|
+
jitoVault: PublicKey
|
|
33
|
+
mintSy: PublicKey
|
|
34
|
+
tokenSyEscrow: PublicKey
|
|
35
|
+
interfaceAccounts: PublicKey[]
|
|
36
36
|
interfaceType: InterfaceType
|
|
37
37
|
maxSySupply: BN
|
|
38
38
|
minMintSize: BN
|
|
@@ -75,4 +75,4 @@ export interface JitoRestakingSyStateJson {
|
|
|
75
75
|
underlyingExchangeRate: number
|
|
76
76
|
mintBase: string
|
|
77
77
|
tokenProgramBase: string
|
|
78
|
-
}
|
|
78
|
+
}
|
package/src/kamino.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { web3 } from "@coral-xyz/anchor"
|
|
1
|
+
import BN from "bn.js"
|
|
3
2
|
|
|
4
3
|
import { SyEmissionJson, SyEmissionRaw, SyEmissionRaw2 } from "./common"
|
|
4
|
+
import { PublicKey } from "@solana/web3.js"
|
|
5
5
|
|
|
6
6
|
export interface KaminoSyState {
|
|
7
|
-
selfAddress:
|
|
7
|
+
selfAddress: PublicKey
|
|
8
8
|
account: KaminoSyMetaAccount
|
|
9
|
-
klendSyProgramId:
|
|
9
|
+
klendSyProgramId: PublicKey
|
|
10
10
|
/** The value of SY tokens in terms of the base asset */
|
|
11
11
|
syRate: string
|
|
12
|
-
mintBase:
|
|
13
|
-
tokenProgramBase:
|
|
14
|
-
klendProgramId:
|
|
15
|
-
klendMarketId:
|
|
16
|
-
scopePriceFeed?:
|
|
12
|
+
mintBase: PublicKey
|
|
13
|
+
tokenProgramBase: PublicKey
|
|
14
|
+
klendProgramId: PublicKey
|
|
15
|
+
klendMarketId: PublicKey
|
|
16
|
+
scopePriceFeed?: PublicKey
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export interface KaminoSyStateJson {
|
|
@@ -29,14 +29,14 @@ export interface KaminoSyStateJson {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export interface KaminoSyMetaAccount {
|
|
32
|
-
kaminoReserve:
|
|
33
|
-
kaminoObligation:
|
|
34
|
-
kaminoFarm:
|
|
35
|
-
kaminoUserMetadata:
|
|
36
|
-
mintSy:
|
|
32
|
+
kaminoReserve: PublicKey
|
|
33
|
+
kaminoObligation: PublicKey
|
|
34
|
+
kaminoFarm: PublicKey
|
|
35
|
+
kaminoUserMetadata: PublicKey
|
|
36
|
+
mintSy: PublicKey
|
|
37
37
|
/** Where deposited SY tokens reside */
|
|
38
|
-
tokenSyEscrow:
|
|
39
|
-
userState:
|
|
38
|
+
tokenSyEscrow: PublicKey
|
|
39
|
+
userState: PublicKey
|
|
40
40
|
maxSySupply: string
|
|
41
41
|
minMintSize: string
|
|
42
42
|
minRedeemSize: string
|
|
@@ -58,22 +58,22 @@ interface KaminoSyMetaAccountJson {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
export interface KaminoSyMetaAccountRaw {
|
|
61
|
-
kamino_reserve:
|
|
62
|
-
kamino_obligation:
|
|
63
|
-
kamino_farm:
|
|
64
|
-
kamino_user_metadata:
|
|
65
|
-
mint_sy:
|
|
61
|
+
kamino_reserve: PublicKey
|
|
62
|
+
kamino_obligation: PublicKey
|
|
63
|
+
kamino_farm: PublicKey
|
|
64
|
+
kamino_user_metadata: PublicKey
|
|
65
|
+
mint_sy: PublicKey
|
|
66
66
|
/** Where deposited SY tokens reside */
|
|
67
|
-
token_sy_escrow:
|
|
67
|
+
token_sy_escrow: PublicKey
|
|
68
68
|
/** Robot authority over the Mfi Account */
|
|
69
|
-
authority_klend_account:
|
|
69
|
+
authority_klend_account: PublicKey
|
|
70
70
|
/** Authority over the SY token escrow account */
|
|
71
|
-
authority_escrow:
|
|
71
|
+
authority_escrow: PublicKey
|
|
72
72
|
/** Authority over the sy mint */
|
|
73
|
-
mint_authority:
|
|
74
|
-
user_state:
|
|
73
|
+
mint_authority: PublicKey
|
|
74
|
+
user_state: PublicKey
|
|
75
75
|
max_sy_supply: BN
|
|
76
76
|
min_mint_size: BN
|
|
77
77
|
min_redeem_size: BN
|
|
78
78
|
emissions: SyEmissionRaw2[]
|
|
79
|
-
}
|
|
79
|
+
}
|
package/src/marginfi.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PublicKey } from "@solana/web3.js"
|
|
2
2
|
import { SyEmissionRaw, SyEmissionJson } from "./common"
|
|
3
|
-
|
|
3
|
+
import BN from 'bn.js'
|
|
4
4
|
export interface MfiSyState {
|
|
5
|
-
selfAddress:
|
|
5
|
+
selfAddress: PublicKey
|
|
6
6
|
account: MarginfiSyMeta
|
|
7
|
-
marginfiSyProgramId:
|
|
7
|
+
marginfiSyProgramId: PublicKey
|
|
8
8
|
|
|
9
9
|
/** The value of SY tokens in terms of the base asset taken directly from the bank */
|
|
10
10
|
syRate: string
|
|
11
|
-
mintBase:
|
|
12
|
-
tokenProgramBase:
|
|
13
|
-
marginfiProgramId:
|
|
14
|
-
marginfiGroupId:
|
|
15
|
-
emissionsMint:
|
|
16
|
-
emissionsTokenProgram:
|
|
11
|
+
mintBase: PublicKey
|
|
12
|
+
tokenProgramBase: PublicKey
|
|
13
|
+
marginfiProgramId: PublicKey
|
|
14
|
+
marginfiGroupId: PublicKey
|
|
15
|
+
emissionsMint: PublicKey | null
|
|
16
|
+
emissionsTokenProgram: PublicKey | null
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export interface MfiSyStateJson {
|
|
@@ -43,11 +43,11 @@ export interface SyMetaJson {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
export interface MarginfiSyMeta {
|
|
46
|
-
marginfiBank:
|
|
47
|
-
marginfiAccount:
|
|
48
|
-
mintSy:
|
|
46
|
+
marginfiBank: PublicKey
|
|
47
|
+
marginfiAccount: PublicKey
|
|
48
|
+
mintSy: PublicKey
|
|
49
49
|
/** Where the SY tokens get deposited */
|
|
50
|
-
tokenSyEscrow:
|
|
50
|
+
tokenSyEscrow: PublicKey
|
|
51
51
|
maxSySupply: bigint
|
|
52
52
|
minMintSize: bigint
|
|
53
53
|
minRedeemSize: bigint
|
|
@@ -66,16 +66,16 @@ export interface MarginfiSyMetaJson {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
export interface MarginfiSyMetaRaw {
|
|
69
|
-
marginfiBank:
|
|
70
|
-
marginfiAccount:
|
|
71
|
-
mintSy:
|
|
69
|
+
marginfiBank: PublicKey
|
|
70
|
+
marginfiAccount: PublicKey
|
|
71
|
+
mintSy: PublicKey
|
|
72
72
|
maxSySupply: BN
|
|
73
73
|
minMintSize: BN
|
|
74
74
|
minRedeemSize: BN
|
|
75
75
|
/** Where the SY tokens get deposited */
|
|
76
|
-
tokenSyEscrow:
|
|
76
|
+
tokenSyEscrow: PublicKey
|
|
77
77
|
emissions: SyEmissionRaw[]
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
export type AnchorizedPNum = { 0: BN[] }
|
|
81
|
-
export type AnchorizedPNumJson = { 0: string[] }
|
|
81
|
+
export type AnchorizedPNumJson = { 0: string[] }
|
package/src/orderbook.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { web3 } from "@coral-xyz/anchor"
|
|
2
1
|
|
|
2
|
+
import { PublicKey } from "@solana/web3.js"
|
|
3
3
|
import { CpiAccountsRaw, ExponentCoreCpiAccountsRaw } from "./cpi"
|
|
4
4
|
import { Flavor } from "./flavor"
|
|
5
5
|
|
|
6
|
-
export const MAX_PRICE_NODES =
|
|
7
|
-
export const MAX_OFFERS =
|
|
8
|
-
export const MAX_USER_ESCROWS =
|
|
6
|
+
export const MAX_PRICE_NODES = 1000
|
|
7
|
+
export const MAX_OFFERS = 2500
|
|
8
|
+
export const MAX_USER_ESCROWS = 1500
|
|
9
9
|
// RedBlackTree uses 3 registers per node: parent, left, right
|
|
10
10
|
export const PRICE_NODE_REGISTERS = 3
|
|
11
11
|
// Offer allocator uses 1 register per node (free‐list pointer)
|
|
@@ -65,6 +65,9 @@ export interface PriceTreeNode {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
export interface OfferNode {
|
|
68
|
+
/** Actual NodeAllocator slot for this offer (0 is sentinel, live offers are 1-based) */
|
|
69
|
+
offerIndex: number
|
|
70
|
+
|
|
68
71
|
/** Internal register 1 (the free‐list link when unused) */
|
|
69
72
|
nextOfferPointer: number
|
|
70
73
|
|
|
@@ -72,7 +75,7 @@ export interface OfferNode {
|
|
|
72
75
|
pricePointer: number
|
|
73
76
|
|
|
74
77
|
/** SY/PT/YT amount deposited */
|
|
75
|
-
amount:
|
|
78
|
+
amount: bigint
|
|
76
79
|
/** Index of the user escrow that owns this offer */
|
|
77
80
|
userVaultPointer: number
|
|
78
81
|
/** Expiry timestamp (unix seconds) */
|
|
@@ -89,8 +92,8 @@ export interface OfferNode {
|
|
|
89
92
|
|
|
90
93
|
export interface UserEscrowNode {
|
|
91
94
|
/** The user’s Pubkey */
|
|
92
|
-
user:
|
|
93
|
-
/**
|
|
95
|
+
user: PublicKey
|
|
96
|
+
/** Last seen SY exchange rate for this user escrow */
|
|
94
97
|
yieldIndex: number
|
|
95
98
|
/** Token amounts held */
|
|
96
99
|
ptAmount: bigint
|
|
@@ -104,27 +107,27 @@ export interface UserEscrowNode {
|
|
|
104
107
|
/** ─── Full On-chain Orderbook ───────────────────────────────────────────────── */
|
|
105
108
|
export interface Orderbook {
|
|
106
109
|
/** PDA link to vault */
|
|
107
|
-
vault:
|
|
110
|
+
vault: PublicKey
|
|
108
111
|
/** PDA link to a vault-owned YT position */
|
|
109
|
-
yieldPosition:
|
|
112
|
+
yieldPosition: PublicKey
|
|
110
113
|
/** Address Lookup Table key for the orderbook */
|
|
111
|
-
addressLookupTable:
|
|
114
|
+
addressLookupTable: PublicKey
|
|
112
115
|
/** Address of the Exponent Core program */
|
|
113
|
-
exponentCoreProgram:
|
|
116
|
+
exponentCoreProgram: PublicKey
|
|
114
117
|
/** Address of the Sy program */
|
|
115
|
-
syProgram:
|
|
118
|
+
syProgram: PublicKey
|
|
116
119
|
/** Orderbook-owned escrow for SY tokens */
|
|
117
|
-
tokenEscrowSy:
|
|
120
|
+
tokenEscrowSy: PublicKey
|
|
118
121
|
/** Orderbook-owned escrow for YT tokens */
|
|
119
|
-
tokenEscrowYt:
|
|
122
|
+
tokenEscrowYt: PublicKey
|
|
120
123
|
/** Orderbook-owned escrow for PT tokens */
|
|
121
|
-
tokenEscrowPt:
|
|
124
|
+
tokenEscrowPt: PublicKey
|
|
122
125
|
|
|
123
126
|
/// Admin key
|
|
124
|
-
admin:
|
|
127
|
+
admin: PublicKey
|
|
125
128
|
|
|
126
129
|
/** CPI accounts storage key */
|
|
127
|
-
cpiAccountOrderbook:
|
|
130
|
+
cpiAccountOrderbook: PublicKey
|
|
128
131
|
|
|
129
132
|
/** How many price nodes are currently in use */
|
|
130
133
|
nodeCount: number
|
|
@@ -146,25 +149,25 @@ export interface Orderbook {
|
|
|
146
149
|
|
|
147
150
|
export interface OrderbookState {
|
|
148
151
|
/** PDA link to vault */
|
|
149
|
-
vault:
|
|
152
|
+
vault: PublicKey
|
|
150
153
|
/** PDA link to a vault-owned YT position */
|
|
151
|
-
yieldPosition:
|
|
154
|
+
yieldPosition: PublicKey
|
|
152
155
|
/** Address Lookup Table key for the orderbook */
|
|
153
|
-
addressLookupTable:
|
|
156
|
+
addressLookupTable: PublicKey
|
|
154
157
|
/** Address of the Exponent Core program */
|
|
155
|
-
exponentCoreProgram:
|
|
158
|
+
exponentCoreProgram: PublicKey
|
|
156
159
|
/** Address of the Exponent Core program */
|
|
157
|
-
syProgram:
|
|
160
|
+
syProgram: PublicKey
|
|
158
161
|
/** Orderbook-owned escrow for SY tokens */
|
|
159
|
-
tokenEscrowSy:
|
|
162
|
+
tokenEscrowSy: PublicKey
|
|
160
163
|
/** Orderbook-owned escrow for YT tokens */
|
|
161
|
-
tokenEscrowYt:
|
|
164
|
+
tokenEscrowYt: PublicKey
|
|
162
165
|
/** Orderbook-owned escrow for PT tokens */
|
|
163
|
-
tokenEscrowPt:
|
|
166
|
+
tokenEscrowPt: PublicKey
|
|
164
167
|
/** CPI accounts storage key */
|
|
165
|
-
cpiAccountOrderbook:
|
|
168
|
+
cpiAccountOrderbook: PublicKey
|
|
166
169
|
/** Admin key */
|
|
167
|
-
admin:
|
|
170
|
+
admin: PublicKey
|
|
168
171
|
|
|
169
172
|
configurationOptions: ConfigurationOptions
|
|
170
173
|
|
|
@@ -184,4 +187,9 @@ export interface OrderbookState {
|
|
|
184
187
|
exponentCoreCpiAccounts: ExponentCoreCpiAccountsRaw
|
|
185
188
|
|
|
186
189
|
flavor: Flavor
|
|
190
|
+
|
|
191
|
+
/** Next offer index that will be allocated (from NodeAllocator free list) */
|
|
192
|
+
offersFreeListHead: number
|
|
193
|
+
/** Bump index boundary for offers allocator */
|
|
194
|
+
offersBumpIndex: number
|
|
187
195
|
}
|
package/src/perena.ts
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PublicKey } from "@solana/web3.js"
|
|
2
2
|
import { AnchorizedPNum, AnchorizedPNumJson, SyEmissionRaw, SyEmissionJson } from "./common"
|
|
3
|
-
|
|
3
|
+
import BN from 'bn.js'
|
|
4
4
|
export interface PerenaSyState {
|
|
5
|
-
selfAddress:
|
|
5
|
+
selfAddress: PublicKey
|
|
6
6
|
account: PerenaSyMetaAccount
|
|
7
7
|
/** The value of SY tokens in terms of the base asset */
|
|
8
8
|
syRate: string
|
|
9
|
-
tokenProgramBase:
|
|
10
|
-
lpMint:
|
|
9
|
+
tokenProgramBase: PublicKey
|
|
10
|
+
lpMint: PublicKey
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export interface PerenaSyMetaAccountRaw {
|
|
14
|
-
perenaStablePool:
|
|
15
|
-
mintSy:
|
|
16
|
-
tokenSyEscrow:
|
|
14
|
+
perenaStablePool: PublicKey
|
|
15
|
+
mintSy: PublicKey
|
|
16
|
+
tokenSyEscrow: PublicKey
|
|
17
17
|
maxSySupply: BN
|
|
18
18
|
minMintSize: BN
|
|
19
19
|
minRedeemSize: BN
|
|
20
20
|
selfAddressBump: number[]
|
|
21
21
|
emissions: SyEmissionRaw[]
|
|
22
|
-
interfaceAccounts:
|
|
22
|
+
interfaceAccounts: PublicKey[]
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export interface PerenaSyMetaAccount {
|
|
26
|
-
perenaStablePool:
|
|
27
|
-
mintSy:
|
|
28
|
-
tokenSyEscrow:
|
|
29
|
-
interfaceAccounts:
|
|
26
|
+
perenaStablePool: PublicKey
|
|
27
|
+
mintSy: PublicKey
|
|
28
|
+
tokenSyEscrow: PublicKey
|
|
29
|
+
interfaceAccounts: PublicKey[]
|
|
30
30
|
maxSySupply: BN
|
|
31
31
|
minMintSize: BN
|
|
32
32
|
minRedeemSize: BN
|
|
@@ -64,4 +64,4 @@ export interface PerenaSyStateJson {
|
|
|
64
64
|
underlyingExchangeRate: number
|
|
65
65
|
mintBase: string
|
|
66
66
|
tokenProgramBase: string
|
|
67
|
-
}
|
|
67
|
+
}
|