@etherspot/prime-sdk
Version:
Etherspot Prime (Account Abstraction) SDK
26 lines (25 loc) • 921 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.EtherspotBundler = void 0;
const common_1 = require("../../common");
const constants_1 = require("../../network/constants");
class EtherspotBundler {
constructor(chainId, apiKey, bundlerUrl) {
if (!bundlerUrl) {
const networkConfig = (0, constants_1.getNetworkConfig)(chainId);
if (!networkConfig || networkConfig.bundler == '')
throw new common_1.Exception('No bundler url provided');
bundlerUrl = networkConfig.bundler;
}
if (apiKey) {
if (bundlerUrl.includes('?api-key='))
this.url = bundlerUrl + apiKey;
else
this.url = bundlerUrl + '?api-key=' + apiKey;
}
else
this.url = bundlerUrl;
this.apiKey = apiKey;
}
}
exports.EtherspotBundler = EtherspotBundler;