// Wallet addresses
const SENDER_ADDRESS =
"addr_test1qq7fc3ke49nkcsfglltut7apa9t3gdul4utwhxt6j2hdrw7pg4vk6erdshyhdj5xeq0vh8qdy34cpdfstvc8l9su8hgq679eew";
const RECEIVER_ADDRESS_1 =
"addr_test1qrydyk6uw6cehk5u3zspyz3dhnwzmhfls2fp42vv5dv9g2z3885pg4kpkn30ptezc855lu3w5ey93zcr5lrezjmwkftqg8xvge";
const RECEIVER_ADDRESS_2 =
"addr_test1qr0tkwvlln0v5fljdxceudmlpt5y6szc84vpj4skm836tgn4hsqaesgg97l8ppy5rsn0alj8pth6lqe20fdyydsdgw6sr74cyt";
// Asset information
const POLICY_ID = "360fd38656e5204f22ec058d18d5a90c18745ca8325e51d077c38a13";
const ASSET_NAME_1 = "616e76696c61706963697032355f333837393837393739";
const ASSET_NAME_2 = "616e76696c61706963697032355f333837393732";
// API configuration
const X_API_KEY = "testnet_EyrkvCWDZqjkfLSe1pxaF0hXxUcByHEhHuXIBjt9";
const API_URL = "https://preprod.api.ada-anvil.app/v2/services";
const HEADERS = { "Content-Type": "application/json", "x-api-key": X_API_KEY };
const requestBody = {
changeAddress: SENDER_ADDRESS,
outputs: [
{
address: RECEIVER_ADDRESS_1,
lovelace: 10_000_000, // 10 ADA
assets: [
{
assetName: ASSET_NAME_1,
policyId: POLICY_ID,
quantity: 1,
},
],
},
{
address: RECEIVER_ADDRESS_2,
lovelace: 5_000_000, // 5 ADA
assets: [
{
assetName: ASSET_NAME_2,
policyId: POLICY_ID,
quantity: 1,
},
],
},
],
};
const response = await fetch(`${API_URL}/transactions/build`, {
method: "POST",
headers: HEADERS,
body: JSON.stringify(requestBody),
});
const result = await response.json();
console.log(result);