-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f7ec61c
commit 987caea
Showing
70 changed files
with
1,694 additions
and
187 deletions.
There are no files selected for viewing
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
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 was deleted.
Oops, something went wrong.
45 changes: 45 additions & 0 deletions
45
apps/mobile/src/features/approver/components/approver-account-card.tsx
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,45 @@ | ||
import { AvatarIcon } from '@/components/avatar-icon'; | ||
import { AccountListItem } from '@/features/account-list/account-list-item'; | ||
import { AccountAddress } from '@/features/account-list/components/account-address'; | ||
import { AccountBalance } from '@/features/account-list/components/account-balance'; | ||
import { useAccountsByFingerprint } from '@/store/accounts/accounts.read'; | ||
import { useWallets } from '@/store/wallets/wallets.read'; | ||
import { t } from '@lingui/macro'; | ||
import { useTheme } from '@shopify/restyle'; | ||
|
||
import { Text, Theme } from '@leather.io/ui/native'; | ||
|
||
export function ApproverAccountCard() { | ||
const theme = useTheme<Theme>(); | ||
const { list: walletsList } = useWallets(); | ||
const wallet = walletsList[0]; | ||
|
||
if (!wallet) throw new Error('no wallet present in approver'); | ||
|
||
const { list: accountList } = useAccountsByFingerprint(wallet.fingerprint); | ||
const account = accountList[0]; | ||
|
||
if (!account) throw new Error('no account present in approver'); | ||
|
||
return ( | ||
<> | ||
<Text variant="label01"> | ||
{t({ | ||
id: 'approver.account.title', | ||
message: 'With account', | ||
})} | ||
</Text> | ||
<AccountListItem | ||
accountName={account.name} | ||
address={ | ||
<AccountAddress accountIndex={account.accountIndex} fingerprint={account.fingerprint} /> | ||
} | ||
balance={ | ||
<AccountBalance accountIndex={account.accountIndex} fingerprint={account.fingerprint} /> | ||
} | ||
icon={<AvatarIcon color={theme.colors['ink.background-primary']} icon={account.icon} />} | ||
walletName={wallet.name} | ||
/> | ||
</> | ||
); | ||
} |
77 changes: 77 additions & 0 deletions
77
apps/mobile/src/features/approver/components/code-card.tsx
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,77 @@ | ||
import { ScrollView } from 'react-native-gesture-handler'; | ||
|
||
import { t } from '@lingui/macro'; | ||
|
||
import { Highlighter, Prism, Text } from '@leather.io/ui/native'; | ||
|
||
/* eslint-disable-next-line lingui/no-unlocalized-strings */ | ||
const sampleCode = ` | ||
;; hello-world contract | ||
(define-constant sender 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR) | ||
(define-constant recipient 'SM2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQVX8X0G) | ||
(define-fungible-token novel-token-19) | ||
(ft-mint? novel-token-19 u12 sender) | ||
(ft-transfer? novel-token-19 u2 sender recipient) | ||
(define-non-fungible-token hello-nft uint) | ||
(nft-mint? hello-nft u1 sender) | ||
(nft-mint? hello-nft u2 sender) | ||
(nft-transfer? hello-nft u1 sender recipient) | ||
(define-public (test-emit-event) | ||
(begin | ||
(print "Event! Hello world") | ||
(ok u1) | ||
) | ||
) | ||
(begin (test-emit-event)) | ||
(define-public (test-event-types) | ||
(begin | ||
(unwrap-panic (ft-mint? novel-token-19 u3 recipient)) | ||
(unwrap-panic (nft-mint? hello-nft u2 recipient)) | ||
(unwrap-panic (stx-transfer? u60 tx-sender 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR)) | ||
(unwrap-panic (stx-burn? u20 tx-sender)) | ||
(ok u1) | ||
) | ||
) | ||
(define-map store { key: (buff 32) } { value: (buff 32) }) | ||
(define-public (get-value (key (buff 32))) | ||
(begin | ||
(match (map-get? store { key: key }) | ||
entry (ok (get value entry)) | ||
(err 0) | ||
) | ||
) | ||
) | ||
(define-public (set-value (key (buff 32)) (value (buff 32))) | ||
(begin | ||
(map-set store { key: key } { value: value }) | ||
(ok u1) | ||
) | ||
) | ||
`; | ||
|
||
export function CodeCard() { | ||
return ( | ||
<> | ||
<Text variant="label01"> | ||
{t({ | ||
id: 'approver.code.title', | ||
message: 'Code', | ||
})} | ||
</Text> | ||
<ScrollView horizontal> | ||
<Highlighter code={sampleCode} prism={Prism} language="clarity" /> | ||
</ScrollView> | ||
</> | ||
); | ||
} |
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,67 @@ | ||
import { ReactNode } from 'react'; | ||
|
||
import { FeeBadge } from '@/features/send/fee-badge'; | ||
import { t } from '@lingui/macro'; | ||
|
||
import { FeeTypes } from '@leather.io/models'; | ||
import { | ||
AnimalChameleonIcon, | ||
AnimalEagleIcon, | ||
AnimalRabbitIcon, | ||
AnimalSnailIcon, | ||
Avatar, | ||
Box, | ||
ChevronRightIcon, | ||
Flag, | ||
ItemLayout, | ||
Pressable, | ||
Text, | ||
} from '@leather.io/ui/native'; | ||
import { match } from '@leather.io/utils'; | ||
|
||
export function FeeCard({ feeType }: { feeType: FeeTypes }) { | ||
const matchFeeType = match<FeeTypes>(); | ||
const feeIcon = matchFeeType<ReactNode>(feeType, { | ||
[FeeTypes.Low]: <AnimalSnailIcon />, | ||
[FeeTypes.Middle]: <AnimalRabbitIcon />, | ||
[FeeTypes.High]: <AnimalEagleIcon />, | ||
[FeeTypes.Custom]: <AnimalChameleonIcon />, | ||
[FeeTypes.Unknown]: <AnimalChameleonIcon />, | ||
}); | ||
return ( | ||
<> | ||
<Box flexDirection="row"> | ||
<Text variant="label01"> | ||
{t({ | ||
id: 'approver.fee.title', | ||
message: 'Fee', | ||
})} | ||
</Text> | ||
<FeeBadge type="normal" /> | ||
</Box> | ||
<Pressable flexDirection="row" onPress={() => {}} py="3"> | ||
<Flag | ||
img={ | ||
<Avatar bg="ink.background-secondary" p="1"> | ||
{feeIcon} | ||
</Avatar> | ||
} | ||
> | ||
<ItemLayout | ||
titleLeft={t({ | ||
id: 'approver.fee.type.normal', | ||
message: 'Normal', | ||
})} | ||
captionLeft={t({ | ||
id: 'approver.fee.speed.normal', | ||
message: '~20 mins', | ||
})} | ||
titleRight="0.000034 BTC" | ||
captionRight="$ 1.65" | ||
actionIcon={<ChevronRightIcon />} | ||
/> | ||
</Flag> | ||
</Pressable> | ||
</> | ||
); | ||
} |
Oops, something went wrong.