agentwallet-sdk 3.3.0 → 3.4.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.
Files changed (320) hide show
  1. package/README.md +2 -536
  2. package/dist/bridge/abis.d.ts +48 -171
  3. package/dist/bridge/abis.d.ts.map +1 -1
  4. package/dist/bridge/abis.js.map +1 -1
  5. package/dist/bridge/client.d.ts +2 -41
  6. package/dist/bridge/client.d.ts.map +1 -1
  7. package/dist/bridge/client.js +35 -168
  8. package/dist/bridge/client.js.map +1 -1
  9. package/dist/bridge/index.d.ts +2 -4
  10. package/dist/bridge/index.d.ts.map +1 -1
  11. package/dist/bridge/index.js +1 -8
  12. package/dist/bridge/index.js.map +1 -1
  13. package/dist/bridge/types.d.ts +15 -134
  14. package/dist/bridge/types.d.ts.map +1 -1
  15. package/dist/bridge/types.js +16 -170
  16. package/dist/bridge/types.js.map +1 -1
  17. package/dist/identity/erc8004.d.ts +2 -240
  18. package/dist/identity/erc8004.d.ts.map +1 -1
  19. package/dist/identity/erc8004.js +58 -334
  20. package/dist/identity/erc8004.js.map +1 -1
  21. package/dist/index.d.ts +313 -136
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +11 -59
  24. package/dist/index.js.map +1 -1
  25. package/dist/swap/SwapModule.d.ts +6 -50
  26. package/dist/swap/SwapModule.d.ts.map +1 -1
  27. package/dist/swap/SwapModule.js +25 -153
  28. package/dist/swap/SwapModule.js.map +1 -1
  29. package/dist/swap/abi.d.ts +47 -165
  30. package/dist/swap/abi.d.ts.map +1 -1
  31. package/dist/swap/abi.js.map +1 -1
  32. package/dist/swap/index.d.ts +2 -3
  33. package/dist/swap/index.d.ts.map +1 -1
  34. package/dist/swap/index.js +1 -4
  35. package/dist/swap/index.js.map +1 -1
  36. package/dist/swap/types.d.ts +6 -36
  37. package/dist/swap/types.d.ts.map +1 -1
  38. package/dist/swap/types.js +0 -1
  39. package/dist/swap/types.js.map +1 -1
  40. package/dist/types.d.ts +1 -2
  41. package/dist/types.d.ts.map +1 -1
  42. package/dist/types.js +0 -1
  43. package/dist/types.js.map +1 -1
  44. package/dist/x402/__tests__/budget.test.d.ts +2 -0
  45. package/dist/x402/__tests__/budget.test.d.ts.map +1 -0
  46. package/dist/x402/__tests__/budget.test.js +114 -0
  47. package/dist/x402/__tests__/budget.test.js.map +1 -0
  48. package/dist/x402/__tests__/client.test.d.ts +2 -0
  49. package/dist/x402/__tests__/client.test.d.ts.map +1 -0
  50. package/dist/x402/__tests__/client.test.js +107 -0
  51. package/dist/x402/__tests__/client.test.js.map +1 -0
  52. package/dist/x402/chains/abstract/index.d.ts +135 -0
  53. package/dist/x402/chains/abstract/index.d.ts.map +1 -0
  54. package/dist/x402/chains/abstract/index.js +190 -0
  55. package/dist/x402/chains/abstract/index.js.map +1 -0
  56. package/dist/x402/client.d.ts +1 -4
  57. package/dist/x402/client.d.ts.map +1 -1
  58. package/dist/x402/client.js +2 -16
  59. package/dist/x402/client.js.map +1 -1
  60. package/dist/x402/index.d.ts +3 -1
  61. package/dist/x402/index.d.ts.map +1 -1
  62. package/dist/x402/index.js +3 -1
  63. package/dist/x402/index.js.map +1 -1
  64. package/dist/x402/types.d.ts +3 -5
  65. package/dist/x402/types.d.ts.map +1 -1
  66. package/dist/x402/types.js +2 -17
  67. package/dist/x402/types.js.map +1 -1
  68. package/package.json +12 -32
  69. package/dist/ap2/index.d.ts +0 -185
  70. package/dist/ap2/index.d.ts.map +0 -1
  71. package/dist/ap2/index.js +0 -255
  72. package/dist/ap2/index.js.map +0 -1
  73. package/dist/bridge/unified.d.ts +0 -101
  74. package/dist/bridge/unified.d.ts.map +0 -1
  75. package/dist/bridge/unified.js +0 -284
  76. package/dist/bridge/unified.js.map +0 -1
  77. package/dist/chains.d.ts +0 -62
  78. package/dist/chains.d.ts.map +0 -1
  79. package/dist/chains.js +0 -108
  80. package/dist/chains.js.map +0 -1
  81. package/dist/fiat/index.d.ts +0 -10
  82. package/dist/fiat/index.d.ts.map +0 -1
  83. package/dist/fiat/index.js +0 -9
  84. package/dist/fiat/index.js.map +0 -1
  85. package/dist/fiat/onramp.d.ts +0 -101
  86. package/dist/fiat/onramp.d.ts.map +0 -1
  87. package/dist/fiat/onramp.js +0 -155
  88. package/dist/fiat/onramp.js.map +0 -1
  89. package/dist/fiat/providers/index.d.ts +0 -16
  90. package/dist/fiat/providers/index.d.ts.map +0 -1
  91. package/dist/fiat/providers/index.js +0 -30
  92. package/dist/fiat/providers/index.js.map +0 -1
  93. package/dist/fiat/providers/moonpay.d.ts +0 -22
  94. package/dist/fiat/providers/moonpay.d.ts.map +0 -1
  95. package/dist/fiat/providers/moonpay.js +0 -107
  96. package/dist/fiat/providers/moonpay.js.map +0 -1
  97. package/dist/fiat/providers/stripe.d.ts +0 -26
  98. package/dist/fiat/providers/stripe.d.ts.map +0 -1
  99. package/dist/fiat/providers/stripe.js +0 -135
  100. package/dist/fiat/providers/stripe.js.map +0 -1
  101. package/dist/fiat/providers/transak.d.ts +0 -26
  102. package/dist/fiat/providers/transak.d.ts.map +0 -1
  103. package/dist/fiat/providers/transak.js +0 -119
  104. package/dist/fiat/providers/transak.js.map +0 -1
  105. package/dist/fiat/types.d.ts +0 -106
  106. package/dist/fiat/types.d.ts.map +0 -1
  107. package/dist/fiat/types.js +0 -13
  108. package/dist/fiat/types.js.map +0 -1
  109. package/dist/flash/executor.d.ts +0 -119
  110. package/dist/flash/executor.d.ts.map +0 -1
  111. package/dist/flash/executor.js +0 -195
  112. package/dist/flash/executor.js.map +0 -1
  113. package/dist/flash/index.d.ts +0 -28
  114. package/dist/flash/index.d.ts.map +0 -1
  115. package/dist/flash/index.js +0 -25
  116. package/dist/flash/index.js.map +0 -1
  117. package/dist/flash/scanner.d.ts +0 -133
  118. package/dist/flash/scanner.d.ts.map +0 -1
  119. package/dist/flash/scanner.js +0 -212
  120. package/dist/flash/scanner.js.map +0 -1
  121. package/dist/flash/types.d.ts +0 -136
  122. package/dist/flash/types.d.ts.map +0 -1
  123. package/dist/flash/types.js +0 -23
  124. package/dist/flash/types.js.map +0 -1
  125. package/dist/gas/index.d.ts +0 -4
  126. package/dist/gas/index.d.ts.map +0 -1
  127. package/dist/gas/index.js +0 -3
  128. package/dist/gas/index.js.map +0 -1
  129. package/dist/gas/sponsor.d.ts +0 -70
  130. package/dist/gas/sponsor.d.ts.map +0 -1
  131. package/dist/gas/sponsor.js +0 -193
  132. package/dist/gas/sponsor.js.map +0 -1
  133. package/dist/gas/types.d.ts +0 -76
  134. package/dist/gas/types.d.ts.map +0 -1
  135. package/dist/gas/types.js +0 -21
  136. package/dist/gas/types.js.map +0 -1
  137. package/dist/identity/agent-identity.d.ts +0 -276
  138. package/dist/identity/agent-identity.d.ts.map +0 -1
  139. package/dist/identity/agent-identity.js +0 -300
  140. package/dist/identity/agent-identity.js.map +0 -1
  141. package/dist/identity/erc6551.d.ts +0 -441
  142. package/dist/identity/erc6551.d.ts.map +0 -1
  143. package/dist/identity/erc6551.js +0 -517
  144. package/dist/identity/erc6551.js.map +0 -1
  145. package/dist/mev/index.d.ts +0 -4
  146. package/dist/mev/index.d.ts.map +0 -1
  147. package/dist/mev/index.js +0 -4
  148. package/dist/mev/index.js.map +0 -1
  149. package/dist/mev/protection.d.ts +0 -54
  150. package/dist/mev/protection.d.ts.map +0 -1
  151. package/dist/mev/protection.js +0 -185
  152. package/dist/mev/protection.js.map +0 -1
  153. package/dist/mev/risk.d.ts +0 -19
  154. package/dist/mev/risk.d.ts.map +0 -1
  155. package/dist/mev/risk.js +0 -95
  156. package/dist/mev/risk.js.map +0 -1
  157. package/dist/mev/types.d.ts +0 -49
  158. package/dist/mev/types.d.ts.map +0 -1
  159. package/dist/mev/types.js +0 -2
  160. package/dist/mev/types.js.map +0 -1
  161. package/dist/settlement/index.d.ts +0 -4
  162. package/dist/settlement/index.d.ts.map +0 -1
  163. package/dist/settlement/index.js +0 -3
  164. package/dist/settlement/index.js.map +0 -1
  165. package/dist/settlement/types.d.ts +0 -66
  166. package/dist/settlement/types.d.ts.map +0 -1
  167. package/dist/settlement/types.js +0 -37
  168. package/dist/settlement/types.js.map +0 -1
  169. package/dist/settlement/verifier.d.ts +0 -75
  170. package/dist/settlement/verifier.d.ts.map +0 -1
  171. package/dist/settlement/verifier.js +0 -354
  172. package/dist/settlement/verifier.js.map +0 -1
  173. package/dist/solana/bridge.d.ts +0 -144
  174. package/dist/solana/bridge.d.ts.map +0 -1
  175. package/dist/solana/bridge.js +0 -352
  176. package/dist/solana/bridge.js.map +0 -1
  177. package/dist/solana/index.d.ts +0 -8
  178. package/dist/solana/index.d.ts.map +0 -1
  179. package/dist/solana/index.js +0 -6
  180. package/dist/solana/index.js.map +0 -1
  181. package/dist/solana/swap.d.ts +0 -85
  182. package/dist/solana/swap.d.ts.map +0 -1
  183. package/dist/solana/swap.js +0 -173
  184. package/dist/solana/swap.js.map +0 -1
  185. package/dist/solana/types.d.ts +0 -126
  186. package/dist/solana/types.d.ts.map +0 -1
  187. package/dist/solana/types.js +0 -10
  188. package/dist/solana/types.js.map +0 -1
  189. package/dist/solana/wallet.d.ts +0 -83
  190. package/dist/solana/wallet.d.ts.map +0 -1
  191. package/dist/solana/wallet.js +0 -164
  192. package/dist/solana/wallet.js.map +0 -1
  193. package/dist/solana/x402.d.ts +0 -69
  194. package/dist/solana/x402.d.ts.map +0 -1
  195. package/dist/solana/x402.js +0 -154
  196. package/dist/solana/x402.js.map +0 -1
  197. package/dist/solver/adapter.d.ts +0 -47
  198. package/dist/solver/adapter.d.ts.map +0 -1
  199. package/dist/solver/adapter.js +0 -138
  200. package/dist/solver/adapter.js.map +0 -1
  201. package/dist/solver/analyzer.d.ts +0 -48
  202. package/dist/solver/analyzer.d.ts.map +0 -1
  203. package/dist/solver/analyzer.js +0 -89
  204. package/dist/solver/analyzer.js.map +0 -1
  205. package/dist/solver/builder.d.ts +0 -31
  206. package/dist/solver/builder.d.ts.map +0 -1
  207. package/dist/solver/builder.js +0 -60
  208. package/dist/solver/builder.js.map +0 -1
  209. package/dist/solver/index.d.ts +0 -22
  210. package/dist/solver/index.d.ts.map +0 -1
  211. package/dist/solver/index.js +0 -21
  212. package/dist/solver/index.js.map +0 -1
  213. package/dist/solver/types.d.ts +0 -115
  214. package/dist/solver/types.d.ts.map +0 -1
  215. package/dist/solver/types.js +0 -10
  216. package/dist/solver/types.js.map +0 -1
  217. package/dist/spend-guard/index.d.ts +0 -125
  218. package/dist/spend-guard/index.d.ts.map +0 -1
  219. package/dist/spend-guard/index.js +0 -150
  220. package/dist/spend-guard/index.js.map +0 -1
  221. package/dist/swap/router/cache.d.ts +0 -13
  222. package/dist/swap/router/cache.d.ts.map +0 -1
  223. package/dist/swap/router/cache.js +0 -30
  224. package/dist/swap/router/cache.js.map +0 -1
  225. package/dist/swap/router/flashbots.d.ts +0 -10
  226. package/dist/swap/router/flashbots.d.ts.map +0 -1
  227. package/dist/swap/router/flashbots.js +0 -43
  228. package/dist/swap/router/flashbots.js.map +0 -1
  229. package/dist/swap/router/health.d.ts +0 -17
  230. package/dist/swap/router/health.d.ts.map +0 -1
  231. package/dist/swap/router/health.js +0 -38
  232. package/dist/swap/router/health.js.map +0 -1
  233. package/dist/swap/router/index.d.ts +0 -10
  234. package/dist/swap/router/index.d.ts.map +0 -1
  235. package/dist/swap/router/index.js +0 -10
  236. package/dist/swap/router/index.js.map +0 -1
  237. package/dist/swap/router/providers/cowswap.d.ts +0 -11
  238. package/dist/swap/router/providers/cowswap.d.ts.map +0 -1
  239. package/dist/swap/router/providers/cowswap.js +0 -79
  240. package/dist/swap/router/providers/cowswap.js.map +0 -1
  241. package/dist/swap/router/providers/index.d.ts +0 -20
  242. package/dist/swap/router/providers/index.d.ts.map +0 -1
  243. package/dist/swap/router/providers/index.js +0 -32
  244. package/dist/swap/router/providers/index.js.map +0 -1
  245. package/dist/swap/router/providers/jupiter.d.ts +0 -12
  246. package/dist/swap/router/providers/jupiter.d.ts.map +0 -1
  247. package/dist/swap/router/providers/jupiter.js +0 -73
  248. package/dist/swap/router/providers/jupiter.js.map +0 -1
  249. package/dist/swap/router/providers/lifi.d.ts +0 -11
  250. package/dist/swap/router/providers/lifi.d.ts.map +0 -1
  251. package/dist/swap/router/providers/lifi.js +0 -123
  252. package/dist/swap/router/providers/lifi.js.map +0 -1
  253. package/dist/swap/router/providers/oneinch.d.ts +0 -13
  254. package/dist/swap/router/providers/oneinch.d.ts.map +0 -1
  255. package/dist/swap/router/providers/oneinch.js +0 -71
  256. package/dist/swap/router/providers/oneinch.js.map +0 -1
  257. package/dist/swap/router/providers/paraswap.d.ts +0 -11
  258. package/dist/swap/router/providers/paraswap.d.ts.map +0 -1
  259. package/dist/swap/router/providers/paraswap.js +0 -73
  260. package/dist/swap/router/providers/paraswap.js.map +0 -1
  261. package/dist/swap/router/providers/uniswap.d.ts +0 -31
  262. package/dist/swap/router/providers/uniswap.d.ts.map +0 -1
  263. package/dist/swap/router/providers/uniswap.js +0 -116
  264. package/dist/swap/router/providers/uniswap.js.map +0 -1
  265. package/dist/swap/router/providers/zerox.d.ts +0 -13
  266. package/dist/swap/router/providers/zerox.d.ts.map +0 -1
  267. package/dist/swap/router/providers/zerox.js +0 -94
  268. package/dist/swap/router/providers/zerox.js.map +0 -1
  269. package/dist/swap/router/router.d.ts +0 -86
  270. package/dist/swap/router/router.d.ts.map +0 -1
  271. package/dist/swap/router/router.js +0 -224
  272. package/dist/swap/router/router.js.map +0 -1
  273. package/dist/swap/router/rsi/engine.d.ts +0 -60
  274. package/dist/swap/router/rsi/engine.d.ts.map +0 -1
  275. package/dist/swap/router/rsi/engine.js +0 -483
  276. package/dist/swap/router/rsi/engine.js.map +0 -1
  277. package/dist/swap/router/rsi/index.d.ts +0 -3
  278. package/dist/swap/router/rsi/index.d.ts.map +0 -1
  279. package/dist/swap/router/rsi/index.js +0 -3
  280. package/dist/swap/router/rsi/index.js.map +0 -1
  281. package/dist/swap/router/rsi/types.d.ts +0 -106
  282. package/dist/swap/router/rsi/types.d.ts.map +0 -1
  283. package/dist/swap/router/rsi/types.js +0 -3
  284. package/dist/swap/router/rsi/types.js.map +0 -1
  285. package/dist/swap/router/types.d.ts +0 -120
  286. package/dist/swap/router/types.d.ts.map +0 -1
  287. package/dist/swap/router/types.js +0 -16
  288. package/dist/swap/router/types.js.map +0 -1
  289. package/dist/tax/engine.d.ts +0 -131
  290. package/dist/tax/engine.d.ts.map +0 -1
  291. package/dist/tax/engine.js +0 -307
  292. package/dist/tax/engine.js.map +0 -1
  293. package/dist/tax/index.d.ts +0 -9
  294. package/dist/tax/index.d.ts.map +0 -1
  295. package/dist/tax/index.js +0 -8
  296. package/dist/tax/index.js.map +0 -1
  297. package/dist/tax/lots.d.ts +0 -60
  298. package/dist/tax/lots.d.ts.map +0 -1
  299. package/dist/tax/lots.js +0 -129
  300. package/dist/tax/lots.js.map +0 -1
  301. package/dist/tax/types.d.ts +0 -113
  302. package/dist/tax/types.d.ts.map +0 -1
  303. package/dist/tax/types.js +0 -18
  304. package/dist/tax/types.js.map +0 -1
  305. package/dist/yield/index.d.ts +0 -26
  306. package/dist/yield/index.d.ts.map +0 -1
  307. package/dist/yield/index.js +0 -25
  308. package/dist/yield/index.js.map +0 -1
  309. package/dist/yield/rates.d.ts +0 -114
  310. package/dist/yield/rates.d.ts.map +0 -1
  311. package/dist/yield/rates.js +0 -351
  312. package/dist/yield/rates.js.map +0 -1
  313. package/dist/yield/types.d.ts +0 -134
  314. package/dist/yield/types.d.ts.map +0 -1
  315. package/dist/yield/types.js +0 -24
  316. package/dist/yield/types.js.map +0 -1
  317. package/dist/yield/vault.d.ts +0 -112
  318. package/dist/yield/vault.d.ts.map +0 -1
  319. package/dist/yield/vault.js +0 -264
  320. package/dist/yield/vault.js.map +0 -1
@@ -1,119 +0,0 @@
1
- /**
2
- * Transak Provider
3
- *
4
- * Creates onramp sessions via Transak's REST API.
5
- * Returns a hosted URL where users complete KYC + payment on Transak's page.
6
- * We never handle KYC data — it stays entirely within Transak's infrastructure.
7
- *
8
- * API reference: https://docs.transak.com/reference/get-price
9
- * Dashboard: https://dashboard.transak.com
10
- */
11
- const TRANSAK_BASE_URL = 'https://api.transak.com/api/v2';
12
- const TRANSAK_SANDBOX_URL = 'https://staging-api.transak.com/api/v2';
13
- const TRANSAK_WIDGET_URL = 'https://global.transak.com';
14
- const TRANSAK_SANDBOX_WIDGET_URL = 'https://global-stg.transak.com';
15
- /** Transak network identifiers */
16
- const CHAIN_MAP = {
17
- ethereum: 'ethereum',
18
- base: 'base',
19
- solana: 'solana',
20
- polygon: 'polygon',
21
- arbitrum: 'arbitrum',
22
- optimism: 'optimism',
23
- avalanche: 'avaxcchain',
24
- bsc: 'bsc',
25
- };
26
- /** Supported assets by chain */
27
- const SUPPORTED_ASSETS = {
28
- ethereum: ['ETH', 'USDC', 'USDT', 'DAI'],
29
- base: ['ETH', 'USDC'],
30
- solana: ['SOL', 'USDC'],
31
- polygon: ['MATIC', 'USDC', 'USDT', 'DAI'],
32
- arbitrum: ['ETH', 'USDC', 'USDT'],
33
- optimism: ['ETH', 'USDC', 'USDT'],
34
- avalanche: ['AVAX', 'USDC'],
35
- bsc: ['BNB', 'USDT', 'BUSD'],
36
- };
37
- export class TransakProvider {
38
- constructor(apiKey, testMode = false) {
39
- this.name = 'transak';
40
- this.supportedAssets = SUPPORTED_ASSETS;
41
- this.apiKey = apiKey;
42
- this.testMode = testMode;
43
- this.baseUrl = testMode ? TRANSAK_SANDBOX_URL : TRANSAK_BASE_URL;
44
- this.widgetUrl = testMode ? TRANSAK_SANDBOX_WIDGET_URL : TRANSAK_WIDGET_URL;
45
- }
46
- get isConfigured() {
47
- return Boolean(this.apiKey);
48
- }
49
- async getQuote(params) {
50
- const network = CHAIN_MAP[params.chain] ?? params.chain;
51
- const currency = (params.currency ?? 'USD').toUpperCase();
52
- const url = new URL(`${this.baseUrl}/currencies/price`);
53
- url.searchParams.set('partnerApiKey', this.apiKey);
54
- url.searchParams.set('fiatCurrency', currency);
55
- url.searchParams.set('cryptoCurrency', params.token.toUpperCase());
56
- url.searchParams.set('isBuyOrSell', 'BUY');
57
- url.searchParams.set('fiatAmount', String(params.amount));
58
- url.searchParams.set('network', network);
59
- const response = await fetch(url.toString(), {
60
- headers: { Accept: 'application/json' },
61
- });
62
- if (!response.ok) {
63
- const errorText = await response.text().catch(() => response.statusText);
64
- throw new Error(`Transak API error ${response.status}: ${errorText}`);
65
- }
66
- const data = await response.json();
67
- if (data.error) {
68
- throw new Error(`Transak error: ${data.error.message}`);
69
- }
70
- const r = data.response ?? {};
71
- const cryptoAmount = r.cryptoAmount ?? 0;
72
- const feePercent = ((r.feeDecimal ?? 0) + (r.partnerFeeDecimal ?? 0)) * 100;
73
- const feeAmount = params.amount * (feePercent / 100);
74
- const purchaseUrl = this.buildWidgetUrl(params, network, currency);
75
- return {
76
- provider: this.name,
77
- fiatAmount: params.amount,
78
- fiatCurrency: currency,
79
- cryptoAmount: String(cryptoAmount),
80
- cryptoToken: params.token.toUpperCase(),
81
- chain: params.chain,
82
- feeAmount,
83
- feePercent: Math.round(feePercent * 100) / 100,
84
- netCryptoAmount: String(cryptoAmount),
85
- paymentMethods: this.extractPaymentMethods(r.payment_methods),
86
- estimatedTimeMinutes: 15,
87
- kycRequired: true,
88
- purchaseUrl,
89
- };
90
- }
91
- async createSession(params) {
92
- // Transak uses a URL-based widget flow — session = widget URL with params
93
- return this.getQuote(params);
94
- }
95
- buildWidgetUrl(params, network, currency) {
96
- const url = new URL(this.widgetUrl);
97
- url.searchParams.set('apiKey', this.apiKey);
98
- url.searchParams.set('fiatCurrency', currency);
99
- url.searchParams.set('cryptoCurrencyCode', params.token.toUpperCase());
100
- url.searchParams.set('fiatAmount', String(params.amount));
101
- url.searchParams.set('network', network);
102
- url.searchParams.set('walletAddress', params.walletAddress);
103
- url.searchParams.set('isBuyOrSell', 'BUY');
104
- if (this.testMode) {
105
- url.searchParams.set('environment', 'STAGING');
106
- }
107
- if (params.redirectUrl) {
108
- url.searchParams.set('redirectURL', params.redirectUrl);
109
- }
110
- return url.toString();
111
- }
112
- extractPaymentMethods(methods) {
113
- if (!methods || methods.length === 0) {
114
- return ['card', 'bank_transfer', 'apple_pay', 'google_pay'];
115
- }
116
- return methods.map((m) => m.id ?? 'card').filter(Boolean);
117
- }
118
- }
119
- //# sourceMappingURL=transak.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transak.js","sourceRoot":"","sources":["../../../src/fiat/providers/transak.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,MAAM,gBAAgB,GAAG,gCAAgC,CAAC;AAC1D,MAAM,mBAAmB,GAAG,wCAAwC,CAAC;AACrE,MAAM,kBAAkB,GAAG,4BAA4B,CAAC;AACxD,MAAM,0BAA0B,GAAG,gCAAgC,CAAC;AAEpE,kCAAkC;AAClC,MAAM,SAAS,GAA2B;IACxC,QAAQ,EAAE,UAAU;IACpB,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,UAAU;IACpB,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,YAAY;IACvB,GAAG,EAAE,KAAK;CACX,CAAC;AAEF,gCAAgC;AAChC,MAAM,gBAAgB,GAA6B;IACjD,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC;IACxC,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC;IACzC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC;IACjC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC;IACjC,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;IAC3B,GAAG,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC;CAC7B,CAAC;A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C;QAC5D,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;QAC3C,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;QACjD,CAAC;QACD,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;YACvB,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;QAC1D,CAAC;QACD,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;IACxB,CAAC;IAEO,qBAAqB,CAAC,OAA2B;QACvD,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACrC,OAAO,CAAC,MAAM,EAAE,eAAe,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC;QAC9D,CAAC;QACD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,MAAM,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC5D,CAAC;CACF"}
@@ -1,106 +0,0 @@
1
- /**
2
- * FiatOnramp Types
3
- *
4
- * IMPORTANT: The fiat onramp module is entirely OPT-IN.
5
- * Users who fund their agent wallet via direct crypto transfer, bridge,
6
- * or any other method NEVER encounter KYC and remain fully anonymous.
7
- *
8
- * KYC only occurs when a user explicitly chooses to use the fiat onramp
9
- * feature. The SDK never collects or stores KYC data — all KYC is handled
10
- * entirely by the third-party provider on their hosted page.
11
- */
12
- /**
13
- * Configuration for the FiatOnramp module.
14
- * API keys are per-provider — only configure the providers you want to use.
15
- * Omitting all keys is valid; it just returns an empty provider list.
16
- */
17
- export interface FiatOnrampConfig {
18
- /** MoonPay publishable API key — https://dashboard.moonpay.com */
19
- moonpayApiKey?: string;
20
- /** Stripe publishable API key — https://dashboard.stripe.com */
21
- stripeApiKey?: string;
22
- /** Transak API key — https://dashboard.transak.com */
23
- transakApiKey?: string;
24
- /** Default fiat currency (ISO 4217). Defaults to 'USD'. */
25
- defaultCurrency?: string;
26
- /** Use sandbox/test mode for all providers. Defaults to false. */
27
- testMode?: boolean;
28
- }
29
- /**
30
- * A quote from a single fiat onramp provider.
31
- *
32
- * NOTE: kycRequired is always true for fiat onramp. KYC happens entirely
33
- * on the provider's hosted page — the SDK never sees any KYC data.
34
- */
35
- export interface FiatQuote {
36
- /** Provider identifier: 'moonpay' | 'stripe' | 'transak' */
37
- provider: string;
38
- /** Fiat amount the user will pay */
39
- fiatAmount: number;
40
- /** Fiat currency code (e.g. 'USD', 'EUR', 'GBP') */
41
- fiatCurrency: string;
42
- /** Estimated gross crypto output before fees */
43
- cryptoAmount: string;
44
- /** Crypto token symbol (e.g. 'USDC', 'ETH', 'SOL') */
45
- cryptoToken: string;
46
- /** Destination blockchain (e.g. 'ethereum', 'base', 'solana') */
47
- chain: string;
48
- /** Provider fee in fiat currency */
49
- feeAmount: number;
50
- /** Provider fee as a percentage of fiatAmount */
51
- feePercent: number;
52
- /** Net crypto amount the wallet receives after fees */
53
- netCryptoAmount: string;
54
- /** Supported payment methods for this quote */
55
- paymentMethods: string[];
56
- /** Estimated minutes until crypto arrives in wallet */
57
- estimatedTimeMinutes: number;
58
- /**
59
- * KYC is ALWAYS required for fiat onramp — this is always true.
60
- * KYC is handled entirely by the provider on their hosted page.
61
- * The SDK never sees, stores, or transmits any KYC data.
62
- */
63
- kycRequired: true;
64
- /**
65
- * URL to complete the purchase.
66
- * Opening this URL takes the user to the provider's hosted KYC + payment page.
67
- * After completion, crypto is sent directly to the walletAddress.
68
- */
69
- purchaseUrl?: string;
70
- /** Provider session ID for tracking purchase status */
71
- sessionId?: string;
72
- }
73
- /**
74
- * Parameters for requesting a fiat onramp quote or session.
75
- */
76
- export interface OnrampParams {
77
- /** Fiat amount to spend (in the specified currency) */
78
- amount: number;
79
- /** Fiat currency code. Defaults to FiatOnrampConfig.defaultCurrency or 'USD' */
80
- currency?: string;
81
- /** Target crypto token (e.g. 'USDC', 'ETH', 'SOL') */
82
- token: string;
83
- /** Target blockchain (e.g. 'ethereum', 'base', 'solana') */
84
- chain: string;
85
- /** Wallet address where crypto will be delivered */
86
- walletAddress: string;
87
- /** Optional redirect URL after the provider's hosted purchase flow completes */
88
- redirectUrl?: string;
89
- }
90
- /**
91
- * Internal provider interface — implemented by each provider module.
92
- * @internal
93
- */
94
- export interface FiatProvider {
95
- /** Provider identifier */
96
- readonly name: string;
97
- /** Whether this provider is configured (has an API key) */
98
- readonly isConfigured: boolean;
99
- /** Supported chain → token mapping */
100
- readonly supportedAssets: Record<string, string[]>;
101
- /** Get a quote from this provider */
102
- getQuote(params: OnrampParams): Promise<FiatQuote>;
103
- /** Create a purchase session (may call additional APIs beyond getQuote) */
104
- createSession(params: OnrampParams): Promise<FiatQuote>;
105
- }
106
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/fiat/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,kEAAkE;IAClE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gEAAgE;IAChE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sDAAsD;IACtD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,2DAA2D;IAC3D,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACxB,4DAA4D;IAC5D,QAAQ,EAAE,MAAM,CAAC;IACjB,oCAAoC;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,YAAY,EAAE,MAAM,CAAC;IACrB,gDAAgD;IAChD,YAAY,EAAE,MAAM,CAAC;IACr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 +0,0 @@
1
- /**
2
- * FiatOnramp Types
3
- *
4
- * IMPORTANT: The fiat onramp module is entirely OPT-IN.
5
- * Users who fund their agent wallet via direct crypto transfer, bridge,
6
- * or any other method NEVER encounter KYC and remain fully anonymous.
7
- *
8
- * KYC only occurs when a user explicitly chooses to use the fiat onramp
9
- * feature. The SDK never collects or stores KYC data — all KYC is handled
10
- * entirely by the third-party provider on their hosted page.
11
- */
12
- export {};
13
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/fiat/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
@@ -1,119 +0,0 @@
1
- /**
2
- * Flash Loan Executor
3
- *
4
- * Builds signed transactions for Aave V3 flash loan execution.
5
- *
6
- * ⚠️ PRODUCTION NOTICE — REQUIRED BEFORE USE:
7
- * Flash loans use Aave's callback pattern. Aave calls `executeOperation()` on a
8
- * receiver contract mid-transaction. This SDK generates the transaction calldata,
9
- * but you MUST deploy `FlashLoanExecutor.sol` first.
10
- *
11
- * Deployment steps:
12
- * 1. Deploy `src/flash/contracts/FlashLoanExecutor.sol` with the Aave Pool address
13
- * 2. Fund it with enough gas token for operations
14
- * 3. Pass the deployed address as `executorContractAddress` in FlashLoanConfig
15
- *
16
- * Architecture (approach C — agent-signed transactions):
17
- * - Agent calls this executor's `buildArbitrageTx()` or `buildLiquidationTx()`
18
- * - Executor returns a transaction object (to, data, value, gasEstimate)
19
- * - Agent signs and broadcasts the transaction using their wallet
20
- * - The deployed FlashLoanExecutor.sol contract handles the Aave callback atomically
21
- *
22
- * No private keys are held by this SDK. All signing is performed by the agent's wallet.
23
- */
24
- import { ethers } from 'ethers';
25
- import type { FlashLoanConfig, FlashLoanProvider, ArbitrageOpportunity, LiquidationOpportunity } from './types.js';
26
- /**
27
- * Aave V3 Pool — methods needed by the executor.
28
- * Full ABI: https://github.com/aave/aave-v3-core/blob/master/contracts/interfaces/IPool.sol
29
- */
30
- declare const AAVE_POOL_ABI: readonly ["function flashLoanSimple(address receiverAddress, address asset, uint256 amount, bytes calldata params, uint16 referralCode) external", "function liquidationCall(address collateralAsset, address debtAsset, address user, uint256 debtToCover, bool receiveAToken) external"];
31
- /**
32
- * FlashLoanExecutor contract ABI (our deployed contract).
33
- * The contract implements IFlashLoanReceiver and handles the Aave callback.
34
- * See: src/flash/contracts/FlashLoanExecutor.sol
35
- */
36
- declare const FLASH_EXECUTOR_ABI: readonly ["function executeArbitrage(address asset, uint256 amount, address buyDex, address sellDex, bytes calldata buyCalldata, bytes calldata sellCalldata) external", "function executeLiquidation(address collateralAsset, address debtAsset, address user, uint256 debtAmount, address aavePool) external"];
37
- /**
38
- * Canonical Aave V3 Pool addresses by chain.
39
- * Source: https://docs.aave.com/developers/deployed-contracts/v3-mainnet
40
- */
41
- declare const AAVE_POOL_ADDRESSES: Record<string, string>;
42
- /** A built transaction ready for agent signing */
43
- export interface BuiltTransaction {
44
- /** Target contract address (Aave Pool or FlashLoanExecutor) */
45
- to: string;
46
- /** ABI-encoded calldata */
47
- data: string;
48
- /** ETH value to send (0n for token flash loans) */
49
- value: bigint;
50
- /** Estimated gas units required */
51
- gasEstimate: bigint;
52
- }
53
- /**
54
- * Builds flash loan transactions for agent signing.
55
- *
56
- * Usage:
57
- * ```typescript
58
- * const executor = new FlashLoanExecutor({ chain: 'base', rpcUrl: '...' });
59
- * const tx = executor.buildArbitrageTx(opportunity, wallet);
60
- * const receipt = await wallet.sendTransaction(tx);
61
- * ```
62
- *
63
- * ⚠️ Requires a deployed `FlashLoanExecutor.sol` contract (see config).
64
- */
65
- export declare class FlashLoanExecutor {
66
- private readonly config;
67
- constructor(config: FlashLoanConfig);
68
- /**
69
- * Build a flash loan arbitrage transaction.
70
- *
71
- * Flow:
72
- * 1. Encodes arbitrage params (buy/sell DEX calldata) into bytes
73
- * 2. Wraps in `flashLoanSimple()` call to Aave Pool
74
- * 3. Aave calls back `FlashLoanExecutor.executeOperation()` on our contract
75
- * 4. Contract buys on DEX A, sells on DEX B, repays loan + fee
76
- *
77
- * @param opportunity - Arbitrage opportunity from the scanner
78
- * @param wallet - Agent's ethers.Wallet (used only for address; does not sign here)
79
- * @returns Transaction object ready for wallet.sendTransaction()
80
- */
81
- buildArbitrageTx(opportunity: ArbitrageOpportunity, wallet: ethers.Wallet): BuiltTransaction;
82
- /**
83
- * Build a flash loan liquidation transaction.
84
- *
85
- * Flow:
86
- * 1. Flash-borrows the borrower's debt token from Aave
87
- * 2. Calls `liquidationCall()` on Aave with the borrowed funds
88
- * 3. Receives discounted collateral (5–10% bonus)
89
- * 4. Swaps collateral back to debt token to repay flash loan
90
- * 5. Profit = collateral bonus - flash loan fee - gas
91
- *
92
- * @param opportunity - Liquidation opportunity from the scanner
93
- * @param wallet - Agent's ethers.Wallet
94
- * @returns Transaction object ready for wallet.sendTransaction()
95
- */
96
- buildLiquidationTx(opportunity: LiquidationOpportunity, wallet: ethers.Wallet): BuiltTransaction;
97
- /**
98
- * Get the canonical Aave V3 Pool address for a chain.
99
- *
100
- * @param chain - Chain name (case-insensitive)
101
- * @returns Pool address, or empty string if chain is not supported
102
- */
103
- getAavePoolAddress(chain: string): string;
104
- /**
105
- * Estimate the flash loan fee for a given borrow amount.
106
- *
107
- * Fee schedule:
108
- * - Aave V3: 0.09% (9 bps) — configurable by Aave governance
109
- * - Balancer: 0.00% (0 bps) — free flash loans (gas only)
110
- * - Uniswap V3: 0.30% (30 bps) — same as the pool's swap fee tier
111
- *
112
- * @param amount - Borrow amount in token's native decimals
113
- * @param provider - Flash loan provider (default: 'aave-v3')
114
- * @returns Fee amount in the same units as `amount`
115
- */
116
- estimateFee(amount: bigint, provider?: FlashLoanProvider): bigint;
117
- }
118
- export { AAVE_POOL_ABI, FLASH_EXECUTOR_ABI, AAVE_POOL_ADDRESSES };
119
- //# sourceMappingURL=executor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../src/flash/executor.ts"],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/**
2
- * Flash Loan Executor
3
- *
4
- * Builds signed transactions for Aave V3 flash loan execution.
5
- *
6
- * ⚠️ PRODUCTION NOTICE — REQUIRED BEFORE USE:
7
- * Flash loans use Aave's callback pattern. Aave calls `executeOperation()` on a
8
- * receiver contract mid-transaction. This SDK generates the transaction calldata,
9
- * but you MUST deploy `FlashLoanExecutor.sol` first.
10
- *
11
- * Deployment steps:
12
- * 1. Deploy `src/flash/contracts/FlashLoanExecutor.sol` with the Aave Pool address
13
- * 2. Fund it with enough gas token for operations
14
- * 3. Pass the deployed address as `executorContractAddress` in FlashLoanConfig
15
- *
16
- * Architecture (approach C — agent-signed transactions):
17
- * - Agent calls this executor's `buildArbitrageTx()` or `buildLiquidationTx()`
18
- * - Executor returns a transaction object (to, data, value, gasEstimate)
19
- * - Agent signs and broadcasts the transaction using their wallet
20
- * - The deployed FlashLoanExecutor.sol contract handles the Aave callback atomically
21
- *
22
- * No private keys are held by this SDK. All signing is performed by the agent's wallet.
23
- */
24
- import { ethers } from 'ethers';
25
- // ─── ABIs ─────────────────────────────────────────────────────────────────────
26
- /**
27
- * Aave V3 Pool — methods needed by the executor.
28
- * Full ABI: https://github.com/aave/aave-v3-core/blob/master/contracts/interfaces/IPool.sol
29
- */
30
- const AAVE_POOL_ABI = [
31
- 'function flashLoanSimple(address receiverAddress, address asset, uint256 amount, bytes calldata params, uint16 referralCode) external',
32
- 'function liquidationCall(address collateralAsset, address debtAsset, address user, uint256 debtToCover, bool receiveAToken) external',
33
- ];
34
- /**
35
- * FlashLoanExecutor contract ABI (our deployed contract).
36
- * The contract implements IFlashLoanReceiver and handles the Aave callback.
37
- * See: src/flash/contracts/FlashLoanExecutor.sol
38
- */
39
- const FLASH_EXECUTOR_ABI = [
40
- 'function executeArbitrage(address asset, uint256 amount, address buyDex, address sellDex, bytes calldata buyCalldata, bytes calldata sellCalldata) external',
41
- 'function executeLiquidation(address collateralAsset, address debtAsset, address user, uint256 debtAmount, address aavePool) external',
42
- ];
43
- // ─── Canonical Aave V3 Pool Addresses ─────────────────────────────────────────
44
- /**
45
- * Canonical Aave V3 Pool addresses by chain.
46
- * Source: https://docs.aave.com/developers/deployed-contracts/v3-mainnet
47
- */
48
- const AAVE_POOL_ADDRESSES = {
49
- ethereum: '0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2',
50
- base: '0xA238Dd80C259a72e81d7e4664a9801593F98d1c5',
51
- arbitrum: '0x794a61358D6845594F94dc1DB02A252b5b4814aD',
52
- optimism: '0x794a61358D6845594F94dc1DB02A252b5b4814aD',
53
- };
54
- /** Default gas limit for flash loan arbitrage transactions */
55
- const DEFAULT_ARB_GAS_ESTIMATE = 500000n;
56
- /** Default gas limit for flash loan liquidation transactions */
57
- const DEFAULT_LIQ_GAS_ESTIMATE = 400000n;
58
- /** Aave V3 referral code (0 = no referral) */
59
- const AAVE_REFERRAL_CODE = 0;
60
- // ─── FlashLoanExecutor Class ──────────────────────────────────────────────────
61
- /**
62
- * Builds flash loan transactions for agent signing.
63
- *
64
- * Usage:
65
- * ```typescript
66
- * const executor = new FlashLoanExecutor({ chain: 'base', rpcUrl: '...' });
67
- * const tx = executor.buildArbitrageTx(opportunity, wallet);
68
- * const receipt = await wallet.sendTransaction(tx);
69
- * ```
70
- *
71
- * ⚠️ Requires a deployed `FlashLoanExecutor.sol` contract (see config).
72
- */
73
- export class FlashLoanExecutor {
74
- constructor(config) {
75
- this.config = config;
76
- }
77
- /**
78
- * Build a flash loan arbitrage transaction.
79
- *
80
- * Flow:
81
- * 1. Encodes arbitrage params (buy/sell DEX calldata) into bytes
82
- * 2. Wraps in `flashLoanSimple()` call to Aave Pool
83
- * 3. Aave calls back `FlashLoanExecutor.executeOperation()` on our contract
84
- * 4. Contract buys on DEX A, sells on DEX B, repays loan + fee
85
- *
86
- * @param opportunity - Arbitrage opportunity from the scanner
87
- * @param wallet - Agent's ethers.Wallet (used only for address; does not sign here)
88
- * @returns Transaction object ready for wallet.sendTransaction()
89
- */
90
- buildArbitrageTx(opportunity, wallet) {
91
- const aavePoolAddress = this.getAavePoolAddress(this.config.chain);
92
- if (!aavePoolAddress) {
93
- throw new Error(`No Aave V3 Pool address for chain: ${this.config.chain}`);
94
- }
95
- const pool = new ethers.Interface(AAVE_POOL_ABI);
96
- // Encode the arbitrage strategy params that will be passed through Aave's callback.
97
- // The FlashLoanExecutor.sol contract decodes these in executeOperation().
98
- const innerParams = ethers.AbiCoder.defaultAbiCoder().encode(['address', 'address', 'bytes', 'bytes'], [
99
- opportunity.buyDex, // DEX router to buy from
100
- opportunity.sellDex, // DEX router to sell to
101
- '0x', // buy calldata (filled by router in production)
102
- '0x', // sell calldata (filled by router in production)
103
- ]);
104
- const data = pool.encodeFunctionData('flashLoanSimple', [
105
- this.config.aavePoolAddress ?? wallet.address, // receiverAddress (FlashLoanExecutor.sol)
106
- opportunity.tokenAddress, // asset to borrow
107
- opportunity.amount, // amount
108
- innerParams, // params passed to executeOperation
109
- AAVE_REFERRAL_CODE,
110
- ]);
111
- return {
112
- to: aavePoolAddress,
113
- data,
114
- value: 0n, // Token flash loans never require ETH value
115
- gasEstimate: DEFAULT_ARB_GAS_ESTIMATE,
116
- };
117
- }
118
- /**
119
- * Build a flash loan liquidation transaction.
120
- *
121
- * Flow:
122
- * 1. Flash-borrows the borrower's debt token from Aave
123
- * 2. Calls `liquidationCall()` on Aave with the borrowed funds
124
- * 3. Receives discounted collateral (5–10% bonus)
125
- * 4. Swaps collateral back to debt token to repay flash loan
126
- * 5. Profit = collateral bonus - flash loan fee - gas
127
- *
128
- * @param opportunity - Liquidation opportunity from the scanner
129
- * @param wallet - Agent's ethers.Wallet
130
- * @returns Transaction object ready for wallet.sendTransaction()
131
- */
132
- buildLiquidationTx(opportunity, wallet) {
133
- const aavePoolAddress = this.getAavePoolAddress(this.config.chain);
134
- if (!aavePoolAddress) {
135
- throw new Error(`No Aave V3 Pool address for chain: ${this.config.chain}`);
136
- }
137
- const pool = new ethers.Interface(AAVE_POOL_ABI);
138
- // Encode liquidation params for the callback
139
- const innerParams = ethers.AbiCoder.defaultAbiCoder().encode(['address', 'address', 'address', 'address'], [
140
- opportunity.collateralAddress, // collateral to seize
141
- opportunity.debtAddress, // debt token to repay
142
- opportunity.borrower, // target borrower
143
- aavePoolAddress, // Aave Pool for repayment
144
- ]);
145
- const data = pool.encodeFunctionData('flashLoanSimple', [
146
- this.config.aavePoolAddress ?? wallet.address, // receiverAddress (FlashLoanExecutor.sol)
147
- opportunity.debtAddress, // asset = debt token
148
- opportunity.debtAmount, // amount = debt to repay
149
- innerParams,
150
- AAVE_REFERRAL_CODE,
151
- ]);
152
- return {
153
- to: aavePoolAddress,
154
- data,
155
- value: 0n,
156
- gasEstimate: DEFAULT_LIQ_GAS_ESTIMATE,
157
- };
158
- }
159
- /**
160
- * Get the canonical Aave V3 Pool address for a chain.
161
- *
162
- * @param chain - Chain name (case-insensitive)
163
- * @returns Pool address, or empty string if chain is not supported
164
- */
165
- getAavePoolAddress(chain) {
166
- return AAVE_POOL_ADDRESSES[chain.toLowerCase()] ?? '';
167
- }
168
- /**
169
- * Estimate the flash loan fee for a given borrow amount.
170
- *
171
- * Fee schedule:
172
- * - Aave V3: 0.09% (9 bps) — configurable by Aave governance
173
- * - Balancer: 0.00% (0 bps) — free flash loans (gas only)
174
- * - Uniswap V3: 0.30% (30 bps) — same as the pool's swap fee tier
175
- *
176
- * @param amount - Borrow amount in token's native decimals
177
- * @param provider - Flash loan provider (default: 'aave-v3')
178
- * @returns Fee amount in the same units as `amount`
179
- */
180
- estimateFee(amount, provider = 'aave-v3') {
181
- switch (provider) {
182
- case 'aave-v3':
183
- return (amount * 9n) / 10000n; // 0.09%
184
- case 'balancer':
185
- return 0n; // Balancer V2: 0% fee
186
- case 'uniswap-v3':
187
- return (amount * 30n) / 10000n; // 0.30% (same as default pool fee)
188
- default:
189
- return (amount * 9n) / 10000n;
190
- }
191
- }
192
- }
193
- // Re-export ABIs for users who want to interact with contracts directly
194
- export { AAVE_POOL_ABI, FLASH_EXECUTOR_ABI, AAVE_POOL_ADDRESSES };
195
- //# sourceMappingURL=executor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../src/flash/executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,iFAAiF;AAEjF;;;GAGG;AACH,MAAM,aAAa,GAAG;IACpB,uIAAuI;IACvI,sIAAsI;CAC9H,CAAC;AAEX;;;;GAIG;AACH,MAAM,kBAAkB,GAAG;IACzB,6JAA6J;IAC7J,sIAAsI;CAC9H,CAAC;AAEX,iFAAiF;AAEjF;;;GAGG;AACH,MAAM,mBAAmB,GAA2B;IAClD,QAAQ,EAAE,4CAA4C;IACtD,IAAI,EAAM,4CAA4C;IACtD,QAAQ,EAAE,4CAA4C;IACtD,QAAQ,EAAE,4CAA4C;CACvD,CAAC;AAEF,8DAA8D;AAC9D,MAAM,wBAAwB,GAAG,OAAQ,CAAC;AAE1C,gEAAgE;AAChE,MAAM,wBAAwB,GAAG,OAAQ,CAAC;AAE1C,8CAA8C;AAC9C,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAgB7B,iFAAiF;AAEjF;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,iBAAiB;IAG5B,YAAY,MAAuB;QACjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,gBAAgB,CACd,WAAiC,EACjC,MAAqB;QAErB,MAAM,eAAe,GAAG,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACnE,IAAI,CAAC,eAAe,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,sCAAsC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;QAC7E,CAAC;QAED,MAAM,IAAI,GAAG,IAAI,MAAM,CAAC,SAA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EAAE,CAAC"}
@@ -1,28 +0,0 @@
1
- /**
2
- * Flash Loan Module — Public API
3
- *
4
- * Exports the scanner (opportunity detection) and executor (transaction building)
5
- * for Aave V3 flash loans.
6
- *
7
- * ⚠️ PRODUCTION NOTICE:
8
- * Executing flash loans requires a deployed `FlashLoanExecutor.sol` contract.
9
- * See `src/flash/contracts/FlashLoanExecutor.sol` for the Solidity scaffold.
10
- *
11
- * Quick start:
12
- * ```typescript
13
- * import { FlashOpportunityScanner, FlashLoanExecutor } from '@agentwallet/sdk/flash';
14
- *
15
- * const scanner = new FlashOpportunityScanner();
16
- * const opportunities = await scanner.scanArbitrage({ tokens: ['WETH'], chain: 'base' });
17
- *
18
- * const executor = new FlashLoanExecutor({ chain: 'base', rpcUrl: '...' });
19
- * const tx = executor.buildArbitrageTx(opportunities[0], wallet);
20
- * await wallet.sendTransaction(tx);
21
- * ```
22
- */
23
- export { FlashOpportunityScanner } from './scanner.js';
24
- export type { ScanArbitrageParams, ScanLiquidationsParams } from './scanner.js';
25
- export { FlashLoanExecutor, AAVE_POOL_ABI, FLASH_EXECUTOR_ABI, AAVE_POOL_ADDRESSES } from './executor.js';
26
- export type { BuiltTransaction } from './executor.js';
27
- export type { FlashLoanConfig, FlashLoanResult, FlashOpportunity, ArbitrageOpportunity, LiquidationOpportunity, FlashScanResult, FlashOpportunityType, FlashLoanProvider, } from './types.js';
28
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/flash/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,YAAY,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAEhF,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAC1G,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD,YAAY,EACV,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,YAAY,CAAC"}
@@ -1,25 +0,0 @@
1
- /**
2
- * Flash Loan Module — Public API
3
- *
4
- * Exports the scanner (opportunity detection) and executor (transaction building)
5
- * for Aave V3 flash loans.
6
- *
7
- * ⚠️ PRODUCTION NOTICE:
8
- * Executing flash loans requires a deployed `FlashLoanExecutor.sol` contract.
9
- * See `src/flash/contracts/FlashLoanExecutor.sol` for the Solidity scaffold.
10
- *
11
- * Quick start:
12
- * ```typescript
13
- * import { FlashOpportunityScanner, FlashLoanExecutor } from '@agentwallet/sdk/flash';
14
- *
15
- * const scanner = new FlashOpportunityScanner();
16
- * const opportunities = await scanner.scanArbitrage({ tokens: ['WETH'], chain: 'base' });
17
- *
18
- * const executor = new FlashLoanExecutor({ chain: 'base', rpcUrl: '...' });
19
- * const tx = executor.buildArbitrageTx(opportunities[0], wallet);
20
- * await wallet.sendTransaction(tx);
21
- * ```
22
- */
23
- export { FlashOpportunityScanner } from './scanner.js';
24
- export { FlashLoanExecutor, AAVE_POOL_ABI, FLASH_EXECUTOR_ABI, AAVE_POOL_ADDRESSES } from './executor.js';
25
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/flash/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAGvD,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC"}