From 0c06d7e6738fe5d309f216a9e90ae8fa9d8e633f Mon Sep 17 00:00:00 2001 From: Iveta Date: Tue, 28 May 2024 13:06:53 -0400 Subject: [PATCH] SEP-24: pass language to GET transaction call --- .../demo-wallet-client/src/ducks/sep24DepositAsset.ts | 1 + .../demo-wallet-client/src/ducks/sep24WithdrawAsset.ts | 1 + .../methods/sep24/pollDepositUntilComplete.ts | 8 ++++++-- .../methods/sep24/pollWithdrawUntilComplete.ts | 8 ++++++-- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/packages/demo-wallet-client/src/ducks/sep24DepositAsset.ts b/packages/demo-wallet-client/src/ducks/sep24DepositAsset.ts index a2adb6f5..b8a53e4e 100644 --- a/packages/demo-wallet-client/src/ducks/sep24DepositAsset.ts +++ b/packages/demo-wallet-client/src/ducks/sep24DepositAsset.ts @@ -169,6 +169,7 @@ export const depositAssetAction = createAsyncThunk< sep24TransferServerUrl: tomlResponse.TRANSFER_SERVER_SEP0024, trustAssetCallback, custodialMemoId: generatedMemoId, + sep9Fields, }); return { diff --git a/packages/demo-wallet-client/src/ducks/sep24WithdrawAsset.ts b/packages/demo-wallet-client/src/ducks/sep24WithdrawAsset.ts index 9b8fc66d..94574968 100644 --- a/packages/demo-wallet-client/src/ducks/sep24WithdrawAsset.ts +++ b/packages/demo-wallet-client/src/ducks/sep24WithdrawAsset.ts @@ -141,6 +141,7 @@ export const withdrawAssetAction = createAsyncThunk< networkUrl: networkConfig.url, assetCode, assetIssuer, + sep9Fields, }); return { diff --git a/packages/demo-wallet-shared/methods/sep24/pollDepositUntilComplete.ts b/packages/demo-wallet-shared/methods/sep24/pollDepositUntilComplete.ts index 48cfa697..e37e85bc 100644 --- a/packages/demo-wallet-shared/methods/sep24/pollDepositUntilComplete.ts +++ b/packages/demo-wallet-shared/methods/sep24/pollDepositUntilComplete.ts @@ -1,6 +1,6 @@ import { getErrorMessage } from "../../helpers/getErrorMessage"; import { log } from "../../helpers/log"; -import { TransactionStatus } from "../../types/types"; +import { AnyObject, TransactionStatus } from "../../types/types"; export const pollDepositUntilComplete = async ({ popup, @@ -9,6 +9,7 @@ export const pollDepositUntilComplete = async ({ sep24TransferServerUrl, trustAssetCallback, custodialMemoId, + sep9Fields, }: { popup: any; transactionId: string; @@ -16,12 +17,15 @@ export const pollDepositUntilComplete = async ({ sep24TransferServerUrl: string; trustAssetCallback: () => Promise; custodialMemoId?: string; + sep9Fields?: AnyObject; }) => { let currentStatus = TransactionStatus.INCOMPLETE; let trustedAssetAdded; const transactionUrl = new URL( - `${sep24TransferServerUrl}/transaction?id=${transactionId}`, + `${sep24TransferServerUrl}/transaction?id=${transactionId}&lang=${ + sep9Fields?.lang || "en" + }`, ); log.instruction({ title: `Polling for updates \`${transactionUrl.toString()}\``, diff --git a/packages/demo-wallet-shared/methods/sep24/pollWithdrawUntilComplete.ts b/packages/demo-wallet-shared/methods/sep24/pollWithdrawUntilComplete.ts index e40ce0f4..5452bf95 100644 --- a/packages/demo-wallet-shared/methods/sep24/pollWithdrawUntilComplete.ts +++ b/packages/demo-wallet-shared/methods/sep24/pollWithdrawUntilComplete.ts @@ -8,7 +8,7 @@ import { } from "@stellar/stellar-sdk"; import { log } from "../../helpers/log"; import { createMemoFromType } from "../createMemoFromType"; -import { TransactionStatus } from "../../types/types"; +import { AnyObject, TransactionStatus } from "../../types/types"; import { getNetworkConfig } from "../../helpers/getNetworkConfig"; export const pollWithdrawUntilComplete = async ({ @@ -21,6 +21,7 @@ export const pollWithdrawUntilComplete = async ({ networkUrl, assetCode, assetIssuer, + sep9Fields, }: { secretKey: string; popup: any; @@ -31,13 +32,16 @@ export const pollWithdrawUntilComplete = async ({ networkUrl: string; assetCode: string; assetIssuer: string; + sep9Fields?: AnyObject; }) => { const keypair = Keypair.fromSecret(secretKey); const server = new Horizon.Server(networkUrl); let currentStatus = TransactionStatus.INCOMPLETE; const transactionUrl = new URL( - `${sep24TransferServerUrl}/transaction?id=${transactionId}`, + `${sep24TransferServerUrl}/transaction?id=${transactionId}&lang=${ + sep9Fields?.lang || "en" + }`, ); log.instruction({ title: `Polling for updates \`${transactionUrl.toString()}\``,