@0xsplits/splits-sdk
Version:
SDK for the 0xSplits protocol
198 lines • 9.57 kB
JavaScript
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.SaltRequired = exports.InvalidTotalAllocation = exports.InvalidDistributorFeePercentErrorV2 = exports.AccountNotFoundError = exports.InvalidConfigError = exports.MissingWalletClientError = exports.MissingDataClientError = exports.MissingPublicClientError = exports.TransactionFailedError = exports.InvalidAuthError = exports.InvalidArgumentError = exports.InvalidDistributorFeePercentError = exports.InvalidRecipientsError = exports.UnsupportedSubgraphChainIdError = exports.UnsupportedChainIdError = void 0;
var constants_1 = require("./constants");
var utils_1 = require("./utils");
// Manually setting the prototype in the constructor with setPrototypeOf fixes a typescript issue so that the
// unit tests can detect the error class
var UnsupportedChainIdError = /** @class */ (function (_super) {
__extends(UnsupportedChainIdError, _super);
function UnsupportedChainIdError(invalidChainId, supportedChains) {
var _this = _super.call(this, "Unsupported chain: ".concat(invalidChainId, ". Supported chains are: ").concat(supportedChains)) || this;
_this.name = 'UnsupportedChainIdError';
Object.setPrototypeOf(_this, UnsupportedChainIdError.prototype);
return _this;
}
return UnsupportedChainIdError;
}(Error));
exports.UnsupportedChainIdError = UnsupportedChainIdError;
var UnsupportedSubgraphChainIdError = /** @class */ (function (_super) {
__extends(UnsupportedSubgraphChainIdError, _super);
function UnsupportedSubgraphChainIdError() {
var _this = _super.call(this, "Unsupported subgraph chain. Supported subgraph chains are: ".concat(constants_1.SPLITS_SUBGRAPH_CHAIN_IDS)) || this;
_this.name = 'UnsupportedSubgraphChainIdError';
Object.setPrototypeOf(_this, UnsupportedSubgraphChainIdError.prototype);
return _this;
}
return UnsupportedSubgraphChainIdError;
}(Error));
exports.UnsupportedSubgraphChainIdError = UnsupportedSubgraphChainIdError;
var InvalidRecipientsError = /** @class */ (function (_super) {
__extends(InvalidRecipientsError, _super);
function InvalidRecipientsError(m) {
var _this = _super.call(this, m) || this;
_this.name = 'InvalidRecipientsError';
Object.setPrototypeOf(_this, InvalidRecipientsError.prototype);
return _this;
}
return InvalidRecipientsError;
}(Error));
exports.InvalidRecipientsError = InvalidRecipientsError;
var InvalidDistributorFeePercentError = /** @class */ (function (_super) {
__extends(InvalidDistributorFeePercentError, _super);
function InvalidDistributorFeePercentError(m) {
var _this = _super.call(this, m) || this;
_this.name = 'InvalidDistributorFeePercent';
Object.setPrototypeOf(_this, InvalidDistributorFeePercentError.prototype);
return _this;
}
return InvalidDistributorFeePercentError;
}(Error));
exports.InvalidDistributorFeePercentError = InvalidDistributorFeePercentError;
var InvalidArgumentError = /** @class */ (function (_super) {
__extends(InvalidArgumentError, _super);
function InvalidArgumentError(m) {
var _this = _super.call(this, m) || this;
_this.name = 'InvalidArgumentError';
Object.setPrototypeOf(_this, InvalidArgumentError.prototype);
return _this;
}
return InvalidArgumentError;
}(Error));
exports.InvalidArgumentError = InvalidArgumentError;
var InvalidAuthError = /** @class */ (function (_super) {
__extends(InvalidAuthError, _super);
function InvalidAuthError(m) {
var _this = _super.call(this, m) || this;
_this.name = 'InvalidAuthError';
Object.setPrototypeOf(_this, InvalidAuthError.prototype);
return _this;
}
return InvalidAuthError;
}(Error));
exports.InvalidAuthError = InvalidAuthError;
var TransactionFailedError = /** @class */ (function (_super) {
__extends(TransactionFailedError, _super);
function TransactionFailedError(m) {
var _this = _super.call(this, m) || this;
_this.name = 'TransactionFailedError';
Object.setPrototypeOf(_this, TransactionFailedError.prototype);
return _this;
}
return TransactionFailedError;
}(Error));
exports.TransactionFailedError = TransactionFailedError;
var MissingPublicClientError = /** @class */ (function (_super) {
__extends(MissingPublicClientError, _super);
function MissingPublicClientError(m) {
var _this = _super.call(this, m) || this;
_this.name = 'MissingPublicClientError';
Object.setPrototypeOf(_this, MissingPublicClientError.prototype);
return _this;
}
return MissingPublicClientError;
}(Error));
exports.MissingPublicClientError = MissingPublicClientError;
var MissingDataClientError = /** @class */ (function (_super) {
__extends(MissingDataClientError, _super);
function MissingDataClientError(m) {
var _this = _super.call(this, m) || this;
_this.name = 'MissingDataClientError';
Object.setPrototypeOf(_this, MissingDataClientError.prototype);
return _this;
}
return MissingDataClientError;
}(Error));
exports.MissingDataClientError = MissingDataClientError;
var MissingWalletClientError = /** @class */ (function (_super) {
__extends(MissingWalletClientError, _super);
function MissingWalletClientError(m) {
var _this = _super.call(this, m) || this;
_this.name = 'MissingWalletClientError';
Object.setPrototypeOf(_this, MissingWalletClientError.prototype);
return _this;
}
return MissingWalletClientError;
}(Error));
exports.MissingWalletClientError = MissingWalletClientError;
var InvalidConfigError = /** @class */ (function (_super) {
__extends(InvalidConfigError, _super);
function InvalidConfigError(m) {
var _this = _super.call(this, m) || this;
_this.name = 'InvalidConfigError';
Object.setPrototypeOf(_this, InvalidConfigError.prototype);
return _this;
}
return InvalidConfigError;
}(Error));
exports.InvalidConfigError = InvalidConfigError;
var AccountNotFoundError = /** @class */ (function (_super) {
__extends(AccountNotFoundError, _super);
function AccountNotFoundError(moduleType, address, chainId) {
var _this = this;
var message = "No ".concat(moduleType, " found at address ").concat(address, " on chain ").concat(chainId, ", please confirm you have entered the correct address. There may just be a delay in subgraph indexing.");
_this = _super.call(this, message) || this;
_this.name = 'AccountNotFoundError';
Object.setPrototypeOf(_this, AccountNotFoundError.prototype);
return _this;
}
return AccountNotFoundError;
}(Error));
exports.AccountNotFoundError = AccountNotFoundError;
var InvalidDistributorFeePercentErrorV2 = /** @class */ (function (_super) {
__extends(InvalidDistributorFeePercentErrorV2, _super);
function InvalidDistributorFeePercentErrorV2(distributorFeePercent) {
var _this = this;
var message = "Distributor Fee ".concat(distributorFeePercent, " should be less than ").concat(utils_1.MAX_V2_DISTRIBUTION_INCENTIVE);
_this = _super.call(this, message) || this;
_this.name = 'InvalidDistributorFeePercentErrorV2';
Object.setPrototypeOf(_this, InvalidDistributorFeePercentErrorV2.prototype);
return _this;
}
return InvalidDistributorFeePercentErrorV2;
}(Error));
exports.InvalidDistributorFeePercentErrorV2 = InvalidDistributorFeePercentErrorV2;
var InvalidTotalAllocation = /** @class */ (function (_super) {
__extends(InvalidTotalAllocation, _super);
function InvalidTotalAllocation(totalAllocationPercent) {
var _this = this;
var message = totalAllocationPercent
? "Specified total allocation ".concat(totalAllocationPercent, " should be the sum of all of recipient allocations")
: "Total allocation of all the recipients should be equal to 100";
_this = _super.call(this, message) || this;
_this.name = 'InvalidTotalAllocation';
Object.setPrototypeOf(_this, InvalidTotalAllocation.prototype);
return _this;
}
return InvalidTotalAllocation;
}(Error));
exports.InvalidTotalAllocation = InvalidTotalAllocation;
var SaltRequired = /** @class */ (function (_super) {
__extends(SaltRequired, _super);
function SaltRequired() {
var _this = this;
var message = "Salt required";
_this = _super.call(this, message) || this;
_this.name = 'SaltRequired';
Object.setPrototypeOf(_this, SaltRequired.prototype);
return _this;
}
return SaltRequired;
}(Error));
exports.SaltRequired = SaltRequired;
//# sourceMappingURL=errors.js.map