@accessprotocol/distributor
Version:
Access Protocol Distributor Library
166 lines (165 loc) • 5.56 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TimestampsNotInFuture = exports.StartTimestampAfterEnd = exports.ArithmeticError = exports.ClaimExpired = exports.SameAdmin = exports.ClawbackAlreadyClaimed = exports.OwnerMismatch = exports.Unauthorized = exports.MaxNodesExceeded = exports.ExceededMaxClaim = exports.InvalidProof = exports.InsufficientUnlockedTokens = void 0;
exports.fromCode = fromCode;
class InsufficientUnlockedTokens extends Error {
constructor(logs) {
super("6000: Insufficient unlocked tokens");
this.logs = logs;
this.code = 6000;
this.name = "InsufficientUnlockedTokens";
this.msg = "Insufficient unlocked tokens";
}
}
exports.InsufficientUnlockedTokens = InsufficientUnlockedTokens;
InsufficientUnlockedTokens.code = 6000;
class InvalidProof extends Error {
constructor(logs) {
super("6001: Invalid Merkle proof.");
this.logs = logs;
this.code = 6001;
this.name = "InvalidProof";
this.msg = "Invalid Merkle proof.";
}
}
exports.InvalidProof = InvalidProof;
InvalidProof.code = 6001;
class ExceededMaxClaim extends Error {
constructor(logs) {
super("6002: Exceeded maximum claim amount");
this.logs = logs;
this.code = 6002;
this.name = "ExceededMaxClaim";
this.msg = "Exceeded maximum claim amount";
}
}
exports.ExceededMaxClaim = ExceededMaxClaim;
ExceededMaxClaim.code = 6002;
class MaxNodesExceeded extends Error {
constructor(logs) {
super("6003: Exceeded maximum node count");
this.logs = logs;
this.code = 6003;
this.name = "MaxNodesExceeded";
this.msg = "Exceeded maximum node count";
}
}
exports.MaxNodesExceeded = MaxNodesExceeded;
MaxNodesExceeded.code = 6003;
class Unauthorized extends Error {
constructor(logs) {
super("6004: Account is not authorized to execute this instruction");
this.logs = logs;
this.code = 6004;
this.name = "Unauthorized";
this.msg = "Account is not authorized to execute this instruction";
}
}
exports.Unauthorized = Unauthorized;
Unauthorized.code = 6004;
class OwnerMismatch extends Error {
constructor(logs) {
super("6005: Token account owner did not match intended owner");
this.logs = logs;
this.code = 6005;
this.name = "OwnerMismatch";
this.msg = "Token account owner did not match intended owner";
}
}
exports.OwnerMismatch = OwnerMismatch;
OwnerMismatch.code = 6005;
class ClawbackAlreadyClaimed extends Error {
constructor(logs) {
super("6006: Clawback already claimed");
this.logs = logs;
this.code = 6006;
this.name = "ClawbackAlreadyClaimed";
this.msg = "Clawback already claimed";
}
}
exports.ClawbackAlreadyClaimed = ClawbackAlreadyClaimed;
ClawbackAlreadyClaimed.code = 6006;
class SameAdmin extends Error {
constructor(logs) {
super("6007: New and old admin are identical");
this.logs = logs;
this.code = 6007;
this.name = "SameAdmin";
this.msg = "New and old admin are identical";
}
}
exports.SameAdmin = SameAdmin;
SameAdmin.code = 6007;
class ClaimExpired extends Error {
constructor(logs) {
super("6008: Claim window expired");
this.logs = logs;
this.code = 6008;
this.name = "ClaimExpired";
this.msg = "Claim window expired";
}
}
exports.ClaimExpired = ClaimExpired;
ClaimExpired.code = 6008;
class ArithmeticError extends Error {
constructor(logs) {
super("6009: Arithmetic Error (overflow/underflow)");
this.logs = logs;
this.code = 6009;
this.name = "ArithmeticError";
this.msg = "Arithmetic Error (overflow/underflow)";
}
}
exports.ArithmeticError = ArithmeticError;
ArithmeticError.code = 6009;
class StartTimestampAfterEnd extends Error {
constructor(logs) {
super("6010: Start Timestamp cannot be after end Timestamp");
this.logs = logs;
this.code = 6010;
this.name = "StartTimestampAfterEnd";
this.msg = "Start Timestamp cannot be after end Timestamp";
}
}
exports.StartTimestampAfterEnd = StartTimestampAfterEnd;
StartTimestampAfterEnd.code = 6010;
class TimestampsNotInFuture extends Error {
constructor(logs) {
super("6011: Timestamps cannot be in the past");
this.logs = logs;
this.code = 6011;
this.name = "TimestampsNotInFuture";
this.msg = "Timestamps cannot be in the past";
}
}
exports.TimestampsNotInFuture = TimestampsNotInFuture;
TimestampsNotInFuture.code = 6011;
function fromCode(code, logs) {
switch (code) {
case 6000:
return new InsufficientUnlockedTokens(logs);
case 6001:
return new InvalidProof(logs);
case 6002:
return new ExceededMaxClaim(logs);
case 6003:
return new MaxNodesExceeded(logs);
case 6004:
return new Unauthorized(logs);
case 6005:
return new OwnerMismatch(logs);
case 6006:
return new ClawbackAlreadyClaimed(logs);
case 6007:
return new SameAdmin(logs);
case 6008:
return new ClaimExpired(logs);
case 6009:
return new ArithmeticError(logs);
case 6010:
return new StartTimestampAfterEnd(logs);
case 6011:
return new TimestampsNotInFuture(logs);
}
return null;
}