Skip to content

Commit

Permalink
Add PlatformType to base Deposit type
Browse files Browse the repository at this point in the history
  • Loading branch information
asoong committed Dec 6, 2023
1 parent 7919893 commit a13a2bb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions client/src/contexts/hdfc/Deposits/DepositsProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
Expand Down
9 changes: 8 additions & 1 deletion client/src/contexts/venmo/Deposits/DepositsProvider.tsx
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions client/src/contexts/venmo/Deposits/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { PaymentPlatformType } from '../../common/PlatformSettings/types';


// struct Deposit {
// address depositor;
// uint256[5] packedVenmoId;
Expand All @@ -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;
Expand Down

0 comments on commit a13a2bb

Please sign in to comment.