@rhinestone/shared-configs 1.4.63 → 1.4.65

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 (48) hide show
  1. package/dist/configs/chains.json +598 -0
  2. package/dist/configs/mainnets.json +56 -0
  3. package/dist/configs/oft.json +31 -0
  4. package/dist/configs/providers.json +69 -0
  5. package/dist/configs/testnets.json +27 -0
  6. package/dist/scripts/generate-abis.d.ts +2 -0
  7. package/dist/scripts/generate-abis.d.ts.map +1 -0
  8. package/dist/scripts/generate-abis.js +150 -0
  9. package/dist/scripts/generate.d.ts +2 -0
  10. package/dist/scripts/generate.d.ts.map +1 -0
  11. package/dist/scripts/generate.js +371 -0
  12. package/dist/src/abis/index.d.ts +3 -0
  13. package/dist/src/abis/index.d.ts.map +1 -0
  14. package/dist/src/abis/index.js +28 -0
  15. package/dist/src/abis/optimized.d.ts +334 -0
  16. package/dist/src/abis/optimized.d.ts.map +1 -0
  17. package/dist/src/abis/optimized.js +384 -0
  18. package/dist/src/abis/orchestrator.d.ts +4590 -0
  19. package/dist/src/abis/orchestrator.d.ts.map +1 -0
  20. package/dist/src/abis/orchestrator.js +5978 -0
  21. package/dist/src/abis/relayer.d.ts +1163 -0
  22. package/dist/src/abis/relayer.d.ts.map +1 -0
  23. package/dist/src/abis/relayer.js +1522 -0
  24. package/dist/src/chains.d.ts +28 -0
  25. package/dist/src/chains.d.ts.map +1 -0
  26. package/dist/src/chains.js +653 -0
  27. package/dist/src/generated/abis.d.ts +4 -0
  28. package/dist/src/generated/abis.d.ts.map +1 -0
  29. package/dist/src/generated/abis.js +6 -0
  30. package/dist/src/generated/contracts.d.ts +6 -0
  31. package/dist/src/generated/contracts.d.ts.map +1 -0
  32. package/dist/src/generated/contracts.dev.d.ts +6 -0
  33. package/dist/src/generated/contracts.dev.d.ts.map +1 -0
  34. package/dist/src/generated/contracts.dev.js +5 -0
  35. package/dist/src/generated/contracts.js +5 -0
  36. package/dist/src/generated/networks.d.ts +3736 -0
  37. package/dist/src/generated/networks.d.ts.map +1 -0
  38. package/dist/src/generated/networks.js +39 -0
  39. package/dist/src/index.d.ts +14 -0
  40. package/dist/src/index.d.ts.map +1 -0
  41. package/dist/src/index.js +52 -0
  42. package/dist/src/oft.d.ts +20 -0
  43. package/dist/src/oft.d.ts.map +1 -0
  44. package/dist/src/oft.js +38 -0
  45. package/dist/src/types.d.ts +48 -0
  46. package/dist/src/types.d.ts.map +1 -0
  47. package/dist/src/types.js +10 -0
  48. package/package.json +1 -1
@@ -0,0 +1,69 @@
1
+ {
2
+ "Alchemy": {
3
+ "chain_mapping": {
4
+ "1": "eth-mainnet",
5
+ "10": "opt-mainnet",
6
+ "100": "gnosis-mainnet",
7
+ "137": "polygon-mainnet",
8
+ "146": "sonic-mainnet",
9
+ "1868": "soneium-mainnet",
10
+ "8453": "base-mainnet",
11
+ "9745": "plasma-mainnet",
12
+ "9746": "plasma-testnet",
13
+ "42161": "arb-mainnet",
14
+ "84532": "base-sepolia",
15
+ "421614": "arb-sepolia",
16
+ "11155111": "eth-sepolia",
17
+ "11155420": "opt-sepolia"
18
+ },
19
+ "url_template": "https://{{chain_param}}.g.alchemy.com/v2/${ALCHEMY_API_KEY}"
20
+ },
21
+ "DRPC": {
22
+ "chain_mapping": {
23
+ "1": "ethereum",
24
+ "10": "optimism",
25
+ "100": "gnosis",
26
+ "137": "polygon",
27
+ "146": "sonic",
28
+ "1868": "soneium",
29
+ "8453": "base",
30
+ "9745": "plasma",
31
+ "9746": "plasma-testnet",
32
+ "42161": "arbitrum",
33
+ "84532": "base-sepolia",
34
+ "421614": "arbitrum-sepolia",
35
+ "11155111": "sepolia",
36
+ "11155420": "optimism-sepolia"
37
+ },
38
+ "url_template": "https://lb.drpc.org/ogrpc?network={{chain_param}}&dkey=${DRPC_API_KEY}"
39
+ },
40
+ "eRPC": {
41
+ "chain_mapping": {
42
+ "1": "1",
43
+ "10": "10",
44
+ "100": "100",
45
+ "137": "137",
46
+ "146": "146",
47
+ "1868": "1868",
48
+ "8453": "8453",
49
+ "9745": "9745",
50
+ "9746": "9746",
51
+ "42161": "42161",
52
+ "84532": "84532",
53
+ "421614": "421614",
54
+ "11155111": "11155111",
55
+ "11155420": "11155420"
56
+ },
57
+ "url_template": "https://v1.orchestrator.rhinestone.dev/rpc-proxy/main/evm/{{chain_param}}"
58
+ },
59
+ "local-rpc": {
60
+ "chain_mapping": {
61
+ "1": "30001",
62
+ "137": "30004",
63
+ "146": "30005",
64
+ "8453": "30003",
65
+ "42161": "30002"
66
+ },
67
+ "url_template": "http://localhost:{{chain_param}}"
68
+ }
69
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "9746": {
3
+ "providers": [
4
+ "Alchemy"
5
+ ]
6
+ },
7
+ "84532": {
8
+ "providers": [
9
+ "DRPC"
10
+ ]
11
+ },
12
+ "421614": {
13
+ "providers": [
14
+ "DRPC"
15
+ ]
16
+ },
17
+ "11155111": {
18
+ "providers": [
19
+ "DRPC"
20
+ ]
21
+ },
22
+ "11155420": {
23
+ "providers": [
24
+ "DRPC"
25
+ ]
26
+ }
27
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=generate-abis.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-abis.d.ts","sourceRoot":"","sources":["../../scripts/generate-abis.ts"],"names":[],"mappings":""}
@@ -0,0 +1,150 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const node_fs_1 = require("node:fs");
7
+ const node_path_1 = __importDefault(require("node:path"));
8
+ const ABIS_SOURCE_DIR = node_path_1.default.join(process.cwd(), "abis-source");
9
+ const ABIS_OUTPUT_DIR = node_path_1.default.join(process.cwd(), "src", "abis");
10
+ const ABI_CONFIGS = [
11
+ {
12
+ outputFile: "orchestrator.ts",
13
+ comment: "Auto-generated from orchestrator ABIs. Do not edit manually.",
14
+ abis: [
15
+ { name: "routerAbi", sourceFile: "router.json" },
16
+ { name: "routerHelperAbi", sourceFile: "routerHelper.json" },
17
+ { name: "emissaryAbi", sourceFile: "emissary.json" },
18
+ { name: "intentExecutorAbi", sourceFile: "intentExecutor.json" },
19
+ { name: "acrossAdapterAbi", sourceFile: "acrossAdapter.json" },
20
+ { name: "ecoAdapterAbi", sourceFile: "ecoAdapter.json" },
21
+ { name: "relayAdapterAbi", sourceFile: "relayAdapter.json" },
22
+ { name: "sameChainAdapterAbi", sourceFile: "sameChainAdapter.json" },
23
+ { name: "intentExecutorAdapterAbi", sourceFile: "intentExecutorAdapter.json" },
24
+ { name: "multicallAbi", sourceFile: "multicall.json" },
25
+ { name: "multicallHandlerAbi", sourceFile: "multicallHandler.json" },
26
+ { name: "acrossAdapterOptimizedAbi", sourceFile: "acrossAdapterOptimized.json", satisfiesAbi: false },
27
+ { name: "routeTupleAbi", sourceFile: "routeTuple.json", satisfiesAbi: false },
28
+ { name: "rewardTupleAbi", sourceFile: "rewardTuple.json", satisfiesAbi: false },
29
+ { name: "ecoAdapterOptimizedAbi", sourceFile: "ecoAdapterOptimized.json", satisfiesAbi: false },
30
+ { name: "relayAdapterOptimizedAbi", sourceFile: "relayAdapterOptimized.json", satisfiesAbi: false },
31
+ ],
32
+ },
33
+ {
34
+ outputFile: "relayer.ts",
35
+ comment: "Auto-generated from relayer ABIs. Do not edit manually.",
36
+ abis: [
37
+ { name: "relayerPotV1Abi", sourceFile: "relayerPotV1.json" },
38
+ { name: "wethAbi", sourceFile: "weth.json" },
39
+ { name: "singleCallAbi", sourceFile: "singleCall.json" },
40
+ { name: "multiCallAbi", sourceFile: "relayerMultiCall.json" },
41
+ { name: "directRouteAbi", sourceFile: "directRoute.json" },
42
+ ],
43
+ },
44
+ ];
45
+ function formatAbiAsTypeScript(abi) {
46
+ const json = JSON.stringify(abi, null, 2);
47
+ return json.replace(/"([^"]+)":/g, "$1:").replace(/"/g, "'");
48
+ }
49
+ function generateAbiFile(config) {
50
+ const lines = [
51
+ `// ${config.comment}`,
52
+ 'import type { Abi } from "viem";',
53
+ "",
54
+ ];
55
+ for (const abiDef of config.abis) {
56
+ const sourceFile = node_path_1.default.join(ABIS_SOURCE_DIR, abiDef.sourceFile);
57
+ if (!(0, node_fs_1.existsSync)(sourceFile)) {
58
+ console.warn(`Warning: Source file not found: ${sourceFile}`);
59
+ continue;
60
+ }
61
+ const abiJson = JSON.parse((0, node_fs_1.readFileSync)(sourceFile, "utf8"));
62
+ const abi = Array.isArray(abiJson) ? abiJson : abiJson.abi;
63
+ if (!abi) {
64
+ console.warn(`Warning: No ABI found in ${sourceFile}`);
65
+ continue;
66
+ }
67
+ const formattedAbi = formatAbiAsTypeScript(abi);
68
+ const typeAnnotation = abiDef.satisfiesAbi === false ? "as const" : "as const satisfies Abi";
69
+ lines.push(`export const ${abiDef.name} = ${formattedAbi} ${typeAnnotation};`);
70
+ lines.push("");
71
+ }
72
+ const outputFile = node_path_1.default.join(ABIS_OUTPUT_DIR, config.outputFile);
73
+ (0, node_fs_1.writeFileSync)(outputFile, lines.join("\n"));
74
+ console.log(`Generated: ${outputFile}`);
75
+ }
76
+ function extractExistingAbis() {
77
+ console.log("Extracting existing ABIs to JSON source files...");
78
+ if (!(0, node_fs_1.existsSync)(ABIS_SOURCE_DIR)) {
79
+ (0, node_fs_1.mkdirSync)(ABIS_SOURCE_DIR, { recursive: true });
80
+ }
81
+ for (const config of ABI_CONFIGS) {
82
+ const sourceFile = node_path_1.default.join(ABIS_OUTPUT_DIR, config.outputFile);
83
+ if (!(0, node_fs_1.existsSync)(sourceFile)) {
84
+ console.warn(`Source TypeScript file not found: ${sourceFile}`);
85
+ continue;
86
+ }
87
+ const content = (0, node_fs_1.readFileSync)(sourceFile, "utf8");
88
+ for (const abiDef of config.abis) {
89
+ let startPattern = `export const ${abiDef.name}= [`;
90
+ let startIndex = content.indexOf(startPattern);
91
+ let prefixLen = `export const ${abiDef.name}= `.length;
92
+ if (startIndex === -1) {
93
+ startPattern = `export const ${abiDef.name} = [`;
94
+ startIndex = content.indexOf(startPattern);
95
+ prefixLen = `export const ${abiDef.name} = `.length;
96
+ }
97
+ if (startIndex === -1) {
98
+ console.warn(`Could not find ${abiDef.name} in ${config.outputFile}`);
99
+ continue;
100
+ }
101
+ const arrayStart = startIndex + prefixLen;
102
+ let depth = 0;
103
+ let endIndex = arrayStart;
104
+ for (let i = arrayStart; i < content.length; i++) {
105
+ const char = content[i];
106
+ if (char === "[" || char === "{")
107
+ depth++;
108
+ else if (char === "]" || char === "}") {
109
+ depth--;
110
+ if (depth === 0) {
111
+ endIndex = i + 1;
112
+ break;
113
+ }
114
+ }
115
+ }
116
+ const abiStr = content.slice(arrayStart, endIndex);
117
+ try {
118
+ const jsonStr = abiStr
119
+ .replace(/'/g, '"')
120
+ .replace(/(\w+):/g, '"$1":')
121
+ .replace(/,(\s*[}\]])/g, "$1");
122
+ const abi = JSON.parse(jsonStr);
123
+ const outputPath = node_path_1.default.join(ABIS_SOURCE_DIR, abiDef.sourceFile);
124
+ (0, node_fs_1.writeFileSync)(outputPath, JSON.stringify(abi, null, 2));
125
+ console.log(`Extracted: ${abiDef.name} -> ${abiDef.sourceFile}`);
126
+ }
127
+ catch (e) {
128
+ console.error(`Failed to extract ${abiDef.name}:`, e);
129
+ }
130
+ }
131
+ }
132
+ }
133
+ function main() {
134
+ const args = process.argv.slice(2);
135
+ if (args.includes("--extract")) {
136
+ extractExistingAbis();
137
+ return;
138
+ }
139
+ if (!(0, node_fs_1.existsSync)(ABIS_SOURCE_DIR)) {
140
+ console.error(`Error: ABI source directory not found: ${ABIS_SOURCE_DIR}`);
141
+ console.log("Run with --extract first to create source files from existing ABIs.");
142
+ process.exit(1);
143
+ }
144
+ console.log("Generating ABI TypeScript files...");
145
+ for (const config of ABI_CONFIGS) {
146
+ generateAbiFile(config);
147
+ }
148
+ console.log("Done!");
149
+ }
150
+ main();
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=generate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../scripts/generate.ts"],"names":[],"mappings":""}
@@ -0,0 +1,371 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const node_child_process_1 = require("node:child_process");
7
+ const node_fs_1 = require("node:fs");
8
+ const promises_1 = require("node:fs/promises");
9
+ const node_os_1 = __importDefault(require("node:os"));
10
+ const node_path_1 = __importDefault(require("node:path"));
11
+ function renderNetworkEnum(name, entries) {
12
+ const lines = entries.map((entry) => ` ${entry.enumKey} = ${entry.viemChain}.id,`);
13
+ return `enum ${name} {\n${lines.join("\n")}\n}\n`;
14
+ }
15
+ function renderNetworks(networks) {
16
+ const imports = [];
17
+ const seen = new Set();
18
+ const addImport = (name) => {
19
+ if (!seen.has(name)) {
20
+ seen.add(name);
21
+ imports.push(name);
22
+ }
23
+ };
24
+ for (const entry of [...networks.mainnets, ...networks.testnets]) {
25
+ addImport(entry.viemChain);
26
+ }
27
+ const mainnetChains = networks.mainnets.map((entry) => entry.viemChain);
28
+ const testnetChains = networks.testnets.map((entry) => entry.viemChain);
29
+ const opStackLines = [];
30
+ for (const entry of networks.mainnets) {
31
+ if (entry.opStackKey) {
32
+ opStackLines.push(` MAINNET_${entry.opStackKey} = ${entry.viemChain}.id,`);
33
+ }
34
+ }
35
+ for (const entry of networks.testnets) {
36
+ if (entry.opStackKey) {
37
+ opStackLines.push(` TESTNET_${entry.opStackKey} = ${entry.viemChain}.id,`);
38
+ }
39
+ }
40
+ return [
41
+ "// Auto-generated by scripts/generate.ts. Do not edit manually.",
42
+ "import {",
43
+ ...imports.map((name) => ` ${name},`),
44
+ '} from "viem/chains";',
45
+ "",
46
+ `const mainnetChains = [${mainnetChains.join(", ")}];`,
47
+ `const testnetChains = [${testnetChains.join(", ")}];`,
48
+ "const chains = [...mainnetChains, ...testnetChains];",
49
+ "",
50
+ renderNetworkEnum("MainnetNetwork", networks.mainnets).trimEnd(),
51
+ "",
52
+ renderNetworkEnum("TestnetNetwork", networks.testnets).trimEnd(),
53
+ "",
54
+ `enum OPStackChains {\n${opStackLines.join("\n")}\n}\n`.trimEnd(),
55
+ "",
56
+ "export {",
57
+ " mainnetChains,",
58
+ " testnetChains,",
59
+ " chains,",
60
+ " MainnetNetwork,",
61
+ " TestnetNetwork,",
62
+ " OPStackChains,",
63
+ "};",
64
+ ].join("\n");
65
+ }
66
+ function renderChains(chainRegistry, mainnets, testnets) {
67
+ const providersByChain = {
68
+ ...mainnets,
69
+ ...testnets,
70
+ };
71
+ const chains = {};
72
+ for (const [chainId, chainCfg] of Object.entries(chainRegistry)) {
73
+ const providers = providersByChain[chainId]?.providers ?? [];
74
+ chains[chainId] = {
75
+ ...chainCfg,
76
+ providers,
77
+ };
78
+ }
79
+ return [
80
+ "// Auto-generated by scripts/generate.ts. Do not edit manually.",
81
+ 'import type { Address } from "viem";',
82
+ 'import type { ProviderName, SettlementLayer, SupportedChain, SwapQuoter } from "./types";',
83
+ "",
84
+ "interface Token {",
85
+ " address: Address;",
86
+ " symbol?: string;",
87
+ " decimals?: number;",
88
+ " priceSymbol?: string;",
89
+ " balanceSlot: number | null;",
90
+ " approvalSlot: number | null;",
91
+ "}",
92
+ "",
93
+ "interface NativeToken {",
94
+ " address: Address;",
95
+ " symbol: string;",
96
+ " decimals: number;",
97
+ "}",
98
+ "",
99
+ "interface Chain {",
100
+ " name: string;",
101
+ " nativeToken: NativeToken;",
102
+ " wrappedNativeToken: NativeToken;",
103
+ " tokens: Token[];",
104
+ " settlementLayers: SettlementLayer[];",
105
+ " providers: ProviderName[];",
106
+ " swapQuoters: SwapQuoter[];",
107
+ "}",
108
+ "",
109
+ `const chains: Record<SupportedChain, Chain> = ${JSON.stringify(chains, null, 2)};`,
110
+ "",
111
+ "export { chains };",
112
+ "export type { Chain, Token, NativeToken };",
113
+ ].join("\n");
114
+ }
115
+ function runJsonnet(yeetRoot) {
116
+ const jsonnetFile = node_path_1.default.join("config", "shared-configs.jsonnet");
117
+ const jsonnetEth = node_path_1.default.join(yeetRoot, "bin", "jsonnet-eth");
118
+ let output = "";
119
+ if ((0, node_fs_1.existsSync)(jsonnetEth)) {
120
+ output = (0, node_child_process_1.execFileSync)(jsonnetEth, [jsonnetFile], {
121
+ cwd: yeetRoot,
122
+ encoding: "utf8",
123
+ });
124
+ }
125
+ else {
126
+ output = (0, node_child_process_1.execFileSync)("go", ["run", "./cmd/jsonnet-eth", jsonnetFile], {
127
+ cwd: yeetRoot,
128
+ encoding: "utf8",
129
+ });
130
+ }
131
+ return JSON.parse(output);
132
+ }
133
+ const compactObject = (values) => {
134
+ return Object.fromEntries(Object.entries(values).filter((entry) => entry[1] !== undefined));
135
+ };
136
+ const collectNullKeys = (values) => Object.keys(values).filter((key) => values[key] === null);
137
+ const stripNulls = (values) => Object.fromEntries(Object.entries(values).filter(([, value]) => value !== null));
138
+ const applyOverrides = (base, overrideWildcard, override) => {
139
+ const merged = {
140
+ ...base,
141
+ ...stripNulls(overrideWildcard),
142
+ ...stripNulls(override),
143
+ };
144
+ for (const key of [
145
+ ...collectNullKeys(overrideWildcard),
146
+ ...collectNullKeys(override),
147
+ ]) {
148
+ delete merged[key];
149
+ }
150
+ return merged;
151
+ };
152
+ const mergeContracts = (base, overrides) => {
153
+ const merged = {};
154
+ const overrideWildcard = overrides["*"] ?? {};
155
+ for (const [chainId, entries] of Object.entries(base)) {
156
+ if (chainId === "*") {
157
+ continue;
158
+ }
159
+ merged[chainId] = applyOverrides(entries, overrideWildcard, overrides[chainId] ?? {});
160
+ }
161
+ for (const [chainId, entries] of Object.entries(overrides)) {
162
+ if (chainId === "*") {
163
+ continue;
164
+ }
165
+ if (!merged[chainId]) {
166
+ merged[chainId] = applyOverrides({}, overrideWildcard, entries);
167
+ }
168
+ }
169
+ const baseWildcard = base["*"] ?? {};
170
+ if (Object.keys(baseWildcard).length > 0 ||
171
+ Object.keys(overrideWildcard).length > 0) {
172
+ merged["*"] = applyOverrides(baseWildcard, overrideWildcard, {});
173
+ }
174
+ return merged;
175
+ };
176
+ const loadContractOverrides = (sharedConfigsRoot) => {
177
+ const overridesPath = node_path_1.default.join(sharedConfigsRoot, "src", "contracts.overrides.json");
178
+ if (!(0, node_fs_1.existsSync)(overridesPath)) {
179
+ return {};
180
+ }
181
+ const raw = (0, node_fs_1.readFileSync)(overridesPath, "utf8");
182
+ return JSON.parse(raw);
183
+ };
184
+ const mapWildcardDeployments = (deployments) => {
185
+ return compactObject({
186
+ addressBook: deployments.addressBook,
187
+ allocator: deployments.allocator,
188
+ caller: deployments.caller,
189
+ multiCaller: deployments.caller,
190
+ emissary: deployments.emissary,
191
+ emissaryImpl: deployments.emissaryImpl,
192
+ intentExecutor: deployments.intentExecutor,
193
+ intentExecutorImpl: deployments.intentExecutorImpl,
194
+ intentExecutorAdapter: deployments.intentExecutorAdapter,
195
+ intentExecutorAdapterGasRefund: deployments.intentExecutorAdapterGasRefund,
196
+ multicallAdapter: deployments.multicallAdapter,
197
+ multicallHandler: deployments.multicallHandler,
198
+ ecoHandler: deployments.multicallHandler,
199
+ paymaster: deployments.paymaster,
200
+ relayerPot: deployments.relayerPotV0AndV1 ?? deployments.relayerPot,
201
+ router: deployments.router,
202
+ routerImpl: deployments.routerImpl,
203
+ samechainArbiter: deployments.samechain,
204
+ samechainAdapter: deployments.samechainAdapterArbiterImpl,
205
+ smartSessionEmissary: deployments.smartSessionEmissary,
206
+ smartSessionLens: deployments.smartSessionLens,
207
+ });
208
+ };
209
+ const mapChainDeployments = (deployments, external) => {
210
+ return compactObject({
211
+ acrossHandler: deployments.acrossHandler,
212
+ across7579Arbiter: deployments.acrossWith7579,
213
+ acrossMulticallArbiter: deployments.acrossWithMulticall,
214
+ relayerPot: deployments.relayerPotV0AndV1 ?? deployments.relayerPot,
215
+ ecoArbiter: deployments.ecoAdapter,
216
+ emissary: deployments.emissary,
217
+ intentExecutor: deployments.intentExecutor,
218
+ intentExecutorAdapter: deployments.intentExecutorAdapter,
219
+ paymaster: deployments.paymaster,
220
+ relayArbiter: deployments.relayAdapter,
221
+ samechainArbiter: deployments.samechain,
222
+ samechainAdapter: deployments.samechainAdapterArbiterImpl,
223
+ acrossBridge: external?.across?.spokepool,
224
+ spokepool: external?.across?.spokepool,
225
+ ecoPortal: external?.eco?.portal,
226
+ ecoHyperProver: external?.eco?.hyperProver,
227
+ ecoVaultAddress: external?.eco?.vault,
228
+ relayReceiver: external?.relay?.receiver,
229
+ relaySolver: external?.relay?.solver,
230
+ compact: external?.contracts?.compact,
231
+ permit2: external?.contracts?.permit2,
232
+ feeCollector: external?.contracts?.feeCollector,
233
+ });
234
+ };
235
+ function collectContracts(addrConfig) {
236
+ const merged = {};
237
+ const wildcardDeployments = addrConfig["*"]?.deployments ?? {};
238
+ const wildcardMapped = mapWildcardDeployments(wildcardDeployments);
239
+ if (Object.keys(wildcardMapped).length > 0) {
240
+ merged["*"] = wildcardMapped;
241
+ }
242
+ for (const [chainId, entry] of Object.entries(addrConfig)) {
243
+ if (chainId === "*")
244
+ continue;
245
+ const deployments = entry.deployments ?? {};
246
+ const mapped = mapChainDeployments(deployments, entry.external);
247
+ if (Object.keys(mapped).length > 0) {
248
+ merged[chainId] = mapped;
249
+ }
250
+ }
251
+ return merged;
252
+ }
253
+ function renderContracts(contracts) {
254
+ return [
255
+ "// Auto-generated by scripts/generate.ts. Do not edit manually.",
256
+ 'import type { Address } from "viem";',
257
+ "",
258
+ "type ContractAddresses = Record<string, Record<string, Address>>;",
259
+ `const contractAddresses: ContractAddresses = ${JSON.stringify(contracts, null, 2)};`,
260
+ "",
261
+ "export { contractAddresses };",
262
+ "export type { ContractAddresses };",
263
+ ].join("\n");
264
+ }
265
+ const SHARED_CHAIN_NAMES = [
266
+ "mainnet",
267
+ "optimism",
268
+ "base",
269
+ "arbitrum",
270
+ "polygon",
271
+ "soneium",
272
+ "sonic",
273
+ "plasma",
274
+ "gnosis",
275
+ "sepolia",
276
+ "optimism_sepolia",
277
+ "base_sepolia",
278
+ "arbitrum_sepolia",
279
+ "plasma_testnet",
280
+ ];
281
+ function runOrchestratorFile(yeetRoot, env) {
282
+ const recipe = node_path_1.default.join("core", "shared-configs.jsonnet");
283
+ const binary = node_path_1.default.join(yeetRoot, "bin", "yeet-orchestrator-file");
284
+ const useBinary = process.env.YEET_USE_BINARY === "1";
285
+ const tempDir = (0, node_fs_1.mkdtempSync)(node_path_1.default.join(node_os_1.default.tmpdir(), "yeet-shared-configs-"));
286
+ const chainsFile = node_path_1.default.join(tempDir, "chains.txt");
287
+ (0, node_fs_1.writeFileSync)(chainsFile, `${SHARED_CHAIN_NAMES.join("\n")}\n`);
288
+ const args = [
289
+ "--recipe",
290
+ recipe,
291
+ "--chains-from-file",
292
+ chainsFile,
293
+ "--dedup",
294
+ "--env",
295
+ env,
296
+ "--codegen",
297
+ ];
298
+ try {
299
+ const output = useBinary && (0, node_fs_1.existsSync)(binary)
300
+ ? (0, node_child_process_1.execFileSync)(binary, args, { cwd: yeetRoot, encoding: "utf8" })
301
+ : (0, node_child_process_1.execFileSync)("go", ["run", "./cmd/yeet-orchestrator-file", ...args], {
302
+ cwd: yeetRoot,
303
+ encoding: "utf8",
304
+ });
305
+ return JSON.parse(output);
306
+ }
307
+ finally {
308
+ (0, node_fs_1.rmSync)(tempDir, { force: true, recursive: true });
309
+ }
310
+ }
311
+ function collectAbiSignatures(addrConfig) {
312
+ const merged = {};
313
+ const wildcardAbis = addrConfig["*"]?.abis ?? {};
314
+ Object.assign(merged, wildcardAbis);
315
+ for (const [chainId, entry] of Object.entries(addrConfig)) {
316
+ if (chainId === "*")
317
+ continue;
318
+ if (!entry.abis)
319
+ continue;
320
+ for (const [name, abi] of Object.entries(entry.abis)) {
321
+ if (!merged[name]) {
322
+ merged[name] = abi;
323
+ }
324
+ }
325
+ }
326
+ return merged;
327
+ }
328
+ function renderAbiSignatures(abis) {
329
+ const ordered = Object.fromEntries(Object.keys(abis)
330
+ .sort()
331
+ .map((key) => [key, abis[key]]));
332
+ return [
333
+ "// Auto-generated by scripts/generate.ts. Do not edit manually.",
334
+ `const abiSignatures = ${JSON.stringify(ordered, null, 2)} as const;`,
335
+ "",
336
+ "export { abiSignatures };",
337
+ "export type AbiSignatureMap = typeof abiSignatures;",
338
+ ].join("\n");
339
+ }
340
+ async function generate() {
341
+ const sharedConfigsRoot = node_path_1.default.resolve(process.cwd());
342
+ const yeetRoot = node_path_1.default.resolve(sharedConfigsRoot, "..");
343
+ const configsDir = node_path_1.default.join(sharedConfigsRoot, "configs");
344
+ const generatedDir = node_path_1.default.join(sharedConfigsRoot, "src", "generated");
345
+ const output = runJsonnet(yeetRoot);
346
+ await (0, promises_1.mkdir)(configsDir, { recursive: true });
347
+ await (0, promises_1.mkdir)(generatedDir, { recursive: true });
348
+ await (0, promises_1.writeFile)(node_path_1.default.join(configsDir, "chains.json"), `${JSON.stringify(output.chains, null, 2)}\n`);
349
+ await (0, promises_1.writeFile)(node_path_1.default.join(configsDir, "mainnets.json"), `${JSON.stringify(output.mainnets, null, 2)}\n`);
350
+ await (0, promises_1.writeFile)(node_path_1.default.join(configsDir, "testnets.json"), `${JSON.stringify(output.testnets, null, 2)}\n`);
351
+ await (0, promises_1.writeFile)(node_path_1.default.join(configsDir, "providers.json"), `${JSON.stringify(output.providers, null, 2)}\n`);
352
+ await (0, promises_1.writeFile)(node_path_1.default.join(configsDir, "oft.json"), `${JSON.stringify(output.oft, null, 2)}\n`);
353
+ await (0, promises_1.writeFile)(node_path_1.default.join(sharedConfigsRoot, "src", "chains.ts"), `${renderChains(output.chains, output.mainnets, output.testnets)}\n`);
354
+ await (0, promises_1.writeFile)(node_path_1.default.join(generatedDir, "networks.ts"), `${renderNetworks(output.networks)}\n`);
355
+ const prodAddrConfig = runOrchestratorFile(yeetRoot, "prod");
356
+ const stagingAddrConfig = runOrchestratorFile(yeetRoot, "staging");
357
+ const abiSignatures = collectAbiSignatures(prodAddrConfig);
358
+ const prodContracts = collectContracts(prodAddrConfig);
359
+ const stagingContracts = collectContracts(stagingAddrConfig);
360
+ const overrides = loadContractOverrides(sharedConfigsRoot);
361
+ const prodContractsMerged = mergeContracts(prodContracts, overrides.prod ?? {});
362
+ const devOverrides = overrides.dev ?? overrides.staging ?? {};
363
+ const stagingContractsMerged = mergeContracts(stagingContracts, devOverrides);
364
+ await (0, promises_1.writeFile)(node_path_1.default.join(generatedDir, "contracts.ts"), `${renderContracts(prodContractsMerged)}\n`);
365
+ await (0, promises_1.writeFile)(node_path_1.default.join(generatedDir, "contracts.dev.ts"), `${renderContracts(stagingContractsMerged)}\n`);
366
+ await (0, promises_1.writeFile)(node_path_1.default.join(generatedDir, "abis.ts"), `${renderAbiSignatures(abiSignatures)}\n`);
367
+ }
368
+ generate().catch((err) => {
369
+ console.error(err);
370
+ process.exit(1);
371
+ });
@@ -0,0 +1,3 @@
1
+ export { routerAbi, routerHelperAbi, emissaryAbi, intentExecutorAbi, intentExecutorAdapterAbi, acrossAdapterAbi, ecoAdapterAbi, relayAdapterAbi, sameChainAdapterAbi, multicallAbi, multicallHandlerAbi, acrossAdapterOptimizedAbi, ecoAdapterOptimizedAbi, relayAdapterOptimizedAbi, routeTupleAbi, rewardTupleAbi, multicallAbi as multiCallAbi } from "./orchestrator";
2
+ export { directRouteAbi, wethAbi, relayerPotV1Abi, singleCallAbi, } from "./relayer";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/abis/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EACT,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,wBAAwB,EACxB,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,YAAY,EACZ,mBAAmB,EACnB,yBAAyB,EACzB,sBAAsB,EACtB,wBAAwB,EACxB,aAAa,EACb,cAAc,EACd,YAAY,IAAI,YAAY,EAC7B,MAAM,gBAAgB,CAAC;AAIxB,OAAO,EACL,cAAc,EACd,OAAO,EACP,eAAe,EACf,aAAa,GACd,MAAM,WAAW,CAAC"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.singleCallAbi = exports.relayerPotV1Abi = exports.wethAbi = exports.directRouteAbi = exports.multiCallAbi = exports.rewardTupleAbi = exports.routeTupleAbi = exports.relayAdapterOptimizedAbi = exports.ecoAdapterOptimizedAbi = exports.acrossAdapterOptimizedAbi = exports.multicallHandlerAbi = exports.multicallAbi = exports.sameChainAdapterAbi = exports.relayAdapterAbi = exports.ecoAdapterAbi = exports.acrossAdapterAbi = exports.intentExecutorAdapterAbi = exports.intentExecutorAbi = exports.emissaryAbi = exports.routerHelperAbi = exports.routerAbi = void 0;
4
+ // Re-export ABIs from orchestrator.ts
5
+ var orchestrator_1 = require("./orchestrator");
6
+ Object.defineProperty(exports, "routerAbi", { enumerable: true, get: function () { return orchestrator_1.routerAbi; } });
7
+ Object.defineProperty(exports, "routerHelperAbi", { enumerable: true, get: function () { return orchestrator_1.routerHelperAbi; } });
8
+ Object.defineProperty(exports, "emissaryAbi", { enumerable: true, get: function () { return orchestrator_1.emissaryAbi; } });
9
+ Object.defineProperty(exports, "intentExecutorAbi", { enumerable: true, get: function () { return orchestrator_1.intentExecutorAbi; } });
10
+ Object.defineProperty(exports, "intentExecutorAdapterAbi", { enumerable: true, get: function () { return orchestrator_1.intentExecutorAdapterAbi; } });
11
+ Object.defineProperty(exports, "acrossAdapterAbi", { enumerable: true, get: function () { return orchestrator_1.acrossAdapterAbi; } });
12
+ Object.defineProperty(exports, "ecoAdapterAbi", { enumerable: true, get: function () { return orchestrator_1.ecoAdapterAbi; } });
13
+ Object.defineProperty(exports, "relayAdapterAbi", { enumerable: true, get: function () { return orchestrator_1.relayAdapterAbi; } });
14
+ Object.defineProperty(exports, "sameChainAdapterAbi", { enumerable: true, get: function () { return orchestrator_1.sameChainAdapterAbi; } });
15
+ Object.defineProperty(exports, "multicallAbi", { enumerable: true, get: function () { return orchestrator_1.multicallAbi; } });
16
+ Object.defineProperty(exports, "multicallHandlerAbi", { enumerable: true, get: function () { return orchestrator_1.multicallHandlerAbi; } });
17
+ Object.defineProperty(exports, "acrossAdapterOptimizedAbi", { enumerable: true, get: function () { return orchestrator_1.acrossAdapterOptimizedAbi; } });
18
+ Object.defineProperty(exports, "ecoAdapterOptimizedAbi", { enumerable: true, get: function () { return orchestrator_1.ecoAdapterOptimizedAbi; } });
19
+ Object.defineProperty(exports, "relayAdapterOptimizedAbi", { enumerable: true, get: function () { return orchestrator_1.relayAdapterOptimizedAbi; } });
20
+ Object.defineProperty(exports, "routeTupleAbi", { enumerable: true, get: function () { return orchestrator_1.routeTupleAbi; } });
21
+ Object.defineProperty(exports, "rewardTupleAbi", { enumerable: true, get: function () { return orchestrator_1.rewardTupleAbi; } });
22
+ Object.defineProperty(exports, "multiCallAbi", { enumerable: true, get: function () { return orchestrator_1.multicallAbi; } });
23
+ // Relayer ABIs
24
+ var relayer_1 = require("./relayer");
25
+ Object.defineProperty(exports, "directRouteAbi", { enumerable: true, get: function () { return relayer_1.directRouteAbi; } });
26
+ Object.defineProperty(exports, "wethAbi", { enumerable: true, get: function () { return relayer_1.wethAbi; } });
27
+ Object.defineProperty(exports, "relayerPotV1Abi", { enumerable: true, get: function () { return relayer_1.relayerPotV1Abi; } });
28
+ Object.defineProperty(exports, "singleCallAbi", { enumerable: true, get: function () { return relayer_1.singleCallAbi; } });