Skip to main content

Common Types

CrossChainRecipient

Euclid enables the movement of assets and execution of actions across multiple chains within a unified routing system. In this context, it's very common for developers to work with recipients that exist on different chains. Whether you're sending tokens, triggering a remote swap, or executing logic across chains, you need to define who the recipient is and what chain they belong to.

Whether you’re sending funds, executing a remote contract call, or initiating a swap that settles elsewhere, you’ll often need to define who the receiver is, what chain they’re on, and how much they can receive.

This is where the CrossChainUser family of types comes into play.

Common Use Case: Cross-Chain Funds Delivery

Let's say you're building a swap mechanism where tokens from Ethereum are swapped and sent to a Cosmos chain. You’ll need to specify:

  • The recipient address
  • The destination chain (chain_uid)
  • A limit (optional) to cap the amount being sent

All of this is covered by the types below, used in our APIs.

Types

CrossChainUser

type CrossChainUser = {
chain_uid?: string
address?: string
}

Fields

FieldTypeDescription
addressstringThe user’s address on the given chain.
chain_uidstringThe unique identifier of the chain.

CrossChainUserInput

type CrossChainUserInput = {
  chain_uid?: string
  address?: string
}
{
  "address": "0xB0b123456789abcdef123456789abcdef1234567",
  "chain_uid": "base"
}

Input Fields

FieldTypeDescription
addressstring?The user’s address to look up or act on.
chain_uidstring?The chain UID of the user.

CrossChainAddressWithLimit

type CrossChainAddressWithLimit = {
user: CrossChainUserWithAmount 
limit?: {
   less_than_or_equal?: string
   greater_than_or_equal?: string
   equal?: string }
preferred_denom?: TokenType
forwarding_message?: {
   data?: string 
   meta?: string } 
   }
{ "user": { "chain_uid": "base", "address": "0xB0b123456789abcdef123456789abcdef1234567", "amount": "1000000" }, "limit": { "greater_than_or_equal": "950000" }, "preferred_denom": { "native": { "denom": "base" } }, "forwarding_message": { "data": "0x", "meta": "forward" } }
FieldTypeDescription
userCrossChainUserWithAmountThe target recipient on a specific chain, including the chain UID, address, and optionally an amount or social identity for routing/claims.
limitLimitOptional delivery constraints that define acceptable amount bounds for this recipient.
preferred_denomTokenTypeOptional preference for how the asset should be represented on the destination chain (native vs smart vs voucher).
forwarding_messageobjectOptional forwarding payload (data/meta) passed along to downstream handlers or contracts when the cross-chain delivery executes.

CrossChainUserWithAmount

type CrossChainUserWithAmount = {
 chain_uid?: string
 address?: string 
 amount?: string }
{
 "chain_uid": "base",
 "address": "0xB0b123456789abcdef123456789abcdef1234567",
 "amount": "1000000" }
FieldTypeDescription
chain_uidstringUnique chain identifier for the user’s address.
addressstringUser address on the specified chain.
amountstringAmount associated with the user for this request (as a string).

Limit

export type Limit =
  | { less_than_or_equal: string }
  | { equal: string }
  | { greater_than_or_equal: string };
{
  "less_than_or_equal": "1000000000000000000"
}

TokenWithDenom

Represents a token and how it should be interpreted on-chain. The token_type determines if it's a native chain token, a smart contract token, or a voucher.

Structure

type TokenWithDenom = {
  token: string
  token_type: TokenType
  amount?: string
}
{
  "token": "usdc",
  "amount":"10000000",
  "token_type": {
    "smart": {
      "contract_address": "0xA1b2C3d4E5F67890123456789abcdef123456789"
    }
  }
}

TokenType Variants

type TokenType =
| { native: { denom: string } }
| { smart: { contract_address: string } }
| { voucher: {} }

PairWithDenomAndAmount

Used when representing a pair of tokens along with their amounts and token type. Commonly used in swaps and pool-related contexts.

Structure

type PairWithDenomAndAmount = {
  token_1: TokenWithDenomAndAmount
  token_2: TokenWithDenomAndAmount
}

type TokenWithDenomAndAmount = {
  token: string
  amount: string
  token_type: TokenType
}

type TokenType =
  | { native: { denom: string } }
  | { smart: { contract_address: string } }
  | { voucher: {} };
{
  "token_1": {
    "token": "usdt",
    "amount": "1000000",
    "token_type": {
      "native": {
        "denom": "usdt"
      }
    }
  },
  "token_2": {
    "token": "weth",
    "amount": "500000000000000000",
    "token_type": {
      "smart": {
        "contract_address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
      }
    }
  }
}