@shapeshiftoss/swap-widget 0.0.2

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 (157) hide show
  1. package/Dockerfile +87 -0
  2. package/README.md +519 -0
  3. package/dist/assets/PhArrowCircleDown-B305t-Sh.js +14 -0
  4. package/dist/assets/PhArrowClockwise-CJPxQhr_.js +14 -0
  5. package/dist/assets/PhArrowDown-C4hT9BVu.js +14 -0
  6. package/dist/assets/PhArrowLeft-Way4Cu-r.js +14 -0
  7. package/dist/assets/PhArrowRight-Cp5ZME0F.js +14 -0
  8. package/dist/assets/PhArrowSquareOut-NnrK69c5.js +14 -0
  9. package/dist/assets/PhArrowUp-Dph6j8rm.js +14 -0
  10. package/dist/assets/PhArrowUpRight-BpJjRRRh.js +14 -0
  11. package/dist/assets/PhArrowsClockwise-CFUT8X7R.js +14 -0
  12. package/dist/assets/PhArrowsDownUp-BjBI4ckC.js +14 -0
  13. package/dist/assets/PhArrowsLeftRight-CuLpbKRk.js +14 -0
  14. package/dist/assets/PhBank-Dchr4XQJ.js +14 -0
  15. package/dist/assets/PhBrowser-dUu2TrC1.js +14 -0
  16. package/dist/assets/PhCaretDown-78IuKU3V.js +14 -0
  17. package/dist/assets/PhCaretLeft-_aiyH7n1.js +14 -0
  18. package/dist/assets/PhCaretRight-8zJQEuDX.js +14 -0
  19. package/dist/assets/PhCaretUp-CiCxKWwN.js +14 -0
  20. package/dist/assets/PhCheck-CcADx8br.js +14 -0
  21. package/dist/assets/PhCircleHalf-BYzSzd2h.js +14 -0
  22. package/dist/assets/PhClock-UItiXeJq.js +14 -0
  23. package/dist/assets/PhCompass-CUy3uA7t.js +14 -0
  24. package/dist/assets/PhCopy-C-PDgSlZ.js +14 -0
  25. package/dist/assets/PhCreditCard-CWRaUT6F.js +14 -0
  26. package/dist/assets/PhCurrencyDollar-Cqla3AXT.js +14 -0
  27. package/dist/assets/PhDesktop-BBIPrYLl.js +14 -0
  28. package/dist/assets/PhDeviceMobile-BdsPaATg.js +14 -0
  29. package/dist/assets/PhDotsThree-BMXCQl-0.js +14 -0
  30. package/dist/assets/PhEnvelope-yUsis6yU.js +14 -0
  31. package/dist/assets/PhFunnelSimple-Ba7BbWTp.js +14 -0
  32. package/dist/assets/PhGlobe-DgLxBk5U.js +14 -0
  33. package/dist/assets/PhIdentificationCard-Czjmq9Z3.js +14 -0
  34. package/dist/assets/PhImage-BAJ_erz6.js +14 -0
  35. package/dist/assets/PhInfo-Cr4DhVUE.js +14 -0
  36. package/dist/assets/PhLightbulb-BX_7duTr.js +14 -0
  37. package/dist/assets/PhMagnifyingGlass-Mygfryvz.js +14 -0
  38. package/dist/assets/PhPaperPlaneRight-BeuCA660.js +14 -0
  39. package/dist/assets/PhPlus-BMjcHjsT.js +14 -0
  40. package/dist/assets/PhPower-CGffGmdb.js +14 -0
  41. package/dist/assets/PhPuzzlePiece-wm_GpVSi.js +14 -0
  42. package/dist/assets/PhQrCode-DRwRzXCH.js +14 -0
  43. package/dist/assets/PhQuestion-M09j2U0T.js +14 -0
  44. package/dist/assets/PhQuestionMark-BP9EMB6h.js +14 -0
  45. package/dist/assets/PhSealCheck-BfG80yKn.js +14 -0
  46. package/dist/assets/PhSignOut-C5YOWlPT.js +14 -0
  47. package/dist/assets/PhSpinner-BXooDYzU.js +14 -0
  48. package/dist/assets/PhTrash-Biq6rmmL.js +14 -0
  49. package/dist/assets/PhUser-CAgZSpGe.js +14 -0
  50. package/dist/assets/PhVault-l2PHF38a.js +14 -0
  51. package/dist/assets/PhWallet-w25D16It.js +14 -0
  52. package/dist/assets/PhWarning-DPEydIPw.js +14 -0
  53. package/dist/assets/PhWarningCircle-BqjT745H.js +14 -0
  54. package/dist/assets/PhX-s-SmVExa.js +14 -0
  55. package/dist/assets/SwapController-If0bFrNc.js +1 -0
  56. package/dist/assets/ccip-BBB7uCdL.js +1 -0
  57. package/dist/assets/ccip-CkkdfKKI.js +1 -0
  58. package/dist/assets/data-capture-D4gAy-Yc.js +242 -0
  59. package/dist/assets/email-B1AJehis.js +90 -0
  60. package/dist/assets/embedded-wallet-Q6DQopDk.js +410 -0
  61. package/dist/assets/features-B6JAPAFb.js +5 -0
  62. package/dist/assets/index-5jd8RPN9.js +7428 -0
  63. package/dist/assets/index-B4kNtSTk.js +1080 -0
  64. package/dist/assets/index-B753eAob.js +1 -0
  65. package/dist/assets/index-BZoLTv77.js +3 -0
  66. package/dist/assets/index-Bcw9UURX.js +3 -0
  67. package/dist/assets/index-BkrV-ahK.js +2 -0
  68. package/dist/assets/index-CRQzQ_up.js +9 -0
  69. package/dist/assets/index-CSW0Gt5y.js +132 -0
  70. package/dist/assets/index-CZ4jTIsk.js +138 -0
  71. package/dist/assets/index-Cwa8SB3h.js +61 -0
  72. package/dist/assets/index-DEwQgT4r.js +78 -0
  73. package/dist/assets/index-DVfQiQ1d.js +1 -0
  74. package/dist/assets/index-cV3UdaMs.css +1 -0
  75. package/dist/assets/index-hAmu622O.js +43 -0
  76. package/dist/assets/onramp-XcPNCLRU.js +422 -0
  77. package/dist/assets/pay-with-exchange-BeHt4OF4.js +280 -0
  78. package/dist/assets/property-C9JG5tag.js +27 -0
  79. package/dist/assets/receive-7ff4he2S.js +131 -0
  80. package/dist/assets/send-CkMBIRXT.js +554 -0
  81. package/dist/assets/socials-DmmxuLrP.js +250 -0
  82. package/dist/assets/swaps-IHAYRQ0x.js +1050 -0
  83. package/dist/assets/transactions-9Cxdk7o9.js +16 -0
  84. package/dist/assets/v4-BOvFkHkt.js +1 -0
  85. package/dist/assets/w3m-modal-kJzFnBfB.js +891 -0
  86. package/dist/assets/wallet-standard-Dv8LMoUB.js +1 -0
  87. package/dist/favicon.png +0 -0
  88. package/dist/favicon.svg +11 -0
  89. package/dist/icon-192x192.png +0 -0
  90. package/dist/icon-512x512.png +0 -0
  91. package/dist/index.html +33 -0
  92. package/index.html +32 -0
  93. package/package.json +59 -0
  94. package/public/favicon.png +0 -0
  95. package/public/favicon.svg +11 -0
  96. package/public/icon-192x192.png +0 -0
  97. package/public/icon-512x512.png +0 -0
  98. package/railway.toml +10 -0
  99. package/src/api/client.ts +95 -0
  100. package/src/components/AddressInputModal.css +173 -0
  101. package/src/components/AddressInputModal.tsx +250 -0
  102. package/src/components/ApprovalStep.tsx +92 -0
  103. package/src/components/ExecutionStep.tsx +27 -0
  104. package/src/components/InputStep.tsx +431 -0
  105. package/src/components/QuoteSelector.css +146 -0
  106. package/src/components/QuoteSelector.tsx +137 -0
  107. package/src/components/QuotesModal.css +250 -0
  108. package/src/components/QuotesModal.tsx +182 -0
  109. package/src/components/SettingsModal.css +145 -0
  110. package/src/components/SettingsModal.tsx +180 -0
  111. package/src/components/StatusStep.tsx +139 -0
  112. package/src/components/SwapWidget.css +713 -0
  113. package/src/components/SwapWidget.tsx +607 -0
  114. package/src/components/TokenSelectModal.css +438 -0
  115. package/src/components/TokenSelectModal.tsx +487 -0
  116. package/src/components/WalletProvider.tsx +92 -0
  117. package/src/config/appkit.ts +104 -0
  118. package/src/config/wagmi.ts +27 -0
  119. package/src/constants/chains.ts +72 -0
  120. package/src/constants/defaults.ts +28 -0
  121. package/src/constants/swappers.ts +48 -0
  122. package/src/constants/viemChains.ts +69 -0
  123. package/src/contexts/SwapWalletContext.tsx +25 -0
  124. package/src/demo/App.css +458 -0
  125. package/src/demo/App.tsx +481 -0
  126. package/src/demo/main.tsx +25 -0
  127. package/src/hooks/useAssets.ts +180 -0
  128. package/src/hooks/useBalances.ts +822 -0
  129. package/src/hooks/useBitcoinSigning.ts +276 -0
  130. package/src/hooks/useMarketData.ts +169 -0
  131. package/src/hooks/useSolanaSigning.ts +275 -0
  132. package/src/hooks/useStatusPolling.ts +137 -0
  133. package/src/hooks/useSwapApproval.ts +106 -0
  134. package/src/hooks/useSwapDisplayValues.ts +157 -0
  135. package/src/hooks/useSwapExecution.ts +199 -0
  136. package/src/hooks/useSwapHandlers.ts +119 -0
  137. package/src/hooks/useSwapQuote.ts +71 -0
  138. package/src/hooks/useSwapQuoting.ts +102 -0
  139. package/src/hooks/useSwapRates.ts +61 -0
  140. package/src/index.ts +43 -0
  141. package/src/machines/SwapMachineContext.ts +5 -0
  142. package/src/machines/__tests__/guards.test.ts +228 -0
  143. package/src/machines/__tests__/setup.test.ts +7 -0
  144. package/src/machines/__tests__/swapMachine.test.ts +544 -0
  145. package/src/machines/__tests__/types.test.ts +124 -0
  146. package/src/machines/guards.ts +33 -0
  147. package/src/machines/swapMachine.ts +288 -0
  148. package/src/machines/types.ts +54 -0
  149. package/src/services/transactionStatus.ts +322 -0
  150. package/src/types/index.ts +361 -0
  151. package/src/utils/addressValidation.ts +201 -0
  152. package/src/utils/redirect.ts +45 -0
  153. package/src/vite-env.d.ts +10 -0
  154. package/tsconfig.json +23 -0
  155. package/tsconfig.node.json +10 -0
  156. package/vite.config.ts +101 -0
  157. package/vitest.config.ts +18 -0
@@ -0,0 +1,554 @@
1
+ import{y as x,F as d,a4 as u,G as b,I as v,at as F,n as D,k as g,C as j,aF as l,J as c,au as z,R as h,N as H,U as R,as as q,S as y,r as Q,q as X,a1 as K,z as Y,D as J,a3 as Z,aN as L,aO as M,E as ee}from"./index-5jd8RPN9.js";import"./index-DEwQgT4r.js";import"./index-CZ4jTIsk.js";import{S as G}from"./SwapController-If0bFrNc.js";const te=x`
2
+ :host {
3
+ width: 100%;
4
+ height: 100px;
5
+ border-radius: ${({borderRadius:e})=>e[5]};
6
+ border: 1px solid ${({tokens:e})=>e.theme.foregroundPrimary};
7
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
8
+ transition: background-color ${({durations:e})=>e.lg}
9
+ ${({easings:e})=>e["ease-out-power-1"]};
10
+ will-change: background-color;
11
+ position: relative;
12
+ }
13
+
14
+ :host(:hover) {
15
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
16
+ }
17
+
18
+ wui-flex {
19
+ width: 100%;
20
+ height: fit-content;
21
+ }
22
+
23
+ wui-button {
24
+ display: ruby;
25
+ color: ${({tokens:e})=>e.theme.textPrimary};
26
+ margin: 0 ${({spacing:e})=>e[2]};
27
+ }
28
+
29
+ .instruction {
30
+ position: absolute;
31
+ top: 50%;
32
+ transform: translateY(-50%);
33
+ z-index: 2;
34
+ }
35
+
36
+ .paste {
37
+ display: inline-flex;
38
+ }
39
+
40
+ textarea {
41
+ background: transparent;
42
+ width: 100%;
43
+ font-family: ${({fontFamily:e})=>e.regular};
44
+ font-style: normal;
45
+ font-size: ${({textSize:e})=>e.large};
46
+ font-weight: ${({fontWeight:e})=>e.regular};
47
+ line-height: ${({typography:e})=>e["lg-regular"].lineHeight};
48
+ letter-spacing: ${({typography:e})=>e["lg-regular"].letterSpacing};
49
+ color: ${({tokens:e})=>e.theme.textPrimary};
50
+ caret-color: ${({tokens:e})=>e.core.backgroundAccentPrimary};
51
+ box-sizing: border-box;
52
+ -webkit-appearance: none;
53
+ -moz-appearance: textfield;
54
+ padding: 0px;
55
+ border: none;
56
+ outline: none;
57
+ appearance: none;
58
+ resize: none;
59
+ overflow: hidden;
60
+ }
61
+ `;var E=function(e,t,i,r){var o=arguments.length,n=o<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(n=(o<3?s(n):o>3?s(t,i,n):s(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};let $=class extends v{constructor(){super(...arguments),this.inputElementRef=F(),this.instructionElementRef=F(),this.readOnly=!1,this.instructionHidden=!!this.value,this.pasting=!1,this.onDebouncedSearch=D.debounce(async t=>{if(!t.length){this.setReceiverAddress("");return}const i=g.state.activeChain;if(D.isAddress(t,i)){this.setReceiverAddress(t);return}try{const o=await j.getEnsAddress(t);if(o){l.setReceiverProfileName(t),l.setReceiverAddress(o);const n=await j.getEnsAvatar(t);l.setReceiverProfileImageUrl(n||void 0)}}catch{this.setReceiverAddress(t)}finally{l.setLoading(!1)}})}firstUpdated(){this.value&&(this.instructionHidden=!0),this.checkHidden()}render(){return this.readOnly?c` <wui-flex
62
+ flexDirection="column"
63
+ justifyContent="center"
64
+ gap="01"
65
+ .padding=${["8","4","5","4"]}
66
+ >
67
+ <textarea
68
+ spellcheck="false"
69
+ ?disabled=${!0}
70
+ autocomplete="off"
71
+ .value=${this.value??""}
72
+ >
73
+ ${this.value??""}</textarea
74
+ >
75
+ </wui-flex>`:c` <wui-flex
76
+ @click=${this.onBoxClick.bind(this)}
77
+ flexDirection="column"
78
+ justifyContent="center"
79
+ gap="01"
80
+ .padding=${["8","4","5","4"]}
81
+ >
82
+ <wui-text
83
+ ${z(this.instructionElementRef)}
84
+ class="instruction"
85
+ color="secondary"
86
+ variant="md-medium"
87
+ >
88
+ Type or
89
+ <wui-button
90
+ class="paste"
91
+ size="md"
92
+ variant="neutral-secondary"
93
+ iconLeft="copy"
94
+ @click=${this.onPasteClick.bind(this)}
95
+ >
96
+ <wui-icon size="sm" color="inherit" slot="iconLeft" name="copy"></wui-icon>
97
+ Paste
98
+ </wui-button>
99
+ address
100
+ </wui-text>
101
+ <textarea
102
+ spellcheck="false"
103
+ ?disabled=${!this.instructionHidden}
104
+ ${z(this.inputElementRef)}
105
+ @input=${this.onInputChange.bind(this)}
106
+ @blur=${this.onBlur.bind(this)}
107
+ .value=${this.value??""}
108
+ autocomplete="off"
109
+ >
110
+ ${this.value??""}</textarea
111
+ >
112
+ </wui-flex>`}async focusInput(){var t;this.instructionElementRef.value&&(this.instructionHidden=!0,await this.toggleInstructionFocus(!1),this.instructionElementRef.value.style.pointerEvents="none",(t=this.inputElementRef.value)==null||t.focus(),this.inputElementRef.value&&(this.inputElementRef.value.selectionStart=this.inputElementRef.value.selectionEnd=this.inputElementRef.value.value.length))}async focusInstruction(){var t;this.instructionElementRef.value&&(this.instructionHidden=!1,await this.toggleInstructionFocus(!0),this.instructionElementRef.value.style.pointerEvents="auto",(t=this.inputElementRef.value)==null||t.blur())}async toggleInstructionFocus(t){this.instructionElementRef.value&&await this.instructionElementRef.value.animate([{opacity:t?0:1},{opacity:t?1:0}],{duration:100,easing:"ease",fill:"forwards"}).finished}onBoxClick(){!this.value&&!this.instructionHidden&&this.focusInput()}onBlur(){!this.value&&this.instructionHidden&&!this.pasting&&this.focusInstruction()}checkHidden(){this.instructionHidden&&this.focusInput()}async onPasteClick(){this.pasting=!0;const t=await navigator.clipboard.readText();l.setReceiverAddress(t),this.focusInput()}onInputChange(t){var r;const i=t.target;this.pasting=!1,this.value=(r=t.target)==null?void 0:r.value,i.value&&!this.instructionHidden&&this.focusInput(),l.setLoading(!0),this.onDebouncedSearch(i.value)}setReceiverAddress(t){l.setReceiverAddress(t),l.setReceiverProfileName(void 0),l.setReceiverProfileImageUrl(void 0),l.setLoading(!1)}};$.styles=te;E([d()],$.prototype,"value",void 0);E([d({type:Boolean})],$.prototype,"readOnly",void 0);E([u()],$.prototype,"instructionHidden",void 0);E([u()],$.prototype,"pasting",void 0);$=E([b("w3m-input-address")],$);const ie=x`
113
+ :host {
114
+ width: 100%;
115
+ height: 100px;
116
+ border-radius: ${({borderRadius:e})=>e[5]};
117
+ border: 1px solid ${({tokens:e})=>e.theme.foregroundPrimary};
118
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
119
+ transition: background-color ${({durations:e})=>e.lg}
120
+ ${({easings:e})=>e["ease-out-power-1"]};
121
+ will-change: background-color;
122
+ transition: all ${({easings:e})=>e["ease-out-power-1"]}
123
+ ${({durations:e})=>e.lg};
124
+ }
125
+
126
+ :host(:hover) {
127
+ background-color: ${({tokens:e})=>e.theme.foregroundSecondary};
128
+ }
129
+
130
+ wui-flex {
131
+ width: 100%;
132
+ height: fit-content;
133
+ }
134
+
135
+ wui-button {
136
+ width: 100%;
137
+ display: flex;
138
+ justify-content: flex-end;
139
+ }
140
+
141
+ wui-input-amount {
142
+ mask-image: linear-gradient(
143
+ 270deg,
144
+ transparent 0px,
145
+ transparent 8px,
146
+ black 24px,
147
+ black 25px,
148
+ black 32px,
149
+ black 100%
150
+ );
151
+ }
152
+
153
+ .totalValue {
154
+ width: 100%;
155
+ }
156
+ `;var P=function(e,t,i,r){var o=arguments.length,n=o<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(n=(o<3?s(n):o>3?s(t,i,n):s(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};let A=class extends v{constructor(){super(...arguments),this.readOnly=!1,this.isInsufficientBalance=!1}render(){const t=this.readOnly||!this.token;return c` <wui-flex
157
+ flexDirection="column"
158
+ gap="01"
159
+ .padding=${["5","3","4","3"]}
160
+ >
161
+ <wui-flex alignItems="center">
162
+ <wui-input-amount
163
+ @inputChange=${this.onInputChange.bind(this)}
164
+ ?disabled=${t}
165
+ .value=${this.sendTokenAmount?String(this.sendTokenAmount):""}
166
+ ?error=${!!this.isInsufficientBalance}
167
+ ></wui-input-amount>
168
+ ${this.buttonTemplate()}
169
+ </wui-flex>
170
+ ${this.bottomTemplate()}
171
+ </wui-flex>`}buttonTemplate(){return this.token?c`<wui-token-button
172
+ text=${this.token.symbol}
173
+ imageSrc=${this.token.iconUrl}
174
+ @click=${this.handleSelectButtonClick.bind(this)}
175
+ >
176
+ </wui-token-button>`:c`<wui-button
177
+ size="md"
178
+ variant="neutral-secondary"
179
+ @click=${this.handleSelectButtonClick.bind(this)}
180
+ >Select token</wui-button
181
+ >`}handleSelectButtonClick(){this.readOnly||h.push("WalletSendSelectToken")}sendValueTemplate(){if(!this.readOnly&&this.token&&this.sendTokenAmount){const i=this.token.price*this.sendTokenAmount;return c`<wui-text class="totalValue" variant="sm-regular" color="secondary"
182
+ >${i?`$${H.formatNumberToLocalString(i,2)}`:"Incorrect value"}</wui-text
183
+ >`}return null}maxAmountTemplate(){return this.token?c` <wui-text variant="sm-regular" color="secondary">
184
+ ${R.roundNumber(Number(this.token.quantity.numeric),6,5)}
185
+ </wui-text>`:null}actionTemplate(){return this.token?c`<wui-link @click=${this.onMaxClick.bind(this)}>Max</wui-link>`:null}bottomTemplate(){return this.readOnly?null:c`<wui-flex alignItems="center" justifyContent="space-between">
186
+ ${this.sendValueTemplate()}
187
+ <wui-flex alignItems="center" gap="01" justifyContent="flex-end">
188
+ ${this.maxAmountTemplate()} ${this.actionTemplate()}
189
+ </wui-flex>
190
+ </wui-flex>`}onInputChange(t){l.setTokenAmount(t.detail)}onMaxClick(){if(this.token){const t=H.bigNumber(this.token.quantity.numeric);l.setTokenAmount(Number(t.toFixed(20)))}}};A.styles=ie;P([d({type:Object})],A.prototype,"token",void 0);P([d({type:Boolean})],A.prototype,"readOnly",void 0);P([d({type:Number})],A.prototype,"sendTokenAmount",void 0);P([d({type:Boolean})],A.prototype,"isInsufficientBalance",void 0);A=P([b("w3m-input-token")],A);const ne=x`
191
+ :host {
192
+ display: block;
193
+ }
194
+
195
+ wui-flex {
196
+ position: relative;
197
+ }
198
+
199
+ wui-icon-box {
200
+ width: 32px;
201
+ height: 32px;
202
+ border-radius: ${({borderRadius:e})=>e[10]} !important;
203
+ border: 4px solid ${({tokens:e})=>e.theme.backgroundPrimary};
204
+ background: ${({tokens:e})=>e.theme.foregroundPrimary};
205
+ position: absolute;
206
+ top: 50%;
207
+ left: 50%;
208
+ transform: translate(-50%, -50%);
209
+ z-index: 3;
210
+ }
211
+
212
+ wui-button {
213
+ --local-border-radius: ${({borderRadius:e})=>e[4]} !important;
214
+ }
215
+
216
+ .inputContainer {
217
+ height: fit-content;
218
+ }
219
+ `;var w=function(e,t,i,r){var o=arguments.length,n=o<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(n=(o<3?s(n):o>3?s(t,i,n):s(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};const p={INSUFFICIENT_FUNDS:"Insufficient Funds",INCORRECT_VALUE:"Incorrect Value",INVALID_ADDRESS:"Invalid Address",ADD_ADDRESS:"Add Address",ADD_AMOUNT:"Add Amount",SELECT_TOKEN:"Select Token",PREVIEW_SEND:"Preview Send"};let f=class extends v{constructor(){var i,r;super(),this.unsubscribe=[],this.isTryingToChooseDifferentWallet=!1,this.token=l.state.token,this.sendTokenAmount=l.state.sendTokenAmount,this.receiverAddress=l.state.receiverAddress,this.receiverProfileName=l.state.receiverProfileName,this.loading=l.state.loading,this.params=(i=h.state.data)==null?void 0:i.send,this.caipAddress=(r=g.getAccountData())==null?void 0:r.caipAddress,this.message=p.PREVIEW_SEND,this.disconnecting=!1,this.token&&!this.params&&(this.fetchBalances(),this.fetchNetworkPrice());const t=g.subscribeKey("activeCaipAddress",o=>{!o&&this.isTryingToChooseDifferentWallet&&(this.isTryingToChooseDifferentWallet=!1,q.open({view:"Connect",data:{redirectView:"WalletSend"}}).catch(()=>null),t())});this.unsubscribe.push(g.subscribeAccountStateProp("caipAddress",o=>{this.caipAddress=o}),l.subscribe(o=>{this.token=o.token,this.sendTokenAmount=o.sendTokenAmount,this.receiverAddress=o.receiverAddress,this.receiverProfileName=o.receiverProfileName,this.loading=o.loading}))}disconnectedCallback(){this.unsubscribe.forEach(t=>t())}async firstUpdated(){await this.handleSendParameters()}render(){this.getMessage();const t=!!this.params;return c` <wui-flex flexDirection="column" .padding=${["0","4","4","4"]}>
220
+ <wui-flex class="inputContainer" gap="2" flexDirection="column">
221
+ <w3m-input-token
222
+ .token=${this.token}
223
+ .sendTokenAmount=${this.sendTokenAmount}
224
+ ?readOnly=${t}
225
+ ?isInsufficientBalance=${this.message===p.INSUFFICIENT_FUNDS}
226
+ ></w3m-input-token>
227
+ <wui-icon-box size="md" variant="secondary" icon="arrowBottom"></wui-icon-box>
228
+ <w3m-input-address
229
+ ?readOnly=${t}
230
+ .value=${this.receiverProfileName?this.receiverProfileName:this.receiverAddress}
231
+ ></w3m-input-address>
232
+ </wui-flex>
233
+ ${this.buttonTemplate()}
234
+ </wui-flex>`}async fetchBalances(){await l.fetchTokenBalance(),l.fetchNetworkBalance()}async fetchNetworkPrice(){await G.getNetworkTokenPrice()}onButtonClick(){h.push("WalletSendPreview",{send:this.params})}onFundWalletClick(){h.push("FundWallet",{redirectView:"WalletSend"})}async onConnectDifferentWalletClick(){try{this.isTryingToChooseDifferentWallet=!0,this.disconnecting=!0,await j.disconnect()}finally{this.disconnecting=!1}}getMessage(){var t;this.message=p.PREVIEW_SEND,this.receiverAddress&&!D.isAddress(this.receiverAddress,g.state.activeChain)&&(this.message=p.INVALID_ADDRESS),this.receiverAddress||(this.message=p.ADD_ADDRESS),this.sendTokenAmount&&this.token&&this.sendTokenAmount>Number(this.token.quantity.numeric)&&(this.message=p.INSUFFICIENT_FUNDS),this.sendTokenAmount||(this.message=p.ADD_AMOUNT),this.sendTokenAmount&&((t=this.token)!=null&&t.price)&&(this.sendTokenAmount*this.token.price||(this.message=p.INCORRECT_VALUE)),this.token||(this.message=p.SELECT_TOKEN)}buttonTemplate(){const t=!this.message.startsWith(p.PREVIEW_SEND),i=this.message===p.INSUFFICIENT_FUNDS,r=!!this.params;return i&&!r?c`
235
+ <wui-flex .margin=${["4","0","0","0"]} flexDirection="column" gap="4">
236
+ <wui-button
237
+ @click=${this.onFundWalletClick.bind(this)}
238
+ size="lg"
239
+ variant="accent-secondary"
240
+ fullWidth
241
+ >
242
+ Fund Wallet
243
+ </wui-button>
244
+
245
+ <wui-separator data-testid="wui-separator" text="or"></wui-separator>
246
+
247
+ <wui-button
248
+ @click=${this.onConnectDifferentWalletClick.bind(this)}
249
+ size="lg"
250
+ variant="neutral-secondary"
251
+ fullWidth
252
+ ?loading=${this.disconnecting}
253
+ >
254
+ Connect a different wallet
255
+ </wui-button>
256
+ </wui-flex>
257
+ `:c`<wui-flex .margin=${["4","0","0","0"]}>
258
+ <wui-button
259
+ @click=${this.onButtonClick.bind(this)}
260
+ ?disabled=${t}
261
+ size="lg"
262
+ variant="accent-primary"
263
+ ?loading=${this.loading}
264
+ fullWidth
265
+ >
266
+ ${this.message}
267
+ </wui-button>
268
+ </wui-flex>`}async handleSendParameters(){if(this.loading=!0,!this.params){this.loading=!1;return}const t=Number(this.params.amount);if(isNaN(t)){y.showError("Invalid amount"),this.loading=!1;return}const{namespace:i,chainId:r,assetAddress:o}=this.params;if(!Q.SEND_PARAMS_SUPPORTED_CHAINS.includes(i)){y.showError(`Chain "${i}" is not supported for send parameters`),this.loading=!1;return}const n=g.getCaipNetworkById(r,i);if(!n){y.showError(`Network with id "${r}" not found`),this.loading=!1;return}try{const{balance:s,name:a,symbol:W,decimals:V}=await X.fetchERC20Balance({caipAddress:this.caipAddress,assetAddress:o,caipNetwork:n});if(!a||!W||!V||!s){y.showError("Token not found");return}l.setToken({name:a,symbol:W,chainId:n.id.toString(),address:`${n.chainNamespace}:${n.id}:${o}`,value:0,price:0,quantity:{decimals:V.toString(),numeric:s.toString()},iconUrl:K.getTokenImage(W)??""}),l.setTokenAmount(t),l.setReceiverAddress(this.params.to)}catch(s){console.error("Failed to load token information:",s),y.showError("Failed to load token information")}finally{this.loading=!1}}};f.styles=ne;w([u()],f.prototype,"token",void 0);w([u()],f.prototype,"sendTokenAmount",void 0);w([u()],f.prototype,"receiverAddress",void 0);w([u()],f.prototype,"receiverProfileName",void 0);w([u()],f.prototype,"loading",void 0);w([u()],f.prototype,"params",void 0);w([u()],f.prototype,"caipAddress",void 0);w([u()],f.prototype,"message",void 0);w([u()],f.prototype,"disconnecting",void 0);f=w([b("w3m-wallet-send-view")],f);const re=x`
269
+ .contentContainer {
270
+ height: 440px;
271
+ overflow: scroll;
272
+ scrollbar-width: none;
273
+ }
274
+
275
+ .contentContainer::-webkit-scrollbar {
276
+ display: none;
277
+ }
278
+
279
+ wui-icon-box {
280
+ width: 40px;
281
+ height: 40px;
282
+ border-radius: ${({borderRadius:e})=>e[3]};
283
+ }
284
+ `;var I=function(e,t,i,r){var o=arguments.length,n=o<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(n=(o<3?s(n):o>3?s(t,i,n):s(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};let C=class extends v{constructor(){super(),this.unsubscribe=[],this.tokenBalances=l.state.tokenBalances,this.search="",this.onDebouncedSearch=D.debounce(t=>{this.search=t}),this.fetchBalancesAndNetworkPrice(),this.unsubscribe.push(l.subscribe(t=>{this.tokenBalances=t.tokenBalances}))}disconnectedCallback(){this.unsubscribe.forEach(t=>t())}render(){return c`
285
+ <wui-flex flexDirection="column">
286
+ ${this.templateSearchInput()} <wui-separator></wui-separator> ${this.templateTokens()}
287
+ </wui-flex>
288
+ `}async fetchBalancesAndNetworkPrice(){var t;(!this.tokenBalances||((t=this.tokenBalances)==null?void 0:t.length)===0)&&(await this.fetchBalances(),await this.fetchNetworkPrice())}async fetchBalances(){await l.fetchTokenBalance(),l.fetchNetworkBalance()}async fetchNetworkPrice(){await G.getNetworkTokenPrice()}templateSearchInput(){return c`
289
+ <wui-flex gap="2" padding="3">
290
+ <wui-input-text
291
+ @inputChange=${this.onInputChange.bind(this)}
292
+ class="network-search-input"
293
+ size="sm"
294
+ placeholder="Search token"
295
+ icon="search"
296
+ ></wui-input-text>
297
+ </wui-flex>
298
+ `}templateTokens(){var t,i;return this.tokens=(t=this.tokenBalances)==null?void 0:t.filter(r=>{var o;return r.chainId===((o=g.state.activeCaipNetwork)==null?void 0:o.caipNetworkId)}),this.search?this.filteredTokens=(i=this.tokenBalances)==null?void 0:i.filter(r=>r.name.toLowerCase().includes(this.search.toLowerCase())):this.filteredTokens=this.tokens,c`
299
+ <wui-flex
300
+ class="contentContainer"
301
+ flexDirection="column"
302
+ .padding=${["0","3","0","3"]}
303
+ >
304
+ <wui-flex justifyContent="flex-start" .padding=${["4","3","3","3"]}>
305
+ <wui-text variant="md-medium" color="secondary">Your tokens</wui-text>
306
+ </wui-flex>
307
+ <wui-flex flexDirection="column" gap="2">
308
+ ${this.filteredTokens&&this.filteredTokens.length>0?this.filteredTokens.map(r=>c`<wui-list-token
309
+ @click=${this.handleTokenClick.bind(this,r)}
310
+ ?clickable=${!0}
311
+ tokenName=${r.name}
312
+ tokenImageUrl=${r.iconUrl}
313
+ tokenAmount=${r.quantity.numeric}
314
+ tokenValue=${r.value}
315
+ tokenCurrency=${r.symbol}
316
+ ></wui-list-token>`):c`<wui-flex
317
+ .padding=${["20","0","0","0"]}
318
+ alignItems="center"
319
+ flexDirection="column"
320
+ gap="4"
321
+ >
322
+ <wui-icon-box icon="coinPlaceholder" color="default" size="lg"></wui-icon-box>
323
+ <wui-flex
324
+ class="textContent"
325
+ gap="2"
326
+ flexDirection="column"
327
+ justifyContent="center"
328
+ flexDirection="column"
329
+ >
330
+ <wui-text variant="lg-medium" align="center" color="primary">
331
+ No tokens found
332
+ </wui-text>
333
+ <wui-text variant="lg-regular" align="center" color="secondary">
334
+ Your tokens will appear here
335
+ </wui-text>
336
+ </wui-flex>
337
+ <wui-link @click=${this.onBuyClick.bind(this)}>Buy</wui-link>
338
+ </wui-flex>`}
339
+ </wui-flex>
340
+ </wui-flex>
341
+ `}onBuyClick(){h.push("OnRampProviders")}onInputChange(t){this.onDebouncedSearch(t.detail)}handleTokenClick(t){l.setToken(t),l.setTokenAmount(void 0),h.goBack()}};C.styles=re;I([u()],C.prototype,"tokenBalances",void 0);I([u()],C.prototype,"tokens",void 0);I([u()],C.prototype,"filteredTokens",void 0);I([u()],C.prototype,"search",void 0);C=I([b("w3m-wallet-send-select-token-view")],C);const oe=x`
342
+ :host {
343
+ height: 32px;
344
+ display: flex;
345
+ align-items: center;
346
+ gap: ${({spacing:e})=>e[1]};
347
+ border-radius: ${({borderRadius:e})=>e[32]};
348
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
349
+ padding: ${({spacing:e})=>e[1]};
350
+ padding-left: ${({spacing:e})=>e[2]};
351
+ }
352
+
353
+ wui-avatar,
354
+ wui-image {
355
+ width: 24px;
356
+ height: 24px;
357
+ border-radius: ${({borderRadius:e})=>e[16]};
358
+ }
359
+
360
+ wui-icon {
361
+ border-radius: ${({borderRadius:e})=>e[16]};
362
+ }
363
+ `;var _=function(e,t,i,r){var o=arguments.length,n=o<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(n=(o<3?s(n):o>3?s(t,i,n):s(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};let T=class extends v{constructor(){super(...arguments),this.text=""}render(){return c`<wui-text variant="lg-regular" color="primary">${this.text}</wui-text>
364
+ ${this.imageTemplate()}`}imageTemplate(){return this.address?c`<wui-avatar address=${this.address} .imageSrc=${this.imageSrc}></wui-avatar>`:this.imageSrc?c`<wui-image src=${this.imageSrc}></wui-image>`:c`<wui-icon size="lg" color="inverse" name="networkPlaceholder"></wui-icon>`}};T.styles=[Y,J,oe];_([d({type:String})],T.prototype,"text",void 0);_([d({type:String})],T.prototype,"address",void 0);_([d({type:String})],T.prototype,"imageSrc",void 0);T=_([b("wui-preview-item")],T);const se=x`
365
+ :host {
366
+ display: flex;
367
+ padding: ${({spacing:e})=>e[4]} ${({spacing:e})=>e[3]};
368
+ width: 100%;
369
+ background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
370
+ border-radius: ${({borderRadius:e})=>e[4]};
371
+ }
372
+
373
+ wui-image {
374
+ width: 20px;
375
+ height: 20px;
376
+ border-radius: ${({borderRadius:e})=>e[16]};
377
+ }
378
+
379
+ wui-icon {
380
+ width: 20px;
381
+ height: 20px;
382
+ }
383
+ `;var O=function(e,t,i,r){var o=arguments.length,n=o<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(n=(o<3?s(n):o>3?s(t,i,n):s(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};let S=class extends v{constructor(){super(...arguments),this.imageSrc=void 0,this.textTitle="",this.textValue=void 0}render(){return c`
384
+ <wui-flex justifyContent="space-between" alignItems="center">
385
+ <wui-text variant="lg-regular" color="primary"> ${this.textTitle} </wui-text>
386
+ ${this.templateContent()}
387
+ </wui-flex>
388
+ `}templateContent(){return this.imageSrc?c`<wui-image src=${this.imageSrc} alt=${this.textTitle}></wui-image>`:this.textValue?c` <wui-text variant="md-regular" color="secondary"> ${this.textValue} </wui-text>`:c`<wui-icon size="inherit" color="default" name="networkPlaceholder"></wui-icon>`}};S.styles=[Y,J,se];O([d()],S.prototype,"imageSrc",void 0);O([d()],S.prototype,"textTitle",void 0);O([d()],S.prototype,"textValue",void 0);S=O([b("wui-list-content")],S);const ae=x`
389
+ :host {
390
+ display: flex;
391
+ width: auto;
392
+ flex-direction: column;
393
+ gap: ${({spacing:e})=>e[1]};
394
+ border-radius: ${({borderRadius:e})=>e[5]};
395
+ background: ${({tokens:e})=>e.theme.foregroundPrimary};
396
+ padding: ${({spacing:e})=>e[3]} ${({spacing:e})=>e[2]}
397
+ ${({spacing:e})=>e[2]} ${({spacing:e})=>e[2]};
398
+ }
399
+
400
+ wui-list-content {
401
+ width: -webkit-fill-available !important;
402
+ }
403
+
404
+ wui-text {
405
+ padding: 0 ${({spacing:e})=>e[2]};
406
+ }
407
+
408
+ wui-flex {
409
+ margin-top: ${({spacing:e})=>e[2]};
410
+ }
411
+
412
+ .network {
413
+ cursor: pointer;
414
+ transition: background-color ${({durations:e})=>e.lg}
415
+ ${({easings:e})=>e["ease-out-power-1"]};
416
+ will-change: background-color;
417
+ }
418
+
419
+ .network:focus-visible {
420
+ border: 1px solid ${({tokens:e})=>e.core.textAccentPrimary};
421
+ background-color: ${({tokens:e})=>e.core.glass010};
422
+ -webkit-box-shadow: 0px 0px 0px 4px ${({tokens:e})=>e.core.foregroundAccent010};
423
+ -moz-box-shadow: 0px 0px 0px 4px ${({tokens:e})=>e.core.foregroundAccent010};
424
+ box-shadow: 0px 0px 0px 4px ${({tokens:e})=>e.core.foregroundAccent010};
425
+ }
426
+
427
+ .network:hover {
428
+ background-color: ${({tokens:e})=>e.core.glass010};
429
+ }
430
+
431
+ .network:active {
432
+ background-color: ${({tokens:e})=>e.core.glass010};
433
+ }
434
+ `;var B=function(e,t,i,r){var o=arguments.length,n=o<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(n=(o<3?s(n):o>3?s(t,i,n):s(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};let N=class extends v{constructor(){var t;super(...arguments),this.params=(t=h.state.data)==null?void 0:t.send}render(){return c` <wui-text variant="sm-regular" color="secondary">Details</wui-text>
435
+ <wui-flex flexDirection="column" gap="1">
436
+ <wui-list-content
437
+ textTitle="Address"
438
+ textValue=${R.getTruncateString({string:this.receiverAddress??"",charsStart:4,charsEnd:4,truncate:"middle"})}
439
+ >
440
+ </wui-list-content>
441
+ ${this.networkTemplate()}
442
+ </wui-flex>`}networkTemplate(){var t;return(t=this.caipNetwork)!=null&&t.name?c` <wui-list-content
443
+ @click=${()=>this.onNetworkClick(this.caipNetwork)}
444
+ class="network"
445
+ textTitle="Network"
446
+ imageSrc=${Z(K.getNetworkImage(this.caipNetwork))}
447
+ ></wui-list-content>`:null}onNetworkClick(t){t&&!this.params&&h.push("Networks",{network:t})}};N.styles=ae;B([d()],N.prototype,"receiverAddress",void 0);B([d({type:Object})],N.prototype,"caipNetwork",void 0);B([u()],N.prototype,"params",void 0);N=B([b("w3m-wallet-send-details")],N);const le=x`
448
+ wui-avatar,
449
+ wui-image {
450
+ display: ruby;
451
+ width: 32px;
452
+ height: 32px;
453
+ border-radius: ${({borderRadius:e})=>e[20]};
454
+ }
455
+
456
+ .sendButton {
457
+ width: 70%;
458
+ --local-width: 100% !important;
459
+ --local-border-radius: ${({borderRadius:e})=>e[4]} !important;
460
+ }
461
+
462
+ .cancelButton {
463
+ width: 30%;
464
+ --local-width: 100% !important;
465
+ --local-border-radius: ${({borderRadius:e})=>e[4]} !important;
466
+ }
467
+ `;var k=function(e,t,i,r){var o=arguments.length,n=o<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(n=(o<3?s(n):o>3?s(t,i,n):s(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};let m=class extends v{constructor(){var t;super(),this.unsubscribe=[],this.token=l.state.token,this.sendTokenAmount=l.state.sendTokenAmount,this.receiverAddress=l.state.receiverAddress,this.receiverProfileName=l.state.receiverProfileName,this.receiverProfileImageUrl=l.state.receiverProfileImageUrl,this.caipNetwork=g.state.activeCaipNetwork,this.loading=l.state.loading,this.params=(t=h.state.data)==null?void 0:t.send,this.unsubscribe.push(l.subscribe(i=>{this.token=i.token,this.sendTokenAmount=i.sendTokenAmount,this.receiverAddress=i.receiverAddress,this.receiverProfileName=i.receiverProfileName,this.receiverProfileImageUrl=i.receiverProfileImageUrl,this.loading=i.loading}),g.subscribeKey("activeCaipNetwork",i=>this.caipNetwork=i))}disconnectedCallback(){this.unsubscribe.forEach(t=>t())}render(){var t,i;return c` <wui-flex flexDirection="column" .padding=${["0","4","4","4"]}>
468
+ <wui-flex gap="2" flexDirection="column" .padding=${["0","2","0","2"]}>
469
+ <wui-flex alignItems="center" justifyContent="space-between">
470
+ <wui-flex flexDirection="column" gap="01">
471
+ <wui-text variant="sm-regular" color="secondary">Send</wui-text>
472
+ ${this.sendValueTemplate()}
473
+ </wui-flex>
474
+ <wui-preview-item
475
+ text="${this.sendTokenAmount?R.roundNumber(this.sendTokenAmount,6,5):"unknown"} ${(t=this.token)==null?void 0:t.symbol}"
476
+ .imageSrc=${(i=this.token)==null?void 0:i.iconUrl}
477
+ ></wui-preview-item>
478
+ </wui-flex>
479
+ <wui-flex>
480
+ <wui-icon color="default" size="md" name="arrowBottom"></wui-icon>
481
+ </wui-flex>
482
+ <wui-flex alignItems="center" justifyContent="space-between">
483
+ <wui-text variant="sm-regular" color="secondary">To</wui-text>
484
+ <wui-preview-item
485
+ text="${this.receiverProfileName?R.getTruncateString({string:this.receiverProfileName,charsStart:20,charsEnd:0,truncate:"end"}):R.getTruncateString({string:this.receiverAddress?this.receiverAddress:"",charsStart:4,charsEnd:4,truncate:"middle"})}"
486
+ address=${this.receiverAddress??""}
487
+ .imageSrc=${this.receiverProfileImageUrl??void 0}
488
+ .isAddress=${!0}
489
+ ></wui-preview-item>
490
+ </wui-flex>
491
+ </wui-flex>
492
+ <wui-flex flexDirection="column" .padding=${["6","0","0","0"]}>
493
+ <w3m-wallet-send-details
494
+ .caipNetwork=${this.caipNetwork}
495
+ .receiverAddress=${this.receiverAddress}
496
+ ></w3m-wallet-send-details>
497
+ <wui-flex justifyContent="center" gap="1" .padding=${["3","0","0","0"]}>
498
+ <wui-icon size="sm" color="default" name="warningCircle"></wui-icon>
499
+ <wui-text variant="sm-regular" color="secondary">Review transaction carefully</wui-text>
500
+ </wui-flex>
501
+ <wui-flex justifyContent="center" gap="3" .padding=${["4","0","0","0"]}>
502
+ <wui-button
503
+ class="cancelButton"
504
+ @click=${this.onCancelClick.bind(this)}
505
+ size="lg"
506
+ variant="neutral-secondary"
507
+ >
508
+ Cancel
509
+ </wui-button>
510
+ <wui-button
511
+ class="sendButton"
512
+ @click=${this.onSendClick.bind(this)}
513
+ size="lg"
514
+ variant="accent-primary"
515
+ .loading=${this.loading}
516
+ >
517
+ Send
518
+ </wui-button>
519
+ </wui-flex>
520
+ </wui-flex></wui-flex
521
+ >`}sendValueTemplate(){if(!this.params&&this.token&&this.sendTokenAmount){const i=this.token.price*this.sendTokenAmount;return c`<wui-text variant="md-regular" color="primary"
522
+ >$${i.toFixed(2)}</wui-text
523
+ >`}return null}async onSendClick(){if(!this.sendTokenAmount||!this.receiverAddress){y.showError("Please enter a valid amount and receiver address");return}try{await l.sendToken(),this.params?h.reset("WalletSendConfirmed"):(y.showSuccess("Transaction started"),h.replace("Account"))}catch(t){let i="Failed to send transaction";const r=t instanceof L&&t.originalName===M.PROVIDER_RPC_ERROR_NAME.USER_REJECTED_REQUEST,o=t instanceof L&&t.originalName===M.PROVIDER_RPC_ERROR_NAME.SEND_TRANSACTION_ERROR;(r||o)&&(i=t.message),ee.sendEvent({type:"track",event:r?"SEND_REJECTED":"SEND_ERROR",properties:l.getSdkEventProperties(t)}),y.showError(i)}}onCancelClick(){h.goBack()}};m.styles=le;k([u()],m.prototype,"token",void 0);k([u()],m.prototype,"sendTokenAmount",void 0);k([u()],m.prototype,"receiverAddress",void 0);k([u()],m.prototype,"receiverProfileName",void 0);k([u()],m.prototype,"receiverProfileImageUrl",void 0);k([u()],m.prototype,"caipNetwork",void 0);k([u()],m.prototype,"loading",void 0);k([u()],m.prototype,"params",void 0);m=k([b("w3m-wallet-send-preview-view")],m);const ce=x`
524
+ .icon-box {
525
+ width: 64px;
526
+ height: 64px;
527
+ border-radius: 16px;
528
+ background-color: ${({spacing:e})=>e[16]};
529
+ border: 8px solid ${({tokens:e})=>e.theme.borderPrimary};
530
+ border-radius: ${({borderRadius:e})=>e.round};
531
+ }
532
+ `;var ue=function(e,t,i,r){var o=arguments.length,n=o<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(n=(o<3?s(n):o>3?s(t,i,n):s(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};let U=class extends v{constructor(){super(),this.unsubscribe=[],this.unsubscribe.push()}render(){return c`
533
+ <wui-flex
534
+ flexDirection="column"
535
+ alignItems="center"
536
+ gap="4"
537
+ .padding="${["1","3","4","3"]}"
538
+ >
539
+ <wui-flex justifyContent="center" alignItems="center" class="icon-box">
540
+ <wui-icon size="xxl" color="success" name="checkmark"></wui-icon>
541
+ </wui-flex>
542
+
543
+ <wui-text variant="h6-medium" color="primary">You successfully sent asset</wui-text>
544
+
545
+ <wui-button
546
+ fullWidth
547
+ @click=${this.onCloseClick.bind(this)}
548
+ size="lg"
549
+ variant="neutral-secondary"
550
+ >
551
+ Close
552
+ </wui-button>
553
+ </wui-flex>
554
+ `}onCloseClick(){q.close()}};U.styles=ce;U=ue([b("w3m-send-confirmed-view")],U);export{U as W3mSendConfirmedView,C as W3mSendSelectTokenView,m as W3mWalletSendPreviewView,f as W3mWalletSendView};