@exponent-labs/exponent-types 0.1.8 → 0.9.1
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 +4 -5
- package/build/cpi.js.map +1 -1
- package/build/flavor.d.ts +23 -23
- package/build/generic.d.ts +44 -37
- package/build/generic.js +39 -36
- package/build/generic.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/jito-restaking.d.ts +13 -12
- package/build/jito-restaking.js +1 -2
- package/build/jito-restaking.js.map +1 -1
- 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/perena.js +1 -2
- package/build/perena.js.map +1 -1
- 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/build/kamino.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { web3 } from "@coral-xyz/anchor";
|
|
1
|
+
import BN from "bn.js";
|
|
3
2
|
import { SyEmissionJson, SyEmissionRaw, SyEmissionRaw2 } from "./common";
|
|
3
|
+
import { PublicKey } from "@solana/web3.js";
|
|
4
4
|
export interface KaminoSyState {
|
|
5
|
-
selfAddress:
|
|
5
|
+
selfAddress: PublicKey;
|
|
6
6
|
account: KaminoSyMetaAccount;
|
|
7
|
-
klendSyProgramId:
|
|
7
|
+
klendSyProgramId: PublicKey;
|
|
8
8
|
/** The value of SY tokens in terms of the base asset */
|
|
9
9
|
syRate: string;
|
|
10
|
-
mintBase:
|
|
11
|
-
tokenProgramBase:
|
|
12
|
-
klendProgramId:
|
|
13
|
-
klendMarketId:
|
|
14
|
-
scopePriceFeed?:
|
|
10
|
+
mintBase: PublicKey;
|
|
11
|
+
tokenProgramBase: PublicKey;
|
|
12
|
+
klendProgramId: PublicKey;
|
|
13
|
+
klendMarketId: PublicKey;
|
|
14
|
+
scopePriceFeed?: PublicKey;
|
|
15
15
|
}
|
|
16
16
|
export interface KaminoSyStateJson {
|
|
17
17
|
selfAddress: string;
|
|
@@ -25,14 +25,14 @@ export interface KaminoSyStateJson {
|
|
|
25
25
|
scopePriceFeed?: string;
|
|
26
26
|
}
|
|
27
27
|
export interface KaminoSyMetaAccount {
|
|
28
|
-
kaminoReserve:
|
|
29
|
-
kaminoObligation:
|
|
30
|
-
kaminoFarm:
|
|
31
|
-
kaminoUserMetadata:
|
|
32
|
-
mintSy:
|
|
28
|
+
kaminoReserve: PublicKey;
|
|
29
|
+
kaminoObligation: PublicKey;
|
|
30
|
+
kaminoFarm: PublicKey;
|
|
31
|
+
kaminoUserMetadata: PublicKey;
|
|
32
|
+
mintSy: PublicKey;
|
|
33
33
|
/** Where deposited SY tokens reside */
|
|
34
|
-
tokenSyEscrow:
|
|
35
|
-
userState:
|
|
34
|
+
tokenSyEscrow: PublicKey;
|
|
35
|
+
userState: PublicKey;
|
|
36
36
|
maxSySupply: string;
|
|
37
37
|
minMintSize: string;
|
|
38
38
|
minRedeemSize: string;
|
|
@@ -52,20 +52,20 @@ interface KaminoSyMetaAccountJson {
|
|
|
52
52
|
emissions: SyEmissionJson[];
|
|
53
53
|
}
|
|
54
54
|
export interface KaminoSyMetaAccountRaw {
|
|
55
|
-
kamino_reserve:
|
|
56
|
-
kamino_obligation:
|
|
57
|
-
kamino_farm:
|
|
58
|
-
kamino_user_metadata:
|
|
59
|
-
mint_sy:
|
|
55
|
+
kamino_reserve: PublicKey;
|
|
56
|
+
kamino_obligation: PublicKey;
|
|
57
|
+
kamino_farm: PublicKey;
|
|
58
|
+
kamino_user_metadata: PublicKey;
|
|
59
|
+
mint_sy: PublicKey;
|
|
60
60
|
/** Where deposited SY tokens reside */
|
|
61
|
-
token_sy_escrow:
|
|
61
|
+
token_sy_escrow: PublicKey;
|
|
62
62
|
/** Robot authority over the Mfi Account */
|
|
63
|
-
authority_klend_account:
|
|
63
|
+
authority_klend_account: PublicKey;
|
|
64
64
|
/** Authority over the SY token escrow account */
|
|
65
|
-
authority_escrow:
|
|
65
|
+
authority_escrow: PublicKey;
|
|
66
66
|
/** Authority over the sy mint */
|
|
67
|
-
mint_authority:
|
|
68
|
-
user_state:
|
|
67
|
+
mint_authority: PublicKey;
|
|
68
|
+
user_state: PublicKey;
|
|
69
69
|
max_sy_supply: BN;
|
|
70
70
|
min_mint_size: BN;
|
|
71
71
|
min_redeem_size: BN;
|
package/build/marginfi.d.ts
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PublicKey } from "@solana/web3.js";
|
|
2
2
|
import { SyEmissionRaw, SyEmissionJson } from "./common";
|
|
3
|
+
import BN from 'bn.js';
|
|
3
4
|
export interface MfiSyState {
|
|
4
|
-
selfAddress:
|
|
5
|
+
selfAddress: PublicKey;
|
|
5
6
|
account: MarginfiSyMeta;
|
|
6
|
-
marginfiSyProgramId:
|
|
7
|
+
marginfiSyProgramId: PublicKey;
|
|
7
8
|
/** The value of SY tokens in terms of the base asset taken directly from the bank */
|
|
8
9
|
syRate: string;
|
|
9
|
-
mintBase:
|
|
10
|
-
tokenProgramBase:
|
|
11
|
-
marginfiProgramId:
|
|
12
|
-
marginfiGroupId:
|
|
13
|
-
emissionsMint:
|
|
14
|
-
emissionsTokenProgram:
|
|
10
|
+
mintBase: PublicKey;
|
|
11
|
+
tokenProgramBase: PublicKey;
|
|
12
|
+
marginfiProgramId: PublicKey;
|
|
13
|
+
marginfiGroupId: PublicKey;
|
|
14
|
+
emissionsMint: PublicKey | null;
|
|
15
|
+
emissionsTokenProgram: PublicKey | null;
|
|
15
16
|
}
|
|
16
17
|
export interface MfiSyStateJson {
|
|
17
18
|
selfAddress: string;
|
|
@@ -38,11 +39,11 @@ export interface SyMetaJson {
|
|
|
38
39
|
syRate: string;
|
|
39
40
|
}
|
|
40
41
|
export interface MarginfiSyMeta {
|
|
41
|
-
marginfiBank:
|
|
42
|
-
marginfiAccount:
|
|
43
|
-
mintSy:
|
|
42
|
+
marginfiBank: PublicKey;
|
|
43
|
+
marginfiAccount: PublicKey;
|
|
44
|
+
mintSy: PublicKey;
|
|
44
45
|
/** Where the SY tokens get deposited */
|
|
45
|
-
tokenSyEscrow:
|
|
46
|
+
tokenSyEscrow: PublicKey;
|
|
46
47
|
maxSySupply: bigint;
|
|
47
48
|
minMintSize: bigint;
|
|
48
49
|
minRedeemSize: bigint;
|
|
@@ -59,14 +60,14 @@ export interface MarginfiSyMetaJson {
|
|
|
59
60
|
emissions: SyEmissionJson[];
|
|
60
61
|
}
|
|
61
62
|
export interface MarginfiSyMetaRaw {
|
|
62
|
-
marginfiBank:
|
|
63
|
-
marginfiAccount:
|
|
64
|
-
mintSy:
|
|
63
|
+
marginfiBank: PublicKey;
|
|
64
|
+
marginfiAccount: PublicKey;
|
|
65
|
+
mintSy: PublicKey;
|
|
65
66
|
maxSySupply: BN;
|
|
66
67
|
minMintSize: BN;
|
|
67
68
|
minRedeemSize: BN;
|
|
68
69
|
/** Where the SY tokens get deposited */
|
|
69
|
-
tokenSyEscrow:
|
|
70
|
+
tokenSyEscrow: PublicKey;
|
|
70
71
|
emissions: SyEmissionRaw[];
|
|
71
72
|
}
|
|
72
73
|
export type AnchorizedPNum = {
|
package/build/orderbook.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PublicKey } from "@solana/web3.js";
|
|
2
2
|
import { CpiAccountsRaw, ExponentCoreCpiAccountsRaw } from "./cpi";
|
|
3
3
|
import { Flavor } from "./flavor";
|
|
4
|
-
export declare const MAX_PRICE_NODES =
|
|
5
|
-
export declare const MAX_OFFERS =
|
|
6
|
-
export declare const MAX_USER_ESCROWS =
|
|
4
|
+
export declare const MAX_PRICE_NODES = 1000;
|
|
5
|
+
export declare const MAX_OFFERS = 2500;
|
|
6
|
+
export declare const MAX_USER_ESCROWS = 1500;
|
|
7
7
|
export declare const PRICE_NODE_REGISTERS = 3;
|
|
8
8
|
export declare const OFFER_REGISTERS = 1;
|
|
9
9
|
export declare const ESCROW_REGISTERS = 0;
|
|
@@ -45,12 +45,14 @@ export interface PriceTreeNode {
|
|
|
45
45
|
right: number;
|
|
46
46
|
}
|
|
47
47
|
export interface OfferNode {
|
|
48
|
+
/** Actual NodeAllocator slot for this offer (0 is sentinel, live offers are 1-based) */
|
|
49
|
+
offerIndex: number;
|
|
48
50
|
/** Internal register 1 (the free‐list link when unused) */
|
|
49
51
|
nextOfferPointer: number;
|
|
50
52
|
/** Internal register 3 (the free‐list link when unused) */
|
|
51
53
|
pricePointer: number;
|
|
52
54
|
/** SY/PT/YT amount deposited */
|
|
53
|
-
amount:
|
|
55
|
+
amount: bigint;
|
|
54
56
|
/** Index of the user escrow that owns this offer */
|
|
55
57
|
userVaultPointer: number;
|
|
56
58
|
/** Expiry timestamp (unix seconds) */
|
|
@@ -66,8 +68,8 @@ export interface OfferNode {
|
|
|
66
68
|
}
|
|
67
69
|
export interface UserEscrowNode {
|
|
68
70
|
/** The user’s Pubkey */
|
|
69
|
-
user:
|
|
70
|
-
/**
|
|
71
|
+
user: PublicKey;
|
|
72
|
+
/** Last seen SY exchange rate for this user escrow */
|
|
71
73
|
yieldIndex: number;
|
|
72
74
|
/** Token amounts held */
|
|
73
75
|
ptAmount: bigint;
|
|
@@ -80,24 +82,24 @@ export interface UserEscrowNode {
|
|
|
80
82
|
/** ─── Full On-chain Orderbook ───────────────────────────────────────────────── */
|
|
81
83
|
export interface Orderbook {
|
|
82
84
|
/** PDA link to vault */
|
|
83
|
-
vault:
|
|
85
|
+
vault: PublicKey;
|
|
84
86
|
/** PDA link to a vault-owned YT position */
|
|
85
|
-
yieldPosition:
|
|
87
|
+
yieldPosition: PublicKey;
|
|
86
88
|
/** Address Lookup Table key for the orderbook */
|
|
87
|
-
addressLookupTable:
|
|
89
|
+
addressLookupTable: PublicKey;
|
|
88
90
|
/** Address of the Exponent Core program */
|
|
89
|
-
exponentCoreProgram:
|
|
91
|
+
exponentCoreProgram: PublicKey;
|
|
90
92
|
/** Address of the Sy program */
|
|
91
|
-
syProgram:
|
|
93
|
+
syProgram: PublicKey;
|
|
92
94
|
/** Orderbook-owned escrow for SY tokens */
|
|
93
|
-
tokenEscrowSy:
|
|
95
|
+
tokenEscrowSy: PublicKey;
|
|
94
96
|
/** Orderbook-owned escrow for YT tokens */
|
|
95
|
-
tokenEscrowYt:
|
|
97
|
+
tokenEscrowYt: PublicKey;
|
|
96
98
|
/** Orderbook-owned escrow for PT tokens */
|
|
97
|
-
tokenEscrowPt:
|
|
98
|
-
admin:
|
|
99
|
+
tokenEscrowPt: PublicKey;
|
|
100
|
+
admin: PublicKey;
|
|
99
101
|
/** CPI accounts storage key */
|
|
100
|
-
cpiAccountOrderbook:
|
|
102
|
+
cpiAccountOrderbook: PublicKey;
|
|
101
103
|
/** How many price nodes are currently in use */
|
|
102
104
|
nodeCount: number;
|
|
103
105
|
financials: OrderbookFinancials;
|
|
@@ -112,25 +114,25 @@ export interface Orderbook {
|
|
|
112
114
|
}
|
|
113
115
|
export interface OrderbookState {
|
|
114
116
|
/** PDA link to vault */
|
|
115
|
-
vault:
|
|
117
|
+
vault: PublicKey;
|
|
116
118
|
/** PDA link to a vault-owned YT position */
|
|
117
|
-
yieldPosition:
|
|
119
|
+
yieldPosition: PublicKey;
|
|
118
120
|
/** Address Lookup Table key for the orderbook */
|
|
119
|
-
addressLookupTable:
|
|
121
|
+
addressLookupTable: PublicKey;
|
|
120
122
|
/** Address of the Exponent Core program */
|
|
121
|
-
exponentCoreProgram:
|
|
123
|
+
exponentCoreProgram: PublicKey;
|
|
122
124
|
/** Address of the Exponent Core program */
|
|
123
|
-
syProgram:
|
|
125
|
+
syProgram: PublicKey;
|
|
124
126
|
/** Orderbook-owned escrow for SY tokens */
|
|
125
|
-
tokenEscrowSy:
|
|
127
|
+
tokenEscrowSy: PublicKey;
|
|
126
128
|
/** Orderbook-owned escrow for YT tokens */
|
|
127
|
-
tokenEscrowYt:
|
|
129
|
+
tokenEscrowYt: PublicKey;
|
|
128
130
|
/** Orderbook-owned escrow for PT tokens */
|
|
129
|
-
tokenEscrowPt:
|
|
131
|
+
tokenEscrowPt: PublicKey;
|
|
130
132
|
/** CPI accounts storage key */
|
|
131
|
-
cpiAccountOrderbook:
|
|
133
|
+
cpiAccountOrderbook: PublicKey;
|
|
132
134
|
/** Admin key */
|
|
133
|
-
admin:
|
|
135
|
+
admin: PublicKey;
|
|
134
136
|
configurationOptions: ConfigurationOptions;
|
|
135
137
|
financials: OrderbookFinancials;
|
|
136
138
|
/** All PriceNode entries (fixed capacity) */
|
|
@@ -142,4 +144,8 @@ export interface OrderbookState {
|
|
|
142
144
|
syCpiAccounts: CpiAccountsRaw;
|
|
143
145
|
exponentCoreCpiAccounts: ExponentCoreCpiAccountsRaw;
|
|
144
146
|
flavor: Flavor;
|
|
147
|
+
/** Next offer index that will be allocated (from NodeAllocator free list) */
|
|
148
|
+
offersFreeListHead: number;
|
|
149
|
+
/** Bump index boundary for offers allocator */
|
|
150
|
+
offersBumpIndex: number;
|
|
145
151
|
}
|
package/build/orderbook.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ESCROW_REGISTERS = exports.OFFER_REGISTERS = exports.PRICE_NODE_REGISTERS = exports.MAX_USER_ESCROWS = exports.MAX_OFFERS = exports.MAX_PRICE_NODES = void 0;
|
|
4
|
-
exports.MAX_PRICE_NODES =
|
|
5
|
-
exports.MAX_OFFERS =
|
|
6
|
-
exports.MAX_USER_ESCROWS =
|
|
4
|
+
exports.MAX_PRICE_NODES = 1000;
|
|
5
|
+
exports.MAX_OFFERS = 2500;
|
|
6
|
+
exports.MAX_USER_ESCROWS = 1500;
|
|
7
7
|
// RedBlackTree uses 3 registers per node: parent, left, right
|
|
8
8
|
exports.PRICE_NODE_REGISTERS = 3;
|
|
9
9
|
// Offer allocator uses 1 register per node (free‐list pointer)
|
package/build/orderbook.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orderbook.js","sourceRoot":"","sources":["../src/orderbook.ts"],"names":[],"mappings":";;;AAKa,QAAA,eAAe,GAAG,
|
|
1
|
+
{"version":3,"file":"orderbook.js","sourceRoot":"","sources":["../src/orderbook.ts"],"names":[],"mappings":";;;AAKa,QAAA,eAAe,GAAG,IAAI,CAAA;AACtB,QAAA,UAAU,GAAG,IAAI,CAAA;AACjB,QAAA,gBAAgB,GAAG,IAAI,CAAA;AACpC,8DAA8D;AACjD,QAAA,oBAAoB,GAAG,CAAC,CAAA;AACrC,+DAA+D;AAClD,QAAA,eAAe,GAAG,CAAC,CAAA;AAChC,wCAAwC;AAC3B,QAAA,gBAAgB,GAAG,CAAC,CAAA"}
|
package/build/perena.d.ts
CHANGED
|
@@ -1,29 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PublicKey } from "@solana/web3.js";
|
|
2
2
|
import { SyEmissionRaw, SyEmissionJson } from "./common";
|
|
3
|
+
import BN from 'bn.js';
|
|
3
4
|
export interface PerenaSyState {
|
|
4
|
-
selfAddress:
|
|
5
|
+
selfAddress: PublicKey;
|
|
5
6
|
account: PerenaSyMetaAccount;
|
|
6
7
|
/** The value of SY tokens in terms of the base asset */
|
|
7
8
|
syRate: string;
|
|
8
|
-
tokenProgramBase:
|
|
9
|
-
lpMint:
|
|
9
|
+
tokenProgramBase: PublicKey;
|
|
10
|
+
lpMint: PublicKey;
|
|
10
11
|
}
|
|
11
12
|
export interface PerenaSyMetaAccountRaw {
|
|
12
|
-
perenaStablePool:
|
|
13
|
-
mintSy:
|
|
14
|
-
tokenSyEscrow:
|
|
13
|
+
perenaStablePool: PublicKey;
|
|
14
|
+
mintSy: PublicKey;
|
|
15
|
+
tokenSyEscrow: PublicKey;
|
|
15
16
|
maxSySupply: BN;
|
|
16
17
|
minMintSize: BN;
|
|
17
18
|
minRedeemSize: BN;
|
|
18
19
|
selfAddressBump: number[];
|
|
19
20
|
emissions: SyEmissionRaw[];
|
|
20
|
-
interfaceAccounts:
|
|
21
|
+
interfaceAccounts: PublicKey[];
|
|
21
22
|
}
|
|
22
23
|
export interface PerenaSyMetaAccount {
|
|
23
|
-
perenaStablePool:
|
|
24
|
-
mintSy:
|
|
25
|
-
tokenSyEscrow:
|
|
26
|
-
interfaceAccounts:
|
|
24
|
+
perenaStablePool: PublicKey;
|
|
25
|
+
mintSy: PublicKey;
|
|
26
|
+
tokenSyEscrow: PublicKey;
|
|
27
|
+
interfaceAccounts: PublicKey[];
|
|
27
28
|
maxSySupply: BN;
|
|
28
29
|
minMintSize: BN;
|
|
29
30
|
minRedeemSize: BN;
|
package/build/perena.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deserializePerenaSyMetaAccountRaw =
|
|
3
|
+
exports.deserializePerenaSyMetaAccountRaw = deserializePerenaSyMetaAccountRaw;
|
|
4
4
|
function deserializePerenaSyMetaAccountRaw(raw) {
|
|
5
5
|
return {
|
|
6
6
|
perenaStablePool: raw.perenaStablePool,
|
|
@@ -13,5 +13,4 @@ function deserializePerenaSyMetaAccountRaw(raw) {
|
|
|
13
13
|
emissions: raw.emissions,
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
-
exports.deserializePerenaSyMetaAccountRaw = deserializePerenaSyMetaAccountRaw;
|
|
17
16
|
//# sourceMappingURL=perena.js.map
|
package/build/perena.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"perena.js","sourceRoot":"","sources":["../src/perena.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"perena.js","sourceRoot":"","sources":["../src/perena.ts"],"names":[],"mappings":";;AA8CA,8EAWC;AAXD,SAAgB,iCAAiC,CAAC,GAA2B;IAC3E,OAAO;QACL,gBAAgB,EAAE,GAAG,CAAC,gBAAgB;QACtC,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,aAAa,EAAE,GAAG,CAAC,aAAa;QAChC,iBAAiB,EAAE,GAAG,CAAC,iBAAiB;QACxC,WAAW,EAAE,GAAG,CAAC,WAAW;QAC5B,WAAW,EAAE,GAAG,CAAC,WAAW;QAC5B,aAAa,EAAE,GAAG,CAAC,aAAa;QAChC,SAAS,EAAE,GAAG,CAAC,SAAS;KACzB,CAAA;AACH,CAAC"}
|
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;
|
|
@@ -66,26 +67,26 @@ export interface VaultState {
|
|
|
66
67
|
/** For how long is the vault active */
|
|
67
68
|
durationSeconds: number;
|
|
68
69
|
/** Vault signer for token accounts, mints, SY position etc */
|
|
69
|
-
authority:
|
|
70
|
-
addressLookupTable:
|
|
70
|
+
authority: PublicKey;
|
|
71
|
+
addressLookupTable: PublicKey;
|
|
71
72
|
lastSeenSyExchangeRate: number;
|
|
72
73
|
allTimeHighSyExchangeRate: number;
|
|
73
74
|
/** Vault-owned account for passing SY between SY program and user */
|
|
74
|
-
escrowSy:
|
|
75
|
+
escrowSy: PublicKey;
|
|
75
76
|
/** Escrow account for holding deposited YT */
|
|
76
|
-
escrowYt:
|
|
77
|
+
escrowYt: PublicKey;
|
|
77
78
|
/** Key to SY Program */
|
|
78
|
-
syProgram:
|
|
79
|
+
syProgram: PublicKey;
|
|
79
80
|
syPosition: SyPosition;
|
|
80
81
|
cpiAccounts: CpiAccountsRaw;
|
|
81
|
-
mintPt:
|
|
82
|
+
mintPt: PublicKey;
|
|
82
83
|
status: number;
|
|
83
84
|
minOperationSizeStrip: bigint;
|
|
84
85
|
minOperationSizeMerge: bigint;
|
|
85
|
-
mintYt:
|
|
86
|
-
mintSy:
|
|
87
|
-
yieldPositonAddress:
|
|
88
|
-
treasurySyTokenAccount:
|
|
86
|
+
mintYt: PublicKey;
|
|
87
|
+
mintSy: PublicKey;
|
|
88
|
+
yieldPositonAddress: PublicKey;
|
|
89
|
+
treasurySyTokenAccount: PublicKey;
|
|
89
90
|
interestBpsFee: number;
|
|
90
91
|
totalSyInEscrow: bigint;
|
|
91
92
|
flavor: Flavor;
|
|
@@ -140,22 +141,22 @@ export interface SyPositionJson {
|
|
|
140
141
|
}
|
|
141
142
|
export interface SyPosition {
|
|
142
143
|
balanceSy: bigint;
|
|
143
|
-
owner:
|
|
144
|
+
owner: PublicKey;
|
|
144
145
|
emissions: {
|
|
145
146
|
/** Last seen index for SY-to-emission exchange rate */
|
|
146
147
|
lastSeenIndex: number;
|
|
147
148
|
/** mint of emission token */
|
|
148
|
-
mint:
|
|
149
|
+
mint: PublicKey;
|
|
149
150
|
/** How many emissions are staged to claim */
|
|
150
151
|
staged: bigint;
|
|
151
152
|
}[];
|
|
152
153
|
}
|
|
153
154
|
export interface VaultEmission {
|
|
154
|
-
tokenAccount:
|
|
155
|
+
tokenAccount: PublicKey;
|
|
155
156
|
initialIndex: AnchorizedPNum;
|
|
156
157
|
lastSeenIndex: AnchorizedPNum;
|
|
157
158
|
finalIndex: AnchorizedPNum;
|
|
158
|
-
treasuryTokenAccount:
|
|
159
|
+
treasuryTokenAccount: PublicKey;
|
|
159
160
|
feeBps: number;
|
|
160
161
|
treasuryEmission: BN;
|
|
161
162
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exponent-labs/exponent-types",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"main": "build/index.js",
|
|
5
5
|
"types": "build/index.d.ts",
|
|
6
6
|
"license": "AGPL-3.0",
|
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
"build": "tsc --build"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@
|
|
12
|
-
"@solana/spl-stake-pool": "1.1.8"
|
|
11
|
+
"@solana/web3.js": "1.98.4",
|
|
12
|
+
"@solana/spl-stake-pool": "1.1.8",
|
|
13
|
+
"bn.js": "5.2.2"
|
|
13
14
|
},
|
|
14
15
|
"devDependencies": {
|
|
15
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
|
}
|
|
@@ -68,7 +68,7 @@ export type AccountInfoJson = {
|
|
|
68
68
|
|
|
69
69
|
export function deserializeCpiAccountsRaw(serialized: CpiAccountsRawJson): CpiAccountsRaw {
|
|
70
70
|
const deserializeAccountInfo = (accountInfo: AccountInfoJson): AccountInfo => ({
|
|
71
|
-
pubkey: new
|
|
71
|
+
pubkey: new PublicKey(accountInfo.pubkey),
|
|
72
72
|
isSigner: accountInfo.isSigner,
|
|
73
73
|
isWritable: accountInfo.isWritable,
|
|
74
74
|
})
|
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
|
|