Palindrome Crypto Pay - Blockchain Escrow Payment Solution

API Reference

Enums & Types

This page documents all TypeScript enums and key interfaces used in the Palindrome Pay SDK. All of them are exported from @palindromepay/sdk.


EscrowState

Represents the current lifecycle state of an escrow. Used in EscrowData.state and state-checking methods.

ValueNameLabelDescription
0AWAITING_PAYMENTAwaiting PaymentBuyer must deposit funds.
1AWAITING_DELIVERYAwaiting DeliverySeller must deliver product/service.
2DISPUTEDDisputedDispute active — arbiter to resolve.
3COMPLETECompleteTransaction successfully finalized.
4REFUNDEDRefundedFunds returned to buyer.
5CANCELEDCanceledEscrow canceled by mutual agreement or timeout.

PayoutOutcome

A type alias (not a separate enum) covering the three terminal escrow states a payout authorization can consent to. Used by signWalletAuthorization() and getWalletSignatureCount().

type PayoutOutcome =
  | EscrowState.COMPLETE   // 3 — release funds to seller
  | EscrowState.REFUNDED   // 4 — return funds to buyer
  | EscrowState.CANCELED;  // 5 — cancel and return funds

Since Multisig v2, every wallet authorization is bound to exactly one of these outcomes, so a signature collected for one outcome cannot be replayed for another.


Role

Defines participant roles in the escrow. Used in submitDisputeMessage.

ValueNameDescription
0NoneNo role
1BuyerEscrow buyer
2SellerEscrow seller
3ArbiterDispute arbitrator

DisputeResolution

Arbiter decision outcomes. Used in submitArbiterDecision. The values intentionally mirror the corresponding EscrowState values (which is why they start at 3, not 0).

ValueNameDescription
3CompleteRelease funds to seller
4RefundedReturn funds to buyer

Constants

ConstantValueDescription
MAX_ARBITER_FEE_BPS2000Maximum arbiter fee in basis points (= 20%)

CreateEscrowParams

Used by createEscrow(). CreateEscrowAndDepositParams is identical except it takes seller instead of buyer.

interface CreateEscrowParams {
  token: Address;
  buyer: Address;
  amount: bigint;
  maturityTimeDays?: bigint;  // 0 = no auto-release
  arbiter?: Address;          // default: zero address (no arbiter)
  arbiterFeeBps?: number;     // 0-2000 bps; must be 0 without an arbiter
  title: string;              // 1-256 chars
  ipfsHash?: string;
}

SetArbiterSignedParams

Used by setArbiterSigned() to assign an arbiter to an arbiterless escrow with buyer and seller consent.

interface SetArbiterSignedParams {
  escrowId: bigint;
  newArbiter: Address;
  arbiterFeeBps: number;  // 0-2000 bps
  buyerSig: Hex;
  sellerSig: Hex;
  deadline: bigint;
  nonce: bigint;          // shared nonce, consumed for BOTH signers
}

EscrowData

Parsed on-chain escrow data returned by getEscrowByIdParsed().

interface EscrowData {
  token: Address;
  buyer: Address;
  seller: Address;
  arbiter: Address;
  wallet: Address;             // the escrow's dedicated multisig wallet
  amount: bigint;
  depositTime: bigint;
  maturityTime: bigint;
  maturityDuration: bigint;    // maturity window in seconds
  disputeStartTime: bigint;
  state: EscrowState;
  buyerCancelRequested: boolean;
  sellerCancelRequested: boolean;
  tokenDecimals: number;
  arbiterFeeBps: number;       // 0-2000 bps
  sellerWalletSig: Hex;
  buyerWalletSig: Hex;
  arbiterWalletSig: Hex;
}

Escrow ID types: bigint vs string

On-chain methods take escrowId as a bigint (e.g. 42n). Subgraph queries (getEscrowDetail, getDisputeMessages, …) take it as a string (e.g. "42"), since The Graph returns IDs as strings.

See alsoCreate Palindrome SDK · createEscrow() · signWalletAuthorization()

Previous
formatTokenAmount