Skip to content

Commit

Permalink
CP-9000: handle avalanche_sendTransaction (#1480)
Browse files Browse the repository at this point in the history
  • Loading branch information
onghwan authored Aug 22, 2024
1 parent 7fcb5c5 commit 59f903c
Show file tree
Hide file tree
Showing 38 changed files with 466 additions and 2,421 deletions.
22 changes: 22 additions & 0 deletions packages/core-mobile/app/components/NodeID.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from 'react'
import { copyToClipboard } from 'utils/DeviceTools'
import { Text } from '@avalabs/k2-mobile'
import { truncateNodeId } from 'utils/Utils'
import AvaButton from './AvaButton'
import CopySVG from './svg/CopySVG'

export const NodeID = ({ nodeID }: { nodeID: string }): JSX.Element => {
return (
<AvaButton.TextWithIcon
textStyle={{ textAlign: 'left' }}
onPress={() => copyToClipboard(nodeID)}
icon={<CopySVG />}
iconPlacement="left"
text={
<Text variant="buttonSmall" sx={{ color: '$neutral50' }}>
{truncateNodeId(nodeID)}
</Text>
}
/>
)
}
3 changes: 1 addition & 2 deletions packages/core-mobile/app/navigation/AppNavigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,7 @@ enum ModalScreens {
SignTransactionV2 = 'ModalScreens.SignTransactionV2',
ApprovalPopup = 'ModalScreens.ApprovalPopup',
EditSpendLimit = 'ModalScreens.EditSpendLimit',
AvalancheSendTransactionV2 = 'ModalScreens.AvalancheSendTransactionV2',
AvalancheSignTransactionV2 = 'ModalScreens.AvalancheSignTransactionV2',
TransactionData = 'ModalScreens.TransactionData',
AvalancheSetDeveloperMode = 'ModalScreens.AvalancheSetDeveloperMode',
StakeDisclaimer = 'ModalScreens.StakeDisclaimer',
CoreIntro = 'ModalScreens.CoreIntro',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ import { BridgeStackParamList } from '../wallet/BridgeScreenStack'
import {
AddEthereumChainV2Params,
ApprovalPopupParams,
AvalancheSendTransactionV2Params,
AvalancheSetDeveloperModeParams,
BridgeAssetV2Params,
BridgeTransactionStatusParams,
Expand All @@ -95,7 +94,8 @@ import {
SwitchEthereumChainV2Params,
TokenSelectParams,
UpdateContactV2Params,
WalletScreenProps
WalletScreenProps,
TransactionDataParams
} from '../types'
import AdvancedStackScreen, {
AdvancedStackParamList
Expand Down Expand Up @@ -158,6 +158,7 @@ export type WalletScreenStackParams = {
[AppNavigation.Modal.SelectToken]: TokenSelectParams
[AppNavigation.Modal.EditGasLimit]: EditGasLimitParams
[AppNavigation.Modal.EditSpendLimit]: EditSpendLimitParams
[AppNavigation.Modal.TransactionData]: TransactionDataParams
[AppNavigation.Modal.BuyCarefully]: BuyCarefullyParams
// rpc prompts for wallet connect v2
[AppNavigation.Modal.SessionProposalV2]: SessionProposalV2Params
Expand All @@ -168,8 +169,6 @@ export type WalletScreenStackParams = {
[AppNavigation.Modal.SwitchEthereumChainV2]: SwitchEthereumChainV2Params
[AppNavigation.Modal.BridgeAssetV2]: BridgeAssetV2Params
[AppNavigation.Modal.ApprovalPopup]: ApprovalPopupParams
[AppNavigation.Modal
.AvalancheSendTransactionV2]: AvalancheSendTransactionV2Params
[AppNavigation.Modal
.AvalancheSetDeveloperMode]: AvalancheSetDeveloperModeParams
[AppNavigation.Modal.StakeDisclaimer]: undefined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import AddEthereumChainV2 from 'screens/rpc/components/v2/AddEthereumChain'
import SwitchEthereumChainV2 from 'screens/rpc/components/v2/SwitchEthereumChain'
import ApprovalPopup from 'screens/rpc/components/v2/ApprovalPopup'
import BuyCarefully from 'screens/rpc/buy/BuyCarefully'
import AvalancheSendTransactionV2 from 'screens/rpc/components/v2/AvalancheSendTransaction'
import { DisclaimerBottomSheet } from 'screens/earn/components/DisclaimerBottomSheet'
import IntroModal from 'screens/onboarding/IntroModal'
import { ViewOnceKey } from 'store/viewOnce'
Expand All @@ -32,6 +31,7 @@ import { AvalancheSetDeveloperMode } from 'screens/rpc/components/v2/AvalancheSe
import { UseWalletConnectModal } from 'screens/browser/UseWalletConnectModal'
import AlertScreen from 'screens/rpc/components/v2/AlertScreen'
import EditSpendLimit from 'components/EditSpendLimit'
import TransactionDataScreen from 'screens/rpc/components/v2/TransactionDataScreen'
import { SignOutModalScreen, WalletScreenSType } from './WalletScreenStack'

export const createModals = (WalletScreenS: WalletScreenSType): JSX.Element => {
Expand Down Expand Up @@ -76,8 +76,8 @@ export const createModals = (WalletScreenS: WalletScreenSType): JSX.Element => {
component={EditSpendLimit}
/>
<WalletScreenS.Screen
name={AppNavigation.Modal.AvalancheSendTransactionV2}
component={AvalancheSendTransactionV2}
name={AppNavigation.Modal.TransactionData}
component={TransactionDataScreen}
/>
<WalletScreenS.Screen
name={AppNavigation.Modal.AvalancheSetDeveloperMode}
Expand Down
14 changes: 5 additions & 9 deletions packages/core-mobile/app/navigation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ import { Asset, Blockchain } from '@avalabs/core-bridge-sdk'
import { WalletAddEthereumChainRpcRequest as WalletAddEthereumChainRpcRequestV2 } from 'store/rpc/handlers/chain/wallet_addEthereumChain/wallet_addEthereumChain'
import { Network } from '@avalabs/core-chains-sdk'
import { WalletSwitchEthereumChainRpcRequest as WalletSwitchEthereumChainRpcRequestV2 } from 'store/rpc/handlers/chain/wallet_switchEthereumChain/wallet_switchEthereumChain'
import {
SendTransactionApproveData,
AvalancheSendTransactionRpcRequest as AvalancheSendTransactionRpcRequestV2
} from 'store/rpc/handlers/avalanche_sendTransaction/avalanche_sendTransaction'
import { EarnStackParamList } from 'navigation/wallet/EarnScreenStack/EarnScreenStack'
import { RefreshTokenScreenStackParamList } from 'navigation/RefreshTokenScreenStack'
import { BrowserStackParamList } from 'navigation/wallet/BrowserScreenStack'
Expand Down Expand Up @@ -93,6 +89,11 @@ export type EditSpendLimitParams = {
dAppName?: string
}

export type TransactionDataParams = {
data: string
onClose(): void
}

export type SessionProposalV2Params = {
request: WCSessionProposal
namespaces: Record<string, ProposalTypes.RequiredNamespace>
Expand Down Expand Up @@ -139,11 +140,6 @@ export type ApprovalPopupParams = {
onReject: (message?: string) => void
}

export type AvalancheSendTransactionV2Params = {
request: AvalancheSendTransactionRpcRequestV2
data: SendTransactionApproveData
}

export type AvalancheSetDeveloperModeParams = {
request: AvalancheSetDeveloperModeRpcRequest
data: AvalancheSetDeveloperModeApproveData
Expand Down

This file was deleted.

Loading

0 comments on commit 59f903c

Please sign in to comment.