@exponent-labs/exponent-sdk 0.1.7 → 0.1.8
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/EventDecoderV2.d.ts +31 -0
- package/build/EventDecoderV2.js +76 -0
- package/build/EventDecoderV2.js.map +1 -0
- package/build/addressLookupTableUtil.d.ts +17 -1
- package/build/addressLookupTableUtil.js +35 -1
- package/build/addressLookupTableUtil.js.map +1 -1
- package/build/clmm/events.d.ts +10 -0
- package/build/clmm/events.js +10 -0
- package/build/clmm/events.js.map +1 -0
- package/build/clmm/index.d.ts +1 -0
- package/build/clmm/index.js +18 -0
- package/build/clmm/index.js.map +1 -0
- package/build/events.d.ts +200 -9
- package/build/events.js +73 -24
- package/build/events.js.map +1 -1
- package/build/eventsV2.d.ts +7 -0
- package/build/eventsV2.js +10 -0
- package/build/eventsV2.js.map +1 -0
- package/build/flavors.d.ts +2 -0
- package/build/flavors.js +81 -27
- package/build/flavors.js.map +1 -1
- package/build/index.d.ts +6 -0
- package/build/index.js +14 -4
- package/build/index.js.map +1 -1
- package/build/lpPosition.js +4 -1
- package/build/lpPosition.js.map +1 -1
- package/build/market.d.ts +14 -2
- package/build/market.js +70 -29
- package/build/market.js.map +1 -1
- package/build/marketThree.d.ts +664 -0
- package/build/marketThree.js +1415 -0
- package/build/marketThree.js.map +1 -0
- package/build/marketThree.test.d.ts +1 -0
- package/build/marketThree.test.js +166 -0
- package/build/marketThree.test.js.map +1 -0
- package/build/orderbook/events.d.ts +7 -0
- package/build/orderbook/events.js +10 -0
- package/build/orderbook/events.js.map +1 -0
- package/build/orderbook/index.d.ts +4 -0
- package/build/orderbook/index.js +41 -0
- package/build/orderbook/index.js.map +1 -0
- package/build/orderbook/math.d.ts +26 -0
- package/build/orderbook/math.js +111 -0
- package/build/orderbook/math.js.map +1 -0
- package/build/orderbook/orderbook.d.ts +175 -0
- package/build/orderbook/orderbook.js +756 -0
- package/build/orderbook/orderbook.js.map +1 -0
- package/build/orderbook/types.d.ts +49 -0
- package/build/orderbook/types.js +27 -0
- package/build/orderbook/types.js.map +1 -0
- package/build/orderbook/utils.d.ts +18 -0
- package/build/orderbook/utils.js +74 -0
- package/build/orderbook/utils.js.map +1 -0
- package/build/router.d.ts +92 -0
- package/build/router.js +214 -0
- package/build/router.js.map +1 -0
- package/build/syPosition.js +6 -0
- package/build/syPosition.js.map +1 -1
- package/build/utils/index.d.ts +3 -2
- package/build/utils/index.js +22 -1
- package/build/utils/index.js.map +1 -1
- package/build/vault.d.ts +3 -1
- package/build/vault.js +98 -62
- package/build/vault.js.map +1 -1
- package/build/ytPosition.d.ts +2 -0
- package/build/ytPosition.js +18 -5
- package/build/ytPosition.js.map +1 -1
- package/package.json +28 -23
- package/src/EventDecoderV2.ts +96 -0
- package/src/addressLookupTableUtil.ts +42 -1
- package/src/clmm/events.ts +17 -0
- package/src/clmm/index.ts +1 -0
- package/src/events.ts +280 -27
- package/src/eventsV2.ts +13 -0
- package/src/flavors.ts +97 -27
- package/src/index.ts +6 -0
- package/src/lpPosition.ts +5 -2
- package/src/market.ts +100 -31
- package/src/marketThree.test.ts +208 -0
- package/src/marketThree.ts +2430 -0
- package/src/orderbook/events.ts +13 -0
- package/src/orderbook/index.ts +12 -0
- package/src/orderbook/math.ts +122 -0
- package/src/orderbook/orderbook.ts +1153 -0
- package/src/orderbook/types.ts +45 -0
- package/src/orderbook/utils.ts +74 -0
- package/src/router.ts +360 -0
- package/src/syPosition.ts +4 -0
- package/src/utils/index.ts +27 -2
- package/src/vault.ts +100 -62
- package/src/ytPosition.ts +28 -7
- package/tsconfig.json +4 -1
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/// <reference types="bn.js" />
|
|
2
|
+
import { BN, web3 } from "@coral-xyz/anchor";
|
|
3
|
+
import { ExponentAdminPda } from "@exponent-labs/exponent-admin-pda";
|
|
4
|
+
import { ExponentOrderbookPDA, ExponentPDA } from "@exponent-labs/exponent-pda";
|
|
5
|
+
import { AccountInfo, ConfigurationOptions, OrderbookState } from "@exponent-labs/exponent-types";
|
|
6
|
+
import { ClaimAmount } from "@exponent-labs/marginfi-sy-sdk";
|
|
7
|
+
import { Environment } from "../environment";
|
|
8
|
+
import { Vault } from "../vault";
|
|
9
|
+
import { Offer, OfferOptionsAnchor, OfferTypeAnchor, OrderbookLoadOptions, QuoteDirection } from "./types";
|
|
10
|
+
export declare class Orderbook {
|
|
11
|
+
state: OrderbookState;
|
|
12
|
+
selfAddress: web3.PublicKey;
|
|
13
|
+
env: Environment;
|
|
14
|
+
connection: web3.Connection;
|
|
15
|
+
vaulLookupTable: web3.PublicKey;
|
|
16
|
+
private orderbookProgram;
|
|
17
|
+
private coreProgram;
|
|
18
|
+
constructor(state: OrderbookState, selfAddress: web3.PublicKey, env: Environment, connection: web3.Connection, vaulLookupTable: web3.PublicKey);
|
|
19
|
+
static load(env: Environment, connection: web3.Connection, address: web3.PublicKey, options?: OrderbookLoadOptions, vault?: Vault): Promise<Orderbook>;
|
|
20
|
+
reload(conn?: web3.Connection): Promise<Orderbook>;
|
|
21
|
+
get corePda(): ExponentPDA;
|
|
22
|
+
get pda(): ExponentOrderbookPDA;
|
|
23
|
+
get adminPda(): ExponentAdminPda;
|
|
24
|
+
get eventAuthority(): web3.PublicKey;
|
|
25
|
+
get coreEventAuthority(): web3.PublicKey;
|
|
26
|
+
get mintYt(): web3.PublicKey;
|
|
27
|
+
get mintPt(): web3.PublicKey;
|
|
28
|
+
get syCpiAccounts(): import("@exponent-labs/exponent-types").CpiAccountsRaw;
|
|
29
|
+
get exponentCoreCpiAccounts(): import("@exponent-labs/exponent-types").ExponentCoreCpiAccountsRaw;
|
|
30
|
+
get flavor(): import("@exponent-labs/exponent-types").Flavor;
|
|
31
|
+
get secondsRemaining(): number;
|
|
32
|
+
/** Fee rate is 1 + the actual fee rate - is is for convenience with calculations
|
|
33
|
+
* A feeRate of 1.001 means the fee is 0.1%
|
|
34
|
+
* A feeRate of 1 means there is no fee
|
|
35
|
+
*/
|
|
36
|
+
get makerFeeRate(): number;
|
|
37
|
+
get takerFeeRate(): number;
|
|
38
|
+
/** Post offer instruction */
|
|
39
|
+
ixPostOffer({ trader, price, amount, offerType, offerOption, virtualOffer, expirySeconds, mintSy, ptSrc: ptSrcParam, ytSrc: ytSrcParam, sySrc: sySrcParam, }: {
|
|
40
|
+
trader: web3.PublicKey;
|
|
41
|
+
price: number;
|
|
42
|
+
amount: BN;
|
|
43
|
+
offerType: OfferTypeAnchor;
|
|
44
|
+
offerOption: OfferOptionsAnchor;
|
|
45
|
+
virtualOffer: boolean;
|
|
46
|
+
expirySeconds: number;
|
|
47
|
+
mintSy: web3.PublicKey;
|
|
48
|
+
ptSrc?: web3.PublicKey;
|
|
49
|
+
ytSrc?: web3.PublicKey;
|
|
50
|
+
sySrc?: web3.PublicKey;
|
|
51
|
+
}): Promise<web3.TransactionInstruction>;
|
|
52
|
+
/** Market offer instruction */
|
|
53
|
+
ixMarketOffer({ trader, maxPriceApy, amount, minAmountOut, offerType, virtualOffer, mintSy, ptSrc: ptSrcParam, ytSrc: ytSrcParam, sySrc: sySrcParam, }: {
|
|
54
|
+
trader: web3.PublicKey;
|
|
55
|
+
maxPriceApy: number;
|
|
56
|
+
amount: BN;
|
|
57
|
+
minAmountOut: BN;
|
|
58
|
+
offerType: OfferTypeAnchor;
|
|
59
|
+
virtualOffer: boolean;
|
|
60
|
+
mintSy: web3.PublicKey;
|
|
61
|
+
ptSrc?: web3.PublicKey;
|
|
62
|
+
ytSrc?: web3.PublicKey;
|
|
63
|
+
sySrc?: web3.PublicKey;
|
|
64
|
+
}): Promise<web3.TransactionInstruction>;
|
|
65
|
+
/** High trust set configuration options instruction */
|
|
66
|
+
ixSetConfigurationOptions({ admin, configurationOptions, }: {
|
|
67
|
+
admin: web3.PublicKey;
|
|
68
|
+
configurationOptions: ConfigurationOptions;
|
|
69
|
+
}): Promise<web3.TransactionInstruction>;
|
|
70
|
+
getOffers(): Offer[];
|
|
71
|
+
/** Remove offer instruction */
|
|
72
|
+
ixRemoveOffer({ trader, offerIdx, mintSy, ptSrc: ptSrcParam, ytSrc: ytSrcParam, sySrc: sySrcParam, }: {
|
|
73
|
+
trader: web3.PublicKey;
|
|
74
|
+
offerIdx: number;
|
|
75
|
+
mintSy: web3.PublicKey;
|
|
76
|
+
ptSrc?: web3.PublicKey;
|
|
77
|
+
ytSrc?: web3.PublicKey;
|
|
78
|
+
sySrc?: web3.PublicKey;
|
|
79
|
+
}): Promise<web3.TransactionInstruction>;
|
|
80
|
+
/** Post offer instruction */
|
|
81
|
+
ixWrapperPostOffer({ trader, price, amount, offerType, offerOption, virtualOffer, expirySeconds, mintSy, ptSrc: ptSrcParam, ytSrc: ytSrcParam, sySrc: sySrcParam, tokenBaseTrader: tokenBaseTraderParam, }: {
|
|
82
|
+
trader: web3.PublicKey;
|
|
83
|
+
price: number;
|
|
84
|
+
amount: BN;
|
|
85
|
+
offerType: OfferTypeAnchor;
|
|
86
|
+
offerOption: OfferOptionsAnchor;
|
|
87
|
+
virtualOffer: boolean;
|
|
88
|
+
expirySeconds: number;
|
|
89
|
+
mintSy: web3.PublicKey;
|
|
90
|
+
ptSrc?: web3.PublicKey;
|
|
91
|
+
ytSrc?: web3.PublicKey;
|
|
92
|
+
sySrc?: web3.PublicKey;
|
|
93
|
+
tokenBaseTrader?: web3.PublicKey;
|
|
94
|
+
}): Promise<web3.TransactionInstruction>;
|
|
95
|
+
/** Market offer instruction */
|
|
96
|
+
ixWrapperMarketOffer({ trader, maxPriceApy, amount, offerType, minAmountOut, virtualOffer, mintSy, ptSrc: ptSrcParam, ytSrc: ytSrcParam, sySrc: sySrcParam, tokenBaseTrader: tokenBaseTraderParam, }: {
|
|
97
|
+
trader: web3.PublicKey;
|
|
98
|
+
maxPriceApy: number;
|
|
99
|
+
amount: BN;
|
|
100
|
+
offerType: OfferTypeAnchor;
|
|
101
|
+
minAmountOut: BN;
|
|
102
|
+
virtualOffer: boolean;
|
|
103
|
+
mintSy: web3.PublicKey;
|
|
104
|
+
ptSrc?: web3.PublicKey;
|
|
105
|
+
ytSrc?: web3.PublicKey;
|
|
106
|
+
sySrc?: web3.PublicKey;
|
|
107
|
+
tokenBaseTrader?: web3.PublicKey;
|
|
108
|
+
}): Promise<web3.TransactionInstruction>;
|
|
109
|
+
/** Wrapper remove offer instruction */
|
|
110
|
+
ixWrapperRemoveOffer({ trader, offerIdx, mintSy, ptSrc: ptSrcParam, ytSrc: ytSrcParam, sySrc: sySrcParam, tokenBaseTrader: tokenBaseTraderParam, }: {
|
|
111
|
+
trader: web3.PublicKey;
|
|
112
|
+
offerIdx: number;
|
|
113
|
+
mintSy: web3.PublicKey;
|
|
114
|
+
ptSrc?: web3.PublicKey;
|
|
115
|
+
ytSrc?: web3.PublicKey;
|
|
116
|
+
sySrc?: web3.PublicKey;
|
|
117
|
+
tokenBaseTrader?: web3.PublicKey;
|
|
118
|
+
}): Promise<web3.TransactionInstruction>;
|
|
119
|
+
/** Wrapper collect interest instruction */
|
|
120
|
+
ixWrapperCollectInterest({ trader, mintSy, sySrc: sySrcParam, tokenBaseTrader: tokenBaseTraderParam, }: {
|
|
121
|
+
trader: web3.PublicKey;
|
|
122
|
+
mintSy: web3.PublicKey;
|
|
123
|
+
sySrc?: web3.PublicKey;
|
|
124
|
+
tokenBaseTrader?: web3.PublicKey;
|
|
125
|
+
}): Promise<web3.TransactionInstruction>;
|
|
126
|
+
/** Wrapper withdraw funds instruction */
|
|
127
|
+
ixWrapperWithdrawFunds({ trader, mintSy, ptAmount, ytAmount, syAmount, ptSrc: ptSrcParam, ytSrc: ytSrcParam, sySrc: sySrcParam, tokenBaseTrader: tokenBaseTraderParam, }: {
|
|
128
|
+
trader: web3.PublicKey;
|
|
129
|
+
mintSy: web3.PublicKey;
|
|
130
|
+
ptAmount: ClaimAmount;
|
|
131
|
+
ytAmount: ClaimAmount;
|
|
132
|
+
syAmount: ClaimAmount;
|
|
133
|
+
ptSrc?: web3.PublicKey;
|
|
134
|
+
ytSrc?: web3.PublicKey;
|
|
135
|
+
sySrc?: web3.PublicKey;
|
|
136
|
+
tokenBaseTrader?: web3.PublicKey;
|
|
137
|
+
}): Promise<web3.TransactionInstruction>;
|
|
138
|
+
/** Wrapper collect admin fee instruction */
|
|
139
|
+
ixWrapperCollectAdminFee({ admin, mintSy }: {
|
|
140
|
+
admin: web3.PublicKey;
|
|
141
|
+
mintSy: web3.PublicKey;
|
|
142
|
+
}): Promise<web3.TransactionInstruction>;
|
|
143
|
+
/** Wrapper collect admin emission instruction */
|
|
144
|
+
ixCollectAdminEmission({ emissionEscrow, amount, index, treasuryEmissionTokenAccount, tokenEmissionAdmin, }: {
|
|
145
|
+
emissionEscrow: web3.PublicKey;
|
|
146
|
+
index: number;
|
|
147
|
+
amount: ClaimAmount;
|
|
148
|
+
treasuryEmissionTokenAccount: web3.PublicKey;
|
|
149
|
+
tokenEmissionAdmin: web3.PublicKey;
|
|
150
|
+
}): Promise<web3.TransactionInstruction>;
|
|
151
|
+
collectAdminEmissionCoreAccounts({ emissionDst, emissionEscrow, treasuryEmissionTokenAccount, }: {
|
|
152
|
+
emissionDst: web3.PublicKey;
|
|
153
|
+
emissionEscrow: web3.PublicKey;
|
|
154
|
+
treasuryEmissionTokenAccount: web3.PublicKey;
|
|
155
|
+
}): AccountInfo[];
|
|
156
|
+
/** Wrapper collect admin fee instruction */
|
|
157
|
+
ixRemoveExpiredOffers({ admin }: {
|
|
158
|
+
admin: web3.PublicKey;
|
|
159
|
+
}): Promise<web3.TransactionInstruction>;
|
|
160
|
+
getQuote({ priceApy: rawPriceApy, inAmount: inAmountRaw, direction, unixNow, syExchangeRate, }: {
|
|
161
|
+
priceApy?: number;
|
|
162
|
+
inAmount: number;
|
|
163
|
+
unixNow: number;
|
|
164
|
+
direction: QuoteDirection;
|
|
165
|
+
syExchangeRate: number;
|
|
166
|
+
}): {
|
|
167
|
+
outAmount: number;
|
|
168
|
+
makerFees: number;
|
|
169
|
+
takerFees: number;
|
|
170
|
+
};
|
|
171
|
+
depositYtAccounts({ owner, ytSrc: ytSrcParam, }: {
|
|
172
|
+
owner: web3.PublicKey;
|
|
173
|
+
ytSrc?: web3.PublicKey;
|
|
174
|
+
}): Promise<web3.TransactionInstruction>;
|
|
175
|
+
}
|