@mortiseagentvault/sdk 0.1.0 → 0.2.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/dist/actions.d.ts CHANGED
@@ -20,6 +20,19 @@ export interface MarketParams {
20
20
  irm: Address;
21
21
  lltv: bigint;
22
22
  }
23
+ /** PancakeSwap Infinity PoolKey of the CL pool manager; address(0) is native ETH. */
24
+ export interface InfinityPoolKey {
25
+ currency0: Address;
26
+ currency1: Address;
27
+ hooks: Address;
28
+ poolManager: Address;
29
+ fee: number;
30
+ parameters: Hex;
31
+ }
32
+ /** The 65-byte signature an x402 payment through MortiseX402Escrow carries: the escrow approves by the payment's
33
+ * digest and ignores the bytes, and facilitators that parse a signature before asking the payer contract
34
+ * (ERC-1271) accept this one. */
35
+ export declare const X402_SIGNATURE: Hex;
23
36
  /** The Uniswap v4 pool id, which is the market UniswapV4Adapter and UniswapV4LiquidityAdapter report. */
24
37
  export declare function poolId(key: PoolKey): Hex;
25
38
  /** The Morpho Blue market id, which is the market MorphoBlueAdapter reports. */
@@ -142,6 +155,215 @@ export declare const actions: {
142
155
  amount0Min: bigint;
143
156
  amount1Min: bigint;
144
157
  }) => Action;
158
+ /** Exact-input swap on one Uniswap v2 pair; address(0) is ETH. The minimum is raised to the vault's floor. */
159
+ uniswapV2Swap: (a: {
160
+ tokenIn: Address;
161
+ tokenOut: Address;
162
+ amountIn: bigint;
163
+ amountOutMinimum: bigint;
164
+ }) => Action;
165
+ /** Exact-input swap on one PancakeSwap v3 pool; address(0) is ETH. */
166
+ pancakeV3Swap: (a: {
167
+ tokenIn: Address;
168
+ tokenOut: Address;
169
+ fee: number;
170
+ amountIn: bigint;
171
+ amountOutMinimum: bigint;
172
+ }) => Action;
173
+ /** Exact-input swap on one PancakeSwap Infinity CL pool. */
174
+ pancakeInfinitySwap: (a: {
175
+ key: InfinityPoolKey;
176
+ zeroForOne: boolean;
177
+ amountIn: bigint;
178
+ amountOutMinimum: bigint;
179
+ }) => Action;
180
+ /** Exact-input swap on one Aero Slipstream (CL) pool, chosen by tick spacing; address(0) is ETH. */
181
+ aeroSlipstreamSwap: (a: {
182
+ tokenIn: Address;
183
+ tokenOut: Address;
184
+ tickSpacing: number;
185
+ amountIn: bigint;
186
+ amountOutMinimum: bigint;
187
+ }) => Action;
188
+ /** A 1inch v6 router call from 1inch's swap API (swap or unoswap); tokenOut is what the vault receives, ethIn the
189
+ * ETH sent with it (0 for an ERC-20 input). The router must pay the vault. */
190
+ oneInch: (a: {
191
+ tokenOut: Address;
192
+ ethIn: bigint;
193
+ routerCalldata: Hex;
194
+ }) => Action;
195
+ /** A Sushi RedSnwapper snwap call from Sushi's swap API, as is. The recipient must be the vault. */
196
+ sushi: (a: {
197
+ snwapCalldata: Hex;
198
+ }) => Action;
199
+ /** Supply or withdraw the loan token of a listed Lista Lending (Moolah) market; give either assets or shares, the other 0. */
200
+ listaLending: (a: {
201
+ op: "supply" | "withdraw";
202
+ market: MarketParams;
203
+ assets: bigint;
204
+ shares: bigint;
205
+ }) => Action;
206
+ /** Supply an asset to Aave v3 (Kaskad) or withdraw it; maxUint256 withdraws the whole position. */
207
+ aaveV3: (a: {
208
+ op: "supply" | "withdraw";
209
+ asset: Address;
210
+ amount: bigint;
211
+ }) => Action;
212
+ /** The Priors credit pool: lend USDG (deposit, withdraw shares), or borrow on a listed agent identity and repay a loan. */
213
+ priors: (a: {
214
+ op: "deposit";
215
+ amount: bigint;
216
+ minShares: bigint;
217
+ } | {
218
+ op: "withdraw";
219
+ shares: bigint;
220
+ } | {
221
+ op: "borrow";
222
+ agentId: bigint;
223
+ amount: bigint;
224
+ maxFee: bigint;
225
+ term: bigint;
226
+ } | {
227
+ op: "repay";
228
+ loanId: bigint;
229
+ }) => Action;
230
+ /** Beefy: a Cowcentrated Liquidity Manager (clm*) or a Beefy vault (vault*), at a listed target. */
231
+ beefy: (a: {
232
+ op: "clmDeposit";
233
+ target: Address;
234
+ amount0: bigint;
235
+ amount1: bigint;
236
+ minShares: bigint;
237
+ } | {
238
+ op: "clmWithdraw";
239
+ target: Address;
240
+ shares: bigint;
241
+ minAmount0: bigint;
242
+ minAmount1: bigint;
243
+ } | {
244
+ op: "vaultDeposit";
245
+ target: Address;
246
+ amount: bigint;
247
+ } | {
248
+ op: "vaultWithdraw";
249
+ target: Address;
250
+ shares: bigint;
251
+ }) => Action;
252
+ /** Pendle PT on a listed market: buy with a token, sell before maturity, redeem after. amountIn is the token for buy
253
+ * and the PT for sell and redeem; the token must be one the market's SY takes directly. */
254
+ pendle: (a: {
255
+ op: "buy" | "sell" | "redeem";
256
+ market: Address;
257
+ token: Address;
258
+ amountIn: bigint;
259
+ minOut: bigint;
260
+ }) => Action;
261
+ /** Aero CL positions: Mint and Increase take up to amount0/amount1; Decrease takes `liquidity`. ERC-20 pairs only. */
262
+ aeroLiquidity: (a: {
263
+ op: "mint";
264
+ token0: Address;
265
+ token1: Address;
266
+ tickSpacing: number;
267
+ tickLower: number;
268
+ tickUpper: number;
269
+ amount0: bigint;
270
+ amount1: bigint;
271
+ amount0Min: bigint;
272
+ amount1Min: bigint;
273
+ } | {
274
+ op: "increase" | "decrease";
275
+ tokenId: bigint;
276
+ liquidity: bigint;
277
+ amount0: bigint;
278
+ amount1: bigint;
279
+ amount0Min: bigint;
280
+ amount1Min: bigint;
281
+ } | {
282
+ op: "collect" | "burn";
283
+ tokenId: bigint;
284
+ }) => Action;
285
+ /** USDG margin in the vault's own Lighter account: deposit (at least Lighter's 1 USDG minimum), withdraw (paid back to
286
+ * the vault), claim a pending balance, or cancel every open order. Amounts in USDG raw units. */
287
+ lighter: (a: {
288
+ op: "deposit";
289
+ amount: bigint;
290
+ } | {
291
+ op: "withdraw";
292
+ accountIndex: number;
293
+ amount: bigint;
294
+ } | {
295
+ op: "claim";
296
+ amount: bigint;
297
+ } | {
298
+ op: "cancelAll";
299
+ accountIndex: number;
300
+ }) => Action;
301
+ /** Send USDG over LayerZero (the USDG OFT) on a listed route; the native fee is paid from the vault's ETH. */
302
+ layerZeroOft: (a: {
303
+ dstEid: number;
304
+ to: Hex;
305
+ minRate: bigint;
306
+ maxFee: bigint;
307
+ amountLD: bigint;
308
+ minAmountLD: bigint;
309
+ }) => Action;
310
+ /** Send a token over Chainlink CCIP on a listed route to an EVM receiver; the fee is paid in ETH from the vault. */
311
+ ccip: (a: {
312
+ destinationChainSelector: bigint;
313
+ receiver: Address;
314
+ token: Address;
315
+ maxFee: bigint;
316
+ amount: bigint;
317
+ }) => Action;
318
+ /** Borrow on Morpho Blue below a listed loan-to-value ceiling (maxLtv, a 1e18 fraction): collateral in and out,
319
+ * borrow and repay. maxUint256 repays the whole debt. */
320
+ morphoBorrow: (a: {
321
+ op: "supplyCollateral" | "withdrawCollateral" | "borrow" | "repay";
322
+ market: MarketParams;
323
+ amount: bigint;
324
+ maxLtv: bigint;
325
+ }) => Action;
326
+ /** The vault's ERC-8004 agent identity: register one (uri), change its URI, or set a metadata entry. */
327
+ erc8004: (a: {
328
+ op: "register";
329
+ uri: string;
330
+ } | {
331
+ op: "setUri";
332
+ agentId: bigint;
333
+ uri: string;
334
+ } | {
335
+ op: "setMetadata";
336
+ agentId: bigint;
337
+ key: string;
338
+ value: Hex;
339
+ }) => Action;
340
+ /** Funds one x402 payment in MortiseX402Escrow, to a payee the owner listed: the fields of the server's payment
341
+ * requirements and a fresh random nonce. Then send x402Payment(...) to the server. */
342
+ x402: (a: {
343
+ to: Address;
344
+ value: bigint;
345
+ validAfter: bigint;
346
+ validBefore: bigint;
347
+ nonce: Hex;
348
+ }) => Action;
349
+ };
350
+ /** The exact-scheme payload of an x402 payment funded with actions.x402: the escrow is the EIP-3009 payer. */
351
+ export declare function x402Payment(a: {
352
+ to: Address;
353
+ value: bigint;
354
+ validAfter: bigint;
355
+ validBefore: bigint;
356
+ nonce: Hex;
357
+ }): {
358
+ authorization: {
359
+ from: "0x0fCB7f2e7023e94eCD7c31D831b3f172931723e1";
360
+ to: `0x${string}`;
361
+ value: string;
362
+ validAfter: string;
363
+ validBefore: string;
364
+ nonce: `0x${string}`;
365
+ };
366
+ signature: `0x${string}`;
145
367
  };
146
368
  /**
147
369
  * The market id each adapter reports, which the owner allows with gate.setMarket(adapter, market, true).
@@ -163,6 +385,39 @@ export declare const markets: {
163
385
  /** The token allowed to move inside the family. */
164
386
  familyTransfer: (token: Address) => `0x${string}`;
165
387
  weth: () => `0x${string}`;
388
+ uniswapV2Pair: (pair: Address) => `0x${string}`;
389
+ pancakeV3Pool: (pool: Address) => `0x${string}`;
390
+ pancakeInfinityPool: (key: InfinityPoolKey) => `0x${string}`;
391
+ /** The pool address from the Aero CL factory (AeroSlipstreamAdapter and AeroLiquidityAdapter). */
392
+ aeroPool: (pool: Address) => `0x${string}`;
393
+ /** The pair as traded, tokenIn first, address(0) for ETH (OneInchAdapter and SushiAdapter). */
394
+ swapPair: (tokenIn: Address, tokenOut: Address) => `0x${string}`;
395
+ listaLending: (m: MarketParams) => `0x${string}`;
396
+ aaveV3: (asset: Address) => `0x${string}`;
397
+ /** Lending to the Priors pool (deposit and withdraw). */
398
+ priorsLend: () => `0x${string}`;
399
+ /** Borrowing and repaying on one agent identity. */
400
+ priorsBorrow: (agentId: bigint) => `0x${string}`;
401
+ beefy: (target: Address) => `0x${string}`;
402
+ pendle: (market: Address) => `0x${string}`;
403
+ lighter: () => `0x${string}`;
404
+ layerZeroRoute: (r: {
405
+ dstEid: number;
406
+ to: Hex;
407
+ minRate: bigint;
408
+ maxFee: bigint;
409
+ }) => `0x${string}`;
410
+ ccipRoute: (r: {
411
+ destinationChainSelector: bigint;
412
+ receiver: Address;
413
+ token: Address;
414
+ maxFee: bigint;
415
+ }) => `0x${string}`;
416
+ /** A Morpho Blue market with the loan-to-value ceiling the owner allows on it. */
417
+ morphoBorrow: (m: MarketParams, maxLtv: bigint) => `0x${string}`;
418
+ erc8004: () => `0x${string}`;
419
+ /** An x402 payee; it must be listed even when the agent has open markets. */
420
+ x402Payee: (to: Address) => `0x${string}`;
166
421
  acrossRoute: (r: {
167
422
  destinationChainId: bigint;
168
423
  recipient: Hex;
@@ -27,6 +27,27 @@ export declare const mortise: {
27
27
  readonly dca: "0xC319309684725a0cF3F712F630A9e7c63ACE345a";
28
28
  readonly automation: "0x2aFf436334EbcafA4233363fcAf95bFE63219d7d";
29
29
  readonly rebalance: "0xe6e501a2A6422587E8c81813B805D52B4b4fFc57";
30
+ readonly uniswapV2: "0x41D0Be363De3b05F4A3C94820B690b1851A8a1Ed";
31
+ readonly pancakeV3: "0xe35C76466C723C88E75B12469E813488065b6Eab";
32
+ readonly pancakeInfinity: "0x1e403cf84375845216EB8335C84724033FB4FE44";
33
+ readonly aeroSlipstream: "0x8Ef073497C2782b31Bd691A8230FDcc6E9c1Aa0C";
34
+ readonly oneInch: "0xBBf54683bEa7964D4F54F68e61F50053e4a348FF";
35
+ readonly sushi: "0xF03FDF71b37473865B7aee99ff1349458efE6bD1";
36
+ readonly listaLending: "0x91880854d8738564FcC681E2A14CD9186e7a0508";
37
+ readonly aaveV3: "0x3b1e415443ccBB11c5B0e64a71A33c6F3Ab70989";
38
+ readonly priors: "0xc7FB4a6B54b3ba55E31A7F58bA5d45169B2A6Fe9";
39
+ readonly beefy: "0x61dB2eFA7561A9b99E3226d118b5Db9b7F63b92a";
40
+ readonly pendle: "0xe7B2BbFc3b2d5eE81991043A1FE35B52D86Fa249";
41
+ readonly aeroLiquidity: "0x61DF34fE62a3276D819EA9D599479615b63a1DB0";
42
+ readonly lighter: "0xEE4CBD35bA70cd69d71D3b130f142b1886f7F67a";
43
+ readonly layerZeroOft: "0x61FE2335508cB2Cf818b173d6900bAE8cC720eAf";
44
+ readonly ccip: "0xfA875b19C28d32eeebfc5cE2d33dF1Df634f06e9";
45
+ readonly morphoBorrow: "0xA89b35F26466d28D4270B728DA6B6643888707f0";
46
+ readonly erc8004: "0x40714A05fF27C0fF24106299b1b584BCaedAa76b";
47
+ readonly x402Escrow: "0x0fCB7f2e7023e94eCD7c31D831b3f172931723e1";
48
+ readonly x402: "0xa3e7A52413be4c050f9d613c00b614f5dc59cCEb";
49
+ readonly pauseGuard: "0x0a880ce9c5D521AC35Dd7215238a84EB715e8eb0";
50
+ readonly compound: "0xfd774AdE825d243B08b4e028B59216E39A0Cd4a0";
30
51
  };
31
52
  /** The block of the first Mortise deployment transaction, where log queries can start. */
32
53
  export declare const deployBlock = 127492191n;
package/dist/calls.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { type Address, type Hex } from "viem";
1
+ import { type Address, type ContractFunctionArgs, type Hex } from "viem";
2
+ import { pauseGuardAbi } from "./abis.ts";
2
3
  import { type Root } from "./root.ts";
3
4
  import { type Call, type RootCall } from "./userop.ts";
4
5
  /**
@@ -63,6 +64,22 @@ export declare const signer: {
63
64
  /** Safe7579 fallback init data: selector, call type static (0xfe), then the module's own init data. */
64
65
  installFallback: () => RootCall;
65
66
  };
67
+ /**
68
+ * The circuit breaker. The vault makes it its pauser with gate.setPauser(mortise.pauseGuard), then names watchers and
69
+ * price trips (root calls). Watchers call pause, and anyone calls trip once a fresh price leaves its bounds; those two
70
+ * are plain transactions. Unpausing stays with the root (gate.unpause).
71
+ */
72
+ export declare const pauseGuard: {
73
+ setWatcher: (wallet: Address, allowed: boolean) => Call;
74
+ /** Bounds are USD prices with 18 decimals; max 0 means no upper bound. Replaces the vault's trips. */
75
+ setTrips: (trips: ContractFunctionArgs<typeof pauseGuardAbi, "nonpayable", "setTrips">[0]) => Call;
76
+ pause: (vault: Address) => Call;
77
+ trip: (vault: Address, index: bigint) => Call;
78
+ };
79
+ /** An x402 payment the server never collected goes back to the vault after its deadline; anyone may send this. */
80
+ export declare const x402Escrow: {
81
+ reclaim: (nonce: Hex) => Call;
82
+ };
66
83
  /** Moving funds out of the vault. */
67
84
  export declare const funds: {
68
85
  sendEth: (to: Address, amount: bigint) => Call;
package/dist/index.d.ts CHANGED
@@ -8,3 +8,4 @@ export * from "./agent.ts";
8
8
  export * from "./vault.ts";
9
9
  export * from "./modules.ts";
10
10
  export * from "./errors.ts";
11
+ export * from "./x402.ts";