PageSourceSearch

https://protocol.art/assets/send-7c9dbcc9.js

js protocol.art collected 2026-10-06 19:11:03 UTC 33,997 bytes, 554 lines download raw bytes

1import{k as b,m as x,h as D,C as g,F as j,bA as l,n as c,x as h,N as F,aH as q,S as y,c as Q,z as X,aa as K,r as Y,l as J,bE as z,bF as H,E as Z}from"./index-c2fc66f8.js";import{n as d,r as u}from"./class-map-57c26684.js";import{c as v,U as N}from"./index-58ba9dd2.js";import"./index-d63e03b8.js";import"./index-0299b85a.js";import"./index-505527ce.js";import{e as L,n as M}from"./ref-e1e6c463.js";import"./index-4126b73f.js";import"./index-ce39da69.js";import"./index-8db34e28.js";import{S as G}from"./SwapController-0aba0753.js";import"./index-ee2d6e6a.js";import"./index-316b2327.js";import"./index-500b0381.js";import"./index-8e53d37b.js";import{o as ee}from"./if-defined-2b5452c9.js";import"./index-f85de7b6.js";import"./async-directive-73fd2c02.js";import"./index-260c9722.js";const te=b`
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 R=globalThis&&globalThis.__decorate||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 x{constructor(){super(...arguments),this.inputElementRef=L(),this.instructionElementRef=L(),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        ${M(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>
98
99        address
100      </wui-text>
101      <textarea
102        spellcheck="false"
103        ?disabled=${!this.instructionHidden}
104        ${M(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;R([d()],$.prototype,"value",void 0);R([d({type:Boolean})],$.prototype,"readOnly",void 0);R([u()],$.prototype,"instructionHidden",void 0);R([u()],$.prototype,"pasting",void 0);$=R([v("w3m-input-address")],$);const ie=b`
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=globalThis&&globalThis.__decorate||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 x{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>
176`: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?`$${F.formatNumberToLocalString(i,2)}`:"Incorrect value"}</wui-text
183      >`}return null}maxAmountTemplate(){return this.token?c` <wui-text variant="sm-regular" color="secondary">
184        ${N.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=F.bigNumber(this.token.quantity.numeric);l.setTokenAmount(Number(t.toFixed(20)))}}};T.styles=ie;P([d({type:Object})],T.prototype,"token",void 0);P([d({type:Boolean})],T.prototype,"readOnly",void 0);P([d({type:Number})],T.prototype,"sendTokenAmount",void 0);P([d({type:Boolean})],T.prototype,"isInsufficientBalance",void 0);T=P([v("w3m-input-token")],T);const ne=b`
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=globalThis&&globalThis.__decorate||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 f={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 p=class extends x{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=f.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===f.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=f.PREVIEW_SEND,this.receiverAddress&&!D.isAddress(this.receiverAddress,g.state.activeChain)&&(this.message=f.INVALID_ADDRESS),this.receiverAddress||(this.message=f.ADD_ADDRESS),this.sendTokenAmount&&this.token&&this.sendTokenAmount>Number(this.token.quantity.numeric)&&(this.message=f.INSUFFICIENT_FUNDS),this.sendTokenAmount||(this.message=f.ADD_AMOUNT),this.sendTokenAmount&&((t=this.token)!=null&&t.price)&&(this.sendTokenAmount*this.token.price||(this.message=f.INCORRECT_VALUE)),this.token||(this.message=f.SELECT_TOKEN)}buttonTemplate(){const t=!this.message.startsWith(f.PREVIEW_SEND),i=this.message===f.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>
243
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}}};p.styles=ne;w([u()],p.prototype,"token",void 0);w([u()],p.prototype,"sendTokenAmount",void 0);w([u()],p.prototype,"receiverAddress",void 0);w([u()],p.prototype,"receiverProfileName",void 0);w([u()],p.prototype,"loading",void 0);w([u()],p.prototype,"params",void 0);w([u()],p.prototype,"caipAddress",void 0);w([u()],p.prototype,"message",void 0);w([u()],p.prototype,"disconnecting",void 0);p=w([v("w3m-wallet-send-view")],p);const re=b`
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=globalThis&&globalThis.__decorate||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 x{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()}};A.styles=re;I([u()],A.prototype,"tokenBalances",void 0);I([u()],A.prototype,"tokens",void 0);I([u()],A.prototype,"filteredTokens",void 0);I([u()],A.prototype,"search",void 0);A=I([v("w3m-wallet-send-select-token-view")],A);const oe=b`
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 _=globalThis&&globalThis.__decorate||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 x{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>`}};C.styles=[Y,J,oe];_([d({type:String})],C.prototype,"text",void 0);_([d({type:String})],C.prototype,"address",void 0);_([d({type:String})],C.prototype,"imageSrc",void 0);C=_([v("wui-preview-item")],C);const se=b`
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=globalThis&&globalThis.__decorate||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 x{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([v("wui-list-content")],S);const ae=b`
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=globalThis&&globalThis.__decorate||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 E=class extends x{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=${N.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=${ee(K.getNetworkImage(this.caipNetwork))}
447      ></wui-list-content>`:null}onNetworkClick(t){t&&!this.params&&h.push("Networks",{network:t})}};E.styles=ae;B([d()],E.prototype,"receiverAddress",void 0);B([d({type:Object})],E.prototype,"caipNetwork",void 0);B([u()],E.prototype,"params",void 0);E=B([v("w3m-wallet-send-details")],E);const le=b`
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=globalThis&&globalThis.__decorate||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 x{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}
467),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?N.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?N.getTruncateString({string:this.receiverProfileName,charsStart:20,charsEnd:0,truncate:"end"}):N.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 z&&t.originalName===H.PROVIDER_RPC_ERROR_NAME.USER_REJECTED_REQUEST,o=t instanceof z&&t.originalName===H.PROVIDER_RPC_ERROR_NAME.SEND_TRANSACTION_ERROR;(r||o)&&(i=t.message),Z.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([v("w3m-wallet-send-preview-view")],m);const ce=b`
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=globalThis&&globalThis.__decorate||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 x{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>
552
553      </wui-flex>
554    `}onCloseClick(){q.close()}};U.styles=ce;U=ue([v("w3m-send-confirmed-view")],U);export{U as W3mSendConfirmedView,A as W3mSendSelectTokenView,m as W3mWalletSendPreviewView,p as W3mWalletSendView};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.