async function estimateBridgeOutput(
fromChain,
toChain,
fromToken,
toToken,
amountFrom
) {
const query_string = `fromChain=${fromChain}&toChain=${toChain}&fromToken=${fromToken}&toToken=${toToken}&amountFrom=${amountFrom}`;
const response = await fetch(
`https://synapse-rest-api-v2.herokuapp.com/bridge?${query_string}`
);
const response_json = await response.json();
return await response_json;
}
estimateBridgeOutput(
1, // Ethereum Chain ID
42161, //Arbitrum Chain ID
"USDC",
"USDC",
"1000"
);
async function generateUnsignedBridgeTxn(
fromChain,
toChain,
fromToken,
toToken,
amountFrom,
destAddress
) {
const query_string = `fromChain=${fromChain}&toChain=${toChain}&fromToken=${fromToken}&toToken=${toToken}&amount=${amountFrom}&destAddress=${addressTo}`;
const response = await fetch(
`https://synapse-rest-api-v2.herokuapp.com/bridgeTxInfo?${query_string}`
);
const response_json = await response.json();
return await response_json;
}
generateUnsignedBridgeTxn(
1, // Ethereum Chain ID
42161, //Arbitrum Chain ID
"USDC",
"USDC",
"1000"
"0x2D2c027E0d1A899a1965910Dd272bcaE1cD03c22"
);
A cURL request to get information about a swap transaction.
curl --request GET \
--url 'https://synapse-rest-api-v2.herokuapp.com/swap?chain=1&fromToken=USDC&toToken=DAI&amount=100'