chaingate
Version:
A complete TypeScript library for connecting to and making transactions on different blockchains
33 lines • 1.18 kB
JavaScript
// IMPROVE: Force to establish missing funds
export class NotEnoughFundsError extends Error {
missingFunds;
constructor(missingFunds) {
if (missingFunds) {
super(`Wallet does not have enough funds. ${missingFunds.baseAmount} ${missingFunds.baseSymbol} needed.`);
}
else {
super('Wallet does not have enough funds.');
}
this.missingFunds = missingFunds;
if (Error.captureStackTrace)
Error.captureStackTrace(this, NotEnoughFundsError);
this.name = this.constructor.name;
}
}
export class CannotDerive extends Error {
constructor() {
super('Derivation path are not supported (Are you using an imported private key?)');
if (Error.captureStackTrace)
Error.captureStackTrace(this, CannotDerive);
this.name = this.constructor.name;
}
}
export class CannotParseAmount extends Error {
constructor(amountStr) {
super(`Invalid amount: ${amountStr}`);
if (Error.captureStackTrace)
Error.captureStackTrace(this, CannotDerive);
this.name = this.constructor.name;
}
}
//# sourceMappingURL=errors.js.map