@daimo/pay 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  var name = "@daimo/pay";
2
- var version = "1.0.6";
2
+ var version = "1.0.7";
3
3
  var author = "Daimo";
4
4
  var homepage = "https://pay.daimo.com";
5
5
  var license = "BSD-2-Clause license";
@@ -47,6 +47,7 @@ function usePaymentState({ trpc, daimoPayOrder, setDaimoPayOrder, setOpen, log,
47
47
  destChainId: daimoPayOrder?.destFinalCallTokenAmount.token.chainId,
48
48
  preferredChains: daimoPayOrder?.metadata.payer?.preferredChains,
49
49
  preferredTokens: daimoPayOrder?.metadata.payer?.preferredTokens,
50
+ log,
50
51
  });
51
52
  const solanaPaymentOptions = useSolanaPaymentOptions({
52
53
  trpc,
@@ -1 +1 @@
1
- {"version":3,"file":"usePaymentState.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"usePaymentState.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,6 +1,8 @@
1
+ import { getDAv2Chains } from '@daimo/contract';
1
2
  import { useState, useEffect } from 'react';
2
3
 
3
- function useWalletPaymentOptions({ trpc, address, usdRequired, destChainId, preferredChains, preferredTokens, }) {
4
+ const supportedChainIds = new Set([...getDAv2Chains(false), ...getDAv2Chains(true)].map((c) => c.chainId));
5
+ function useWalletPaymentOptions({ trpc, address, usdRequired, destChainId, preferredChains, preferredTokens, log, }) {
4
6
  const [options, setOptions] = useState(null);
5
7
  const [isLoading, setIsLoading] = useState(false);
6
8
  useEffect(() => {
@@ -17,7 +19,13 @@ function useWalletPaymentOptions({ trpc, address, usdRequired, destChainId, pref
17
19
  preferredChains,
18
20
  preferredTokens,
19
21
  });
20
- setOptions(newOptions);
22
+ // Filter out options we don't support yet.
23
+ const isSupported = (o) => supportedChainIds.has(o.balance.token.chainId);
24
+ const filteredOptions = newOptions.filter(isSupported);
25
+ if (filteredOptions.length < newOptions.length) {
26
+ log(`[WALLET]: skipping ${newOptions.length - filteredOptions.length} unsupported-chain balances on ${address}`);
27
+ }
28
+ setOptions(filteredOptions);
21
29
  }
22
30
  catch (error) {
23
31
  console.error(error);
@@ -1 +1 @@
1
- {"version":3,"file":"useWalletPaymentOptions.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"useWalletPaymentOptions.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@daimo/pay",
3
3
  "private": false,
4
- "version": "1.0.6",
4
+ "version": "1.0.7",
5
5
  "author": "Daimo",
6
6
  "homepage": "https://pay.daimo.com",
7
7
  "license": "BSD-2-Clause license",