Working with HyperCore
This guide provides a comprehensive overview for developers on how to use the Across Swap API to bridge USDC-SPOT to HyperCore, integrated via HyperEVM. We will be focusing on how using the Swap API abstracts away all complexities to ensure a smooth developer and user experience.
Important Parameters for the Swap API Call
To bridge USDC-SPOT to HyperCore, you make a standard call to the /swap/approval endpoint. The key is to specify HyperCore destinationChainId: 1337 and USDC-SPOT outputToken: 0x200000000000000000000000000000000000010C in the destination parameters.
While using the GET /swap/chains endpoint, you will see HyperCore listed with chainId: 1337 .
Next up, we will look at the major use case of the /swap/approval call while working with HyperCore.
Now, the Across Swap API can automatically initialize your depositor account on HyperCore when you are conducting a crosschain swap with this account as the recipient. Account creation is fully supported on any input amount.
From any EVM chain (like Arbitrum) to HyperCore
https://app.across.to/api/swap/approval?
tradeType=exactInput&
inputToken=0xaf88d065e77c8cC2239327C5EDb3A432268e5831&
originChainId=42161& // arbitrum
outputToken=0x2000000000000000000000000000000000000000& // USDC-SPOT
destinationChainId=1337& // HyperCore
depositor=0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D&
amount=1000000Output
{
"crossSwapType": "bridgeableToBridgeableIndirect",
"amountType": "exactInput",
"checks": {
"allowance": {
"token": "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
"spender": "0xe35e9842fceaCA96570B734083f4a58e8F7C5f2A",
"actual": "115792089237316195423570985008687907853269984665640564039457584007807744139935",
"expected": "1000000"
},
"balance": {
"token": "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
"actual": "12607096",
"expected": "1000000"
}
},
"steps": {
"bridge": {
"inputAmount": "1000000",
"outputAmount": "998773",
"tokenIn": {
"decimals": 6,
"symbol": "USDT",
"address": "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
"name": "Tether USD",
"chainId": 42161
},
"tokenOut": {
"symbol": "USDT",
"name": "Tether USD",
"decimals": 6,
"address": "0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb",
"chainId": 999,
"coingeckoId": "tether"
},
"fees": {
"totalRelay": {
"total": "1227",
"pct": "1227000000000000",
"token": {
"decimals": 6,
"symbol": "USDT",
"address": "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
"name": "Tether USD",
"chainId": 42161
}
},
"relayerCapital": {
"total": "100",
"pct": "100000000000000",
"token": {
"decimals": 6,
"symbol": "USDT",
"address": "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
"name": "Tether USD",
"chainId": 42161
}
},
"relayerGas": {
"total": "1127",
"pct": "1127000000000000",
"token": {
"decimals": 6,
"symbol": "USDT",
"address": "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
"name": "Tether USD",
"chainId": 42161
}
},
"lp": {
"total": "0",
"pct": "0",
"token": {
"decimals": 6,
"symbol": "USDT",
"address": "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
"name": "Tether USD",
"chainId": 42161
}
}
}
}
},
"inputToken": {
"decimals": 6,
"symbol": "USDT",
"address": "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
"name": "Tether USD",
"chainId": 42161
},
"outputToken": {
"symbol": "USDT-SPOT",
"name": "Tether USD",
"decimals": 8,
"address": "0x200000000000000000000000000000000000010C",
"chainId": 1337,
"coingeckoId": "tether"
},
"refundToken": {
"decimals": 6,
"symbol": "USDT",
"address": "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
"name": "Tether USD",
"chainId": 42161
},
"fees": {
"total": {
"amount": "1226",
"amountUsd": "0.001226999999999978",
"pct": "1226999999999978",
"token": {
"decimals": 6,
"symbol": "USDT",
"address": "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
"name": "Tether USD",
"chainId": 42161
}
},
"originGas": {
"amount": "3176078275684",
"amountUsd": "0.013793803233643881",
"token": {
"chainId": 42161,
"address": "0x0000000000000000000000000000000000000000",
"decimals": 18,
"symbol": "ETH"
}
},
"destinationGas": {
"amount": "25607816405362",
"amountUsd": "0.001127",
"pct": "1127000000000000",
"token": {
"chainId": 999,
"address": "0x0000000000000000000000000000000000000000",
"decimals": 18,
"symbol": "HYPE"
}
},
"relayerCapital": {
"amount": "100",
"amountUsd": "0.0001",
"pct": "100000000000000",
"token": {
"decimals": 6,
"symbol": "USDT",
"address": "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
"name": "Tether USD",
"chainId": 42161
}
},
"lpFee": {
"amount": "0",
"amountUsd": "0.0",
"pct": "0",
"token": {
"decimals": 6,
"symbol": "USDT",
"address": "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
"name": "Tether USD",
"chainId": 42161
}
},
"relayerTotal": {
"amount": "1227",
"amountUsd": "0.001227",
"pct": "1227000000000000",
"token": {
"decimals": 6,
"symbol": "USDT",
"address": "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
"name": "Tether USD",
"chainId": 42161
}
},
"app": {
"amount": "0",
"amountUsd": "0.0",
"pct": "0",
"token": {
"symbol": "USDT-SPOT",
"name": "Tether USD",
"decimals": 8,
"address": "0x200000000000000000000000000000000000010C",
"chainId": 1337,
"coingeckoId": "tether"
}
}
},
"inputAmount": "1000000",
"maxInputAmount": "1000000",
"expectedOutputAmount": "99877300",
"minOutputAmount": "99877300",
"expectedFillTime": 2,
"swapTx": {
"simulationSuccess": true,
"chainId": 42161,
"to": "0xe35e9842fceaCA96570B734083f4a58e8F7C5f2A",
"data": "0xad5...0073c0de",
"gas": "100484",
"maxFeePerGas": "31607801",
"maxPriorityFeePerGas": "1"
},
"id": "kwnvz-1760078642040-c3005198326d"
}This is a standard crosschain swap that settles on HyperEVM before being credited to HyperCore:
Deposit on Origin: The user's transaction calls the SpokePool on the origin chain, emitting a
FundsDepositedevent.Fill on HyperEVM: An Across relayer fills the deposit, which emits a
FilledRelayevent.Automatic Deposit to HyperCore: The Across API automatically appends a destination action to the relay. This action calls a specialized function on HyperEVM which, in turn, credits the user's USDC-SPOT balance on HyperCore. You do not need to specify this action in your API call.
Read the API Reference and in case you face any errors or need support, please feel free to reach out to us.
Last updated