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.
Parameters:
option(GetBridgesOption): Options for fetching bridges
Returns:
- Promise<Bridge[] | TranslatedBridge[]>: Array of bridges
ask
typescript
ask(askIF: AskIF, callback: OnQuoteIF): voidInitiates a quote request for a swap operation with continuous updates.
- Parameters:
- Returns: void
stopAsk
typescript
stopAsk(): voidTerminates 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 swapsignData(SwapSignData): The signing data objectsigned(string): The signature
- Returns:
- Promise<PreBusiness>: Pre-business data for the swap
getHistory
typescript
getHistory(address: string): Promise<BusinessFullData[]>Retrieves swap history for a given address.
- Parameters:
address(string): The wallet address to query
- Returns:
- Promise<BusinessFullData[]>: Array of detailed business history
getBusiness
typescript
getBusiness(hash: string): Promise<Business>Gets business details by transaction hash.
- Parameters:
hash(string): Transaction hashoptions(GetBusinessOptions, optional): Options for fetching business details, if omitted, the Business type data will returned.
- Returns:
- Promise<Business | BusinessFullData>: Business transaction details or full business data if detailed option is set