# Aurora Cloud Bridge
The Aurora Cloud Bridge is the place to onramp, pay, bridge, send and receive assets on Aurora Cloud Silos.
Some examples include bridging from a Ledger wallet address on Ethereum to a hot wallet app on a Virtual Chain, or briding from a NEAR wallet to a virtual chain wallet without needing the virtual chain app to support NEAR wallets, or onramping with a credit card. The app can pre-set the destination network, recipient and amount so that the user only needs to select a deposit method and pay. These use cases are not possible with the rainbowbridge.app UX.
Aurora Cloud Bridge also takes a different approach than rainbowbridge.app because the user doesn't know which tokens are available on which virtual chains and we don't want users sending the wrong tokens. So the user first selects where to send a token and then can chose among different available options to fulfill their intent.
Apps can use this interface as a payment url where the app sets the destination network, token, address and amount in url params and then the spender selects the payment method (credit card, bridge from another network, simple transfer from another wallet, deposit from an exchange). This way the user is able to onboard quickly to a virtual chain in a few clicks.
The user is also able to connect any wallet to transfer funds to a virtual chain (not necessarily the same wallet that is used in a silo dApp). The user can get transfer quotes and see available options before having to connect a wallet.
When transfering tokens to a silo, the token must have been registered and recipient whitelisted when applicable.
Future features:
- Let the user consolidate and swap tokens from multiple networks before making the transfer to the final recipient.
## Functionality
### Silo onramps from fiat
- Munzen: every supported silo and token.
- Transak: Aurora Mainnet.
- Forwarder: every supported silo and token.
### Silo onramps from other networks
- Ethereum: Rainbow Bridge (~30 min).
- NEAR: instant deposit to silos.
- Aurora: instant deposit to silos (XCC token transfer).
- Silo to Silo: XCC bridge contract must have been deployed and tokens must have been registered.
### Transfer between networks
- Silo to NEAR: all tokens bridged from NEAR to a silo can be withdrawn (NEP-141 storage fees may need to be paid if recipient never held the token).
- Silo to Ethereum: Fast bridge must have been deployed on the silo.
- Other Rainbow Bridge functionality:
- Ethereum to NEAR and Ethereum to Aurora.
- ~~NEAR to Ethereum using fast bridge.~~ deprecated.
- Slow transfers to Ethereum which require finalization are not available (yet?) and can be done using [rainbowbridge.app](https://rainbowbridge.app) instead.
### Payment
- Select among different options (simple transfer, bridge from other networks, deposit from exchanges, onramp with credit card) to send tokens to an address.
## Configuration
When parameters are not provided, all the default functionality is available.
Dapps can simplify the user onramp journey by presetting transfer parameters. For example to onramp USDC.e to a specific silo.
### Custom settings
- Configure available networks and tokens
- Define new custom chains and tokens
- Fix a recipient
#### `toNetworks`
Array of Aurora Cloud ID chains where the tokens can be received.
The ID is the NEAR account of the Silo EVM (`aurora`, `silo-1.aurora-silo.near`...) or `ethereum` or `near`.
```js
const toNetworks = JSON.stringify(["silo-1.aurora-silo.near"])
const url = "https://aurora-plus-git-cloud-bridge-auroraisnear.vercel.app/cloud?" + new URLSearchParams({ toNetworks }).toString()
// https://aurora-plus-git-cloud-bridge-auroraisnear.vercel.app/cloud?toNetworks=%5B%22silo-1.aurora-silo.near%22%5D
```
#### `tokens`
Array of token symbols available to transfer.
```js
const tokens = JSON.stringify(["USDC.e"])
const url = "https://aurora-plus-git-cloud-bridge-auroraisnear.vercel.app/cloud?" + new URLSearchParams({ tokens }).toString()
// https://aurora-plus-git-cloud-bridge-auroraisnear.vercel.app/cloud?tokens=%5B%22USDC.e%22%5D
```
#### `fromNetworks`
Array of Aurora Cloud ID chains or Onramp IDs which can be used as source of funds.
The Aurora Cloud ID is the NEAR account of the Silo EVM (`aurora`, `silo-1.aurora-silo.near`...) or `ethereum` or `near`.
The Onramp IDs currently available are "munzen", "forwarder" and "transak".
DApps usually should not restrict `fromNetworks` so this feature will be less commonly used than `toNetworks`.
```js
const fromNetworks = JSON.stringify(["munzen"])
const url = "https://aurora-plus-git-cloud-bridge-auroraisnear.vercel.app/cloud?" + new URLSearchParams({ fromNetworks }).toString()
// https://aurora-plus-git-cloud-bridge-auroraisnear.vercel.app/cloud?fromNetworks=%5B%22munzen%22%5D
```
#### `recipient`
Recipient's wallet address (0x...) or NEAR account (.near, .tg, pubkey). When set, the user cannot edit the recipient, this is to prevent sending tokens to a non whitelisted address. Use `recipientSelection` instead to allow the user to modify the address.
A Dapp on a silo onboarding a user should set it to the user's whitelisted wallet address so that tokens can be received.
```js
const recipient = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
const url = "https://aurora-plus-git-cloud-bridge-auroraisnear.vercel.app/cloud?" + new URLSearchParams({ recipient }).toString()
// https://aurora-plus-git-cloud-bridge-auroraisnear.vercel.app/cloud?recipient=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
```
#### `customChains`
This parameter makes it possible for apps like Aurora Cloud Console to interact with chains that are not available by default.
```js
const customChains = JSON.stringify([
{
id: 1313161562,
name: "TPRO Network",
network: "TPRO Network",
nativeCurrency: {
decimals: 18,
name: "TPRO",
symbol: "TPRO",
},
rpcUrl: "https://rpc-tpro.aurora.dev",
blockExplorer: {
name: "TPRO Network Explorer",
url: "https://explorer.rpc-tpro.aurora.dev",
},
auroraEvmAccount: "0x4e45415a.c.aurora",
fastBridge: null,
siloToSiloBridge: null,
// logo: "/static/images/tpro.png",
// websiteUrl: null,
// currencyERC20: null,
},
])
const url = "https://aurora-plus-git-cloud-bridge-auroraisnear.vercel.app/cloud?" + new URLSearchParams({ customChains }).toString()
// https://aurora-plus-git-cloud-bridge-auroraisnear.vercel.app/cloud?customChains=%5B%7B%22id%22%3A1313161562%2C%22name%22%3A%22TPRO+Network%22%2C%22network%22%3A%22TPRO+Network%22%2C%22nativeCurrency%22%3A%7B%22decimals%22%3A18%2C%22name%22%3A%22TPRO%22%2C%22symbol%22%3A%22TPRO%22%7D%2C%22rpcUrl%22%3A%22https%3A%2F%2Frpc-tpro.aurora.dev%22%2C%22blockExplorer%22%3A%7B%22name%22%3A%22TPRO+Network+Explorer%22%2C%22url%22%3A%22https%3A%2F%2Fexplorer.rpc-tpro.aurora.dev%22%7D%2C%22auroraEvmAccount%22%3A%220x4e45415a.c.aurora%22%2C%22fastBridge%22%3Anull%2C%22siloToSiloBridge%22%3Anull%7D%5D
```
#### `customTokens`
This parameter makes it possible for apps like Aurora Cloud Console to interact with tokens that are not available by default.
```js
const customTokens = JSON.stringify([
{
symbol: "TPRO",
name: "TPRO",
decimals: 18,
origin: "ethereum",
isFast: false,
icon: "/static/images/tpro.png",
ethereum: "0x3540abe4f288b280a0740ad5121aec337c404d15",
near: "3540abe4f288b280a0740ad5121aec337c404d15.factory.bridge.near",
aurora: "0xaf40a53b7e20331f4199d43bc3b8957d4082bb71",
"silo-1.aurora-silo.near": null,
// `0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee` means that TPRO is the native currency of the silo `0x4e45415a.c.aurora`.
"0x4e45415a.c.aurora": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
},
])
const url = "https://aurora-plus-git-cloud-bridge-auroraisnear.vercel.app/cloud?" + new URLSearchParams({ customTokens }).toString()
// https://aurora-plus-git-cloud-bridge-auroraisnear.vercel.app/cloud?customTokens=%5B%7B%22symbol%22%3A%22TPRO%22%2C%22name%22%3A%22TPRO%22%2C%22decimals%22%3A18%2C%22origin%22%3A%22ethereum%22%2C%22isFast%22%3Afalse%2C%22icon%22%3A%22%2Fstatic%2Fimages%2Ftpro.png%22%2C%22ethereum%22%3A%220x3540abe4f288b280a0740ad5121aec337c404d15%22%2C%22near%22%3A%223540abe4f288b280a0740ad5121aec337c404d15.factory.bridge.near%22%2C%22aurora%22%3A%220xaf40a53b7e20331f4199d43bc3b8957d4082bb71%22%2C%22silo-1.aurora-silo.near%22%3Anull%2C%220x4e45415a.c.aurora%22%3A%220xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee%22%7D%5D
```
### Preselect parameters
These parameters are mainly used when doing callbacks from mynearwallet to continue where the user left off.
When set, the value is preselected but unlike the custom settings, the user it able to modify it.
#### `toNetworkSelection`
Preselected Aurora Cloud ID.
```js
const toNetworkSelection = "aurora"
const url = "https://aurora-plus-git-cloud-bridge-auroraisnear.vercel.app/cloud?" + new URLSearchParams({ toNetworkSelection }).toString()
// https://aurora-plus-git-cloud-bridge-auroraisnear.vercel.app/cloud?toNetworkSelection=aurora
```
#### `tokenSymbolSelection`
Preselected token symbol.
```js
const tokenSymbolSelection = "USDC.e"
const url = "https://aurora-plus-git-cloud-bridge-auroraisnear.vercel.app/cloud?" + new URLSearchParams({ tokenSymbolSelection }).toString()
// https://aurora-plus-git-cloud-bridge-auroraisnear.vercel.app/cloud?tokenSymbolSelection=USDC.e
```
#### `fromNetworkSelection`
Preselected Aurora Cloud ID or Onramp ID.
```js
const fromNetworkSelection = "ethereum"
const url = "https://aurora-plus-git-cloud-bridge-auroraisnear.vercel.app/cloud?" + new URLSearchParams({ fromNetworkSelection }).toString()
// https://aurora-plus-git-cloud-bridge-auroraisnear.vercel.app/cloud?fromNetworkSelection=ethereum
```
#### `amountSelection`
Preselected bignumber decimal amount.
```js
const amountSelection = "41500000000000000"
const url = "https://aurora-plus-git-cloud-bridge-auroraisnear.vercel.app/cloud?" + new URLSearchParams({ amountSelection }).toString()
// https://aurora-plus-git-cloud-bridge-auroraisnear.vercel.app/cloud?amountSelection=41500000000000000
```
#### `recipientSelection`
Preselected recipient.
```js
const recipientSelection = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
const url = "https://aurora-plus-git-cloud-bridge-auroraisnear.vercel.app/cloud?" + new URLSearchParams({ recipientSelection }).toString()
// https://aurora-plus-git-cloud-bridge-auroraisnear.vercel.app/cloud?recipientSelection=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
```
## Example
Open the url in a new popup window.
```html
<a
href="https://aurora-plus-git-cloud-bridge-auroraisnear.vercel.app/cloud"
target="_blank"
rel="noopener noreferrer"
onClick={(e) => {
e.preventDefault()
window.open(
e.currentTarget.href,
"newwindow",
`width=${600},height=${800},left=${
window.screen.width / 2 - 300
},top=${window.screen.height / 2 - 400}`
)
}}
>
Bridge!
</a>
```
