const fetch = require("node-fetch");
const url = "https://api.chainrails.io/api/v1/intents";
const apiKey = "YOUR_API_KEY";
const payload = {
sender: "0xdA3ECb2E5362295E2b802669dD47127A61d9Ce54",
amount: "1000000",
tokenIn: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
source_chain: "BASE_TESTNET",
destination_chain: "ARBITRUM_TESTNET",
recipient: "0xb79541Be080a59fdcE6C0b43219ba56c725eC65e",
refund_address: "0xb79541Be080a59fdcE6C0b43219ba56c725eC65e",
metadata: {
description: "Cross-chain USDC transfer",
priority: "normal",
},
};
async function createIntent() {
const res = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${apiKey}`,
},
body: JSON.stringify(payload),
});
const data = await res.json();
console.log("Response:", data);
}
createIntent().catch(console.error);