import { NodeResponses } from "../schemas"; import { Address } from "../basic"; import { Values } from "../error"; import { tidy } from "../utils"; import { HashlockTransferName, HashlockTransferResolver, HashlockTransferResolverEncoding, HashlockTransferState, HashlockTransferStateEncoding, } from "./hashlockTransfer"; import { WithdrawName, WithdrawResolver, WithdrawResolverEncoding, WithdrawState, WithdrawStateEncoding, } from "./withdraw"; // Must be updated when adding a new transfer export const TransferNames = { [HashlockTransferName]: HashlockTransferName, [WithdrawName]: WithdrawName, } as const; // Must be updated when adding a new transfer export interface TransferResolverMap { [HashlockTransferName]: HashlockTransferResolver; [WithdrawName]: WithdrawResolver; } // Must be updated when adding a new transfer export interface TransferStateMap { [HashlockTransferName]: HashlockTransferState; [WithdrawName]: WithdrawState; } // Must be updated when adding a new transfer export const TransferEncodingsMap = { [HashlockTransferName]: [HashlockTransferStateEncoding, HashlockTransferResolverEncoding], [WithdrawName]: [WithdrawStateEncoding, WithdrawResolverEncoding], } as const; export type TransferName = keyof typeof TransferNames | string; export type TransferState = Values | any; export type TransferResolver = Values | any; export type TransferEncodings = Values | [string, string]; export type RegisteredTransfer = { stateEncoding: string; resolverEncoding: string; definition: Address; name: string; encodedCancel: string; }; export const TransferQuoteEncoding = tidy(`tuple( string routerIdentifier, uint256 amount, address assetId, uint256 chainId, string recipient, uint256 recipientChainId, address recipientAssetId, uint256 fee, uint256 expiry )`);