Skip to content

Commit

Permalink
publish: @dodoex/[email protected]
Browse files Browse the repository at this point in the history
  • Loading branch information
junjieit committed Sep 12, 2024
1 parent 2a8f06a commit 142a9d6
Show file tree
Hide file tree
Showing 2 changed files with 188 additions and 1 deletion.
187 changes: 187 additions & 0 deletions packages/doc/src/stories/widgets/Bridge.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
import { ComponentStory, ComponentMeta } from '@storybook/react';
import { Widget, BridgeTonSummaryDialog } from '@dodoex/widgets';
import { TokenInfo } from '@dodoex/widgets/dist/src/hooks/Token/type';

export enum ChainId {
MAINNET = 1,
RINKEBY = 4,
GOERLI = 5,

BSC = 56,

HECO = 128,

POLYGON = 137,

ARBITRUM_ONE = 42161,
ARBITRUM_RINKEBY = 421611,

AURORA = 1313161554,

MOONRIVER = 1285,

OKCHAIN = 66,

OPTIMISM = 10,

BOBA = 288,

AVALANCHE = 43114,

CRONOS = 25,
}
const ChainIdObj: {
[key in ChainId]?: keyof typeof ChainId;
} = {};
Object.keys(ChainId).forEach((key: any) => {
const numVal = Number(ChainId[key]) as ChainId;
if (!isNaN(numVal)) {
ChainIdObj[numVal] = key;
}
});

// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
export default {
title: 'Widgets/Bridge',
component: BridgeTonSummaryDialog,
} as ComponentMeta<typeof BridgeTonSummaryDialog>;

export const Primary = (args) => {
const slippage = 0.5;
return (
<Widget {...args}>
<BridgeTonSummaryDialog
fromTokenAddress="0x55d398326f99059ff775485246999027b3197955"
fromChainId={56}
toTokenAddress="EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs"
toChainId={-239}
slippage={slippage}
fromAmt="3.6"
tonAccount="UQB2nPKipw1XbQB_xwiTbpbihlHjZIQI2AuDo6ciCJUlBF5j"
redirectLink="https://t.me/gwegwehgww35223BOT/bridge"
/>
</Widget>
);
};

Primary.args = {
apikey: 'ef9apopzq9qrgntjubojbxe7hy4z5eez',
theme: {
palette: {
mode: 'light',
primary: {
main: '#1A1A1B',
},
secondary: {
main: '#FFE804',
contrastText: '#1A1A1B',
},
error: {
main: '#EC5A7D',
contrastText: '#FFFFFF',
},
warning: {
main: '#B15600',
contrastText: '#1A1A1B',
},
success: {
main: '#2FBA90',
contrastText: '#1A1A1B',
},
purple: {
main: '#6851B4',
contrastText: '#1A1A1B',
},
background: {
default: '#F9F6E8',
paper: '#FFFFFF',
paperContrast: '#F6F6F6',
backdrop: 'rgba(0, 0, 0, 0.9)',
input: '#F0F0F0',
tag: 'rgba(26, 26, 27, 0.04)',
},
text: {
primary: '#1A1A1B',
secondary: 'rgba(26, 26, 27, 0.5)',
disabled: 'rgba(26, 26, 27, 0.3)',
placeholder: 'rgba(26, 26, 27, 0.3)',
link: '#1A1A1B',
},
border: {
main: 'rgba(26, 26, 27, 0.1)',
light: 'rgba(26, 26, 27, 0.3)',
disabled: 'rgba(26, 26, 27, 0.1)',
},
hover: {
default: 'rgba(26, 26, 27, 0.1)',
},
},
},
defaultFromToken: {
chainId: 1,
address: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
name: 'Ether',
decimals: 18,
symbol: 'ETH',
logoURI:
'https://images.dodoex.io/prKmKP8yDTuPMHTCZ_DcxG8BqsuHNO8w5KDmJWmPodg/rs:fit:96:96:0/g:no/aHR0cHM6Ly9pbWFnZS1wcm94eS5kb2RvZXguaW8vOUVaWU1ER2ZVN3g2N3ZBZThqWkUxZzA0RExUaFhaV0JIb09wZFhpeXhHRS9hSFIwY0hNNkx5OWpaRzR0YldWa2FXRXVaRzlrYjJWNExtbHZMMlZ5WXpJd0wyaDBkSEJ6WDNNeVgyTnZhVzV0WVhKclpYUmpZWEJmWTI5dFgzTjBZWFJwWTE5cGJXZGZZMjlwYm5OZk5qUjROalJmTVRBeU4xOHhNekkyTjJGbE5EY3dMbkJ1WncucG5n.webp',
// amount: 10,
},
defaultToToken: {
chainId: 1,
address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
name: 'USD Coin',
decimals: 6,
symbol: 'USDC',
logoURI:
'https://images.dodoex.io/sQ5dF3FkjjQUsmfqFFE5cKq-cthh4u0wUooBE5Epf-k/rs:fit:96:96:0/g:no/aHR0cHM6Ly9pbWFnZS1wcm94eS5kb2RvZXguaW8vTDlEVElLa2dONG5mRkNTSF9GMUdXU3JiZkJDa2JZRTkwbmFDS0dIWnRsby9hSFIwY0hNNkx5OWpaRzR0YldWa2FXRXVaRzlrYjJWNExtbHZMM1Z6WkdOZlpXVTFNbUV4WldReVlpOTFjMlJqWDJWbE5USmhNV1ZrTW1JdWNHNW4ucG5n.webp',
amount: 100,
},
popularTokenList: [
{
chainId: 1,
address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
name: 'USD Coin',
decimals: 6,
symbol: 'USDC',
logoURI:
'https://images.dodoex.io/sQ5dF3FkjjQUsmfqFFE5cKq-cthh4u0wUooBE5Epf-k/rs:fit:96:96:0/g:no/aHR0cHM6Ly9pbWFnZS1wcm94eS5kb2RvZXguaW8vTDlEVElLa2dONG5mRkNTSF9GMUdXU3JiZkJDa2JZRTkwbmFDS0dIWnRsby9hSFIwY0hNNkx5OWpaRzR0YldWa2FXRXVaRzlrYjJWNExtbHZMM1Z6WkdOZlpXVTFNbUV4WldReVlpOTFjMlJqWDJWbE5USmhNV1ZrTW1JdWNHNW4ucG5n.webp',
},
{
chainId: 1,
address: '0x4Fabb145d64652a948d72533023f6E7A623C7C53',
name: 'Binance USD',
decimals: 18,
symbol: 'BUSD',
logoURI:
'https://images.dodoex.io/xZmadzpVOnpuq2jNG_5EGKeqMET0LU_gmfnp4VxkcxI/rs:fit:96:96:0/g:no/aHR0cHM6Ly9pbWFnZS1wcm94eS5kb2RvZXguaW8vSHQwWXZKMGNnU0lGTFM0aHExTV9jOXVITV9fMHpXaHBKSGVOQU5neTBuby9hSFIwY0hNNkx5OWpaRzR0YldWa2FXRXVaRzlrYjJWNExtbHZMMkoxYzJSZk4ySTJOalJpWWpReVpDOWlkWE5rWHpkaU5qWTBZbUkwTW1RdWNHNW4ucG5n.webp',
},
{
chainId: 4,
symbol: 'DODO',
address: '0xeaa70c2a40820dF9D38149C84dd943CFcB562587',
name: 'DODO',
decimals: 18,
source: 'dodo',
logoURI: '',
},
],
tokenList: 'all',
crossChain: true,
getAutoSlippage: ({
fromToken,
toToken,
}: {
fromToken: TokenInfo | null;
toToken: TokenInfo | null;
}) => {
if (!fromToken || !toToken || fromToken.chainId !== toToken.chainId) {
return undefined;
}
return new Promise((resolve) => {
setTimeout(() => {
resolve(0.9);
}, 1000);
});
},
};
2 changes: 1 addition & 1 deletion packages/dodoex-icons/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dodoex/icons",
"version": "2.0.1",
"version": "2.0.2",
"description": "DODO icons distributed as SVG React components.",
"main": "build/index.js",
"source": "src/index.js",
Expand Down

0 comments on commit 142a9d6

Please sign in to comment.