diff --git a/src/hooks/memo.ts b/src/hooks/memo.ts index cc31e545..9c5f4be8 100644 --- a/src/hooks/memo.ts +++ b/src/hooks/memo.ts @@ -1,4 +1,4 @@ -import { PaymentInformation } from '../types/publicAPI' +import { PaymentInformation } from '../types/protocol' /** * This function is expected to be overwritten by companies deploying diff --git a/src/services/basePayId.ts b/src/services/basePayId.ts index 81e288e5..6211759b 100644 --- a/src/services/basePayId.ts +++ b/src/services/basePayId.ts @@ -1,5 +1,5 @@ import { AddressInformation } from '../types/database' -import { AddressDetailsType, PaymentInformation } from '../types/publicAPI' +import { AddressDetailsType, PaymentInformation } from '../types/protocol' import { ParsedAcceptHeader } from './headers' diff --git a/src/types/database.ts b/src/types/database.ts index e0a4aa41..090a4b51 100644 --- a/src/types/database.ts +++ b/src/types/database.ts @@ -1,4 +1,4 @@ -import { CryptoAddressDetails, FiatAddressDetails } from './publicAPI' +import { CryptoAddressDetails, FiatAddressDetails } from './protocol' /** * Model of the Account table schema for the database. diff --git a/src/types/publicAPI.ts b/src/types/protocol.ts similarity index 71% rename from src/types/publicAPI.ts rename to src/types/protocol.ts index 914a163f..a2aca0fe 100644 --- a/src/types/publicAPI.ts +++ b/src/types/protocol.ts @@ -1,8 +1,3 @@ -/* eslint-disable import/no-cycle -- -Cycle between this file and types/verifiedAddress.ts. Should we combine these into one? -*/ -import { VerifiedAddress } from './verifiedAddress' - /** * Type of payment address in PaymentInformation. */ @@ -41,9 +36,30 @@ export interface PaymentInformation { /** * Address information included inside of a PaymentInformation object. */ -export interface Address { +interface Address { readonly paymentNetwork: string readonly environment?: string readonly addressDetailsType: AddressDetailsType readonly addressDetails: CryptoAddressDetails | FiatAddressDetails } + +/** + * Object containing address information alongside signatures. + */ +interface VerifiedAddress { + readonly payload: VerifiedAddressPayload + readonly signatures: readonly VerifiedAddressSignature[] +} + +interface VerifiedAddressPayload { + payId: string + payIdAddress: Address +} + +/** + * JWS object for verification. + */ +interface VerifiedAddressSignature { + protected: string + signature: string +} diff --git a/src/types/verifiedAddress.ts b/src/types/verifiedAddress.ts deleted file mode 100644 index 454f5765..00000000 --- a/src/types/verifiedAddress.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* eslint-disable import/no-cycle -- -Cycle between this file and types/publicApi.ts. Should we combine these into one? */ -import { Address } from './publicAPI' - -/** - * Object containing address information alongside signatures. - */ -export interface VerifiedAddress { - readonly payload: VerifiedAddressPayload - readonly signatures: readonly VerifiedAddressSignature[] -} - -interface VerifiedAddressPayload { - payId: string - payIdAddress: Address -} - -/** - * JWS object for verification. - */ -interface VerifiedAddressSignature { - protected: string - signature: string -} diff --git a/test/unit/formatPaymentInfo.test.ts b/test/unit/formatPaymentInfo.test.ts index dfa79381..653a4843 100644 --- a/test/unit/formatPaymentInfo.test.ts +++ b/test/unit/formatPaymentInfo.test.ts @@ -1,7 +1,7 @@ import { assert } from 'chai' import { formatPaymentInfo } from '../../src/services/basePayId' -import { AddressDetailsType } from '../../src/types/publicAPI' +import { AddressDetailsType } from '../../src/types/protocol' describe('Base PayID - formatPaymentInfo()', function (): void { it('Returns CryptoAddressDetails & FiatAddressDetails for addressDetailsTypes when formatting array with multiple AddressInformation', function () { diff --git a/test/unit/getAddressDetailsType.test.ts b/test/unit/getAddressDetailsType.test.ts index 5529c6ae..ea7f6f0f 100644 --- a/test/unit/getAddressDetailsType.test.ts +++ b/test/unit/getAddressDetailsType.test.ts @@ -1,7 +1,7 @@ import { assert } from 'chai' import { getAddressDetailsType } from '../../src/services/basePayId' -import { AddressDetailsType } from '../../src/types/publicAPI' +import { AddressDetailsType } from '../../src/types/protocol' describe('Base PayID - getAddressDetailsType()', function (): void { it('Returns FiatAddressDetails for addressDetailsType when formatting ACH AddressInformation', function () {