Default Chains and Tokens
Squid Widget v2.0: Default Chains and Tokens Configuration Guide
This guide explains how to configure default chains and tokens for the Squid Widget v2.0. Note that there have been significant changes from previous versions.
Finding Chain IDs and Token Addresses
Before configuring, you'll need to know the correct chain IDs and token addresses:
Chain IDs:
Use Squid's API playground
Or access the chains endpoint directly
Token Addresses:
Use the tokens endpoint
Or filter by chain in the API playground (input the chain ID in the
/tokens
reference)
Configuring Initial Assets (Chains and Tokens)
In Squid v2.0, initialFromChainId
and initialToChainId
have been replaced by the initialAssets
object:
<SquidWidget
config={{
initialAssets: {
from: {
address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", // Token address
chainId: "1", // Ethereum
},
to: {
address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", // Token address
chainId: "42161", // Arbitrum
},
},
// ... other configuration options
}}
/>
Configuring Default Tokens Per Chain
The defaultTokens
property has been renamed to defaultTokensPerChain
:
<SquidWidget
config={{
defaultTokensPerChain: [
{
address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", // ETH on Ethereum
chainId: "1",
},
{
address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", // ETH on Arbitrum
chainId: "42161",
},
],
// ... other configuration options
}}
/>
Removed Features
Please note that the following features have been removed in Squid v2.0:
favTokens
: Favorite tokens are no longer supported.Several other properties including
companyName
,titles
,enableExpress
,mainLogoUrl
, and others. Refer to the migration guide for a full list.
Full Example
Here's a complete example combining these configurations:
import { SquidWidget } from '@0xsquid/widget';
function App() {
return (
<SquidWidget
config={{
integratorId: "<your-integrator-id>",
apiUrl: "https://apiplus.squidrouter.com",
initialAssets: {
from: {
address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
chainId: "1",
},
to: {
address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
chainId: "42161",
},
},
defaultTokensPerChain: [
{
address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
chainId: "1",
},
{
address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
chainId: "42161",
},
],
// ... other configuration options
}}
/>
);
}
export default App;
Last updated