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

vue-3-useeosiowallet

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-3-useeosiowallet - npm Package Compare versions

Comparing version 0.0.32 to 0.0.33

21

dist/anchor.js

@@ -1,12 +0,18 @@

import { ref } from 'vue';
import AnchorLink from 'anchor-link';
import AnchorLinkBrowserTransport from 'anchor-link-browser-transport';
const applicationName = ref('');
const transport = new AnchorLinkBrowserTransport();
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.useAnchor = void 0;
const vue_1 = require("vue");
const anchor_link_1 = __importDefault(require("anchor-link"));
const anchor_link_browser_transport_1 = __importDefault(require("anchor-link-browser-transport"));
const applicationName = vue_1.ref('');
const transport = new anchor_link_browser_transport_1.default();
let link = null;
let globalSession = null;
export const useAnchor = () => {
const useAnchor = () => {
const setup = async (appName, chain) => {
applicationName.value = appName;
link = new AnchorLink({ transport, chains: [chain] });
link = new anchor_link_1.default({ transport, chains: [chain] });
};

@@ -49,2 +55,3 @@ const login = async () => {

};
exports.useAnchor = useAnchor;
//# sourceMappingURL=anchor.js.map

@@ -1,9 +0,12 @@

import { useAnchor } from './anchor';
import { computed, ref } from 'vue';
import { useWaxcloud } from './waxcloud';
import { useScatter } from './scatter';
const isSetup = ref(false);
const applicationName = ref('');
export const availableChains = ref([]);
export const selectedChain = ref({
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.changeChain = exports.logout = exports.login = exports.setup = exports.isAuthenticated = exports.username = exports.selectedWallet = exports.availableWallets = exports.selectedChain = exports.availableChains = void 0;
const anchor_1 = require("./anchor");
const vue_1 = require("vue");
const waxcloud_1 = require("./waxcloud");
const scatter_1 = require("./scatter");
const isSetup = vue_1.ref(false);
const applicationName = vue_1.ref('');
exports.availableChains = vue_1.ref([]);
exports.selectedChain = vue_1.ref({
id: 'eos',

@@ -13,4 +16,4 @@ chainId: 'aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906',

});
export const availableWallets = computed(() => {
switch (selectedChain.value.id) {
exports.availableWallets = vue_1.computed(() => {
switch (exports.selectedChain.value.id) {
case 'wax':

@@ -22,6 +25,6 @@ return ['anchor', 'scatter', 'waxcloud'];

});
export const selectedWallet = ref(null);
export const username = ref(null);
export const isAuthenticated = ref(false);
export const setup = async (appName, chains) => {
exports.selectedWallet = vue_1.ref(null);
exports.username = vue_1.ref(null);
exports.isAuthenticated = vue_1.ref(false);
const setup = async (appName, chains) => {
if (!appName)

@@ -32,23 +35,24 @@ throw new Error('App Name not set.');

applicationName.value = appName;
availableChains.value = chains;
await changeChain(chains[0].id);
exports.availableChains.value = chains;
await exports.changeChain(chains[0].id);
isSetup.value = true;
};
export const login = async (walletId) => {
exports.setup = setup;
const login = async (walletId) => {
if (!isSetup.value)
throw new Error('Login Failed: Eosio wallet setup required. Please use setup() function first.');
if (isAuthenticated.value)
if (exports.isAuthenticated.value)
throw new Error('Login failed: A user is already logged in - please logout first.');
switch (walletId) {
case 'anchor':
await useAnchor().setup(applicationName.value, selectedChain.value);
username.value = await useAnchor().login();
await anchor_1.useAnchor().setup(applicationName.value, exports.selectedChain.value);
exports.username.value = await anchor_1.useAnchor().login();
break;
case 'waxcloud':
await useWaxcloud().setup(applicationName.value, selectedChain.value);
username.value = await useWaxcloud().login();
await waxcloud_1.useWaxcloud().setup(applicationName.value, exports.selectedChain.value);
exports.username.value = await waxcloud_1.useWaxcloud().login();
break;
case 'scatter':
await useScatter().setup(applicationName.value, selectedChain.value);
username.value = await useScatter().login();
await scatter_1.useScatter().setup(applicationName.value, exports.selectedChain.value);
exports.username.value = await scatter_1.useScatter().login();
break;

@@ -58,14 +62,15 @@ default:

}
isAuthenticated.value = true;
selectedWallet.value = walletId;
return username.value;
exports.isAuthenticated.value = true;
exports.selectedWallet.value = walletId;
return exports.username.value;
};
export const logout = async () => {
exports.login = login;
const logout = async () => {
if (!isSetup.value)
throw new Error('Logout Failed: Eosio wallet setup required. Please use setup() function first.');
if (!isAuthenticated.value)
if (!exports.isAuthenticated.value)
throw new Error('Logout failed: No wallet connected.');
switch (selectedWallet.value) {
switch (exports.selectedWallet.value) {
case 'anchor':
await useAnchor().logout();
await anchor_1.useAnchor().logout();
break;

@@ -75,14 +80,16 @@ default:

}
username.value = null;
isAuthenticated.value = false;
selectedWallet.value = null;
exports.username.value = null;
exports.isAuthenticated.value = false;
exports.selectedWallet.value = null;
};
export const changeChain = async (chainId) => {
const chain = availableChains.value.find((x) => x.id === chainId);
exports.logout = logout;
const changeChain = async (chainId) => {
const chain = exports.availableChains.value.find((x) => x.id === chainId);
if (!chain)
throw new Error('Chain ID not found');
if (isAuthenticated.value)
await logout();
selectedChain.value = chain;
if (exports.isAuthenticated.value)
await exports.logout();
exports.selectedChain.value = chain;
};
exports.changeChain = changeChain;
//# sourceMappingURL=index.js.map

@@ -0,17 +1,23 @@

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.useScatter = void 0;
// @ts-ignore
import ScatterJS from '@scatterjs/core';
const core_1 = __importDefault(require("@scatterjs/core"));
// @ts-ignore
import ScatterEOS from '@scatterjs/eosjs2';
import { JsonRpc } from 'eosjs';
import { ref } from 'vue';
ScatterJS.plugins(new ScatterEOS());
const applicationName = ref('');
const eosjs2_1 = __importDefault(require("@scatterjs/eosjs2"));
const eosjs_1 = require("eosjs");
const vue_1 = require("vue");
core_1.default.plugins(new eosjs2_1.default());
const applicationName = vue_1.ref('');
// @ts-ignore
let rpc = null;
let network = null;
export const useScatter = () => {
const useScatter = () => {
const setup = async (appName, chain) => {
applicationName.value = appName;
rpc = new JsonRpc(chain.nodeUrl);
network = ScatterJS.Network.fromJson({
rpc = new eosjs_1.JsonRpc(chain.nodeUrl);
network = core_1.default.Network.fromJson({
blockchain: 'eos',

@@ -26,3 +32,3 @@ chainId: chain.chainId,

try {
const connected = await ScatterJS.connect(applicationName.value, { network });
const connected = await core_1.default.connect(applicationName.value, { network });
if (!connected)

@@ -40,3 +46,3 @@ throw new Error('Scatter could not connect to app.');

await connect();
const id = await ScatterJS.login({ accounts: [network] });
const id = await core_1.default.login({ accounts: [network] });
if (!id)

@@ -59,2 +65,3 @@ throw new Error('Scatter login failed');

};
exports.useScatter = useScatter;
//# sourceMappingURL=scatter.js.map

@@ -1,4 +0,26 @@

import * as waxjs from "@waxio/waxjs/dist";
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.useWaxcloud = void 0;
const waxjs = __importStar(require("@waxio/waxjs/dist"));
let wax = null;
export const useWaxcloud = () => {
const useWaxcloud = () => {
const setup = async (appName, chain) => {

@@ -36,2 +58,3 @@ if (chain.id !== 'wax')

};
exports.useWaxcloud = useWaxcloud;
//# sourceMappingURL=waxcloud.js.map
{
"name": "vue-3-useeosiowallet",
"version": "0.0.32",
"version": "0.0.33",
"description": "",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -8,3 +8,3 @@ {

"target": "ESNEXT", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
"module": "ESNEXT", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
// "lib": [], /* Specify library files to be included in the compilation. */

@@ -11,0 +11,0 @@ // "allowJs": true, /* Allow javascript files to be compiled. */

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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