|
31 | 31 | import { getConversionPaymentValues } from "../../utils/getConversionPaymentValues"; |
32 | 32 | import { getEthersSigner } from "../../utils"; |
33 | 33 |
|
34 | | - interface BuyerSelerInfo { |
| 34 | + interface EntityInfo { |
35 | 35 | value: string; |
36 | 36 | isCompany?: boolean; |
37 | 37 | isEmail?: boolean; |
38 | 38 | } |
39 | 39 |
|
| 40 | + interface BuyerInfo extends EntityInfo {} |
| 41 | +
|
| 42 | + interface SellerInfo extends EntityInfo {} |
| 43 | +
|
40 | 44 | export let config; |
41 | 45 | export let account: GetAccountReturnType; |
42 | 46 | export let requestNetwork: RequestNetwork | null | undefined; |
|
46 | 50 | export let wagmiConfig: any; |
47 | 51 |
|
48 | 52 | let network: string | undefined = request?.currencyInfo?.network || "mainnet"; |
49 | | - // FIXME: Use a non deprecated function |
50 | 53 | let currency: CurrencyTypes.CurrencyDefinition | undefined = |
51 | 54 | getCurrencyFromManager(request.currencyInfo, currencyManager); |
52 | 55 | let paymentCurrencies: (CurrencyTypes.CurrencyDefinition | undefined)[] = []; |
|
59 | 62 | let address = account.address; |
60 | 63 | let firstItems: any; |
61 | 64 | let otherItems: any; |
62 | | - let sellerInfo: BuyerSelerInfo[] = []; |
63 | | - let buyerInfo: BuyerSelerInfo[] = []; |
| 65 | + let sellerInfo: SellerInfo[] = []; |
| 66 | + let buyerInfo: BuyerInfo[] = []; |
64 | 67 | let isPayee = request?.payee?.value.toLowerCase() === address?.toLowerCase(); |
65 | 68 | let unsupportedNetwork = false; |
66 | | - let hexStringChain = "0x" + account.chainId.toString(16); |
| 69 | + let hexStringChain = "0x" + account?.chainId?.toString(16); |
67 | 70 | let correctChain = |
68 | 71 | hexStringChain === String(getNetworkIdFromNetworkName(network)); |
69 | 72 | let paymentNetworkExtension: |
|
85 | 88 | .join(", "); |
86 | 89 |
|
87 | 90 | return [ |
88 | | - ...(fullName ? [{ label: "Name", value: fullName }] : []), |
| 91 | + ...(fullName ? [{ value: fullName }] : []), |
89 | 92 | ...(info?.businessName |
90 | 93 | ? [ |
91 | 94 | { |
92 | | - label: "Company Name", |
93 | 95 | value: info?.businessName, |
94 | 96 | isCompany: true, |
95 | 97 | }, |
96 | 98 | ] |
97 | 99 | : []), |
98 | | - ...(info?.taxRegistration |
99 | | - ? [{ label: "Tax Registration", value: info?.taxRegistration }] |
100 | | - : []), |
101 | | - ...(fullAddress ? [{ label: "Address", value: fullAddress }] : []), |
102 | | - ...(info?.email |
103 | | - ? [{ label: "Email", value: info?.email, isEmail: true }] |
104 | | - : []), |
| 100 | + ...(info?.taxRegistration ? [{ value: info?.taxRegistration }] : []), |
| 101 | + ...(fullAddress ? [{ value: fullAddress }] : []), |
| 102 | + ...(info?.email ? [{ value: info?.email, isEmail: true }] : []), |
105 | 103 | ].filter((detail) => detail.value); |
106 | 104 | }; |
107 | 105 |
|
|
133 | 131 | $: { |
134 | 132 | account = account; |
135 | 133 | network = request?.currencyInfo?.network || "mainnet"; |
136 | | - // FIXME: Use a non deprecated function |
137 | 134 | currency = getCurrencyFromManager(request.currencyInfo, currencyManager); |
138 | 135 | } |
139 | 136 |
|
|
0 commit comments