From a13a2bb1deeff13c352db9af27de0c3e8727fd03 Mon Sep 17 00:00:00 2001 From: Alex Soong Date: Tue, 5 Dec 2023 22:49:36 -0800 Subject: [PATCH] Add PlatformType to base Deposit type --- client/src/contexts/hdfc/Deposits/DepositsProvider.tsx | 2 ++ client/src/contexts/venmo/Deposits/DepositsProvider.tsx | 9 ++++++++- client/src/contexts/venmo/Deposits/types.ts | 4 ++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/client/src/contexts/hdfc/Deposits/DepositsProvider.tsx b/client/src/contexts/hdfc/Deposits/DepositsProvider.tsx index a283aa6e9..5ead6e970 100644 --- a/client/src/contexts/hdfc/Deposits/DepositsProvider.tsx +++ b/client/src/contexts/hdfc/Deposits/DepositsProvider.tsx @@ -7,6 +7,7 @@ import { DepositWithAvailableLiquidity, Intent } from '../../venmo/Deposits/types'; +import { PaymentPlatform } from '../../common/PlatformSettings/types' import { esl } from '@helpers/constants'; import { unpackPackedVenmoId } from '@helpers/poseidonHash'; import useAccount from '@hooks/useAccount'; @@ -130,6 +131,7 @@ const DepositsProvider = ({ children }: ProvidersProps) => { const depositData = depositWithAvailableLiquidityData.deposit; const deposit: Deposit = { + platformType: PaymentPlatform.VENMO, depositor: depositData.depositor.toString(), venmoId: unpackPackedVenmoId(depositData.upiId), depositAmount: depositData.depositAmount, diff --git a/client/src/contexts/venmo/Deposits/DepositsProvider.tsx b/client/src/contexts/venmo/Deposits/DepositsProvider.tsx index 61354292d..b1e8a4198 100644 --- a/client/src/contexts/venmo/Deposits/DepositsProvider.tsx +++ b/client/src/contexts/venmo/Deposits/DepositsProvider.tsx @@ -1,7 +1,13 @@ import React, { useEffect, useState, ReactNode } from 'react' import { useContractRead } from 'wagmi' -import { Deposit, DepositWithAvailableLiquidity, Intent, DepositIntent } from './types' +import { + Deposit, + DepositWithAvailableLiquidity, + Intent, + DepositIntent +} from './types' +import { PaymentPlatform } from '../../common/PlatformSettings/types' import { esl } from '@helpers/constants' import { unpackPackedVenmoId } from '@helpers/poseidonHash' import useAccount from '@hooks/useAccount' @@ -125,6 +131,7 @@ const DepositsProvider = ({ children }: ProvidersProps) => { const depositData = depositWithAvailableLiquidityData.deposit; const deposit: Deposit = { + platformType: PaymentPlatform.VENMO, depositor: depositData.depositor.toString(), venmoId: unpackPackedVenmoId(depositData.packedVenmoId), depositAmount: depositData.depositAmount, diff --git a/client/src/contexts/venmo/Deposits/types.ts b/client/src/contexts/venmo/Deposits/types.ts index 6cd6570cf..194bfb618 100644 --- a/client/src/contexts/venmo/Deposits/types.ts +++ b/client/src/contexts/venmo/Deposits/types.ts @@ -1,3 +1,6 @@ +import { PaymentPlatformType } from '../../common/PlatformSettings/types'; + + // struct Deposit { // address depositor; // uint256[5] packedVenmoId; @@ -8,6 +11,7 @@ // bytes32[] intentHashes; // Array of hashes of all open intents (may include some expired if not pruned) // } export interface Deposit { + platformType: PaymentPlatformType; depositor: string; venmoId: string; depositAmount: bigint;