@rhinestone/shared-configs 1.4.57 → 1.4.58
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.
- package/dist/scripts/generate.js +64 -0
- package/dist/src/abis/relayer.d.ts +1163 -0
- package/dist/src/abis/relayer.d.ts.map +1 -0
- package/dist/src/abis/relayer.js +1522 -0
- package/dist/src/abis/rhinestone.d.ts +4590 -0
- package/dist/src/abis/rhinestone.d.ts.map +1 -0
- package/dist/src/abis/rhinestone.js +4250 -0
- package/dist/src/generated/contracts.d.ts +6 -0
- package/dist/src/generated/contracts.d.ts.map +1 -0
- package/dist/src/generated/contracts.dev.d.ts +6 -0
- package/dist/src/generated/contracts.dev.d.ts.map +1 -0
- package/dist/src/generated/contracts.dev.js +276 -0
- package/dist/src/generated/contracts.js +276 -0
- package/dist/src/index.d.ts +7 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +21 -1
- package/dist/src/types.d.ts +2 -1
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/scripts/generate.js
CHANGED
|
@@ -129,6 +129,66 @@ function runJsonnet(yeetRoot) {
|
|
|
129
129
|
}
|
|
130
130
|
return JSON.parse(output);
|
|
131
131
|
}
|
|
132
|
+
const compactObject = (values) => {
|
|
133
|
+
return Object.fromEntries(Object.entries(values).filter((entry) => entry[1] !== undefined));
|
|
134
|
+
};
|
|
135
|
+
const mapWildcardDeployments = (deployments) => {
|
|
136
|
+
return compactObject({
|
|
137
|
+
addressBook: deployments.addressBook,
|
|
138
|
+
allocator: deployments.allocator,
|
|
139
|
+
caller: deployments.caller,
|
|
140
|
+
multiCaller: deployments.caller,
|
|
141
|
+
emissaryImpl: deployments.emissaryImpl,
|
|
142
|
+
intentExecutorImpl: deployments.intentExecutorImpl,
|
|
143
|
+
multicallAdapter: deployments.multicallAdapter,
|
|
144
|
+
multicallHandler: deployments.multicallHandler,
|
|
145
|
+
router: deployments.router,
|
|
146
|
+
routerImpl: deployments.routerImpl,
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
const mapChainDeployments = (deployments, external) => {
|
|
150
|
+
return compactObject({
|
|
151
|
+
acrossHandler: deployments.acrossHandler,
|
|
152
|
+
across7579Arbiter: deployments.acrossWith7579,
|
|
153
|
+
acrossMulticallArbiter: deployments.acrossWithMulticall,
|
|
154
|
+
ecoArbiter: deployments.ecoAdapter,
|
|
155
|
+
emissary: deployments.emissary,
|
|
156
|
+
intentExecutor: deployments.intentExecutor,
|
|
157
|
+
intentExecutorAdapter: deployments.intentExecutorAdapter,
|
|
158
|
+
paymaster: deployments.paymaster,
|
|
159
|
+
relayArbiter: deployments.relayAdapter,
|
|
160
|
+
samechainArbiter: deployments.samechain,
|
|
161
|
+
samechainAdapter: deployments.samechainAdapterArbiterImpl,
|
|
162
|
+
acrossBridge: external?.across?.spokepool,
|
|
163
|
+
spokepool: external?.across?.spokepool,
|
|
164
|
+
ecoPortal: external?.eco?.portal,
|
|
165
|
+
relayReceiver: external?.relay?.receiver,
|
|
166
|
+
relaySolver: external?.relay?.solver,
|
|
167
|
+
});
|
|
168
|
+
};
|
|
169
|
+
function renderContracts(legacyContracts, addrConfig) {
|
|
170
|
+
const merged = JSON.parse(JSON.stringify(legacyContracts));
|
|
171
|
+
const wildcardDeployments = addrConfig["*"]?.deployments ?? {};
|
|
172
|
+
const wildcardMapped = mapWildcardDeployments(wildcardDeployments);
|
|
173
|
+
merged["*"] = { ...merged["*"], ...wildcardMapped };
|
|
174
|
+
for (const [chainId, entry] of Object.entries(addrConfig)) {
|
|
175
|
+
if (chainId === "*")
|
|
176
|
+
continue;
|
|
177
|
+
const deployments = entry.deployments ?? {};
|
|
178
|
+
const mapped = mapChainDeployments(deployments, entry.external);
|
|
179
|
+
merged[chainId] = { ...merged[chainId], ...mapped };
|
|
180
|
+
}
|
|
181
|
+
return [
|
|
182
|
+
"// Auto-generated by scripts/generate.ts. Do not edit manually.",
|
|
183
|
+
'import type { Address } from "viem";',
|
|
184
|
+
"",
|
|
185
|
+
"type ContractAddresses = Record<string, Record<string, Address>>;",
|
|
186
|
+
`const contractAddresses: ContractAddresses = ${JSON.stringify(merged, null, 2)};`,
|
|
187
|
+
"",
|
|
188
|
+
"export { contractAddresses };",
|
|
189
|
+
"export type { ContractAddresses };",
|
|
190
|
+
].join("\n");
|
|
191
|
+
}
|
|
132
192
|
async function generate() {
|
|
133
193
|
const sharedConfigsRoot = node_path_1.default.resolve(process.cwd());
|
|
134
194
|
const yeetRoot = node_path_1.default.resolve(sharedConfigsRoot, "..");
|
|
@@ -144,6 +204,10 @@ async function generate() {
|
|
|
144
204
|
await (0, promises_1.writeFile)(node_path_1.default.join(configsDir, "oft.json"), `${JSON.stringify(output.oft, null, 2)}\n`);
|
|
145
205
|
await (0, promises_1.writeFile)(node_path_1.default.join(sharedConfigsRoot, "src", "chains.ts"), `${renderChains(output.chains, output.mainnets, output.testnets)}\n`);
|
|
146
206
|
await (0, promises_1.writeFile)(node_path_1.default.join(generatedDir, "networks.ts"), `${renderNetworks(output.networks)}\n`);
|
|
207
|
+
const addrPath = node_path_1.default.join(yeetRoot, "addr.json");
|
|
208
|
+
const addrConfig = JSON.parse((0, node_fs_1.readFileSync)(addrPath, "utf8"));
|
|
209
|
+
await (0, promises_1.writeFile)(node_path_1.default.join(generatedDir, "contracts.ts"), `${renderContracts(output.contracts, addrConfig)}\n`);
|
|
210
|
+
await (0, promises_1.writeFile)(node_path_1.default.join(generatedDir, "contracts.dev.ts"), `${renderContracts(output.contractsDev, addrConfig)}\n`);
|
|
147
211
|
}
|
|
148
212
|
generate().catch((err) => {
|
|
149
213
|
console.error(err);
|