# Message Passing

When transferring tokens using Rango cross-chain API, you could pass a random message from the source chain to the destination and call your contract on the destination. In order to do so, you need to pass your contracts on source & destination chains plus an arbitrary hex message. Here is a brief guide on what you need to do in terms of SDK usage and the smart contract side.

## SDK Usage

You should specify `sourceContract`, `destinationContract` and `imMessage` arguments in both `quote` and `swap` methods if you want to pass a message from the source contract to the destination.

{% tabs %}
{% tab title="Quote Sample" %}

```typescript
const quoteResponse = await rango.quote({
  from: {
    "blockchain": "OPTIMISM",
    "symbol": "ETH",
    "address": null
  },
  to: {
    "blockchain": "ARBITRUM",
    "symbol": "ETH",
    "address": null
  },
  amount: "100000000000000000000",
  messagingProtocols: ['LAYER_ZERO'],
  sourceContract: "<source contract address>",
  destinationContract: "<destination contract address>",
  imMessage: "0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000007E8A8b130272430008eCa062419ACD8B423d339D" 
})
```

{% endtab %}

{% tab title="Swap Sample" %}

```typescript
const swapResponse = await rango.swap({
  from: {
    "blockchain": "OPTIMISM",
    "symbol": "ETH",
    "address": null
  },
  to: {
    "blockchain": "ARBITRUM",
    "symbol": "ETH",
    "address": null
  },
  amount: "100000000000000000000",
  fromAddress: fromAddress,
  toAddress: fromAddress,
  disableEstimate: false,
  referrerAddress: null,
  referrerFee: null,
  slippage: '1.0',
  messagingProtocols: ['LAYER_ZERO'],
  sourceContract: "<source contract address>",
  destinationContract: "<destination contract address>",
  imMessage: "0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000007E8A8b130272430008eCa062419ACD8B423d339D"
})

if (!!swapResponse && !swapResponse.error && swapResponse.resultType === "OK" && swapResponse.tx?.type === TransactionType.EVM) {
  const evmTx = swapResponse.tx as EvmTransaction
  const {value, txData} = evmTx
  console.log({value, txData})
  // pass value and txData to your own contract
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
You could also limit `messagingProtocols` used to a custom list like `['LAYER_ZERO']`. (Please note that as the message is relayed alongside with token in a single transaction if you limit messaging protocols to`LAYER_ZERO`, we use the same bridge for transferring tokens.&#x20;
{% endhint %}

Make sure to check out [message-passing](https://docs.rango.exchange/smart-contracts/message-passing "mention") in order to implement proper interface in your smart contracts to receive messages from Rango contracts.
