Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@wallet01/core

Package Overview
Dependencies
Maintainers
2
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wallet01/core - npm Package Compare versions

Comparing version 0.5.4 to 0.5.5

dist/chunk-3OSFNS7Z.cjs

6

CHANGELOG.md
# @wallet01/core
## 0.5.5
### Patch Changes
- bundle packages using tsup
## 0.5.4

@@ -4,0 +10,0 @@

68

dist/client/client.js

@@ -1,56 +0,12 @@

import { Wallet01Store } from "./store";
export default class Client extends Wallet01Store {
static instance;
activeConnector = null;
constructor({ autoConnect, connectors }) {
super();
this.setAutoConnect(autoConnect || false);
this.setConnectors(connectors);
// this.setAddress('INITNIT');
if (localStorage.getItem("autoConnect") === null)
localStorage.setItem("autoConnect", String(autoConnect));
if (localStorage.getItem("autoConnect") !== String(autoConnect))
localStorage.setItem("autoConnect", String(autoConnect));
if (localStorage.getItem("lastUsedConnector") &&
localStorage.getItem("autoConnect") === "true") {
this.ac();
}
}
static init = (config) => {
if (!Client.instance)
Client.instance = new Client(config);
return Client.instance;
};
async ac() {
this.setIsAutoConnecting(true);
const lastConnName = localStorage.getItem("lastUsedConnector");
const connector = this.getConnectors().find(conn => conn.name === lastConnName);
if (!connector)
return;
else
this.setLastUsedConnector(connector);
this.setActiveConnector(this.getLastUsedConnector());
this.activeConnector = this.getLastUsedConnector();
if (this.activeConnector) {
this.activeConnector.connect({});
const addresses = await this.activeConnector.getAccount();
const address = addresses[0];
if (!address)
return;
this.setAddress(address);
try {
if (this.activeConnector.getChainId &&
(await this.activeConnector.getChainId()) === "1")
this.setDid(await this.activeConnector.resolveDid(address));
}
catch (error) {
console.error(error);
}
this.activeConnector.getChainId
? this.setChainId(await this.activeConnector.getChainId())
: this.setChainId(null);
this.setIsAutoConnecting(false);
this.setIsConnected(true);
}
}
}
import {
Client
} from "../chunk-A65LNWIU.js";
import "../chunk-PH6OAS5D.js";
import "../chunk-OBYFS5IT.js";
import "../chunk-4A3ZCJ3K.js";
import "../chunk-MNEXFLDY.js";
import "../chunk-W7E5PEDQ.js";
import "../chunk-XXPGZHWZ.js";
export {
Client as default
};

@@ -1,75 +0,11 @@

import getState from '../store/rootStore';
export class Wallet01Store {
getAddress() {
const { address } = getState();
return address;
}
getDid() {
const { did } = getState();
return did;
}
getIsConnected() {
const { isConnected } = getState();
return isConnected;
}
getChain() {
const { chainId } = getState();
return chainId;
}
getAutoConnect() {
const { autoConnect } = getState();
return autoConnect;
}
getConnectors() {
const { connectors } = getState();
return connectors;
}
getActiveConnector() {
const { activeConnector } = getState();
return activeConnector;
}
getLastUsedConnector() {
const { lastUsedConnector } = getState();
return lastUsedConnector;
}
getIsAutoConnecting() {
const { isAutoConnecting } = getState();
return isAutoConnecting;
}
setAddress(address) {
const { setAddress } = getState();
setAddress(address);
}
setDid(did) {
const { setDid } = getState();
setDid(did);
}
setIsConnected(val) {
const { setIsConnected } = getState();
setIsConnected(val);
}
setChainId(id) {
const { setChainId } = getState();
setChainId(id);
}
setAutoConnect(val) {
const { setAutoConnect } = getState();
setAutoConnect(val);
}
setConnectors(connectors) {
const { setConnectors } = getState();
setConnectors(connectors);
}
setActiveConnector(connector) {
const { setActiveConnector } = getState();
setActiveConnector(connector);
}
setLastUsedConnector(connector) {
const { setLastUsedConnector } = getState();
setLastUsedConnector(connector);
}
setIsAutoConnecting(val) {
const { setIsAutoConnecting } = getState();
setIsAutoConnecting(val);
}
}
import {
Wallet01Store
} from "../chunk-PH6OAS5D.js";
import "../chunk-OBYFS5IT.js";
import "../chunk-4A3ZCJ3K.js";
import "../chunk-MNEXFLDY.js";
import "../chunk-W7E5PEDQ.js";
import "../chunk-XXPGZHWZ.js";
export {
Wallet01Store
};

@@ -1,6 +0,24 @@

// import { Client, createClient } from './client';
import Client from "./client/client";
import { useStore } from "./store/rootStore";
import { BaseConnector, } from "./types";
import setLastUsedConnector from "./utils/util";
export { Client, BaseConnector, setLastUsedConnector, useStore, };
import "./chunk-RZMIDZ2N.js";
import {
BaseConnector
} from "./chunk-YGTQYFXZ.js";
import {
util_default
} from "./chunk-DUPRLLUL.js";
import {
Client
} from "./chunk-A65LNWIU.js";
import "./chunk-PH6OAS5D.js";
import {
useStore
} from "./chunk-OBYFS5IT.js";
import "./chunk-4A3ZCJ3K.js";
import "./chunk-MNEXFLDY.js";
import "./chunk-W7E5PEDQ.js";
import "./chunk-XXPGZHWZ.js";
export {
BaseConnector,
Client,
util_default as setLastUsedConnector,
useStore
};

@@ -1,11 +0,7 @@

const createAccountSlice = set => ({
address: null,
did: null,
setAddress: address => {
set(() => ({ address }));
},
setDid: did => {
set(() => ({ did }));
},
});
export default createAccountSlice;
import {
createAccountSlice_default
} from "../chunk-4A3ZCJ3K.js";
import "../chunk-XXPGZHWZ.js";
export {
createAccountSlice_default as default
};

@@ -1,23 +0,7 @@

const createClientSlice = set => ({
autoConnect: false,
connectors: [],
activeConnector: null,
lastUsedConnector: null,
isAutoConnecting: false,
setAutoConnect: autoConnect => {
set(() => ({ autoConnect }));
},
setConnectors: connectors => {
set(() => ({ connectors }));
},
setActiveConnector: activeConnector => {
set(() => ({ activeConnector }));
},
setLastUsedConnector: lastUsedConnector => {
set(() => ({ lastUsedConnector }));
},
setIsAutoConnecting: val => {
set(() => ({ isAutoConnecting: val }));
},
});
export default createClientSlice;
import {
createClientSlice_default
} from "../chunk-MNEXFLDY.js";
import "../chunk-XXPGZHWZ.js";
export {
createClientSlice_default as default
};

@@ -1,11 +0,7 @@

const createWalletSlice = set => ({
isConnected: false,
chainId: null,
setIsConnected: isConnected => {
set(() => ({ isConnected }));
},
setChainId: chainId => {
set(() => ({ chainId }));
},
});
export default createWalletSlice;
import {
createWalletSlice_default
} from "../chunk-W7E5PEDQ.js";
import "../chunk-XXPGZHWZ.js";
export {
createWalletSlice_default as default
};

@@ -1,11 +0,12 @@

import create from 'zustand';
import createAccountSlice from './createAccountSlice';
import createClientSlice from './createClientSlice';
import createWalletSlice from './createWalletSlice';
export const useStore = create()((...a) => ({
...createAccountSlice(...a),
...createWalletSlice(...a),
...createClientSlice(...a),
}));
const { getState } = useStore;
export default getState;
import {
rootStore_default,
useStore
} from "../chunk-OBYFS5IT.js";
import "../chunk-4A3ZCJ3K.js";
import "../chunk-MNEXFLDY.js";
import "../chunk-W7E5PEDQ.js";
import "../chunk-XXPGZHWZ.js";
export {
rootStore_default as default,
useStore
};

@@ -1,8 +0,7 @@

export class BaseConnector {
chain;
name;
constructor(chain, name) {
this.chain = chain;
this.name = name;
}
}
import {
BaseConnector
} from "../chunk-YGTQYFXZ.js";
import "../chunk-XXPGZHWZ.js";
export {
BaseConnector
};

@@ -1,2 +0,8 @@

import { BaseConnector } from './baseConnector';
export { BaseConnector };
import "../chunk-RZMIDZ2N.js";
import {
BaseConnector
} from "../chunk-YGTQYFXZ.js";
import "../chunk-XXPGZHWZ.js";
export {
BaseConnector
};

@@ -1,5 +0,7 @@

const setLastUsedConnector = (connectorName) => {
if (localStorage.getItem('lastUsedConnector') !== connectorName)
localStorage.setItem('lastUsedConnector', connectorName);
import {
util_default
} from "../chunk-DUPRLLUL.js";
import "../chunk-XXPGZHWZ.js";
export {
util_default as default
};
export default setLastUsedConnector;
{
"name": "@wallet01/core",
"version": "0.5.4",
"version": "0.5.5",
"description": "",
"main": "dist/index.js",
"main": "dist/index.cjs",
"types": "dist/index.d.ts",

@@ -19,2 +19,3 @@ "import": "dist/index.js",

"rimraf": "^3.0.2",
"tsup": "^6.5.0",
"typescript": "^4.9.3",

@@ -28,5 +29,5 @@ "tsconfig": "0.0.0"

"clean": "rimraf dist/",
"build": "pnpm clean & tsc",
"build": "tsup && tsc --emitDeclarationOnly --declaration",
"dev": "pnpm build --watch"
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc