@dynamic-labs/wallet-book 0.19.0-alpha.8 → 0.19.0

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.
Files changed (96) hide show
  1. package/CHANGELOG.md +321 -0
  2. package/README.md +34 -0
  3. package/package.json +3 -3
  4. package/src/build/index.d.ts +50 -41
  5. package/src/build/sources/firstParty/index.d.ts +2 -2
  6. package/src/build/sources/index.d.ts +4 -4
  7. package/src/build/sources/walletConnect/index.d.ts +100 -91
  8. package/src/build/sources/walletConnect/preprocessors.d.ts +13 -13
  9. package/src/build/sources/walletConnectOverrides/index.d.ts +249 -249
  10. package/src/build/sources/walletGroups/index.d.ts +2 -2
  11. package/src/components/WalletBookContext.cjs +3 -3
  12. package/src/components/WalletBookContext.d.ts +9 -9
  13. package/src/components/WalletBookContext.js +3 -3
  14. package/src/components/WalletIcon.cjs +19 -19
  15. package/src/components/WalletIcon.d.ts +8 -8
  16. package/src/components/WalletIcon.js +19 -19
  17. package/src/components/index.d.ts +2 -2
  18. package/src/helpers/findWalletBookWallet.cjs +9 -9
  19. package/src/helpers/findWalletBookWallet.d.ts +44 -35
  20. package/src/helpers/findWalletBookWallet.js +9 -9
  21. package/src/helpers/findWalletGroup.cjs +8 -8
  22. package/src/helpers/findWalletGroup.d.ts +11 -11
  23. package/src/helpers/findWalletGroup.js +8 -8
  24. package/src/helpers/getWalletBookCdnUrl.cjs +8 -8
  25. package/src/helpers/getWalletBookCdnUrl.d.ts +1 -1
  26. package/src/helpers/getWalletBookCdnUrl.js +8 -8
  27. package/src/helpers/getWalletBookWallet.cjs +6 -6
  28. package/src/helpers/getWalletBookWallet.d.ts +2 -2
  29. package/src/helpers/getWalletBookWallet.js +6 -6
  30. package/src/helpers/getWalletGroup.cjs +5 -5
  31. package/src/helpers/getWalletGroup.d.ts +3 -3
  32. package/src/helpers/getWalletGroup.js +5 -5
  33. package/src/helpers/getWalletIconUrl.cjs +23 -23
  34. package/src/helpers/getWalletIconUrl.d.ts +3 -3
  35. package/src/helpers/getWalletIconUrl.js +23 -23
  36. package/src/helpers/getWalletLinks.cjs +26 -26
  37. package/src/helpers/getWalletLinks.d.ts +10 -10
  38. package/src/helpers/getWalletLinks.js +26 -26
  39. package/src/helpers/getWalletPrimaryColor.cjs +3 -3
  40. package/src/helpers/getWalletPrimaryColor.d.ts +2 -2
  41. package/src/helpers/getWalletPrimaryColor.js +3 -3
  42. package/src/helpers/index.d.ts +11 -11
  43. package/src/helpers/logger.d.ts +2 -2
  44. package/src/helpers/normalizeWalletName.d.ts +1 -1
  45. package/src/helpers/renderTemplate.cjs +13 -13
  46. package/src/helpers/renderTemplate.d.ts +12 -12
  47. package/src/helpers/renderTemplate.js +13 -13
  48. package/src/hooks/index.d.ts +2 -2
  49. package/src/hooks/useWalletBookCdn.cjs +27 -27
  50. package/src/hooks/useWalletBookCdn.d.ts +55 -46
  51. package/src/hooks/useWalletBookCdn.js +27 -27
  52. package/src/hooks/useWalletBookContext.cjs +6 -6
  53. package/src/hooks/useWalletBookContext.d.ts +1 -1
  54. package/src/hooks/useWalletBookContext.js +6 -6
  55. package/src/index.d.ts +18 -18
  56. package/src/schemas/index.d.ts +3 -3
  57. package/src/schemas/utils/filterEmptyObject.cjs +5 -5
  58. package/src/schemas/utils/filterEmptyObject.d.ts +6 -6
  59. package/src/schemas/utils/filterEmptyObject.js +5 -5
  60. package/src/schemas/utils/nonEmptyString.cjs +3 -3
  61. package/src/schemas/utils/nonEmptyString.d.ts +5 -5
  62. package/src/schemas/utils/nonEmptyString.js +3 -3
  63. package/src/schemas/utils/nonEmptyStringArray.cjs +3 -3
  64. package/src/schemas/utils/nonEmptyStringArray.d.ts +5 -5
  65. package/src/schemas/utils/nonEmptyStringArray.js +3 -3
  66. package/src/schemas/utils/processWalletConnectNativeUrl.d.ts +1 -1
  67. package/src/schemas/utils/sortKeys.d.ts +5 -5
  68. package/src/schemas/utils/transformAndroidId.cjs +16 -16
  69. package/src/schemas/utils/transformAndroidId.d.ts +1 -1
  70. package/src/schemas/utils/transformAndroidId.js +16 -16
  71. package/src/schemas/utils/transformChromeExtensionId.cjs +13 -13
  72. package/src/schemas/utils/transformChromeExtensionId.d.ts +1 -1
  73. package/src/schemas/utils/transformChromeExtensionId.js +13 -13
  74. package/src/schemas/utils/transformEdgeExtensionId.cjs +13 -13
  75. package/src/schemas/utils/transformEdgeExtensionId.d.ts +1 -1
  76. package/src/schemas/utils/transformEdgeExtensionId.js +13 -13
  77. package/src/schemas/utils/transformFirefoxExtensionId.cjs +13 -13
  78. package/src/schemas/utils/transformFirefoxExtensionId.d.ts +1 -1
  79. package/src/schemas/utils/transformFirefoxExtensionId.js +13 -13
  80. package/src/schemas/utils/transformIosId.cjs +20 -20
  81. package/src/schemas/utils/transformIosId.d.ts +1 -1
  82. package/src/schemas/utils/transformIosId.js +20 -20
  83. package/src/schemas/walletBookSchema.cjs +5 -5
  84. package/src/schemas/walletBookSchema.d.ts +862 -714
  85. package/src/schemas/walletBookSchema.js +5 -5
  86. package/src/schemas/walletConnectSourceSchema.cjs +64 -64
  87. package/src/schemas/walletConnectSourceSchema.d.ts +504 -504
  88. package/src/schemas/walletConnectSourceSchema.js +64 -64
  89. package/src/schemas/walletGroup.cjs +22 -22
  90. package/src/schemas/walletGroup.d.ts +50 -50
  91. package/src/schemas/walletGroup.js +22 -22
  92. package/src/schemas/walletSchema.cjs +88 -66
  93. package/src/schemas/walletSchema.d.ts +351 -256
  94. package/src/schemas/walletSchema.js +88 -66
  95. package/wallet-book-fallbacks.cjs +82 -1
  96. package/wallet-book-fallbacks.js +82 -1
@@ -5,15 +5,15 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var getWalletBookWallet = require('./getWalletBookWallet.cjs');
6
6
  var logger = require('./logger.cjs');
7
7
 
8
- const findWalletBookWallet = (walletBook, walletKey) => {
9
- try {
10
- const walletData = getWalletBookWallet.getWalletBookWallet(walletBook, walletKey);
11
- return walletData;
12
- }
13
- catch (err) {
14
- logger.logger.error(err);
15
- return undefined;
16
- }
8
+ const findWalletBookWallet = (walletBook, walletKey) => {
9
+ try {
10
+ const walletData = getWalletBookWallet.getWalletBookWallet(walletBook, walletKey);
11
+ return walletData;
12
+ }
13
+ catch (err) {
14
+ logger.logger.error(err);
15
+ return undefined;
16
+ }
17
17
  };
18
18
 
19
19
  exports.findWalletBookWallet = findWalletBookWallet;
@@ -1,35 +1,44 @@
1
- import { WalletBookSchema } from '../schemas';
2
- export declare const findWalletBookWallet: (walletBook: WalletBookSchema, walletKey: string | undefined) => {
3
- name: string;
4
- brand?: {
5
- alt?: string | undefined;
6
- imageId?: string | undefined;
7
- primaryColor?: string | undefined;
8
- spriteId?: string | undefined;
9
- } | undefined;
10
- chains?: string[] | undefined;
11
- desktop?: {
12
- chromeId?: string | undefined;
13
- edgeId?: string | undefined;
14
- firefoxId?: string | undefined;
15
- native?: string | undefined;
16
- operaId?: string | undefined;
17
- safariId?: string | undefined;
18
- universal?: string | undefined;
19
- } | undefined;
20
- group?: string | undefined;
21
- mobile?: {
22
- android?: string | null | undefined;
23
- androidId?: string | undefined;
24
- ios?: string | null | undefined;
25
- iosId?: string | undefined;
26
- native?: string | undefined;
27
- universal?: string | undefined;
28
- } | undefined;
29
- shortName?: string | undefined;
30
- showOnlyIfInstalled?: boolean | undefined;
31
- switchNetworkOnlyFromWallet?: boolean | undefined;
32
- walletConnect?: {
33
- sdks?: string[] | undefined;
34
- } | undefined;
35
- } | undefined;
1
+ import { WalletBookSchema } from '../schemas';
2
+ export declare const findWalletBookWallet: (walletBook: WalletBookSchema, walletKey: string | undefined) => {
3
+ name: string;
4
+ brand?: {
5
+ alt?: string | undefined;
6
+ imageId?: string | undefined;
7
+ primaryColor?: string | undefined;
8
+ spriteId?: string | undefined;
9
+ } | undefined;
10
+ chains?: string[] | undefined;
11
+ desktop?: {
12
+ chromeId?: string | undefined;
13
+ edgeId?: string | undefined;
14
+ firefoxId?: string | undefined;
15
+ native?: string | undefined;
16
+ operaId?: string | undefined;
17
+ safariId?: string | undefined;
18
+ universal?: string | undefined;
19
+ } | undefined;
20
+ filterFromWalletConnect?: boolean | undefined;
21
+ group?: string | undefined;
22
+ injectedConfig?: {
23
+ chain: string;
24
+ extensionLocators: {
25
+ value: boolean;
26
+ flag: string;
27
+ }[];
28
+ windowLocations?: string[] | undefined;
29
+ }[] | undefined;
30
+ mobile?: {
31
+ android?: string | null | undefined;
32
+ androidId?: string | undefined;
33
+ ios?: string | null | undefined;
34
+ iosId?: string | undefined;
35
+ native?: string | undefined;
36
+ universal?: string | undefined;
37
+ } | undefined;
38
+ shortName?: string | undefined;
39
+ showOnlyIfInstalled?: boolean | undefined;
40
+ switchNetworkOnlyFromWallet?: boolean | undefined;
41
+ walletConnect?: {
42
+ sdks?: string[] | undefined;
43
+ } | undefined;
44
+ } | undefined;
@@ -1,15 +1,15 @@
1
1
  import { getWalletBookWallet } from './getWalletBookWallet.js';
2
2
  import { logger } from './logger.js';
3
3
 
4
- const findWalletBookWallet = (walletBook, walletKey) => {
5
- try {
6
- const walletData = getWalletBookWallet(walletBook, walletKey);
7
- return walletData;
8
- }
9
- catch (err) {
10
- logger.error(err);
11
- return undefined;
12
- }
4
+ const findWalletBookWallet = (walletBook, walletKey) => {
5
+ try {
6
+ const walletData = getWalletBookWallet(walletBook, walletKey);
7
+ return walletData;
8
+ }
9
+ catch (err) {
10
+ logger.error(err);
11
+ return undefined;
12
+ }
13
13
  };
14
14
 
15
15
  export { findWalletBookWallet };
@@ -5,14 +5,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var getWalletGroup = require('./getWalletGroup.cjs');
6
6
  var logger = require('./logger.cjs');
7
7
 
8
- const findWalletGroup = (walletBook, walletGroup) => {
9
- try {
10
- return getWalletGroup.getWalletGroup(walletBook, walletGroup);
11
- }
12
- catch (err) {
13
- logger.logger.error(err);
14
- return undefined;
15
- }
8
+ const findWalletGroup = (walletBook, walletGroup) => {
9
+ try {
10
+ return getWalletGroup.getWalletGroup(walletBook, walletGroup);
11
+ }
12
+ catch (err) {
13
+ logger.logger.error(err);
14
+ return undefined;
15
+ }
16
16
  };
17
17
 
18
18
  exports.findWalletGroup = findWalletGroup;
@@ -1,11 +1,11 @@
1
- import { WalletBookSchema } from '../schemas';
2
- export declare const findWalletGroup: (walletBook: WalletBookSchema, walletGroup: string) => {
3
- key: string;
4
- name: string;
5
- brand?: {
6
- alt?: string | undefined;
7
- imageId?: string | undefined;
8
- primaryColor?: string | undefined;
9
- spriteId?: string | undefined;
10
- } | undefined;
11
- } | undefined;
1
+ import { WalletBookSchema } from '../schemas';
2
+ export declare const findWalletGroup: (walletBook: WalletBookSchema, walletGroup: string) => {
3
+ key: string;
4
+ name: string;
5
+ brand?: {
6
+ alt?: string | undefined;
7
+ imageId?: string | undefined;
8
+ primaryColor?: string | undefined;
9
+ spriteId?: string | undefined;
10
+ } | undefined;
11
+ } | undefined;
@@ -1,14 +1,14 @@
1
1
  import { getWalletGroup } from './getWalletGroup.js';
2
2
  import { logger } from './logger.js';
3
3
 
4
- const findWalletGroup = (walletBook, walletGroup) => {
5
- try {
6
- return getWalletGroup(walletBook, walletGroup);
7
- }
8
- catch (err) {
9
- logger.error(err);
10
- return undefined;
11
- }
4
+ const findWalletGroup = (walletBook, walletGroup) => {
5
+ try {
6
+ return getWalletGroup(walletBook, walletGroup);
7
+ }
8
+ catch (err) {
9
+ logger.error(err);
10
+ return undefined;
11
+ }
12
12
  };
13
13
 
14
14
  export { findWalletGroup };
@@ -2,14 +2,14 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- /* eslint-disable arrow-body-style */
6
- // This method needs to be wrapped correctly to avoid bundler issues
7
- // that may update process.env variable via custom configs in customers apps
8
- const getWalletBookCdnUrl = () => {
9
- return (process.env['WALLET_BOOK_CDN_URL'] ??
10
- process.env['NEXT_PUBLIC_WALLET_BOOK_CDN_URL'] ??
11
- process.env['REACT_APP_WALLET_BOOK_CDN_URL'] ??
12
- 'https://dynamic-static-assets.com/wallet-book/v1/stable/wallet-book.json');
5
+ /* eslint-disable arrow-body-style */
6
+ // This method needs to be wrapped correctly to avoid bundler issues
7
+ // that may update process.env variable via custom configs in customers apps
8
+ const getWalletBookCdnUrl = () => {
9
+ return (process.env['WALLET_BOOK_CDN_URL'] ??
10
+ process.env['NEXT_PUBLIC_WALLET_BOOK_CDN_URL'] ??
11
+ process.env['REACT_APP_WALLET_BOOK_CDN_URL'] ??
12
+ 'https://dynamic-static-assets.com/wallet-book/v1/stable/wallet-book.json');
13
13
  };
14
14
 
15
15
  exports.getWalletBookCdnUrl = getWalletBookCdnUrl;
@@ -1 +1 @@
1
- export declare const getWalletBookCdnUrl: () => string;
1
+ export declare const getWalletBookCdnUrl: () => string;
@@ -1,11 +1,11 @@
1
- /* eslint-disable arrow-body-style */
2
- // This method needs to be wrapped correctly to avoid bundler issues
3
- // that may update process.env variable via custom configs in customers apps
4
- const getWalletBookCdnUrl = () => {
5
- return (process.env['WALLET_BOOK_CDN_URL'] ??
6
- process.env['NEXT_PUBLIC_WALLET_BOOK_CDN_URL'] ??
7
- process.env['REACT_APP_WALLET_BOOK_CDN_URL'] ??
8
- 'https://dynamic-static-assets.com/wallet-book/v1/stable/wallet-book.json');
1
+ /* eslint-disable arrow-body-style */
2
+ // This method needs to be wrapped correctly to avoid bundler issues
3
+ // that may update process.env variable via custom configs in customers apps
4
+ const getWalletBookCdnUrl = () => {
5
+ return (process.env['WALLET_BOOK_CDN_URL'] ??
6
+ process.env['NEXT_PUBLIC_WALLET_BOOK_CDN_URL'] ??
7
+ process.env['REACT_APP_WALLET_BOOK_CDN_URL'] ??
8
+ 'https://dynamic-static-assets.com/wallet-book/v1/stable/wallet-book.json');
9
9
  };
10
10
 
11
11
  export { getWalletBookCdnUrl };
@@ -4,12 +4,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var normalizeWalletName = require('./normalizeWalletName.cjs');
6
6
 
7
- const getWalletBookWallet = (walletBook, walletName) => {
8
- const normalizedWalletName = normalizeWalletName.normalizeWalletName(walletName);
9
- const walletData = walletBook?.wallets?.[normalizedWalletName];
10
- if (!walletData)
11
- throw new Error(`Wallet ${walletName} not found in wallet book (${Object.keys(walletBook?.wallets ?? {}).length} wallets found)`);
12
- return walletData;
7
+ const getWalletBookWallet = (walletBook, walletName) => {
8
+ const normalizedWalletName = normalizeWalletName.normalizeWalletName(walletName);
9
+ const walletData = walletBook?.wallets?.[normalizedWalletName];
10
+ if (!walletData)
11
+ throw new Error(`Wallet ${walletName} not found in wallet book (${Object.keys(walletBook?.wallets ?? {}).length} wallets found)`);
12
+ return walletData;
13
13
  };
14
14
 
15
15
  exports.getWalletBookWallet = getWalletBookWallet;
@@ -1,2 +1,2 @@
1
- import { WalletBookSchema, WalletSchema } from '../schemas';
2
- export declare const getWalletBookWallet: (walletBook: WalletBookSchema, walletName: string | undefined) => WalletSchema;
1
+ import { WalletBookSchema, WalletSchema } from '../schemas';
2
+ export declare const getWalletBookWallet: (walletBook: WalletBookSchema, walletName: string | undefined) => WalletSchema;
@@ -1,11 +1,11 @@
1
1
  import { normalizeWalletName } from './normalizeWalletName.js';
2
2
 
3
- const getWalletBookWallet = (walletBook, walletName) => {
4
- const normalizedWalletName = normalizeWalletName(walletName);
5
- const walletData = walletBook?.wallets?.[normalizedWalletName];
6
- if (!walletData)
7
- throw new Error(`Wallet ${walletName} not found in wallet book (${Object.keys(walletBook?.wallets ?? {}).length} wallets found)`);
8
- return walletData;
3
+ const getWalletBookWallet = (walletBook, walletName) => {
4
+ const normalizedWalletName = normalizeWalletName(walletName);
5
+ const walletData = walletBook?.wallets?.[normalizedWalletName];
6
+ if (!walletData)
7
+ throw new Error(`Wallet ${walletName} not found in wallet book (${Object.keys(walletBook?.wallets ?? {}).length} wallets found)`);
8
+ return walletData;
9
9
  };
10
10
 
11
11
  export { getWalletBookWallet };
@@ -2,11 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const getWalletGroup = (walletBook, key) => {
6
- const group = walletBook.groups[key];
7
- if (!group)
8
- throw new Error(`Group ${key} not found in wallet book`);
9
- return group;
5
+ const getWalletGroup = (walletBook, key) => {
6
+ const group = walletBook.groups[key];
7
+ if (!group)
8
+ throw new Error(`Group ${key} not found in wallet book`);
9
+ return group;
10
10
  };
11
11
 
12
12
  exports.getWalletGroup = getWalletGroup;
@@ -1,3 +1,3 @@
1
- import { WalletBookSchema } from '../schemas';
2
- import { WalletGroupSchema } from '../schemas/walletGroup';
3
- export declare const getWalletGroup: (walletBook: WalletBookSchema, key: string) => WalletGroupSchema;
1
+ import { WalletBookSchema } from '../schemas';
2
+ import { WalletGroupSchema } from '../schemas/walletGroup';
3
+ export declare const getWalletGroup: (walletBook: WalletBookSchema, key: string) => WalletGroupSchema;
@@ -1,8 +1,8 @@
1
- const getWalletGroup = (walletBook, key) => {
2
- const group = walletBook.groups[key];
3
- if (!group)
4
- throw new Error(`Group ${key} not found in wallet book`);
5
- return group;
1
+ const getWalletGroup = (walletBook, key) => {
2
+ const group = walletBook.groups[key];
3
+ if (!group)
4
+ throw new Error(`Group ${key} not found in wallet book`);
5
+ return group;
6
6
  };
7
7
 
8
8
  export { getWalletGroup };
@@ -6,29 +6,29 @@ var getWalletBookWallet = require('./getWalletBookWallet.cjs');
6
6
  var logger = require('./logger.cjs');
7
7
  var renderTemplate = require('./renderTemplate.cjs');
8
8
 
9
- const getWalletIconUrl = (walletBook, walletKey) => {
10
- try {
11
- const walletData = getWalletBookWallet.getWalletBookWallet(walletBook, walletKey);
12
- if (walletData?.brand?.spriteId) {
13
- return renderTemplate.renderTemplate('iconicUrl', walletData.brand.spriteId);
14
- }
15
- if (walletData?.brand?.imageId) {
16
- return renderTemplate.renderTemplate('walletConnectUrl', walletData.brand.imageId);
17
- }
18
- }
19
- catch (err) {
20
- logger.logger.error(err);
21
- }
22
- return '';
23
- };
24
- const getDefaultWalletIconUrl = () => {
25
- try {
26
- return renderTemplate.renderTemplate('iconicUrl', 'defaultwallet');
27
- }
28
- catch (err) {
29
- logger.logger.error(err);
30
- }
31
- return '';
9
+ const getWalletIconUrl = (walletBook, walletKey) => {
10
+ try {
11
+ const walletData = getWalletBookWallet.getWalletBookWallet(walletBook, walletKey);
12
+ if (walletData?.brand?.spriteId) {
13
+ return renderTemplate.renderTemplate('iconicUrl', walletData.brand.spriteId);
14
+ }
15
+ if (walletData?.brand?.imageId) {
16
+ return renderTemplate.renderTemplate('walletConnectUrl', walletData.brand.imageId);
17
+ }
18
+ }
19
+ catch (err) {
20
+ logger.logger.error(err);
21
+ }
22
+ return '';
23
+ };
24
+ const getDefaultWalletIconUrl = () => {
25
+ try {
26
+ return renderTemplate.renderTemplate('iconicUrl', 'defaultwallet');
27
+ }
28
+ catch (err) {
29
+ logger.logger.error(err);
30
+ }
31
+ return '';
32
32
  };
33
33
 
34
34
  exports.getDefaultWalletIconUrl = getDefaultWalletIconUrl;
@@ -1,3 +1,3 @@
1
- import { WalletBookSchema } from '../schemas';
2
- export declare const getWalletIconUrl: (walletBook: WalletBookSchema, walletKey?: string) => string | undefined;
3
- export declare const getDefaultWalletIconUrl: () => string | undefined;
1
+ import { WalletBookSchema } from '../schemas';
2
+ export declare const getWalletIconUrl: (walletBook: WalletBookSchema, walletKey?: string) => string | undefined;
3
+ export declare const getDefaultWalletIconUrl: () => string | undefined;
@@ -2,29 +2,29 @@ import { getWalletBookWallet } from './getWalletBookWallet.js';
2
2
  import { logger } from './logger.js';
3
3
  import { renderTemplate } from './renderTemplate.js';
4
4
 
5
- const getWalletIconUrl = (walletBook, walletKey) => {
6
- try {
7
- const walletData = getWalletBookWallet(walletBook, walletKey);
8
- if (walletData?.brand?.spriteId) {
9
- return renderTemplate('iconicUrl', walletData.brand.spriteId);
10
- }
11
- if (walletData?.brand?.imageId) {
12
- return renderTemplate('walletConnectUrl', walletData.brand.imageId);
13
- }
14
- }
15
- catch (err) {
16
- logger.error(err);
17
- }
18
- return '';
19
- };
20
- const getDefaultWalletIconUrl = () => {
21
- try {
22
- return renderTemplate('iconicUrl', 'defaultwallet');
23
- }
24
- catch (err) {
25
- logger.error(err);
26
- }
27
- return '';
5
+ const getWalletIconUrl = (walletBook, walletKey) => {
6
+ try {
7
+ const walletData = getWalletBookWallet(walletBook, walletKey);
8
+ if (walletData?.brand?.spriteId) {
9
+ return renderTemplate('iconicUrl', walletData.brand.spriteId);
10
+ }
11
+ if (walletData?.brand?.imageId) {
12
+ return renderTemplate('walletConnectUrl', walletData.brand.imageId);
13
+ }
14
+ }
15
+ catch (err) {
16
+ logger.error(err);
17
+ }
18
+ return '';
19
+ };
20
+ const getDefaultWalletIconUrl = () => {
21
+ try {
22
+ return renderTemplate('iconicUrl', 'defaultwallet');
23
+ }
24
+ catch (err) {
25
+ logger.error(err);
26
+ }
27
+ return '';
28
28
  };
29
29
 
30
30
  export { getDefaultWalletIconUrl, getWalletIconUrl };
@@ -5,32 +5,32 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var findWalletBookWallet = require('./findWalletBookWallet.cjs');
6
6
  var renderTemplate = require('./renderTemplate.cjs');
7
7
 
8
- const getWalletLinks = (walletBook, walletKey) => {
9
- const walletData = findWalletBookWallet.findWalletBookWallet(walletBook, walletKey);
10
- const links = {
11
- android: '',
12
- brave: '',
13
- chrome: '',
14
- edge: '',
15
- firefox: '',
16
- ios: '',
17
- };
18
- links.brave =
19
- renderTemplate.renderTemplate('chromeUrl', walletData?.desktop?.chromeId) ?? '';
20
- links.chrome =
21
- renderTemplate.renderTemplate('chromeUrl', walletData?.desktop?.chromeId) ?? '';
22
- links.edge = renderTemplate.renderTemplate('edgeUrl', walletData?.desktop?.edgeId) ?? '';
23
- links.firefox =
24
- renderTemplate.renderTemplate('firefoxUrl', walletData?.desktop?.firefoxId) ?? '';
25
- links.ios =
26
- renderTemplate.renderTemplate('iosUrl', walletData?.mobile?.iosId) ??
27
- walletData?.mobile?.ios ??
28
- '';
29
- links.android =
30
- renderTemplate.renderTemplate('androidUrl', walletData?.mobile?.androidId) ??
31
- walletData?.mobile?.android ??
32
- '';
33
- return links;
8
+ const getWalletLinks = (walletBook, walletKey) => {
9
+ const walletData = findWalletBookWallet.findWalletBookWallet(walletBook, walletKey);
10
+ const links = {
11
+ android: '',
12
+ brave: '',
13
+ chrome: '',
14
+ edge: '',
15
+ firefox: '',
16
+ ios: '',
17
+ };
18
+ links.brave =
19
+ renderTemplate.renderTemplate('chromeUrl', walletData?.desktop?.chromeId) ?? '';
20
+ links.chrome =
21
+ renderTemplate.renderTemplate('chromeUrl', walletData?.desktop?.chromeId) ?? '';
22
+ links.edge = renderTemplate.renderTemplate('edgeUrl', walletData?.desktop?.edgeId) ?? '';
23
+ links.firefox =
24
+ renderTemplate.renderTemplate('firefoxUrl', walletData?.desktop?.firefoxId) ?? '';
25
+ links.ios =
26
+ renderTemplate.renderTemplate('iosUrl', walletData?.mobile?.iosId) ??
27
+ walletData?.mobile?.ios ??
28
+ '';
29
+ links.android =
30
+ renderTemplate.renderTemplate('androidUrl', walletData?.mobile?.androidId) ??
31
+ walletData?.mobile?.android ??
32
+ '';
33
+ return links;
34
34
  };
35
35
 
36
36
  exports.getWalletLinks = getWalletLinks;
@@ -1,10 +1,10 @@
1
- import { WalletBookSchema } from '../schemas';
2
- export type WalletLinks = {
3
- android: string;
4
- brave: string;
5
- chrome: string;
6
- edge: string;
7
- firefox: string;
8
- ios: string;
9
- };
10
- export declare const getWalletLinks: (walletBook: WalletBookSchema, walletKey: string) => WalletLinks;
1
+ import { WalletBookSchema } from '../schemas';
2
+ export type WalletLinks = {
3
+ android: string;
4
+ brave: string;
5
+ chrome: string;
6
+ edge: string;
7
+ firefox: string;
8
+ ios: string;
9
+ };
10
+ export declare const getWalletLinks: (walletBook: WalletBookSchema, walletKey: string) => WalletLinks;
@@ -1,32 +1,32 @@
1
1
  import { findWalletBookWallet } from './findWalletBookWallet.js';
2
2
  import { renderTemplate } from './renderTemplate.js';
3
3
 
4
- const getWalletLinks = (walletBook, walletKey) => {
5
- const walletData = findWalletBookWallet(walletBook, walletKey);
6
- const links = {
7
- android: '',
8
- brave: '',
9
- chrome: '',
10
- edge: '',
11
- firefox: '',
12
- ios: '',
13
- };
14
- links.brave =
15
- renderTemplate('chromeUrl', walletData?.desktop?.chromeId) ?? '';
16
- links.chrome =
17
- renderTemplate('chromeUrl', walletData?.desktop?.chromeId) ?? '';
18
- links.edge = renderTemplate('edgeUrl', walletData?.desktop?.edgeId) ?? '';
19
- links.firefox =
20
- renderTemplate('firefoxUrl', walletData?.desktop?.firefoxId) ?? '';
21
- links.ios =
22
- renderTemplate('iosUrl', walletData?.mobile?.iosId) ??
23
- walletData?.mobile?.ios ??
24
- '';
25
- links.android =
26
- renderTemplate('androidUrl', walletData?.mobile?.androidId) ??
27
- walletData?.mobile?.android ??
28
- '';
29
- return links;
4
+ const getWalletLinks = (walletBook, walletKey) => {
5
+ const walletData = findWalletBookWallet(walletBook, walletKey);
6
+ const links = {
7
+ android: '',
8
+ brave: '',
9
+ chrome: '',
10
+ edge: '',
11
+ firefox: '',
12
+ ios: '',
13
+ };
14
+ links.brave =
15
+ renderTemplate('chromeUrl', walletData?.desktop?.chromeId) ?? '';
16
+ links.chrome =
17
+ renderTemplate('chromeUrl', walletData?.desktop?.chromeId) ?? '';
18
+ links.edge = renderTemplate('edgeUrl', walletData?.desktop?.edgeId) ?? '';
19
+ links.firefox =
20
+ renderTemplate('firefoxUrl', walletData?.desktop?.firefoxId) ?? '';
21
+ links.ios =
22
+ renderTemplate('iosUrl', walletData?.mobile?.iosId) ??
23
+ walletData?.mobile?.ios ??
24
+ '';
25
+ links.android =
26
+ renderTemplate('androidUrl', walletData?.mobile?.androidId) ??
27
+ walletData?.mobile?.android ??
28
+ '';
29
+ return links;
30
30
  };
31
31
 
32
32
  export { getWalletLinks };
@@ -4,9 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var getWalletBookWallet = require('./getWalletBookWallet.cjs');
6
6
 
7
- const getWalletPrimaryColor = (walletBook, walletKey) => {
8
- const walletData = getWalletBookWallet.getWalletBookWallet(walletBook, walletKey);
9
- return walletData?.brand?.primaryColor;
7
+ const getWalletPrimaryColor = (walletBook, walletKey) => {
8
+ const walletData = getWalletBookWallet.getWalletBookWallet(walletBook, walletKey);
9
+ return walletData?.brand?.primaryColor;
10
10
  };
11
11
 
12
12
  exports.getWalletPrimaryColor = getWalletPrimaryColor;
@@ -1,2 +1,2 @@
1
- import { WalletBookSchema } from '../schemas';
2
- export declare const getWalletPrimaryColor: (walletBook: WalletBookSchema, walletKey: string) => string | undefined;
1
+ import { WalletBookSchema } from '../schemas';
2
+ export declare const getWalletPrimaryColor: (walletBook: WalletBookSchema, walletKey: string) => string | undefined;
@@ -1,8 +1,8 @@
1
1
  import { getWalletBookWallet } from './getWalletBookWallet.js';
2
2
 
3
- const getWalletPrimaryColor = (walletBook, walletKey) => {
4
- const walletData = getWalletBookWallet(walletBook, walletKey);
5
- return walletData?.brand?.primaryColor;
3
+ const getWalletPrimaryColor = (walletBook, walletKey) => {
4
+ const walletData = getWalletBookWallet(walletBook, walletKey);
5
+ return walletData?.brand?.primaryColor;
6
6
  };
7
7
 
8
8
  export { getWalletPrimaryColor };