Skip to content

Commit 2cb1789

Browse files
authored
Use destination instead of target for bridge address/network (#279)
1 parent c51f626 commit 2cb1789

File tree

9 files changed

+54
-57
lines changed

9 files changed

+54
-57
lines changed

renderer/components/BridgeAssetsForm/BridgeAssetsForm.tsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,15 @@ function BridgeAssetsFormContent({
9999
fromAccount: defaultFromAccount,
100100
assetId: defaultAssetId,
101101
destinationNetworkId: null,
102-
targetAddress: "",
102+
destinationAddress: "",
103103
},
104104
});
105105

106106
const amountValue = watch("amount");
107107
const fromAccountValue = watch("fromAccount");
108108
const assetIdValue = watch("assetId");
109109
const destinationNetworkId = watch("destinationNetworkId");
110-
const targetAddress = watch("targetAddress");
110+
const destinationAddress = watch("destinationAddress");
111111

112112
const { data: tokenPathsResponse, isLoading: tokenPathsLoading } =
113113
trpcReact.getChainportTokenPaths.useQuery(
@@ -180,20 +180,20 @@ function BridgeAssetsFormContent({
180180
[selectedAsset, setError],
181181
);
182182

183-
const targetAddressIcon = useMemo(() => {
184-
if (targetAddress.length === 0) {
183+
const destinationAddressIcon = useMemo(() => {
184+
if (destinationAddress.length === 0) {
185185
return null;
186186
}
187187

188-
return targetAddress.length > 0 && isAddress(targetAddress) ? (
188+
return destinationAddress.length > 0 && isAddress(destinationAddress) ? (
189189
<chakra.svg width="18" height="13" viewBox="0 0 18 13" fill="none" mr={1}>
190190
<path
191191
d="M6.54961 13L0.849609 7.29998L2.27461 5.87498L6.54961 10.15L15.7246 0.974976L17.1496 2.39998L6.54961 13Z"
192192
fill="#6A991C"
193193
/>
194194
</chakra.svg>
195195
) : null;
196-
}, [targetAddress]);
196+
}, [destinationAddress]);
197197

198198
// Try to reset selected asset to a valid one if the current one is disabled
199199
useEffect(() => {
@@ -257,7 +257,7 @@ function BridgeAssetsFormContent({
257257
fromAccount: data.fromAccount,
258258
assetId: data.assetId,
259259
destinationNetwork: destinationNetwork,
260-
targetAddress: getChecksumAddress(data.targetAddress),
260+
destinationAddress: getChecksumAddress(data.destinationAddress),
261261
});
262262
})}
263263
>
@@ -389,12 +389,12 @@ function BridgeAssetsFormContent({
389389
/>
390390
)
391391
}
392-
targetAddressInput={
392+
destinationAddressInput={
393393
<TextInput
394-
{...register("targetAddress")}
395-
label="Target Address"
396-
error={formErrors.targetAddress?.message}
397-
icon={targetAddressIcon}
394+
{...register("destinationAddress")}
395+
label="Destination Address"
396+
error={formErrors.destinationAddress?.message}
397+
icon={destinationAddressIcon}
398398
/>
399399
}
400400
topLevelErrorMessage={transactionDetailsError}
@@ -404,7 +404,7 @@ function BridgeAssetsFormContent({
404404
<BridgeConfirmationModal
405405
onClose={() => setConfirmationData(null)}
406406
formData={confirmationData}
407-
targetNetwork={confirmationData.destinationNetwork}
407+
destinationNetwork={confirmationData.destinationNetwork}
408408
selectedAsset={assetOptionsMap.get(confirmationData.assetId)!}
409409
chainportToken={chainportTokensMap[confirmationData.assetId]!}
410410
handleTransactionDetailsError={(errorMessage) =>
@@ -439,7 +439,7 @@ export function BridgeAssetsForm() {
439439
assetAmountInput={<Skeleton height={71} />}
440440
bridgeProviderInput={<Skeleton height={71} w="50%" />}
441441
destinationNetworkInput={<Skeleton height={71} w="50%" />}
442-
targetAddressInput={<Skeleton height={71} w="100%" />}
442+
destinationAddressInput={<Skeleton height={71} w="100%" />}
443443
/>
444444
);
445445
}

renderer/components/BridgeAssetsForm/BridgeAssetsFormShell.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ export function BridgeAssetsFormShell({
1818
assetAmountInput,
1919
bridgeProviderInput,
2020
destinationNetworkInput,
21-
targetAddressInput,
21+
destinationAddressInput,
2222
topLevelErrorMessage,
2323
}: {
2424
status?: "LOADING";
2525
fromAccountInput: ReactNode;
2626
assetAmountInput: ReactNode;
2727
bridgeProviderInput: ReactNode;
2828
destinationNetworkInput: ReactNode;
29-
targetAddressInput: ReactNode;
29+
destinationAddressInput: ReactNode;
3030
topLevelErrorMessage?: string;
3131
}) {
3232
const { formatMessage } = useIntl();
@@ -86,7 +86,7 @@ export function BridgeAssetsFormShell({
8686
}}
8787
>
8888
<HStack>{destinationNetworkInput}</HStack>
89-
<Box>{targetAddressInput}</Box>
89+
<Box>{destinationAddressInput}</Box>
9090
</VStack>
9191
</VStack>
9292
</VStack>

renderer/components/BridgeAssetsForm/BridgeConfirmationModal/BridgeConfirmationModal.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ type ChainportNetwork =
7272
type Props = {
7373
onClose: () => void;
7474
formData: BridgeAssetsConfirmationData;
75-
targetNetwork: ChainportNetwork;
75+
destinationNetwork: ChainportNetwork;
7676
selectedAsset: AssetOptionType;
7777
chainportToken: ChainportToken;
7878
handleTransactionDetailsError: (error: string) => void;
@@ -81,7 +81,7 @@ type Props = {
8181
export function BridgeConfirmationModal({
8282
onClose,
8383
formData,
84-
targetNetwork,
84+
destinationNetwork,
8585
selectedAsset,
8686
chainportToken,
8787
handleTransactionDetailsError,
@@ -114,8 +114,8 @@ export function BridgeConfirmationModal({
114114
{
115115
amount: convertedAmount.toString(),
116116
assetId: chainportToken.web3_address,
117-
to: formData.targetAddress,
118-
selectedNetwork: targetNetwork.chainport_network_id,
117+
to: formData.destinationAddress,
118+
selectedNetwork: destinationNetwork.chainport_network_id,
119119
},
120120
{
121121
retry: false,
@@ -279,11 +279,11 @@ export function BridgeConfirmationModal({
279279
{isSubmitIdle && (
280280
<StepIdle
281281
fromAccount={formData.fromAccount}
282-
targetNetwork={targetNetwork.label}
283-
targetNetworkIcon={targetNetwork.network_icon}
282+
destinationNetwork={destinationNetwork.label}
283+
destinationNetworkIcon={destinationNetwork.network_icon}
284284
amountSending={amountToSend}
285285
amountReceiving={amountToReceive}
286-
targetAddress={formData.targetAddress}
286+
destinationAddress={formData.destinationAddress}
287287
chainportGasFee={chainportGasFee}
288288
chainportBridgeFee={chainportBridgeFee}
289289
feeRate={feeRate}

renderer/components/BridgeAssetsForm/BridgeConfirmationModal/StepIdle.tsx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ const messages = defineMessages({
3838
sourceNetworkLabel: {
3939
defaultMessage: "Source Network",
4040
},
41-
targetNetworkLabel: {
42-
defaultMessage: "Target Network",
41+
destinationNetworkLabel: {
42+
defaultMessage: "Destination Network",
4343
},
4444
sendingLabel: {
4545
defaultMessage: "Sending",
@@ -51,14 +51,14 @@ const messages = defineMessages({
5151
defaultMessage:
5252
"Sending amount minus the bridge fee. This is an estimate, and you may receive a slightly different amount.",
5353
},
54-
targetAddressLabel: {
55-
defaultMessage: "Target Address",
54+
destinationAddressLabel: {
55+
defaultMessage: "Destination Address",
5656
},
5757
gasFeeLabel: {
5858
defaultMessage: "Gas fee",
5959
},
6060
gasFeeTooltip: {
61-
defaultMessage: "The fee for transacting on the target network",
61+
defaultMessage: "The fee for transacting on the destination network",
6262
},
6363
bridgeFeeLabel: {
6464
defaultMessage: "Bridge fee",
@@ -82,11 +82,11 @@ const messages = defineMessages({
8282

8383
type Props = {
8484
fromAccount: string;
85-
targetNetwork: string;
86-
targetNetworkIcon: string;
85+
destinationNetwork: string;
86+
destinationNetworkIcon: string;
8787
amountSending: ReactNode;
8888
amountReceiving: ReactNode;
89-
targetAddress: string;
89+
destinationAddress: string;
9090
chainportGasFee: ReactNode;
9191
chainportBridgeFee: ReactNode;
9292
estimatedFees: UseTRPCQueryResult<
@@ -100,11 +100,11 @@ type Props = {
100100

101101
export function StepIdle({
102102
fromAccount,
103-
targetNetwork,
104-
targetNetworkIcon,
103+
destinationNetwork,
104+
destinationNetworkIcon,
105105
amountSending,
106106
amountReceiving,
107-
targetAddress,
107+
destinationAddress,
108108
chainportGasFee,
109109
chainportBridgeFee,
110110
estimatedFees,
@@ -167,9 +167,9 @@ export function StepIdle({
167167
</GridItem>
168168
<GridItem>
169169
<LineItem
170-
label={formatMessage(messages.targetNetworkLabel)}
171-
content={targetNetwork}
172-
icon={targetNetworkIcon}
170+
label={formatMessage(messages.destinationNetworkLabel)}
171+
content={destinationNetwork}
172+
icon={destinationNetworkIcon}
173173
/>
174174
</GridItem>
175175
<GridItem
@@ -216,8 +216,8 @@ export function StepIdle({
216216
<Divider />
217217

218218
<LineItem
219-
label={formatMessage(messages.targetAddressLabel)}
220-
content={targetAddress}
219+
label={formatMessage(messages.destinationAddressLabel)}
220+
content={destinationAddress}
221221
/>
222222

223223
<Divider />

renderer/components/BridgeAssetsForm/bridgeAssetsSchema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const bridgeAssetsFormSchema = z.object({
1616
}, "Amount must be greater than 0"),
1717
assetId: z.string().min(1),
1818
destinationNetworkId: z.string().min(1).nullable(),
19-
targetAddress: z.string().superRefine((value, ctx) => {
19+
destinationAddress: z.string().superRefine((value, ctx) => {
2020
try {
2121
getChecksumAddress(value);
2222
} catch (err) {

renderer/components/BridgeTransactionInformation/BridgeTransactionInformation.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export function BridgeTransactionInformation({
9494
type={transaction.type}
9595
address={chainportData.address}
9696
networkIcon={otherNetwork?.network_icon ?? ""}
97-
targetTxHash={destinationTxHashContent?.txHash ?? undefined}
97+
destinationTxHash={destinationTxHashContent?.txHash ?? undefined}
9898
blockExplorerUrl={destinationTxHashContent?.href}
9999
sourceNetwork={sourceNetwork}
100100
{...rest}

renderer/components/BridgeTransactionInformation/BridgeTransactionInformationShell.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ type Props = BoxProps & {
4848
type: ReactNode;
4949
address: string;
5050
networkIcon?: string;
51-
targetTxHash?: string;
51+
destinationTxHash?: string;
5252
blockExplorerUrl?: string;
5353
sourceNetwork?: {
5454
name: string;
@@ -61,7 +61,7 @@ export function BridgeTransactionInformationShell({
6161
type,
6262
address,
6363
networkIcon,
64-
targetTxHash,
64+
destinationTxHash,
6565
blockExplorerUrl,
6666
sourceNetwork,
6767
...rest
@@ -176,12 +176,12 @@ export function BridgeTransactionInformationShell({
176176
</Text>
177177
<Box fontSize="md">
178178
<VStack alignItems="flex-start">
179-
{targetTxHash ? (
179+
{destinationTxHash ? (
180180
<CopyAddress
181181
fontSize="md"
182182
color={COLORS.BLACK}
183183
_dark={{ color: COLORS.WHITE }}
184-
address={targetTxHash}
184+
address={destinationTxHash}
185185
parts={2}
186186
/>
187187
) : (

renderer/intl/locales/en-US.json

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
"/km2Zu": {
2727
"message": "Import Account"
2828
},
29+
"/nrkEG": {
30+
"message": "The fee for transacting on the destination network"
31+
},
2932
"/tbC+S": {
3033
"description": "Button to export account in the specified format",
3134
"message": "Export Account"
@@ -69,9 +72,6 @@
6972
"2qzbcD": {
7073
"message": "Min Peers"
7174
},
72-
"3+EYHL": {
73-
"message": "Target Network"
74-
},
7575
"3/a0Ho": {
7676
"message": "We're not able to download release notes right now."
7777
},
@@ -168,6 +168,9 @@
168168
"7N6OYQ": {
169169
"message": "View Transaction"
170170
},
171+
"7Qw9T7": {
172+
"message": "Destination Network"
173+
},
171174
"8GvVWZ": {
172175
"message": "Something went wrong, please try again."
173176
},
@@ -249,9 +252,6 @@
249252
"D5NqQO": {
250253
"message": "Memo"
251254
},
252-
"DOMotB": {
253-
"message": "Target Address"
254-
},
255255
"Dh1MGS": {
256256
"message": "Account Syncing"
257257
},
@@ -859,9 +859,6 @@
859859
"rqrhXg": {
860860
"message": "Confirm Your Recovery Phrase"
861861
},
862-
"ru6717": {
863-
"message": "The fee for transacting on the target network"
864-
},
865862
"sXlL42": {
866863
"message": "Encrypted Wallets Unsupported"
867864
},

renderer/utils/chainport/useChainportTransactionStatus.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ const chainportStatusMessages = defineMessages({
1919
defaultMessage: "Submitted",
2020
},
2121
bridge_pending: {
22-
defaultMessage: "Preparing target txn",
22+
defaultMessage: "Preparing destination txn",
2323
},
2424
bridge_submitted: {
25-
defaultMessage: "Submitted target txn",
25+
defaultMessage: "Submitted destination txn",
2626
},
2727
complete: {
2828
defaultMessage: "Complete",

0 commit comments

Comments
 (0)