@reown/appkit-cdn 0.0.3

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.
@@ -0,0 +1,64 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./W3MFrameProviderSingleton-BpWUndnw.cjs"),o=n.proxy({status:"uninitialized"}),u={state:o,subscribeKey(t,e){return n.subscribeKey(o,t,e)},subscribe(t){return n.subscribe(o,()=>t(o))},_getClient(){if(!o._client)throw new Error("SIWEController client not set");return o._client},async getNonce(t){const i=await this._getClient().getNonce(t);return this.setNonce(i),i},async getSession(){try{const e=await this._getClient().getSession();return e&&(this.setSession(e),this.setStatus("success")),e}catch{return}},createMessage(t){const i=this._getClient().createMessage(t);return this.setMessage(i),i},async verifyMessage(t){return await this._getClient().verifyMessage(t)},async signIn(){return await this._getClient().signIn()},async signOut(){var e;const t=this._getClient();await t.signOut(),this.setStatus("ready"),this.setSession(void 0),(e=t.onSignOut)==null||e.call(t)},onSignIn(t){var i;const e=this._getClient();(i=e.onSignIn)==null||i.call(e,t)},onSignOut(){var e;const t=this._getClient();(e=t.onSignOut)==null||e.call(t)},setSIWEClient(t){o._client=n.ref(t),o.status="ready",n.OptionsController.setIsSiweEnabled(t.options.enabled)},setNonce(t){o.nonce=t},setStatus(t){o.status=t,n.AccountController.setSiweStatus(t)},setMessage(t){o.message=t},setSession(t){o.session=t,o.status=t?"success":"ready"}},d=n.i`
2
+ :host {
3
+ display: flex;
4
+ justify-content: center;
5
+ gap: var(--wui-spacing-2xl);
6
+ }
7
+
8
+ wui-visual-thumbnail:nth-child(1) {
9
+ z-index: 1;
10
+ }
11
+ `;var C=function(t,e,i,r){var a=arguments.length,s=a<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,i):r,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,i,r);else for(var l=t.length-1;l>=0;l--)(c=t[l])&&(s=(a<3?c(s):a>3?c(e,i,s):c(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s};exports.W3mConnectingSiwe=class extends n.h{constructor(){var e,i;super(...arguments),this.dappImageUrl=(e=n.OptionsController.state.metadata)==null?void 0:e.icons,this.walletImageUrl=(i=n.AccountController.state.connectedWalletInfo)==null?void 0:i.icon}firstUpdated(){var i;const e=(i=this.shadowRoot)==null?void 0:i.querySelectorAll("wui-visual-thumbnail");e!=null&&e[0]&&this.createAnimation(e[0],"translate(18px)"),e!=null&&e[1]&&this.createAnimation(e[1],"translate(-18px)")}render(){var e;return n.ke`
12
+ <wui-visual-thumbnail
13
+ ?borderRadiusFull=${!0}
14
+ .imageSrc=${(e=this.dappImageUrl)==null?void 0:e[0]}
15
+ ></wui-visual-thumbnail>
16
+ <wui-visual-thumbnail .imageSrc=${this.walletImageUrl}></wui-visual-thumbnail>
17
+ `}createAnimation(e,i){e.animate([{transform:"translateX(0px)"},{transform:i}],{duration:1600,easing:"cubic-bezier(0.56, 0, 0.48, 1)",direction:"alternate",iterations:1/0})}};exports.W3mConnectingSiwe.styles=d;exports.W3mConnectingSiwe=C([n.customElement("w3m-connecting-siwe")],exports.W3mConnectingSiwe);var g=function(t,e,i,r){var a=arguments.length,s=a<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,i):r,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,i,r);else for(var l=t.length-1;l>=0;l--)(c=t[l])&&(s=(a<3?c(s):a>3?c(e,i,s):c(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s};exports.W3mConnectingSiweView=class extends n.h{constructor(){var e;super(...arguments),this.dappName=(e=n.OptionsController.state.metadata)==null?void 0:e.name,this.isSigning=!1,this.isCancelling=!1}render(){return n.ke`
18
+ <wui-flex justifyContent="center" .padding=${["2xl","0","xxl","0"]}>
19
+ <w3m-connecting-siwe></w3m-connecting-siwe>
20
+ </wui-flex>
21
+ <wui-flex
22
+ .padding=${["0","4xl","l","4xl"]}
23
+ gap="s"
24
+ justifyContent="space-between"
25
+ >
26
+ <wui-text variant="paragraph-500" align="center" color="fg-100"
27
+ >${this.dappName??"Dapp"} needs to connect to your wallet</wui-text
28
+ >
29
+ </wui-flex>
30
+ <wui-flex
31
+ .padding=${["0","3xl","l","3xl"]}
32
+ gap="s"
33
+ justifyContent="space-between"
34
+ >
35
+ <wui-text variant="small-400" align="center" color="fg-200"
36
+ >Sign this message to prove you own this wallet and proceed. Canceling will disconnect
37
+ you.</wui-text
38
+ >
39
+ </wui-flex>
40
+ <wui-flex .padding=${["l","xl","xl","xl"]} gap="s" justifyContent="space-between">
41
+ <wui-button
42
+ size="lg"
43
+ borderRadius="xs"
44
+ fullWidth
45
+ variant="neutral"
46
+ ?loading=${this.isCancelling}
47
+ @click=${this.onCancel.bind(this)}
48
+ data-testid="w3m-connecting-siwe-cancel"
49
+ >
50
+ Cancel
51
+ </wui-button>
52
+ <wui-button
53
+ size="lg"
54
+ borderRadius="xs"
55
+ fullWidth
56
+ variant="main"
57
+ @click=${this.onSign.bind(this)}
58
+ ?loading=${this.isSigning}
59
+ data-testid="w3m-connecting-siwe-sign"
60
+ >
61
+ ${this.isSigning?"Signing...":"Sign"}
62
+ </wui-button>
63
+ </wui-flex>
64
+ `}async onSign(){var e,i,r;this.isSigning=!0,n.EventsController.sendEvent({event:"CLICK_SIGN_SIWE_MESSAGE",type:"track",properties:{network:((e=n.NetworkController.state.caipNetwork)==null?void 0:e.id)||"",isSmartAccount:n.AccountController.state.preferredAccountType===n.W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT}});try{u.setStatus("loading");const a=await u.signIn();return u.setStatus("success"),n.EventsController.sendEvent({event:"SIWE_AUTH_SUCCESS",type:"track",properties:{network:((i=n.NetworkController.state.caipNetwork)==null?void 0:i.id)||"",isSmartAccount:n.AccountController.state.preferredAccountType===n.W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT}}),a}catch{const c=n.AccountController.state.preferredAccountType===n.W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT;return c?n.SnackController.showError("This application might not support Smart Accounts"):n.SnackController.showError("Signature declined"),u.setStatus("error"),n.EventsController.sendEvent({event:"SIWE_AUTH_ERROR",type:"track",properties:{network:((r=n.NetworkController.state.caipNetwork)==null?void 0:r.id)||"",isSmartAccount:c}})}finally{this.isSigning=!1}}async onCancel(){var i;this.isCancelling=!0,n.AccountController.state.isConnected?(await n.ConnectionController.disconnect(),n.ModalController.close()):n.RouterController.push("Connect"),this.isCancelling=!1,n.EventsController.sendEvent({event:"CLICK_CANCEL_SIWE",type:"track",properties:{network:((i=n.NetworkController.state.caipNetwork)==null?void 0:i.id)||"",isSmartAccount:n.AccountController.state.preferredAccountType===n.W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT}})}};g([n.r()],exports.W3mConnectingSiweView.prototype,"isSigning",void 0);g([n.r()],exports.W3mConnectingSiweView.prototype,"isCancelling",void 0);exports.W3mConnectingSiweView=g([n.customElement("w3m-connecting-siwe-view")],exports.W3mConnectingSiweView);exports.formatMessage=n.Jf;exports.getDidAddress=n.Yi;exports.getDidChainId=n.Gi;exports.SIWEController=u;