Type definitions
GetBridgesOption
Type definition for the options used to fetch bridges.
interface GetBridgesOption {
detailed?: boolean;
network?: NetworkType;
rpcs?: Record<string, string>;
}detailed(boolean, optional): Whether to fetch detailed bridge information. Iftrue, the network will be included, will return TranslatedBridge array. Iffalse, will return Bridge array.network(NetworkType, optional): The network type to filter bridges (e.g., 'mainnet', 'testnet').rpcs(Record<string, string>, optional): RPC endpoints for different networks. The key is the network name and the value is the RPC endpoint. e.g.,{ "solana": "https://mainnet.infura.io/v3/your-api-key", "bsc": "https://mainnet.infura.io/v3/your-api-key" }. If not provided, the default RPC endpoints will be used.
Bridge
Type definition for the bridge configuration.
interface Bridge {
bridge_id: number;
src_chain_id: number;
dst_chain_id: number;
src_token: string;
dst_token: string;
bridge_name?: string;
}bridge_id(number): Unique identifier for the bridge.src_chain_id(number): Source blockchain chain ID.dst_chain_id(number): Destination blockchain chain ID.src_token(string): Source token address.dst_token(string): Destination token address.bridge_name(string, optional): Name of the bridge.
TranslatedBridge
Type definition for the translated bridge configuration.
interface TranslatedBridge {
bridge_id: number;
src_chain_id: number;
dst_chain_id: number;
src_token: string;
dst_token: string;
bridge_name?: string;
src_chain_name: string;
dst_chain_name: string;
src_token_symbol: string;
dst_token_symbol: string;
}bridge_id(number): Unique identifier for the bridge.src_chain_id(number): Source blockchain chain ID.dst_chain_id(number): Destination blockchain chain ID.src_token(string): Source token address.dst_token(string): Destination token address.bridge_name(string, optional): Name of the bridge.src_chain_name(string): Human-readable name of the source blockchain.dst_chain_name(string): Human-readable name of the destination blockchain.src_token_symbol(string): Human-readable symbol of the source token.dst_token_symbol(string): Human-readable symbol of the destination token.
AskIF
Type definition for the ask interface.
interface AskIF {
bridge: Bridge;
amount: string;
}bridge(Bridge): The target bridge to ask price.amount(string): The amount to be swapped.
OnQuoteIF
Type definition for the on quote interface.
interface OnQuoteIF {
OnQuote(quote: Quote): void;
}OnQuote(function): The callback function to be called when a quote is received, with the quote data as the parameter.
Quote
interface Quote {
quote_base: QuoteBase;
authentication_limiter: AuthenticationLimiter;
lp_info: LpInfo;
quote_name: string;
timestamp: number;
}quote_base(QuoteBase): Base information about the quote, including bridge details and pricing.authentication_limiter(AuthenticationLimiter): Information about authentication limits, such as country restrictions and age limits.lp_info(LpInfo): Information about the liquidity provider, including ID, name, and credit score.quote_name(string): The name of the quote.timestamp(number): The timestamp when the quote was created.
QuoteBase
Type definition for the base information of a quote.
interface QuoteBase {
bridge: Bridge;
lp_bridge_address: string;
price: string;
native_token_price: string;
native_token_max: string;
native_token_min: string;
capacity: string;
lp_node_uri: string;
quote_hash: string;
}bridge(Bridge): The bridge details for the quote.lp_bridge_address(string): The address of the liquidity provider's bridge.price(string): The price of the quote.native_token_price(string): The price of the native token.native_token_max(string): The maximum amount of native tokens.native_token_min(string): The minimum amount of native tokens.capacity(string): The capacity of the quote.lp_node_uri(string): The URI of the liquidity provider's node.quote_hash(string): The hash of the quote.
AuthenticationLimiter
Type definition for the authentication limiter information.
interface AuthenticationLimiter {
country_white_list: string;
country_black_list: string;
min_age: string;
limiter_state: string;
}country_white_list(string): List of countries allowed.country_black_list(string): List of countries not allowed.min_age(string): Minimum age required.limiter_state(string): State of the limiter.
LpInfo
Type definition for the liquidity provider information.
interface LpInfo {
lp_id: number;
lp_id_fake: string;
name: string;
profile: string;
credit_score: number;
}lp_id(number): The ID of the liquidity provider.lp_id_fake(string): A fake ID for the liquidity provider.name(string): The name of the liquidity provider.profile(string): The profile of the liquidity provider.credit_score(number): The credit score of the liquidity provider.
SwapSignData
Type definition for the swap sign data.
interface SwapSignData {
types?: {
Message: {
name: string;
type: string;
}[];
EIP712Domain: {
name: string;
type: string;
}[];
};
primaryType?: string;
domain?: {
name: string;
version: string;
chainId: number | undefined;
};
message: {
src_chain_id: number;
src_address: string;
src_token: string;
src_amount: string;
dst_chain_id: number;
dst_address: string;
dst_token: string;
dst_amount: string;
dst_native_amount: string;
requestor: string;
lp_id: string;
agreement_reached_time: number;
expected_single_step_time: number;
tolerant_single_step_time: number;
earliest_refund_time: number;
};
}types(optional): Object defining the types for EIP-712 signing.Message: Array of objects defining the message fields.name(string): Name of the field.type(string): Type of the field.
EIP712Domain: Array of objects defining the domain fields.name(string): Name of the field.type(string): Type of the field.
primaryType(optional): Primary type for EIP-712 signing.domain(optional): Object defining the domain for EIP-712 signing.name(string): Name of the domain.version(string): Version of the domain.chainId(number | undefined): Chain ID of the domain.
message: Object containing the message data for the swap.src_chain_id(number): Source chain ID.src_address(string): Source address.src_token(string): Source token address.src_amount(string): Source amount.dst_chain_id(number): Destination chain ID.dst_address(string): Destination address.dst_token(string): Destination token address.dst_amount(string): Destination amount.dst_native_amount(string): Destination native amount.requestor(string): Requestor address.lp_id(string): Liquidity provider ID.agreement_reached_time(number): Agreement reached time.expected_single_step_time(number): Expected single step time.tolerant_single_step_time(number): Tolerant single step time.earliest_refund_time(number): Earliest refund time.
SwapSignedData
Type definition for the signed swap data.
interface SwapSignedData {
signData: SwapSignData;
signed: string;
}signData(SwapSignData): The signing data object containing the details of the swap to be signed.signed(string): The signature generated from signing thesignData.
PreBusiness
Type definition for the pre-business data.
interface PreBusiness {
swap_asset_information: SwapAssetInformation;
hash: string;
hashlock_evm: string;
hashlock_xrp: string;
hashlock_near: string;
hashlock_solana: string;
locked: boolean;
lock_message: string;
preimage: string;
timestamp: number;
is_kyc: boolean;
same_did: boolean;
}swap_asset_information(SwapAssetInformation): Information about the swap asset.hash(string): The hash of the pre-business transaction.hashlock_evm(string): Hashlock for EVM chains.hashlock_xrp(string): Hashlock for XRP chain.hashlock_near(string): Hashlock for NEAR chain.hashlock_solana(string): Hashlock for Solana chain.locked(boolean): Indicates if the transaction is locked.lock_message(string): Message associated with the lock.preimage(string): Preimage for the hashlock.timestamp(number): Timestamp of the pre-business transaction.is_kyc(boolean): Indicates if KYC is required.same_did(boolean): Indicates if the same DID is used.
Business
Type definition for the business data.
interface Business {
business_id: number;
step: number;
business_hash: string;
transfer_out_id: number;
transfer_in_id: number;
transfer_out_confirm_id: number;
transfer_in_confirm_id: number;
transfer_out_refund_id: number;
transfer_in_refund_id: number;
}business_id(number): Unique identifier for the business.step(number): Current step of the business process.business_hash(string): Hash of the business transaction.transfer_out_id(number): ID of the transfer out transaction.transfer_in_id(number): ID of the transfer in transaction.transfer_out_confirm_id(number): ID of the transfer out confirmation.transfer_in_confirm_id(number): ID of the transfer in confirmation.transfer_out_refund_id(number): ID of the transfer out refund.transfer_in_refund_id(number): ID of the transfer in refund.
BusinessFullData
Type definition for the full business data.
interface BusinessFullData {
pre_business: PreBusiness;
business: Business;
event_transfer_out: any;
event_transfer_in: any;
event_transfer_out_confirm: any;
event_transfer_in_confirm: any;
event_transfer_out_refund: any;
event_transfer_in_refund: any;
}pre_business(PreBusiness): Pre-business data.business(Business): Business data.event_transfer_out(any): Event data for the transfer out.event_transfer_in(any): Event data for the transfer in.event_transfer_out_confirm(any): Event data for the transfer out confirmation.event_transfer_in_confirm(any): Event data for the transfer in confirmation.event_transfer_out_refund(any): Event data for the transfer out refund.event_transfer_in_refund(any): Event data for the transfer in refund.
SwapAssetInformation
Type definition for the swap asset information.
interface SwapAssetInformation {
bridge_name: string;
lp_id_fake: string;
sender: string;
amount: string;
dst_address: string;
dst_amount: string;
dst_native_amount: string;
system_fee_src: number;
system_fee_dst: number;
dst_amount_need: string;
dst_native_amount_need: string;
agreement_reached_time: number;
expected_single_step_time: number;
tolerant_single_step_time: number;
earliest_refund_time: number;
quote: Quote;
append_information: string;
did: string;
requestor: string;
user_sign: string;
lp_sign: string;
src_transfer_id?: string;
}bridge_name(string): The name of the bridge used for the swap.lp_id_fake(string): A fake ID for the liquidity provider.sender(string): The address of the sender initiating the swap.amount(string): The amount to be swapped.dst_address(string): The destination address to receive the swapped tokens.dst_amount(string): The amount of tokens to be received at the destination.dst_native_amount(string): The amount of native tokens to be received at the destination.system_fee_src(number): The system fee charged on the source chain.system_fee_dst(number): The system fee charged on the destination chain.dst_amount_need(string): The required amount of tokens at the destination.dst_native_amount_need(string): The required amount of native tokens at the destination.agreement_reached_time(number): The timestamp when the agreement was reached.expected_single_step_time(number): The expected time for a single step in the swap process.tolerant_single_step_time(number): The tolerant time for a single step in the swap process.earliest_refund_time(number): The earliest time when a refund can be initiated.quote(Quote): The quote data associated with the swap.append_information(string): Additional information related to the swap.did(string): The decentralized identifier of the user.requestor(string): The address of the requestor.user_sign(string): The user's signature for the swap.lp_sign(string): The liquidity provider's signature for the swap.src_transfer_id(string, optional): The transfer ID on the source chain.
GetBusinessOptions
Type definition for the options used to fetch business details.
interface GetBusinessOptions {
detailed?: boolean;
}detailed(boolean, optional): Whether to fetch detailed business information. Iftrue, the response will include full business data (BusinessFullData). Iffalse, only basic business data (Business) will be returned.
ChainId
Enumeration for supported blockchain chain IDs. The chain IDs are from BIP-44.
enum ChainId {
AVAX = 9000,
BSC = 9006,
ETH = 60,
POLYGON = 966,
OPT = 614,
SOLANA = 501,
NEAR = 397,
XRP = 144,
}AVAX(9000): Avalanche chain ID.BSC(9006): Binance Smart Chain ID.ETH(60): Ethereum chain ID.POLYGON(966): Polygon chain ID.OPT(614): Optimism chain ID.SOLANA(501): Solana chain ID.NEAR(397): NEAR chain ID.XRP(144): XRP chain ID.
NetworkType
Enumeration for supported network types.
enum NetworkType {
MAINNET = 'mainnet',
TESTNET = 'testnet',
}MAINNET('mainnet'): Represents the main network where actual transactions occur.TESTNET('testnet'): Represents the test network used for testing and development purposes.
DstAmountSet
Type definition for the destination amount set.
interface DstAmountSet {
dstAmount: string;
dstNativeAmount: string;
}dstAmount(string): The amount of tokens to be received at the destination.dstNativeAmount(string): The amount of native tokens to be received at the destination.
GasPrice
Type definition for the gas price information.
interface GasPrice {
amount: bigint;
usedMaximum: boolean;
}amount(bigint): The amount of gas price in the smallest unit of the blockchain's native currency (e.g., wei for Ethereum).usedMaximum(boolean): Indicates whether the maximum gas price limitation set in otmoic was used for the price. Iftrue, means the gas price got from blockchain exceeds otmoic gas price limitaton and the otmoic gas price limitation was used for the price. Iffalse, the on chain gas price was used.
SignSwapOption
Type definition for the options used to sign a swap.
interface SignSwapOption {
getSignDataOnly?: boolean;
type?: 'privateKey' | 'metamaskAPI' | 'phantomAPI';
privateKey?: string;
metamaskAPI?: any;
phantomAPI?: any;
sender?: string;
}getSignDataOnly(boolean, optional): Iftrue, only the signing data will be returned without performing the actual signing. the rest of the options will be ignored.type('privateKey' | 'metamaskAPI' | 'phantomAPI', optional): Specifies the method to be used for signing. It can be one of the following:privateKey: Uses a private key for signing.metamaskAPI: Uses the MetaMask API for signing.phantomAPI: Uses the Phantom API for signing.
privateKey(string, optional): The private key to be used for signing if thetypeis set toprivateKey.metamaskAPI(any, optional): The MetaMask API object to be used for signing if thetypeis set tometamaskAPI.phantomAPI(any, optional): The Phantom API object to be used for signing if thetypeis set tophantomAPI.sender(string, optional): The address of the sender initiating the swap must be provided iftypeis eithermetamaskAPIorphantomAPI.
SwapTransactionOption
Type definition for the options used to perform a swap transaction.
interface SwapTransactionOption {
getTxDataOnly?: boolean;
type?: 'privateKey' | 'metamaskAPI' | 'phantomAPI';
privateKey?: string;
metamaskAPI?: any;
phantomAPI?: any;
useMaximumGasPriceAtMost?: boolean;
provider?: Connection;
pluginProvider?: Provider;
}getTxDataOnly(boolean, optional): Iftrue, only the transaction data will be returned without performing the actual transaction. the rest of the options will be ignored.type('privateKey' | 'metamaskAPI' | 'phantomAPI', optional): Specifies the method to be used for the transaction. It can be one of the following:privateKey: Uses a private key for signing the transaction.metamaskAPI: Uses the MetaMask API for signing the transaction.phantomAPI: Uses the Phantom API for signing the transaction.
privateKey(string, optional): The private key to be used for signing the transaction if thetypeis set toprivateKey.metamaskAPI(any, optional): The MetaMask API object to be used for signing the transaction if thetypeis set tometamaskAPI.phantomAPI(any, optional): The Phantom API object to be used for signing the transaction if thetypeis set tophantomAPI.useMaximumGasPriceAtMost(boolean, optional): Iftrue, the maximum gas price limitation set in Otmoic will be used for the transaction. must be provided whentypeisprivateKeyand operate on EVM network.provider(Connection, optional): The Solana connection provider.pluginProvider(Provider, optional): The Anchor provider for Solana transactions.
ResponseTransferOut
Type definition for the response of a transfer out operation.
interface ResponseTransferOut {
approve: ContractTransactionResponse | undefined;
transferOut: ContractTransactionResponse;
}approve(ContractTransactionResponse | undefined): The response of the approval transaction. This is optional and may be undefined if no approval is needed.transferOut(ContractTransactionResponse): The response of the transfer out transaction. This contains details about the transaction such as the transaction hash, status, block number, gas used, and logs.
ResponseSolana
Type definition for the response of a Solana transaction.
interface ResponseSolana {
txHash: string;
}txHash(string): The transaction hash of the Solana transaction.
SignComplainEIP712Option
Type definition for the options used to sign a complaint using EIP-712.
interface SignComplainEIP712Option {
getSignDataOnly?: boolean;
type?: 'privateKey' | 'termiPass';
privateKey?: string;
termiPassAPI?: any;
}getSignDataOnly(boolean, optional): Iftrue, only the signing data will be returned without performing the actual signing. The rest of the options will be ignored.type('privateKey' | 'termiPass', optional): Specifies the method to be used for signing. It can be one of the following:privateKey: Uses a private key for signing.termiPass: Uses the TermiPass API for signing.
privateKey(string, optional): The private key to be used for signing if thetypeis set toprivateKey.termiPassAPI(any, optional): The TermiPass API object to be used for signing if thetypeis set totermiPass.
ComplainSignData
Type definition for the complaint sign data.
interface ComplainSignData {
types: Record<string, TypedDataField[]>;
primaryType: string;
domain: TypedDataDomain;
message: ComplaintValue;
}types(Record<string, TypedDataField[]>): Object defining the types for EIP-712 signing.TypedDataField: Array of objects defining the message fields.name(string): Name of the field.type(string): Type of the field.
primaryType(string): Primary type for EIP-712 signing.domain(TypedDataDomain): Object defining the domain for EIP-712 signing.name(string): Name of the domain.version(string): Version of the domain.chainId(number | undefined): Chain ID of the domain.
message(ComplaintValue): Object containing the message data for the complaint.srcChainId(number): Source chain ID.srcAddress(string): Source address.srcToken(string): Source token address.srcAmount(string): Source amount.dstChainId(number): Destination chain ID.dstAddress(string): Destination address.dstToken(string): Destination token address.dstAmount(string): Destination amount.dstNativeAmount(string): Destination native amount.requestor(string): Requestor address.lpId(string): Liquidity provider ID.expectedSingleStepTime(number): Expected single step time.tolerantSingleStepTime(number): Tolerant single step time.earliestRefundTime(number): Earliest refund time.agreementReachedTime(number): Agreement reached time.userSign(string): User's signature.lpSign(string): Liquidity provider's signature.
ComplainSignedData
Type definition for the signed complaint data.
interface ComplainSignedData {
signData: ComplainSignData;
signed: string;
}signData(ComplainSignData): The signing data object containing the details of the complaint to be signed.signed(string): The signature generated from signing thesignData.