@dynamic-labs/wallet-book 2.0.0-alpha.3 → 2.0.0-alpha.30

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,8 +1,8 @@
1
1
  import { __rest } from '../../_virtual/_tslib.js';
2
2
  import { useState, createElement, Fragment } from 'react';
3
3
  import { getDefaultWalletIconUrl } from '../helpers/getWalletIconUrl.js';
4
- import '../helpers/logger.js';
5
4
  import '../helpers/renderTemplate.js';
5
+ import '../helpers/logger.js';
6
6
  import { getBrandIconUrl } from '../helpers/getBrandIconUrl.js';
7
7
 
8
8
  const BrandIcon = (_a) => {
@@ -5,9 +5,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var _tslib = require('../../_virtual/_tslib.cjs');
6
6
  var react = require('react');
7
7
  var getWalletIconUrl = require('../helpers/getWalletIconUrl.cjs');
8
- require('../helpers/logger.cjs');
9
8
  var findWalletBookWallet = require('../helpers/findWalletBookWallet.cjs');
10
9
  require('../helpers/renderTemplate.cjs');
10
+ require('../helpers/logger.cjs');
11
11
  require('@dynamic-labs/utils');
12
12
  require('../schemas/walletConnectSourceSchema.cjs');
13
13
  require('../schemas/walletBookSchema.cjs');
@@ -1,9 +1,9 @@
1
1
  import { __rest } from '../../_virtual/_tslib.js';
2
2
  import { useState, createElement, Fragment } from 'react';
3
3
  import { getWalletIconUrl, getDefaultWalletIconUrl } from '../helpers/getWalletIconUrl.js';
4
- import '../helpers/logger.js';
5
4
  import { findWalletBookWallet } from '../helpers/findWalletBookWallet.js';
6
5
  import '../helpers/renderTemplate.js';
6
+ import '../helpers/logger.js';
7
7
  import '@dynamic-labs/utils';
8
8
  import '../schemas/walletConnectSourceSchema.js';
9
9
  import '../schemas/walletBookSchema.js';
@@ -3,7 +3,6 @@ export declare const findWalletBookWallet: (walletBook: WalletBookSchema, wallet
3
3
  name: string;
4
4
  brand?: {
5
5
  alt?: string | undefined;
6
- imageId?: string | undefined;
7
6
  primaryColor?: string | undefined;
8
7
  spriteId?: string | undefined;
9
8
  } | undefined;
@@ -40,6 +39,7 @@ export declare const findWalletBookWallet: (walletBook: WalletBookSchema, wallet
40
39
  mobile?: {
41
40
  android?: string | null | undefined;
42
41
  androidId?: string | undefined;
42
+ inAppBrowser?: string | null | undefined;
43
43
  ios?: string | null | undefined;
44
44
  iosId?: string | undefined;
45
45
  native?: string | undefined;
@@ -4,14 +4,12 @@ export declare const findWalletGroup: (walletBook: WalletBookSchema, walletGroup
4
4
  name: string;
5
5
  brand?: {
6
6
  alt?: string | undefined;
7
- imageId?: string | undefined;
8
7
  primaryColor?: string | undefined;
9
8
  spriteId?: string | undefined;
10
9
  } | undefined;
11
10
  walletOverrides?: Record<string, {
12
11
  brand?: {
13
12
  alt?: string | undefined;
14
- imageId?: string | undefined;
15
13
  primaryColor?: string | undefined;
16
14
  spriteId?: string | undefined;
17
15
  } | undefined;
@@ -2,25 +2,15 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var normalizeWalletName = require('./normalizeWalletName.cjs');
6
- var logger = require('./logger.cjs');
7
-
8
- const getWalletBookWallet = (walletBook, walletKey) => {
5
+ const getWalletBookWallet = (walletBook, walletKey, walletFallback) => {
9
6
  var _a, _b, _c;
10
7
  if (!walletKey)
11
8
  throw new Error('Wallet key is required. Please pass in a wallet key to getWalletBookWallet');
12
- const walletDataFromKeyLookup = (_a = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) === null || _a === void 0 ? void 0 : _a[walletKey];
13
- if (!walletDataFromKeyLookup) {
14
- // adds fallback support. normalizeWalletName will be removed in v2
15
- const normalizedWalletKey = normalizeWalletName.normalizeWalletName(walletKey);
16
- const walletDataFromNormalizedKeyLookup = (_b = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) === null || _b === void 0 ? void 0 : _b[normalizedWalletKey];
17
- if (walletDataFromNormalizedKeyLookup) {
18
- logger.logger.warn(`deprecated: using walletName: ${walletKey} to look up wallet data is deprecated. use connector.key instead ${normalizedWalletKey}`);
19
- return walletDataFromNormalizedKeyLookup;
20
- }
21
- throw new Error(`Wallet ${normalizedWalletKey} not found in wallet book (${Object.keys((_c = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) !== null && _c !== void 0 ? _c : {}).length} wallets found)`);
9
+ const walletData = (_b = (_a = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) === null || _a === void 0 ? void 0 : _a[walletKey]) !== null && _b !== void 0 ? _b : walletFallback;
10
+ if (!walletData) {
11
+ throw new Error(`Wallet ${walletKey} not found in wallet book (${Object.keys((_c = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) !== null && _c !== void 0 ? _c : {}).length} wallets found)`);
22
12
  }
23
- return walletDataFromKeyLookup;
13
+ return walletData;
24
14
  };
25
15
 
26
16
  exports.getWalletBookWallet = getWalletBookWallet;
@@ -1,2 +1,2 @@
1
1
  import { WalletBookSchema, WalletSchema } from '../schemas';
2
- export declare const getWalletBookWallet: (walletBook: WalletBookSchema, walletKey: string | undefined) => WalletSchema;
2
+ export declare const getWalletBookWallet: (walletBook: WalletBookSchema, walletKey: string | undefined, walletFallback?: WalletSchema) => WalletSchema;
@@ -1,22 +1,12 @@
1
- import { normalizeWalletName } from './normalizeWalletName.js';
2
- import { logger } from './logger.js';
3
-
4
- const getWalletBookWallet = (walletBook, walletKey) => {
1
+ const getWalletBookWallet = (walletBook, walletKey, walletFallback) => {
5
2
  var _a, _b, _c;
6
3
  if (!walletKey)
7
4
  throw new Error('Wallet key is required. Please pass in a wallet key to getWalletBookWallet');
8
- const walletDataFromKeyLookup = (_a = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) === null || _a === void 0 ? void 0 : _a[walletKey];
9
- if (!walletDataFromKeyLookup) {
10
- // adds fallback support. normalizeWalletName will be removed in v2
11
- const normalizedWalletKey = normalizeWalletName(walletKey);
12
- const walletDataFromNormalizedKeyLookup = (_b = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) === null || _b === void 0 ? void 0 : _b[normalizedWalletKey];
13
- if (walletDataFromNormalizedKeyLookup) {
14
- logger.warn(`deprecated: using walletName: ${walletKey} to look up wallet data is deprecated. use connector.key instead ${normalizedWalletKey}`);
15
- return walletDataFromNormalizedKeyLookup;
16
- }
17
- throw new Error(`Wallet ${normalizedWalletKey} not found in wallet book (${Object.keys((_c = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) !== null && _c !== void 0 ? _c : {}).length} wallets found)`);
5
+ const walletData = (_b = (_a = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) === null || _a === void 0 ? void 0 : _a[walletKey]) !== null && _b !== void 0 ? _b : walletFallback;
6
+ if (!walletData) {
7
+ throw new Error(`Wallet ${walletKey} not found in wallet book (${Object.keys((_c = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) !== null && _c !== void 0 ? _c : {}).length} wallets found)`);
18
8
  }
19
- return walletDataFromKeyLookup;
9
+ return walletData;
20
10
  };
21
11
 
22
12
  export { getWalletBookWallet };
@@ -2,7 +2,6 @@ export * from './getWalletIconUrl';
2
2
  export * from './getWalletBookWallet';
3
3
  export * from './getWalletLinks';
4
4
  export * from './getWalletPrimaryColor';
5
- export * from './normalizeWalletName';
6
5
  export * from './renderTemplate';
7
6
  export * from './findWalletBookWallet';
8
7
  export * from './logger';
@@ -8,8 +8,8 @@ var utils = require('@dynamic-labs/utils');
8
8
  require('../schemas/walletConnectSourceSchema.cjs');
9
9
  var walletBookSchema = require('../schemas/walletBookSchema.cjs');
10
10
  require('../schemas/walletSchema.cjs');
11
- var logger = require('../helpers/logger.cjs');
12
11
  require('../helpers/renderTemplate.cjs');
12
+ var logger = require('../helpers/logger.cjs');
13
13
  var getWalletBookCdnUrl = require('../helpers/getWalletBookCdnUrl.cjs');
14
14
  var walletBookFallbacks = require('../../wallet-book-fallbacks.cjs');
15
15
 
@@ -4,14 +4,12 @@ export declare const useWalletBookCdn: () => {
4
4
  name: string;
5
5
  brand?: {
6
6
  alt?: string | undefined;
7
- imageId?: string | undefined;
8
7
  primaryColor?: string | undefined;
9
8
  spriteId?: string | undefined;
10
9
  } | undefined;
11
10
  walletOverrides?: Record<string, {
12
11
  brand?: {
13
12
  alt?: string | undefined;
14
- imageId?: string | undefined;
15
13
  primaryColor?: string | undefined;
16
14
  spriteId?: string | undefined;
17
15
  } | undefined;
@@ -22,7 +20,6 @@ export declare const useWalletBookCdn: () => {
22
20
  name: string;
23
21
  brand?: {
24
22
  alt?: string | undefined;
25
- imageId?: string | undefined;
26
23
  primaryColor?: string | undefined;
27
24
  spriteId?: string | undefined;
28
25
  } | undefined;
@@ -59,6 +56,7 @@ export declare const useWalletBookCdn: () => {
59
56
  mobile?: {
60
57
  android?: string | null | undefined;
61
58
  androidId?: string | undefined;
59
+ inAppBrowser?: string | null | undefined;
62
60
  ios?: string | null | undefined;
63
61
  iosId?: string | undefined;
64
62
  native?: string | undefined;
@@ -4,8 +4,8 @@ import { retryableFn } from '@dynamic-labs/utils';
4
4
  import '../schemas/walletConnectSourceSchema.js';
5
5
  import { walletBookSchema } from '../schemas/walletBookSchema.js';
6
6
  import '../schemas/walletSchema.js';
7
- import { logger } from '../helpers/logger.js';
8
7
  import '../helpers/renderTemplate.js';
8
+ import { logger } from '../helpers/logger.js';
9
9
  import { getWalletBookCdnUrl } from '../helpers/getWalletBookCdnUrl.js';
10
10
  import walletBookFallbacks from '../../wallet-book-fallbacks.js';
11
11
 
@@ -4,8 +4,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var react = require('react');
6
6
  require('../../_virtual/_tslib.cjs');
7
- require('../helpers/logger.cjs');
8
7
  require('../helpers/renderTemplate.cjs');
8
+ require('../helpers/logger.cjs');
9
9
  require('@dynamic-labs/utils');
10
10
  require('../schemas/walletConnectSourceSchema.cjs');
11
11
  require('../schemas/walletBookSchema.cjs');
@@ -1,7 +1,7 @@
1
1
  import { useContext } from 'react';
2
2
  import '../../_virtual/_tslib.js';
3
- import '../helpers/logger.js';
4
3
  import '../helpers/renderTemplate.js';
4
+ import '../helpers/logger.js';
5
5
  import '@dynamic-labs/utils';
6
6
  import '../schemas/walletConnectSourceSchema.js';
7
7
  import '../schemas/walletBookSchema.js';