@avaprotocol/sdk-js 4.0.0-dev.1 → 4.0.0-dev.2

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.
Files changed (62) hide show
  1. package/dist/index.js +776 -0
  2. package/dist/index.mjs +775 -0
  3. package/dist/v4/builders/nodes.d.ts +2 -2
  4. package/dist/v4/builders/nodes.d.ts.map +1 -1
  5. package/dist/v4/index.d.ts +1 -0
  6. package/dist/v4/index.d.ts.map +1 -1
  7. package/dist/v4/index.js +1 -0
  8. package/dist/v4/protocols/aave-v3.d.ts +21 -0
  9. package/dist/v4/protocols/aave-v3.d.ts.map +1 -0
  10. package/dist/v4/protocols/aave-v3.js +238 -0
  11. package/dist/v4/protocols/aerodrome.d.ts +4 -0
  12. package/dist/v4/protocols/aerodrome.d.ts.map +1 -0
  13. package/dist/v4/protocols/aerodrome.js +9 -0
  14. package/dist/v4/protocols/chainlink.d.ts +7 -0
  15. package/dist/v4/protocols/chainlink.d.ts.map +1 -0
  16. package/dist/v4/protocols/chainlink.js +25 -0
  17. package/dist/v4/protocols/common.d.ts +16 -0
  18. package/dist/v4/protocols/common.d.ts.map +1 -0
  19. package/dist/v4/protocols/common.js +76 -0
  20. package/dist/v4/protocols/compound-v3.d.ts +4 -0
  21. package/dist/v4/protocols/compound-v3.d.ts.map +1 -0
  22. package/dist/v4/protocols/compound-v3.js +15 -0
  23. package/dist/v4/protocols/erc20.d.ts +5 -0
  24. package/dist/v4/protocols/erc20.d.ts.map +1 -0
  25. package/dist/v4/protocols/erc20.js +18 -0
  26. package/dist/v4/protocols/ethena.d.ts +7 -0
  27. package/dist/v4/protocols/ethena.d.ts.map +1 -0
  28. package/dist/v4/protocols/ethena.js +58 -0
  29. package/dist/v4/protocols/frax-ether.d.ts +7 -0
  30. package/dist/v4/protocols/frax-ether.d.ts.map +1 -0
  31. package/dist/v4/protocols/frax-ether.js +20 -0
  32. package/dist/v4/protocols/index.d.ts +132 -0
  33. package/dist/v4/protocols/index.d.ts.map +1 -0
  34. package/dist/v4/protocols/index.js +87 -0
  35. package/dist/v4/protocols/lido.d.ts +7 -0
  36. package/dist/v4/protocols/lido.d.ts.map +1 -0
  37. package/dist/v4/protocols/lido.js +44 -0
  38. package/dist/v4/protocols/morpho.d.ts +6 -0
  39. package/dist/v4/protocols/morpho.d.ts.map +1 -0
  40. package/dist/v4/protocols/morpho.js +89 -0
  41. package/dist/v4/protocols/rocket-pool.d.ts +6 -0
  42. package/dist/v4/protocols/rocket-pool.d.ts.map +1 -0
  43. package/dist/v4/protocols/rocket-pool.js +36 -0
  44. package/dist/v4/protocols/sky.d.ts +6 -0
  45. package/dist/v4/protocols/sky.d.ts.map +1 -0
  46. package/dist/v4/protocols/sky.js +13 -0
  47. package/dist/v4/protocols/spark.d.ts +4 -0
  48. package/dist/v4/protocols/spark.d.ts.map +1 -0
  49. package/dist/v4/protocols/spark.js +15 -0
  50. package/dist/v4/protocols/superfluid.d.ts +6 -0
  51. package/dist/v4/protocols/superfluid.d.ts.map +1 -0
  52. package/dist/v4/protocols/superfluid.js +39 -0
  53. package/dist/v4/protocols/types.d.ts +17 -0
  54. package/dist/v4/protocols/types.d.ts.map +1 -0
  55. package/dist/v4/protocols/types.js +1 -0
  56. package/dist/v4/protocols/uniswap-v3.d.ts +27 -0
  57. package/dist/v4/protocols/uniswap-v3.d.ts.map +1 -0
  58. package/dist/v4/protocols/uniswap-v3.js +197 -0
  59. package/dist/v4/protocols/wrapped.d.ts +6 -0
  60. package/dist/v4/protocols/wrapped.d.ts.map +1 -0
  61. package/dist/v4/protocols/wrapped.js +55 -0
  62. package/package.json +1 -1
@@ -0,0 +1,197 @@
1
+ // Uniswap V3 whitelist context — Router02 / QuoterV2 / Permit2 / Factory
2
+ // / NonfungiblePositionManager addresses per chain, plus the ABI
3
+ // fragments templates routinely need to compose swaps and quotes.
4
+ //
5
+ // Address parity with studio's per-chain data files:
6
+ // sepolia → app/lib/uniswap/v3/data/sepolia.json
7
+ // ethereum → app/lib/uniswap/v3/data/ethereum.json
8
+ // base → app/lib/uniswap/v3/data/base.json
9
+ // base-sepolia → app/lib/uniswap/v3/data/base-sepolia.json
10
+ //
11
+ // Studio's per-chain pool registries (`pools[]`) intentionally NOT
12
+ // migrated — they're 25+ entries per chain, change frequently, and
13
+ // belong to studio's UI discovery layer. Template tests that need a
14
+ // specific pool address pass it inline; the catalog ships the
15
+ // canonical contract addresses, not the indexed pool universe.
16
+ import { Chains } from "../chains";
17
+ /** SwapRouter02 — the entry point for exactInput/exactOutput swaps. */
18
+ const swapRouter02 = {
19
+ [Chains.EthereumMainnet]: "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45",
20
+ [Chains.Sepolia]: "0x3bFA4769FB09eefC5a80d6E87c3B9C650f7Ae48E",
21
+ [Chains.BaseMainnet]: "0x2626664c2603336E57B271c5C0b26F421741e481",
22
+ [Chains.BaseSepolia]: "0x94cC0AaC535CCDB3C01d6787D6413C739ae12bc4",
23
+ };
24
+ /** QuoterV2 — off-chain quote helper for swap previews. */
25
+ const quoterV2 = {
26
+ [Chains.EthereumMainnet]: "0x61fFE014bA17989E743c5F6cB21bF9697530B21e",
27
+ [Chains.Sepolia]: "0xEd1f6473345F45b75F8179591dd5bA1888cf2FB3",
28
+ [Chains.BaseMainnet]: "0x3d4e44Eb1374240CE5F1B871ab261CD16335B76a",
29
+ [Chains.BaseSepolia]: "0xC5290058841028F1614F3A6F0F5816cAd0df5E27",
30
+ };
31
+ /**
32
+ * Permit2 — Uniswap's universal token-permit contract. Deployed at the
33
+ * SAME address across all chains in the catalog.
34
+ */
35
+ const permit2 = {
36
+ [Chains.EthereumMainnet]: "0x000000000022d473030F116dDEE9F6B43aC78BA3",
37
+ [Chains.Sepolia]: "0x000000000022d473030F116dDEE9F6B43aC78BA3",
38
+ [Chains.BaseMainnet]: "0x000000000022d473030F116dDEE9F6B43aC78BA3",
39
+ [Chains.BaseSepolia]: "0x000000000022d473030F116dDEE9F6B43aC78BA3",
40
+ };
41
+ /** Uniswap V3 Factory — derives the deterministic pool address per token-pair+fee. */
42
+ const factory = {
43
+ [Chains.EthereumMainnet]: "0x1F98431c8aD98523631AE4a59f267346ea31F984",
44
+ [Chains.Sepolia]: "0x0227628f3F023bb0B980b67D528571c95c6DaC1c",
45
+ [Chains.BaseMainnet]: "0x33128a8fC17869897dcE68Ed026d694621f6FDfD",
46
+ [Chains.BaseSepolia]: "0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24",
47
+ };
48
+ /** NonfungiblePositionManager — LP NFT mint/burn/collect. */
49
+ const nonfungiblePositionManager = {
50
+ [Chains.EthereumMainnet]: "0xC36442b4a4522E871399CD717aBDD847Ab11FE88",
51
+ [Chains.Sepolia]: "0x1238536071E1c677A632429e3655c799b22cDA52",
52
+ [Chains.BaseMainnet]: "0x03a520b32C04BF3bEEf7BEb72E919cf822Ed34f1",
53
+ [Chains.BaseSepolia]: "0x27F971cb582BF9E50F397e4d29a5C7A34f11faA2",
54
+ };
55
+ /** UniversalRouter — Uniswap's multi-step routing entrypoint (Permit2-aware). */
56
+ const universalRouter = {
57
+ [Chains.EthereumMainnet]: "0x66a9893cc07d91d95644aedd05d03f95e1dba8af",
58
+ [Chains.Sepolia]: "0x3A9D48AB9751398BbFa63ad67599Bb04e4BdF98b",
59
+ [Chains.BaseMainnet]: "0x6ff5693b99212da76ad316178a184ab56d299b43",
60
+ [Chains.BaseSepolia]: "0x492e6456d9528771018deb9e87ef7750ef184104",
61
+ };
62
+ /**
63
+ * SwapRouter02 ABI — `exactInputSingle` + `exactOutputSingle`. These
64
+ * are the two single-hop swap methods stoploss-style and DCA-style
65
+ * templates use; multi-hop variants (`exactInput` / `exactOutput`)
66
+ * take a `path` bytes blob and aren't included until a template
67
+ * actually needs them.
68
+ */
69
+ const swapRouter02Abi = Object.freeze([
70
+ {
71
+ inputs: [
72
+ {
73
+ components: [
74
+ { internalType: "address", name: "tokenIn", type: "address" },
75
+ { internalType: "address", name: "tokenOut", type: "address" },
76
+ { internalType: "uint24", name: "fee", type: "uint24" },
77
+ { internalType: "address", name: "recipient", type: "address" },
78
+ { internalType: "uint256", name: "amountIn", type: "uint256" },
79
+ { internalType: "uint256", name: "amountOutMinimum", type: "uint256" },
80
+ { internalType: "uint160", name: "sqrtPriceLimitX96", type: "uint160" },
81
+ ],
82
+ internalType: "struct IV3SwapRouter.ExactInputSingleParams",
83
+ name: "params",
84
+ type: "tuple",
85
+ },
86
+ ],
87
+ name: "exactInputSingle",
88
+ outputs: [{ internalType: "uint256", name: "amountOut", type: "uint256" }],
89
+ stateMutability: "payable",
90
+ type: "function",
91
+ },
92
+ {
93
+ inputs: [
94
+ {
95
+ components: [
96
+ { internalType: "address", name: "tokenIn", type: "address" },
97
+ { internalType: "address", name: "tokenOut", type: "address" },
98
+ { internalType: "uint24", name: "fee", type: "uint24" },
99
+ { internalType: "address", name: "recipient", type: "address" },
100
+ { internalType: "uint256", name: "amountOut", type: "uint256" },
101
+ { internalType: "uint256", name: "amountInMaximum", type: "uint256" },
102
+ { internalType: "uint160", name: "sqrtPriceLimitX96", type: "uint160" },
103
+ ],
104
+ internalType: "struct IV3SwapRouter.ExactOutputSingleParams",
105
+ name: "params",
106
+ type: "tuple",
107
+ },
108
+ ],
109
+ name: "exactOutputSingle",
110
+ outputs: [{ internalType: "uint256", name: "amountIn", type: "uint256" }],
111
+ stateMutability: "payable",
112
+ type: "function",
113
+ },
114
+ ]);
115
+ /**
116
+ * QuoterV2 ABI — `quoteExactInputSingle` for off-chain price preview.
117
+ * Note: this is a state-changing call in QuoterV2 (the contract uses
118
+ * `revert` to return the quote) — eth_call against an archive node is
119
+ * the standard usage, which the SDK's `contractRead` supports.
120
+ */
121
+ const quoterV2Abi = Object.freeze([
122
+ {
123
+ inputs: [
124
+ {
125
+ components: [
126
+ { internalType: "address", name: "tokenIn", type: "address" },
127
+ { internalType: "address", name: "tokenOut", type: "address" },
128
+ { internalType: "uint256", name: "amountIn", type: "uint256" },
129
+ { internalType: "uint24", name: "fee", type: "uint24" },
130
+ { internalType: "uint160", name: "sqrtPriceLimitX96", type: "uint160" },
131
+ ],
132
+ internalType: "struct IQuoterV2.QuoteExactInputSingleParams",
133
+ name: "params",
134
+ type: "tuple",
135
+ },
136
+ ],
137
+ name: "quoteExactInputSingle",
138
+ outputs: [
139
+ { internalType: "uint256", name: "amountOut", type: "uint256" },
140
+ { internalType: "uint160", name: "sqrtPriceX96After", type: "uint160" },
141
+ { internalType: "uint32", name: "initializedTicksCrossed", type: "uint32" },
142
+ { internalType: "uint256", name: "gasEstimate", type: "uint256" },
143
+ ],
144
+ stateMutability: "nonpayable",
145
+ type: "function",
146
+ },
147
+ ]);
148
+ /**
149
+ * Factory ABI — `getPool` resolves the canonical pool address for a
150
+ * (tokenA, tokenB, fee) triple. Useful when a template starts from a
151
+ * pair + fee tier rather than a known pool.
152
+ */
153
+ const factoryAbi = Object.freeze([
154
+ {
155
+ inputs: [
156
+ { internalType: "address", name: "tokenA", type: "address" },
157
+ { internalType: "address", name: "tokenB", type: "address" },
158
+ { internalType: "uint24", name: "fee", type: "uint24" },
159
+ ],
160
+ name: "getPool",
161
+ outputs: [{ internalType: "address", name: "pool", type: "address" }],
162
+ stateMutability: "view",
163
+ type: "function",
164
+ },
165
+ ]);
166
+ /**
167
+ * Reference token addresses on the testnet markets these templates
168
+ * routinely target. Mainnet tokens vary per template — pass them
169
+ * inline rather than relying on a global registry the catalog
170
+ * doesn't yet maintain.
171
+ */
172
+ const tokens = Object.freeze({
173
+ WETH: {
174
+ [Chains.Sepolia]: "0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14",
175
+ [Chains.EthereumMainnet]: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
176
+ [Chains.BaseMainnet]: "0x4200000000000000000000000000000000000006",
177
+ [Chains.BaseSepolia]: "0x4200000000000000000000000000000000000006",
178
+ },
179
+ USDC: {
180
+ [Chains.Sepolia]: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
181
+ [Chains.EthereumMainnet]: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
182
+ [Chains.BaseMainnet]: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
183
+ [Chains.BaseSepolia]: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
184
+ },
185
+ });
186
+ export const uniswapV3 = Object.freeze({
187
+ swapRouter02,
188
+ quoterV2,
189
+ permit2,
190
+ factory,
191
+ nonfungiblePositionManager,
192
+ universalRouter,
193
+ swapRouter02Abi,
194
+ quoterV2Abi,
195
+ factoryAbi,
196
+ tokens,
197
+ });
@@ -0,0 +1,6 @@
1
+ import { type AbiFragment } from "./types";
2
+ export declare const wrapped: Readonly<{
3
+ weth: Partial<Record<number, `0x${string}`>>;
4
+ wethAbi: readonly AbiFragment[];
5
+ }>;
6
+ //# sourceMappingURL=wrapped.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrapped.d.ts","sourceRoot":"","sources":["../../../src/v4/protocols/wrapped.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,WAAW,EAAuB,MAAM,SAAS,CAAC;AAkDhE,eAAO,MAAM,OAAO;;;EAGlB,CAAC"}
@@ -0,0 +1,55 @@
1
+ // Wrapped Ether (WETH) — the canonical native-ETH wrapping contract.
2
+ // Mainnet WETH is a one-off; Base (and Base Sepolia) use the OP-stack
3
+ // predeploy at 0x4200…0006. Sepolia is the Uniswap-deployed test WETH
4
+ // used by AAVE Sepolia and Uniswap Sepolia.
5
+ import { Chains } from "../chains";
6
+ const weth = {
7
+ [Chains.EthereumMainnet]: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
8
+ [Chains.Sepolia]: "0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14",
9
+ [Chains.BaseMainnet]: "0x4200000000000000000000000000000000000006",
10
+ [Chains.BaseSepolia]: "0x4200000000000000000000000000000000000006",
11
+ };
12
+ /**
13
+ * WETH9 ABI — `deposit` (payable wrap) + `withdraw` (unwrap) + the
14
+ * standard ERC-20 surface templates rely on. `deposit` is payable
15
+ * with no args; the wrap amount comes from `msg.value`, so the
16
+ * contractWrite node must surface an editable value field — keep
17
+ * stateMutability: "payable" so the SDK builder doesn't hide it.
18
+ */
19
+ const wethAbi = Object.freeze([
20
+ {
21
+ inputs: [],
22
+ name: "deposit",
23
+ outputs: [],
24
+ stateMutability: "payable",
25
+ type: "function",
26
+ },
27
+ {
28
+ inputs: [{ internalType: "uint256", name: "wad", type: "uint256" }],
29
+ name: "withdraw",
30
+ outputs: [],
31
+ stateMutability: "nonpayable",
32
+ type: "function",
33
+ },
34
+ {
35
+ inputs: [
36
+ { internalType: "address", name: "guy", type: "address" },
37
+ { internalType: "uint256", name: "wad", type: "uint256" },
38
+ ],
39
+ name: "approve",
40
+ outputs: [{ internalType: "bool", name: "", type: "bool" }],
41
+ stateMutability: "nonpayable",
42
+ type: "function",
43
+ },
44
+ {
45
+ inputs: [{ internalType: "address", name: "", type: "address" }],
46
+ name: "balanceOf",
47
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
48
+ stateMutability: "view",
49
+ type: "function",
50
+ },
51
+ ]);
52
+ export const wrapped = Object.freeze({
53
+ weth,
54
+ wethAbi,
55
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avaprotocol/sdk-js",
3
- "version": "4.0.0-dev.1",
3
+ "version": "4.0.0-dev.2",
4
4
  "description": "TypeScript SDK for Ava Protocol's AVS REST API (v4). Resource-grouped sub-clients, fetch transport, EIP-191 auth.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",