@medialane/ui 0.184.0 → 0.186.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 (251) hide show
  1. package/dist/components/drop/create/drop-create.cjs +6 -4
  2. package/dist/components/drop/create/drop-create.cjs.map +1 -1
  3. package/dist/components/drop/create/drop-create.d.cts +4 -6
  4. package/dist/components/drop/create/drop-create.d.ts +4 -6
  5. package/dist/components/drop/create/drop-create.js +6 -4
  6. package/dist/components/drop/create/drop-create.js.map +1 -1
  7. package/dist/components/drop/create/launch-dialog.cjs +4 -1
  8. package/dist/components/drop/create/launch-dialog.cjs.map +1 -1
  9. package/dist/components/drop/create/launch-dialog.js +5 -2
  10. package/dist/components/drop/create/launch-dialog.js.map +1 -1
  11. package/dist/components/drop/create/sale-section.cjs +2 -2
  12. package/dist/components/drop/create/sale-section.cjs.map +1 -1
  13. package/dist/components/drop/create/sale-section.d.cts +3 -3
  14. package/dist/components/drop/create/sale-section.d.ts +3 -3
  15. package/dist/components/drop/create/sale-section.js +2 -2
  16. package/dist/components/drop/create/sale-section.js.map +1 -1
  17. package/dist/components/drop/drop-card.cjs +2 -2
  18. package/dist/components/drop/drop-card.cjs.map +1 -1
  19. package/dist/components/drop/drop-card.js +1 -1
  20. package/dist/components/drop/drop-card.js.map +1 -1
  21. package/dist/components/drop/drop-features.cjs +44 -0
  22. package/dist/components/drop/drop-features.cjs.map +1 -0
  23. package/dist/components/drop/drop-features.d.cts +5 -0
  24. package/dist/components/drop/drop-features.d.ts +5 -0
  25. package/dist/components/drop/drop-features.js +20 -0
  26. package/dist/components/drop/drop-features.js.map +1 -0
  27. package/dist/components/{drop-status-display.cjs → drop/drop-status.cjs} +5 -5
  28. package/dist/components/drop/drop-status.cjs.map +1 -0
  29. package/dist/components/{drop-status-display.d.ts → drop/drop-status.d.cts} +1 -2
  30. package/dist/components/{drop-status-display.d.cts → drop/drop-status.d.ts} +1 -2
  31. package/dist/components/{drop-status-display.js → drop/drop-status.js} +2 -2
  32. package/dist/components/drop/drop-status.js.map +1 -0
  33. package/dist/components/drop/page/drop-action-box.cjs +3 -3
  34. package/dist/components/drop/page/drop-action-box.cjs.map +1 -1
  35. package/dist/components/drop/page/drop-action-box.d.cts +0 -1
  36. package/dist/components/drop/page/drop-action-box.d.ts +0 -1
  37. package/dist/components/drop/page/drop-action-box.js +1 -1
  38. package/dist/components/drop/page/drop-action-box.js.map +1 -1
  39. package/dist/components/drop/page/drop-page.cjs +6 -4
  40. package/dist/components/drop/page/drop-page.cjs.map +1 -1
  41. package/dist/components/drop/page/drop-page.d.cts +1 -2
  42. package/dist/components/drop/page/drop-page.d.ts +1 -2
  43. package/dist/components/drop/page/drop-page.js +7 -5
  44. package/dist/components/drop/page/drop-page.js.map +1 -1
  45. package/dist/components/media-wallet/action-button.cjs +54 -0
  46. package/dist/components/media-wallet/action-button.cjs.map +1 -0
  47. package/dist/components/media-wallet/action-button.d.cts +10 -0
  48. package/dist/components/media-wallet/action-button.d.ts +10 -0
  49. package/dist/components/media-wallet/action-button.js +28 -0
  50. package/dist/components/media-wallet/action-button.js.map +1 -0
  51. package/dist/components/media-wallet/action-modal.cjs +84 -0
  52. package/dist/components/media-wallet/action-modal.cjs.map +1 -0
  53. package/dist/components/media-wallet/action-modal.d.cts +20 -0
  54. package/dist/components/media-wallet/action-modal.d.ts +20 -0
  55. package/dist/components/media-wallet/action-modal.js +56 -0
  56. package/dist/components/media-wallet/action-modal.js.map +1 -0
  57. package/dist/components/media-wallet/activate-card.cjs +72 -0
  58. package/dist/components/media-wallet/activate-card.cjs.map +1 -0
  59. package/dist/components/media-wallet/activate-card.d.cts +7 -0
  60. package/dist/components/media-wallet/activate-card.d.ts +7 -0
  61. package/dist/components/media-wallet/activate-card.js +48 -0
  62. package/dist/components/media-wallet/activate-card.js.map +1 -0
  63. package/dist/components/media-wallet/address-qr.cjs +64 -0
  64. package/dist/components/media-wallet/address-qr.cjs.map +1 -0
  65. package/dist/components/media-wallet/address-qr.d.cts +8 -0
  66. package/dist/components/media-wallet/address-qr.d.ts +8 -0
  67. package/dist/components/media-wallet/address-qr.js +30 -0
  68. package/dist/components/media-wallet/address-qr.js.map +1 -0
  69. package/dist/components/media-wallet/back-button.cjs +41 -0
  70. package/dist/components/media-wallet/back-button.cjs.map +1 -0
  71. package/dist/components/media-wallet/back-button.d.cts +7 -0
  72. package/dist/components/media-wallet/back-button.d.ts +7 -0
  73. package/dist/components/media-wallet/back-button.js +17 -0
  74. package/dist/components/media-wallet/back-button.js.map +1 -0
  75. package/dist/components/media-wallet/copy-icon.cjs +49 -0
  76. package/dist/components/media-wallet/copy-icon.cjs.map +1 -0
  77. package/dist/components/media-wallet/copy-icon.d.cts +7 -0
  78. package/dist/components/media-wallet/copy-icon.d.ts +7 -0
  79. package/dist/components/media-wallet/copy-icon.js +25 -0
  80. package/dist/components/media-wallet/copy-icon.js.map +1 -0
  81. package/dist/components/media-wallet/currency-sheet.cjs +54 -0
  82. package/dist/components/media-wallet/currency-sheet.cjs.map +1 -0
  83. package/dist/components/media-wallet/currency-sheet.d.cts +12 -0
  84. package/dist/components/media-wallet/currency-sheet.d.ts +12 -0
  85. package/dist/components/media-wallet/currency-sheet.js +30 -0
  86. package/dist/components/media-wallet/currency-sheet.js.map +1 -0
  87. package/dist/components/media-wallet/media-wallet-activity.cjs +223 -0
  88. package/dist/components/media-wallet/media-wallet-activity.cjs.map +1 -0
  89. package/dist/components/media-wallet/media-wallet-activity.d.cts +12 -0
  90. package/dist/components/media-wallet/media-wallet-activity.d.ts +12 -0
  91. package/dist/components/media-wallet/media-wallet-activity.js +189 -0
  92. package/dist/components/media-wallet/media-wallet-activity.js.map +1 -0
  93. package/dist/components/media-wallet/media-wallet-header.cjs +97 -0
  94. package/dist/components/media-wallet/media-wallet-header.cjs.map +1 -0
  95. package/dist/components/media-wallet/media-wallet-header.d.cts +8 -0
  96. package/dist/components/media-wallet/media-wallet-header.d.ts +8 -0
  97. package/dist/components/media-wallet/media-wallet-header.js +63 -0
  98. package/dist/components/media-wallet/media-wallet-header.js.map +1 -0
  99. package/dist/components/media-wallet/media-wallet-home.cjs +258 -0
  100. package/dist/components/media-wallet/media-wallet-home.cjs.map +1 -0
  101. package/dist/components/media-wallet/media-wallet-home.d.cts +14 -0
  102. package/dist/components/media-wallet/media-wallet-home.d.ts +14 -0
  103. package/dist/components/media-wallet/media-wallet-home.js +224 -0
  104. package/dist/components/media-wallet/media-wallet-home.js.map +1 -0
  105. package/dist/components/media-wallet/media-wallet-overlay.cjs +137 -0
  106. package/dist/components/media-wallet/media-wallet-overlay.cjs.map +1 -0
  107. package/dist/components/media-wallet/media-wallet-overlay.d.cts +14 -0
  108. package/dist/components/media-wallet/media-wallet-overlay.d.ts +14 -0
  109. package/dist/components/media-wallet/media-wallet-overlay.js +102 -0
  110. package/dist/components/media-wallet/media-wallet-overlay.js.map +1 -0
  111. package/dist/components/media-wallet/media-wallet-send.cjs +313 -0
  112. package/dist/components/media-wallet/media-wallet-send.cjs.map +1 -0
  113. package/dist/components/media-wallet/media-wallet-send.d.cts +14 -0
  114. package/dist/components/media-wallet/media-wallet-send.d.ts +14 -0
  115. package/dist/components/media-wallet/media-wallet-send.js +289 -0
  116. package/dist/components/media-wallet/media-wallet-send.js.map +1 -0
  117. package/dist/components/media-wallet/media-wallet-token-detail.cjs +164 -0
  118. package/dist/components/media-wallet/media-wallet-token-detail.cjs.map +1 -0
  119. package/dist/components/media-wallet/media-wallet-token-detail.d.cts +13 -0
  120. package/dist/components/media-wallet/media-wallet-token-detail.d.ts +13 -0
  121. package/dist/components/media-wallet/media-wallet-token-detail.js +140 -0
  122. package/dist/components/media-wallet/media-wallet-token-detail.js.map +1 -0
  123. package/dist/components/media-wallet/media-wallet.cjs +51 -0
  124. package/dist/components/media-wallet/media-wallet.cjs.map +1 -0
  125. package/dist/components/media-wallet/media-wallet.d.cts +13 -0
  126. package/dist/components/media-wallet/media-wallet.d.ts +13 -0
  127. package/dist/components/media-wallet/media-wallet.js +27 -0
  128. package/dist/components/media-wallet/media-wallet.js.map +1 -0
  129. package/dist/components/media-wallet/nft-strip.cjs +85 -0
  130. package/dist/components/media-wallet/nft-strip.cjs.map +1 -0
  131. package/dist/components/media-wallet/nft-strip.d.cts +12 -0
  132. package/dist/components/media-wallet/nft-strip.d.ts +12 -0
  133. package/dist/components/media-wallet/nft-strip.js +51 -0
  134. package/dist/components/media-wallet/nft-strip.js.map +1 -0
  135. package/dist/components/media-wallet/quick-action.cjs +59 -0
  136. package/dist/components/media-wallet/quick-action.cjs.map +1 -0
  137. package/dist/components/media-wallet/quick-action.d.cts +12 -0
  138. package/dist/components/media-wallet/quick-action.d.ts +12 -0
  139. package/dist/components/media-wallet/quick-action.js +35 -0
  140. package/dist/components/media-wallet/quick-action.js.map +1 -0
  141. package/dist/components/media-wallet/receive-card.cjs +86 -0
  142. package/dist/components/media-wallet/receive-card.cjs.map +1 -0
  143. package/dist/components/media-wallet/receive-card.d.cts +7 -0
  144. package/dist/components/media-wallet/receive-card.d.ts +7 -0
  145. package/dist/components/media-wallet/receive-card.js +52 -0
  146. package/dist/components/media-wallet/receive-card.js.map +1 -0
  147. package/dist/components/media-wallet/section-header.cjs +32 -0
  148. package/dist/components/media-wallet/section-header.cjs.map +1 -0
  149. package/dist/components/media-wallet/section-header.d.cts +7 -0
  150. package/dist/components/media-wallet/section-header.d.ts +7 -0
  151. package/dist/components/media-wallet/section-header.js +8 -0
  152. package/dist/components/media-wallet/section-header.js.map +1 -0
  153. package/dist/components/media-wallet/success-dialog.cjs +75 -0
  154. package/dist/components/media-wallet/success-dialog.cjs.map +1 -0
  155. package/dist/components/media-wallet/success-dialog.d.cts +11 -0
  156. package/dist/components/media-wallet/success-dialog.d.ts +11 -0
  157. package/dist/components/media-wallet/success-dialog.js +51 -0
  158. package/dist/components/media-wallet/success-dialog.js.map +1 -0
  159. package/dist/components/media-wallet/types.cjs +37 -0
  160. package/dist/components/media-wallet/types.cjs.map +1 -0
  161. package/dist/components/media-wallet/types.d.cts +66 -0
  162. package/dist/components/media-wallet/types.d.ts +66 -0
  163. package/dist/components/media-wallet/types.js +12 -0
  164. package/dist/components/media-wallet/types.js.map +1 -0
  165. package/dist/components/media-wallet/wallet-activity-icon.cjs +69 -0
  166. package/dist/components/media-wallet/wallet-activity-icon.cjs.map +1 -0
  167. package/dist/components/media-wallet/wallet-activity-icon.d.cts +8 -0
  168. package/dist/components/media-wallet/wallet-activity-icon.d.ts +8 -0
  169. package/dist/components/media-wallet/wallet-activity-icon.js +45 -0
  170. package/dist/components/media-wallet/wallet-activity-icon.js.map +1 -0
  171. package/dist/index.cjs +13 -3
  172. package/dist/index.cjs.map +1 -1
  173. package/dist/index.d.cts +6 -2
  174. package/dist/index.d.ts +6 -2
  175. package/dist/index.js +8 -2
  176. package/dist/index.js.map +1 -1
  177. package/dist/utils/drop/sale.cjs +3 -3
  178. package/dist/utils/drop/sale.cjs.map +1 -1
  179. package/dist/utils/drop/sale.d.cts +2 -2
  180. package/dist/utils/drop/sale.d.ts +2 -2
  181. package/dist/utils/drop/sale.js +4 -4
  182. package/dist/utils/drop/sale.js.map +1 -1
  183. package/dist/utils/drop/view.cjs +2 -2
  184. package/dist/utils/drop/view.cjs.map +1 -1
  185. package/dist/utils/drop/view.d.cts +2 -2
  186. package/dist/utils/drop/view.d.ts +2 -2
  187. package/dist/utils/drop/view.js +2 -2
  188. package/dist/utils/drop/view.js.map +1 -1
  189. package/dist/utils/media-wallet/activity-feed.cjs +35 -0
  190. package/dist/utils/media-wallet/activity-feed.cjs.map +1 -0
  191. package/dist/utils/media-wallet/activity-feed.d.cts +14 -0
  192. package/dist/utils/media-wallet/activity-feed.d.ts +14 -0
  193. package/dist/utils/media-wallet/activity-feed.js +11 -0
  194. package/dist/utils/media-wallet/activity-feed.js.map +1 -0
  195. package/dist/utils/media-wallet/confetti.cjs +51 -0
  196. package/dist/utils/media-wallet/confetti.cjs.map +1 -0
  197. package/dist/utils/media-wallet/confetti.d.cts +3 -0
  198. package/dist/utils/media-wallet/confetti.d.ts +3 -0
  199. package/dist/utils/media-wallet/confetti.js +17 -0
  200. package/dist/utils/media-wallet/confetti.js.map +1 -0
  201. package/dist/utils/media-wallet/nft-items.cjs +38 -0
  202. package/dist/utils/media-wallet/nft-items.cjs.map +1 -0
  203. package/dist/utils/media-wallet/nft-items.d.cts +13 -0
  204. package/dist/utils/media-wallet/nft-items.d.ts +13 -0
  205. package/dist/utils/media-wallet/nft-items.js +14 -0
  206. package/dist/utils/media-wallet/nft-items.js.map +1 -0
  207. package/dist/utils/media-wallet/run-intent-calls.cjs +32 -0
  208. package/dist/utils/media-wallet/run-intent-calls.cjs.map +1 -0
  209. package/dist/utils/media-wallet/run-intent-calls.d.cts +16 -0
  210. package/dist/utils/media-wallet/run-intent-calls.d.ts +16 -0
  211. package/dist/utils/media-wallet/run-intent-calls.js +8 -0
  212. package/dist/utils/media-wallet/run-intent-calls.js.map +1 -0
  213. package/dist/utils/media-wallet/use-erc20-balance.cjs +75 -0
  214. package/dist/utils/media-wallet/use-erc20-balance.cjs.map +1 -0
  215. package/dist/utils/media-wallet/use-erc20-balance.d.cts +15 -0
  216. package/dist/utils/media-wallet/use-erc20-balance.d.ts +15 -0
  217. package/dist/utils/media-wallet/use-erc20-balance.js +40 -0
  218. package/dist/utils/media-wallet/use-erc20-balance.js.map +1 -0
  219. package/dist/utils/media-wallet/use-tokens-by-owner.cjs +52 -0
  220. package/dist/utils/media-wallet/use-tokens-by-owner.cjs.map +1 -0
  221. package/dist/utils/media-wallet/use-tokens-by-owner.d.cts +10 -0
  222. package/dist/utils/media-wallet/use-tokens-by-owner.d.ts +10 -0
  223. package/dist/utils/media-wallet/use-tokens-by-owner.js +18 -0
  224. package/dist/utils/media-wallet/use-tokens-by-owner.js.map +1 -0
  225. package/dist/utils/media-wallet/wallet-activity.cjs +83 -0
  226. package/dist/utils/media-wallet/wallet-activity.cjs.map +1 -0
  227. package/dist/utils/media-wallet/wallet-activity.d.cts +7 -0
  228. package/dist/utils/media-wallet/wallet-activity.d.ts +7 -0
  229. package/dist/utils/media-wallet/wallet-activity.js +57 -0
  230. package/dist/utils/media-wallet/wallet-activity.js.map +1 -0
  231. package/dist/utils/media-wallet/wallet-format.cjs +59 -0
  232. package/dist/utils/media-wallet/wallet-format.cjs.map +1 -0
  233. package/dist/utils/media-wallet/wallet-format.d.cts +9 -0
  234. package/dist/utils/media-wallet/wallet-format.d.ts +9 -0
  235. package/dist/utils/media-wallet/wallet-format.js +29 -0
  236. package/dist/utils/media-wallet/wallet-format.js.map +1 -0
  237. package/dist/utils/media-wallet/wallet-tokens.cjs +39 -0
  238. package/dist/utils/media-wallet/wallet-tokens.cjs.map +1 -0
  239. package/dist/utils/media-wallet/wallet-tokens.d.cts +10 -0
  240. package/dist/utils/media-wallet/wallet-tokens.d.ts +10 -0
  241. package/dist/utils/media-wallet/wallet-tokens.js +15 -0
  242. package/dist/utils/media-wallet/wallet-tokens.js.map +1 -0
  243. package/dist/utils/use-drops.cjs +7 -0
  244. package/dist/utils/use-drops.cjs.map +1 -1
  245. package/dist/utils/use-drops.d.cts +3 -1
  246. package/dist/utils/use-drops.d.ts +3 -1
  247. package/dist/utils/use-drops.js +6 -0
  248. package/dist/utils/use-drops.js.map +1 -1
  249. package/package.json +11 -3
  250. package/dist/components/drop-status-display.cjs.map +0 -1
  251. package/dist/components/drop-status-display.js.map +0 -1
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var confetti_exports = {};
30
+ __export(confetti_exports, {
31
+ fireConfetti: () => fireConfetti
32
+ });
33
+ module.exports = __toCommonJS(confetti_exports);
34
+ var import_canvas_confetti = __toESM(require("canvas-confetti"), 1);
35
+ function fireConfetti() {
36
+ if (typeof window !== "undefined" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches) return;
37
+ const defaults = { zIndex: 9999, colors: ["#3b7bff", "#8a5cf6", "#f6608f", "#fb8b46", "#5b4ce6"] };
38
+ (0, import_canvas_confetti.default)({ ...defaults, particleCount: 80, spread: 70, origin: { y: 0.6 } });
39
+ setTimeout(() => {
40
+ (0, import_canvas_confetti.default)({ ...defaults, particleCount: 60, angle: 60, spread: 55, origin: { x: 0, y: 0.65 } });
41
+ (0, import_canvas_confetti.default)({ ...defaults, particleCount: 60, angle: 120, spread: 55, origin: { x: 1, y: 0.65 } });
42
+ }, 150);
43
+ setTimeout(() => {
44
+ (0, import_canvas_confetti.default)({ ...defaults, particleCount: 40, spread: 100, decay: 0.91, scalar: 0.8, origin: { y: 0.55 } });
45
+ }, 350);
46
+ }
47
+ // Annotate the CommonJS export names for ESM import in node:
48
+ 0 && (module.exports = {
49
+ fireConfetti
50
+ });
51
+ //# sourceMappingURL=confetti.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/media-wallet/confetti.ts"],"sourcesContent":["import confetti from \"canvas-confetti\";\n\nexport function fireConfetti() {\n if (typeof window !== \"undefined\" && window.matchMedia?.(\"(prefers-reduced-motion: reduce)\").matches) return;\n\n const defaults = { zIndex: 9999, colors: [\"#3b7bff\", \"#8a5cf6\", \"#f6608f\", \"#fb8b46\", \"#5b4ce6\"] };\n\n confetti({ ...defaults, particleCount: 80, spread: 70, origin: { y: 0.6 } });\n\n setTimeout(() => {\n confetti({ ...defaults, particleCount: 60, angle: 60, spread: 55, origin: { x: 0, y: 0.65 } });\n confetti({ ...defaults, particleCount: 60, angle: 120, spread: 55, origin: { x: 1, y: 0.65 } });\n }, 150);\n\n setTimeout(() => {\n confetti({ ...defaults, particleCount: 40, spread: 100, decay: 0.91, scalar: 0.8, origin: { y: 0.55 } });\n }, 350);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6BAAqB;AAEd,SAAS,eAAe;AAC7B,MAAI,OAAO,WAAW,eAAe,OAAO,aAAa,kCAAkC,EAAE,QAAS;AAEtG,QAAM,WAAW,EAAE,QAAQ,MAAM,QAAQ,CAAC,WAAW,WAAW,WAAW,WAAW,SAAS,EAAE;AAEjG,6BAAAA,SAAS,EAAE,GAAG,UAAU,eAAe,IAAI,QAAQ,IAAI,QAAQ,EAAE,GAAG,IAAI,EAAE,CAAC;AAE3E,aAAW,MAAM;AACf,+BAAAA,SAAS,EAAE,GAAG,UAAU,eAAe,IAAI,OAAO,IAAI,QAAQ,IAAI,QAAQ,EAAE,GAAG,GAAG,GAAG,KAAK,EAAE,CAAC;AAC7F,+BAAAA,SAAS,EAAE,GAAG,UAAU,eAAe,IAAI,OAAO,KAAK,QAAQ,IAAI,QAAQ,EAAE,GAAG,GAAG,GAAG,KAAK,EAAE,CAAC;AAAA,EAChG,GAAG,GAAG;AAEN,aAAW,MAAM;AACf,+BAAAA,SAAS,EAAE,GAAG,UAAU,eAAe,IAAI,QAAQ,KAAK,OAAO,MAAM,QAAQ,KAAK,QAAQ,EAAE,GAAG,KAAK,EAAE,CAAC;AAAA,EACzG,GAAG,GAAG;AACR;","names":["confetti"]}
@@ -0,0 +1,3 @@
1
+ declare function fireConfetti(): void;
2
+
3
+ export { fireConfetti };
@@ -0,0 +1,3 @@
1
+ declare function fireConfetti(): void;
2
+
3
+ export { fireConfetti };
@@ -0,0 +1,17 @@
1
+ import confetti from "canvas-confetti";
2
+ function fireConfetti() {
3
+ if (typeof window !== "undefined" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches) return;
4
+ const defaults = { zIndex: 9999, colors: ["#3b7bff", "#8a5cf6", "#f6608f", "#fb8b46", "#5b4ce6"] };
5
+ confetti({ ...defaults, particleCount: 80, spread: 70, origin: { y: 0.6 } });
6
+ setTimeout(() => {
7
+ confetti({ ...defaults, particleCount: 60, angle: 60, spread: 55, origin: { x: 0, y: 0.65 } });
8
+ confetti({ ...defaults, particleCount: 60, angle: 120, spread: 55, origin: { x: 1, y: 0.65 } });
9
+ }, 150);
10
+ setTimeout(() => {
11
+ confetti({ ...defaults, particleCount: 40, spread: 100, decay: 0.91, scalar: 0.8, origin: { y: 0.55 } });
12
+ }, 350);
13
+ }
14
+ export {
15
+ fireConfetti
16
+ };
17
+ //# sourceMappingURL=confetti.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/media-wallet/confetti.ts"],"sourcesContent":["import confetti from \"canvas-confetti\";\n\nexport function fireConfetti() {\n if (typeof window !== \"undefined\" && window.matchMedia?.(\"(prefers-reduced-motion: reduce)\").matches) return;\n\n const defaults = { zIndex: 9999, colors: [\"#3b7bff\", \"#8a5cf6\", \"#f6608f\", \"#fb8b46\", \"#5b4ce6\"] };\n\n confetti({ ...defaults, particleCount: 80, spread: 70, origin: { y: 0.6 } });\n\n setTimeout(() => {\n confetti({ ...defaults, particleCount: 60, angle: 60, spread: 55, origin: { x: 0, y: 0.65 } });\n confetti({ ...defaults, particleCount: 60, angle: 120, spread: 55, origin: { x: 1, y: 0.65 } });\n }, 150);\n\n setTimeout(() => {\n confetti({ ...defaults, particleCount: 40, spread: 100, decay: 0.91, scalar: 0.8, origin: { y: 0.55 } });\n }, 350);\n}\n"],"mappings":"AAAA,OAAO,cAAc;AAEd,SAAS,eAAe;AAC7B,MAAI,OAAO,WAAW,eAAe,OAAO,aAAa,kCAAkC,EAAE,QAAS;AAEtG,QAAM,WAAW,EAAE,QAAQ,MAAM,QAAQ,CAAC,WAAW,WAAW,WAAW,WAAW,SAAS,EAAE;AAEjG,WAAS,EAAE,GAAG,UAAU,eAAe,IAAI,QAAQ,IAAI,QAAQ,EAAE,GAAG,IAAI,EAAE,CAAC;AAE3E,aAAW,MAAM;AACf,aAAS,EAAE,GAAG,UAAU,eAAe,IAAI,OAAO,IAAI,QAAQ,IAAI,QAAQ,EAAE,GAAG,GAAG,GAAG,KAAK,EAAE,CAAC;AAC7F,aAAS,EAAE,GAAG,UAAU,eAAe,IAAI,OAAO,KAAK,QAAQ,IAAI,QAAQ,EAAE,GAAG,GAAG,GAAG,KAAK,EAAE,CAAC;AAAA,EAChG,GAAG,GAAG;AAEN,aAAW,MAAM;AACf,aAAS,EAAE,GAAG,UAAU,eAAe,IAAI,QAAQ,KAAK,OAAO,MAAM,QAAQ,KAAK,QAAQ,EAAE,GAAG,KAAK,EAAE,CAAC;AAAA,EACzG,GAAG,GAAG;AACR;","names":[]}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var nft_items_exports = {};
20
+ __export(nft_items_exports, {
21
+ pickNftItems: () => pickNftItems
22
+ });
23
+ module.exports = __toCommonJS(nft_items_exports);
24
+ function pickNftItems(tokens, limit) {
25
+ return tokens.slice(0, limit).map((token) => ({
26
+ key: `${token.contractAddress}-${token.tokenId}`,
27
+ href: `/asset/starknet/${token.contractAddress}/${token.tokenId}`,
28
+ name: token.metadata.name ?? `#${token.tokenId}`,
29
+ image: token.metadata.image,
30
+ ipType: token.metadata.ipType,
31
+ fallbackId: token.tokenId
32
+ }));
33
+ }
34
+ // Annotate the CommonJS export names for ESM import in node:
35
+ 0 && (module.exports = {
36
+ pickNftItems
37
+ });
38
+ //# sourceMappingURL=nft-items.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/media-wallet/nft-items.ts"],"sourcesContent":["import type { ApiToken } from \"@medialane/sdk\";\n\nexport interface NftItem {\n key: string;\n href: string;\n name: string;\n image: string | null;\n ipType: string | null;\n fallbackId: string;\n}\n\nexport function pickNftItems(tokens: ApiToken[], limit: number): NftItem[] {\n return tokens.slice(0, limit).map((token) => ({\n key: `${token.contractAddress}-${token.tokenId}`,\n href: `/asset/starknet/${token.contractAddress}/${token.tokenId}`,\n name: token.metadata.name ?? `#${token.tokenId}`,\n image: token.metadata.image,\n ipType: token.metadata.ipType,\n fallbackId: token.tokenId,\n }));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAWO,SAAS,aAAa,QAAoB,OAA0B;AACzE,SAAO,OAAO,MAAM,GAAG,KAAK,EAAE,IAAI,CAAC,WAAW;AAAA,IAC5C,KAAK,GAAG,MAAM,eAAe,IAAI,MAAM,OAAO;AAAA,IAC9C,MAAM,mBAAmB,MAAM,eAAe,IAAI,MAAM,OAAO;AAAA,IAC/D,MAAM,MAAM,SAAS,QAAQ,IAAI,MAAM,OAAO;AAAA,IAC9C,OAAO,MAAM,SAAS;AAAA,IACtB,QAAQ,MAAM,SAAS;AAAA,IACvB,YAAY,MAAM;AAAA,EACpB,EAAE;AACJ;","names":[]}
@@ -0,0 +1,13 @@
1
+ import { ApiToken } from '@medialane/sdk';
2
+
3
+ interface NftItem {
4
+ key: string;
5
+ href: string;
6
+ name: string;
7
+ image: string | null;
8
+ ipType: string | null;
9
+ fallbackId: string;
10
+ }
11
+ declare function pickNftItems(tokens: ApiToken[], limit: number): NftItem[];
12
+
13
+ export { type NftItem, pickNftItems };
@@ -0,0 +1,13 @@
1
+ import { ApiToken } from '@medialane/sdk';
2
+
3
+ interface NftItem {
4
+ key: string;
5
+ href: string;
6
+ name: string;
7
+ image: string | null;
8
+ ipType: string | null;
9
+ fallbackId: string;
10
+ }
11
+ declare function pickNftItems(tokens: ApiToken[], limit: number): NftItem[];
12
+
13
+ export { type NftItem, pickNftItems };
@@ -0,0 +1,14 @@
1
+ function pickNftItems(tokens, limit) {
2
+ return tokens.slice(0, limit).map((token) => ({
3
+ key: `${token.contractAddress}-${token.tokenId}`,
4
+ href: `/asset/starknet/${token.contractAddress}/${token.tokenId}`,
5
+ name: token.metadata.name ?? `#${token.tokenId}`,
6
+ image: token.metadata.image,
7
+ ipType: token.metadata.ipType,
8
+ fallbackId: token.tokenId
9
+ }));
10
+ }
11
+ export {
12
+ pickNftItems
13
+ };
14
+ //# sourceMappingURL=nft-items.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/media-wallet/nft-items.ts"],"sourcesContent":["import type { ApiToken } from \"@medialane/sdk\";\n\nexport interface NftItem {\n key: string;\n href: string;\n name: string;\n image: string | null;\n ipType: string | null;\n fallbackId: string;\n}\n\nexport function pickNftItems(tokens: ApiToken[], limit: number): NftItem[] {\n return tokens.slice(0, limit).map((token) => ({\n key: `${token.contractAddress}-${token.tokenId}`,\n href: `/asset/starknet/${token.contractAddress}/${token.tokenId}`,\n name: token.metadata.name ?? `#${token.tokenId}`,\n image: token.metadata.image,\n ipType: token.metadata.ipType,\n fallbackId: token.tokenId,\n }));\n}\n"],"mappings":"AAWO,SAAS,aAAa,QAAoB,OAA0B;AACzE,SAAO,OAAO,MAAM,GAAG,KAAK,EAAE,IAAI,CAAC,WAAW;AAAA,IAC5C,KAAK,GAAG,MAAM,eAAe,IAAI,MAAM,OAAO;AAAA,IAC9C,MAAM,mBAAmB,MAAM,eAAe,IAAI,MAAM,OAAO;AAAA,IAC/D,MAAM,MAAM,SAAS,QAAQ,IAAI,MAAM,OAAO;AAAA,IAC9C,OAAO,MAAM,SAAS;AAAA,IACtB,QAAQ,MAAM,SAAS;AAAA,IACvB,YAAY,MAAM;AAAA,EACpB,EAAE;AACJ;","names":[]}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var run_intent_calls_exports = {};
20
+ __export(run_intent_calls_exports, {
21
+ runIntentCalls: () => runIntentCalls
22
+ });
23
+ module.exports = __toCommonJS(run_intent_calls_exports);
24
+ async function runIntentCalls(signer, create) {
25
+ const intent = (await create()).data;
26
+ return signer.execute(intent.calls, { intentIds: [intent.id] });
27
+ }
28
+ // Annotate the CommonJS export names for ESM import in node:
29
+ 0 && (module.exports = {
30
+ runIntentCalls
31
+ });
32
+ //# sourceMappingURL=run-intent-calls.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/media-wallet/run-intent-calls.ts"],"sourcesContent":["import type { Call } from \"starknet\";\nimport type { ApiIntentCreated } from \"@medialane/sdk\";\n\nexport async function runIntentCalls(\n signer: { execute(calls: Call[], opts?: { intentIds?: string[] }): Promise<{ txHash: string }> },\n create: () => Promise<{ data: ApiIntentCreated }>,\n): Promise<{ txHash: string }> {\n const intent = (await create()).data as { id: string; calls: Call[] };\n return signer.execute(intent.calls, { intentIds: [intent.id] });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,eAAsB,eACpB,QACA,QAC6B;AAC7B,QAAM,UAAU,MAAM,OAAO,GAAG;AAChC,SAAO,OAAO,QAAQ,OAAO,OAAO,EAAE,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC;AAChE;","names":[]}
@@ -0,0 +1,16 @@
1
+ import { Call } from 'starknet';
2
+ import { ApiIntentCreated } from '@medialane/sdk';
3
+
4
+ declare function runIntentCalls(signer: {
5
+ execute(calls: Call[], opts?: {
6
+ intentIds?: string[];
7
+ }): Promise<{
8
+ txHash: string;
9
+ }>;
10
+ }, create: () => Promise<{
11
+ data: ApiIntentCreated;
12
+ }>): Promise<{
13
+ txHash: string;
14
+ }>;
15
+
16
+ export { runIntentCalls };
@@ -0,0 +1,16 @@
1
+ import { Call } from 'starknet';
2
+ import { ApiIntentCreated } from '@medialane/sdk';
3
+
4
+ declare function runIntentCalls(signer: {
5
+ execute(calls: Call[], opts?: {
6
+ intentIds?: string[];
7
+ }): Promise<{
8
+ txHash: string;
9
+ }>;
10
+ }, create: () => Promise<{
11
+ data: ApiIntentCreated;
12
+ }>): Promise<{
13
+ txHash: string;
14
+ }>;
15
+
16
+ export { runIntentCalls };
@@ -0,0 +1,8 @@
1
+ async function runIntentCalls(signer, create) {
2
+ const intent = (await create()).data;
3
+ return signer.execute(intent.calls, { intentIds: [intent.id] });
4
+ }
5
+ export {
6
+ runIntentCalls
7
+ };
8
+ //# sourceMappingURL=run-intent-calls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/media-wallet/run-intent-calls.ts"],"sourcesContent":["import type { Call } from \"starknet\";\nimport type { ApiIntentCreated } from \"@medialane/sdk\";\n\nexport async function runIntentCalls(\n signer: { execute(calls: Call[], opts?: { intentIds?: string[] }): Promise<{ txHash: string }> },\n create: () => Promise<{ data: ApiIntentCreated }>,\n): Promise<{ txHash: string }> {\n const intent = (await create()).data as { id: string; calls: Call[] };\n return signer.execute(intent.calls, { intentIds: [intent.id] });\n}\n"],"mappings":"AAGA,eAAsB,eACpB,QACA,QAC6B;AAC7B,QAAM,UAAU,MAAM,OAAO,GAAG;AAChC,SAAO,OAAO,QAAQ,OAAO,OAAO,EAAE,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC;AAChE;","names":[]}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ "use client";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var use_erc20_balance_exports = {};
31
+ __export(use_erc20_balance_exports, {
32
+ useErc20Balance: () => useErc20Balance,
33
+ useTokenBalance: () => useTokenBalance
34
+ });
35
+ module.exports = __toCommonJS(use_erc20_balance_exports);
36
+ var import_swr = __toESM(require("swr"), 1);
37
+ var import_sdk = require("@medialane/sdk");
38
+ async function fetchErc20Balance(provider, tokenAddress, holderAddress) {
39
+ const result = await provider.callContract(
40
+ {
41
+ contractAddress: tokenAddress,
42
+ entrypoint: "balanceOf",
43
+ calldata: [holderAddress]
44
+ },
45
+ "latest"
46
+ );
47
+ const low = BigInt(result[0]);
48
+ const high = BigInt(result[1]);
49
+ return low + (high << 128n);
50
+ }
51
+ function useErc20Balance(provider, tokenAddress, holderAddress) {
52
+ const { data, error, isLoading } = (0, import_swr.default)(
53
+ tokenAddress && holderAddress ? ["erc20-balance", tokenAddress, holderAddress] : null,
54
+ ([, addr, holder]) => fetchErc20Balance(provider, addr, holder),
55
+ {
56
+ refreshInterval: 3e4,
57
+ revalidateOnFocus: false,
58
+ shouldRetryOnError: false,
59
+ onError: () => {
60
+ }
61
+ }
62
+ );
63
+ return { rawBalance: data ?? null, isLoading, error };
64
+ }
65
+ function useTokenBalance(provider, symbol, holderAddress) {
66
+ const token = symbol ? (0, import_sdk.getListableTokens)().find((t) => t.symbol === symbol) ?? null : null;
67
+ const { rawBalance, isLoading, error } = useErc20Balance(provider, token?.address ?? null, holderAddress);
68
+ return { rawBalance, isLoading, error, decimals: token?.decimals ?? 18 };
69
+ }
70
+ // Annotate the CommonJS export names for ESM import in node:
71
+ 0 && (module.exports = {
72
+ useErc20Balance,
73
+ useTokenBalance
74
+ });
75
+ //# sourceMappingURL=use-erc20-balance.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/media-wallet/use-erc20-balance.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport type { ProviderInterface } from \"starknet\";\nimport { getListableTokens } from \"@medialane/sdk\";\n\nasync function fetchErc20Balance(provider: ProviderInterface, tokenAddress: string, holderAddress: string): Promise<bigint> {\n const result = await provider.callContract(\n {\n contractAddress: tokenAddress,\n entrypoint: \"balanceOf\",\n calldata: [holderAddress],\n },\n \"latest\"\n );\n\n const low = BigInt(result[0]);\n const high = BigInt(result[1]);\n return low + (high << 128n);\n}\n\nexport function useErc20Balance(provider: ProviderInterface, tokenAddress: string | null, holderAddress: string | null) {\n const { data, error, isLoading } = useSWR(\n tokenAddress && holderAddress ? [\"erc20-balance\", tokenAddress, holderAddress] : null,\n ([, addr, holder]) => fetchErc20Balance(provider, addr, holder),\n {\n refreshInterval: 30_000,\n revalidateOnFocus: false,\n shouldRetryOnError: false,\n onError: () => {},\n }\n );\n return { rawBalance: data ?? null, isLoading, error };\n}\n\nexport function useTokenBalance(provider: ProviderInterface, symbol: string | null, holderAddress: string | null) {\n const token = symbol ? getListableTokens().find((t) => t.symbol === symbol) ?? null : null;\n const { rawBalance, isLoading, error } = useErc20Balance(provider, token?.address ?? null, holderAddress);\n return { rawBalance, isLoading, error, decimals: token?.decimals ?? 18 };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAAmB;AAEnB,iBAAkC;AAElC,eAAe,kBAAkB,UAA6B,cAAsB,eAAwC;AAC1H,QAAM,SAAS,MAAM,SAAS;AAAA,IAC5B;AAAA,MACE,iBAAiB;AAAA,MACjB,YAAY;AAAA,MACZ,UAAU,CAAC,aAAa;AAAA,IAC1B;AAAA,IACA;AAAA,EACF;AAEA,QAAM,MAAM,OAAO,OAAO,CAAC,CAAC;AAC5B,QAAM,OAAO,OAAO,OAAO,CAAC,CAAC;AAC7B,SAAO,OAAO,QAAQ;AACxB;AAEO,SAAS,gBAAgB,UAA6B,cAA6B,eAA8B;AACtH,QAAM,EAAE,MAAM,OAAO,UAAU,QAAI,WAAAA;AAAA,IACjC,gBAAgB,gBAAgB,CAAC,iBAAiB,cAAc,aAAa,IAAI;AAAA,IACjF,CAAC,CAAC,EAAE,MAAM,MAAM,MAAM,kBAAkB,UAAU,MAAM,MAAM;AAAA,IAC9D;AAAA,MACE,iBAAiB;AAAA,MACjB,mBAAmB;AAAA,MACnB,oBAAoB;AAAA,MACpB,SAAS,MAAM;AAAA,MAAC;AAAA,IAClB;AAAA,EACF;AACA,SAAO,EAAE,YAAY,QAAQ,MAAM,WAAW,MAAM;AACtD;AAEO,SAAS,gBAAgB,UAA6B,QAAuB,eAA8B;AAChH,QAAM,QAAQ,aAAS,8BAAkB,EAAE,KAAK,CAAC,MAAM,EAAE,WAAW,MAAM,KAAK,OAAO;AACtF,QAAM,EAAE,YAAY,WAAW,MAAM,IAAI,gBAAgB,UAAU,OAAO,WAAW,MAAM,aAAa;AACxG,SAAO,EAAE,YAAY,WAAW,OAAO,UAAU,OAAO,YAAY,GAAG;AACzE;","names":["useSWR"]}
@@ -0,0 +1,15 @@
1
+ import { ProviderInterface } from 'starknet';
2
+
3
+ declare function useErc20Balance(provider: ProviderInterface, tokenAddress: string | null, holderAddress: string | null): {
4
+ rawBalance: bigint | null;
5
+ isLoading: boolean;
6
+ error: any;
7
+ };
8
+ declare function useTokenBalance(provider: ProviderInterface, symbol: string | null, holderAddress: string | null): {
9
+ rawBalance: bigint | null;
10
+ isLoading: boolean;
11
+ error: any;
12
+ decimals: 6 | 18 | 8;
13
+ };
14
+
15
+ export { useErc20Balance, useTokenBalance };
@@ -0,0 +1,15 @@
1
+ import { ProviderInterface } from 'starknet';
2
+
3
+ declare function useErc20Balance(provider: ProviderInterface, tokenAddress: string | null, holderAddress: string | null): {
4
+ rawBalance: bigint | null;
5
+ isLoading: boolean;
6
+ error: any;
7
+ };
8
+ declare function useTokenBalance(provider: ProviderInterface, symbol: string | null, holderAddress: string | null): {
9
+ rawBalance: bigint | null;
10
+ isLoading: boolean;
11
+ error: any;
12
+ decimals: 6 | 18 | 8;
13
+ };
14
+
15
+ export { useErc20Balance, useTokenBalance };
@@ -0,0 +1,40 @@
1
+ "use client";
2
+ import useSWR from "swr";
3
+ import { getListableTokens } from "@medialane/sdk";
4
+ async function fetchErc20Balance(provider, tokenAddress, holderAddress) {
5
+ const result = await provider.callContract(
6
+ {
7
+ contractAddress: tokenAddress,
8
+ entrypoint: "balanceOf",
9
+ calldata: [holderAddress]
10
+ },
11
+ "latest"
12
+ );
13
+ const low = BigInt(result[0]);
14
+ const high = BigInt(result[1]);
15
+ return low + (high << 128n);
16
+ }
17
+ function useErc20Balance(provider, tokenAddress, holderAddress) {
18
+ const { data, error, isLoading } = useSWR(
19
+ tokenAddress && holderAddress ? ["erc20-balance", tokenAddress, holderAddress] : null,
20
+ ([, addr, holder]) => fetchErc20Balance(provider, addr, holder),
21
+ {
22
+ refreshInterval: 3e4,
23
+ revalidateOnFocus: false,
24
+ shouldRetryOnError: false,
25
+ onError: () => {
26
+ }
27
+ }
28
+ );
29
+ return { rawBalance: data ?? null, isLoading, error };
30
+ }
31
+ function useTokenBalance(provider, symbol, holderAddress) {
32
+ const token = symbol ? getListableTokens().find((t) => t.symbol === symbol) ?? null : null;
33
+ const { rawBalance, isLoading, error } = useErc20Balance(provider, token?.address ?? null, holderAddress);
34
+ return { rawBalance, isLoading, error, decimals: token?.decimals ?? 18 };
35
+ }
36
+ export {
37
+ useErc20Balance,
38
+ useTokenBalance
39
+ };
40
+ //# sourceMappingURL=use-erc20-balance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/media-wallet/use-erc20-balance.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport type { ProviderInterface } from \"starknet\";\nimport { getListableTokens } from \"@medialane/sdk\";\n\nasync function fetchErc20Balance(provider: ProviderInterface, tokenAddress: string, holderAddress: string): Promise<bigint> {\n const result = await provider.callContract(\n {\n contractAddress: tokenAddress,\n entrypoint: \"balanceOf\",\n calldata: [holderAddress],\n },\n \"latest\"\n );\n\n const low = BigInt(result[0]);\n const high = BigInt(result[1]);\n return low + (high << 128n);\n}\n\nexport function useErc20Balance(provider: ProviderInterface, tokenAddress: string | null, holderAddress: string | null) {\n const { data, error, isLoading } = useSWR(\n tokenAddress && holderAddress ? [\"erc20-balance\", tokenAddress, holderAddress] : null,\n ([, addr, holder]) => fetchErc20Balance(provider, addr, holder),\n {\n refreshInterval: 30_000,\n revalidateOnFocus: false,\n shouldRetryOnError: false,\n onError: () => {},\n }\n );\n return { rawBalance: data ?? null, isLoading, error };\n}\n\nexport function useTokenBalance(provider: ProviderInterface, symbol: string | null, holderAddress: string | null) {\n const token = symbol ? getListableTokens().find((t) => t.symbol === symbol) ?? null : null;\n const { rawBalance, isLoading, error } = useErc20Balance(provider, token?.address ?? null, holderAddress);\n return { rawBalance, isLoading, error, decimals: token?.decimals ?? 18 };\n}\n"],"mappings":";AAEA,OAAO,YAAY;AAEnB,SAAS,yBAAyB;AAElC,eAAe,kBAAkB,UAA6B,cAAsB,eAAwC;AAC1H,QAAM,SAAS,MAAM,SAAS;AAAA,IAC5B;AAAA,MACE,iBAAiB;AAAA,MACjB,YAAY;AAAA,MACZ,UAAU,CAAC,aAAa;AAAA,IAC1B;AAAA,IACA;AAAA,EACF;AAEA,QAAM,MAAM,OAAO,OAAO,CAAC,CAAC;AAC5B,QAAM,OAAO,OAAO,OAAO,CAAC,CAAC;AAC7B,SAAO,OAAO,QAAQ;AACxB;AAEO,SAAS,gBAAgB,UAA6B,cAA6B,eAA8B;AACtH,QAAM,EAAE,MAAM,OAAO,UAAU,IAAI;AAAA,IACjC,gBAAgB,gBAAgB,CAAC,iBAAiB,cAAc,aAAa,IAAI;AAAA,IACjF,CAAC,CAAC,EAAE,MAAM,MAAM,MAAM,kBAAkB,UAAU,MAAM,MAAM;AAAA,IAC9D;AAAA,MACE,iBAAiB;AAAA,MACjB,mBAAmB;AAAA,MACnB,oBAAoB;AAAA,MACpB,SAAS,MAAM;AAAA,MAAC;AAAA,IAClB;AAAA,EACF;AACA,SAAO,EAAE,YAAY,QAAQ,MAAM,WAAW,MAAM;AACtD;AAEO,SAAS,gBAAgB,UAA6B,QAAuB,eAA8B;AAChH,QAAM,QAAQ,SAAS,kBAAkB,EAAE,KAAK,CAAC,MAAM,EAAE,WAAW,MAAM,KAAK,OAAO;AACtF,QAAM,EAAE,YAAY,WAAW,MAAM,IAAI,gBAAgB,UAAU,OAAO,WAAW,MAAM,aAAa;AACxG,SAAO,EAAE,YAAY,WAAW,OAAO,UAAU,OAAO,YAAY,GAAG;AACzE;","names":[]}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ "use client";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var use_tokens_by_owner_exports = {};
31
+ __export(use_tokens_by_owner_exports, {
32
+ useTokensByOwner: () => useTokensByOwner
33
+ });
34
+ module.exports = __toCommonJS(use_tokens_by_owner_exports);
35
+ var import_swr = __toESM(require("swr"), 1);
36
+ var import_query_keys = require("../query-keys.js");
37
+ var import_use_medialane_client = require("../use-medialane-client.js");
38
+ const EMPTY_TOKENS = [];
39
+ function useTokensByOwner(getClient, address, page = 1, limit = 20) {
40
+ const client = (0, import_use_medialane_client.useMedialaneClient)(getClient);
41
+ const { data, error, isLoading } = (0, import_swr.default)(
42
+ address ? import_query_keys.queryKeys.tokensOwned(address, page, limit) : null,
43
+ () => client.api.getTokensByOwner(address, page, limit),
44
+ { revalidateOnFocus: false, refreshInterval: 6e4, revalidateOnMount: true }
45
+ );
46
+ return { tokens: data?.data ?? EMPTY_TOKENS, isLoading, error };
47
+ }
48
+ // Annotate the CommonJS export names for ESM import in node:
49
+ 0 && (module.exports = {
50
+ useTokensByOwner
51
+ });
52
+ //# sourceMappingURL=use-tokens-by-owner.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/media-wallet/use-tokens-by-owner.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport type { ApiToken } from \"@medialane/sdk\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport { queryKeys } from \"../query-keys.js\";\nimport { useMedialaneClient } from \"../use-medialane-client.js\";\n\nconst EMPTY_TOKENS: ApiToken[] = [];\n\nexport function useTokensByOwner(getClient: () => MedialaneClient, address: string | null, page = 1, limit = 20) {\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading } = useSWR(\n address ? queryKeys.tokensOwned(address, page, limit) : null,\n () => client.api.getTokensByOwner(address!, page, limit),\n { revalidateOnFocus: false, refreshInterval: 60_000, revalidateOnMount: true }\n );\n return { tokens: data?.data ?? EMPTY_TOKENS, isLoading, error };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAAmB;AAGnB,wBAA0B;AAC1B,kCAAmC;AAEnC,MAAM,eAA2B,CAAC;AAE3B,SAAS,iBAAiB,WAAkC,SAAwB,OAAO,GAAG,QAAQ,IAAI;AAC/G,QAAM,aAAS,gDAAmB,SAAS;AAC3C,QAAM,EAAE,MAAM,OAAO,UAAU,QAAI,WAAAA;AAAA,IACjC,UAAU,4BAAU,YAAY,SAAS,MAAM,KAAK,IAAI;AAAA,IACxD,MAAM,OAAO,IAAI,iBAAiB,SAAU,MAAM,KAAK;AAAA,IACvD,EAAE,mBAAmB,OAAO,iBAAiB,KAAQ,mBAAmB,KAAK;AAAA,EAC/E;AACA,SAAO,EAAE,QAAQ,MAAM,QAAQ,cAAc,WAAW,MAAM;AAChE;","names":["useSWR"]}
@@ -0,0 +1,10 @@
1
+ import { ApiToken } from '@medialane/sdk';
2
+ import { MedialaneClient } from '@medialane/sdk/starknet';
3
+
4
+ declare function useTokensByOwner(getClient: () => MedialaneClient, address: string | null, page?: number, limit?: number): {
5
+ tokens: ApiToken[];
6
+ isLoading: boolean;
7
+ error: any;
8
+ };
9
+
10
+ export { useTokensByOwner };
@@ -0,0 +1,10 @@
1
+ import { ApiToken } from '@medialane/sdk';
2
+ import { MedialaneClient } from '@medialane/sdk/starknet';
3
+
4
+ declare function useTokensByOwner(getClient: () => MedialaneClient, address: string | null, page?: number, limit?: number): {
5
+ tokens: ApiToken[];
6
+ isLoading: boolean;
7
+ error: any;
8
+ };
9
+
10
+ export { useTokensByOwner };
@@ -0,0 +1,18 @@
1
+ "use client";
2
+ import useSWR from "swr";
3
+ import { queryKeys } from "../query-keys.js";
4
+ import { useMedialaneClient } from "../use-medialane-client.js";
5
+ const EMPTY_TOKENS = [];
6
+ function useTokensByOwner(getClient, address, page = 1, limit = 20) {
7
+ const client = useMedialaneClient(getClient);
8
+ const { data, error, isLoading } = useSWR(
9
+ address ? queryKeys.tokensOwned(address, page, limit) : null,
10
+ () => client.api.getTokensByOwner(address, page, limit),
11
+ { revalidateOnFocus: false, refreshInterval: 6e4, revalidateOnMount: true }
12
+ );
13
+ return { tokens: data?.data ?? EMPTY_TOKENS, isLoading, error };
14
+ }
15
+ export {
16
+ useTokensByOwner
17
+ };
18
+ //# sourceMappingURL=use-tokens-by-owner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/media-wallet/use-tokens-by-owner.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport type { ApiToken } from \"@medialane/sdk\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport { queryKeys } from \"../query-keys.js\";\nimport { useMedialaneClient } from \"../use-medialane-client.js\";\n\nconst EMPTY_TOKENS: ApiToken[] = [];\n\nexport function useTokensByOwner(getClient: () => MedialaneClient, address: string | null, page = 1, limit = 20) {\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading } = useSWR(\n address ? queryKeys.tokensOwned(address, page, limit) : null,\n () => client.api.getTokensByOwner(address!, page, limit),\n { revalidateOnFocus: false, refreshInterval: 60_000, revalidateOnMount: true }\n );\n return { tokens: data?.data ?? EMPTY_TOKENS, isLoading, error };\n}\n"],"mappings":";AAEA,OAAO,YAAY;AAGnB,SAAS,iBAAiB;AAC1B,SAAS,0BAA0B;AAEnC,MAAM,eAA2B,CAAC;AAE3B,SAAS,iBAAiB,WAAkC,SAAwB,OAAO,GAAG,QAAQ,IAAI;AAC/G,QAAM,SAAS,mBAAmB,SAAS;AAC3C,QAAM,EAAE,MAAM,OAAO,UAAU,IAAI;AAAA,IACjC,UAAU,UAAU,YAAY,SAAS,MAAM,KAAK,IAAI;AAAA,IACxD,MAAM,OAAO,IAAI,iBAAiB,SAAU,MAAM,KAAK;AAAA,IACvD,EAAE,mBAAmB,OAAO,iBAAiB,KAAQ,mBAAmB,KAAK;AAAA,EAC/E;AACA,SAAO,EAAE,QAAQ,MAAM,QAAQ,cAAc,WAAW,MAAM;AAChE;","names":[]}
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var wallet_activity_exports = {};
20
+ __export(wallet_activity_exports, {
21
+ walletActivityAmount: () => walletActivityAmount,
22
+ walletActivitySubtitle: () => walletActivitySubtitle,
23
+ walletActivityTitle: () => walletActivityTitle
24
+ });
25
+ module.exports = __toCommonJS(wallet_activity_exports);
26
+ var import_sdk = require("@medialane/sdk");
27
+ var import_wallet_format = require("./wallet-format.js");
28
+ function tokenAmount(tokenAddress, amount) {
29
+ if (!amount) return null;
30
+ const token = tokenAddress ? (0, import_sdk.getTokenByAddress)(tokenAddress) : void 0;
31
+ if (!token) return amount;
32
+ return `${(0, import_wallet_format.fmt)(BigInt(amount), token.decimals)} ${token.symbol}`;
33
+ }
34
+ function walletActivityTitle(a) {
35
+ switch (a.type) {
36
+ case "SEND":
37
+ return "Sent";
38
+ case "RECEIVE":
39
+ return "Received";
40
+ case "SWAP":
41
+ return "Swapped";
42
+ case "DEPLOY":
43
+ return "Account activated";
44
+ case "GUARDIAN_SET":
45
+ return "Guardian added";
46
+ case "GUARDIAN_TRIGGER_ESCAPE":
47
+ return "Recovery started";
48
+ case "GUARDIAN_COMPLETE_ESCAPE":
49
+ return "Recovery completed";
50
+ case "GUARDIAN_CANCEL_ESCAPE":
51
+ return "Recovery canceled";
52
+ default: {
53
+ const exhaustive = a.type;
54
+ throw new Error(`Unhandled WalletActivityType: ${exhaustive}`);
55
+ }
56
+ }
57
+ }
58
+ function walletActivitySubtitle(a) {
59
+ switch (a.type) {
60
+ case "SEND":
61
+ return a.counterparty ? `to ${(0, import_wallet_format.short)(a.counterparty)}` : null;
62
+ case "RECEIVE":
63
+ return a.counterparty ? `from ${(0, import_wallet_format.short)(a.counterparty)}` : null;
64
+ case "SWAP": {
65
+ const from = tokenAmount(a.tokenInAddress, a.amountIn);
66
+ const to = tokenAmount(a.tokenOutAddress, a.amountOut);
67
+ return from && to ? `${from} \u2192 ${to}` : null;
68
+ }
69
+ default:
70
+ return null;
71
+ }
72
+ }
73
+ function walletActivityAmount(a) {
74
+ if (a.type === "SEND" || a.type === "RECEIVE") return tokenAmount(a.tokenAddress, a.amount);
75
+ return null;
76
+ }
77
+ // Annotate the CommonJS export names for ESM import in node:
78
+ 0 && (module.exports = {
79
+ walletActivityAmount,
80
+ walletActivitySubtitle,
81
+ walletActivityTitle
82
+ });
83
+ //# sourceMappingURL=wallet-activity.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/media-wallet/wallet-activity.ts"],"sourcesContent":["import { getTokenByAddress } from \"@medialane/sdk\";\nimport type { ApiWalletActivity } from \"@medialane/sdk\";\nimport { fmt, short } from \"./wallet-format.js\";\n\nfunction tokenAmount(tokenAddress: string | null, amount: string | null): string | null {\n if (!amount) return null;\n const token = tokenAddress ? getTokenByAddress(tokenAddress) : undefined;\n if (!token) return amount;\n return `${fmt(BigInt(amount), token.decimals)} ${token.symbol}`;\n}\n\nexport function walletActivityTitle(a: ApiWalletActivity): string {\n switch (a.type) {\n case \"SEND\": return \"Sent\";\n case \"RECEIVE\": return \"Received\";\n case \"SWAP\": return \"Swapped\";\n case \"DEPLOY\": return \"Account activated\";\n case \"GUARDIAN_SET\": return \"Guardian added\";\n case \"GUARDIAN_TRIGGER_ESCAPE\": return \"Recovery started\";\n case \"GUARDIAN_COMPLETE_ESCAPE\": return \"Recovery completed\";\n case \"GUARDIAN_CANCEL_ESCAPE\": return \"Recovery canceled\";\n default: {\n const exhaustive: never = a.type;\n throw new Error(`Unhandled WalletActivityType: ${exhaustive}`);\n }\n }\n}\n\nexport function walletActivitySubtitle(a: ApiWalletActivity): string | null {\n switch (a.type) {\n case \"SEND\": return a.counterparty ? `to ${short(a.counterparty)}` : null;\n case \"RECEIVE\": return a.counterparty ? `from ${short(a.counterparty)}` : null;\n case \"SWAP\": {\n const from = tokenAmount(a.tokenInAddress, a.amountIn);\n const to = tokenAmount(a.tokenOutAddress, a.amountOut);\n return from && to ? `${from} → ${to}` : null;\n }\n default: return null;\n }\n}\n\nexport function walletActivityAmount(a: ApiWalletActivity): string | null {\n if (a.type === \"SEND\" || a.type === \"RECEIVE\") return tokenAmount(a.tokenAddress, a.amount);\n return null;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAkC;AAElC,2BAA2B;AAE3B,SAAS,YAAY,cAA6B,QAAsC;AACtF,MAAI,CAAC,OAAQ,QAAO;AACpB,QAAM,QAAQ,mBAAe,8BAAkB,YAAY,IAAI;AAC/D,MAAI,CAAC,MAAO,QAAO;AACnB,SAAO,OAAG,0BAAI,OAAO,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,MAAM,MAAM;AAC/D;AAEO,SAAS,oBAAoB,GAA8B;AAChE,UAAQ,EAAE,MAAM;AAAA,IACd,KAAK;AAAQ,aAAO;AAAA,IACpB,KAAK;AAAW,aAAO;AAAA,IACvB,KAAK;AAAQ,aAAO;AAAA,IACpB,KAAK;AAAU,aAAO;AAAA,IACtB,KAAK;AAAgB,aAAO;AAAA,IAC5B,KAAK;AAA2B,aAAO;AAAA,IACvC,KAAK;AAA4B,aAAO;AAAA,IACxC,KAAK;AAA0B,aAAO;AAAA,IACtC,SAAS;AACP,YAAM,aAAoB,EAAE;AAC5B,YAAM,IAAI,MAAM,iCAAiC,UAAU,EAAE;AAAA,IAC/D;AAAA,EACF;AACF;AAEO,SAAS,uBAAuB,GAAqC;AAC1E,UAAQ,EAAE,MAAM;AAAA,IACd,KAAK;AAAQ,aAAO,EAAE,eAAe,UAAM,4BAAM,EAAE,YAAY,CAAC,KAAK;AAAA,IACrE,KAAK;AAAW,aAAO,EAAE,eAAe,YAAQ,4BAAM,EAAE,YAAY,CAAC,KAAK;AAAA,IAC1E,KAAK,QAAQ;AACX,YAAM,OAAO,YAAY,EAAE,gBAAgB,EAAE,QAAQ;AACrD,YAAM,KAAK,YAAY,EAAE,iBAAiB,EAAE,SAAS;AACrD,aAAO,QAAQ,KAAK,GAAG,IAAI,WAAM,EAAE,KAAK;AAAA,IAC1C;AAAA,IACA;AAAS,aAAO;AAAA,EAClB;AACF;AAEO,SAAS,qBAAqB,GAAqC;AACxE,MAAI,EAAE,SAAS,UAAU,EAAE,SAAS,UAAW,QAAO,YAAY,EAAE,cAAc,EAAE,MAAM;AAC1F,SAAO;AACT;","names":[]}