@dxdao/aqua-sc
Version:
Utility pack from aqua-smartcontracts
41 lines (40 loc) • 1.82 kB
JavaScript
;
/*eslint-disable */
// @ts-nocheck
// Inspired by https://github.com/0xProject/protocol/tree/main/packages/contract-addresses
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
exports.__esModule = true;
exports.getContractAddressesForChainOrThrow = exports.ChainId = void 0;
var addresses = require("./addresses.json");
__exportStar(require("./typechain/index"), exports);
__exportStar(require("./encoders"), exports);
var ChainId;
(function (ChainId) {
ChainId[ChainId["rinkeby"] = 4] = "rinkeby";
ChainId[ChainId["xdai"] = 100] = "xdai";
})(ChainId = exports.ChainId || (exports.ChainId = {}));
/**
* Used to get addresses of contracts that have been deployed to either the
* Ethereum mainnet or a supported testnet. Throws if there are no known
* contracts deployed on the corresponding chain.
* @param chainId The desired chainId.
* @returns The set of addresses for contracts which have been deployed on the
* given chainId.
*/
function getContractAddressesForChainOrThrow(chainId) {
var chainToAddresses = addresses;
if (chainToAddresses[chainId] === undefined) {
throw new Error("Unknown chain id (" + chainId + "). No known aqua contracts have been deployed on this chain.");
}
return chainToAddresses[chainId];
}
exports.getContractAddressesForChainOrThrow = getContractAddressesForChainOrThrow;