agentwallet-sdk 5.0.0 → 5.0.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 (371) hide show
  1. package/README.md +221 -0
  2. package/dist/abi.d.ts +397 -0
  3. package/dist/abi.d.ts.map +1 -0
  4. package/dist/abi.js +255 -0
  5. package/dist/abi.js.map +1 -0
  6. package/dist/ap2/index.d.ts +185 -0
  7. package/dist/ap2/index.d.ts.map +1 -0
  8. package/dist/ap2/index.js +255 -0
  9. package/dist/ap2/index.js.map +1 -0
  10. package/dist/bridge/abis.d.ts +64 -0
  11. package/dist/bridge/abis.d.ts.map +1 -0
  12. package/dist/bridge/abis.js +129 -0
  13. package/dist/bridge/abis.js.map +1 -0
  14. package/dist/bridge/client.d.ts +35 -0
  15. package/dist/bridge/client.d.ts.map +1 -0
  16. package/dist/bridge/client.js +245 -0
  17. package/dist/bridge/client.js.map +1 -0
  18. package/dist/bridge/index.d.ts +4 -0
  19. package/dist/bridge/index.d.ts.map +1 -0
  20. package/dist/bridge/index.js +3 -0
  21. package/dist/bridge/index.js.map +1 -0
  22. package/dist/bridge/types.d.ts +68 -0
  23. package/dist/bridge/types.d.ts.map +1 -0
  24. package/dist/bridge/types.js +93 -0
  25. package/dist/bridge/types.js.map +1 -0
  26. package/dist/bridge/unified.d.ts +101 -0
  27. package/dist/bridge/unified.d.ts.map +1 -0
  28. package/dist/bridge/unified.js +284 -0
  29. package/dist/bridge/unified.js.map +1 -0
  30. package/dist/chains.d.ts +62 -0
  31. package/dist/chains.d.ts.map +1 -0
  32. package/dist/chains.js +108 -0
  33. package/dist/chains.js.map +1 -0
  34. package/dist/escrow/MutualStakeEscrow.d.ts +75 -0
  35. package/dist/escrow/MutualStakeEscrow.d.ts.map +1 -0
  36. package/dist/escrow/MutualStakeEscrow.js +339 -0
  37. package/dist/escrow/MutualStakeEscrow.js.map +1 -0
  38. package/dist/escrow/types.d.ts +59 -0
  39. package/dist/escrow/types.d.ts.map +1 -0
  40. package/dist/escrow/types.js +11 -0
  41. package/dist/escrow/types.js.map +1 -0
  42. package/dist/escrow/verifiers.d.ts +26 -0
  43. package/dist/escrow/verifiers.d.ts.map +1 -0
  44. package/dist/escrow/verifiers.js +53 -0
  45. package/dist/escrow/verifiers.js.map +1 -0
  46. package/dist/fiat/index.d.ts +10 -0
  47. package/dist/fiat/index.d.ts.map +1 -0
  48. package/dist/fiat/index.js +9 -0
  49. package/dist/fiat/index.js.map +1 -0
  50. package/dist/fiat/onramp.d.ts +101 -0
  51. package/dist/fiat/onramp.d.ts.map +1 -0
  52. package/dist/fiat/onramp.js +155 -0
  53. package/dist/fiat/onramp.js.map +1 -0
  54. package/dist/fiat/providers/index.d.ts +16 -0
  55. package/dist/fiat/providers/index.d.ts.map +1 -0
  56. package/dist/fiat/providers/index.js +30 -0
  57. package/dist/fiat/providers/index.js.map +1 -0
  58. package/dist/fiat/providers/moonpay.d.ts +22 -0
  59. package/dist/fiat/providers/moonpay.d.ts.map +1 -0
  60. package/dist/fiat/providers/moonpay.js +107 -0
  61. package/dist/fiat/providers/moonpay.js.map +1 -0
  62. package/dist/fiat/providers/stripe.d.ts +26 -0
  63. package/dist/fiat/providers/stripe.d.ts.map +1 -0
  64. package/dist/fiat/providers/stripe.js +135 -0
  65. package/dist/fiat/providers/stripe.js.map +1 -0
  66. package/dist/fiat/providers/transak.d.ts +26 -0
  67. package/dist/fiat/providers/transak.d.ts.map +1 -0
  68. package/dist/fiat/providers/transak.js +119 -0
  69. package/dist/fiat/providers/transak.js.map +1 -0
  70. package/dist/fiat/types.d.ts +106 -0
  71. package/dist/fiat/types.d.ts.map +1 -0
  72. package/dist/fiat/types.js +13 -0
  73. package/dist/fiat/types.js.map +1 -0
  74. package/dist/flash/executor.d.ts +119 -0
  75. package/dist/flash/executor.d.ts.map +1 -0
  76. package/dist/flash/executor.js +195 -0
  77. package/dist/flash/executor.js.map +1 -0
  78. package/dist/flash/index.d.ts +28 -0
  79. package/dist/flash/index.d.ts.map +1 -0
  80. package/dist/flash/index.js +29 -0
  81. package/dist/flash/index.js.map +1 -0
  82. package/dist/flash/scanner.d.ts +133 -0
  83. package/dist/flash/scanner.d.ts.map +1 -0
  84. package/dist/flash/scanner.js +212 -0
  85. package/dist/flash/scanner.js.map +1 -0
  86. package/dist/flash/types.d.ts +136 -0
  87. package/dist/flash/types.d.ts.map +1 -0
  88. package/dist/flash/types.js +23 -0
  89. package/dist/flash/types.js.map +1 -0
  90. package/dist/gas/index.d.ts +4 -0
  91. package/dist/gas/index.d.ts.map +1 -0
  92. package/dist/gas/index.js +3 -0
  93. package/dist/gas/index.js.map +1 -0
  94. package/dist/gas/sponsor.d.ts +70 -0
  95. package/dist/gas/sponsor.d.ts.map +1 -0
  96. package/dist/gas/sponsor.js +193 -0
  97. package/dist/gas/sponsor.js.map +1 -0
  98. package/dist/gas/types.d.ts +76 -0
  99. package/dist/gas/types.d.ts.map +1 -0
  100. package/dist/gas/types.js +21 -0
  101. package/dist/gas/types.js.map +1 -0
  102. package/dist/identity/agent-identity.d.ts +276 -0
  103. package/dist/identity/agent-identity.d.ts.map +1 -0
  104. package/dist/identity/agent-identity.js +300 -0
  105. package/dist/identity/agent-identity.js.map +1 -0
  106. package/dist/identity/erc6551.d.ts +441 -0
  107. package/dist/identity/erc6551.d.ts.map +1 -0
  108. package/dist/identity/erc6551.js +517 -0
  109. package/dist/identity/erc6551.js.map +1 -0
  110. package/dist/identity/erc8004.d.ts +305 -0
  111. package/dist/identity/erc8004.d.ts.map +1 -0
  112. package/dist/identity/erc8004.js +413 -0
  113. package/dist/identity/erc8004.js.map +1 -0
  114. package/dist/identity/index.d.ts +7 -0
  115. package/dist/identity/index.d.ts.map +1 -0
  116. package/dist/identity/index.js +4 -0
  117. package/dist/identity/index.js.map +1 -0
  118. package/dist/identity/reputation.d.ts +318 -0
  119. package/dist/identity/reputation.d.ts.map +1 -0
  120. package/dist/identity/reputation.js +272 -0
  121. package/dist/identity/reputation.js.map +1 -0
  122. package/dist/identity/validation.d.ts +284 -0
  123. package/dist/identity/validation.d.ts.map +1 -0
  124. package/dist/identity/validation.js +226 -0
  125. package/dist/identity/validation.js.map +1 -0
  126. package/dist/index.d.ts +38803 -0
  127. package/dist/index.d.ts.map +1 -0
  128. package/dist/index.js +376 -0
  129. package/dist/index.js.map +1 -0
  130. package/dist/mev/index.d.ts +4 -0
  131. package/dist/mev/index.d.ts.map +1 -0
  132. package/dist/mev/index.js +8 -0
  133. package/dist/mev/index.js.map +1 -0
  134. package/dist/mev/protection.d.ts +54 -0
  135. package/dist/mev/protection.d.ts.map +1 -0
  136. package/dist/mev/protection.js +185 -0
  137. package/dist/mev/protection.js.map +1 -0
  138. package/dist/mev/risk.d.ts +19 -0
  139. package/dist/mev/risk.d.ts.map +1 -0
  140. package/dist/mev/risk.js +95 -0
  141. package/dist/mev/risk.js.map +1 -0
  142. package/dist/mev/types.d.ts +49 -0
  143. package/dist/mev/types.d.ts.map +1 -0
  144. package/dist/mev/types.js +2 -0
  145. package/dist/mev/types.js.map +1 -0
  146. package/dist/plugins/elizaos.d.ts +52 -0
  147. package/dist/plugins/elizaos.d.ts.map +1 -0
  148. package/dist/plugins/elizaos.js +89 -0
  149. package/dist/plugins/elizaos.js.map +1 -0
  150. package/dist/policy/SpendingPolicy.d.ts +106 -0
  151. package/dist/policy/SpendingPolicy.d.ts.map +1 -0
  152. package/dist/policy/SpendingPolicy.js +155 -0
  153. package/dist/policy/SpendingPolicy.js.map +1 -0
  154. package/dist/policy/SpendingPolicy.test.d.ts +2 -0
  155. package/dist/policy/SpendingPolicy.test.d.ts.map +1 -0
  156. package/dist/policy/SpendingPolicy.test.js +143 -0
  157. package/dist/policy/SpendingPolicy.test.js.map +1 -0
  158. package/dist/settlement/index.d.ts +4 -0
  159. package/dist/settlement/index.d.ts.map +1 -0
  160. package/dist/settlement/index.js +3 -0
  161. package/dist/settlement/index.js.map +1 -0
  162. package/dist/settlement/types.d.ts +66 -0
  163. package/dist/settlement/types.d.ts.map +1 -0
  164. package/dist/settlement/types.js +37 -0
  165. package/dist/settlement/types.js.map +1 -0
  166. package/dist/settlement/verifier.d.ts +75 -0
  167. package/dist/settlement/verifier.d.ts.map +1 -0
  168. package/dist/settlement/verifier.js +354 -0
  169. package/dist/settlement/verifier.js.map +1 -0
  170. package/dist/solana/bridge.d.ts +144 -0
  171. package/dist/solana/bridge.d.ts.map +1 -0
  172. package/dist/solana/bridge.js +352 -0
  173. package/dist/solana/bridge.js.map +1 -0
  174. package/dist/solana/index.d.ts +8 -0
  175. package/dist/solana/index.d.ts.map +1 -0
  176. package/dist/solana/index.js +6 -0
  177. package/dist/solana/index.js.map +1 -0
  178. package/dist/solana/swap.d.ts +85 -0
  179. package/dist/solana/swap.d.ts.map +1 -0
  180. package/dist/solana/swap.js +173 -0
  181. package/dist/solana/swap.js.map +1 -0
  182. package/dist/solana/types.d.ts +126 -0
  183. package/dist/solana/types.d.ts.map +1 -0
  184. package/dist/solana/types.js +10 -0
  185. package/dist/solana/types.js.map +1 -0
  186. package/dist/solana/wallet.d.ts +83 -0
  187. package/dist/solana/wallet.d.ts.map +1 -0
  188. package/dist/solana/wallet.js +164 -0
  189. package/dist/solana/wallet.js.map +1 -0
  190. package/dist/solana/x402.d.ts +69 -0
  191. package/dist/solana/x402.d.ts.map +1 -0
  192. package/dist/solana/x402.js +154 -0
  193. package/dist/solana/x402.js.map +1 -0
  194. package/dist/solver/adapter.d.ts +47 -0
  195. package/dist/solver/adapter.d.ts.map +1 -0
  196. package/dist/solver/adapter.js +146 -0
  197. package/dist/solver/adapter.js.map +1 -0
  198. package/dist/solver/analyzer.d.ts +48 -0
  199. package/dist/solver/analyzer.d.ts.map +1 -0
  200. package/dist/solver/analyzer.js +171 -0
  201. package/dist/solver/analyzer.js.map +1 -0
  202. package/dist/solver/builder.d.ts +31 -0
  203. package/dist/solver/builder.d.ts.map +1 -0
  204. package/dist/solver/builder.js +60 -0
  205. package/dist/solver/builder.js.map +1 -0
  206. package/dist/solver/index.d.ts +22 -0
  207. package/dist/solver/index.d.ts.map +1 -0
  208. package/dist/solver/index.js +25 -0
  209. package/dist/solver/index.js.map +1 -0
  210. package/dist/solver/types.d.ts +115 -0
  211. package/dist/solver/types.d.ts.map +1 -0
  212. package/dist/solver/types.js +10 -0
  213. package/dist/solver/types.js.map +1 -0
  214. package/dist/spend-guard/index.d.ts +125 -0
  215. package/dist/spend-guard/index.d.ts.map +1 -0
  216. package/dist/spend-guard/index.js +150 -0
  217. package/dist/spend-guard/index.js.map +1 -0
  218. package/dist/swap/SwapModule.d.ts +34 -0
  219. package/dist/swap/SwapModule.d.ts.map +1 -0
  220. package/dist/swap/SwapModule.js +144 -0
  221. package/dist/swap/SwapModule.js.map +1 -0
  222. package/dist/swap/abi.d.ts +51 -0
  223. package/dist/swap/abi.d.ts.map +1 -0
  224. package/dist/swap/abi.js +118 -0
  225. package/dist/swap/abi.js.map +1 -0
  226. package/dist/swap/index.d.ts +5 -0
  227. package/dist/swap/index.d.ts.map +1 -0
  228. package/dist/swap/index.js +4 -0
  229. package/dist/swap/index.js.map +1 -0
  230. package/dist/swap/router/cache.d.ts +13 -0
  231. package/dist/swap/router/cache.d.ts.map +1 -0
  232. package/dist/swap/router/cache.js +30 -0
  233. package/dist/swap/router/cache.js.map +1 -0
  234. package/dist/swap/router/flashbots.d.ts +10 -0
  235. package/dist/swap/router/flashbots.d.ts.map +1 -0
  236. package/dist/swap/router/flashbots.js +43 -0
  237. package/dist/swap/router/flashbots.js.map +1 -0
  238. package/dist/swap/router/health.d.ts +17 -0
  239. package/dist/swap/router/health.d.ts.map +1 -0
  240. package/dist/swap/router/health.js +38 -0
  241. package/dist/swap/router/health.js.map +1 -0
  242. package/dist/swap/router/index.d.ts +10 -0
  243. package/dist/swap/router/index.d.ts.map +1 -0
  244. package/dist/swap/router/index.js +10 -0
  245. package/dist/swap/router/index.js.map +1 -0
  246. package/dist/swap/router/providers/cowswap.d.ts +11 -0
  247. package/dist/swap/router/providers/cowswap.d.ts.map +1 -0
  248. package/dist/swap/router/providers/cowswap.js +79 -0
  249. package/dist/swap/router/providers/cowswap.js.map +1 -0
  250. package/dist/swap/router/providers/index.d.ts +20 -0
  251. package/dist/swap/router/providers/index.d.ts.map +1 -0
  252. package/dist/swap/router/providers/index.js +32 -0
  253. package/dist/swap/router/providers/index.js.map +1 -0
  254. package/dist/swap/router/providers/jupiter.d.ts +12 -0
  255. package/dist/swap/router/providers/jupiter.d.ts.map +1 -0
  256. package/dist/swap/router/providers/jupiter.js +73 -0
  257. package/dist/swap/router/providers/jupiter.js.map +1 -0
  258. package/dist/swap/router/providers/lifi.d.ts +11 -0
  259. package/dist/swap/router/providers/lifi.d.ts.map +1 -0
  260. package/dist/swap/router/providers/lifi.js +123 -0
  261. package/dist/swap/router/providers/lifi.js.map +1 -0
  262. package/dist/swap/router/providers/oneinch.d.ts +13 -0
  263. package/dist/swap/router/providers/oneinch.d.ts.map +1 -0
  264. package/dist/swap/router/providers/oneinch.js +71 -0
  265. package/dist/swap/router/providers/oneinch.js.map +1 -0
  266. package/dist/swap/router/providers/paraswap.d.ts +11 -0
  267. package/dist/swap/router/providers/paraswap.d.ts.map +1 -0
  268. package/dist/swap/router/providers/paraswap.js +73 -0
  269. package/dist/swap/router/providers/paraswap.js.map +1 -0
  270. package/dist/swap/router/providers/uniswap.d.ts +31 -0
  271. package/dist/swap/router/providers/uniswap.d.ts.map +1 -0
  272. package/dist/swap/router/providers/uniswap.js +237 -0
  273. package/dist/swap/router/providers/uniswap.js.map +1 -0
  274. package/dist/swap/router/providers/zerox.d.ts +13 -0
  275. package/dist/swap/router/providers/zerox.d.ts.map +1 -0
  276. package/dist/swap/router/providers/zerox.js +94 -0
  277. package/dist/swap/router/providers/zerox.js.map +1 -0
  278. package/dist/swap/router/router.d.ts +86 -0
  279. package/dist/swap/router/router.d.ts.map +1 -0
  280. package/dist/swap/router/router.js +224 -0
  281. package/dist/swap/router/router.js.map +1 -0
  282. package/dist/swap/router/rsi/engine.d.ts +60 -0
  283. package/dist/swap/router/rsi/engine.d.ts.map +1 -0
  284. package/dist/swap/router/rsi/engine.js +483 -0
  285. package/dist/swap/router/rsi/engine.js.map +1 -0
  286. package/dist/swap/router/rsi/index.d.ts +3 -0
  287. package/dist/swap/router/rsi/index.d.ts.map +1 -0
  288. package/dist/swap/router/rsi/index.js +3 -0
  289. package/dist/swap/router/rsi/index.js.map +1 -0
  290. package/dist/swap/router/rsi/types.d.ts +106 -0
  291. package/dist/swap/router/rsi/types.d.ts.map +1 -0
  292. package/dist/swap/router/rsi/types.js +3 -0
  293. package/dist/swap/router/rsi/types.js.map +1 -0
  294. package/dist/swap/router/types.d.ts +120 -0
  295. package/dist/swap/router/types.d.ts.map +1 -0
  296. package/dist/swap/router/types.js +16 -0
  297. package/dist/swap/router/types.js.map +1 -0
  298. package/dist/swap/types.d.ts +51 -0
  299. package/dist/swap/types.d.ts.map +1 -0
  300. package/dist/swap/types.js +17 -0
  301. package/dist/swap/types.js.map +1 -0
  302. package/dist/tax/engine.d.ts +131 -0
  303. package/dist/tax/engine.d.ts.map +1 -0
  304. package/dist/tax/engine.js +307 -0
  305. package/dist/tax/engine.js.map +1 -0
  306. package/dist/tax/index.d.ts +9 -0
  307. package/dist/tax/index.d.ts.map +1 -0
  308. package/dist/tax/index.js +12 -0
  309. package/dist/tax/index.js.map +1 -0
  310. package/dist/tax/lots.d.ts +60 -0
  311. package/dist/tax/lots.d.ts.map +1 -0
  312. package/dist/tax/lots.js +129 -0
  313. package/dist/tax/lots.js.map +1 -0
  314. package/dist/tax/types.d.ts +113 -0
  315. package/dist/tax/types.d.ts.map +1 -0
  316. package/dist/tax/types.js +18 -0
  317. package/dist/tax/types.js.map +1 -0
  318. package/dist/types.d.ts +110 -0
  319. package/dist/types.d.ts.map +1 -0
  320. package/dist/types.js +9 -0
  321. package/dist/types.js.map +1 -0
  322. package/dist/x402/__tests__/budget.test.d.ts +2 -0
  323. package/dist/x402/__tests__/budget.test.d.ts.map +1 -0
  324. package/dist/x402/__tests__/budget.test.js +114 -0
  325. package/dist/x402/__tests__/budget.test.js.map +1 -0
  326. package/dist/x402/__tests__/client.test.d.ts +2 -0
  327. package/dist/x402/__tests__/client.test.d.ts.map +1 -0
  328. package/dist/x402/__tests__/client.test.js +107 -0
  329. package/dist/x402/__tests__/client.test.js.map +1 -0
  330. package/dist/x402/budget.d.ts +52 -0
  331. package/dist/x402/budget.d.ts.map +1 -0
  332. package/dist/x402/budget.js +113 -0
  333. package/dist/x402/budget.js.map +1 -0
  334. package/dist/x402/chains/abstract/index.d.ts +135 -0
  335. package/dist/x402/chains/abstract/index.d.ts.map +1 -0
  336. package/dist/x402/chains/abstract/index.js +190 -0
  337. package/dist/x402/chains/abstract/index.js.map +1 -0
  338. package/dist/x402/client.d.ts +60 -0
  339. package/dist/x402/client.d.ts.map +1 -0
  340. package/dist/x402/client.js +205 -0
  341. package/dist/x402/client.js.map +1 -0
  342. package/dist/x402/index.d.ts +8 -0
  343. package/dist/x402/index.d.ts.map +1 -0
  344. package/dist/x402/index.js +8 -0
  345. package/dist/x402/index.js.map +1 -0
  346. package/dist/x402/middleware.d.ts +37 -0
  347. package/dist/x402/middleware.d.ts.map +1 -0
  348. package/dist/x402/middleware.js +65 -0
  349. package/dist/x402/middleware.js.map +1 -0
  350. package/dist/x402/types.d.ts +91 -0
  351. package/dist/x402/types.d.ts.map +1 -0
  352. package/dist/x402/types.js +9 -0
  353. package/dist/x402/types.js.map +1 -0
  354. package/dist/yield/index.d.ts +26 -0
  355. package/dist/yield/index.d.ts.map +1 -0
  356. package/dist/yield/index.js +29 -0
  357. package/dist/yield/index.js.map +1 -0
  358. package/dist/yield/rates.d.ts +114 -0
  359. package/dist/yield/rates.d.ts.map +1 -0
  360. package/dist/yield/rates.js +351 -0
  361. package/dist/yield/rates.js.map +1 -0
  362. package/dist/yield/types.d.ts +134 -0
  363. package/dist/yield/types.d.ts.map +1 -0
  364. package/dist/yield/types.js +24 -0
  365. package/dist/yield/types.js.map +1 -0
  366. package/dist/yield/vault.d.ts +112 -0
  367. package/dist/yield/vault.d.ts.map +1 -0
  368. package/dist/yield/vault.js +264 -0
  369. package/dist/yield/vault.js.map +1 -0
  370. package/package.json +46 -7
  371. package/index.js +0 -2
package/README.md ADDED
@@ -0,0 +1,221 @@
1
+ # AgentWallet SDK
2
+
3
+ Non-custodial AI agent wallet with ERC-8004 on-chain identity, ERC-6551 token-bound accounts, x402 payments, mutual stake escrow, and programmable spending guardrails.
4
+
5
+ Agent Wallet gives AI agents autonomous spending power with hard on-chain limits. No more choosing between "agent can drain everything" and "every transaction needs manual approval."
6
+
7
+ > **ERC-8004 Ready:** Maps directly to [ERC-8004 (Trustless Agents)](https://eips.ethereum.org/EIPS/eip-8004) — your agent's ERC-6551 wallet NFT doubles as its on-chain identity handle, with built-in Identity Registry, Reputation Registry, and Validation Registry clients.
8
+
9
+ ```
10
+ Agent wants to spend $15 → ✅ Auto-approved (under $25 limit)
11
+ Agent wants to spend $500 → ⏳ Queued for your approval
12
+ Agent spent $490 today → 🛑 Next tx queued ($500/day limit hit)
13
+ ```
14
+
15
+ ## Why Agent Wallet?
16
+
17
+ | Approach | Problem |
18
+ |----------|---------|
19
+ | Raw EOA wallet | Agent can drain everything. One prompt injection = rugged. |
20
+ | Multisig (Safe) | Every tx needs human sigs. Kills agent autonomy. |
21
+ | Custodial API (Stripe) | Centralized, KYC friction, not crypto-native. |
22
+ | **Agent Wallet** | **Agents spend freely within limits. Everything else queues for approval.** |
23
+
24
+ Built on **ERC-6551** (token-bound accounts). Your agent's wallet is tied to an NFT — portable, auditable, fully on-chain.
25
+
26
+ ## Quick Start
27
+
28
+ ```bash
29
+ npm install agentwallet-sdk viem
30
+ ```
31
+
32
+ ### Create a Wallet
33
+
34
+ ```typescript
35
+ import { createWallet, setSpendPolicy, agentExecute, NATIVE_TOKEN } from 'agentwallet-sdk';
36
+ import { createWalletClient, http } from 'viem';
37
+ import { privateKeyToAccount } from 'viem/accounts';
38
+ import { base } from 'viem/chains';
39
+
40
+ const account = privateKeyToAccount('0x...');
41
+ const walletClient = createWalletClient({ account, chain: base, transport: http() });
42
+
43
+ const wallet = createWallet({
44
+ accountAddress: '0xYourAgentWallet',
45
+ chain: 'base',
46
+ walletClient,
47
+ });
48
+
49
+ // Set a $25/tx, $500/day spend policy for ETH
50
+ await setSpendPolicy(wallet, {
51
+ token: NATIVE_TOKEN,
52
+ perTxLimit: 25000000000000000n, // 0.025 ETH
53
+ periodLimit: 500000000000000000n, // 0.5 ETH
54
+ periodLength: 86400,
55
+ });
56
+
57
+ // Agent executes — auto-approved if within limits, queued if over
58
+ const result = await agentExecute(wallet, {
59
+ to: '0xRecipient',
60
+ value: 10000000000000000n, // 0.01 ETH
61
+ });
62
+ console.log(result.executed ? 'Sent!' : 'Queued for approval');
63
+ ```
64
+
65
+ ## ERC-8004 On-Chain Identity
66
+
67
+ Register your agent on the ERC-8004 Identity Registry — a portable, censorship-resistant on-chain identity using ERC-721.
68
+
69
+ ```typescript
70
+ import { ERC8004Client } from 'agentwallet-sdk';
71
+
72
+ const identity = new ERC8004Client({ chain: 'base' });
73
+
74
+ // Register agent
75
+ const { txHash, agentId } = await identity.registerAgent(walletClient, {
76
+ name: 'MyAgent',
77
+ description: 'Autonomous trading agent',
78
+ });
79
+
80
+ // Look up any agent
81
+ const agent = await identity.lookupAgentIdentity(agentId!);
82
+ console.log(agent.owner, agent.agentURI);
83
+ ```
84
+
85
+ ## ERC-8004 Reputation Registry
86
+
87
+ On-chain reputation signals — scored feedback from clients, aggregated summaries, revocable.
88
+
89
+ ```typescript
90
+ import { ReputationClient } from 'agentwallet-sdk';
91
+
92
+ const reputation = new ReputationClient({ chain: 'base' });
93
+
94
+ // Leave feedback for an agent
95
+ await reputation.giveFeedback(walletClient, {
96
+ agentId: 42n,
97
+ score: 95n,
98
+ category: 1,
99
+ comment: 'Fast execution, accurate results',
100
+ taskRef: 'task-abc-123',
101
+ verifierRef: '',
102
+ clientRef: '',
103
+ contentHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
104
+ });
105
+
106
+ // Read aggregated reputation
107
+ const rep = await reputation.getAgentReputation(42n);
108
+ console.log(`Score: ${rep.totalScore} from ${rep.count} reviews`);
109
+ ```
110
+
111
+ ## ERC-8004 Validation Registry
112
+
113
+ Request and receive on-chain validation from validator contracts (TEE attestations, capability proofs, compliance checks).
114
+
115
+ ```typescript
116
+ import { ValidationClient } from 'agentwallet-sdk';
117
+ import { keccak256, toBytes } from 'viem';
118
+
119
+ const validation = new ValidationClient({
120
+ chain: 'base',
121
+ validationAddress: '0xYourValidationRegistry', // address required until official deployment
122
+ });
123
+
124
+ // Request validation from a validator
125
+ const requestHash = keccak256(toBytes('my-validation-request-v1'));
126
+ await validation.requestValidation(walletClient, {
127
+ validator: '0xValidatorContract',
128
+ agentId: 42n,
129
+ requestURI: 'https://example.com/validation-spec.json',
130
+ requestHash,
131
+ });
132
+
133
+ // Check validation status
134
+ const status = await validation.getValidationStatus(requestHash);
135
+ console.log(status.responded ? `Result: ${status.response}` : 'Pending');
136
+
137
+ // Get summary for an agent
138
+ const summary = await validation.getSummary(42n);
139
+ console.log(`${summary.passCount} passed, ${summary.failCount} failed`);
140
+ ```
141
+
142
+ ## Mutual Stake Escrow
143
+
144
+ Reciprocal collateral for agent-to-agent task settlement. Both parties stake, both lose if the task fails.
145
+
146
+ ```typescript
147
+ import { MutualStakeEscrow } from 'agentwallet-sdk';
148
+
149
+ const escrow = new MutualStakeEscrow({
150
+ chain: 'base',
151
+ walletClient,
152
+ });
153
+
154
+ // Create escrow — both agent and client stake
155
+ const { escrowId, txHash } = await escrow.create({
156
+ counterparty: '0xOtherAgent',
157
+ token: '0xUSDC',
158
+ stakeAmount: 100000000n, // 100 USDC
159
+ taskHash: '0x...',
160
+ deadline: BigInt(Math.floor(Date.now() / 1000) + 86400),
161
+ });
162
+
163
+ // Counterparty funds their side
164
+ await escrow.fund(escrowId);
165
+
166
+ // After task completion, fulfill
167
+ await escrow.fulfill(escrowId, proofHash);
168
+
169
+ // Verify and release stakes
170
+ await escrow.verify(escrowId);
171
+ ```
172
+
173
+ ## Feature Tiers
174
+
175
+ ### Base (Free)
176
+
177
+ | Feature | Description |
178
+ |---------|-------------|
179
+ | Agent Identity | ERC-8004 Identity Registry — on-chain ERC-721 agent IDs |
180
+ | Agent Reputation | ERC-8004 Reputation Registry — scored feedback and summaries |
181
+ | Agent Validation | ERC-8004 Validation Registry — validator request/response |
182
+ | ERC-6551 TBA | NFT-bound wallets with autonomous spending |
183
+ | Mutual Stake Escrow | Reciprocal collateral task settlement |
184
+ | Optimistic Escrow | Time-locked optimistic verification |
185
+ | x402 Payments | HTTP 402 auto-pay for agent-to-service payments |
186
+ | CCTP Bridge | Circle CCTP V2 across 17 chains + Solana |
187
+ | Spend Policies | Per-token, per-period on-chain spending limits |
188
+ | Swap | Uniswap V3 on Base/Arbitrum/Optimism |
189
+ | Fiat Onramp | Opt-in fiat-to-crypto |
190
+ | AP2 Protocol | Agent-to-Agent task delegation and payment |
191
+ | Settlement | On-chain settlement finalization |
192
+ | Gas Sponsorship | ERC-4337 paymaster-based gas sponsorship |
193
+ | Solana Support | Cross-chain Solana bridging via CCTP |
194
+
195
+ ### Premium
196
+
197
+ | Feature | Description |
198
+ |---------|-------------|
199
+ | CowSwap Solver | Batch auction solutions, earn COW tokens |
200
+ | Flash Executor | Atomic flash loan execution |
201
+ | MEV Protection | Private mempool via Flashbots/MEV Blocker |
202
+ | Yield Staking | Aave V3, Compound V3, Morpho Blue strategies |
203
+ | Tax Reporting | Cost basis and gain/loss reporting |
204
+
205
+ Premium access: [github.com/up2itnow/AgentNexus2](https://github.com/up2itnow/AgentNexus2)
206
+
207
+ ## Supported Chains
208
+
209
+ Mainnet: Ethereum, Base, Arbitrum, Polygon, Optimism, Avalanche, BSC, Celo, Gnosis, Linea, Mantle, Scroll, and more.
210
+
211
+ Testnet: Base Sepolia, Arbitrum Sepolia, and corresponding testnets.
212
+
213
+ ## Links
214
+
215
+ - [ERC-8004 Spec](https://eips.ethereum.org/EIPS/eip-8004)
216
+ - [GitHub](https://github.com/agentnexus/agent-wallet-sdk)
217
+ - [npm](https://www.npmjs.com/package/agentwallet-sdk)
218
+
219
+ ## License
220
+
221
+ MIT
package/dist/abi.d.ts ADDED
@@ -0,0 +1,397 @@
1
+ export declare const AgentAccountV2Abi: readonly [{
2
+ readonly name: "setSpendPolicy";
3
+ readonly type: "function";
4
+ readonly stateMutability: "nonpayable";
5
+ readonly inputs: readonly [{
6
+ readonly name: "token";
7
+ readonly type: "address";
8
+ }, {
9
+ readonly name: "perTxLimit";
10
+ readonly type: "uint256";
11
+ }, {
12
+ readonly name: "periodLimit";
13
+ readonly type: "uint256";
14
+ }, {
15
+ readonly name: "periodLength";
16
+ readonly type: "uint256";
17
+ }];
18
+ readonly outputs: readonly [];
19
+ }, {
20
+ readonly name: "setOperator";
21
+ readonly type: "function";
22
+ readonly stateMutability: "nonpayable";
23
+ readonly inputs: readonly [{
24
+ readonly name: "operator";
25
+ readonly type: "address";
26
+ }, {
27
+ readonly name: "authorized";
28
+ readonly type: "bool";
29
+ }];
30
+ readonly outputs: readonly [];
31
+ }, {
32
+ readonly name: "execute";
33
+ readonly type: "function";
34
+ readonly stateMutability: "payable";
35
+ readonly inputs: readonly [{
36
+ readonly name: "to";
37
+ readonly type: "address";
38
+ }, {
39
+ readonly name: "value";
40
+ readonly type: "uint256";
41
+ }, {
42
+ readonly name: "data";
43
+ readonly type: "bytes";
44
+ }];
45
+ readonly outputs: readonly [{
46
+ readonly name: "";
47
+ readonly type: "bytes";
48
+ }];
49
+ }, {
50
+ readonly name: "approvePending";
51
+ readonly type: "function";
52
+ readonly stateMutability: "nonpayable";
53
+ readonly inputs: readonly [{
54
+ readonly name: "txId";
55
+ readonly type: "uint256";
56
+ }];
57
+ readonly outputs: readonly [];
58
+ }, {
59
+ readonly name: "cancelPending";
60
+ readonly type: "function";
61
+ readonly stateMutability: "nonpayable";
62
+ readonly inputs: readonly [{
63
+ readonly name: "txId";
64
+ readonly type: "uint256";
65
+ }];
66
+ readonly outputs: readonly [];
67
+ }, {
68
+ readonly name: "agentExecute";
69
+ readonly type: "function";
70
+ readonly stateMutability: "payable";
71
+ readonly inputs: readonly [{
72
+ readonly name: "to";
73
+ readonly type: "address";
74
+ }, {
75
+ readonly name: "value";
76
+ readonly type: "uint256";
77
+ }, {
78
+ readonly name: "data";
79
+ readonly type: "bytes";
80
+ }];
81
+ readonly outputs: readonly [{
82
+ readonly name: "";
83
+ readonly type: "bytes";
84
+ }];
85
+ }, {
86
+ readonly name: "agentTransferToken";
87
+ readonly type: "function";
88
+ readonly stateMutability: "nonpayable";
89
+ readonly inputs: readonly [{
90
+ readonly name: "token";
91
+ readonly type: "address";
92
+ }, {
93
+ readonly name: "to";
94
+ readonly type: "address";
95
+ }, {
96
+ readonly name: "amount";
97
+ readonly type: "uint256";
98
+ }];
99
+ readonly outputs: readonly [];
100
+ }, {
101
+ readonly name: "remainingBudget";
102
+ readonly type: "function";
103
+ readonly stateMutability: "view";
104
+ readonly inputs: readonly [{
105
+ readonly name: "token";
106
+ readonly type: "address";
107
+ }];
108
+ readonly outputs: readonly [{
109
+ readonly name: "perTx";
110
+ readonly type: "uint256";
111
+ }, {
112
+ readonly name: "inPeriod";
113
+ readonly type: "uint256";
114
+ }];
115
+ }, {
116
+ readonly name: "getPending";
117
+ readonly type: "function";
118
+ readonly stateMutability: "view";
119
+ readonly inputs: readonly [{
120
+ readonly name: "txId";
121
+ readonly type: "uint256";
122
+ }];
123
+ readonly outputs: readonly [{
124
+ readonly name: "to";
125
+ readonly type: "address";
126
+ }, {
127
+ readonly name: "value";
128
+ readonly type: "uint256";
129
+ }, {
130
+ readonly name: "token";
131
+ readonly type: "address";
132
+ }, {
133
+ readonly name: "amount";
134
+ readonly type: "uint256";
135
+ }, {
136
+ readonly name: "createdAt";
137
+ readonly type: "uint256";
138
+ }, {
139
+ readonly name: "executed";
140
+ readonly type: "bool";
141
+ }, {
142
+ readonly name: "cancelled";
143
+ readonly type: "bool";
144
+ }];
145
+ }, {
146
+ readonly name: "spendPolicies";
147
+ readonly type: "function";
148
+ readonly stateMutability: "view";
149
+ readonly inputs: readonly [{
150
+ readonly name: "token";
151
+ readonly type: "address";
152
+ }];
153
+ readonly outputs: readonly [{
154
+ readonly name: "perTxLimit";
155
+ readonly type: "uint256";
156
+ }, {
157
+ readonly name: "periodLimit";
158
+ readonly type: "uint256";
159
+ }, {
160
+ readonly name: "periodLength";
161
+ readonly type: "uint256";
162
+ }, {
163
+ readonly name: "periodSpent";
164
+ readonly type: "uint256";
165
+ }, {
166
+ readonly name: "periodStart";
167
+ readonly type: "uint256";
168
+ }];
169
+ }, {
170
+ readonly name: "operators";
171
+ readonly type: "function";
172
+ readonly stateMutability: "view";
173
+ readonly inputs: readonly [{
174
+ readonly name: "operator";
175
+ readonly type: "address";
176
+ }];
177
+ readonly outputs: readonly [{
178
+ readonly name: "";
179
+ readonly type: "bool";
180
+ }];
181
+ }, {
182
+ readonly name: "pendingNonce";
183
+ readonly type: "function";
184
+ readonly stateMutability: "view";
185
+ readonly inputs: readonly [];
186
+ readonly outputs: readonly [{
187
+ readonly name: "";
188
+ readonly type: "uint256";
189
+ }];
190
+ }, {
191
+ readonly name: "nonce";
192
+ readonly type: "function";
193
+ readonly stateMutability: "view";
194
+ readonly inputs: readonly [];
195
+ readonly outputs: readonly [{
196
+ readonly name: "";
197
+ readonly type: "uint256";
198
+ }];
199
+ }, {
200
+ readonly name: "tokenContract";
201
+ readonly type: "function";
202
+ readonly stateMutability: "view";
203
+ readonly inputs: readonly [];
204
+ readonly outputs: readonly [{
205
+ readonly name: "";
206
+ readonly type: "address";
207
+ }];
208
+ }, {
209
+ readonly name: "tokenId";
210
+ readonly type: "function";
211
+ readonly stateMutability: "view";
212
+ readonly inputs: readonly [];
213
+ readonly outputs: readonly [{
214
+ readonly name: "";
215
+ readonly type: "uint256";
216
+ }];
217
+ }, {
218
+ readonly name: "operatorEpoch";
219
+ readonly type: "function";
220
+ readonly stateMutability: "view";
221
+ readonly inputs: readonly [];
222
+ readonly outputs: readonly [{
223
+ readonly name: "";
224
+ readonly type: "uint256";
225
+ }];
226
+ }, {
227
+ readonly name: "isOperatorActive";
228
+ readonly type: "function";
229
+ readonly stateMutability: "view";
230
+ readonly inputs: readonly [{
231
+ readonly name: "operator";
232
+ readonly type: "address";
233
+ }];
234
+ readonly outputs: readonly [{
235
+ readonly name: "";
236
+ readonly type: "bool";
237
+ }];
238
+ }, {
239
+ readonly name: "TransactionExecuted";
240
+ readonly type: "event";
241
+ readonly inputs: readonly [{
242
+ readonly name: "target";
243
+ readonly type: "address";
244
+ readonly indexed: true;
245
+ }, {
246
+ readonly name: "value";
247
+ readonly type: "uint256";
248
+ readonly indexed: false;
249
+ }, {
250
+ readonly name: "data";
251
+ readonly type: "bytes";
252
+ readonly indexed: false;
253
+ }, {
254
+ readonly name: "executor";
255
+ readonly type: "address";
256
+ readonly indexed: true;
257
+ }];
258
+ }, {
259
+ readonly name: "SpendPolicyUpdated";
260
+ readonly type: "event";
261
+ readonly inputs: readonly [{
262
+ readonly name: "token";
263
+ readonly type: "address";
264
+ readonly indexed: true;
265
+ }, {
266
+ readonly name: "perTxLimit";
267
+ readonly type: "uint256";
268
+ readonly indexed: false;
269
+ }, {
270
+ readonly name: "periodLimit";
271
+ readonly type: "uint256";
272
+ readonly indexed: false;
273
+ }, {
274
+ readonly name: "periodLength";
275
+ readonly type: "uint256";
276
+ readonly indexed: false;
277
+ }];
278
+ }, {
279
+ readonly name: "OperatorUpdated";
280
+ readonly type: "event";
281
+ readonly inputs: readonly [{
282
+ readonly name: "operator";
283
+ readonly type: "address";
284
+ readonly indexed: true;
285
+ }, {
286
+ readonly name: "authorized";
287
+ readonly type: "bool";
288
+ readonly indexed: false;
289
+ }];
290
+ }, {
291
+ readonly name: "TransactionQueued";
292
+ readonly type: "event";
293
+ readonly inputs: readonly [{
294
+ readonly name: "txId";
295
+ readonly type: "uint256";
296
+ readonly indexed: true;
297
+ }, {
298
+ readonly name: "to";
299
+ readonly type: "address";
300
+ readonly indexed: true;
301
+ }, {
302
+ readonly name: "value";
303
+ readonly type: "uint256";
304
+ readonly indexed: false;
305
+ }, {
306
+ readonly name: "token";
307
+ readonly type: "address";
308
+ readonly indexed: false;
309
+ }, {
310
+ readonly name: "amount";
311
+ readonly type: "uint256";
312
+ readonly indexed: false;
313
+ }];
314
+ }, {
315
+ readonly name: "TransactionApproved";
316
+ readonly type: "event";
317
+ readonly inputs: readonly [{
318
+ readonly name: "txId";
319
+ readonly type: "uint256";
320
+ readonly indexed: true;
321
+ }];
322
+ }, {
323
+ readonly name: "TransactionCancelled";
324
+ readonly type: "event";
325
+ readonly inputs: readonly [{
326
+ readonly name: "txId";
327
+ readonly type: "uint256";
328
+ readonly indexed: true;
329
+ }];
330
+ }];
331
+ export declare const AgentAccountFactoryV2Abi: readonly [{
332
+ readonly name: "createAccount";
333
+ readonly type: "function";
334
+ readonly stateMutability: "nonpayable";
335
+ readonly inputs: readonly [{
336
+ readonly name: "tokenContract";
337
+ readonly type: "address";
338
+ }, {
339
+ readonly name: "tokenId";
340
+ readonly type: "uint256";
341
+ }];
342
+ readonly outputs: readonly [{
343
+ readonly name: "wallet";
344
+ readonly type: "address";
345
+ }];
346
+ }, {
347
+ readonly name: "getAddress";
348
+ readonly type: "function";
349
+ readonly stateMutability: "view";
350
+ readonly inputs: readonly [{
351
+ readonly name: "tokenContract";
352
+ readonly type: "address";
353
+ }, {
354
+ readonly name: "tokenId";
355
+ readonly type: "uint256";
356
+ }];
357
+ readonly outputs: readonly [{
358
+ readonly name: "";
359
+ readonly type: "address";
360
+ }];
361
+ }, {
362
+ readonly name: "wallets";
363
+ readonly type: "function";
364
+ readonly stateMutability: "view";
365
+ readonly inputs: readonly [{
366
+ readonly name: "tokenContract";
367
+ readonly type: "address";
368
+ }, {
369
+ readonly name: "tokenId";
370
+ readonly type: "uint256";
371
+ }];
372
+ readonly outputs: readonly [{
373
+ readonly name: "";
374
+ readonly type: "address";
375
+ }];
376
+ }, {
377
+ readonly name: "WalletCreated";
378
+ readonly type: "event";
379
+ readonly inputs: readonly [{
380
+ readonly name: "wallet";
381
+ readonly type: "address";
382
+ readonly indexed: true;
383
+ }, {
384
+ readonly name: "tokenContract";
385
+ readonly type: "address";
386
+ readonly indexed: true;
387
+ }, {
388
+ readonly name: "tokenId";
389
+ readonly type: "uint256";
390
+ readonly indexed: true;
391
+ }, {
392
+ readonly name: "deployer";
393
+ readonly type: "address";
394
+ readonly indexed: false;
395
+ }];
396
+ }];
397
+ //# sourceMappingURL=abi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abi.d.ts","sourceRoot":"","sources":["../src/abi.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsNpB,CAAC;AAEX,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyC3B,CAAC"}