Skip to content

Commit

Permalink
Merge pull request #609 from z3us-dapps/develop
Browse files Browse the repository at this point in the history
v2.0.47+ext
  • Loading branch information
heathsnee authored Aug 27, 2024
2 parents 9d4b212 + 1b0bd9c commit 227f94a
Show file tree
Hide file tree
Showing 28 changed files with 40 additions and 39 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,6 @@
"xxxlarge",
"xxxxlarge",
"zustand"
]
],
"workbench.sideBar.location": "right"
}
2 changes: 1 addition & 1 deletion apps/extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "z3us-extension",
"version": "2.0.46",
"version": "2.0.47",
"type": "module",
"scripts": {
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
Expand Down
2 changes: 1 addition & 1 deletion apps/extension/src/browser/background/message-handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { getPrivateKey, publicKeyToJSON } from '@src/crypto/key_pair'
import { getSecret as cryptoGetSecret, getCombineData } from '@src/crypto/secret'
import type { SignatureJSON, SignatureWithPublicKeyJSON } from '@src/crypto/signature'
import { signatureToJSON, signatureWithPublicKeyToJSON } from '@src/crypto/signature'
import { saveInteractions } from '@src/radix/interaction'
import { saveInteractions } from '@src/networks/radix/interaction'
import { type Data } from '@src/types/vault'

import { getExtensionTabsByUrl } from '../tabs'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { PORT_NAME } from '@src/browser/messages/constants'
import { newMessage } from '@src/browser/messages/message'
import type { Message, ResponseMessage } from '@src/browser/messages/types'
import { MessageSource } from '@src/browser/messages/types'
import { addOriginToCancelInteraction, addOriginToWalletInteraction } from '@src/radix/add-origin-to-wallet-interaction'
import { addOriginToCancelInteraction, addOriginToWalletInteraction } from '@src/networks/radix/add-origin-to-wallet-interaction'

import timeout, { reason } from '../messages/timeout'
import { chromeDAppClient, logger, radixMessageHandler, sendRadixMessage } from './radix'
Expand Down
2 changes: 1 addition & 1 deletion apps/extension/src/components/forms/add-persona-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { SelectSimple } from 'ui/src/components/select'
import { useSharedStore } from 'ui/src/hooks/use-store'
import { KeystoreType } from 'ui/src/store/types'

import { useAddPersona } from '@src/hooks/use-add-persona'
import { useAddPersona } from '@src/networks/radix/hooks/use-add-persona'

import * as styles from './styles.css'

Expand Down
4 changes: 2 additions & 2 deletions apps/extension/src/context/zdt-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { useSharedStore } from 'ui/src/hooks/use-store'

import { usePasswordModal } from '@src/hooks/modal/use-password-modal'
import { useSendTransaction } from '@src/hooks/transaction/use-send'
import { useBuildNewAccountKeyParts } from '@src/hooks/use-add-account'
import { useBuildNewPersonKeyParts } from '@src/hooks/use-add-persona'
import { useBuildNewAccountKeyParts } from '@src/networks/radix/hooks/use-add-account'
import { useBuildNewPersonKeyParts } from '@src/networks/radix/hooks/use-add-persona'
import { useIsUnlocked } from '@src/hooks/use-is-unlocked'
import { useMessageClient } from '@src/hooks/use-message-client'

Expand Down
4 changes: 2 additions & 2 deletions apps/extension/src/hooks/transaction/use-intent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import { useAccountIndexes } from 'ui/src/hooks/use-account-indexes'
import { buildAccountDerivationPath } from '@src/crypto/derivation_path'
import { deriveEd25519, ed25519FromSeed } from '@src/crypto/key_pair'
import { createMnemonic } from '@src/crypto/secret'
import { summaryFromInstructions } from '@src/radix/manifest'
import { appendAssertWorktopContainsFungibles, appendLockFeeInstruction } from '@src/radix/transaction'
import { summaryFromInstructions } from '@src/networks/radix/manifest'
import { appendAssertWorktopContainsFungibles, appendLockFeeInstruction } from '@src/networks/radix/transaction'
import type { TransactionMeta, TransactionSettings } from '@src/types/transaction'

const messages = defineMessages({
Expand Down
4 changes: 3 additions & 1 deletion apps/extension/src/hooks/transaction/use-preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import { RadixEngineToolkit, generateRandomNonce } from '@radixdlt/radix-engine-
import { useCallback } from 'react'

import { useGatewayClient } from 'ui/src/hooks/dapp/use-gateway-client'
import { useNetworkId } from 'ui/src/hooks/dapp/use-network'
import { useNoneSharedStore } from 'ui/src/hooks/use-store'

import { gatewayPublicKeyFromPersonaOrAccount } from '@src/crypto/key_pair'
import type { TransactionSettings } from '@src/types/transaction'

export const usePreview = () => {
const networkId = useNetworkId()
const { status, transaction } = useGatewayClient()

const { allAccountIndexes } = useNoneSharedStore(state => ({
Expand Down Expand Up @@ -54,5 +56,5 @@ export const usePreview = () => {
})
}

return useCallback(buildPreview, [allAccountIndexes, status, transaction])
return useCallback(buildPreview, [networkId, allAccountIndexes, status, transaction])
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ import { KeystoreType } from 'ui/src/store/types'

import { getDAppDataToSign, proofCurve } from '@src/crypto/signature'
import { usePasswordModal } from '@src/hooks/modal/use-password-modal'
import { useLedgerClient } from '@src/hooks/use-ledger-client'
import { useMessageClient } from '@src/hooks/use-message-client'

import { useLedgerClient } from '../use-ledger-client'

const messages = defineMessages({
account_challenge: {
id: 'A4qogS',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ import type { Keystore, Persona } from 'ui/src/store/types'
import { KeystoreType } from 'ui/src/store/types'

import { getDAppDataToSign, proofCurve } from '@src/crypto/signature'

import { usePasswordModal } from '../modal/use-password-modal'
import { useLedgerClient } from '../use-ledger-client'
import { useMessageClient } from '../use-message-client'
import { usePasswordModal } from '@src/hooks/modal/use-password-modal'
import { useLedgerClient } from '@src/hooks/use-ledger-client'
import { useMessageClient } from '@src/hooks/use-message-client'

const messages = defineMessages({
persona_challenge_title: {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Box } from 'ui/src/components/box'
import FieldValue from 'ui/src/components/field-value'
import { AccountSnippet } from 'ui/src/components/snippet/account'

import { resolveManifestAddress } from '@src/radix/manifest'
import { resolveManifestAddress } from '@src/networks/radix/manifest'

interface IProps {
instruction: Extract<ManifestInstruction, { kind: 'CallFunction' }>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Box } from 'ui/src/components/box'
import FieldValue from 'ui/src/components/field-value'
import { AccountSnippet } from 'ui/src/components/snippet/account'

import { resolveManifestAddress } from '@src/radix/manifest'
import { resolveManifestAddress } from '@src/networks/radix/manifest'

const messages = defineMessages({
lock_fee: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ import type { ApprovedDapps, Personas } from 'ui/src/store/types'
import { getShortAddress } from 'ui/src/utils/string'

import type { WalletInteractionWithTabId } from '@src/browser/app/types'
import { useAccountsData } from '@src/hooks/interaction/use-accounts-data'
import { useLogin } from '@src/hooks/interaction/use-login'
import { usePersonaDataModal } from '@src/hooks/modal/use-persona-data-modal'
import { useSelectAccountsModal } from '@src/hooks/modal/use-select-accounts-modal'
import { useSelectPersonaModal } from '@src/hooks/modal/use-select-persona-modal'
import { sendInteractionMessage } from '@src/radix/interaction'
import { useAccountsData } from '@src/networks/radix/hooks/interaction/use-accounts-data'
import { useLogin } from '@src/networks/radix/hooks/interaction/use-login'
import { sendInteractionMessage } from '@src/networks/radix/interaction'

import { DappDetails } from '../dapp-details'
import { NetworkAlert } from '../network-alert'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { useApprovedDapps } from 'ui/src/hooks/use-approved-dapps'
import type { WalletInteractionWithTabId } from '@src/browser/app/types'
import { useIntent } from '@src/hooks/transaction/use-intent'
import { useSign } from '@src/hooks/transaction/use-sign'
import { sendInteractionMessage } from '@src/radix/interaction'
import { sendInteractionMessage } from '@src/networks/radix/interaction'
import type { TransactionMeta, TransactionSettings } from '@src/types/transaction'

import { DappDetails } from '../dapp-details'
Expand Down Expand Up @@ -192,9 +192,9 @@ export const TransactionRequest: React.FC<IProps> = ({ interaction }) => {
})
}

const handlePreviewStatusChange = (status: string) => {
const handlePreviewStatusChange = (s: string) => {
setState(draft => {
draft.previewStatus = status
draft.previewStatus = s
})
}

Expand Down
2 changes: 1 addition & 1 deletion apps/extension/src/pages/interaction/home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { Text } from 'ui/src/components/typography'

import { MessageAction, type WalletInteractionWithTabId } from '@src/browser/app/types'
import type { Z3USEvent } from '@src/browser/messages/types'
import { getInteraction, removeInteraction, sendInteractionMessage } from '@src/radix/interaction'
import { getInteraction, removeInteraction, sendInteractionMessage } from '@src/networks/radix/interaction'

import { DappDetails } from './components/dapp-details'
import { Interaction } from './components/interaction'
Expand Down
2 changes: 1 addition & 1 deletion apps/extension/src/pages/keystore/components/done.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Z3usLogoLarge } from 'ui/src/components/z3us-logo-babylon'
import { useSharedStore } from 'ui/src/hooks/use-store'
import { KeystoreType } from 'ui/src/store/types'

import { useAddAccount } from '@src/hooks/use-add-account'
import { useAddAccount } from '@src/networks/radix/hooks/use-add-account'

import * as styles from '../seed/styles.css'
import { Title } from './title'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { QrStyled } from 'ui/src/components/qr-styled'
import { Link } from 'ui/src/components/typography'

import { config, radixConnectConfig } from '@src/config'
import { chromeLocalStore } from '@src/radix/storage-local'
import { chromeLocalStore } from '@src/networks/radix/storage-local'

import { Title } from '../../components/title'
import * as styles from '../styles.css'
Expand Down
10 changes: 5 additions & 5 deletions apps/extension/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ const config = {
components: resolve(__dirname, '../../node_modules/@radixdlt/connector-extension/src/components'),
ledger: resolve(__dirname, '../../node_modules/@radixdlt/connector-extension/src/ledger'),
queues: resolve(__dirname, '../../node_modules/@radixdlt/connector-extension/src/queues'),
'chrome/helpers/add-origin-to-wallet-interaction': resolve(__dirname, 'src/radix/add-origin-to-wallet-interaction'),
'chrome/helpers/chrome-storage-sync': resolve(__dirname, 'src/radix/storage-sync'),
'chrome/helpers/chrome-local-store': resolve(__dirname, 'src/radix/storage-local'),
'chrome/background/create-gateway-module': resolve(__dirname, 'src/radix/create-gateway-module'),
'./create-gateway-module': resolve(__dirname, 'src/radix/create-gateway-module'),
'chrome/helpers/add-origin-to-wallet-interaction': resolve(__dirname, 'src/networks/radix/add-origin-to-wallet-interaction'),
'chrome/helpers/chrome-storage-sync': resolve(__dirname, 'src/networks/radix/storage-sync'),
'chrome/helpers/chrome-local-store': resolve(__dirname, 'src/networks/radix/storage-local'),
'chrome/background/create-gateway-module': resolve(__dirname, 'src/networks/radix/create-gateway-module'),
'./create-gateway-module': resolve(__dirname, 'src/networks/radix/create-gateway-module'),
},
},
define: {
Expand Down
14 changes: 7 additions & 7 deletions packages/ui/src/hooks/dapp/use-network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@ import { useNoneSharedStore } from '../use-store'
import { useGatewayClient } from './use-gateway-client'

export const useNetworkConfiguration = () => {
const { status } = useGatewayClient()!
const { status } = useGatewayClient()
const { gatewayBaseUrl } = useNoneSharedStore(state => ({
gatewayBaseUrl: state.gatewayBaseUrl,
}))

return useQuery({
queryKey: ['useNetworkConfiguration', gatewayBaseUrl],
queryKey: ['useNetworkConfiguration', gatewayBaseUrl, (status?.innerClient as any).configuration.basePath],
queryFn: () => status.getNetworkConfiguration(),
enabled: !!status,
})
}

export const useCurrentStatus = () => {
const { status } = useGatewayClient()!
const { status } = useGatewayClient()
const { gatewayBaseUrl } = useNoneSharedStore(state => ({
gatewayBaseUrl: state.gatewayBaseUrl,
}))

return useQuery({
queryKey: ['useCurrent', gatewayBaseUrl],
queryKey: ['useCurrent', gatewayBaseUrl, (status?.innerClient as any).configuration.basePath],
queryFn: () => status.getCurrent(),
enabled: !!status,
refetchInterval: 30 * 1000,
Expand All @@ -40,7 +40,7 @@ export const useNetworkId = () => {

useEffect(() => {
if (data?.network_id) setState(data?.network_id)
}, [data])
}, [data?.network_id])

return state
}
Expand All @@ -51,7 +51,7 @@ export const useDashboardUrl = () => {

useEffect(() => {
if (data?.network_id) setState(RadixNetworkConfigById[data.network_id].dashboardUrl)
}, [data])
}, [data?.network_id])

return state
}
Expand All @@ -62,7 +62,7 @@ export const useGatewayUrl = () => {

useEffect(() => {
if (data?.network_id) setState(RadixNetworkConfigById[data.network_id].gatewayUrl)
}, [data])
}, [data?.network_id])

return state
}

0 comments on commit 227f94a

Please sign in to comment.