@mortiseagentvault/sdk 0.1.1 → 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/README.md +43 -3
- package/dist/abis.d.ts +3438 -0
- package/dist/actions.d.ts +255 -0
- package/dist/addresses.d.ts +21 -0
- package/dist/calls.d.ts +18 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +395 -5
- package/dist/modules.d.ts +14 -1
- package/dist/x402.d.ts +68 -0
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -92,9 +92,49 @@ const receipt = await executeActions(client, agentWallet, vault, wrap);
|
|
|
92
92
|
const p = await permissions(client, vault, agent.address, { adapters: [mortise.weth], tokens: [ETH] });
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
-
`actions.*` encodes the input of each adapter
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
`actions.*` encodes the input of each adapter, in exactly the layout its `plan()` decodes, and `markets.*`
|
|
96
|
+
gives the market id the owner allows for it:
|
|
97
|
+
|
|
98
|
+
| Kind | Adapters |
|
|
99
|
+
|---|---|
|
|
100
|
+
| Swaps | Uniswap v2, v3 and v4, PancakeSwap v3 and Infinity, Aero Slipstream, 1inch, Sushi, Pons, Flap |
|
|
101
|
+
| Liquidity | Uniswap v3 and v4 positions, Aero CL positions, Beefy CLM and vaults |
|
|
102
|
+
| Lending and yield | Morpho Blue (supply, and borrowing under a listed loan-to-value ceiling), Aave v3, Lista Lending, ERC-4626, Pendle PT, the Priors credit pool |
|
|
103
|
+
| Bridges | Across, LayerZero (USDG OFT), Chainlink CCIP |
|
|
104
|
+
| Payments and identity | x402 through `MortiseX402Escrow`, the vault's ERC-8004 identity |
|
|
105
|
+
| Venues and moves | Lighter perps margin, WETH, listed transfers, family transfers |
|
|
106
|
+
|
|
107
|
+
1inch and Sushi take the router calldata from their own swap APIs: the adapters check it (output to the
|
|
108
|
+
vault, the exact amount, a floor on the pair) before the vault signs anything.
|
|
109
|
+
|
|
110
|
+
## x402 payments
|
|
111
|
+
|
|
112
|
+
The vault pays x402 resources through `MortiseX402Escrow`, which stands as the EIP-3009 payer and approves
|
|
113
|
+
exactly one payment per funding (ERC-1271). The owner lists each payee; the agent then pays it:
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
import { gate, markets, mortise, payX402 } from "@mortiseagentvault/sdk";
|
|
117
|
+
|
|
118
|
+
// Owner, once per seller: gate.setMarket(mortise.x402, markets.x402Payee(PAYEE), true)
|
|
119
|
+
const paid = await payX402(client, agentWallet, vault, "https://seller.example/resource", { maxValue: 100_000n });
|
|
120
|
+
console.log(paid.status, paid.collected, paid.settlement);
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
`payX402` reads the 402 answer (v2 header or v1 body), funds one payment in USDG, and asks again with it.
|
|
124
|
+
The seller's facilitator must accept a contract payer, as the official `@x402/evm` facilitator does. A
|
|
125
|
+
payment the seller never collects goes back to the vault after its deadline with `x402Escrow.reclaim(nonce)`,
|
|
126
|
+
which anyone may send. A failure after the payment's terms are fixed throws an `X402PaymentError` whose
|
|
127
|
+
`terms.nonce` is the one to reclaim, so a funded payment is never lost track of.
|
|
128
|
+
|
|
129
|
+
## Circuit breaker and auto-compound
|
|
130
|
+
|
|
131
|
+
`pauseGuard.*` makes `MortisePauseGuard` the vault's pauser (`gate.setPauser(mortise.pauseGuard)`), names
|
|
132
|
+
watchers that may pause at any time, and sets Chainlink price bounds that let anyone pause once a fresh price
|
|
133
|
+
leaves them. Unpausing stays with the root.
|
|
134
|
+
|
|
135
|
+
`moduleState.compound` builds the state of `CompoundModule`, which puts a position's fees back into it in two
|
|
136
|
+
triggers: collect, then deposit what the balances rose by. The deposit is an `increase` action with zero
|
|
137
|
+
amounts; `compoundWords.increase` names the words the module fills.
|
|
98
138
|
|
|
99
139
|
## Errors
|
|
100
140
|
|