UNPKG

@accessprotocol/distributor

Version:

Access Protocol Distributor Library

150 lines (149 loc) 4.66 kB
export 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"; } } InsufficientUnlockedTokens.code = 6000; export 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."; } } InvalidProof.code = 6001; export 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"; } } ExceededMaxClaim.code = 6002; export 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"; } } MaxNodesExceeded.code = 6003; export 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"; } } Unauthorized.code = 6004; export 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"; } } OwnerMismatch.code = 6005; export 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"; } } ClawbackAlreadyClaimed.code = 6006; export 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"; } } SameAdmin.code = 6007; export 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"; } } ClaimExpired.code = 6008; export 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)"; } } ArithmeticError.code = 6009; export 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"; } } StartTimestampAfterEnd.code = 6010; export 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"; } } TimestampsNotInFuture.code = 6011; export 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; }