@p2pdotme/sdk 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -0
- package/dist/country.cjs +4 -4
- package/dist/country.cjs.map +1 -1
- package/dist/country.d.cts +2 -2
- package/dist/country.d.ts +2 -2
- package/dist/country.mjs +4 -4
- package/dist/country.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/orders.cjs +691 -2
- package/dist/orders.cjs.map +1 -1
- package/dist/orders.d.cts +222 -1
- package/dist/orders.d.ts +222 -1
- package/dist/orders.mjs +685 -1
- package/dist/orders.mjs.map +1 -1
- package/dist/prices.cjs +424 -0
- package/dist/prices.cjs.map +1 -1
- package/dist/prices.mjs +424 -0
- package/dist/prices.mjs.map +1 -1
- package/dist/profile.cjs +424 -0
- package/dist/profile.cjs.map +1 -1
- package/dist/profile.mjs +424 -0
- package/dist/profile.mjs.map +1 -1
- package/dist/qr-parsers.cjs +82 -1
- package/dist/qr-parsers.cjs.map +1 -1
- package/dist/qr-parsers.mjs +82 -1
- package/dist/qr-parsers.mjs.map +1 -1
- package/dist/react.cjs +424 -0
- package/dist/react.cjs.map +1 -1
- package/dist/react.mjs +424 -0
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/orders.d.cts
CHANGED
|
@@ -358,6 +358,227 @@ interface OrdersClient {
|
|
|
358
358
|
*/
|
|
359
359
|
declare function createOrders(config: OrdersConfig): OrdersClient;
|
|
360
360
|
|
|
361
|
+
/**
|
|
362
|
+
* Centralized contract error definitions mirroring `contracts/libraries/Errors.sol`.
|
|
363
|
+
* Maps Solidity custom error names and their 4-byte selectors to human-readable codes.
|
|
364
|
+
*/
|
|
365
|
+
declare const contractErrors: {
|
|
366
|
+
readonly NotAdmin: "NOT_ADMIN";
|
|
367
|
+
readonly NotSuperAdmin: "NOT_SUPER_ADMIN";
|
|
368
|
+
readonly NotAuthorized: "NOT_AUTHORIZED";
|
|
369
|
+
readonly NotSelf: "NOT_SELF";
|
|
370
|
+
readonly NotWhitelisted: "NOT_WHITELISTED";
|
|
371
|
+
readonly NotCircleAdmin: "NOT_CIRCLE_ADMIN";
|
|
372
|
+
readonly InvalidName: "INVALID_NAME";
|
|
373
|
+
readonly InvalidCommunityUrl: "INVALID_COMMUNITY_URL";
|
|
374
|
+
readonly InvalidAdminCommunityUrl: "INVALID_ADMIN_COMMUNITY_URL";
|
|
375
|
+
readonly AdminAlreadyHasCircle: "ADMIN_ALREADY_HAS_CIRCLE";
|
|
376
|
+
readonly CircleNameAlreadyTaken: "CIRCLE_NAME_ALREADY_TAKEN";
|
|
377
|
+
readonly P2PStakeConfigNotSet: "P2P_STAKE_CONFIG_NOT_SET";
|
|
378
|
+
readonly InsufficientP2PStake: "INSUFFICIENT_P2P_STAKE";
|
|
379
|
+
readonly P2PTokenNotSet: "P2P_TOKEN_NOT_SET";
|
|
380
|
+
readonly P2PUnstakeRequestPending: "P2P_UNSTAKE_REQUEST_PENDING";
|
|
381
|
+
readonly NoP2PUnstakeRequest: "NO_P2P_UNSTAKE_REQUEST";
|
|
382
|
+
readonly P2PUnstakeCooldownNotPassed: "P2P_UNSTAKE_COOLDOWN_NOT_PASSED";
|
|
383
|
+
readonly SlashAmountExceedsStake: "SLASH_AMOUNT_EXCEEDS_STAKE";
|
|
384
|
+
readonly CircleNotActive: "CIRCLE_NOT_ACTIVE";
|
|
385
|
+
readonly InvalidCircleId: "INVALID_CIRCLE_ID";
|
|
386
|
+
readonly CurrencyMismatch: "CURRENCY_MISMATCH";
|
|
387
|
+
readonly CircleFull: "CIRCLE_FULL";
|
|
388
|
+
readonly CircleIdMismatch: "CIRCLE_ID_MISMATCH";
|
|
389
|
+
readonly DuplicateAccountName: "DUPLICATE_ACCOUNT_NAME";
|
|
390
|
+
readonly EmptyName: "EMPTY_NAME";
|
|
391
|
+
readonly AccountBoundToAnotherCircle: "ACCOUNT_BOUND_TO_ANOTHER_CIRCLE";
|
|
392
|
+
readonly ExitAmountExceededCircleBalance: "EXIT_AMOUNT_EXCEEDED_CIRCLE_BALANCE";
|
|
393
|
+
readonly UndelegationAmountTooHigh: "UNDELEGATION_AMOUNT_TOO_HIGH";
|
|
394
|
+
readonly ExchangeNotOperational: "EXCHANGE_NOT_OPERATIONAL";
|
|
395
|
+
readonly OrderNotPlaced: "ORDER_NOT_PLACED";
|
|
396
|
+
readonly OrderNotPaid: "ORDER_NOT_PAID";
|
|
397
|
+
readonly OrderStatusInvalid: "ORDER_STATUS_INVALID";
|
|
398
|
+
readonly OrderExpired: "ORDER_EXPIRED";
|
|
399
|
+
readonly OrderAlreadyPaid: "ORDER_ALREADY_PAID";
|
|
400
|
+
readonly OrderAlreadyCompleted: "ORDER_ALREADY_COMPLETED";
|
|
401
|
+
readonly InvalidOrderType: "INVALID_ORDER_TYPE";
|
|
402
|
+
readonly OrderTypeIncorrect: "ORDER_TYPE_INCORRECT";
|
|
403
|
+
readonly OrderNotAccepted: "ORDER_NOT_ACCEPTED";
|
|
404
|
+
readonly OrderNotAssigned: "ORDER_NOT_ASSIGNED";
|
|
405
|
+
readonly OrderAmountExceedsLimit: "ORDER_AMOUNT_EXCEEDS_LIMIT";
|
|
406
|
+
readonly InvalidOrderAmount: "INVALID_ORDER_AMOUNT";
|
|
407
|
+
readonly InvalidOrderAmountToCoverFee: "INVALID_ORDER_AMOUNT_TO_COVER_FEE";
|
|
408
|
+
readonly InvalidOrderId: "INVALID_ORDER_ID";
|
|
409
|
+
readonly OrderTooEarlyForReassignment: "ORDER_TOO_EARLY_FOR_REASSIGNMENT";
|
|
410
|
+
readonly OrderTooLateForReassignment: "ORDER_TOO_LATE_FOR_REASSIGNMENT";
|
|
411
|
+
readonly ReAssignmentNotRequired: "REASSIGNMENT_NOT_REQUIRED";
|
|
412
|
+
readonly TipAlreadyGiven: "TIP_ALREADY_GIVEN";
|
|
413
|
+
readonly CashbackTransferFailed: "CASHBACK_TRANSFER_FAILED";
|
|
414
|
+
readonly DailyBuyOrderLimitExceeded: "DAILY_BUY_ORDER_LIMIT_EXCEEDED";
|
|
415
|
+
readonly MonthlyBuyOrderLimitExceeded: "MONTHLY_BUY_ORDER_LIMIT_EXCEEDED";
|
|
416
|
+
readonly SellOrderAmountLimitExceeded: "SELL_ORDER_AMOUNT_LIMIT_EXCEEDED";
|
|
417
|
+
readonly BuyOrderAmountExceedsLimit: "BUY_ORDER_AMOUNT_EXCEEDS_LIMIT";
|
|
418
|
+
readonly SellOrderAmountExceedsLimit: "SELL_ORDER_AMOUNT_EXCEEDS_LIMIT";
|
|
419
|
+
readonly BuyAmountExceedsUsdcLimit: "BUY_AMOUNT_EXCEEDS_USDC_LIMIT";
|
|
420
|
+
readonly SellAmountExceedsFiatLimit: "SELL_AMOUNT_EXCEEDS_FIAT_LIMIT";
|
|
421
|
+
readonly DailyVolumeLimitExceeded: "DAILY_VOLUME_LIMIT_EXCEEDED";
|
|
422
|
+
readonly MonthlyVolumeLimitExceeded: "MONTHLY_VOLUME_LIMIT_EXCEEDED";
|
|
423
|
+
readonly UserYearlyVolumeLimitExceeded: "USER_YEARLY_VOLUME_LIMIT_EXCEEDED";
|
|
424
|
+
readonly DisputeTimeNotReached: "DISPUTE_TIME_NOT_REACHED";
|
|
425
|
+
readonly DisputeTimeExpired: "DISPUTE_TIME_EXPIRED";
|
|
426
|
+
readonly InvalidOrderStatusToRaiseDispute: "INVALID_ORDER_STATUS_TO_RAISE_DISPUTE";
|
|
427
|
+
readonly DisputeNotRaised: "DISPUTE_NOT_RAISED";
|
|
428
|
+
readonly CannotRaiseDisputeTwice: "CANNOT_RAISE_DISPUTE_TWICE";
|
|
429
|
+
readonly DisputeAlreadySettled: "DISPUTE_ALREADY_SETTLED";
|
|
430
|
+
readonly TransactionIdMismatch: "TRANSACTION_ID_MISMATCH";
|
|
431
|
+
readonly AccountNumberMismatch: "ACCOUNT_NUMBER_MISMATCH";
|
|
432
|
+
readonly NotPaidBuyOrder: "NOT_PAID_BUY_ORDER";
|
|
433
|
+
readonly PaymentChannelNotFound: "PAYMENT_CHANNEL_NOT_FOUND";
|
|
434
|
+
readonly PaymentChannelNotActive: "PAYMENT_CHANNEL_NOT_ACTIVE";
|
|
435
|
+
readonly PaymentChannelNotApproved: "PAYMENT_CHANNEL_NOT_APPROVED";
|
|
436
|
+
readonly PaymentChannelNotRejected: "PAYMENT_CHANNEL_NOT_REJECTED";
|
|
437
|
+
readonly InvalidPaymentChannelId: "INVALID_PAYMENT_CHANNEL_ID";
|
|
438
|
+
readonly DuplicatePaymentChannel: "DUPLICATE_PAYMENT_CHANNEL";
|
|
439
|
+
readonly OldPaymentChannelNotFound: "OLD_PAYMENT_CHANNEL_NOT_FOUND";
|
|
440
|
+
readonly NewPaymentChannelNotFound: "NEW_PAYMENT_CHANNEL_NOT_FOUND";
|
|
441
|
+
readonly SamePaymentChannel: "SAME_PAYMENT_CHANNEL";
|
|
442
|
+
readonly OldPaymentChannelShouldBeInactive: "OLD_PAYMENT_CHANNEL_SHOULD_BE_INACTIVE";
|
|
443
|
+
readonly NewPaymentChannelShouldBeActive: "NEW_PAYMENT_CHANNEL_SHOULD_BE_ACTIVE";
|
|
444
|
+
readonly OngoingOrderOnPaymentChannel: "ONGOING_ORDER_ON_PAYMENT_CHANNEL";
|
|
445
|
+
readonly UpiAlreadySent: "UPI_ALREADY_SENT";
|
|
446
|
+
readonly InvalidOrderUpi: "INVALID_ORDER_UPI";
|
|
447
|
+
readonly NoFiatLiquidity: "NO_FIAT_LIQUIDITY";
|
|
448
|
+
readonly NotEnoughEligibleMerchants: "NOT_ENOUGH_ELIGIBLE_MERCHANTS";
|
|
449
|
+
readonly MerchantNotRegistered: "MERCHANT_NOT_REGISTERED";
|
|
450
|
+
readonly MerchantNotApproved: "MERCHANT_NOT_APPROVED";
|
|
451
|
+
readonly MerchantAlreadyRegistered: "MERCHANT_ALREADY_REGISTERED";
|
|
452
|
+
readonly MerchantAlreadyRejected: "MERCHANT_ALREADY_REJECTED";
|
|
453
|
+
readonly MerchantBlacklisted: "MERCHANT_BLACKLISTED";
|
|
454
|
+
readonly MerchantNotBlacklisted: "MERCHANT_NOT_BLACKLISTED";
|
|
455
|
+
readonly MerchantAlreadyBlacklisted: "MERCHANT_ALREADY_BLACKLISTED";
|
|
456
|
+
readonly MerchantHasOngoingOrders: "MERCHANT_HAS_ONGOING_ORDERS";
|
|
457
|
+
readonly MerchantNotFullfilledEligibilityThreshold: "MERCHANT_NOT_FULLFILLED_ELIGIBILITY_THRESHOLD";
|
|
458
|
+
readonly InvalidMerchant: "INVALID_MERCHANT";
|
|
459
|
+
readonly StakeAmountTooLow: "STAKE_AMOUNT_TOO_LOW";
|
|
460
|
+
readonly AdditionalStakeNotAllowed: "ADDITIONAL_STAKE_NOT_ALLOWED";
|
|
461
|
+
readonly UnstakeRequestPending: "UNSTAKE_REQUEST_PENDING";
|
|
462
|
+
readonly UnstakeRequestNotPending: "UNSTAKE_REQUEST_NOT_PENDING";
|
|
463
|
+
readonly UnstakeAmountExceeded: "UNSTAKE_AMOUNT_EXCEEDED";
|
|
464
|
+
readonly ZeroUnstakeAmount: "ZERO_UNSTAKE_AMOUNT";
|
|
465
|
+
readonly NoWithdrawableAmount: "NO_WITHDRAWABLE_AMOUNT";
|
|
466
|
+
readonly NoStake: "NO_STAKE";
|
|
467
|
+
readonly NoStakers: "NO_STAKERS";
|
|
468
|
+
readonly InsufficientStakedAmount: "INSUFFICIENT_STAKED_AMOUNT";
|
|
469
|
+
readonly CooldownNotPassed: "COOLDOWN_NOT_PASSED";
|
|
470
|
+
readonly ClaimableRewardsNotAvailable: "CLAIMABLE_REWARDS_NOT_AVAILABLE";
|
|
471
|
+
readonly ExitWouldBreachDelegationInvariant: "EXIT_WOULD_BREACH_DELEGATION_INVARIANT";
|
|
472
|
+
readonly AggregateDelegationExceedsTotalStaked: "AGGREGATE_DELEGATION_EXCEEDS_TOTAL_STAKED";
|
|
473
|
+
readonly InsufficientMerchantRewards: "INSUFFICIENT_MERCHANT_REWARDS";
|
|
474
|
+
readonly InvalidMigrationStatus: "INVALID_MIGRATION_STATUS";
|
|
475
|
+
readonly MigrationRequestNotPending: "MIGRATION_REQUEST_NOT_PENDING";
|
|
476
|
+
readonly MigrationAlreadyRequested: "MIGRATION_ALREADY_REQUESTED";
|
|
477
|
+
readonly TokenAlreadyExists: "TOKEN_ALREADY_EXISTS";
|
|
478
|
+
readonly TokenNotFound: "TOKEN_NOT_FOUND";
|
|
479
|
+
readonly TokenEmpty: "TOKEN_EMPTY";
|
|
480
|
+
readonly CurrencyNotSupported: "CURRENCY_NOT_SUPPORTED";
|
|
481
|
+
readonly InvalidCurrency: "INVALID_CURRENCY";
|
|
482
|
+
readonly UsdtTransferFailed: "USDC_TRANSFER_FAILED";
|
|
483
|
+
readonly UsdtTransferFailedWithErrorMessage: "USDC_TRANSFER_FAILED_WITH_ERROR_MESSAGE";
|
|
484
|
+
readonly UsdtTransferFailedWithPanic: "USDC_TRANSFER_FAILED_WITH_PANIC";
|
|
485
|
+
readonly InsufficientAllowance: "INSUFFICIENT_ALLOWANCE";
|
|
486
|
+
readonly ZKPassportVerifierNotSet: "ZK_PASSPORT_VERIFIER_NOT_SET";
|
|
487
|
+
readonly ZKPassportDomainEmpty: "ZK_PASSPORT_DOMAIN_EMPTY";
|
|
488
|
+
readonly ZKPassportScopeEmpty: "ZK_PASSPORT_SCOPE_EMPTY";
|
|
489
|
+
readonly PassportAlreadyVerified: "PASSPORT_ALREADY_VERIFIED";
|
|
490
|
+
readonly ZKPassportProofInvalid: "ZK_PASSPORT_PROOF_INVALID";
|
|
491
|
+
readonly ZKPassportIdentifierAlreadyVerified: "ZK_PASSPORT_IDENTIFIER_ALREADY_VERIFIED";
|
|
492
|
+
readonly ZKPassportInvalidScope: "ZK_PASSPORT_INVALID_SCOPE";
|
|
493
|
+
readonly ZKPassportUnexpectedSender: "ZK_PASSPORT_UNEXPECTED_SENDER";
|
|
494
|
+
readonly ZKPassportAgeBelowMinimum: "ZK_PASSPORT_AGE_BELOW_MINIMUM";
|
|
495
|
+
readonly ZKPassportMinAgeTooHigh: "ZK_PASSPORT_MIN_AGE_TOO_HIGH";
|
|
496
|
+
readonly UnexpectedRequestId: "UNEXPECTED_REQUEST_ID";
|
|
497
|
+
readonly OnlyRouterCanFulfill: "ONLY_ROUTER_CAN_FULFILL";
|
|
498
|
+
readonly RequestFailed: "REQUEST_FAILED";
|
|
499
|
+
readonly SourceCodeMismatch: "SOURCE_CODE_MISMATCH";
|
|
500
|
+
readonly ZeroMarketPrice: "ZERO_MARKET_PRICE";
|
|
501
|
+
readonly InvalidComputedPrices: "INVALID_COMPUTED_PRICES";
|
|
502
|
+
readonly NotPriceUpdaterForCurrency: "NOT_PRICE_UPDATER_FOR_CURRENCY";
|
|
503
|
+
readonly ThresholdNotConfigured: "THRESHOLD_NOT_CONFIGURED";
|
|
504
|
+
readonly SlippageExceeded: "SLIPPAGE_EXCEEDED";
|
|
505
|
+
readonly UserHasNoReputation: "USER_HAS_NO_REPUTATION";
|
|
506
|
+
readonly ZeroReputationPoints: "ZERO_REPUTATION_POINTS";
|
|
507
|
+
readonly NoReputation: "NO_REPUTATION";
|
|
508
|
+
readonly InsufficientRP: "INSUFFICIENT_RP";
|
|
509
|
+
readonly NullifierAlreadyVerified: "NULLIFIER_ALREADY_VERIFIED";
|
|
510
|
+
readonly VerificationFailed: "VERIFICATION_FAILED";
|
|
511
|
+
readonly InvalidSocialPlatform: "INVALID_SOCIAL_PLATFORM";
|
|
512
|
+
readonly SocialAlreadyVerified: "SOCIAL_ALREADY_VERIFIED";
|
|
513
|
+
readonly YearFieldNotInProof: "YEAR_FIELD_NOT_IN_PROOF";
|
|
514
|
+
readonly UserIdFieldNotInProof: "USER_ID_FIELD_NOT_IN_PROOF";
|
|
515
|
+
readonly UserIdAlreadyVerified: "USER_ID_ALREADY_VERIFIED";
|
|
516
|
+
readonly UsernameAlreadyVerified: "USERNAME_ALREADY_VERIFIED";
|
|
517
|
+
readonly UsernameNotInProof: "USERNAME_NOT_IN_PROOF";
|
|
518
|
+
readonly LinkedInOnlyRpUpdates: "LINKEDIN_ONLY_RP_UPDATES";
|
|
519
|
+
readonly FacebookOnlyRpUpdates: "FACEBOOK_ONLY_RP_UPDATES";
|
|
520
|
+
readonly AlreadyReferred: "ALREADY_REFERRED";
|
|
521
|
+
readonly SelfReferralNotAllowed: "SELF_REFERRAL_NOT_ALLOWED";
|
|
522
|
+
readonly NotEligibleToRefer: "NOT_ELIGIBLE_TO_REFER";
|
|
523
|
+
readonly MerchantMonthlyReferralLimitReached: "MERCHANT_MONTHLY_REFERRAL_LIMIT_REACHED";
|
|
524
|
+
readonly NoRecommender: "NO_RECOMMENDER";
|
|
525
|
+
readonly RecommendationAlreadyClaimed: "RECOMMENDATION_ALREADY_CLAIMED";
|
|
526
|
+
readonly CannotVoteYourself: "CANNOT_VOTE_YOURSELF";
|
|
527
|
+
readonly VotesPerEpochExceeded: "VOTES_PER_EPOCH_EXCEEDED";
|
|
528
|
+
readonly AlreadyVoted: "ALREADY_VOTED";
|
|
529
|
+
readonly FunctionNotFound: "FUNCTION_NOT_FOUND";
|
|
530
|
+
readonly CampaignNotActive: "CAMPAIGN_NOT_ACTIVE";
|
|
531
|
+
readonly InvalidManagerDetails: "INVALID_MANAGER_DETAILS";
|
|
532
|
+
readonly UnclaimedRewardsExist: "UNCLAIMED_REWARDS_EXIST";
|
|
533
|
+
readonly RewardAlreadyClaimed: "REWARD_ALREADY_CLAIMED";
|
|
534
|
+
readonly OnlyNewUsersAllowed: "ONLY_NEW_USERS_ALLOWED";
|
|
535
|
+
readonly ManagerNotFound: "MANAGER_NOT_FOUND";
|
|
536
|
+
readonly ManagerInactive: "MANAGER_INACTIVE";
|
|
537
|
+
readonly NoRewards: "NO_REWARDS";
|
|
538
|
+
readonly InvalidCampaignId: "INVALID_CAMPAIGN_ID";
|
|
539
|
+
readonly CannotClaimRevenueForCurrentMonth: "CANNOT_CLAIM_REVENUE_FOR_CURRENT_MONTH";
|
|
540
|
+
readonly RewardPercentageTooHigh: "REWARD_PERCENTAGE_TOO_HIGH";
|
|
541
|
+
readonly NonceAlreadyUsed: "NONCE_ALREADY_USED";
|
|
542
|
+
readonly SignatureValidationFailed: "SIGNATURE_VALIDATION_FAILED";
|
|
543
|
+
readonly InvalidAddress: "INVALID_ADDRESS";
|
|
544
|
+
readonly InvalidBlockAmount: "INVALID_BLOCK_AMOUNT";
|
|
545
|
+
readonly InvalidAmount: "INVALID_AMOUNT";
|
|
546
|
+
readonly InvalidInput: "INVALID_INPUT";
|
|
547
|
+
readonly InvalidStatusTransition: "INVALID_STATUS_TRANSITION";
|
|
548
|
+
readonly ArrayLengthMismatch: "ARRAY_LENGTH_MISMATCH";
|
|
549
|
+
readonly UserIsBlacklisted: "USER_IS_BLACKLISTED";
|
|
550
|
+
readonly ZeroAddress: "ZERO_ADDRESS";
|
|
551
|
+
readonly ReentrancyGuard: "REENTRANCY_GUARD";
|
|
552
|
+
readonly BatchTooLarge: "BATCH_TOO_LARGE";
|
|
553
|
+
readonly UnderflowSubtraction: "UNDERFLOW_SUBTRACTION";
|
|
554
|
+
readonly TargetLongerThanData: "TARGET_LONGER_THAN_DATA";
|
|
555
|
+
};
|
|
556
|
+
type ContractErrorCode = (typeof contractErrors)[keyof typeof contractErrors];
|
|
557
|
+
/** Maps 4-byte Solidity custom error selectors to their error codes. */
|
|
558
|
+
declare const hexContractErrors: Record<string, ContractErrorCode>;
|
|
559
|
+
/**
|
|
560
|
+
* Parses an unknown contract revert into a `ContractErrorCode` string.
|
|
561
|
+
* Inspects hex selectors in `data`, `message`, and nested `cause` fields.
|
|
562
|
+
* Returns `null` if no known error is matched.
|
|
563
|
+
*/
|
|
564
|
+
declare function parseContractError(error: unknown): ContractErrorCode | null;
|
|
565
|
+
|
|
566
|
+
/**
|
|
567
|
+
* English UI strings for every contract error code.
|
|
568
|
+
* Pass a `ContractErrorCode` to `getContractErrorMessage` to get a
|
|
569
|
+
* human-readable string safe to display directly in the UI.
|
|
570
|
+
*/
|
|
571
|
+
declare const contractErrorMessages: Record<ContractErrorCode, string>;
|
|
572
|
+
/**
|
|
573
|
+
* Returns a human-readable English string for the given `ContractErrorCode`,
|
|
574
|
+
* or a generic fallback message if the code is not recognised.
|
|
575
|
+
*
|
|
576
|
+
* @example
|
|
577
|
+
* const msg = getContractErrorMessage("USERNAME_ALREADY_VERIFIED");
|
|
578
|
+
* // "The social media account's username is already verified"
|
|
579
|
+
*/
|
|
580
|
+
declare function getContractErrorMessage(code: ContractErrorCode | string | null | undefined, fallback?: string): string;
|
|
581
|
+
|
|
361
582
|
interface Encrypted {
|
|
362
583
|
readonly iv: string;
|
|
363
584
|
readonly ephemPublicKey: string;
|
|
@@ -396,4 +617,4 @@ interface DecryptPaymentAddressInput {
|
|
|
396
617
|
*/
|
|
397
618
|
declare function decryptPaymentAddress(input: DecryptPaymentAddressInput): ResultAsync<string, OrdersError>;
|
|
398
619
|
|
|
399
|
-
export { type ApproveUsdcParams, type CancelOrderParams, type DisputeStatus, type ExecuteBase, type FeeConfig, type GetFeeConfigParams, type GetOrderParams, type GetOrdersParams, type Order, type OrderEvent, type OrderStatus, type OrderType, type OrdersClient, type OrdersConfig, OrdersError, type OrdersErrorCode, type PaidBuyOrderAction, type PaidBuyOrderParams, type PlaceOrderParams, type PreparedTx, type PreparedTxMeta, type RaiseDisputeParams, type RelayIdentity, type RelayIdentityStore, type SetSellOrderUpiParams, type TxResult, type TxResultMeta, type WatchEventsParams, cipherParse, cipherStringify, createInMemoryRelayStore, createLocalStorageRelayStore, createOrders, createRelayIdentity, decryptPaymentAddress, encryptPaymentAddress };
|
|
620
|
+
export { type ApproveUsdcParams, type CancelOrderParams, type ContractErrorCode, type DisputeStatus, type ExecuteBase, type FeeConfig, type GetFeeConfigParams, type GetOrderParams, type GetOrdersParams, type Order, type OrderEvent, type OrderStatus, type OrderType, type OrdersClient, type OrdersConfig, OrdersError, type OrdersErrorCode, type PaidBuyOrderAction, type PaidBuyOrderParams, type PlaceOrderParams, type PreparedTx, type PreparedTxMeta, type RaiseDisputeParams, type RelayIdentity, type RelayIdentityStore, type SetSellOrderUpiParams, type TxResult, type TxResultMeta, type WatchEventsParams, cipherParse, cipherStringify, contractErrorMessages, contractErrors, createInMemoryRelayStore, createLocalStorageRelayStore, createOrders, createRelayIdentity, decryptPaymentAddress, encryptPaymentAddress, getContractErrorMessage, hexContractErrors, parseContractError };
|
package/dist/orders.d.ts
CHANGED
|
@@ -358,6 +358,227 @@ interface OrdersClient {
|
|
|
358
358
|
*/
|
|
359
359
|
declare function createOrders(config: OrdersConfig): OrdersClient;
|
|
360
360
|
|
|
361
|
+
/**
|
|
362
|
+
* Centralized contract error definitions mirroring `contracts/libraries/Errors.sol`.
|
|
363
|
+
* Maps Solidity custom error names and their 4-byte selectors to human-readable codes.
|
|
364
|
+
*/
|
|
365
|
+
declare const contractErrors: {
|
|
366
|
+
readonly NotAdmin: "NOT_ADMIN";
|
|
367
|
+
readonly NotSuperAdmin: "NOT_SUPER_ADMIN";
|
|
368
|
+
readonly NotAuthorized: "NOT_AUTHORIZED";
|
|
369
|
+
readonly NotSelf: "NOT_SELF";
|
|
370
|
+
readonly NotWhitelisted: "NOT_WHITELISTED";
|
|
371
|
+
readonly NotCircleAdmin: "NOT_CIRCLE_ADMIN";
|
|
372
|
+
readonly InvalidName: "INVALID_NAME";
|
|
373
|
+
readonly InvalidCommunityUrl: "INVALID_COMMUNITY_URL";
|
|
374
|
+
readonly InvalidAdminCommunityUrl: "INVALID_ADMIN_COMMUNITY_URL";
|
|
375
|
+
readonly AdminAlreadyHasCircle: "ADMIN_ALREADY_HAS_CIRCLE";
|
|
376
|
+
readonly CircleNameAlreadyTaken: "CIRCLE_NAME_ALREADY_TAKEN";
|
|
377
|
+
readonly P2PStakeConfigNotSet: "P2P_STAKE_CONFIG_NOT_SET";
|
|
378
|
+
readonly InsufficientP2PStake: "INSUFFICIENT_P2P_STAKE";
|
|
379
|
+
readonly P2PTokenNotSet: "P2P_TOKEN_NOT_SET";
|
|
380
|
+
readonly P2PUnstakeRequestPending: "P2P_UNSTAKE_REQUEST_PENDING";
|
|
381
|
+
readonly NoP2PUnstakeRequest: "NO_P2P_UNSTAKE_REQUEST";
|
|
382
|
+
readonly P2PUnstakeCooldownNotPassed: "P2P_UNSTAKE_COOLDOWN_NOT_PASSED";
|
|
383
|
+
readonly SlashAmountExceedsStake: "SLASH_AMOUNT_EXCEEDS_STAKE";
|
|
384
|
+
readonly CircleNotActive: "CIRCLE_NOT_ACTIVE";
|
|
385
|
+
readonly InvalidCircleId: "INVALID_CIRCLE_ID";
|
|
386
|
+
readonly CurrencyMismatch: "CURRENCY_MISMATCH";
|
|
387
|
+
readonly CircleFull: "CIRCLE_FULL";
|
|
388
|
+
readonly CircleIdMismatch: "CIRCLE_ID_MISMATCH";
|
|
389
|
+
readonly DuplicateAccountName: "DUPLICATE_ACCOUNT_NAME";
|
|
390
|
+
readonly EmptyName: "EMPTY_NAME";
|
|
391
|
+
readonly AccountBoundToAnotherCircle: "ACCOUNT_BOUND_TO_ANOTHER_CIRCLE";
|
|
392
|
+
readonly ExitAmountExceededCircleBalance: "EXIT_AMOUNT_EXCEEDED_CIRCLE_BALANCE";
|
|
393
|
+
readonly UndelegationAmountTooHigh: "UNDELEGATION_AMOUNT_TOO_HIGH";
|
|
394
|
+
readonly ExchangeNotOperational: "EXCHANGE_NOT_OPERATIONAL";
|
|
395
|
+
readonly OrderNotPlaced: "ORDER_NOT_PLACED";
|
|
396
|
+
readonly OrderNotPaid: "ORDER_NOT_PAID";
|
|
397
|
+
readonly OrderStatusInvalid: "ORDER_STATUS_INVALID";
|
|
398
|
+
readonly OrderExpired: "ORDER_EXPIRED";
|
|
399
|
+
readonly OrderAlreadyPaid: "ORDER_ALREADY_PAID";
|
|
400
|
+
readonly OrderAlreadyCompleted: "ORDER_ALREADY_COMPLETED";
|
|
401
|
+
readonly InvalidOrderType: "INVALID_ORDER_TYPE";
|
|
402
|
+
readonly OrderTypeIncorrect: "ORDER_TYPE_INCORRECT";
|
|
403
|
+
readonly OrderNotAccepted: "ORDER_NOT_ACCEPTED";
|
|
404
|
+
readonly OrderNotAssigned: "ORDER_NOT_ASSIGNED";
|
|
405
|
+
readonly OrderAmountExceedsLimit: "ORDER_AMOUNT_EXCEEDS_LIMIT";
|
|
406
|
+
readonly InvalidOrderAmount: "INVALID_ORDER_AMOUNT";
|
|
407
|
+
readonly InvalidOrderAmountToCoverFee: "INVALID_ORDER_AMOUNT_TO_COVER_FEE";
|
|
408
|
+
readonly InvalidOrderId: "INVALID_ORDER_ID";
|
|
409
|
+
readonly OrderTooEarlyForReassignment: "ORDER_TOO_EARLY_FOR_REASSIGNMENT";
|
|
410
|
+
readonly OrderTooLateForReassignment: "ORDER_TOO_LATE_FOR_REASSIGNMENT";
|
|
411
|
+
readonly ReAssignmentNotRequired: "REASSIGNMENT_NOT_REQUIRED";
|
|
412
|
+
readonly TipAlreadyGiven: "TIP_ALREADY_GIVEN";
|
|
413
|
+
readonly CashbackTransferFailed: "CASHBACK_TRANSFER_FAILED";
|
|
414
|
+
readonly DailyBuyOrderLimitExceeded: "DAILY_BUY_ORDER_LIMIT_EXCEEDED";
|
|
415
|
+
readonly MonthlyBuyOrderLimitExceeded: "MONTHLY_BUY_ORDER_LIMIT_EXCEEDED";
|
|
416
|
+
readonly SellOrderAmountLimitExceeded: "SELL_ORDER_AMOUNT_LIMIT_EXCEEDED";
|
|
417
|
+
readonly BuyOrderAmountExceedsLimit: "BUY_ORDER_AMOUNT_EXCEEDS_LIMIT";
|
|
418
|
+
readonly SellOrderAmountExceedsLimit: "SELL_ORDER_AMOUNT_EXCEEDS_LIMIT";
|
|
419
|
+
readonly BuyAmountExceedsUsdcLimit: "BUY_AMOUNT_EXCEEDS_USDC_LIMIT";
|
|
420
|
+
readonly SellAmountExceedsFiatLimit: "SELL_AMOUNT_EXCEEDS_FIAT_LIMIT";
|
|
421
|
+
readonly DailyVolumeLimitExceeded: "DAILY_VOLUME_LIMIT_EXCEEDED";
|
|
422
|
+
readonly MonthlyVolumeLimitExceeded: "MONTHLY_VOLUME_LIMIT_EXCEEDED";
|
|
423
|
+
readonly UserYearlyVolumeLimitExceeded: "USER_YEARLY_VOLUME_LIMIT_EXCEEDED";
|
|
424
|
+
readonly DisputeTimeNotReached: "DISPUTE_TIME_NOT_REACHED";
|
|
425
|
+
readonly DisputeTimeExpired: "DISPUTE_TIME_EXPIRED";
|
|
426
|
+
readonly InvalidOrderStatusToRaiseDispute: "INVALID_ORDER_STATUS_TO_RAISE_DISPUTE";
|
|
427
|
+
readonly DisputeNotRaised: "DISPUTE_NOT_RAISED";
|
|
428
|
+
readonly CannotRaiseDisputeTwice: "CANNOT_RAISE_DISPUTE_TWICE";
|
|
429
|
+
readonly DisputeAlreadySettled: "DISPUTE_ALREADY_SETTLED";
|
|
430
|
+
readonly TransactionIdMismatch: "TRANSACTION_ID_MISMATCH";
|
|
431
|
+
readonly AccountNumberMismatch: "ACCOUNT_NUMBER_MISMATCH";
|
|
432
|
+
readonly NotPaidBuyOrder: "NOT_PAID_BUY_ORDER";
|
|
433
|
+
readonly PaymentChannelNotFound: "PAYMENT_CHANNEL_NOT_FOUND";
|
|
434
|
+
readonly PaymentChannelNotActive: "PAYMENT_CHANNEL_NOT_ACTIVE";
|
|
435
|
+
readonly PaymentChannelNotApproved: "PAYMENT_CHANNEL_NOT_APPROVED";
|
|
436
|
+
readonly PaymentChannelNotRejected: "PAYMENT_CHANNEL_NOT_REJECTED";
|
|
437
|
+
readonly InvalidPaymentChannelId: "INVALID_PAYMENT_CHANNEL_ID";
|
|
438
|
+
readonly DuplicatePaymentChannel: "DUPLICATE_PAYMENT_CHANNEL";
|
|
439
|
+
readonly OldPaymentChannelNotFound: "OLD_PAYMENT_CHANNEL_NOT_FOUND";
|
|
440
|
+
readonly NewPaymentChannelNotFound: "NEW_PAYMENT_CHANNEL_NOT_FOUND";
|
|
441
|
+
readonly SamePaymentChannel: "SAME_PAYMENT_CHANNEL";
|
|
442
|
+
readonly OldPaymentChannelShouldBeInactive: "OLD_PAYMENT_CHANNEL_SHOULD_BE_INACTIVE";
|
|
443
|
+
readonly NewPaymentChannelShouldBeActive: "NEW_PAYMENT_CHANNEL_SHOULD_BE_ACTIVE";
|
|
444
|
+
readonly OngoingOrderOnPaymentChannel: "ONGOING_ORDER_ON_PAYMENT_CHANNEL";
|
|
445
|
+
readonly UpiAlreadySent: "UPI_ALREADY_SENT";
|
|
446
|
+
readonly InvalidOrderUpi: "INVALID_ORDER_UPI";
|
|
447
|
+
readonly NoFiatLiquidity: "NO_FIAT_LIQUIDITY";
|
|
448
|
+
readonly NotEnoughEligibleMerchants: "NOT_ENOUGH_ELIGIBLE_MERCHANTS";
|
|
449
|
+
readonly MerchantNotRegistered: "MERCHANT_NOT_REGISTERED";
|
|
450
|
+
readonly MerchantNotApproved: "MERCHANT_NOT_APPROVED";
|
|
451
|
+
readonly MerchantAlreadyRegistered: "MERCHANT_ALREADY_REGISTERED";
|
|
452
|
+
readonly MerchantAlreadyRejected: "MERCHANT_ALREADY_REJECTED";
|
|
453
|
+
readonly MerchantBlacklisted: "MERCHANT_BLACKLISTED";
|
|
454
|
+
readonly MerchantNotBlacklisted: "MERCHANT_NOT_BLACKLISTED";
|
|
455
|
+
readonly MerchantAlreadyBlacklisted: "MERCHANT_ALREADY_BLACKLISTED";
|
|
456
|
+
readonly MerchantHasOngoingOrders: "MERCHANT_HAS_ONGOING_ORDERS";
|
|
457
|
+
readonly MerchantNotFullfilledEligibilityThreshold: "MERCHANT_NOT_FULLFILLED_ELIGIBILITY_THRESHOLD";
|
|
458
|
+
readonly InvalidMerchant: "INVALID_MERCHANT";
|
|
459
|
+
readonly StakeAmountTooLow: "STAKE_AMOUNT_TOO_LOW";
|
|
460
|
+
readonly AdditionalStakeNotAllowed: "ADDITIONAL_STAKE_NOT_ALLOWED";
|
|
461
|
+
readonly UnstakeRequestPending: "UNSTAKE_REQUEST_PENDING";
|
|
462
|
+
readonly UnstakeRequestNotPending: "UNSTAKE_REQUEST_NOT_PENDING";
|
|
463
|
+
readonly UnstakeAmountExceeded: "UNSTAKE_AMOUNT_EXCEEDED";
|
|
464
|
+
readonly ZeroUnstakeAmount: "ZERO_UNSTAKE_AMOUNT";
|
|
465
|
+
readonly NoWithdrawableAmount: "NO_WITHDRAWABLE_AMOUNT";
|
|
466
|
+
readonly NoStake: "NO_STAKE";
|
|
467
|
+
readonly NoStakers: "NO_STAKERS";
|
|
468
|
+
readonly InsufficientStakedAmount: "INSUFFICIENT_STAKED_AMOUNT";
|
|
469
|
+
readonly CooldownNotPassed: "COOLDOWN_NOT_PASSED";
|
|
470
|
+
readonly ClaimableRewardsNotAvailable: "CLAIMABLE_REWARDS_NOT_AVAILABLE";
|
|
471
|
+
readonly ExitWouldBreachDelegationInvariant: "EXIT_WOULD_BREACH_DELEGATION_INVARIANT";
|
|
472
|
+
readonly AggregateDelegationExceedsTotalStaked: "AGGREGATE_DELEGATION_EXCEEDS_TOTAL_STAKED";
|
|
473
|
+
readonly InsufficientMerchantRewards: "INSUFFICIENT_MERCHANT_REWARDS";
|
|
474
|
+
readonly InvalidMigrationStatus: "INVALID_MIGRATION_STATUS";
|
|
475
|
+
readonly MigrationRequestNotPending: "MIGRATION_REQUEST_NOT_PENDING";
|
|
476
|
+
readonly MigrationAlreadyRequested: "MIGRATION_ALREADY_REQUESTED";
|
|
477
|
+
readonly TokenAlreadyExists: "TOKEN_ALREADY_EXISTS";
|
|
478
|
+
readonly TokenNotFound: "TOKEN_NOT_FOUND";
|
|
479
|
+
readonly TokenEmpty: "TOKEN_EMPTY";
|
|
480
|
+
readonly CurrencyNotSupported: "CURRENCY_NOT_SUPPORTED";
|
|
481
|
+
readonly InvalidCurrency: "INVALID_CURRENCY";
|
|
482
|
+
readonly UsdtTransferFailed: "USDC_TRANSFER_FAILED";
|
|
483
|
+
readonly UsdtTransferFailedWithErrorMessage: "USDC_TRANSFER_FAILED_WITH_ERROR_MESSAGE";
|
|
484
|
+
readonly UsdtTransferFailedWithPanic: "USDC_TRANSFER_FAILED_WITH_PANIC";
|
|
485
|
+
readonly InsufficientAllowance: "INSUFFICIENT_ALLOWANCE";
|
|
486
|
+
readonly ZKPassportVerifierNotSet: "ZK_PASSPORT_VERIFIER_NOT_SET";
|
|
487
|
+
readonly ZKPassportDomainEmpty: "ZK_PASSPORT_DOMAIN_EMPTY";
|
|
488
|
+
readonly ZKPassportScopeEmpty: "ZK_PASSPORT_SCOPE_EMPTY";
|
|
489
|
+
readonly PassportAlreadyVerified: "PASSPORT_ALREADY_VERIFIED";
|
|
490
|
+
readonly ZKPassportProofInvalid: "ZK_PASSPORT_PROOF_INVALID";
|
|
491
|
+
readonly ZKPassportIdentifierAlreadyVerified: "ZK_PASSPORT_IDENTIFIER_ALREADY_VERIFIED";
|
|
492
|
+
readonly ZKPassportInvalidScope: "ZK_PASSPORT_INVALID_SCOPE";
|
|
493
|
+
readonly ZKPassportUnexpectedSender: "ZK_PASSPORT_UNEXPECTED_SENDER";
|
|
494
|
+
readonly ZKPassportAgeBelowMinimum: "ZK_PASSPORT_AGE_BELOW_MINIMUM";
|
|
495
|
+
readonly ZKPassportMinAgeTooHigh: "ZK_PASSPORT_MIN_AGE_TOO_HIGH";
|
|
496
|
+
readonly UnexpectedRequestId: "UNEXPECTED_REQUEST_ID";
|
|
497
|
+
readonly OnlyRouterCanFulfill: "ONLY_ROUTER_CAN_FULFILL";
|
|
498
|
+
readonly RequestFailed: "REQUEST_FAILED";
|
|
499
|
+
readonly SourceCodeMismatch: "SOURCE_CODE_MISMATCH";
|
|
500
|
+
readonly ZeroMarketPrice: "ZERO_MARKET_PRICE";
|
|
501
|
+
readonly InvalidComputedPrices: "INVALID_COMPUTED_PRICES";
|
|
502
|
+
readonly NotPriceUpdaterForCurrency: "NOT_PRICE_UPDATER_FOR_CURRENCY";
|
|
503
|
+
readonly ThresholdNotConfigured: "THRESHOLD_NOT_CONFIGURED";
|
|
504
|
+
readonly SlippageExceeded: "SLIPPAGE_EXCEEDED";
|
|
505
|
+
readonly UserHasNoReputation: "USER_HAS_NO_REPUTATION";
|
|
506
|
+
readonly ZeroReputationPoints: "ZERO_REPUTATION_POINTS";
|
|
507
|
+
readonly NoReputation: "NO_REPUTATION";
|
|
508
|
+
readonly InsufficientRP: "INSUFFICIENT_RP";
|
|
509
|
+
readonly NullifierAlreadyVerified: "NULLIFIER_ALREADY_VERIFIED";
|
|
510
|
+
readonly VerificationFailed: "VERIFICATION_FAILED";
|
|
511
|
+
readonly InvalidSocialPlatform: "INVALID_SOCIAL_PLATFORM";
|
|
512
|
+
readonly SocialAlreadyVerified: "SOCIAL_ALREADY_VERIFIED";
|
|
513
|
+
readonly YearFieldNotInProof: "YEAR_FIELD_NOT_IN_PROOF";
|
|
514
|
+
readonly UserIdFieldNotInProof: "USER_ID_FIELD_NOT_IN_PROOF";
|
|
515
|
+
readonly UserIdAlreadyVerified: "USER_ID_ALREADY_VERIFIED";
|
|
516
|
+
readonly UsernameAlreadyVerified: "USERNAME_ALREADY_VERIFIED";
|
|
517
|
+
readonly UsernameNotInProof: "USERNAME_NOT_IN_PROOF";
|
|
518
|
+
readonly LinkedInOnlyRpUpdates: "LINKEDIN_ONLY_RP_UPDATES";
|
|
519
|
+
readonly FacebookOnlyRpUpdates: "FACEBOOK_ONLY_RP_UPDATES";
|
|
520
|
+
readonly AlreadyReferred: "ALREADY_REFERRED";
|
|
521
|
+
readonly SelfReferralNotAllowed: "SELF_REFERRAL_NOT_ALLOWED";
|
|
522
|
+
readonly NotEligibleToRefer: "NOT_ELIGIBLE_TO_REFER";
|
|
523
|
+
readonly MerchantMonthlyReferralLimitReached: "MERCHANT_MONTHLY_REFERRAL_LIMIT_REACHED";
|
|
524
|
+
readonly NoRecommender: "NO_RECOMMENDER";
|
|
525
|
+
readonly RecommendationAlreadyClaimed: "RECOMMENDATION_ALREADY_CLAIMED";
|
|
526
|
+
readonly CannotVoteYourself: "CANNOT_VOTE_YOURSELF";
|
|
527
|
+
readonly VotesPerEpochExceeded: "VOTES_PER_EPOCH_EXCEEDED";
|
|
528
|
+
readonly AlreadyVoted: "ALREADY_VOTED";
|
|
529
|
+
readonly FunctionNotFound: "FUNCTION_NOT_FOUND";
|
|
530
|
+
readonly CampaignNotActive: "CAMPAIGN_NOT_ACTIVE";
|
|
531
|
+
readonly InvalidManagerDetails: "INVALID_MANAGER_DETAILS";
|
|
532
|
+
readonly UnclaimedRewardsExist: "UNCLAIMED_REWARDS_EXIST";
|
|
533
|
+
readonly RewardAlreadyClaimed: "REWARD_ALREADY_CLAIMED";
|
|
534
|
+
readonly OnlyNewUsersAllowed: "ONLY_NEW_USERS_ALLOWED";
|
|
535
|
+
readonly ManagerNotFound: "MANAGER_NOT_FOUND";
|
|
536
|
+
readonly ManagerInactive: "MANAGER_INACTIVE";
|
|
537
|
+
readonly NoRewards: "NO_REWARDS";
|
|
538
|
+
readonly InvalidCampaignId: "INVALID_CAMPAIGN_ID";
|
|
539
|
+
readonly CannotClaimRevenueForCurrentMonth: "CANNOT_CLAIM_REVENUE_FOR_CURRENT_MONTH";
|
|
540
|
+
readonly RewardPercentageTooHigh: "REWARD_PERCENTAGE_TOO_HIGH";
|
|
541
|
+
readonly NonceAlreadyUsed: "NONCE_ALREADY_USED";
|
|
542
|
+
readonly SignatureValidationFailed: "SIGNATURE_VALIDATION_FAILED";
|
|
543
|
+
readonly InvalidAddress: "INVALID_ADDRESS";
|
|
544
|
+
readonly InvalidBlockAmount: "INVALID_BLOCK_AMOUNT";
|
|
545
|
+
readonly InvalidAmount: "INVALID_AMOUNT";
|
|
546
|
+
readonly InvalidInput: "INVALID_INPUT";
|
|
547
|
+
readonly InvalidStatusTransition: "INVALID_STATUS_TRANSITION";
|
|
548
|
+
readonly ArrayLengthMismatch: "ARRAY_LENGTH_MISMATCH";
|
|
549
|
+
readonly UserIsBlacklisted: "USER_IS_BLACKLISTED";
|
|
550
|
+
readonly ZeroAddress: "ZERO_ADDRESS";
|
|
551
|
+
readonly ReentrancyGuard: "REENTRANCY_GUARD";
|
|
552
|
+
readonly BatchTooLarge: "BATCH_TOO_LARGE";
|
|
553
|
+
readonly UnderflowSubtraction: "UNDERFLOW_SUBTRACTION";
|
|
554
|
+
readonly TargetLongerThanData: "TARGET_LONGER_THAN_DATA";
|
|
555
|
+
};
|
|
556
|
+
type ContractErrorCode = (typeof contractErrors)[keyof typeof contractErrors];
|
|
557
|
+
/** Maps 4-byte Solidity custom error selectors to their error codes. */
|
|
558
|
+
declare const hexContractErrors: Record<string, ContractErrorCode>;
|
|
559
|
+
/**
|
|
560
|
+
* Parses an unknown contract revert into a `ContractErrorCode` string.
|
|
561
|
+
* Inspects hex selectors in `data`, `message`, and nested `cause` fields.
|
|
562
|
+
* Returns `null` if no known error is matched.
|
|
563
|
+
*/
|
|
564
|
+
declare function parseContractError(error: unknown): ContractErrorCode | null;
|
|
565
|
+
|
|
566
|
+
/**
|
|
567
|
+
* English UI strings for every contract error code.
|
|
568
|
+
* Pass a `ContractErrorCode` to `getContractErrorMessage` to get a
|
|
569
|
+
* human-readable string safe to display directly in the UI.
|
|
570
|
+
*/
|
|
571
|
+
declare const contractErrorMessages: Record<ContractErrorCode, string>;
|
|
572
|
+
/**
|
|
573
|
+
* Returns a human-readable English string for the given `ContractErrorCode`,
|
|
574
|
+
* or a generic fallback message if the code is not recognised.
|
|
575
|
+
*
|
|
576
|
+
* @example
|
|
577
|
+
* const msg = getContractErrorMessage("USERNAME_ALREADY_VERIFIED");
|
|
578
|
+
* // "The social media account's username is already verified"
|
|
579
|
+
*/
|
|
580
|
+
declare function getContractErrorMessage(code: ContractErrorCode | string | null | undefined, fallback?: string): string;
|
|
581
|
+
|
|
361
582
|
interface Encrypted {
|
|
362
583
|
readonly iv: string;
|
|
363
584
|
readonly ephemPublicKey: string;
|
|
@@ -396,4 +617,4 @@ interface DecryptPaymentAddressInput {
|
|
|
396
617
|
*/
|
|
397
618
|
declare function decryptPaymentAddress(input: DecryptPaymentAddressInput): ResultAsync<string, OrdersError>;
|
|
398
619
|
|
|
399
|
-
export { type ApproveUsdcParams, type CancelOrderParams, type DisputeStatus, type ExecuteBase, type FeeConfig, type GetFeeConfigParams, type GetOrderParams, type GetOrdersParams, type Order, type OrderEvent, type OrderStatus, type OrderType, type OrdersClient, type OrdersConfig, OrdersError, type OrdersErrorCode, type PaidBuyOrderAction, type PaidBuyOrderParams, type PlaceOrderParams, type PreparedTx, type PreparedTxMeta, type RaiseDisputeParams, type RelayIdentity, type RelayIdentityStore, type SetSellOrderUpiParams, type TxResult, type TxResultMeta, type WatchEventsParams, cipherParse, cipherStringify, createInMemoryRelayStore, createLocalStorageRelayStore, createOrders, createRelayIdentity, decryptPaymentAddress, encryptPaymentAddress };
|
|
620
|
+
export { type ApproveUsdcParams, type CancelOrderParams, type ContractErrorCode, type DisputeStatus, type ExecuteBase, type FeeConfig, type GetFeeConfigParams, type GetOrderParams, type GetOrdersParams, type Order, type OrderEvent, type OrderStatus, type OrderType, type OrdersClient, type OrdersConfig, OrdersError, type OrdersErrorCode, type PaidBuyOrderAction, type PaidBuyOrderParams, type PlaceOrderParams, type PreparedTx, type PreparedTxMeta, type RaiseDisputeParams, type RelayIdentity, type RelayIdentityStore, type SetSellOrderUpiParams, type TxResult, type TxResultMeta, type WatchEventsParams, cipherParse, cipherStringify, contractErrorMessages, contractErrors, createInMemoryRelayStore, createLocalStorageRelayStore, createOrders, createRelayIdentity, decryptPaymentAddress, encryptPaymentAddress, getContractErrorMessage, hexContractErrors, parseContractError };
|