James Bachini

Bridging Assets With Stellar x Near Intents

Near Intents

Imagine being able to bridge and swap different assets across different chains with a single API call. That’s the promise of Near Intents who have just announced an integration with Stellar.

James On YouTube

The recent launch of Near Intents for Stellar marks a major milestone in cross-chain interoperability, unlocking new possibilities for developers and users across the Stellar ecosystem.

Instead of orchestrating complex flows across multiple blockchains, users describe what they want, and a decentralized network of solvers competes to deliver the best solution. Now, with Stellar support live, those intents can include native Stellar assets, making them accessible from over 20 other blockchains.

At its core, NEAR Intents abstracts away blockchain complexity, replacing traditional, manual interactions with an intelligent coordination layer. This allows both humans and AI agents to request outcomes, from token swaps to more sophisticated cross-chain operations, that are fulfilled automatically via the most efficient path.

For Stellar, this opens the door to frictionless, bridge-free liquidity access: users can now swap into Stellar’s USDC or XLM directly from BTC, ETH, SOL, and more, all without relying on 3rd party bridges or custodial tools.

For Stellar developers, the integration is especially exciting. By plugging into NEAR Intents, wallets, DEXs, and dApps gain instant access to users and liquidity from 100+ supported chains.


I wanted to create an RFQ (Request for quote) tool which could do cross-chain swaps to demonstrate the 1-click API.

Here is what the UI looks like.

xlm rfq client

This uses a single API query to /quote which returns a price and deposit address. If you want to go ahead simply send funds to the deposit address and the swap will be carried out by market makers.

There is documentation for the API query here: https://docs.near-intents.org/near-intents/integration/distribution-channels/1click-api#post-v0-quote

Full source code for the RFQ client is available on Github: https://github.com/jamesbachini/Near-Intents-Client

In the repository there is also a node js client in src/nic.mjs which clearly demonstrates the API usage:

near intents client
const BASE_URL = 'https://1click.chaindefuser.com/v0';
const RECIPIENT_ADDRESS = '0x0158A6CD56f63b1A09Ee67683F64af6e023439E0';
const AMOUNT_USDC = '10';
const USDC_DECIMALS = 6;
const amountSmallestUnit = (BigInt(Number(AMOUNT_USDC) * 10 ** USDC_DECIMALS)).toString();

const quoteRequest = {
  dry: false,
  swapType: 'EXACT_INPUT',
  slippageTolerance: 100, // 1%
  originAsset: 'nep141:eth-0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.omft.near',
  depositType: 'ORIGIN_CHAIN',
  destinationAsset: 'nep141:eth.omft.near',
  amount: amountSmallestUnit,
  refundTo: RECIPIENT_ADDRESS,
  refundType: 'ORIGIN_CHAIN',
  recipient: RECIPIENT_ADDRESS,
  recipientType: 'DESTINATION_CHAIN',
  deadline: new Date(Date.now() + 30 * 60 * 1000).toISOString(), // 30 mins from now
  referral: 'referral', // optional
  quoteWaitingTimeMs: 3000,
  appFees: [
    {
      recipient: 'recipient.near',
      fee: 100
    }
  ]
};

const sleep = ms => new Promise(r => setTimeout(r, ms));

async function main() {
  console.log('Requesting quote...');
  const quoteRes = await fetch(`${BASE_URL}/quote`, {
    method: 'POST',
    headers: {
      //'Authorization': `Bearer ${JWT_TOKEN}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify(quoteRequest)
  });

  const res = await quoteRes.json();
  if (!res.quote.depositAddress) {
    console.error('Quote failed:', res.quote);
    return;
  }

  const {
    depositAddress,
    amountInFormatted,
    amountOutFormatted,
    deadline,
  } = res.quote;
  const deadlineFormatted = new Date(deadline);
  console.log('\n=== QUOTE ===');
  console.log(`Send: ${amountInFormatted} USDC`);
  console.log(`Receive: ${amountOutFormatted} ETH`);
  console.log('\n=== TO ACCEPT ===');
  console.log(`Send exactly ${amountInFormatted} USDC to:`);
  console.log(`→ ${depositAddress}`);
  console.log(`Deadline: ${deadlineFormatted}`);
}

main().catch(err => {
  console.error('Error:', err);
});

This script defines some basic parameters: the base URL for the API, the address of the person who should receive the swapped tokens and the amount of USDC being sent.

Next, the script builds a “quote request” object. This object tells the API what you want to do: swap a specific amount of USDC from Ethereum into ETH on NEAR. It also includes extra details such as the maximum slippage you’re willing to accept, where a refund should be sent if the swap fails, who the final recipient is, and when the quote should expire. There’s even space to add referral information or application fees if you want to charge a small percentage for facilitating the swap.

Once the request is ready, the script sends it to the API’s /quote endpoint. The API responds with the terms of the trade. If successful, this includes a deposit address where the user should send their USDC, along with formatted values showing exactly how much they need to send and how much ETH they’ll receive in return.

Finally, the script prints these details in a human friendly format. It shows the input and output token amounts, the deposit address to use, and the deadline for completing the transfer. In practice, the user would take this deposit address, send the specified USDC before the deadline, and the system automatically handles the swap and delivers ETH on NEAR to the recipient’s account.

The RFQ client is basically a frontend wrapper around this simple functionality. Source here: https://github.com/jamesbachini/Near-Intents-Client/blob/main/index.html

It’s a very elegant way to bridge assets into wallets or smart contracts on the Stellar network.


With Stellar live on NEAR Intents, the future of multichain coordination has arrived. The path is now clear for developers to build smarter, simpler, and more interoperable applications — and for users to access Stellar assets more easily than ever before.


Get The Blockchain Sector Newsletter, binge the YouTube channel and connect with me on Twitter

The Blockchain Sector newsletter goes out a few times a month when there is breaking news or interesting developments to discuss. All the content I produce is free, if you’d like to help please share this content on social media.

Thank you.

James Bachini

Disclaimer: Not a financial advisor, not financial advice. The content I create is to document my journey and for educational and entertainment purposes only. It is not under any circumstances investment advice. I am not an investment or trading professional and am learning myself while still making plenty of mistakes along the way. Any code published is experimental and not production ready to be used for financial transactions. Do your own research and do not play with funds you do not want to lose.


Posted

in

, , , , ,

by

Tags: