🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@vectis/extension-client

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vectis/extension-client - npm Package Compare versions

Comparing version
0.4.0
to
0.5.0
+20
cosmos/cosmos.provider.d.ts
import { AminoSignResponse, StdSignDoc } from '@cosmjs/amino';
import { DirectSignResponse, OfflineSigner } from '@cosmjs/proto-signing';
import { SignDoc } from 'cosmjs-types/cosmos/tx/v1beta1/tx';
import { CosmosProvider } from '../types/cosmos';
import { ChainInfo, KeyInfo } from '../types/vectis';
export declare function getClient(): CosmosProvider;
export declare function getSupportedChains(): Promise<ChainInfo[]>;
export declare function getKey(chainId: string): Promise<KeyInfo>;
export declare function getAccount(chainId: string): Promise<{
address: string;
name: string;
}>;
export declare function getOfflineSigner(chainId: string): Promise<OfflineSigner>;
export declare function suggestChains(chainsInfo: ChainInfo[]): Promise<void>;
export declare function enable(chainId: string): Promise<void>;
export declare function signAmino(signerAddress: string, doc: StdSignDoc): Promise<AminoSignResponse>;
export declare function signDirect(signerAddress: string, doc: SignDoc): Promise<DirectSignResponse>;
export declare function isChainSupported(chainId: string): Promise<boolean>;
export declare function onAccountChange(handler: EventListener): void;
export declare function offAccountChange(handler: EventListener): void;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.offAccountChange = exports.onAccountChange = exports.isChainSupported = exports.signDirect = exports.signAmino = exports.enable = exports.suggestChains = exports.getOfflineSigner = exports.getAccount = exports.getKey = exports.getSupportedChains = exports.getClient = void 0;
function getClient() {
return window.vectis.cosmos;
}
exports.getClient = getClient;
async function getSupportedChains() {
return await window.vectis.cosmos.getSupportedChains();
}
exports.getSupportedChains = getSupportedChains;
async function getKey(chainId) {
return await window.vectis.cosmos.getKey(chainId);
}
exports.getKey = getKey;
async function getAccount(chainId) {
const { address, name } = await getKey(chainId);
return { address, name };
}
exports.getAccount = getAccount;
async function getOfflineSigner(chainId) {
return await window.vectis.cosmos.getOfflineSigner(chainId);
}
exports.getOfflineSigner = getOfflineSigner;
async function suggestChains(chainsInfo) {
await window.vectis.cosmos.suggestChains(chainsInfo);
}
exports.suggestChains = suggestChains;
async function enable(chainId) {
await window.vectis.cosmos.enable(chainId);
}
exports.enable = enable;
async function signAmino(signerAddress, doc) {
return await window.vectis.cosmos.signAmino(signerAddress, doc);
}
exports.signAmino = signAmino;
async function signDirect(signerAddress, doc) {
return await window.vectis.cosmos.signDirect(signerAddress, doc);
}
exports.signDirect = signDirect;
async function isChainSupported(chainId) {
const chains = await getSupportedChains();
return chains.some((c) => c.chainId === chainId);
}
exports.isChainSupported = isChainSupported;
function onAccountChange(handler) {
window.addEventListener('vectis_accountChanged', handler);
}
exports.onAccountChange = onAccountChange;
function offAccountChange(handler) {
window.removeEventListener('vectis_accountChanged', handler);
}
exports.offAccountChange = offAccountChange;
import * as cosmosProvider from './cosmos/cosmos.provider';
export declare type Cosmos = typeof cosmosProvider;
export { cosmosProvider };
export declare function isInstalled(): boolean;
export declare function cosmos(): Promise<Cosmos>;
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (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.cosmos = exports.isInstalled = exports.cosmosProvider = void 0;
const cosmosProvider = __importStar(require("./cosmos/cosmos.provider"));
exports.cosmosProvider = cosmosProvider;
function isInstalled() {
return !!window.vectis;
}
exports.isInstalled = isInstalled;
function cosmos() {
return new Promise((resolve, reject) => {
const interval = setInterval(() => {
if (isInstalled()) {
clearInterval(interval);
resolve(cosmosProvider);
}
}, 100);
setTimeout(() => {
clearInterval(interval);
reject(new Error('Vectis is not installed'));
}, 500);
});
}
exports.cosmos = cosmos;
import { OfflineDirectSigner, OfflineSigner, AccountData, DirectSignResponse } from '@cosmjs/proto-signing';
import { AminoSignResponse, StdSignDoc, OfflineAminoSigner } from '@cosmjs/amino';
import { SignDoc } from 'cosmjs-types/cosmos/tx/v1beta1/tx';
import { ChainInfo, KeyInfo } from './vectis';
export interface CosmosProvider {
suggestChains(chainsInfo: ChainInfo[]): Promise<void>;
enable(chainIds: string | string[]): Promise<void>;
getSupportedChains(): Promise<ChainInfo[]>;
getKey(chainId: string): Promise<KeyInfo>;
getAccounts(chainId: string): Promise<AccountData[]>;
signAmino(signerAddress: string, doc: StdSignDoc): Promise<AminoSignResponse>;
signDirect(signerAddress: string, doc: SignDoc): Promise<DirectSignResponse>;
getOfflineSignerAmino(chainId: string): OfflineAminoSigner;
getOfflineSignerDirect(chainId: string): OfflineDirectSigner;
getOfflineSigner(chainId: string): OfflineSigner;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export { KeyInfo, ChainInfo } from './vectis';
export { CosmosProvider } from './cosmos';
export { VectisWindow } from './window';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export interface KeyInfo {
name: string;
address: string;
isNanoLedger: boolean;
isSCWallet: boolean;
algo: 'secp256k1';
pubkey: Uint8Array;
}
export interface ChainInfo {
readonly rpcUrl: string;
readonly restUrl: string;
readonly addressPrefix: string;
readonly chainId: string;
readonly chainName: string;
readonly feeToken: string;
readonly stakingToken: string;
readonly gasPrice: number;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
import { CosmosProvider } from './cosmos';
export interface VectisWindow {
vectis: {
cosmos: CosmosProvider;
version: string;
};
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
+5
-19
{
"name": "@vectis/extension-client",
"version": "0.4.0",
"version": "0.5.0",
"description": "Client for vectis extension",
"main": "./cjs/index.js",
"types": "./cjs/types/index.d.ts",
"main": "index.js",
"types": "index.d.ts",
"license": "Apache-2.0",

@@ -14,5 +14,3 @@ "publishConfig": {

"prebuild": "rimraf dist",
"build": "npm run build:esm && npm run build:cjs",
"build:esm": "tsc -p ./tsconfig.esm.json && mv dist/esm/index.js dist/esm/index.mjs",
"build:cjs": "tsc -p ./tsconfig.cjs.json",
"build": "tsc",
"postbuild": "cpy package.json dist",

@@ -30,16 +28,4 @@ "publish:dev": "npm run build && cd dist && npm publish --dry-run",

"rimraf": "^3.0.2",
"typescript": "^4.7.4"
},
"exports": {
".": {
"import": {
"types": "./lib/esm/types/index.d.ts",
"default": "./lib/esm/index.mjs"
},
"require": {
"types": "./lib/cjs/types/index.d.ts",
"default": "./lib/cjs/index.js"
}
}
"typescript": "^4.8.3"
}
}
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.offAccountChange = exports.onAccountChange = exports.isChainSupported = exports.signDirect = exports.signAmino = exports.enable = exports.suggestChains = exports.getOfflineSigner = exports.getAccount = exports.getKey = exports.getSupportedChains = exports.getClient = void 0;
function getClient() {
return window.vectis.cosmos;
}
exports.getClient = getClient;
function getSupportedChains() {
return __awaiter(this, void 0, void 0, function* () {
return yield window.vectis.cosmos.getSupportedChains();
});
}
exports.getSupportedChains = getSupportedChains;
function getKey(chainId) {
return __awaiter(this, void 0, void 0, function* () {
return yield window.vectis.cosmos.getKey(chainId);
});
}
exports.getKey = getKey;
function getAccount(chainId) {
return __awaiter(this, void 0, void 0, function* () {
const { address, name } = yield getKey(chainId);
return { address, name };
});
}
exports.getAccount = getAccount;
function getOfflineSigner(chainId) {
return __awaiter(this, void 0, void 0, function* () {
return yield window.vectis.cosmos.getOfflineSigner(chainId);
});
}
exports.getOfflineSigner = getOfflineSigner;
function suggestChains(chainsInfo) {
return __awaiter(this, void 0, void 0, function* () {
yield window.vectis.cosmos.suggestChains(chainsInfo);
});
}
exports.suggestChains = suggestChains;
function enable(chainId) {
return __awaiter(this, void 0, void 0, function* () {
yield window.vectis.cosmos.enable(chainId);
});
}
exports.enable = enable;
function signAmino(signerAddress, doc) {
return __awaiter(this, void 0, void 0, function* () {
return yield window.vectis.cosmos.signAmino(signerAddress, doc);
});
}
exports.signAmino = signAmino;
function signDirect(signerAddress, doc) {
return __awaiter(this, void 0, void 0, function* () {
return yield window.vectis.cosmos.signDirect(signerAddress, doc);
});
}
exports.signDirect = signDirect;
function isChainSupported(chainId) {
return __awaiter(this, void 0, void 0, function* () {
const chains = yield getSupportedChains();
return chains.some((c) => c.chainId === chainId);
});
}
exports.isChainSupported = isChainSupported;
function onAccountChange(handler) {
window.addEventListener('vectis_accountChanged', handler);
}
exports.onAccountChange = onAccountChange;
function offAccountChange(handler) {
window.removeEventListener('vectis_accountChanged', handler);
}
exports.offAccountChange = offAccountChange;
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (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.cosmos = exports.isInstalled = exports.cosmosProvider = void 0;
const cosmosProvider = __importStar(require("./cosmos/cosmos.provider"));
exports.cosmosProvider = cosmosProvider;
function isInstalled() {
return !!window.vectis;
}
exports.isInstalled = isInstalled;
function cosmos() {
return new Promise((resolve, reject) => {
const interval = setInterval(() => {
if (isInstalled()) {
clearInterval(interval);
resolve(cosmosProvider);
}
}, 100);
setTimeout(() => {
clearInterval(interval);
reject(new Error('Vectis is not installed'));
}, 500);
});
}
exports.cosmos = cosmos;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
import { AminoSignResponse, StdSignDoc } from '@cosmjs/amino';
import { DirectSignResponse, OfflineSigner } from '@cosmjs/proto-signing';
import { SignDoc } from 'cosmjs-types/cosmos/tx/v1beta1/tx';
import { CosmosProvider } from '../types/cosmos';
import { ChainInfo, KeyInfo } from '../types/vectis';
export declare function getClient(): CosmosProvider;
export declare function getSupportedChains(): Promise<ChainInfo[]>;
export declare function getKey(chainId: string): Promise<KeyInfo>;
export declare function getAccount(chainId: string): Promise<{
address: string;
name: string;
}>;
export declare function getOfflineSigner(chainId: string): Promise<OfflineSigner>;
export declare function suggestChains(chainsInfo: ChainInfo[]): Promise<void>;
export declare function enable(chainId: string): Promise<void>;
export declare function signAmino(signerAddress: string, doc: StdSignDoc): Promise<AminoSignResponse>;
export declare function signDirect(signerAddress: string, doc: SignDoc): Promise<DirectSignResponse>;
export declare function isChainSupported(chainId: string): Promise<boolean>;
export declare function onAccountChange(handler: EventListener): void;
export declare function offAccountChange(handler: EventListener): void;
import * as cosmosProvider from './cosmos/cosmos.provider';
export declare type Cosmos = typeof cosmosProvider;
export { cosmosProvider };
export declare function isInstalled(): boolean;
export declare function cosmos(): Promise<Cosmos>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
import { OfflineDirectSigner, OfflineSigner, AccountData, DirectSignResponse } from '@cosmjs/proto-signing';
import { AminoSignResponse, StdSignDoc, OfflineAminoSigner } from '@cosmjs/amino';
import { SignDoc } from 'cosmjs-types/cosmos/tx/v1beta1/tx';
import { ChainInfo, KeyInfo } from './vectis';
export interface CosmosProvider {
suggestChains(chainsInfo: ChainInfo[]): Promise<void>;
enable(chainIds: string | string[]): Promise<void>;
getSupportedChains(): Promise<ChainInfo[]>;
getKey(chainId: string): Promise<KeyInfo>;
getAccounts(chainId: string): Promise<AccountData[]>;
signAmino(signerAddress: string, doc: StdSignDoc): Promise<AminoSignResponse>;
signDirect(signerAddress: string, doc: SignDoc): Promise<DirectSignResponse>;
getOfflineSignerAmino(chainId: string): OfflineAminoSigner;
getOfflineSignerDirect(chainId: string): OfflineDirectSigner;
getOfflineSigner(chainId: string): OfflineSigner;
}
export { KeyInfo, ChainInfo } from './vectis';
export { CosmosProvider } from './cosmos';
export { VectisWindow } from './window';
export interface KeyInfo {
name: string;
address: string;
isNanoLedger: boolean;
isSCWallet: boolean;
algo: 'secp256k1';
pubkey: Uint8Array;
}
export interface ChainInfo {
readonly rpcUrl: string;
readonly restUrl: string;
readonly addressPrefix: string;
readonly chainId: string;
readonly chainName: string;
readonly feeToken: string;
readonly stakingToken: string;
readonly gasPrice: number;
}
import { CosmosProvider } from './cosmos';
export interface VectisWindow {
vectis: {
cosmos: CosmosProvider;
version: string;
};
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export function getClient() {
return window.vectis.cosmos;
}
export async function getSupportedChains() {
return await window.vectis.cosmos.getSupportedChains();
}
export async function getKey(chainId) {
return await window.vectis.cosmos.getKey(chainId);
}
export async function getAccount(chainId) {
const { address, name } = await getKey(chainId);
return { address, name };
}
export async function getOfflineSigner(chainId) {
return await window.vectis.cosmos.getOfflineSigner(chainId);
}
export async function suggestChains(chainsInfo) {
await window.vectis.cosmos.suggestChains(chainsInfo);
}
export async function enable(chainId) {
await window.vectis.cosmos.enable(chainId);
}
export async function signAmino(signerAddress, doc) {
return await window.vectis.cosmos.signAmino(signerAddress, doc);
}
export async function signDirect(signerAddress, doc) {
return await window.vectis.cosmos.signDirect(signerAddress, doc);
}
export async function isChainSupported(chainId) {
const chains = await getSupportedChains();
return chains.some((c) => c.chainId === chainId);
}
export function onAccountChange(handler) {
window.addEventListener('vectis_accountChanged', handler);
}
export function offAccountChange(handler) {
window.removeEventListener('vectis_accountChanged', handler);
}
import * as cosmosProvider from './cosmos/cosmos.provider';
export { cosmosProvider };
export function isInstalled() {
return !!window.vectis;
}
export function cosmos() {
return new Promise((resolve, reject) => {
const interval = setInterval(() => {
if (isInstalled()) {
clearInterval(interval);
resolve(cosmosProvider);
}
}, 100);
setTimeout(() => {
clearInterval(interval);
reject(new Error('Vectis is not installed'));
}, 500);
});
}
import { AminoSignResponse, StdSignDoc } from '@cosmjs/amino';
import { DirectSignResponse, OfflineSigner } from '@cosmjs/proto-signing';
import { SignDoc } from 'cosmjs-types/cosmos/tx/v1beta1/tx';
import { CosmosProvider } from '../types/cosmos';
import { ChainInfo, KeyInfo } from '../types/vectis';
export declare function getClient(): CosmosProvider;
export declare function getSupportedChains(): Promise<ChainInfo[]>;
export declare function getKey(chainId: string): Promise<KeyInfo>;
export declare function getAccount(chainId: string): Promise<{
address: string;
name: string;
}>;
export declare function getOfflineSigner(chainId: string): Promise<OfflineSigner>;
export declare function suggestChains(chainsInfo: ChainInfo[]): Promise<void>;
export declare function enable(chainId: string): Promise<void>;
export declare function signAmino(signerAddress: string, doc: StdSignDoc): Promise<AminoSignResponse>;
export declare function signDirect(signerAddress: string, doc: SignDoc): Promise<DirectSignResponse>;
export declare function isChainSupported(chainId: string): Promise<boolean>;
export declare function onAccountChange(handler: EventListener): void;
export declare function offAccountChange(handler: EventListener): void;
import * as cosmosProvider from './cosmos/cosmos.provider';
export declare type Cosmos = typeof cosmosProvider;
export { cosmosProvider };
export declare function isInstalled(): boolean;
export declare function cosmos(): Promise<Cosmos>;
export {};
import { OfflineDirectSigner, OfflineSigner, AccountData, DirectSignResponse } from '@cosmjs/proto-signing';
import { AminoSignResponse, StdSignDoc, OfflineAminoSigner } from '@cosmjs/amino';
import { SignDoc } from 'cosmjs-types/cosmos/tx/v1beta1/tx';
import { ChainInfo, KeyInfo } from './vectis';
export interface CosmosProvider {
suggestChains(chainsInfo: ChainInfo[]): Promise<void>;
enable(chainIds: string | string[]): Promise<void>;
getSupportedChains(): Promise<ChainInfo[]>;
getKey(chainId: string): Promise<KeyInfo>;
getAccounts(chainId: string): Promise<AccountData[]>;
signAmino(signerAddress: string, doc: StdSignDoc): Promise<AminoSignResponse>;
signDirect(signerAddress: string, doc: SignDoc): Promise<DirectSignResponse>;
getOfflineSignerAmino(chainId: string): OfflineAminoSigner;
getOfflineSignerDirect(chainId: string): OfflineDirectSigner;
getOfflineSigner(chainId: string): OfflineSigner;
}
export { KeyInfo, ChainInfo } from './vectis';
export { CosmosProvider } from './cosmos';
export { VectisWindow } from './window';
export interface KeyInfo {
name: string;
address: string;
isNanoLedger: boolean;
isSCWallet: boolean;
algo: 'secp256k1';
pubkey: Uint8Array;
}
export interface ChainInfo {
readonly rpcUrl: string;
readonly restUrl: string;
readonly addressPrefix: string;
readonly chainId: string;
readonly chainName: string;
readonly feeToken: string;
readonly stakingToken: string;
readonly gasPrice: number;
}
import { CosmosProvider } from './cosmos';
export interface VectisWindow {
vectis: {
cosmos: CosmosProvider;
version: string;
};
}