@pushchain/core 6.0.26 → 6.0.27-alpha.1

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 (171) hide show
  1. package/AGW.md +226 -0
  2. package/CHANGELOG.md +18 -0
  3. package/README.md +2 -0
  4. package/package.json +7 -1
  5. package/src/lib/agentic/agentic.d.ts +23 -0
  6. package/src/lib/agentic/agentic.js +51 -0
  7. package/src/lib/agentic/agentic.types.d.ts +414 -0
  8. package/src/lib/agentic/agentic.types.js +3 -0
  9. package/src/lib/agentic/capabilities.d.ts +37 -0
  10. package/src/lib/agentic/capabilities.js +64 -0
  11. package/src/lib/agentic/chain.d.ts +3 -0
  12. package/src/lib/agentic/chain.js +15 -0
  13. package/src/lib/agentic/codec/abi-layout.d.ts +20 -0
  14. package/src/lib/agentic/codec/abi-layout.js +168 -0
  15. package/src/lib/agentic/codec/defaults.d.ts +51 -0
  16. package/src/lib/agentic/codec/defaults.js +53 -0
  17. package/src/lib/agentic/codec/ids.d.ts +35 -0
  18. package/src/lib/agentic/codec/ids.js +74 -0
  19. package/src/lib/agentic/codec/native.d.ts +73 -0
  20. package/src/lib/agentic/codec/native.js +341 -0
  21. package/src/lib/agentic/codec/pins.d.ts +20 -0
  22. package/src/lib/agentic/codec/pins.js +29 -0
  23. package/src/lib/agentic/codec/rules.d.ts +45 -0
  24. package/src/lib/agentic/codec/rules.js +110 -0
  25. package/src/lib/agentic/codec/selectors.d.ts +19 -0
  26. package/src/lib/agentic/codec/selectors.js +60 -0
  27. package/src/lib/agentic/codec/session.d.ts +54 -0
  28. package/src/lib/agentic/codec/session.js +65 -0
  29. package/src/lib/agentic/codec/svm-accounts.d.ts +35 -0
  30. package/src/lib/agentic/codec/svm-accounts.js +68 -0
  31. package/src/lib/agentic/codec/svm-idl.d.ts +11 -0
  32. package/src/lib/agentic/codec/svm-idl.js +226 -0
  33. package/src/lib/agentic/codec/svm-terms.d.ts +157 -0
  34. package/src/lib/agentic/codec/svm-terms.js +246 -0
  35. package/src/lib/agentic/codec/universal-terms.d.ts +82 -0
  36. package/src/lib/agentic/codec/universal-terms.js +43 -0
  37. package/src/lib/agentic/codec/universal.d.ts +14 -0
  38. package/src/lib/agentic/codec/universal.js +173 -0
  39. package/src/lib/agentic/constants.d.ts +12 -0
  40. package/src/lib/agentic/constants.js +16 -0
  41. package/src/lib/agentic/context.d.ts +29 -0
  42. package/src/lib/agentic/context.js +56 -0
  43. package/src/lib/agentic/contracts/abi/v6/agent-validator.d.ts +105 -0
  44. package/src/lib/agentic/contracts/abi/v6/agent-validator.js +149 -0
  45. package/src/lib/agentic/contracts/abi/v6/agw-factory.d.ts +1146 -0
  46. package/src/lib/agentic/contracts/abi/v6/agw-factory.js +1499 -0
  47. package/src/lib/agentic/contracts/abi/v6/agw.d.ts +1306 -0
  48. package/src/lib/agentic/contracts/abi/v6/agw.js +1713 -0
  49. package/src/lib/agentic/contracts/abi/v6/index.d.ts +6 -0
  50. package/src/lib/agentic/contracts/abi/v6/index.js +17 -0
  51. package/src/lib/agentic/contracts/abi/v6/smart-session.d.ts +1493 -0
  52. package/src/lib/agentic/contracts/abi/v6/smart-session.js +1965 -0
  53. package/src/lib/agentic/contracts/abi/v6/universal-rules-policy.d.ts +1661 -0
  54. package/src/lib/agentic/contracts/abi/v6/universal-rules-policy.js +2187 -0
  55. package/src/lib/agentic/contracts/donut-v6.d.ts +11 -0
  56. package/src/lib/agentic/contracts/donut-v6.js +15 -0
  57. package/src/lib/agentic/contracts/prc20-metadata.d.ts +26 -0
  58. package/src/lib/agentic/contracts/prc20-metadata.js +87 -0
  59. package/src/lib/agentic/contracts/reader.d.ts +35 -0
  60. package/src/lib/agentic/contracts/reader.js +16 -0
  61. package/src/lib/agentic/contracts/v6.d.ts +5739 -0
  62. package/src/lib/agentic/contracts/v6.js +343 -0
  63. package/src/lib/agentic/deployments.d.ts +61 -0
  64. package/src/lib/agentic/deployments.js +203 -0
  65. package/src/lib/agentic/errors.d.ts +65 -0
  66. package/src/lib/agentic/errors.js +84 -0
  67. package/src/lib/agentic/execution/guards.d.ts +9 -0
  68. package/src/lib/agentic/execution/guards.js +30 -0
  69. package/src/lib/agentic/execution/outbound.d.ts +55 -0
  70. package/src/lib/agentic/execution/outbound.js +187 -0
  71. package/src/lib/agentic/execution/send.d.ts +9 -0
  72. package/src/lib/agentic/execution/send.js +268 -0
  73. package/src/lib/agentic/execution/svm-instruction.d.ts +24 -0
  74. package/src/lib/agentic/execution/svm-instruction.js +40 -0
  75. package/src/lib/agentic/execution/svm-outbound.d.ts +18 -0
  76. package/src/lib/agentic/execution/svm-outbound.js +86 -0
  77. package/src/lib/agentic/execution/svm-payload.d.ts +18 -0
  78. package/src/lib/agentic/execution/svm-payload.js +136 -0
  79. package/src/lib/agentic/execution/svm-public.d.ts +5 -0
  80. package/src/lib/agentic/execution/svm-public.js +176 -0
  81. package/src/lib/agentic/execution/svm-quote.d.ts +11 -0
  82. package/src/lib/agentic/execution/svm-quote.js +24 -0
  83. package/src/lib/agentic/execution/svm-send.d.ts +44 -0
  84. package/src/lib/agentic/execution/svm-send.js +87 -0
  85. package/src/lib/agentic/index.d.ts +5 -0
  86. package/src/lib/agentic/index.js +10 -0
  87. package/src/lib/agentic/management/common.d.ts +29 -0
  88. package/src/lib/agentic/management/common.js +116 -0
  89. package/src/lib/agentic/management/create.d.ts +4 -0
  90. package/src/lib/agentic/management/create.js +138 -0
  91. package/src/lib/agentic/management/duplicates.d.ts +4 -0
  92. package/src/lib/agentic/management/duplicates.js +20 -0
  93. package/src/lib/agentic/management/label.d.ts +3 -0
  94. package/src/lib/agentic/management/label.js +17 -0
  95. package/src/lib/agentic/management/prepare.d.ts +7 -0
  96. package/src/lib/agentic/management/prepare.js +95 -0
  97. package/src/lib/agentic/management/rules-write.d.ts +42 -0
  98. package/src/lib/agentic/management/rules-write.js +279 -0
  99. package/src/lib/agentic/management/svm-context.d.ts +25 -0
  100. package/src/lib/agentic/management/svm-context.js +55 -0
  101. package/src/lib/agentic/management/svm-metadata.d.ts +10 -0
  102. package/src/lib/agentic/management/svm-metadata.js +56 -0
  103. package/src/lib/agentic/management/svm-public.d.ts +6 -0
  104. package/src/lib/agentic/management/svm-public.js +125 -0
  105. package/src/lib/agentic/management/svm.d.ts +27 -0
  106. package/src/lib/agentic/management/svm.js +150 -0
  107. package/src/lib/agentic/presets/catalog.d.ts +26 -0
  108. package/src/lib/agentic/presets/catalog.js +307 -0
  109. package/src/lib/agentic/presets/index.d.ts +5 -0
  110. package/src/lib/agentic/presets/index.js +265 -0
  111. package/src/lib/agentic/presets/types.d.ts +48 -0
  112. package/src/lib/agentic/presets/types.js +3 -0
  113. package/src/lib/agentic/public-rule.d.ts +9 -0
  114. package/src/lib/agentic/public-rule.js +326 -0
  115. package/src/lib/agentic/reads/checkpoints.d.ts +17 -0
  116. package/src/lib/agentic/reads/checkpoints.js +109 -0
  117. package/src/lib/agentic/reads/rules.d.ts +42 -0
  118. package/src/lib/agentic/reads/rules.js +302 -0
  119. package/src/lib/agentic/reads/snapshot.d.ts +28 -0
  120. package/src/lib/agentic/reads/snapshot.js +85 -0
  121. package/src/lib/agentic/reads/svm.d.ts +17 -0
  122. package/src/lib/agentic/reads/svm.js +52 -0
  123. package/src/lib/agentic/reads/wallets.d.ts +25 -0
  124. package/src/lib/agentic/reads/wallets.js +122 -0
  125. package/src/lib/agentic/response.d.ts +41 -0
  126. package/src/lib/agentic/response.js +358 -0
  127. package/src/lib/agentic/revert.d.ts +7 -0
  128. package/src/lib/agentic/revert.js +102 -0
  129. package/src/lib/agentic/runtime.d.ts +58 -0
  130. package/src/lib/agentic/runtime.js +104 -0
  131. package/src/lib/agentic/utils.d.ts +57 -0
  132. package/src/lib/agentic/utils.js +165 -0
  133. package/src/lib/agentic/wallet.d.ts +32 -0
  134. package/src/lib/agentic/wallet.js +130 -0
  135. package/src/lib/constants/enums.d.ts +6 -3
  136. package/src/lib/constants/enums.js +6 -3
  137. package/src/lib/constants/index.d.ts +61 -4
  138. package/src/lib/constants/index.js +17 -3
  139. package/src/lib/constants/read-state.d.ts +9 -0
  140. package/src/lib/constants/read-state.js +13 -1
  141. package/src/lib/index.d.ts +8 -2
  142. package/src/lib/index.js +9 -1
  143. package/src/lib/orchestrator/internals/errors.d.ts +7 -0
  144. package/src/lib/orchestrator/internals/errors.js +13 -1
  145. package/src/lib/orchestrator/internals/execute-standard.d.ts +3 -1
  146. package/src/lib/orchestrator/internals/execute-standard.js +3 -3
  147. package/src/lib/orchestrator/internals/outbound-sync.js +52 -7
  148. package/src/lib/orchestrator/internals/push-chain-tx.d.ts +1 -1
  149. package/src/lib/orchestrator/internals/push-chain-tx.js +13 -1
  150. package/src/lib/orchestrator/orchestrator.d.ts +3 -0
  151. package/src/lib/orchestrator/orchestrator.js +13 -1
  152. package/src/lib/orchestrator/orchestrator.types.d.ts +8 -0
  153. package/src/lib/orchestrator/route-detector.js +3 -2
  154. package/src/lib/orchestrator/svm-idl/resolve.d.ts +2 -0
  155. package/src/lib/orchestrator/svm-idl/resolve.js +11 -1
  156. package/src/lib/progress-hook/progress-hook.js +63 -0
  157. package/src/lib/progress-hook/progress-hook.types.d.ts +10 -1
  158. package/src/lib/progress-hook/progress-hook.types.js +10 -0
  159. package/src/lib/push-chain/push-chain.d.ts +57 -15
  160. package/src/lib/push-chain/push-chain.js +66 -7
  161. package/src/lib/read-state/destination.js +6 -1
  162. package/src/lib/read-state/read-params.d.ts +3 -3
  163. package/src/lib/read-state/read-params.js +3 -2
  164. package/src/lib/read-state/read-state.types.d.ts +3 -1
  165. package/src/lib/read-state/read-tracker.js +2 -2
  166. package/src/lib/read-state/spec-builder.js +1 -1
  167. package/src/lib/universal/prc20-address.d.ts +15 -0
  168. package/src/lib/universal/prc20-address.js +135 -0
  169. package/src/lib/utils.d.ts +6 -13
  170. package/src/lib/utils.js +5 -128
  171. package/src/lib/vm-client/evm-client.js +34 -20
@@ -0,0 +1,150 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.verifySvmWallet = verifySvmWallet;
4
+ exports.grantSvmWire = grantSvmWire;
5
+ exports.prepareSvmReplacement = prepareSvmReplacement;
6
+ exports.replaceSvmWire = replaceSvmWire;
7
+ /** Internal explicit-wire operations. Not exported by the SDK entry point. */
8
+ const viem_1 = require("viem");
9
+ const deployments_1 = require("../deployments");
10
+ const snapshot_1 = require("../reads/snapshot");
11
+ const svm_1 = require("../reads/svm");
12
+ const common_1 = require("./common");
13
+ const svm_terms_1 = require("../codec/svm-terms");
14
+ const session_1 = require("../codec/session");
15
+ const ids_1 = require("../codec/ids");
16
+ const v6_1 = require("../contracts/v6");
17
+ const svm_accounts_1 = require("../codec/svm-accounts");
18
+ const errors_1 = require("../errors");
19
+ const prc20_metadata_1 = require("../contracts/prc20-metadata");
20
+ async function verifyAssets(snap, input) {
21
+ if (!/^solana:[1-9A-HJ-NP-Za-km-z]{32}$/.test(input.chainNamespace))
22
+ throw new errors_1.AgenticError(errors_1.AGENTIC_ERROR_CODE.INVALID_RULE, 'SVM chain must be a full Solana CAIP-2 namespace');
23
+ for (const cap of input.terms.assets) {
24
+ if ((await snap.read(cap.token, prc20_metadata_1.PRC20_SOURCE_ABI, 'SOURCE_CHAIN_NAMESPACE')) !== input.chainNamespace)
25
+ throw new errors_1.AgenticError(errors_1.AGENTIC_ERROR_CODE.ASSET_CHAIN_MISMATCH, 'SVM asset source-chain mismatch');
26
+ }
27
+ }
28
+ async function verifySvmWallet(runtime, gen, wallet) {
29
+ const actual = await (0, deployments_1.resolveWalletGeneration)(runtime.reader, runtime.network, wallet);
30
+ if (actual.addresses.factory !== gen.addresses.factory)
31
+ throw new errors_1.AgenticError(errors_1.AGENTIC_ERROR_CODE.CAPABILITY_UNAVAILABLE, 'SVM wallet generation mismatch');
32
+ await (0, deployments_1.verifyPolicyVersion)(runtime.reader, gen);
33
+ }
34
+ function session(gen, wallet, owner, input, now) {
35
+ const agent = (0, viem_1.getAddress)(input.agent);
36
+ if (agent === owner)
37
+ throw new errors_1.AgenticError(errors_1.AGENTIC_ERROR_CODE.AGENT_IS_OWNER, 'agent must differ from owner');
38
+ const cea = (0, svm_accounts_1.deriveAgwSvmCea)(wallet, input.terms.gatewayProgram).address;
39
+ if (cea.toLowerCase() !== input.terms.expectedCEA.toLowerCase())
40
+ throw new errors_1.AgenticError(errors_1.AGENTIC_ERROR_CODE.INVALID_RULE, 'SVM expectedCEA does not belong to this wallet/gateway');
41
+ return (0, session_1.buildSession)({
42
+ validator: gen.addresses.sessionValidator,
43
+ rulesPolicy: gen.addresses.rulesPolicy,
44
+ agent,
45
+ actions: [
46
+ {
47
+ target: gen.addresses.gateway,
48
+ selector: v6_1.SEND_OUTBOUND_SELECTOR,
49
+ initData: (0, session_1.encodeEnvelope)(input.chainNamespace, (0, svm_terms_1.encodeSvmTerms)(input.terms, now)),
50
+ },
51
+ ],
52
+ });
53
+ }
54
+ async function grantSvmWire(runtime, gen, wallet, input) {
55
+ (0, common_1.assertCanSign)(runtime, 'internal SVM grant');
56
+ await verifySvmWallet(runtime, gen, wallet);
57
+ const snap = await snapshot_1.Snapshot.at(runtime.reader);
58
+ const owner = await (0, common_1.assertOwner)(runtime, gen, wallet, snap);
59
+ await verifyAssets(snap, input);
60
+ const s = session(gen, wallet, owner, input, runtime.nowSeconds());
61
+ const nonce = await snap.read(wallet, gen.contracts.abis.wallet, 'grantNonce');
62
+ const expected = (0, ids_1.rulesId)({
63
+ validator: gen.addresses.sessionValidator,
64
+ agent: (0, viem_1.getAddress)(input.agent),
65
+ grantNonce: nonce,
66
+ });
67
+ let tx;
68
+ try {
69
+ tx = await runtime.execute({
70
+ to: wallet,
71
+ value: BigInt(0),
72
+ data: gen.contracts.encodeGrantRules(s),
73
+ });
74
+ }
75
+ catch (error) {
76
+ throw (0, common_1.wrapSendError)(error);
77
+ }
78
+ const { logs } = await (0, common_1.confirmedLogs)(runtime, tx);
79
+ const granted = gen.contracts.parseRulesGranted(logs, wallet);
80
+ if (granted.length !== 1 ||
81
+ granted[0].mode !== 0 ||
82
+ granted[0].chainNamespace !== input.chainNamespace)
83
+ throw new errors_1.AgenticError(errors_1.AGENTIC_ERROR_CODE.RECEIPT_MISMATCH, 'SVM grant receipt did not match this operation', { details: { txHash: tx.hash, expected } });
84
+ // Another owner grant can advance grantNonce between read and inclusion.
85
+ // The sole matching event from this receipt is the authoritative ID.
86
+ return { rulesId: granted[0].rulesId, tx };
87
+ }
88
+ /** Snapshot -> all-asset assertion -> revoke -> grant. No sequential fallback. */
89
+ async function prepareSvmReplacement(runtime, gen, wallet, oldId, input) {
90
+ (0, common_1.assertCanSign)(runtime, 'internal SVM replacement');
91
+ await verifySvmWallet(runtime, gen, wallet);
92
+ const snap = await snapshot_1.Snapshot.at(runtime.reader);
93
+ const owner = await (0, common_1.assertOwner)(runtime, gen, wallet, snap);
94
+ await verifyAssets(snap, input);
95
+ const old = await (0, svm_1.readSvmRule)(snap, gen, wallet, oldId, runtime.pushChainNamespace);
96
+ const s = session(gen, wallet, owner, input, runtime.nowSeconds());
97
+ const nonce = await snap.read(wallet, gen.contracts.abis.wallet, 'grantNonce');
98
+ const rulesId = (0, ids_1.rulesId)({
99
+ validator: gen.addresses.sessionValidator,
100
+ agent: (0, viem_1.getAddress)(input.agent),
101
+ grantNonce: nonce,
102
+ });
103
+ const calls = [
104
+ {
105
+ target: gen.addresses.rulesPolicy,
106
+ value: BigInt(0),
107
+ data: gen.contracts.encodeAssertSpentUniversal(old.configId, wallet, old.config.assets.map((a) => a.spent)),
108
+ },
109
+ {
110
+ target: wallet,
111
+ value: BigInt(0),
112
+ data: gen.contracts.encodeRevokeRules(oldId),
113
+ },
114
+ {
115
+ target: wallet,
116
+ value: BigInt(0),
117
+ data: gen.contracts.encodeGrantRules(s),
118
+ },
119
+ ];
120
+ return {
121
+ rulesId,
122
+ oldId,
123
+ snapshotBlock: snap.blockNumber,
124
+ data: gen.contracts.encodeExecute(calls),
125
+ };
126
+ }
127
+ async function replaceSvmWire(runtime, gen, wallet, oldId, input) {
128
+ const prepared = await prepareSvmReplacement(runtime, gen, wallet, oldId, input);
129
+ let tx;
130
+ try {
131
+ tx = await runtime.execute({
132
+ to: wallet,
133
+ value: BigInt(0),
134
+ data: prepared.data,
135
+ });
136
+ }
137
+ catch (error) {
138
+ throw (0, common_1.wrapSendError)(error);
139
+ }
140
+ const { logs } = await (0, common_1.confirmedLogs)(runtime, tx);
141
+ const grants = gen.contracts.parseRulesGranted(logs, wallet);
142
+ const revokes = gen.contracts.parseRulesRevoked(logs, wallet);
143
+ if (grants.length !== 1 ||
144
+ grants[0].mode !== 0 ||
145
+ grants[0].chainNamespace !== input.chainNamespace ||
146
+ !revokes.some((r) => r.rulesId.toLowerCase() === oldId.toLowerCase()))
147
+ throw new errors_1.AgenticError(errors_1.AGENTIC_ERROR_CODE.RECEIPT_MISMATCH, 'SVM replacement receipt mismatch', { details: { txHash: tx.hash } });
148
+ return { rulesId: grants[0].rulesId, replaced: oldId, tx };
149
+ }
150
+ //# sourceMappingURL=svm.js.map
@@ -0,0 +1,26 @@
1
+ import { type Address } from 'viem';
2
+ import type { RuleCall, ForeignChainNamespace } from '../agentic.types';
3
+ import type { PresetCategory } from './types';
4
+ /** Internal catalog: reviewed addresses and explicit calls only; never fetched at runtime. */
5
+ export interface PresetChainDefinition {
6
+ chainNamespace: ForeignChainNamespace;
7
+ allowedCalls: readonly RuleCall[];
8
+ /** Static single-hop routers; incomplete pairs return zero-input-cap review calls. */
9
+ swapRouters?: readonly {
10
+ address: Address;
11
+ app: string;
12
+ }[];
13
+ /** Exact spenders that need an approval for each non-native supplied asset. */
14
+ approvals?: readonly {
15
+ spender: Address;
16
+ app: string;
17
+ token?: Address;
18
+ }[];
19
+ maxGasPerCall?: bigint;
20
+ }
21
+ export interface PresetDefinition {
22
+ constant: PresetCategory;
23
+ name: string;
24
+ chains: readonly PresetChainDefinition[];
25
+ }
26
+ export declare const PRESET_CATALOG: readonly PresetDefinition[];
@@ -0,0 +1,307 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PRESET_CATALOG = void 0;
4
+ const viem_1 = require("viem");
5
+ /** Mainnet and testnet templates from the October 15 Notion export and protocol sources.
6
+ * Read-only deployment/code evidence and exclusions: plan/agw/research/preset-catalog-2026-10-15/.
7
+ * Mainnet entries are templates only; no mainnet deployment or execution guarantee.
8
+ */
9
+ const address = (value) => (0, viem_1.getAddress)(value.toLowerCase());
10
+ const wallet = 'agentic:wallet';
11
+ const aave = (pool) => [
12
+ ['supply(address,uint256,address,uint16)', 2, 'Supply'],
13
+ ['withdraw(address,uint256,address)', 2, 'Withdraw'],
14
+ ['borrow(address,uint256,uint256,uint16,address)', 4, 'Borrow'],
15
+ ['repay(address,uint256,uint256,address)', 3, 'Repay'],
16
+ ].map(([selector, arg, label]) => ({
17
+ target: pool,
18
+ selector: selector,
19
+ pins: [{ arg: arg, expected: wallet }],
20
+ app: 'Aave V3',
21
+ label: label,
22
+ }));
23
+ const market = (target, app) => [
24
+ 'mint(uint256)',
25
+ 'redeem(uint256)',
26
+ 'redeemUnderlying(uint256)',
27
+ 'borrow(uint256)',
28
+ 'repayBorrow(uint256)',
29
+ ].map((selector) => ({
30
+ target,
31
+ selector: selector,
32
+ app,
33
+ label: selector.split('(')[0],
34
+ }));
35
+ const sepoliaPool = address('0x6Ae43d3271ff6888e7Fc43Fd7321a503ff738951');
36
+ const basePool = address('0x8bAB6d1b75f19e9eD9fCe8b9BD338844fF79aE27');
37
+ const arbitrumPool = address('0xBfC91D59fdAA134A4ED45f7B584cAf96D7792Eff');
38
+ const moonUSDBC = address('0x876852425331a113d8E432eFFB3aC5BEf38f033a');
39
+ const moonWETH = address('0x2F39a349A79492a70E152760ce7123A1933eCf28');
40
+ const venusUSDT = address('0xb7526572FFE56AB9D7489838Bf2E18e3323b441A');
41
+ const venusUSDC = address('0xD5C4C2e2facBEB59D0216D0595d63FcDc6F9A1a7');
42
+ const eigen = address('0x2E3D6c0744b10eb0A4e6F679F71554a39Ec47a5D');
43
+ const stETH = address('0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84');
44
+ const wstETH = address('0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0');
45
+ const lidoQueue = address('0x889edC2eDab5f40e902b864aD4d7AdE8E412F9B1');
46
+ const mainnetMarkets = (chain) => {
47
+ const entries = chain === 'eip155:8453'
48
+ ? [
49
+ [
50
+ '0xEdc817A28E8B93B03976FBd4a3dDBc9f7D176c22',
51
+ 'Moonwell mUSDC',
52
+ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
53
+ ],
54
+ [
55
+ '0x628ff693426583D9a7FB391E54366292F509D457',
56
+ 'Moonwell mWETH',
57
+ '0x4200000000000000000000000000000000000006',
58
+ ],
59
+ ]
60
+ : chain === 'eip155:56'
61
+ ? [
62
+ [
63
+ '0xfD5840Cd36d94D7229439859C0112a4185BC0255',
64
+ 'Venus vUSDT',
65
+ '0x55d398326f99059fF775485246999027B3197955',
66
+ ],
67
+ [
68
+ '0xecA88125a5ADbe82614ffC12D0DB554E2e2867C8',
69
+ 'Venus vUSDC',
70
+ '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d',
71
+ ],
72
+ ]
73
+ : [];
74
+ const controller = chain === 'eip155:8453'
75
+ ? '0xfBb21d0380beE3312B33c4353c8936a0F13EF26C'
76
+ : '0xfD36E2c2a6789Db23113685031d7F16329158384';
77
+ return {
78
+ allowedCalls: [
79
+ ...entries.flatMap(([target, app]) => market(address(target), app)),
80
+ ...(entries.length
81
+ ? [
82
+ {
83
+ target: address(controller),
84
+ selector: 'enterMarkets(address[])',
85
+ app: chain === 'eip155:8453' ? 'Moonwell' : 'Venus',
86
+ label: 'Enter markets',
87
+ },
88
+ ]
89
+ : []),
90
+ ],
91
+ approvals: entries.map(([spender, app, token]) => ({
92
+ spender: address(spender),
93
+ app,
94
+ token: address(token),
95
+ })),
96
+ };
97
+ };
98
+ exports.PRESET_CATALOG = [
99
+ {
100
+ constant: 'DEXES',
101
+ name: 'Popular DEXes',
102
+ chains: [
103
+ ['eip155:1', '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45', 'Uniswap V3'],
104
+ [
105
+ 'eip155:8453',
106
+ '0x2626664c2603336E57B271c5C0b26F421741e481',
107
+ 'Uniswap V3',
108
+ ],
109
+ [
110
+ 'eip155:42161',
111
+ '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45',
112
+ 'Uniswap V3',
113
+ ],
114
+ [
115
+ 'eip155:56',
116
+ '0x13f4EA83D0bd40E75C8222255bc855a974568Dd4',
117
+ 'PancakeSwap V3',
118
+ ],
119
+ [
120
+ 'eip155:11155111',
121
+ '0x3bFA4769FB09eefC5a80d6E87c3B9C650f7Ae48E',
122
+ 'Uniswap V3',
123
+ ],
124
+ [
125
+ 'eip155:84532',
126
+ '0x94cC0AaC535CCDB3C01d6787D6413C739ae12bc4',
127
+ 'Uniswap V3',
128
+ ],
129
+ [
130
+ 'eip155:421614',
131
+ '0x101F443B4d1b059569D643917553c771E1b9663E',
132
+ 'Uniswap V3',
133
+ ],
134
+ [
135
+ 'eip155:97',
136
+ '0x9a489505a00cE272eAa5e07Dba6491314CaE3796',
137
+ 'PancakeSwap V3',
138
+ ],
139
+ ].map(([chain, router, app]) => ({
140
+ chainNamespace: chain,
141
+ allowedCalls: [],
142
+ swapRouters: [{ address: address(router), app }],
143
+ approvals: [{ spender: address(router), app }],
144
+ })),
145
+ },
146
+ {
147
+ constant: 'LENDING',
148
+ name: 'Lending',
149
+ chains: [
150
+ ...[
151
+ ['eip155:1', '0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2'],
152
+ ['eip155:8453', '0xA238Dd80C259a72e81d7e4664a9801593F98d1c5'],
153
+ ['eip155:42161', '0x794a61358D6845594F94dc1DB02A252b5b4814aD'],
154
+ ['eip155:56', '0x6807dc923806fE8Fd134338EABCA509979a7e0cB'],
155
+ ].map(([chainNamespace, pool]) => ({
156
+ chainNamespace,
157
+ allowedCalls: [
158
+ ...aave(address(pool)),
159
+ ...mainnetMarkets(chainNamespace).allowedCalls,
160
+ ],
161
+ approvals: [
162
+ { spender: address(pool), app: 'Aave V3' },
163
+ ...(mainnetMarkets(chainNamespace).approvals ?? []),
164
+ ],
165
+ })),
166
+ {
167
+ chainNamespace: 'eip155:11155111',
168
+ allowedCalls: aave(sepoliaPool),
169
+ approvals: [{ spender: sepoliaPool, app: 'Aave V3' }],
170
+ },
171
+ {
172
+ chainNamespace: 'eip155:421614',
173
+ allowedCalls: aave(arbitrumPool),
174
+ approvals: [{ spender: arbitrumPool, app: 'Aave V3' }],
175
+ },
176
+ {
177
+ chainNamespace: 'eip155:84532',
178
+ allowedCalls: [
179
+ ...aave(basePool),
180
+ ...market(moonUSDBC, 'Moonwell mUSDbC'),
181
+ ...market(moonWETH, 'Moonwell mWETH'),
182
+ {
183
+ target: address('0xC72ba45f2Ae134F21DAEb2b7B5fd5De0064Ee9bB'),
184
+ selector: 'enterMarkets(address[])',
185
+ app: 'Moonwell',
186
+ label: 'Enter markets',
187
+ },
188
+ ],
189
+ approvals: [
190
+ { spender: basePool, app: 'Aave V3' },
191
+ {
192
+ spender: moonUSDBC,
193
+ app: 'Moonwell mUSDbC',
194
+ token: address('0x4616975f7E6045FD9737e95bC527e9e14c727BD2'),
195
+ },
196
+ {
197
+ spender: moonWETH,
198
+ app: 'Moonwell mWETH',
199
+ token: address('0x663A6F02d547dFd639BF689FED298712f2FB69Fb'),
200
+ },
201
+ ],
202
+ },
203
+ {
204
+ chainNamespace: 'eip155:97',
205
+ allowedCalls: [
206
+ ...market(venusUSDT, 'Venus vUSDT'),
207
+ ...market(venusUSDC, 'Venus vUSDC'),
208
+ {
209
+ target: address('0x94d1820b2D1c7c7452A163983Dc888CEC546b77D'),
210
+ selector: 'enterMarkets(address[])',
211
+ app: 'Venus',
212
+ label: 'Enter markets',
213
+ },
214
+ ],
215
+ approvals: [
216
+ {
217
+ spender: venusUSDT,
218
+ app: 'Venus vUSDT',
219
+ token: address('0xA11c8D9DC9b66E209Ef60F0C8D969D3CD988782c'),
220
+ },
221
+ {
222
+ spender: venusUSDC,
223
+ app: 'Venus vUSDC',
224
+ token: address('0x16227D60f7a0e586C66B005219dfc887D13C9531'),
225
+ },
226
+ ],
227
+ },
228
+ ],
229
+ },
230
+ {
231
+ constant: 'STAKING',
232
+ name: 'Staking',
233
+ chains: [
234
+ {
235
+ chainNamespace: 'eip155:1',
236
+ allowedCalls: [
237
+ {
238
+ target: stETH,
239
+ selector: 'submit(address)',
240
+ maxValue: BigInt(0),
241
+ app: 'Lido',
242
+ label: 'Stake ETH (set an explicit value cap)',
243
+ },
244
+ {
245
+ target: wstETH,
246
+ selector: 'wrap(uint256)',
247
+ app: 'Lido wstETH',
248
+ label: 'Wrap stETH',
249
+ },
250
+ {
251
+ target: wstETH,
252
+ selector: 'unwrap(uint256)',
253
+ app: 'Lido wstETH',
254
+ label: 'Unwrap wstETH',
255
+ },
256
+ {
257
+ target: lidoQueue,
258
+ selector: 'requestWithdrawals(uint256[],address)',
259
+ pins: [{ arg: 1, expected: wallet }],
260
+ app: 'Lido withdrawal queue',
261
+ label: 'Request withdrawal',
262
+ },
263
+ {
264
+ target: lidoQueue,
265
+ selector: 'claimWithdrawals(uint256[],uint256[])',
266
+ app: 'Lido withdrawal queue',
267
+ label: 'Claim finalized withdrawals',
268
+ },
269
+ {
270
+ target: lidoQueue,
271
+ selector: 'claimWithdrawal(uint256)',
272
+ app: 'Lido withdrawal queue',
273
+ label: 'Claim finalized withdrawal',
274
+ },
275
+ {
276
+ target: address('0x858646372CC42E1A627fcE94aa7A7033e7CF075A'),
277
+ selector: 'depositIntoStrategy(address,address,uint256)',
278
+ app: 'EigenLayer',
279
+ label: 'Deposit into strategy (withdrawals not included)',
280
+ },
281
+ ],
282
+ approvals: [
283
+ { spender: wstETH, token: stETH, app: 'Lido wstETH' },
284
+ { spender: lidoQueue, token: stETH, app: 'Lido withdrawal queue' },
285
+ {
286
+ spender: address('0x858646372CC42E1A627fcE94aa7A7033e7CF075A'),
287
+ app: 'EigenLayer',
288
+ },
289
+ ],
290
+ },
291
+ {
292
+ chainNamespace: 'eip155:11155111',
293
+ allowedCalls: [
294
+ {
295
+ target: eigen,
296
+ selector: 'depositIntoStrategy(address,address,uint256)',
297
+ app: 'EigenLayer',
298
+ label: 'Deposit into strategy (withdrawals not included)',
299
+ },
300
+ ],
301
+ approvals: [{ spender: eigen, app: 'EigenLayer' }],
302
+ },
303
+ ],
304
+ },
305
+ { constant: 'PREDICTION', name: 'Prediction markets', chains: [] },
306
+ ];
307
+ //# sourceMappingURL=catalog.js.map
@@ -0,0 +1,5 @@
1
+ import type { AgenticPresets } from './types';
2
+ import { type PresetDefinition } from './catalog';
3
+ /** Not a public registration API. Tests inject fixtures; production uses the bundled catalog. */
4
+ export declare function buildPresetApi(catalog: readonly PresetDefinition[]): AgenticPresets;
5
+ export declare const agenticPresets: AgenticPresets;