Getting Started
Install the widget
Basic example
import { OpenOceanWidget } from '@openocean.finance/widget';
const widgetConfig = {
fromChain: 8453, // Source chain ID
toChain: 8453, // Destination chain ID (same as source in this case)
fromToken: '0x0000000000000000000000000000000000000000', // Address of the token you are sending (e.g., native token like ETH)
toToken: '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913', // Address of the token you want to receive
fromAmount: '1' // Amount to be swapped
subvariant:"bridge" // Set this only if you're enabling cross-chain functionality
theme: {
container: {
border: '1px solid rgb(234, 234, 234)',
borderRadius: '16px',
},
},
languages: {
allow: ['en'], // bn, de, en, es, fr, id, it, ja, ko, pt, th, tr, uk, vi, zh
// deny: ['uk'],
},
};
export const WidgetPage = () => {
return (
<OpenOceanWidget integrator="Your dApp/company name" config={widgetConfig} />
);
};Last updated