@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
@@ -1,19 +1,19 @@
1
- const transformAndroidId = (url) => {
2
- if (!url?.match(/^https?:\/\//))
3
- return url;
4
- if (!url)
5
- return;
6
- try {
7
- const urlObject = new URL(url);
8
- const id = urlObject.searchParams.get('id');
9
- if (id) {
10
- return id;
11
- }
12
- }
13
- catch {
14
- // ignore
15
- }
16
- return;
1
+ const transformAndroidId = (url) => {
2
+ if (!url?.match(/^https?:\/\//))
3
+ return url;
4
+ if (!url)
5
+ return;
6
+ try {
7
+ const urlObject = new URL(url);
8
+ const id = urlObject.searchParams.get('id');
9
+ if (id) {
10
+ return id;
11
+ }
12
+ }
13
+ catch {
14
+ // ignore
15
+ }
16
+ return;
17
17
  };
18
18
 
19
19
  export { transformAndroidId };
@@ -2,19 +2,19 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const transformChromeExtensionId = (url) => {
6
- if (url?.match(/^[a-z]{32}$/))
7
- return url;
8
- if (url?.includes('chrome.google.com/webstore/detail/')) {
9
- try {
10
- const urlObject = new URL(url);
11
- return urlObject.pathname.split('/').at(-1);
12
- }
13
- catch {
14
- // ignore
15
- }
16
- }
17
- return;
5
+ const transformChromeExtensionId = (url) => {
6
+ if (url?.match(/^[a-z]{32}$/))
7
+ return url;
8
+ if (url?.includes('chrome.google.com/webstore/detail/')) {
9
+ try {
10
+ const urlObject = new URL(url);
11
+ return urlObject.pathname.split('/').at(-1);
12
+ }
13
+ catch {
14
+ // ignore
15
+ }
16
+ }
17
+ return;
18
18
  };
19
19
 
20
20
  exports.transformChromeExtensionId = transformChromeExtensionId;
@@ -1 +1 @@
1
- export declare const transformChromeExtensionId: (url: string | undefined) => string | undefined;
1
+ export declare const transformChromeExtensionId: (url: string | undefined) => string | undefined;
@@ -1,16 +1,16 @@
1
- const transformChromeExtensionId = (url) => {
2
- if (url?.match(/^[a-z]{32}$/))
3
- return url;
4
- if (url?.includes('chrome.google.com/webstore/detail/')) {
5
- try {
6
- const urlObject = new URL(url);
7
- return urlObject.pathname.split('/').at(-1);
8
- }
9
- catch {
10
- // ignore
11
- }
12
- }
13
- return;
1
+ const transformChromeExtensionId = (url) => {
2
+ if (url?.match(/^[a-z]{32}$/))
3
+ return url;
4
+ if (url?.includes('chrome.google.com/webstore/detail/')) {
5
+ try {
6
+ const urlObject = new URL(url);
7
+ return urlObject.pathname.split('/').at(-1);
8
+ }
9
+ catch {
10
+ // ignore
11
+ }
12
+ }
13
+ return;
14
14
  };
15
15
 
16
16
  export { transformChromeExtensionId };
@@ -2,19 +2,19 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const transformEdgeExtensionId = (url) => {
6
- if (url?.match(/^[a-z]{32}$/))
7
- return url;
8
- if (url?.includes('microsoftedge.microsoft.com/addons/detail/')) {
9
- try {
10
- const urlObject = new URL(url);
11
- return urlObject.pathname.split('/').at(-1);
12
- }
13
- catch {
14
- // ignore
15
- }
16
- }
17
- return;
5
+ const transformEdgeExtensionId = (url) => {
6
+ if (url?.match(/^[a-z]{32}$/))
7
+ return url;
8
+ if (url?.includes('microsoftedge.microsoft.com/addons/detail/')) {
9
+ try {
10
+ const urlObject = new URL(url);
11
+ return urlObject.pathname.split('/').at(-1);
12
+ }
13
+ catch {
14
+ // ignore
15
+ }
16
+ }
17
+ return;
18
18
  };
19
19
 
20
20
  exports.transformEdgeExtensionId = transformEdgeExtensionId;
@@ -1 +1 @@
1
- export declare const transformEdgeExtensionId: (url: string | undefined) => string | undefined;
1
+ export declare const transformEdgeExtensionId: (url: string | undefined) => string | undefined;
@@ -1,16 +1,16 @@
1
- const transformEdgeExtensionId = (url) => {
2
- if (url?.match(/^[a-z]{32}$/))
3
- return url;
4
- if (url?.includes('microsoftedge.microsoft.com/addons/detail/')) {
5
- try {
6
- const urlObject = new URL(url);
7
- return urlObject.pathname.split('/').at(-1);
8
- }
9
- catch {
10
- // ignore
11
- }
12
- }
13
- return;
1
+ const transformEdgeExtensionId = (url) => {
2
+ if (url?.match(/^[a-z]{32}$/))
3
+ return url;
4
+ if (url?.includes('microsoftedge.microsoft.com/addons/detail/')) {
5
+ try {
6
+ const urlObject = new URL(url);
7
+ return urlObject.pathname.split('/').at(-1);
8
+ }
9
+ catch {
10
+ // ignore
11
+ }
12
+ }
13
+ return;
14
14
  };
15
15
 
16
16
  export { transformEdgeExtensionId };
@@ -2,19 +2,19 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const transformFirefoxExtensionId = (url) => {
6
- if (!url?.match(/^https?:\/\//))
7
- return url;
8
- if (url?.includes('addons.mozilla.org')) {
9
- try {
10
- const urlObject = new URL(url);
11
- return urlObject.pathname.replace(/\/$/, '').split('/').at(-1);
12
- }
13
- catch {
14
- // ignore
15
- }
16
- }
17
- return;
5
+ const transformFirefoxExtensionId = (url) => {
6
+ if (!url?.match(/^https?:\/\//))
7
+ return url;
8
+ if (url?.includes('addons.mozilla.org')) {
9
+ try {
10
+ const urlObject = new URL(url);
11
+ return urlObject.pathname.replace(/\/$/, '').split('/').at(-1);
12
+ }
13
+ catch {
14
+ // ignore
15
+ }
16
+ }
17
+ return;
18
18
  };
19
19
 
20
20
  exports.transformFirefoxExtensionId = transformFirefoxExtensionId;
@@ -1 +1 @@
1
- export declare const transformFirefoxExtensionId: (url: string | undefined) => string | undefined;
1
+ export declare const transformFirefoxExtensionId: (url: string | undefined) => string | undefined;
@@ -1,16 +1,16 @@
1
- const transformFirefoxExtensionId = (url) => {
2
- if (!url?.match(/^https?:\/\//))
3
- return url;
4
- if (url?.includes('addons.mozilla.org')) {
5
- try {
6
- const urlObject = new URL(url);
7
- return urlObject.pathname.replace(/\/$/, '').split('/').at(-1);
8
- }
9
- catch {
10
- // ignore
11
- }
12
- }
13
- return;
1
+ const transformFirefoxExtensionId = (url) => {
2
+ if (!url?.match(/^https?:\/\//))
3
+ return url;
4
+ if (url?.includes('addons.mozilla.org')) {
5
+ try {
6
+ const urlObject = new URL(url);
7
+ return urlObject.pathname.replace(/\/$/, '').split('/').at(-1);
8
+ }
9
+ catch {
10
+ // ignore
11
+ }
12
+ }
13
+ return;
14
14
  };
15
15
 
16
16
  export { transformFirefoxExtensionId };
@@ -2,26 +2,26 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const idRegex = /^id[0-9]{1,36}$/;
6
- const transformIosId = (url) => {
7
- if (url?.match(idRegex))
8
- return url;
9
- if (url?.match(/^https:\/\/[a-zA-Z0-9-]+\.apple\.com/)) {
10
- try {
11
- const urlObject = new URL(url);
12
- const expectedId = urlObject.pathname
13
- .replace(/\/$/, '')
14
- .split('/')
15
- .at(-1);
16
- if (expectedId?.match(idRegex)) {
17
- return expectedId;
18
- }
19
- }
20
- catch {
21
- // ignore
22
- }
23
- }
24
- return;
5
+ const idRegex = /^id[0-9]{1,36}$/;
6
+ const transformIosId = (url) => {
7
+ if (url?.match(idRegex))
8
+ return url;
9
+ if (url?.match(/^https:\/\/[a-zA-Z0-9-]+\.apple\.com/)) {
10
+ try {
11
+ const urlObject = new URL(url);
12
+ const expectedId = urlObject.pathname
13
+ .replace(/\/$/, '')
14
+ .split('/')
15
+ .at(-1);
16
+ if (expectedId?.match(idRegex)) {
17
+ return expectedId;
18
+ }
19
+ }
20
+ catch {
21
+ // ignore
22
+ }
23
+ }
24
+ return;
25
25
  };
26
26
 
27
27
  exports.transformIosId = transformIosId;
@@ -1 +1 @@
1
- export declare const transformIosId: (url: string | undefined) => string | undefined;
1
+ export declare const transformIosId: (url: string | undefined) => string | undefined;
@@ -1,23 +1,23 @@
1
- const idRegex = /^id[0-9]{1,36}$/;
2
- const transformIosId = (url) => {
3
- if (url?.match(idRegex))
4
- return url;
5
- if (url?.match(/^https:\/\/[a-zA-Z0-9-]+\.apple\.com/)) {
6
- try {
7
- const urlObject = new URL(url);
8
- const expectedId = urlObject.pathname
9
- .replace(/\/$/, '')
10
- .split('/')
11
- .at(-1);
12
- if (expectedId?.match(idRegex)) {
13
- return expectedId;
14
- }
15
- }
16
- catch {
17
- // ignore
18
- }
19
- }
20
- return;
1
+ const idRegex = /^id[0-9]{1,36}$/;
2
+ const transformIosId = (url) => {
3
+ if (url?.match(idRegex))
4
+ return url;
5
+ if (url?.match(/^https:\/\/[a-zA-Z0-9-]+\.apple\.com/)) {
6
+ try {
7
+ const urlObject = new URL(url);
8
+ const expectedId = urlObject.pathname
9
+ .replace(/\/$/, '')
10
+ .split('/')
11
+ .at(-1);
12
+ if (expectedId?.match(idRegex)) {
13
+ return expectedId;
14
+ }
15
+ }
16
+ catch {
17
+ // ignore
18
+ }
19
+ }
20
+ return;
21
21
  };
22
22
 
23
23
  export { transformIosId };
@@ -6,11 +6,11 @@ var zod = require('zod');
6
6
  var walletSchema = require('./walletSchema.cjs');
7
7
  var walletGroup = require('./walletGroup.cjs');
8
8
 
9
- zod.z.record(zod.z.string(), walletSchema.walletSchema);
10
- const walletBookSchema = zod.z.preprocess((val) => val, zod.z.object({
11
- groups: zod.z.record(zod.z.string(), walletGroup.walletGroupSchema),
12
- wallets: zod.z.record(zod.z.string(), walletSchema.walletSchema),
13
- }));
9
+ zod.z.record(zod.z.string(), walletSchema.walletSchema);
10
+ const walletBookSchema = zod.z.preprocess((val) => val, zod.z.object({
11
+ groups: zod.z.record(zod.z.string(), walletGroup.walletGroupSchema),
12
+ wallets: zod.z.record(zod.z.string(), walletSchema.walletSchema),
13
+ }));
14
14
  zod.z.record(zod.z.string(), walletGroup.walletGroupSchema);
15
15
 
16
16
  exports.walletBookSchema = walletBookSchema;