@shapeshiftoss/swap-widget 0.0.2 → 0.1.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 (159) hide show
  1. package/dist/index.d.ts +233 -0
  2. package/dist/index.js +63612 -0
  3. package/dist/style.css +1 -0
  4. package/package.json +69 -18
  5. package/Dockerfile +0 -87
  6. package/dist/assets/PhArrowCircleDown-B305t-Sh.js +0 -14
  7. package/dist/assets/PhArrowClockwise-CJPxQhr_.js +0 -14
  8. package/dist/assets/PhArrowDown-C4hT9BVu.js +0 -14
  9. package/dist/assets/PhArrowLeft-Way4Cu-r.js +0 -14
  10. package/dist/assets/PhArrowRight-Cp5ZME0F.js +0 -14
  11. package/dist/assets/PhArrowSquareOut-NnrK69c5.js +0 -14
  12. package/dist/assets/PhArrowUp-Dph6j8rm.js +0 -14
  13. package/dist/assets/PhArrowUpRight-BpJjRRRh.js +0 -14
  14. package/dist/assets/PhArrowsClockwise-CFUT8X7R.js +0 -14
  15. package/dist/assets/PhArrowsDownUp-BjBI4ckC.js +0 -14
  16. package/dist/assets/PhArrowsLeftRight-CuLpbKRk.js +0 -14
  17. package/dist/assets/PhBank-Dchr4XQJ.js +0 -14
  18. package/dist/assets/PhBrowser-dUu2TrC1.js +0 -14
  19. package/dist/assets/PhCaretDown-78IuKU3V.js +0 -14
  20. package/dist/assets/PhCaretLeft-_aiyH7n1.js +0 -14
  21. package/dist/assets/PhCaretRight-8zJQEuDX.js +0 -14
  22. package/dist/assets/PhCaretUp-CiCxKWwN.js +0 -14
  23. package/dist/assets/PhCheck-CcADx8br.js +0 -14
  24. package/dist/assets/PhCircleHalf-BYzSzd2h.js +0 -14
  25. package/dist/assets/PhClock-UItiXeJq.js +0 -14
  26. package/dist/assets/PhCompass-CUy3uA7t.js +0 -14
  27. package/dist/assets/PhCopy-C-PDgSlZ.js +0 -14
  28. package/dist/assets/PhCreditCard-CWRaUT6F.js +0 -14
  29. package/dist/assets/PhCurrencyDollar-Cqla3AXT.js +0 -14
  30. package/dist/assets/PhDesktop-BBIPrYLl.js +0 -14
  31. package/dist/assets/PhDeviceMobile-BdsPaATg.js +0 -14
  32. package/dist/assets/PhDotsThree-BMXCQl-0.js +0 -14
  33. package/dist/assets/PhEnvelope-yUsis6yU.js +0 -14
  34. package/dist/assets/PhFunnelSimple-Ba7BbWTp.js +0 -14
  35. package/dist/assets/PhGlobe-DgLxBk5U.js +0 -14
  36. package/dist/assets/PhIdentificationCard-Czjmq9Z3.js +0 -14
  37. package/dist/assets/PhImage-BAJ_erz6.js +0 -14
  38. package/dist/assets/PhInfo-Cr4DhVUE.js +0 -14
  39. package/dist/assets/PhLightbulb-BX_7duTr.js +0 -14
  40. package/dist/assets/PhMagnifyingGlass-Mygfryvz.js +0 -14
  41. package/dist/assets/PhPaperPlaneRight-BeuCA660.js +0 -14
  42. package/dist/assets/PhPlus-BMjcHjsT.js +0 -14
  43. package/dist/assets/PhPower-CGffGmdb.js +0 -14
  44. package/dist/assets/PhPuzzlePiece-wm_GpVSi.js +0 -14
  45. package/dist/assets/PhQrCode-DRwRzXCH.js +0 -14
  46. package/dist/assets/PhQuestion-M09j2U0T.js +0 -14
  47. package/dist/assets/PhQuestionMark-BP9EMB6h.js +0 -14
  48. package/dist/assets/PhSealCheck-BfG80yKn.js +0 -14
  49. package/dist/assets/PhSignOut-C5YOWlPT.js +0 -14
  50. package/dist/assets/PhSpinner-BXooDYzU.js +0 -14
  51. package/dist/assets/PhTrash-Biq6rmmL.js +0 -14
  52. package/dist/assets/PhUser-CAgZSpGe.js +0 -14
  53. package/dist/assets/PhVault-l2PHF38a.js +0 -14
  54. package/dist/assets/PhWallet-w25D16It.js +0 -14
  55. package/dist/assets/PhWarning-DPEydIPw.js +0 -14
  56. package/dist/assets/PhWarningCircle-BqjT745H.js +0 -14
  57. package/dist/assets/PhX-s-SmVExa.js +0 -14
  58. package/dist/assets/SwapController-If0bFrNc.js +0 -1
  59. package/dist/assets/ccip-BBB7uCdL.js +0 -1
  60. package/dist/assets/ccip-CkkdfKKI.js +0 -1
  61. package/dist/assets/data-capture-D4gAy-Yc.js +0 -242
  62. package/dist/assets/email-B1AJehis.js +0 -90
  63. package/dist/assets/embedded-wallet-Q6DQopDk.js +0 -410
  64. package/dist/assets/features-B6JAPAFb.js +0 -5
  65. package/dist/assets/index-5jd8RPN9.js +0 -7428
  66. package/dist/assets/index-B4kNtSTk.js +0 -1080
  67. package/dist/assets/index-B753eAob.js +0 -1
  68. package/dist/assets/index-BZoLTv77.js +0 -3
  69. package/dist/assets/index-Bcw9UURX.js +0 -3
  70. package/dist/assets/index-BkrV-ahK.js +0 -2
  71. package/dist/assets/index-CRQzQ_up.js +0 -9
  72. package/dist/assets/index-CSW0Gt5y.js +0 -132
  73. package/dist/assets/index-CZ4jTIsk.js +0 -138
  74. package/dist/assets/index-Cwa8SB3h.js +0 -61
  75. package/dist/assets/index-DEwQgT4r.js +0 -78
  76. package/dist/assets/index-DVfQiQ1d.js +0 -1
  77. package/dist/assets/index-cV3UdaMs.css +0 -1
  78. package/dist/assets/index-hAmu622O.js +0 -43
  79. package/dist/assets/onramp-XcPNCLRU.js +0 -422
  80. package/dist/assets/pay-with-exchange-BeHt4OF4.js +0 -280
  81. package/dist/assets/property-C9JG5tag.js +0 -27
  82. package/dist/assets/receive-7ff4he2S.js +0 -131
  83. package/dist/assets/send-CkMBIRXT.js +0 -554
  84. package/dist/assets/socials-DmmxuLrP.js +0 -250
  85. package/dist/assets/swaps-IHAYRQ0x.js +0 -1050
  86. package/dist/assets/transactions-9Cxdk7o9.js +0 -16
  87. package/dist/assets/v4-BOvFkHkt.js +0 -1
  88. package/dist/assets/w3m-modal-kJzFnBfB.js +0 -891
  89. package/dist/assets/wallet-standard-Dv8LMoUB.js +0 -1
  90. package/dist/favicon.png +0 -0
  91. package/dist/favicon.svg +0 -11
  92. package/dist/icon-192x192.png +0 -0
  93. package/dist/icon-512x512.png +0 -0
  94. package/dist/index.html +0 -33
  95. package/index.html +0 -32
  96. package/public/favicon.png +0 -0
  97. package/public/favicon.svg +0 -11
  98. package/public/icon-192x192.png +0 -0
  99. package/public/icon-512x512.png +0 -0
  100. package/railway.toml +0 -10
  101. package/src/api/client.ts +0 -95
  102. package/src/components/AddressInputModal.css +0 -173
  103. package/src/components/AddressInputModal.tsx +0 -250
  104. package/src/components/ApprovalStep.tsx +0 -92
  105. package/src/components/ExecutionStep.tsx +0 -27
  106. package/src/components/InputStep.tsx +0 -431
  107. package/src/components/QuoteSelector.css +0 -146
  108. package/src/components/QuoteSelector.tsx +0 -137
  109. package/src/components/QuotesModal.css +0 -250
  110. package/src/components/QuotesModal.tsx +0 -182
  111. package/src/components/SettingsModal.css +0 -145
  112. package/src/components/SettingsModal.tsx +0 -180
  113. package/src/components/StatusStep.tsx +0 -139
  114. package/src/components/SwapWidget.css +0 -713
  115. package/src/components/SwapWidget.tsx +0 -607
  116. package/src/components/TokenSelectModal.css +0 -438
  117. package/src/components/TokenSelectModal.tsx +0 -487
  118. package/src/components/WalletProvider.tsx +0 -92
  119. package/src/config/appkit.ts +0 -104
  120. package/src/config/wagmi.ts +0 -27
  121. package/src/constants/chains.ts +0 -72
  122. package/src/constants/defaults.ts +0 -28
  123. package/src/constants/swappers.ts +0 -48
  124. package/src/constants/viemChains.ts +0 -69
  125. package/src/contexts/SwapWalletContext.tsx +0 -25
  126. package/src/demo/App.css +0 -458
  127. package/src/demo/App.tsx +0 -481
  128. package/src/demo/main.tsx +0 -25
  129. package/src/hooks/useAssets.ts +0 -180
  130. package/src/hooks/useBalances.ts +0 -822
  131. package/src/hooks/useBitcoinSigning.ts +0 -276
  132. package/src/hooks/useMarketData.ts +0 -169
  133. package/src/hooks/useSolanaSigning.ts +0 -275
  134. package/src/hooks/useStatusPolling.ts +0 -137
  135. package/src/hooks/useSwapApproval.ts +0 -106
  136. package/src/hooks/useSwapDisplayValues.ts +0 -157
  137. package/src/hooks/useSwapExecution.ts +0 -199
  138. package/src/hooks/useSwapHandlers.ts +0 -119
  139. package/src/hooks/useSwapQuote.ts +0 -71
  140. package/src/hooks/useSwapQuoting.ts +0 -102
  141. package/src/hooks/useSwapRates.ts +0 -61
  142. package/src/index.ts +0 -43
  143. package/src/machines/SwapMachineContext.ts +0 -5
  144. package/src/machines/__tests__/guards.test.ts +0 -228
  145. package/src/machines/__tests__/setup.test.ts +0 -7
  146. package/src/machines/__tests__/swapMachine.test.ts +0 -544
  147. package/src/machines/__tests__/types.test.ts +0 -124
  148. package/src/machines/guards.ts +0 -33
  149. package/src/machines/swapMachine.ts +0 -288
  150. package/src/machines/types.ts +0 -54
  151. package/src/services/transactionStatus.ts +0 -322
  152. package/src/types/index.ts +0 -361
  153. package/src/utils/addressValidation.ts +0 -201
  154. package/src/utils/redirect.ts +0 -45
  155. package/src/vite-env.d.ts +0 -10
  156. package/tsconfig.json +0 -23
  157. package/tsconfig.node.json +0 -10
  158. package/vite.config.ts +0 -101
  159. package/vitest.config.ts +0 -18
@@ -1,280 +0,0 @@
1
- import{y as A,z as D,D as z,F as p,G as $,I as v,J as u,a3 as P,k as y,ae as a,R as f,a1 as E,S as b,C as S,a4 as d,n as _}from"./index-5jd8RPN9.js";import"./index-DEwQgT4r.js";const T=A`
2
- button {
3
- border: none;
4
- border-radius: ${({borderRadius:t})=>t[20]};
5
- display: flex;
6
- flex-direction: row;
7
- align-items: center;
8
- padding: ${({spacing:t})=>t[1]};
9
- transition:
10
- background-color ${({durations:t})=>t.lg}
11
- ${({easings:t})=>t["ease-out-power-2"]},
12
- box-shadow ${({durations:t})=>t.lg}
13
- ${({easings:t})=>t["ease-out-power-2"]};
14
- will-change: background-color, box-shadow;
15
- }
16
-
17
- /* -- Variants --------------------------------------------------------------- */
18
- button[data-type='accent'] {
19
- background-color: ${({tokens:t})=>t.core.backgroundAccentPrimary};
20
- color: ${({tokens:t})=>t.theme.textPrimary};
21
- }
22
-
23
- button[data-type='neutral'] {
24
- background-color: ${({tokens:t})=>t.theme.foregroundSecondary};
25
- color: ${({tokens:t})=>t.theme.textPrimary};
26
- }
27
-
28
- /* -- Sizes --------------------------------------------------------------- */
29
- button[data-size='sm'] {
30
- height: 24px;
31
- }
32
-
33
- button[data-size='md'] {
34
- height: 28px;
35
- }
36
-
37
- button[data-size='lg'] {
38
- height: 32px;
39
- }
40
-
41
- button[data-size='sm'] > wui-image,
42
- button[data-size='sm'] > wui-icon {
43
- width: 16px;
44
- height: 16px;
45
- }
46
-
47
- button[data-size='md'] > wui-image,
48
- button[data-size='md'] > wui-icon {
49
- width: 20px;
50
- height: 20px;
51
- }
52
-
53
- button[data-size='lg'] > wui-image,
54
- button[data-size='lg'] > wui-icon {
55
- width: 24px;
56
- height: 24px;
57
- }
58
-
59
- wui-text {
60
- padding-left: ${({spacing:t})=>t[1]};
61
- padding-right: ${({spacing:t})=>t[1]};
62
- }
63
-
64
- wui-image {
65
- border-radius: ${({borderRadius:t})=>t[3]};
66
- overflow: hidden;
67
- user-drag: none;
68
- user-select: none;
69
- -moz-user-select: none;
70
- -webkit-user-drag: none;
71
- -webkit-user-select: none;
72
- -ms-user-select: none;
73
- }
74
-
75
- /* -- States --------------------------------------------------------------- */
76
- @media (hover: hover) and (pointer: fine) {
77
- button[data-type='accent']:not(:disabled):hover {
78
- background-color: ${({tokens:t})=>t.core.foregroundAccent060};
79
- }
80
-
81
- button[data-type='neutral']:not(:disabled):hover {
82
- background-color: ${({tokens:t})=>t.theme.foregroundTertiary};
83
- }
84
- }
85
-
86
- button[data-type='accent']:not(:disabled):focus-visible,
87
- button[data-type='accent']:not(:disabled):active {
88
- box-shadow: 0 0 0 4px ${({tokens:t})=>t.core.foregroundAccent020};
89
- }
90
-
91
- button[data-type='neutral']:not(:disabled):focus-visible,
92
- button[data-type='neutral']:not(:disabled):active {
93
- box-shadow: 0 0 0 4px ${({tokens:t})=>t.core.foregroundAccent020};
94
- }
95
-
96
- button:disabled {
97
- opacity: 0.5;
98
- }
99
- `;var g=function(t,e,s,n){var o=arguments.length,i=o<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,s):n,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,s,n);else for(var c=t.length-1;c>=0;c--)(r=t[c])&&(i=(o<3?r(i):o>3?r(e,s,i):r(e,s))||i);return o>3&&i&&Object.defineProperty(e,s,i),i};const L={sm:"sm-regular",md:"md-regular",lg:"lg-regular"};let h=class extends v{constructor(){super(...arguments),this.type="accent",this.size="md",this.imageSrc="",this.disabled=!1,this.leftIcon=void 0,this.rightIcon=void 0,this.text=""}render(){return u`
100
- <button ?disabled=${this.disabled} data-type=${this.type} data-size=${this.size}>
101
- ${this.imageSrc?u`<wui-image src=${this.imageSrc}></wui-image>`:null}
102
- ${this.leftIcon?u`<wui-icon name=${this.leftIcon} color="inherit" size="inherit"></wui-icon>`:null}
103
- <wui-text variant=${L[this.size]} color="inherit">${this.text}</wui-text>
104
- ${this.rightIcon?u`<wui-icon name=${this.rightIcon} color="inherit" size="inherit"></wui-icon>`:null}
105
- </button>
106
- `}};h.styles=[D,z,T];g([p()],h.prototype,"type",void 0);g([p()],h.prototype,"size",void 0);g([p()],h.prototype,"imageSrc",void 0);g([p({type:Boolean})],h.prototype,"disabled",void 0);g([p()],h.prototype,"leftIcon",void 0);g([p()],h.prototype,"rightIcon",void 0);g([p()],h.prototype,"text",void 0);h=g([$("wui-chip-button")],h);var I=function(t,e,s,n){var o=arguments.length,i=o<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,s):n,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,s,n);else for(var c=t.length-1;c>=0;c--)(r=t[c])&&(i=(o<3?r(i):o>3?r(e,s,i):r(e,s))||i);return o>3&&i&&Object.defineProperty(e,s,i),i};let w=class extends v{constructor(){super(...arguments),this.maxDecimals=void 0,this.maxIntegers=void 0}render(){return u`
107
- <wui-flex alignItems="center" gap="1">
108
- <wui-input-amount
109
- widthVariant="fit"
110
- fontSize="h2"
111
- .maxDecimals=${P(this.maxDecimals)}
112
- .maxIntegers=${P(this.maxIntegers)}
113
- .value=${this.amount?String(this.amount):""}
114
- ></wui-input-amount>
115
- <wui-text variant="md-regular" color="secondary">USD</wui-text>
116
- </wui-flex>
117
- `}};I([p({type:Number})],w.prototype,"amount",void 0);I([p({type:Number})],w.prototype,"maxDecimals",void 0);I([p({type:Number})],w.prototype,"maxIntegers",void 0);w=I([$("w3m-fund-input")],w);const R=A`
118
- .amount-input-container {
119
- border-radius: ${({borderRadius:t})=>t[6]};
120
- border-top-right-radius: 0;
121
- border-top-left-radius: 0;
122
- background-color: ${({tokens:t})=>t.theme.foregroundPrimary};
123
- padding: ${({spacing:t})=>t[1]};
124
- }
125
-
126
- .container {
127
- border-radius: 30px;
128
- }
129
- `;var m=function(t,e,s,n){var o=arguments.length,i=o<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,s):n,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,s,n);else for(var c=t.length-1;c>=0;c--)(r=t[c])&&(i=(o<3?r(i):o>3?r(e,s,i):r(e,s))||i);return o>3&&i&&Object.defineProperty(e,s,i),i};const C=[10,50,100],j=6,N=10;let l=class extends v{constructor(){super(),this.unsubscribe=[],this.network=y.state.activeCaipNetwork,this.exchanges=a.state.exchanges,this.isLoading=a.state.isLoading,this.amount=a.state.amount,this.tokenAmount=a.state.tokenAmount,this.priceLoading=a.state.priceLoading,this.isPaymentInProgress=a.state.isPaymentInProgress,this.currentPayment=a.state.currentPayment,this.paymentId=a.state.paymentId,this.paymentAsset=a.state.paymentAsset,this.unsubscribe.push(y.subscribeKey("activeCaipNetwork",e=>{this.network=e,this.setDefaultPaymentAsset()}),a.subscribe(e=>{var n,o;this.exchanges=e.exchanges,this.isLoading=e.isLoading,this.amount=e.amount,this.tokenAmount=e.tokenAmount,this.priceLoading=e.priceLoading,this.paymentId=e.paymentId,this.isPaymentInProgress=e.isPaymentInProgress,this.currentPayment=e.currentPayment,this.paymentAsset=e.paymentAsset,e.isPaymentInProgress&&((n=e.currentPayment)==null?void 0:n.exchangeId)&&((o=e.currentPayment)==null?void 0:o.sessionId)&&e.paymentId&&this.handlePaymentInProgress()}))}disconnectedCallback(){this.unsubscribe.forEach(s=>s()),a.state.isPaymentInProgress||a.reset()}async firstUpdated(){await this.getPaymentAssets(),this.paymentAsset||await this.setDefaultPaymentAsset(),a.setAmount(C[0]),await a.fetchExchanges()}render(){return u`
130
- <wui-flex flexDirection="column" class="container">
131
- ${this.amountInputTemplate()} ${this.exchangesTemplate()}
132
- </wui-flex>
133
- `}exchangesLoadingTemplate(){return Array.from({length:2}).map(()=>u`<wui-shimmer width="100%" height="65px" borderRadius="xxs"></wui-shimmer>`)}_exchangesTemplate(){return this.exchanges.length>0?this.exchanges.map(e=>u`<wui-list-item
134
- @click=${()=>this.onExchangeClick(e)}
135
- chevron
136
- variant="image"
137
- imageSrc=${e.imageUrl}
138
- ?loading=${this.isLoading}
139
- >
140
- <wui-text variant="md-regular" color="primary">
141
- Deposit from ${e.name}
142
- </wui-text>
143
- </wui-list-item>`):u`<wui-flex flexDirection="column" alignItems="center" gap="4" padding="4">
144
- <wui-text variant="lg-medium" align="center" color="primary">
145
- No exchanges support this asset on this network
146
- </wui-text>
147
- </wui-flex>`}exchangesTemplate(){return u`<wui-flex
148
- flexDirection="column"
149
- gap="2"
150
- .padding=${["3","3","3","3"]}
151
- class="exchanges-container"
152
- >
153
- ${this.isLoading?this.exchangesLoadingTemplate():this._exchangesTemplate()}
154
- </wui-flex>`}amountInputTemplate(){var e,s;return u`
155
- <wui-flex
156
- flexDirection="column"
157
- .padding=${["0","3","3","3"]}
158
- class="amount-input-container"
159
- >
160
- <wui-flex
161
- justifyContent="space-between"
162
- alignItems="center"
163
- .margin=${["0","0","6","0"]}
164
- >
165
- <wui-text variant="md-medium" color="secondary">Asset</wui-text>
166
- <wui-token-button
167
- data-testid="deposit-from-exchange-asset-button"
168
- flexDirection="row-reverse"
169
- text=${((e=this.paymentAsset)==null?void 0:e.metadata.symbol)||""}
170
- imageSrc=${((s=this.paymentAsset)==null?void 0:s.metadata.iconUrl)||""}
171
- @click=${()=>f.push("PayWithExchangeSelectAsset")}
172
- size="lg"
173
- .chainImageSrc=${P(E.getNetworkImage(this.network))}
174
- >
175
- </wui-token-button>
176
- </wui-flex>
177
- <wui-flex
178
- flexDirection="column"
179
- alignItems="center"
180
- justifyContent="center"
181
- .margin=${["0","0","4","0"]}
182
- >
183
- <w3m-fund-input
184
- @inputChange=${this.onAmountChange.bind(this)}
185
- .amount=${this.amount}
186
- .maxDecimals=${j}
187
- .maxIntegers=${N}
188
- >
189
- </w3m-fund-input>
190
- ${this.tokenAmountTemplate()}
191
- </wui-flex>
192
- <wui-flex justifyContent="center" gap="2">
193
- ${C.map(n=>u`<wui-chip-button
194
- @click=${()=>a.setAmount(n)}
195
- type="neutral"
196
- size="lg"
197
- text=${`$${n}`}
198
- ></wui-chip-button>`)}
199
- </wui-flex>
200
- </wui-flex>
201
- `}tokenAmountTemplate(){var e;return this.priceLoading?u`<wui-shimmer
202
- width="65px"
203
- height="20px"
204
- borderRadius="xxs"
205
- variant="light"
206
- ></wui-shimmer>`:u`
207
- <wui-text variant="md-regular" color="secondary">
208
- ${this.tokenAmount.toFixed(4)} ${(e=this.paymentAsset)==null?void 0:e.metadata.symbol}
209
- </wui-text>
210
- `}async onExchangeClick(e){if(!this.amount){b.showError("Please enter an amount");return}await a.handlePayWithExchange(e.id)}handlePaymentInProgress(){var n,o;const e=y.state.activeChain,{redirectView:s="Account"}=f.state.data??{};this.isPaymentInProgress&&((n=this.currentPayment)!=null&&n.exchangeId)&&((o=this.currentPayment)!=null&&o.sessionId)&&this.paymentId&&(a.waitUntilComplete({exchangeId:this.currentPayment.exchangeId,sessionId:this.currentPayment.sessionId,paymentId:this.paymentId}).then(i=>{i.status==="SUCCESS"?(b.showSuccess("Deposit completed"),a.reset(),e&&(y.fetchTokenBalance(),S.updateBalance(e)),f.replace("Transactions")):i.status==="FAILED"&&b.showError("Deposit failed")}),b.showLoading("Deposit in progress..."),f.replace(s))}onAmountChange({detail:e}){a.setAmount(e?Number(e):null)}async getPaymentAssets(){this.network&&await a.getAssetsForNetwork(this.network.caipNetworkId)}async setDefaultPaymentAsset(){if(this.network){const e=await a.getAssetsForNetwork(this.network.caipNetworkId);e[0]&&a.setPaymentAsset(e[0])}}};l.styles=R;m([d()],l.prototype,"network",void 0);m([d()],l.prototype,"exchanges",void 0);m([d()],l.prototype,"isLoading",void 0);m([d()],l.prototype,"amount",void 0);m([d()],l.prototype,"tokenAmount",void 0);m([d()],l.prototype,"priceLoading",void 0);m([d()],l.prototype,"isPaymentInProgress",void 0);m([d()],l.prototype,"currentPayment",void 0);m([d()],l.prototype,"paymentId",void 0);m([d()],l.prototype,"paymentAsset",void 0);l=m([$("w3m-deposit-from-exchange-view")],l);const O=A`
211
- .contentContainer {
212
- height: 440px;
213
- overflow: scroll;
214
- scrollbar-width: none;
215
- }
216
-
217
- .contentContainer::-webkit-scrollbar {
218
- display: none;
219
- }
220
-
221
- wui-icon-box {
222
- width: 40px;
223
- height: 40px;
224
- border-radius: ${({borderRadius:t})=>t[3]};
225
- }
226
- `;var k=function(t,e,s,n){var o=arguments.length,i=o<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,s):n,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,s,n);else for(var c=t.length-1;c>=0;c--)(r=t[c])&&(i=(o<3?r(i):o>3?r(e,s,i):r(e,s))||i);return o>3&&i&&Object.defineProperty(e,s,i),i};let x=class extends v{constructor(){super(),this.unsubscribe=[],this.assets=a.state.assets,this.search="",this.onDebouncedSearch=_.debounce(e=>{this.search=e}),this.unsubscribe.push(a.subscribe(e=>{this.assets=e.assets}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return u`
227
- <wui-flex flexDirection="column">
228
- ${this.templateSearchInput()} <wui-separator></wui-separator> ${this.templateTokens()}
229
- </wui-flex>
230
- `}templateSearchInput(){return u`
231
- <wui-flex gap="2" padding="3">
232
- <wui-input-text
233
- @inputChange=${this.onInputChange.bind(this)}
234
- class="network-search-input"
235
- size="sm"
236
- placeholder="Search token"
237
- icon="search"
238
- ></wui-input-text>
239
- </wui-flex>
240
- `}templateTokens(){const e=this.assets.filter(n=>n.metadata.name.toLowerCase().includes(this.search.toLowerCase())),s=e.length>0;return u`
241
- <wui-flex
242
- class="contentContainer"
243
- flexDirection="column"
244
- .padding=${["0","3","0","3"]}
245
- >
246
- <wui-flex justifyContent="flex-start" .padding=${["4","3","3","3"]}>
247
- <wui-text variant="md-medium" color="secondary">Available tokens</wui-text>
248
- </wui-flex>
249
- <wui-flex flexDirection="column" gap="2">
250
- ${s?e.map(n=>u`<wui-list-item
251
- .imageSrc=${n.metadata.iconUrl}
252
- ?clickable=${!0}
253
- @click=${this.handleTokenClick.bind(this,n)}
254
- >
255
- <wui-text variant="md-medium" color="primary">${n.metadata.name}</wui-text>
256
- <wui-text variant="md-regular" color="secondary"
257
- >${n.metadata.symbol}</wui-text
258
- >
259
- </wui-list-item>`):u`<wui-flex
260
- .padding=${["20","0","0","0"]}
261
- alignItems="center"
262
- flexDirection="column"
263
- gap="4"
264
- >
265
- <wui-icon-box icon="coinPlaceholder" color="default" size="lg"></wui-icon-box>
266
- <wui-flex
267
- class="textContent"
268
- gap="2"
269
- flexDirection="column"
270
- justifyContent="center"
271
- >
272
- <wui-text variant="lg-medium" align="center" color="primary">
273
- No tokens found
274
- </wui-text>
275
- </wui-flex>
276
- <wui-link @click=${this.onBuyClick.bind(this)}>Buy</wui-link>
277
- </wui-flex>`}
278
- </wui-flex>
279
- </wui-flex>
280
- `}onBuyClick(){f.push("OnRampProviders")}onInputChange(e){this.onDebouncedSearch(e.detail)}handleTokenClick(e){a.setPaymentAsset(e),f.goBack()}};x.styles=O;k([d()],x.prototype,"assets",void 0);k([d()],x.prototype,"search",void 0);x=k([$("w3m-deposit-from-exchange-select-asset-view")],x);export{x as W3mDepositFromExchangeSelectAssetView,l as W3mDepositFromExchangeView};
@@ -1,27 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2019 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */const O=globalThis,j=O.ShadowRoot&&(O.ShadyCSS===void 0||O.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,k=Symbol(),L=new WeakMap;let nt=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==k)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(j&&t===void 0){const s=e!==void 0&&e.length===1;s&&(t=L.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&L.set(e,t))}return t}toString(){return this.cssText}};const pt=r=>new nt(typeof r=="string"?r:r+"",void 0,k),It=(r,...t)=>{const e=r.length===1?r[0]:t.reduce((s,i,o)=>s+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+r[o+1],r[0]);return new nt(e,r,k)},$t=(r,t)=>{if(j)r.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const e of t){const s=document.createElement("style"),i=O.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=e.cssText,r.appendChild(s)}},I=j?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return pt(e)})(r):r;/**
6
- * @license
7
- * Copyright 2017 Google LLC
8
- * SPDX-License-Identifier: BSD-3-Clause
9
- */const{is:_t,defineProperty:ft,getOwnPropertyDescriptor:vt,getOwnPropertyNames:At,getOwnPropertySymbols:yt,getPrototypeOf:mt}=Object,m=globalThis,B=m.trustedTypes,gt=B?B.emptyScript:"",V=m.reactiveElementPolyfillSupport,S=(r,t)=>r,T={toAttribute(r,t){switch(t){case Boolean:r=r?gt:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,t){let e=r;switch(t){case Boolean:e=r!==null;break;case Number:e=r===null?null:Number(r);break;case Object:case Array:try{e=JSON.parse(r)}catch{e=null}}return e}},z=(r,t)=>!_t(r,t),W={attribute:!0,type:String,converter:T,reflect:!1,hasChanged:z};Symbol.metadata!=null||(Symbol.metadata=Symbol("metadata")),m.litPropertyMetadata!=null||(m.litPropertyMetadata=new WeakMap);class y extends HTMLElement{static addInitializer(t){var e;this._$Ei(),((e=this.l)!=null?e:this.l=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=W){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(t,s,e);i!==void 0&&ft(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){var i;const{get:o,set:n}=(i=vt(this.prototype,t))!=null?i:{get(){return this[e]},set(l){this[e]=l}};return{get(){return o==null?void 0:o.call(this)},set(l){const a=o==null?void 0:o.call(this);n.call(this,l),this.requestUpdate(t,a,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){var e;return(e=this.elementProperties.get(t))!=null?e:W}static _$Ei(){if(this.hasOwnProperty(S("elementProperties")))return;const t=mt(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(S("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(S("properties"))){const e=this.properties,s=[...At(e),...yt(e)];for(const i of s)this.createProperty(i,e[i])}const t=this[Symbol.metadata];if(t!==null){const e=litPropertyMetadata.get(t);if(e!==void 0)for(const[s,i]of e)this.elementProperties.set(s,i)}this._$Eh=new Map;for(const[e,s]of this.elementProperties){const i=this._$Eu(e,s);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const i of s)e.unshift(I(i))}else t!==void 0&&e.push(I(t));return e}static _$Eu(t,e){const s=e.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(e=>e(this))}addController(t){var e,s;((e=this._$EO)!=null?e:this._$EO=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&((s=t.hostConnected)==null||s.call(t))}removeController(t){var e;(e=this._$EO)==null||e.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){var t;const e=(t=this.shadowRoot)!=null?t:this.attachShadow(this.constructor.shadowRootOptions);return $t(e,this.constructor.elementStyles),e}connectedCallback(){var t;this.renderRoot!=null||(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$EO)==null||t.forEach(e=>{var s;return(s=e.hostConnected)==null?void 0:s.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(e=>{var s;return(s=e.hostDisconnected)==null?void 0:s.call(e)})}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$EC(t,e){var s;const i=this.constructor.elementProperties.get(t),o=this.constructor._$Eu(t,i);if(o!==void 0&&i.reflect===!0){const n=(((s=i.converter)==null?void 0:s.toAttribute)!==void 0?i.converter:T).toAttribute(e,i.type);this._$Em=t,n==null?this.removeAttribute(o):this.setAttribute(o,n),this._$Em=null}}_$AK(t,e){var s;const i=this.constructor,o=i._$Eh.get(t);if(o!==void 0&&this._$Em!==o){const n=i.getPropertyOptions(o),l=typeof n.converter=="function"?{fromAttribute:n.converter}:((s=n.converter)==null?void 0:s.fromAttribute)!==void 0?n.converter:T;this._$Em=o,this[o]=l.fromAttribute(e,n.type),this._$Em=null}}requestUpdate(t,e,s){var i;if(t!==void 0){if(s!=null||(s=this.constructor.getPropertyOptions(t)),!((i=s.hasChanged)!=null?i:z)(this[t],e))return;this.P(t,e,s)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,e,s){var i;this._$AL.has(t)||this._$AL.set(t,e),s.reflect===!0&&this._$Em!==t&&((i=this._$Ej)!=null?i:this._$Ej=new Set).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot!=null||(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[o,n]of this._$Ep)this[o]=n;this._$Ep=void 0}const i=this.constructor.elementProperties;if(i.size>0)for(const[o,n]of i)n.wrapped!==!0||this._$AL.has(o)||this[o]===void 0||this.P(o,this[o],n)}let e=!1;const s=this._$AL;try{e=this.shouldUpdate(s),e?(this.willUpdate(s),(t=this._$EO)==null||t.forEach(i=>{var o;return(o=i.hostUpdate)==null?void 0:o.call(i)}),this.update(s)):this._$EU()}catch(i){throw e=!1,this._$EU(),i}e&&this._$AE(s)}willUpdate(t){}_$AE(t){var e;(e=this._$EO)==null||e.forEach(s=>{var i;return(i=s.hostUpdated)==null?void 0:i.call(s)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}}var q;y.elementStyles=[],y.shadowRootOptions={mode:"open"},y[S("elementProperties")]=new Map,y[S("finalized")]=new Map,V==null||V({ReactiveElement:y}),((q=m.reactiveElementVersions)!=null?q:m.reactiveElementVersions=[]).push("2.0.4");/**
10
- * @license
11
- * Copyright 2017 Google LLC
12
- * SPDX-License-Identifier: BSD-3-Clause
13
- */const H=globalThis,M=H.trustedTypes,J=M?M.createPolicy("lit-html",{createHTML:r=>r}):void 0,ot="$lit$",_=`lit$${Math.random().toFixed(9).slice(2)}$`,lt="?"+_,bt=`<${lt}>`,A=document,w=()=>A.createComment(""),P=r=>r===null||typeof r!="object"&&typeof r!="function",at=Array.isArray,Et=r=>at(r)||typeof(r==null?void 0:r[Symbol.iterator])=="function",R=`[
14
- \f\r]`,E=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,K=/-->/g,Z=/>/g,f=RegExp(`>|${R}(?:([^\\s"'>=/]+)(${R}*=${R}*(?:[^
15
- \f\r"'\`<>=]|("|')|))|$)`,"g"),F=/'/g,G=/"/g,ht=/^(?:script|style|textarea|title)$/i,ct=r=>(t,...e)=>({_$litType$:r,strings:t,values:e}),Bt=ct(1),Vt=ct(2),g=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),Q=new WeakMap,v=A.createTreeWalker(A,129);function ut(r,t){if(!Array.isArray(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return J!==void 0?J.createHTML(t):t}const St=(r,t)=>{const e=r.length-1,s=[];let i,o=t===2?"<svg>":"",n=E;for(let l=0;l<e;l++){const a=r[l];let h,u,c=-1,p=0;for(;p<a.length&&(n.lastIndex=p,u=n.exec(a),u!==null);)p=n.lastIndex,n===E?u[1]==="!--"?n=K:u[1]!==void 0?n=Z:u[2]!==void 0?(ht.test(u[2])&&(i=RegExp("</"+u[2],"g")),n=f):u[3]!==void 0&&(n=f):n===f?u[0]===">"?(n=i??E,c=-1):u[1]===void 0?c=-2:(c=n.lastIndex-u[2].length,h=u[1],n=u[3]===void 0?f:u[3]==='"'?G:F):n===G||n===F?n=f:n===K||n===Z?n=E:(n=f,i=void 0);const $=n===f&&r[l+1].startsWith("/>")?" ":"";o+=n===E?a+bt:c>=0?(s.push(h),a.slice(0,c)+ot+a.slice(c)+_+$):a+_+(c===-2?l:$)}return[ut(r,o+(r[e]||"<?>")+(t===2?"</svg>":"")),s]};class C{constructor({strings:t,_$litType$:e},s){let i;this.parts=[];let o=0,n=0;const l=t.length-1,a=this.parts,[h,u]=St(t,e);if(this.el=C.createElement(h,s),v.currentNode=this.el.content,e===2){const c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(i=v.nextNode())!==null&&a.length<l;){if(i.nodeType===1){if(i.hasAttributes())for(const c of i.getAttributeNames())if(c.endsWith(ot)){const p=u[n++],$=i.getAttribute(c).split(_),U=/([.?@])?(.*)/.exec(p);a.push({type:1,index:o,name:U[2],strings:$,ctor:U[1]==="."?Pt:U[1]==="?"?Ct:U[1]==="@"?Ut:N}),i.removeAttribute(c)}else c.startsWith(_)&&(a.push({type:6,index:o}),i.removeAttribute(c));if(ht.test(i.tagName)){const c=i.textContent.split(_),p=c.length-1;if(p>0){i.textContent=M?M.emptyScript:"";for(let $=0;$<p;$++)i.append(c[$],w()),v.nextNode(),a.push({type:2,index:++o});i.append(c[p],w())}}}else if(i.nodeType===8)if(i.data===lt)a.push({type:2,index:o});else{let c=-1;for(;(c=i.data.indexOf(_,c+1))!==-1;)a.push({type:7,index:o}),c+=_.length-1}o++}}static createElement(t,e){const s=A.createElement("template");return s.innerHTML=t,s}}function b(r,t,e=r,s){var i,o,n;if(t===g)return t;let l=s!==void 0?(i=e._$Co)==null?void 0:i[s]:e._$Cl;const a=P(t)?void 0:t._$litDirective$;return(l==null?void 0:l.constructor)!==a&&((o=l==null?void 0:l._$AO)==null||o.call(l,!1),a===void 0?l=void 0:(l=new a(r),l._$AT(r,e,s)),s!==void 0?((n=e._$Co)!=null?n:e._$Co=[])[s]=l:e._$Cl=l),l!==void 0&&(t=b(r,l._$AS(r,t.values),l,s)),t}class wt{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var e;const{el:{content:s},parts:i}=this._$AD,o=((e=t==null?void 0:t.creationScope)!=null?e:A).importNode(s,!0);v.currentNode=o;let n=v.nextNode(),l=0,a=0,h=i[0];for(;h!==void 0;){if(l===h.index){let u;h.type===2?u=new D(n,n.nextSibling,this,t):h.type===1?u=new h.ctor(n,h.name,h.strings,this,t):h.type===6&&(u=new Ot(n,this,t)),this._$AV.push(u),h=i[++a]}l!==(h==null?void 0:h.index)&&(n=v.nextNode(),l++)}return v.currentNode=A,o}p(t){let e=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}let D=class dt{get _$AU(){var t,e;return(e=(t=this._$AM)==null?void 0:t._$AU)!=null?e:this._$Cv}constructor(t,e,s,i){var o;this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=i,this._$Cv=(o=i==null?void 0:i.isConnected)!=null?o:!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=b(this,t,e),P(t)?t===d||t==null||t===""?(this._$AH!==d&&this._$AR(),this._$AH=d):t!==this._$AH&&t!==g&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Et(t)?this.k(t):this._(t)}S(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.S(t))}_(t){this._$AH!==d&&P(this._$AH)?this._$AA.nextSibling.data=t:this.T(A.createTextNode(t)),this._$AH=t}$(t){var e;const{values:s,_$litType$:i}=t,o=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=C.createElement(ut(i.h,i.h[0]),this.options)),i);if(((e=this._$AH)==null?void 0:e._$AD)===o)this._$AH.p(s);else{const n=new wt(o,this),l=n.u(this.options);n.p(s),this.T(l),this._$AH=n}}_$AC(t){let e=Q.get(t.strings);return e===void 0&&Q.set(t.strings,e=new C(t)),e}k(t){at(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,i=0;for(const o of t)i===e.length?e.push(s=new dt(this.S(w()),this.S(w()),this,this.options)):s=e[i],s._$AI(o),i++;i<e.length&&(this._$AR(s&&s._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){var s;for((s=this._$AP)==null?void 0:s.call(this,!1,!0,e);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}};class N{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,i,o){this.type=1,this._$AH=d,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=o,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=d}_$AI(t,e=this,s,i){const o=this.strings;let n=!1;if(o===void 0)t=b(this,t,e,0),n=!P(t)||t!==this._$AH&&t!==g,n&&(this._$AH=t);else{const l=t;let a,h;for(t=o[0],a=0;a<o.length-1;a++)h=b(this,l[s+a],e,a),h===g&&(h=this._$AH[a]),n||(n=!P(h)||h!==this._$AH[a]),h===d?t=d:t!==d&&(t+=(h??"")+o[a+1]),this._$AH[a]=h}n&&!i&&this.j(t)}j(t){t===d?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class Pt extends N{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===d?void 0:t}}class Ct extends N{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==d)}}class Ut extends N{constructor(t,e,s,i,o){super(t,e,s,i,o),this.type=5}_$AI(t,e=this){var s;if((t=(s=b(this,t,e,0))!=null?s:d)===g)return;const i=this._$AH,o=t===d&&i!==d||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,n=t!==d&&(i===d||o);o&&this.element.removeEventListener(this.name,this,i),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,s;typeof this._$AH=="function"?this._$AH.call((s=(e=this.options)==null?void 0:e.host)!=null?s:this.element,t):this._$AH.handleEvent(t)}}class Ot{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){b(this,t)}}const X=H.litHtmlPolyfillSupport;var Y;X==null||X(C,D),((Y=H.litHtmlVersions)!=null?Y:H.litHtmlVersions=[]).push("3.1.4");const xt=(r,t,e)=>{var s,i;const o=(s=e==null?void 0:e.renderBefore)!=null?s:t;let n=o._$litPart$;if(n===void 0){const l=(i=e==null?void 0:e.renderBefore)!=null?i:null;o._$litPart$=n=new D(t.insertBefore(w(),l),l,void 0,e??{})}return n._$AI(r),n};/**
16
- * @license
17
- * Copyright 2017 Google LLC
18
- * SPDX-License-Identifier: BSD-3-Clause
19
- */class x extends y{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;const e=super.createRenderRoot();return(t=this.renderOptions).renderBefore!=null||(t.renderBefore=e.firstChild),e}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=xt(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)==null||t.setConnected(!1)}render(){return g}}var tt;x._$litElement$=!0,x.finalized=!0,(tt=globalThis.litElementHydrateSupport)==null||tt.call(globalThis,{LitElement:x});const et=globalThis.litElementPolyfillSupport;et==null||et({LitElement:x});var st;((st=globalThis.litElementVersions)!=null?st:globalThis.litElementVersions=[]).push("4.0.6");/**
20
- * @license
21
- * Copyright 2017 Google LLC
22
- * SPDX-License-Identifier: BSD-3-Clause
23
- */const Wt=r=>(t,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(r,t)}):customElements.define(r,t)};var Tt=Object.defineProperty,Ht=Object.defineProperties,Mt=Object.getOwnPropertyDescriptors,it=Object.getOwnPropertySymbols,Nt=Object.prototype.hasOwnProperty,Rt=Object.prototype.propertyIsEnumerable,rt=(r,t,e)=>t in r?Tt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,jt=(r,t)=>{for(var e in t||(t={}))Nt.call(t,e)&&rt(r,e,t[e]);if(it)for(var e of it(t))Rt.call(t,e)&&rt(r,e,t[e]);return r},kt=(r,t)=>Ht(r,Mt(t));/**
24
- * @license
25
- * Copyright 2017 Google LLC
26
- * SPDX-License-Identifier: BSD-3-Clause
27
- */const zt={attribute:!0,type:String,converter:T,reflect:!1,hasChanged:z},Dt=(r=zt,t,e)=>{const{kind:s,metadata:i}=e;let o=globalThis.litPropertyMetadata.get(i);if(o===void 0&&globalThis.litPropertyMetadata.set(i,o=new Map),o.set(e.name,r),s==="accessor"){const{name:n}=e;return{set(l){const a=t.get.call(this);t.set.call(this,l),this.requestUpdate(n,a,r)},init(l){return l!==void 0&&this.P(n,void 0,r),l}}}if(s==="setter"){const{name:n}=e;return function(l){const a=this[n];t.call(this,l),this.requestUpdate(n,a,r)}}throw Error("Unsupported decorator location: "+s)};function qt(r){return(t,e)=>typeof e=="object"?Dt(r,t,e):((s,i,o)=>{const n=i.hasOwnProperty(o);return i.constructor.createProperty(o,n?kt(jt({},s),{wrapped:!0}):s),n?Object.getOwnPropertyDescriptor(i,o):void 0})(r,t,e)}export{qt as O,Bt as Y,x as n,It as p,Wt as s,Vt as t};
@@ -1,131 +0,0 @@
1
- import{y as k,z as v,D as N,F as x,G as $,I as C,J as u,k as c,S as h,a1 as m,U as R,a2 as f,a3 as A,j as S,W as I,R as T,n as O,a4 as b}from"./index-5jd8RPN9.js";const _=k`
2
- button {
3
- width: 100%;
4
- display: flex;
5
- align-items: center;
6
- justify-content: space-between;
7
- gap: ${({spacing:e})=>e[4]};
8
- background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
9
- border-radius: ${({borderRadius:e})=>e[3]};
10
- border: none;
11
- padding: ${({spacing:e})=>e[3]};
12
- transition: background-color ${({durations:e})=>e.lg}
13
- ${({easings:e})=>e["ease-out-power-2"]};
14
- will-change: background-color;
15
- }
16
-
17
- /* -- Hover & Active states ----------------------------------------------------------- */
18
- button:hover:enabled,
19
- button:active:enabled {
20
- background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
21
- }
22
-
23
- wui-text {
24
- flex: 1;
25
- color: ${({tokens:e})=>e.theme.textSecondary};
26
- }
27
-
28
- wui-flex {
29
- width: auto;
30
- display: flex;
31
- align-items: center;
32
- gap: ${({spacing:e})=>e["01"]};
33
- }
34
-
35
- wui-icon {
36
- color: ${({tokens:e})=>e.theme.iconDefault};
37
- }
38
-
39
- .network-icon {
40
- position: relative;
41
- width: 20px;
42
- height: 20px;
43
- border-radius: ${({borderRadius:e})=>e[4]};
44
- overflow: hidden;
45
- margin-left: -8px;
46
- }
47
-
48
- .network-icon:first-child {
49
- margin-left: 0px;
50
- }
51
-
52
- .network-icon:after {
53
- position: absolute;
54
- inset: 0;
55
- content: '';
56
- display: block;
57
- height: 100%;
58
- width: 100%;
59
- border-radius: ${({borderRadius:e})=>e[4]};
60
- box-shadow: inset 0 0 0 1px ${({tokens:e})=>e.core.glass010};
61
- }
62
- `;var g=function(e,t,o,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,o):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(e,t,o,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(r=(s<3?n(r):s>3?n(t,o,r):n(t,o))||r);return s>3&&r&&Object.defineProperty(t,o,r),r};let p=class extends C{constructor(){super(...arguments),this.networkImages=[""],this.text=""}render(){return u`
63
- <button>
64
- <wui-text variant="md-regular" color="inherit">${this.text}</wui-text>
65
- <wui-flex>
66
- ${this.networksTemplate()}
67
- <wui-icon name="chevronRight" size="sm" color="inherit"></wui-icon>
68
- </wui-flex>
69
- </button>
70
- `}networksTemplate(){const t=this.networkImages.slice(0,5);return u` <wui-flex class="networks">
71
- ${t==null?void 0:t.map(o=>u` <wui-flex class="network-icon"> <wui-image src=${o}></wui-image> </wui-flex>`)}
72
- </wui-flex>`}};p.styles=[v,N,_];g([x({type:Array})],p.prototype,"networkImages",void 0);g([x()],p.prototype,"text",void 0);p=g([$("wui-compatible-network")],p);const E=k`
73
- wui-compatible-network {
74
- margin-top: ${({spacing:e})=>e[4]};
75
- width: 100%;
76
- }
77
-
78
- wui-qr-code {
79
- width: unset !important;
80
- height: unset !important;
81
- }
82
-
83
- wui-icon {
84
- align-items: normal;
85
- }
86
- `;var w=function(e,t,o,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,o):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(e,t,o,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(r=(s<3?n(r):s>3?n(t,o,r):n(t,o))||r);return s>3&&r&&Object.defineProperty(t,o,r),r};let d=class extends C{constructor(){var t,o;super(),this.unsubscribe=[],this.address=(t=c.getAccountData())==null?void 0:t.address,this.profileName=(o=c.getAccountData())==null?void 0:o.profileName,this.network=c.state.activeCaipNetwork,this.unsubscribe.push(c.subscribeChainProp("accountState",i=>{i?(this.address=i.address,this.profileName=i.profileName):h.showError("Account not found")}),c.subscribeKey("activeCaipNetwork",i=>{i!=null&&i.id&&(this.network=i)}))}disconnectedCallback(){this.unsubscribe.forEach(t=>t())}render(){if(!this.address)throw new Error("w3m-wallet-receive-view: No account provided");const t=m.getNetworkImage(this.network);return u` <wui-flex
87
- flexDirection="column"
88
- .padding=${["0","4","4","4"]}
89
- alignItems="center"
90
- >
91
- <wui-chip-button
92
- data-testid="receive-address-copy-button"
93
- @click=${this.onCopyClick.bind(this)}
94
- text=${R.getTruncateString({string:this.profileName||this.address||"",charsStart:this.profileName?18:4,charsEnd:this.profileName?0:4,truncate:this.profileName?"end":"middle"})}
95
- icon="copy"
96
- size="sm"
97
- imageSrc=${t||""}
98
- variant="gray"
99
- ></wui-chip-button>
100
- <wui-flex
101
- flexDirection="column"
102
- .padding=${["4","0","0","0"]}
103
- alignItems="center"
104
- gap="4"
105
- >
106
- <wui-qr-code
107
- size=${232}
108
- theme=${f.state.themeMode}
109
- uri=${this.address}
110
- ?arenaClear=${!0}
111
- color=${A(f.state.themeVariables["--apkt-qr-color"]??f.state.themeVariables["--w3m-qr-color"])}
112
- data-testid="wui-qr-code"
113
- ></wui-qr-code>
114
- <wui-text variant="lg-regular" color="primary" align="center">
115
- Copy your address or scan this QR code
116
- </wui-text>
117
- <wui-button @click=${this.onCopyClick.bind(this)} size="sm" variant="neutral-secondary">
118
- <wui-icon slot="iconLeft" size="sm" color="inherit" name="copy"></wui-icon>
119
- <wui-text variant="md-regular" color="inherit">Copy address</wui-text>
120
- </wui-button>
121
- </wui-flex>
122
- ${this.networkTemplate()}
123
- </wui-flex>`}networkTemplate(){var a;const t=c.getAllRequestedCaipNetworks(),o=c.checkIfSmartAccountEnabled(),i=c.state.activeCaipNetwork,s=t.filter(l=>(l==null?void 0:l.chainNamespace)===(i==null?void 0:i.chainNamespace));if(S(i==null?void 0:i.chainNamespace)===I.ACCOUNT_TYPES.SMART_ACCOUNT&&o)return i?u`<wui-compatible-network
124
- @click=${this.onReceiveClick.bind(this)}
125
- text="Only receive assets on this network"
126
- .networkImages=${[m.getNetworkImage(i)??""]}
127
- ></wui-compatible-network>`:null;const n=((a=s==null?void 0:s.filter(l=>{var y;return(y=l==null?void 0:l.assets)==null?void 0:y.imageId}))==null?void 0:a.slice(0,5)).map(m.getNetworkImage).filter(Boolean);return u`<wui-compatible-network
128
- @click=${this.onReceiveClick.bind(this)}
129
- text="Only receive assets on these networks"
130
- .networkImages=${n}
131
- ></wui-compatible-network>`}onReceiveClick(){T.push("WalletCompatibleNetworks")}onCopyClick(){try{this.address&&(O.copyToClopboard(this.address),h.showSuccess("Address copied"))}catch{h.showError("Failed to copy")}}};d.styles=E;w([b()],d.prototype,"address",void 0);w([b()],d.prototype,"profileName",void 0);w([b()],d.prototype,"network",void 0);d=w([$("w3m-wallet-receive-view")],d);export{d as W3mWalletReceiveView};