UNPKG

@wuwei-labs/srsly

Version:

[![npm version](https://img.shields.io/npm/v/ts-sdk-example.svg)](https://www.npmjs.com/package/ts-sdk-example)

71 lines 5.18 kB
"use strict"; /** * This code was AUTOGENERATED using the codama library. * Please DO NOT EDIT THIS FILE, instead use visitors * to add features, then rerun codama to update it. * * @see https://github.com/codama-idl/codama */ Object.defineProperty(exports, "__esModule", { value: true }); exports.SRSLY_ERROR__RENTAL_STATE_EXISTS = exports.SRSLY_ERROR__RENTAL_IS_ACTIVE = exports.SRSLY_ERROR__INVALID_THREAD_CONTEXT = exports.SRSLY_ERROR__EXPECTED_DAILY_FREQUENCY = exports.SRSLY_ERROR__DEV_ONLY_FREQUENCY = exports.SRSLY_ERROR__CONTRACT_CLOSED = exports.SRSLY_ERROR__INSUFFICIENT_CANCELLATION_NOTICE = exports.SRSLY_ERROR__INVALID_SUB_PROFILE_INVALIDATOR = exports.SRSLY_ERROR__INVALID_PAYMENT_FREQUENCY = exports.SRSLY_ERROR__INVALID_RATE = exports.SRSLY_ERROR__FLEET_ALREADY_RENTED = exports.SRSLY_ERROR__INVALID_RATE_CALCULATION = exports.SRSLY_ERROR__INVALID_DURATION_MAXIMUM = exports.SRSLY_ERROR__INVALID_DURATION_MINIMUM = void 0; exports.getSrslyErrorMessage = getSrslyErrorMessage; exports.isSrslyError = isSrslyError; const kit_1 = require("@solana/kit"); const programs_1 = require("../programs"); /** InvalidDurationMinimum: Invalid duration minimum. Must be between 1 and the duration maximum. */ exports.SRSLY_ERROR__INVALID_DURATION_MINIMUM = 0x1770; // 6000 /** InvalidDurationMaximum: Invalid duration maximum. Must be greater than or equal to the duration minimum. */ exports.SRSLY_ERROR__INVALID_DURATION_MAXIMUM = 0x1771; // 6001 /** InvalidRateCalculation: The contract rate multiplied by duration exceeds the payment amount. */ exports.SRSLY_ERROR__INVALID_RATE_CALCULATION = 0x1772; // 6002 /** FleetAlreadyRented: Fleet is already rented (sub_profile is not empty). */ exports.SRSLY_ERROR__FLEET_ALREADY_RENTED = 0x1773; // 6003 /** InvalidRate: Contract rate must be greater than or equal to 0. */ exports.SRSLY_ERROR__INVALID_RATE = 0x1774; // 6004 /** InvalidPaymentFrequency: Invalid payment frequency. Must be one of: @hourly, @daily, @weekly, @monthly. */ exports.SRSLY_ERROR__INVALID_PAYMENT_FREQUENCY = 0x1775; // 6005 /** InvalidSubProfileInvalidator: Invalid sub_profile invalidator. */ exports.SRSLY_ERROR__INVALID_SUB_PROFILE_INVALIDATOR = 0x1776; // 6006 /** InsufficientCancellationNotice: Rental time remaining is less than minimum cancellation notice required. */ exports.SRSLY_ERROR__INSUFFICIENT_CANCELLATION_NOTICE = 0x1777; // 6007 /** ContractClosed: The contract is closed. */ exports.SRSLY_ERROR__CONTRACT_CLOSED = 0x1778; // 6008 /** DevOnlyFrequency: This frequency is only allowed in development. */ exports.SRSLY_ERROR__DEV_ONLY_FREQUENCY = 0x1779; // 6009 /** ExpectedDailyFrequency: Expected daily frequency but contract is set differently. */ exports.SRSLY_ERROR__EXPECTED_DAILY_FREQUENCY = 0x177a; // 6010 /** InvalidThreadContext: Thread has invalid context set. */ exports.SRSLY_ERROR__INVALID_THREAD_CONTEXT = 0x177b; // 6011 /** RentalIsActive: Rental is still active. */ exports.SRSLY_ERROR__RENTAL_IS_ACTIVE = 0x177c; // 6012 /** RentalStateExists: Rental reset requires rental state to not exist. */ exports.SRSLY_ERROR__RENTAL_STATE_EXISTS = 0x177d; // 6013 let srslyErrorMessages; if (process.env.NODE_ENV !== 'production') { srslyErrorMessages = { [exports.SRSLY_ERROR__CONTRACT_CLOSED]: `The contract is closed.`, [exports.SRSLY_ERROR__DEV_ONLY_FREQUENCY]: `This frequency is only allowed in development.`, [exports.SRSLY_ERROR__EXPECTED_DAILY_FREQUENCY]: `Expected daily frequency but contract is set differently.`, [exports.SRSLY_ERROR__FLEET_ALREADY_RENTED]: `Fleet is already rented (sub_profile is not empty).`, [exports.SRSLY_ERROR__INSUFFICIENT_CANCELLATION_NOTICE]: `Rental time remaining is less than minimum cancellation notice required.`, [exports.SRSLY_ERROR__INVALID_DURATION_MAXIMUM]: `Invalid duration maximum. Must be greater than or equal to the duration minimum.`, [exports.SRSLY_ERROR__INVALID_DURATION_MINIMUM]: `Invalid duration minimum. Must be between 1 and the duration maximum.`, [exports.SRSLY_ERROR__INVALID_PAYMENT_FREQUENCY]: `Invalid payment frequency. Must be one of: @hourly, @daily, @weekly, @monthly.`, [exports.SRSLY_ERROR__INVALID_RATE]: `Contract rate must be greater than or equal to 0.`, [exports.SRSLY_ERROR__INVALID_RATE_CALCULATION]: `The contract rate multiplied by duration exceeds the payment amount.`, [exports.SRSLY_ERROR__INVALID_SUB_PROFILE_INVALIDATOR]: `Invalid sub_profile invalidator.`, [exports.SRSLY_ERROR__INVALID_THREAD_CONTEXT]: `Thread has invalid context set.`, [exports.SRSLY_ERROR__RENTAL_IS_ACTIVE]: `Rental is still active.`, [exports.SRSLY_ERROR__RENTAL_STATE_EXISTS]: `Rental reset requires rental state to not exist.`, }; } function getSrslyErrorMessage(code) { if (process.env.NODE_ENV !== 'production') { return srslyErrorMessages[code]; } return 'Error message not available in production bundles.'; } function isSrslyError(error, transactionMessage, code) { return (0, kit_1.isProgramError)(error, transactionMessage, programs_1.SRSLY_PROGRAM_ADDRESS, code); } //# sourceMappingURL=srsly.js.map