Skip to content

Classes

Relay

Main class for interacting with the Otmoic relay service. Provides functionality for bridge operations, quote management, and transaction tracking.

Constructor
typescript
constructor(relay: string)

Creates a new Relay instance.

  • Parameters:
    • relay (string): The URL of the relay service
  • Throws: Error if relay parameter is undefined
Methods
getBridge
typescript
getBridge(option: GetBridgesOption): Promise<Bridge[] | TranslatedBridge[]>

Retrieves all available bridges from the relay service.

ask
typescript
ask(askIF: AskIF, callback: OnQuoteIF): void

Initiates a quote request for a swap operation with continuous updates.

  • Parameters:
    • askIF (AskIF): Quote request parameters
    • callback (OnQuoteIF): Callback interface for quote responses
  • Returns: void
stopAsk
typescript
stopAsk(): void

Terminates the current quote request and stops receiving updates.

  • Returns: void
swap
typescript
swap(quote: Quote, signData: SwapSignData, signed: string): Promise<PreBusiness>

Executes a swap operation with a signed quote.

  • Parameters:
    • quote (Quote): The quote data for the swap
    • signData (SwapSignData): The signing data object
    • signed (string): The signature
  • Returns:
getHistory
typescript
getHistory(address: string): Promise<BusinessFullData[]>

Retrieves swap history for a given address.

  • Parameters:
    • address (string): The wallet address to query
  • Returns:
getBusiness
typescript
getBusiness(hash: string): Promise<Business>

Gets business details by transaction hash.

  • Parameters:
    • hash (string): Transaction hash
    • options (GetBusinessOptions, optional): Options for fetching business details, if omitted, the Business type data will returned.
  • Returns: