@dappnode/dappnodesdk
Version:
dappnodesdk is a tool to make the creation of new dappnode packages as simple as possible. It helps to initialize and publish in ethereum blockchain
31 lines • 992 B
JavaScript
import { ipfsVersion } from "./ipfsVersion.js";
import { ReleaseUploaderConnectionError } from "../errors.js";
/**
* Verify the IPFS connection
* @param ipfsProvider
*/
export async function verifyIpfsConnection(ipfsProvider) {
try {
await ipfsVersion(ipfsProvider);
}
catch (e) {
// On IPFS version 0.5 only POST methods are allowed
// Tolerate errors 405 to be more backwards compatible
if (e.message.includes("Method Not Allowed"))
return;
if (e.code === "ENOTFOUND") {
throw new ReleaseUploaderConnectionError({
ipfsProvider,
reason: "ENOTFOUND",
help: ipfsProvider === "dappnode" ? "Check your VPN connection" : undefined
});
}
else {
throw new ReleaseUploaderConnectionError({
ipfsProvider,
reason: e.message
});
}
}
}
//# sourceMappingURL=verifyConnection.js.map