Socket
Socket
Sign inDemoInstall

hashup-drm

Package Overview
Dependencies
65
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.3 to 1.0.4

2

hashup-drm.bundled.js

@@ -45,3 +45,3 @@ /**

*/
var tt=function(t,i,s,e){for(var n,o=arguments.length,r=o<3?i:null===e?e=Object.getOwnPropertyDescriptor(i,s):e,h=t.length-1;h>=0;h--)(n=t[h])&&(r=(o<3?n(r):o>3?n(i,s,r):n(i,s))||r);return o>3&&r&&Object.defineProperty(i,s,r),r};window.Moralis.start({serverUrl:"https://mqia9hg0fj9k.usemoralis.com:2053/server",appId:"yXCZJLM8gX3PgM8xc2TnxHoQfg86qukH8NRgjKPv"});let it=class extends J{constructor(){super(...arguments),this.tokenId="0x9ec4a3eff8ccaf295321aa4c2a03552f11c760af",this.balance=0,this.isAuthenticated=!1}formatUnits({balance:t,decimals:i}){return t/Math.pow(10,i)}async moralisAuthentication(){const t=window.Moralis.User.current();if(!t)return await window.Moralis.authenticate({signingMessage:"Log in using Moralis"});const[i]=await window.ethereum.request({method:"eth_requestAccounts"});return t.get("ethAddress")!==i?await window.Moralis.authenticate({signingMessage:"Log in using Moralis"}):t}async login(){try{const t=await this.moralisAuthentication();return this.isAuthenticated=!!t,t}catch(t){return console.error(t),null}}async updateGameBalance(t){const i=(await window.Moralis.Web3API.account.getTokenBalances({chain:"polygon",address:t.get("ethAddress")})).find((({token_address:t})=>t===this.tokenId));i&&(this.balance=this.formatUnits(i),this.dispatchEvent(new CustomEvent("balance-changed",{detail:this.balance})))}reset(){this.isAuthenticated=!1,this.balance=0}async connectedCallback(){if(super.connectedCallback(),!this.tokenId||""===this.tokenId)throw"Please define attribute `tokenId` first!";const t=window.Moralis.User.current(),[i]=await window.ethereum.request({method:"eth_requestAccounts"});t.get("ethAddress")!==i?await window.Moralis.User.logOut():(this.isAuthenticated=!0,this.updateGameBalance(t)),window.ethereum.on("accountsChanged",(async()=>{await window.Moralis.User.logOut(),this.reset();const t=await this.login();t&&await this.updateGameBalance(t)}))}async handleConnect(){const t=await this.login();t&&await this.updateGameBalance(t)}render(){return T`
var tt=function(t,i,s,e){for(var n,o=arguments.length,r=o<3?i:null===e?e=Object.getOwnPropertyDescriptor(i,s):e,h=t.length-1;h>=0;h--)(n=t[h])&&(r=(o<3?n(r):o>3?n(i,s,r):n(i,s))||r);return o>3&&r&&Object.defineProperty(i,s,r),r};window.Moralis.start({serverUrl:"https://mqia9hg0fj9k.usemoralis.com:2053/server",appId:"yXCZJLM8gX3PgM8xc2TnxHoQfg86qukH8NRgjKPv"});let it=class extends J{constructor(){super(...arguments),this.tokenId="0x9ec4a3eff8ccaf295321aa4c2a03552f11c760af",this.balance=0,this.isAuthenticated=!1}formatUnits({balance:t,decimals:i}){return t/Math.pow(10,i)}async moralisAuthentication(){const t=window.Moralis.User.current();if(!t)return await window.Moralis.authenticate({signingMessage:"Log in using Moralis"});const[i]=await window.ethereum.request({method:"eth_requestAccounts"});return t.get("ethAddress")!==i?await window.Moralis.authenticate({signingMessage:"Log in using Moralis"}):t}async login(){try{const t=await this.moralisAuthentication();return this.isAuthenticated=!!t,t}catch(t){return console.error(t),null}}async updateGameBalance(t){const i=(await window.Moralis.Web3API.account.getTokenBalances({chain:"polygon",address:t.get("ethAddress")})).find((({token_address:t})=>t===this.tokenId));i&&(this.balance=this.formatUnits(i),this.dispatchEvent(new CustomEvent("balance-changed",{detail:this.balance,bubbles:!0,composed:!0})))}reset(){this.isAuthenticated=!1,this.balance=0}async connectedCallback(){if(super.connectedCallback(),!this.tokenId||""===this.tokenId)throw"Please define attribute `tokenId` first!";const t=window.Moralis.User.current(),[i]=await window.ethereum.request({method:"eth_requestAccounts"});t.get("ethAddress")!==i?await window.Moralis.User.logOut():(this.isAuthenticated=!0,this.updateGameBalance(t)),window.ethereum.on("accountsChanged",(async()=>{await window.Moralis.User.logOut(),this.reset();const t=await this.login();t&&await this.updateGameBalance(t)}))}async handleConnect(){const t=await this.login();t&&await this.updateGameBalance(t)}render(){return T`
${this.isAuthenticated?this.mainTmpl():this.connectionTmpl()}

@@ -48,0 +48,0 @@ ${this.balance<1?this.notAllowedTmpl():""}

@@ -61,3 +61,3 @@ /**

this.balance = this.formatUnits(userGameToken);
this.dispatchEvent(new CustomEvent('balance-changed', { detail: this.balance }));
this.dispatchEvent(new CustomEvent('balance-changed', { detail: this.balance, bubbles: true, composed: true }));
}

@@ -64,0 +64,0 @@ }

{
"name": "hashup-drm",
"private": false,
"version": "1.0.3",
"version": "1.0.4",
"description": "Hashup drm",

@@ -6,0 +6,0 @@ "main": "hashup-drm.bundled.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc