@luxfi/core 5.3.7 → 10.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (196) hide show
  1. package/package.json +9 -53
  2. package/tsconfig.json +3 -8
  3. package/types/asset.ts +28 -0
  4. package/types/contract.ts +13 -0
  5. package/types/deposit-address.ts +9 -0
  6. package/types/exchange.ts +25 -0
  7. package/types/index.ts +21 -4
  8. package/types/network-type.ts +16 -0
  9. package/types/network.ts +58 -0
  10. package/types/swap-status.ts +58 -0
  11. package/types/transaction-type.ts +5 -0
  12. package/types/utila.ts +36 -0
  13. package/commerce/ui/conf.ts +0 -13
  14. package/commerce/ui/context.tsx +0 -123
  15. package/commerce/ui/store.ts +0 -290
  16. package/components/access-code-input.tsx +0 -71
  17. package/components/auth/auth-listener.tsx +0 -29
  18. package/components/auth/auth-token/clear-auth-token.tsx +0 -12
  19. package/components/auth/auth-token/set-auth-token.tsx +0 -16
  20. package/components/auth/common-auth-domains.ts +0 -16
  21. package/components/auth/login-panel.tsx +0 -107
  22. package/components/back-button.tsx +0 -49
  23. package/components/chat-widget.tsx +0 -85
  24. package/components/commerce/_to_deprecate_checkout-widget/const.ts +0 -13
  25. package/components/commerce/_to_deprecate_checkout-widget/index.tsx_ +0 -188
  26. package/components/commerce/_to_deprecate_checkout-widget/obs-string-set.ts +0 -48
  27. package/components/commerce/_to_deprecate_checkout-widget/use-anim-clx-set.ts +0 -59
  28. package/components/commerce/bag-button.tsx +0 -98
  29. package/components/commerce/buy-button.tsx +0 -34
  30. package/components/commerce/checkout-button.tsx +0 -129
  31. package/components/commerce/checkout-panel/cart-accordian.tsx +0 -66
  32. package/components/commerce/checkout-panel/checkout-panel-props.ts +0 -10
  33. package/components/commerce/checkout-panel/desktop-bag-carousel.tsx +0 -36
  34. package/components/commerce/checkout-panel/desktop-cp.tsx +0 -83
  35. package/components/commerce/checkout-panel/index.tsx +0 -126
  36. package/components/commerce/checkout-panel/mobile-cp.tsx +0 -67
  37. package/components/commerce/checkout-panel/policy-links.tsx +0 -29
  38. package/components/commerce/checkout-panel/steps-indicator.tsx +0 -39
  39. package/components/commerce/checkout-panel/thank-you.tsx +0 -18
  40. package/components/commerce/desktop-bag-popup.tsx +0 -78
  41. package/components/commerce/desktop-nav-menu.tsx +0 -194
  42. package/components/commerce/drawer/index.tsx +0 -88
  43. package/components/commerce/drawer/micro.tsx +0 -145
  44. package/components/commerce/drawer/shell.tsx +0 -85
  45. package/components/commerce/mobile-bag-drawer.tsx +0 -51
  46. package/components/commerce/mobile-login-button.tsx +0 -108
  47. package/components/commerce/mobile-menu-toggle-button.tsx +0 -35
  48. package/components/commerce/mobile-nav-menu-ai.tsx +0 -51
  49. package/components/commerce/mobile-nav-menu-item.tsx +0 -50
  50. package/components/commerce/mobile-nav-menu.tsx +0 -102
  51. package/components/contact-dialog/contact-form.tsx +0 -113
  52. package/components/contact-dialog/disclaimer.tsx +0 -13
  53. package/components/contact-dialog/index.tsx +0 -64
  54. package/components/copyright.tsx +0 -21
  55. package/components/drawer-margin.tsx +0 -28
  56. package/components/footer.tsx +0 -78
  57. package/components/header/desktop.tsx +0 -51
  58. package/components/header/index.tsx +0 -50
  59. package/components/header/mobile.tsx +0 -163
  60. package/components/header/theme-toggle.tsx +0 -26
  61. package/components/icons/24k-gold-card.tsx +0 -43
  62. package/components/icons/ai-chat-act.tsx +0 -47
  63. package/components/icons/ai-chat.tsx +0 -29
  64. package/components/icons/anodized-titanium.tsx +0 -45
  65. package/components/icons/avatar.tsx +0 -11
  66. package/components/icons/bag-icon.tsx +0 -10
  67. package/components/icons/blog-act.tsx +0 -14
  68. package/components/icons/blog.tsx +0 -20
  69. package/components/icons/bridge-act.tsx +0 -18
  70. package/components/icons/bridge.tsx +0 -68
  71. package/components/icons/changelog-act.tsx +0 -15
  72. package/components/icons/changelog.tsx +0 -21
  73. package/components/icons/chrome.tsx +0 -45
  74. package/components/icons/coins-act.tsx +0 -29
  75. package/components/icons/coins.tsx +0 -20
  76. package/components/icons/compare-cards-act.tsx +0 -30
  77. package/components/icons/compare-cards.tsx +0 -21
  78. package/components/icons/credit-act.tsx +0 -29
  79. package/components/icons/credit.tsx +0 -20
  80. package/components/icons/customer-support-act.tsx +0 -27
  81. package/components/icons/customer-support.tsx +0 -21
  82. package/components/icons/customers-act.tsx +0 -65
  83. package/components/icons/customers.tsx +0 -33
  84. package/components/icons/developer-docs-act.tsx +0 -26
  85. package/components/icons/developer-docs.tsx +0 -20
  86. package/components/icons/exchange-act.tsx +0 -27
  87. package/components/icons/exchange.tsx +0 -21
  88. package/components/icons/explorer-act.tsx +0 -27
  89. package/components/icons/explorer.tsx +0 -22
  90. package/components/icons/faqs-act.tsx +0 -27
  91. package/components/icons/faqs.tsx +0 -21
  92. package/components/icons/github.tsx +0 -14
  93. package/components/icons/guides-act.tsx +0 -26
  94. package/components/icons/guides.tsx +0 -21
  95. package/components/icons/gun-metal.tsx +0 -44
  96. package/components/icons/index.tsx +0 -43
  97. package/components/icons/integrations-act.tsx +0 -41
  98. package/components/icons/integrations.tsx +0 -25
  99. package/components/icons/irradescent.tsx +0 -41
  100. package/components/icons/launch-subnet.tsx +0 -21
  101. package/components/icons/launchsubnet-act.tsx +0 -29
  102. package/components/icons/left-arrow.tsx +0 -11
  103. package/components/icons/lux-finance-act.tsx +0 -34
  104. package/components/icons/lux-finance.tsx +0 -23
  105. package/components/icons/lux-logo.tsx +0 -10
  106. package/components/icons/lux-pass-act.tsx +0 -41
  107. package/components/icons/lux-pass.tsx +0 -25
  108. package/components/icons/lux-quests-act.tsx +0 -15
  109. package/components/icons/lux-quests.tsx +0 -21
  110. package/components/icons/market-act.tsx +0 -39
  111. package/components/icons/market.tsx +0 -24
  112. package/components/icons/mirrored-titanium.tsx +0 -46
  113. package/components/icons/more-benefits-act.tsx +0 -29
  114. package/components/icons/more-benefits.tsx +0 -21
  115. package/components/icons/open-source-act.tsx +0 -41
  116. package/components/icons/open-source.tsx +0 -26
  117. package/components/icons/right-arrow.tsx +0 -10
  118. package/components/icons/safe-act.tsx +0 -77
  119. package/components/icons/safe.tsx +0 -37
  120. package/components/icons/search.tsx +0 -12
  121. package/components/icons/secure-delivery.tsx +0 -13
  122. package/components/icons/shop-act.tsx +0 -29
  123. package/components/icons/shop.tsx +0 -20
  124. package/components/icons/social-icon.tsx +0 -35
  125. package/components/icons/social-svg.css +0 -3
  126. package/components/icons/sterling-silver-card.tsx +0 -44
  127. package/components/icons/templates-act.tsx +0 -29
  128. package/components/icons/templates.tsx +0 -21
  129. package/components/icons/validators-act.tsx +0 -42
  130. package/components/icons/validators.tsx +0 -41
  131. package/components/icons/view-all-card-act.tsx +0 -28
  132. package/components/icons/view-all-card.tsx +0 -20
  133. package/components/icons/wallet-act.tsx +0 -29
  134. package/components/icons/wallet.tsx +0 -20
  135. package/components/icons/warpcast.tsx +0 -58
  136. package/components/icons/youtube-logo.tsx +0 -59
  137. package/components/index.ts +0 -25
  138. package/components/logo.tsx +0 -89
  139. package/components/main.tsx +0 -27
  140. package/components/mini-chart/index.tsx +0 -8
  141. package/components/mini-chart/mini-chart-props.ts +0 -44
  142. package/components/mini-chart/mini-chart.tsx +0 -85
  143. package/components/mini-chart/wrapper.tsx +0 -23
  144. package/components/not-found/index.tsx +0 -28
  145. package/components/not-found/not-found-content.mdx +0 -5
  146. package/components/scripts.tsx +0 -24
  147. package/components/tooltip.tsx +0 -31
  148. package/environment.d.ts +0 -6
  149. package/next/analytics/fpixel.ts +0 -16
  150. package/next/analytics/google-analytics.ts +0 -14
  151. package/next/analytics/index.ts +0 -3
  152. package/next/analytics/pixel-analytics.tsx +0 -55
  153. package/next/font/get-app-router-font-classes.ts +0 -12
  154. package/next/font/load-and-return-lux-next-fonts-on-import.ts +0 -68
  155. package/next/font/local/Druk-Wide-Bold.ttf +0 -0
  156. package/next/font/local/Druk-Wide-Medium.ttf +0 -0
  157. package/next/font/local/InterVariable-Italic.ttf +0 -0
  158. package/next/font/local/InterVariable-Italic.woff2 +0 -0
  159. package/next/font/local/InterVariable.ttf +0 -0
  160. package/next/font/local/InterVariable.woff2 +0 -0
  161. package/next/font/next-font-desc.ts +0 -28
  162. package/next/font/pages-router-font-vars.tsx +0 -18
  163. package/next/head-metadata/from-next/metadata-types.ts +0 -158
  164. package/next/head-metadata/from-next/opengraph-types.ts +0 -267
  165. package/next/head-metadata/from-next/twitter-types.ts +0 -92
  166. package/next/head-metadata/index.tsx +0 -208
  167. package/next/index.ts +0 -1
  168. package/next/middleware/determine-device-mw.ts +0 -16
  169. package/root-layout/WHY_THIS_IS_SEPARATE.txt +0 -2
  170. package/root-layout/index.tsx +0 -112
  171. package/server-actions/TO-DO.txt +0 -1
  172. package/server-actions/firebase-app.ts +0 -14
  173. package/server-actions/index.ts +0 -5
  174. package/server-actions/store-contact.ts +0 -51
  175. package/site-def/footer/community.tsx +0 -67
  176. package/site-def/footer/company.ts +0 -37
  177. package/site-def/footer/ecosystem.ts +0 -37
  178. package/site-def/footer/index.tsx +0 -26
  179. package/site-def/footer/legal.ts +0 -28
  180. package/site-def/footer/network.ts +0 -45
  181. package/site-def/footer/svg/warpcast-logo.svg +0 -12
  182. package/site-def/index.ts +0 -3
  183. package/site-def/main-nav.tsx +0 -458
  184. package/style/cart-animation.css +0 -29
  185. package/style/checkout-animation.css +0 -23
  186. package/style/drawer-handle-overrides.css +0 -160
  187. package/style/lux-colors.css +0 -85
  188. package/style/lux-global.css +0 -51
  189. package/tailwind/fontFamily.tailwind.lux.ts +0 -18
  190. package/tailwind/index.ts +0 -2
  191. package/tailwind/lux-tw-fonts.ts +0 -40
  192. package/tailwind/tailwind.config.lux-preset.ts +0 -10
  193. package/types/chatbot-config.ts +0 -7
  194. package/types/chatbot-suggested-question.ts +0 -7
  195. package/types/contact-info.ts +0 -11
  196. package/types/site-def.ts +0 -43
package/package.json CHANGED
@@ -1,80 +1,36 @@
1
1
  {
2
2
  "name": "@luxfi/core",
3
- "version": "5.3.7",
4
- "description": "Library that contains shared UI primitives, support for a common design system, and other boilerplate support.",
3
+ "version": "10.0.1",
4
+ "description": "core types and shared utilities related blockchain",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/",
7
7
  "access": "public",
8
8
  "scope": "@luxfi"
9
9
  },
10
+ "author": "Hanzo AI, Inc.",
11
+ "license": "BSD-3-Clause",
10
12
  "repository": {
11
13
  "type": "git",
12
- "url": "git+https://github.com/luxfi/web.git",
13
- "directory": "packages/core"
14
+ "url": "git+https://github.com/luxfi/bridge.git",
15
+ "directory": "pkg/luxfi-core"
14
16
  },
15
17
  "keywords": [
16
- "components",
17
- "radix-ui",
18
18
  "hanzo",
19
19
  "luxdefi"
20
20
  ],
21
21
  "scripts": {
22
22
  "lat": "npm show @luxfi/core version",
23
23
  "pub": "npm publish",
24
- "build": "tsc",
25
- "tc": "tsc",
26
- "clean": "rm -rf node_modules"
24
+ "tc": "tsc"
27
25
  },
28
26
  "exports": {
29
- ".": "./components/index.ts",
30
- "./commerce": "./commerce/ui/context.tsx",
31
- "./root-layout": "./root-layout/index.tsx",
32
- "./server-actions": "./server-actions/index.ts",
33
- "./next": "./next/index.ts",
34
- "./style/": "./style/",
35
- "./site-def": "./site-def/index.ts",
36
- "./tailwind": "./tailwind/index.ts"
27
+ ".": "./types/index.ts"
37
28
  },
38
29
  "dependencies": {
39
- "@next/third-parties": "^14.1.0",
40
- "@types/node": "^20.12.12",
41
- "cookies-next": "^4.1.1",
42
- "date-fns": "^3.6.0",
43
- "embla-carousel-autoplay": "^8.1.1",
44
- "firebase": "10.12.0",
45
- "framer-motion": "^11.2.12",
46
- "react-device-detect": "^2.2.3",
47
- "react-social-icons": "^6.4.0",
48
- "react-tooltip": "^5.26.4",
49
- "request": "^2.88.2",
50
- "usehooks-ts": "^3.1.0"
51
30
  },
52
31
  "peerDependencies": {
53
- "@hanzo/auth": "*",
54
- "@hanzo/commerce": "*",
55
- "@hanzo/ui": "*",
56
- "@hookform/resolvers": "^3.3.2",
57
- "lucide-react": "^0.344.0",
58
- "mobx": "^6.12.3",
59
- "mobx-react-lite": "^4.0.7",
60
- "next": "14.2.3",
61
- "next-themes": "^0.2.1",
62
- "react": "*",
63
- "react-dom": "*",
64
- "react-hook-form": "^7.51.4",
65
- "validator": "^13.11.0",
66
- "zod": "3.23.8"
67
32
  },
68
33
  "devDependencies": {
69
- "@mdx-js/loader": "^3.0.0",
70
- "@mdx-js/react": "^3.0.0",
71
- "@types/facebook-pixel": "^0.0.30",
72
- "@types/gtag.js": "^0.0.19",
73
- "@types/mdx": "^2.0.9",
74
- "@types/node": "^20.11.24",
75
- "@types/react": "*",
76
- "@types/react-dom": "*",
77
- "tailwindcss": "^3.4.3",
78
- "typescript": "5.4.5"
34
+ "typescript": "5.7.2"
79
35
  }
80
36
  }
package/tsconfig.json CHANGED
@@ -1,15 +1,10 @@
1
1
  {
2
- "extends": "../tsconfig.modules.base.json",
2
+ "extends": "../../tsconfig.base.json",
3
3
  "include": [
4
4
  "**/*.ts",
5
- "**/*.tsx", "components/commerce/_to_deprecate_checkout-widget/index.tsx_",
5
+ "**/*.tsx",
6
6
  ],
7
7
  "exclude": [
8
8
  "node_modules",
9
- ],
10
- "compilerOptions": {
11
- "paths": {
12
- "react": [ "./node_modules/@types/react" ],
13
- }
14
- }
9
+ ]
15
10
  }
package/types/asset.ts ADDED
@@ -0,0 +1,28 @@
1
+ interface Asset {
2
+ name: string
3
+ asset: string
4
+ logo: string
5
+ contract_address: string | null
6
+ decimals: number
7
+ status: string
8
+ is_deposit_enabled: boolean
9
+ is_withdrawal_enabled: boolean
10
+ is_refuel_enabled: boolean
11
+ max_withdrawal_amount: number
12
+ deposit_fee: number
13
+ withdrawal_fee: number
14
+ source_base_fee: number
15
+ destination_base_fee: number
16
+ //is_native: boolean
17
+
18
+ id?: number,
19
+ price_in_usd?: number | null,
20
+ precision?: number | null,
21
+ listing_date?: Date,
22
+ network_id?: number
23
+
24
+ }
25
+
26
+ export {
27
+ type Asset as default
28
+ }
@@ -0,0 +1,13 @@
1
+ interface Contract {
2
+ name?: string
3
+ chain_id: number,
4
+ teleporter: `0x${string}` | ''
5
+ vault: `0x${string}` | ''
6
+ }
7
+
8
+ type Contracts = Record<number,Contract >
9
+
10
+ export {
11
+ type Contract,
12
+ type Contracts
13
+ }
@@ -0,0 +1,9 @@
1
+ interface DepositAddress {
2
+ address: string
3
+ memo?: string
4
+ }
5
+
6
+ export {
7
+ type DepositAddress as default
8
+ }
9
+
@@ -0,0 +1,25 @@
1
+ type Status = 'active' | 'inactive'
2
+
3
+ interface ExchangeAsset {
4
+ asset: string
5
+ is_default: boolean
6
+ network: string
7
+ status: Status
8
+ }
9
+
10
+ interface Exchange {
11
+ display_name: string
12
+ internal_name: string
13
+ is_featured: boolean
14
+ type: "cex" | "fiat"
15
+ status: Status
16
+ created_date: string
17
+ currencies: ExchangeAsset []
18
+ metadata?: {} | null
19
+ img_url?: string
20
+ }
21
+
22
+ export {
23
+ type Exchange as default
24
+ }
25
+
package/types/index.ts CHANGED
@@ -1,4 +1,21 @@
1
- export type { ContactInfo, ContactInfoFields } from './contact-info'
2
- export type { default as SiteDef } from './site-def'
3
- export type { default as ChatbotSuggestedQuestion } from './chatbot-suggested-question'
4
- export type { default as ChatbotConfig } from './chatbot-config'
1
+
2
+ export { type default as Asset } from './asset'
3
+ export type { Contract, Contracts } from './contract'
4
+ export { type default as DepositAddress} from './deposit-address'
5
+ export { type default as Exchange } from './exchange'
6
+ export { type default as NetworkType} from './network-type'
7
+ export { type default as Network} from './network'
8
+ export { TransactionType} from './transaction-type'
9
+ export {
10
+ SwapStatus,
11
+ swapStatusByIndex,
12
+ UtilaTransactionStatus,
13
+ utilaTransactionStatusByIndex
14
+ } from './swap-status'
15
+
16
+ export type {
17
+ UTILA_NETWORK,
18
+ UTILA_TRANSACTION_CREATED,
19
+ UTILA_TRANSACTION_STATE_UPDATED
20
+ } from './utila'
21
+
@@ -0,0 +1,16 @@
1
+ type NetworkType =
2
+ "evm"
3
+ | "starknet"
4
+ | "solana"
5
+ | "cosmos"
6
+ | "stark_ex"
7
+ | "zk_sync_lite"
8
+ | "ton"
9
+ | "btc"
10
+ | "cardano"
11
+
12
+
13
+ export {
14
+ type NetworkType as default
15
+ }
16
+
@@ -0,0 +1,58 @@
1
+ import type Asset from './asset'
2
+ import type DepositAddress from './deposit-address'
3
+ import type NetworkType from './network-type'
4
+
5
+ type NetworkNode = { url: string } | string
6
+
7
+ interface NetworkMetadata {
8
+ multicall3?: {
9
+ address: `0x${string}`
10
+ blockCreated: number
11
+ }
12
+ ensRegistry?: {
13
+ address: `0x${string}`
14
+ }
15
+ ensUniversalResolver?: {
16
+ address: `0x${string}`
17
+ }
18
+ WatchdogContractAddress?: `0x${string}`
19
+ L1Network?: string
20
+ }
21
+
22
+ interface _ManagedAccount {
23
+ address: `0x${string}`
24
+ }
25
+
26
+ type ManagedAccount = _ManagedAccount | string
27
+
28
+ interface Network {
29
+
30
+ display_name: string
31
+ internal_name: string
32
+ transaction_explorer_template: string
33
+ account_explorer_template: string
34
+ currencies: Asset[]
35
+ refuel_amount_in_usd?: number
36
+ chain_id: string | null
37
+ type: NetworkType
38
+ created_date?: string
39
+ is_featured: boolean
40
+ nodes: NetworkNode[]
41
+ managed_accounts: ManagedAccount[]
42
+ metadata: NetworkMetadata | null | undefined
43
+ img_url?: string
44
+
45
+ id?: number,
46
+ native_currency: string | null
47
+ is_testnet: boolean | null
48
+ logo: string | null
49
+ average_completion_time: string | null
50
+ listing_date?: Date | null
51
+
52
+ status: string
53
+ deposit_address?: DepositAddress
54
+ }
55
+
56
+ export {
57
+ type Network as default
58
+ }
@@ -0,0 +1,58 @@
1
+ export enum SwapStatus {
2
+ Created = "created",
3
+ UserTransferPending = "user_transfer_pending",
4
+ UserTransferDelayed = "user_transfer_delayed",
5
+ UserDepositPending = "user_deposit_pending",
6
+ BridgeTransferPending = "bridge_transfer_pending",
7
+ Completed = "completed",
8
+ Failed = "failed",
9
+ Expired = "expired",
10
+ Cancelled = "cancelled",
11
+ TeleportProcessPending = "teleport_processing_pending",
12
+ UserPayoutPending = "user_payout_pending",
13
+ PayoutSuccess = "payout_success"
14
+ }
15
+ export const swapStatusByIndex: { [key: number]: SwapStatus } = {
16
+ "0": SwapStatus.Created,
17
+ "1": SwapStatus.UserTransferPending,
18
+ "2": SwapStatus.UserTransferDelayed,
19
+ "3": SwapStatus.BridgeTransferPending,
20
+ "4": SwapStatus.Completed,
21
+ "5": SwapStatus.Failed,
22
+ "6": SwapStatus.Expired,
23
+ "7": SwapStatus.Cancelled,
24
+ };
25
+
26
+ export enum UtilaTransactionStatus {
27
+ AWAITING_APPROVAL = "AWAITING_APPROVAL",
28
+ AWAITING_POLICY_CHECK = "AWAITING_POLICY_CHECK",
29
+ AWAITING_SIGNATURE = "AWAITING_SIGNATURE",
30
+ SIGNED = "SIGNED",
31
+ AWAITING_PUBLISH = "AWAITING_PUBLISH",
32
+ PUBLISHED = "PUBLISHED",
33
+ MINED = "MINED",
34
+ FAILED = "FAILED",
35
+ DECLINED = "DECLINED",
36
+ REPLACED = "REPLACED",
37
+ CANCELED = "CANCELED",
38
+ DROPPED = "DROPPED",
39
+ CONFIRMED = "CONFIRMED",
40
+ EXPIRED = "EXPIRED"
41
+ }
42
+
43
+ export const utilaTransactionStatusByIndex: { [key: number]: UtilaTransactionStatus } = {
44
+ "1": UtilaTransactionStatus.AWAITING_APPROVAL,
45
+ "2": UtilaTransactionStatus.AWAITING_POLICY_CHECK,
46
+ "3": UtilaTransactionStatus.AWAITING_SIGNATURE,
47
+ "4": UtilaTransactionStatus.SIGNED,
48
+ "5": UtilaTransactionStatus.AWAITING_PUBLISH,
49
+ "6": UtilaTransactionStatus.PUBLISHED,
50
+ "7": UtilaTransactionStatus.MINED,
51
+ "8": UtilaTransactionStatus.FAILED,
52
+ "9": UtilaTransactionStatus.DECLINED,
53
+ "10": UtilaTransactionStatus.REPLACED,
54
+ "11": UtilaTransactionStatus.CANCELED,
55
+ "12": UtilaTransactionStatus.DROPPED,
56
+ "13": UtilaTransactionStatus.CONFIRMED,
57
+ "14": UtilaTransactionStatus.EXPIRED
58
+ }
@@ -0,0 +1,5 @@
1
+ export enum TransactionType {
2
+ Input = "input",
3
+ Output = "output",
4
+ Refuel = "refuel",
5
+ }
package/types/utila.ts ADDED
@@ -0,0 +1,36 @@
1
+ export type UTILA_NETWORK = {
2
+ $typeName: string
3
+ name: string
4
+ displayName: string
5
+ testnet: boolean
6
+ nativeAsset: string
7
+ custom: boolean
8
+ caipDetails: {
9
+ $typeName: string
10
+ chainId: string
11
+ namespace: string
12
+ reference: string
13
+ },
14
+ assets: Record<string, string>
15
+ }
16
+
17
+ export type UTILA_TRANSACTION_CREATED = {
18
+ id: string,
19
+ vault: string,
20
+ type: string,
21
+ resourceType: string,
22
+ resource: string,
23
+ }
24
+
25
+ export type UTILA_TRANSACTION_STATE_UPDATED = {
26
+ id: string,
27
+ vault: string,
28
+ type: string,
29
+ details: {
30
+ transactionStateUpdated: {
31
+ newState: string
32
+ }
33
+ },
34
+ resourceType: string,
35
+ resource: string,
36
+ }
@@ -1,13 +0,0 @@
1
- import type { SnapPointsConfig } from './store'
2
-
3
- export default {
4
- mb: {
5
- micro: '62px',
6
- full: '550px'
7
- },
8
-
9
- dt: {
10
- micro: '74px',
11
- full: '575px'
12
- }
13
- } satisfies SnapPointsConfig
@@ -1,123 +0,0 @@
1
- 'use client'
2
- import React, {
3
- createContext,
4
- useContext,
5
- useRef,
6
- type PropsWithChildren,
7
- useEffect,
8
- useLayoutEffect
9
- } from 'react'
10
- import { enableStaticRendering } from 'mobx-react-lite'
11
- import { usePathname } from 'next/navigation'
12
- import { useDebounceCallback } from 'usehooks-ts'
13
-
14
-
15
- import { preset as twConfig } from '@hanzo/ui/tailwind'
16
- import { useCommerce } from '@hanzo/commerce'
17
-
18
- import type { CommerceDrawer, SelectAndBuy } from './store'
19
- import { CommerceUIStore } from './store'
20
- import conf from './conf'
21
-
22
- const LOG = false ////////////////////
23
- const log = (s: string) => {
24
- if (LOG) {
25
- console.log('CMMC UI CONTEXT ' + s)
26
- }
27
- }
28
-
29
- // https://dev.to/ivandotv/mobx-server-side-rendering-with-next-js-4m18
30
- enableStaticRendering(typeof window === "undefined")
31
-
32
- const CommerceUIContext = createContext<CommerceUIStore | undefined>(undefined)
33
-
34
- const useCommerceDrawer = (): CommerceDrawer => {
35
- return useContext(CommerceUIContext) as CommerceDrawer
36
- }
37
-
38
- const useSelectAndBuy = (): SelectAndBuy => {
39
- return useContext(CommerceUIContext) as SelectAndBuy
40
- }
41
-
42
- const CommerceUIProvider: React.FC<PropsWithChildren> = ({
43
- children,
44
- }) => {
45
-
46
- const cmmc = useCommerce()
47
- const pathname = usePathname()
48
- const storeRef = useRef<CommerceUIStore>(new CommerceUIStore(cmmc, conf))
49
- const prevPathRef = useRef<string>('initial')
50
-
51
- const onResize = () => {
52
- const width = window.innerWidth
53
- let desktopMin = 0
54
- if (twConfig.theme?.screens) {
55
- // expected form: { md: '768px' }
56
- if ('md' in twConfig.theme?.screens && typeof twConfig.theme?.screens.md === 'string') {
57
- desktopMin = parseInt(twConfig.theme?.screens.md)
58
- }
59
- if (width < desktopMin) {
60
- if (!storeRef.current.isMobile) {
61
- storeRef.current.setMobile(true)
62
- }
63
- }
64
- else if (storeRef.current.isMobile) {
65
- storeRef.current.setMobile(false)
66
- }
67
- }
68
- storeRef.current.setViewportHeight(window.innerHeight)
69
- }
70
-
71
- const onResize_debounced = useDebounceCallback(onResize, 500)
72
-
73
- useLayoutEffect(() => {
74
- storeRef.current.initialize()
75
- onResize()
76
- window.addEventListener('resize', onResize_debounced);
77
-
78
- return () => {
79
- window.removeEventListener('resize', onResize_debounced)
80
- storeRef.current.dispose()
81
- }
82
- }, [])
83
-
84
- useEffect(() => {
85
- const checkingOut = (pathname === '/checkout')
86
-
87
- /////////////////////////////////////
88
- log("useEffect: pathname: " + pathname)
89
- log("useEffect: prev pathname: " + prevPathRef.current)
90
-
91
- if (storeRef.current.checkingOut === undefined || storeRef.current._checkingOut!== checkingOut) {
92
- log("useEffect: setting checkingOut to: " + checkingOut) /////////////////////////////////////
93
- storeRef.current.setCheckingOut(checkingOut)
94
- }
95
- if ( prevPathRef.current === 'initial') {
96
- prevPathRef.current = pathname
97
- storeRef.current.newRoute()
98
- }
99
- else if (
100
- !checkingOut
101
- &&
102
- prevPathRef.current !== pathname
103
- ) {
104
- storeRef.current.newRoute()
105
- prevPathRef.current = pathname
106
- log("ROUTE CHANGE: " + pathname + ": " + storeRef.current._routeChangedTime)
107
- }
108
- }, [pathname])
109
-
110
-
111
- return (
112
- <CommerceUIContext.Provider value={storeRef.current}>
113
- {children}
114
- </CommerceUIContext.Provider>
115
- )
116
- }
117
-
118
- export {
119
- useCommerceDrawer,
120
- useSelectAndBuy,
121
- CommerceUIProvider
122
- }
123
-