fix: harden Base manifest recovery
This commit is contained in:
@@ -35,11 +35,20 @@ export function validatePublicManifest(manifest) {
|
||||
assertActors(manifest.actors);
|
||||
for (const field of optionalFields) if (Object.hasOwn(manifest, field)) assertPublicUrl(manifest[field], field);
|
||||
if (manifest.network === "baseSepolia") {
|
||||
if (Object.hasOwn(manifest, "rpcUrl") && new URL(manifest.rpcUrl).protocol !== "https:") {
|
||||
for (const field of ["rpcUrl", "explorerBaseUrl"]) {
|
||||
if (!Object.hasOwn(manifest, field)) throw new Error(`manifest baseSepolia is missing ${field}`);
|
||||
}
|
||||
if (new URL(manifest.rpcUrl).protocol !== "https:") {
|
||||
throw new Error("manifest Base Sepolia rpcUrl must use HTTPS");
|
||||
}
|
||||
if (Object.hasOwn(manifest, "explorerBaseUrl") && manifest.explorerBaseUrl !== "https://sepolia.basescan.org") {
|
||||
throw new Error("manifest Base Sepolia explorerBaseUrl must use BaseScan");
|
||||
if (manifest.explorerBaseUrl !== "https://sepolia.basescan.org") {
|
||||
throw new Error("manifest Base Sepolia explorerBaseUrl must use the BaseScan root");
|
||||
}
|
||||
if (manifest.actors.length !== 2 || manifest.actors[0].label !== "Presenter" || manifest.actors[1].label !== "Recipient") {
|
||||
throw new Error("manifest baseSepolia actors must contain exactly Presenter and Recipient");
|
||||
}
|
||||
if (manifest.owner.toLowerCase() !== manifest.actors[0].address.toLowerCase()) {
|
||||
throw new Error("manifest owner must be the Presenter");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user