-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement Nano Contract integration with Wallet Connect
- Loading branch information
1 parent
42ae166
commit d79397b
Showing
24 changed files
with
1,963 additions
and
264 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
84 changes: 84 additions & 0 deletions
84
src/components/WalletConnect/NanoContract/DappContainer.js
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,84 @@ | ||
/** | ||
* Copyright (c) Hathor Labs and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { | ||
StyleSheet, | ||
View, | ||
Text, | ||
Image | ||
} from 'react-native'; | ||
import { t } from 'ttag'; | ||
import { commonStyles } from '../theme'; | ||
|
||
/** | ||
* Renders DApp information. | ||
* | ||
* @param {Object} props | ||
* @param {Object} props.dapp | ||
*/ | ||
export const DappContainer = ({ dapp }) => ( | ||
<View style={styles.container}> | ||
<View style={styles.header}> | ||
<View style={styles.avatar}> | ||
<Image | ||
source={{ uri: dapp.icon }} | ||
width={48} | ||
height={48} | ||
style={styles.avatarIcon} | ||
/> | ||
</View> | ||
<View> | ||
<Text style={styles.proposer}>{dapp.proposer}</Text> | ||
<Text style={styles.network}>{'• '}{'mainnet'}</Text> | ||
</View> | ||
</View> | ||
<View> | ||
<Text style={styles.emphasis}>{t`Review your transaction from this dApp`}</Text> | ||
</View> | ||
<View> | ||
<Text style={commonStyles.text}>{t`Stay vigilant and protect your data from potential phishing attempts.`}</Text> | ||
</View> | ||
</View> | ||
); | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
gap: 16, | ||
paddingVertical: 16, | ||
paddingHorizontal: 16, | ||
}, | ||
header: { | ||
flexDirection: 'row', | ||
gap: 16, | ||
}, | ||
avatar: { | ||
flexShrink: 1, | ||
alignSelf: 'flex-start', | ||
maxWidth: 48, | ||
maxHeight: 48, | ||
}, | ||
avatarIcon: { | ||
width: 48, | ||
height: 48, | ||
backgroundColor: 'hsla(0, 0%, 85%, 1)', | ||
borderRadius: 24, | ||
}, | ||
proposer: [ | ||
commonStyles.text, | ||
commonStyles.bold, | ||
commonStyles.mb4, | ||
], | ||
network: [ | ||
commonStyles.text, | ||
{ color: 'hsla(263, 100%, 64%, 1)', } | ||
], | ||
emphasis: [ | ||
commonStyles.text, | ||
commonStyles.bold | ||
] | ||
}); |
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 @@ | ||
/** | ||
* Copyright (c) Hathor Labs and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { | ||
StyleSheet, | ||
Text, | ||
} from 'react-native'; | ||
import { t } from 'ttag'; | ||
import { ModalBase } from '../../ModalBase'; | ||
|
||
/** | ||
* It renders a confirmation modal to decline the tranaction creation. | ||
* | ||
* @param {Object} props | ||
* @param {boolean} props.show Flag that determines the if the modal should appear or not. | ||
* @param {() => void} props.onDecline Callback fn for decline action. | ||
* @param {() => void} props.onDismiss Callback fn for dismiss action. | ||
*/ | ||
export const DeclineModal = ({ show, onDecline, onDismiss }) => ( | ||
<ModalBase show={show} onDismiss={onDismiss}> | ||
<ModalBase.Title>{t`Decline transaction`}</ModalBase.Title> | ||
<ModalBase.Body style={styles.declineModalBody}> | ||
<Text style={styles.text}> | ||
{t`Are you sure you want to decline this transaction?`} | ||
</Text> | ||
</ModalBase.Body> | ||
<ModalBase.Button | ||
title={t`Yes, decline transaction`} | ||
secondary | ||
danger | ||
onPress={onDecline} | ||
/> | ||
<ModalBase.DiscreteButton | ||
title={t`No, go back`} | ||
onPress={onDismiss} | ||
/> | ||
</ModalBase> | ||
); | ||
|
||
const styles = StyleSheet.create({ | ||
declineModalBody: { | ||
paddingBottom: 24, | ||
}, | ||
text: { | ||
fontSize: 16, | ||
lineHeight: 20, | ||
textAlign: 'center', | ||
}, | ||
}); |
Oops, something went wrong.