Skip to main content
All types are exported from the main entry point:
import type {
  TransferConfig,
  TransferStatus,
  DepositRequest,
  DepositResult,
  SignerFunction,
  SignerRequest,
  SignerResponse,
  TransferSummary,
  TransferErrorCode,
} from '@swype-org/transfer';

TransferStatus

Current phase of the transfer flow.
type TransferStatus =
  | 'idle'
  | 'signer-loading'
  | 'iframe-active'
  | 'completed'
  | 'error';

TransferConfig

Configuration for a Transfer instance. See Transfer Class for detailed descriptions.
interface TransferConfig {
  signer: string | SignerFunction;
  webviewBaseUrl?: string;
  hostedFlowOrigin?: string;
  containerElement?: HTMLElement;
  signerTimeoutMs?: number;
  flowTimeoutMs?: number;
  debug?: boolean;
}

DepositRequest

Parameters for a single deposit request.
interface DepositRequest {
  amount: number;
  chainId: number;
  address: string;
  token: string;
  callbackScheme?: string | null;
  reference?: string;
  metadata?: Record<string, string>;
}
FieldTypeRequiredDescription
amountnumberYesUSD amount to deposit. Must be > 0.
chainIdnumberYesEVM chain ID for the destination (e.g., 8453 for Base).
addressstringYesDestination wallet address (0x-prefixed, 40 hex chars).
tokenstringYesToken contract address on the destination chain (0x-prefixed hex).
callbackSchemestring | nullNoCustom URL scheme for native app deep-link callbacks. Always null for browser.
referencestringNoMerchant order or invoice ID for reconciliation.
metadataRecord<string, string>NoArbitrary key-value pairs forwarded to the signer.

DepositResult

Result returned when a deposit completes successfully.
interface DepositResult {
  transfer: TransferSummary;
  idempotencyKey?: string;
  preview?: {
    amount: number;
    chainId: number;
    address: string;
    token: string;
  };
}

TransferSummary

Subset of transfer data returned from the hosted flow on completion.
interface TransferSummary {
  id: string;
  status: string;
  amount?: {
    amount: number;
    currency: string;
  };
  destinations?: Array<{
    chainId: string;
    address: string;
    token?: { address?: string; symbol?: string };
  }>;
}

SignerRequest

Data the SDK passes to the merchant signer.
interface SignerRequest {
  amount: number;
  chainId: number;
  address: string;
  token: string;
  callbackScheme: string | null;
  url: string;
  version: 'v1';
  reference?: string;
  metadata?: Record<string, string>;
}
FieldTypeDescription
amountnumberUSD amount to deposit.
chainIdnumberEVM chain ID for the destination.
addressstringDestination wallet address.
tokenstringToken contract address on the destination chain.
callbackSchemestring | nullnull for browser integrations.
urlstringBase webview URL. Provided for logging/validation only.
version'v1'Protocol version.
referencestring?Merchant order or invoice ID.
metadataRecord<string, string>?Arbitrary key-value pairs.

SignerResponse

Shape the merchant signer must return.
interface SignerResponse {
  merchantId: string;
  payload: string;
  signature: string;
  expiresAt?: string;
  preview: {
    amount: number;
    chainId: number;
    address: string;
    token: string;
    idempotencyKey: string;
  };
}
FieldTypeDescription
merchantIdstringYour merchant UUID.
payloadstringBase64url-encoded payment payload.
signaturestringBase64url-encoded ECDSA signature of the payload string.
expiresAtstring?ISO 8601 expiration timestamp. Optional — Swype enforces expiry server-side via signatureTimestamp in the payload.
previewobjectEcho of payment parameters for client-side display.

SignerFunction

Custom async function for full control over the signer call.
type SignerFunction = (data: SignerRequest) => Promise<SignerResponse>;