-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* adding kima-transaction-widget to `Bridge` page * fix webpack config, apply plugins on external loader * update kima-widet integration * update npm access token * update npm access token * update npm access token * add backend url * upgrade widget version * * remove unused code * update backend url * success, error handlers as callback * * remove npm access token * refactor Kima component's props * small fix * add sendData * Update src/pages/gd/Bridge/index.tsx --------- Co-authored-by: Lewis B <[email protected]> Co-authored-by: sirpy <[email protected]>
- Loading branch information
1 parent
d350332
commit 097c5ee
Showing
12 changed files
with
2,366 additions
and
410 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
nodeLinker: node-modules | ||
|
||
plugins: | ||
- path: .yarn/plugins/@yarnpkg/plugin-postinstall.cjs | ||
spec: 'https://raw.githubusercontent.com/gravitywelluk/yarn-plugin-postinstall/master/bundles/%40yarnpkg/plugin-postinstall.js' | ||
- path: .yarn/plugins/@yarnpkg/plugin-postinstall.cjs | ||
spec: "https://raw.githubusercontent.com/gravitywelluk/yarn-plugin-postinstall/master/bundles/%40yarnpkg/plugin-postinstall.js" | ||
|
||
yarnPath: .yarn/releases/yarn-3.2.3.cjs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import React, { memo, useCallback, useMemo } from 'react' | ||
import useActiveWeb3React from 'hooks/useActiveWeb3React' | ||
import { useApplicationTheme } from 'state/application/hooks' | ||
import { | ||
KimaTransactionWidget, | ||
KimaProvider, | ||
FontSizeOptions, | ||
ColorModeOptions, | ||
ModeOptions, | ||
DAppOptions, | ||
} from '@kimafinance/kima-transaction-widget' | ||
import '@kimafinance/kima-transaction-widget/dist/index.css' | ||
import useSendAnalyticsData from 'hooks/useSendAnalyticsData' | ||
|
||
const Bridge = memo(() => { | ||
const { library } = useActiveWeb3React() | ||
const [theme] = useApplicationTheme() | ||
const sendData = useSendAnalyticsData() | ||
|
||
const successHandler = useCallback(() => { | ||
sendData({ event: 'kima_bridge', action: 'bridge_success' }) | ||
}, []) | ||
|
||
const errorHandler = useCallback((e) => { | ||
console.log('Kima bridge error:', e?.message, e) | ||
sendData({ event: 'kima_bridge', action: 'bridge_failure', error: e?.message }) | ||
}, []) | ||
|
||
const options = useMemo( | ||
() => ({ | ||
theme: { | ||
colorMode: theme === 'light' ? ColorModeOptions.light : ColorModeOptions.dark, | ||
fontSize: FontSizeOptions.medium, | ||
fontFamily: 'Roboto', | ||
backgroundColorDark: 'rgb(21, 26, 48)', | ||
}, | ||
mode: ModeOptions.bridge, | ||
dAppOption: DAppOptions.G$, | ||
kimaBackendUrl: 'https://gooddollar-beta.kima.finance', | ||
kimaNodeProviderQuery: 'https://api_testnet.kima.finance', | ||
provider: library, | ||
compliantOption: false, | ||
}), | ||
[theme, library] | ||
) | ||
|
||
return ( | ||
<KimaProvider> | ||
<KimaTransactionWidget {...options} successHandler={successHandler} errorHandler={errorHandler} /> | ||
</KimaProvider> | ||
) | ||
}) | ||
|
||
export default Bridge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.