Swap and Sale Integration
Last updated
Last updated
Place this script tag on the <body>
of your page:
<script src="https://unpkg.com/@bitoftrade/crypto-trading-widget-sdk/build/index.js"
type="text/javascript"></script>
<div id="widget"></div>
Add this to the <script> tag at the bottom of the <body> tag:
<script>
const = {
palletOverrides: {
"primary": "#38D9C0",
"secondary": "#2B363B",
"paper": "#1A1F23",
"text-primary": "#fff",
"text-secondary": "#C5C9C9",
"text-primaryButton": "#fff",
"text-secondaryButton": "#C5C9C9",
"secondaryButton": "#255558",
"success": "#38D9C0",
"error": "#FF6666",
"warning": "#FF7A2A",
},
chainOptions: {
'': {
enabled: true,
defaultTokenAddress: "",
},
'0x89': {
enabled: true,
defaultTokenAddress: "0x5ceebb0947d58fabde2fc026ffe4b33ccfe1ba8b",
},
'0xfa': {
enabled: true,
defaultTokenAddress: "0x6a07a792ab2965c72a5b8088d3a069a7ac3a993b",
},
'0x38': {
enabled: true,
defaultTokenAddress: "0x3ee2200efb3400fabb9aacf31297cbdd1d435d47",
},
'0xa86a': {
enabled: true,
defaultTokenAddress: "0x60781c2586d68229fde47564546784ab3faca982",
},
},
widgetType: "swap",
};
</script>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Widget Demo</title>
</head>
<body>
<script src="https://unpkg.com/@bitoftrade/crypto-trading-widget-sdk/build/index.js"
type="text/javascript"></script>
<div id="widget"></div>
<script>
const configuration = {
paletteOverrides: {
"primary": "#38D9C0",
"secondary": "#2B363B",
"paper": "#1A1F23",
"text-primary": "#fff",
"text-secondary": "#C5C9C9",
"text-primaryButton": "#fff",
"text-secondaryButton": "#C5C9C9",
"secondaryButton": "#255558",
"success": "#38D9C0",
"error": "#FF6666",
"warning": "#FF7A2A",
},
chainOptions: {
'0x1': {
enabled: true,
defaultTokenAddress: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
},
'0x89': {
enabled: true,
defaultTokenAddress: "0x2791bca1f2de4661ed88a30c99a7a9449aa84174",
},
'0xfa': {
enabled: true,
defaultTokenAddress: "0x04068da6c83afcfa0e13ba15a6696662335d5b75",
},
'0x38': {
enabled: true,
defaultTokenAddress: "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
},
'0xa86a': {
enabled: true,
defaultTokenAddress: "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e",
},
},
widgetType: "swap",
};
CryptoTradingWidget.tradingWidget('widget', configuration);
</script>
</body>
</html>
Here is the full code