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

@polkadot/keyring

Package Overview
Dependencies
Maintainers
2
Versions
1173
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@polkadot/keyring - npm Package Compare versions

Comparing version 12.0.1 to 12.1.1

63

bundle-polkadot-keyring.js
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@polkadot/util'), require('@polkadot/util-crypto')) :
typeof define === 'function' && define.amd ? define(['exports', '@polkadot/util', '@polkadot/util-crypto'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.polkadotKeyring = {}, global.polkadotUtil, global.polkadotUtilCrypto));
})(this, (function (exports, util, utilCrypto) { 'use strict';
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@polkadot/util-crypto'), require('@polkadot/util')) :
typeof define === 'function' && define.amd ? define(['exports', '@polkadot/util-crypto', '@polkadot/util'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.polkadotKeyring = {}, global.polkadotUtilCrypto, global.polkadotUtil));
})(this, (function (exports, utilCrypto, util) { 'use strict';
const global = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : window;
function __classPrivateFieldGet(receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
}
function __classPrivateFieldSet(receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
}
const PKCS8_DIVIDER = new Uint8Array([161, 35, 3, 33, 0]);

@@ -220,16 +208,15 @@ const PKCS8_HEADER = new Uint8Array([48, 83, 2, 1, 1, 48, 5, 6, 3, 43, 101, 112, 4, 34, 4, 32]);

var _Pairs_map;
class Pairs {
constructor() {
_Pairs_map.set(this, {});
this.__internal__map = {};
}
add(pair) {
__classPrivateFieldGet(this, _Pairs_map, "f")[utilCrypto.decodeAddress(pair.address).toString()] = pair;
this.__internal__map[utilCrypto.decodeAddress(pair.address).toString()] = pair;
return pair;
}
all() {
return Object.values(__classPrivateFieldGet(this, _Pairs_map, "f"));
return Object.values(this.__internal__map);
}
get(address) {
const pair = __classPrivateFieldGet(this, _Pairs_map, "f")[utilCrypto.decodeAddress(address).toString()];
const pair = this.__internal__map[utilCrypto.decodeAddress(address).toString()];
if (!pair) {

@@ -243,8 +230,6 @@ throw new Error(`Unable to retrieve keypair '${util.isU8a(address) || util.isHex(address)

remove(address) {
delete __classPrivateFieldGet(this, _Pairs_map, "f")[utilCrypto.decodeAddress(address).toString()];
delete this.__internal__map[utilCrypto.decodeAddress(address).toString()];
}
}
_Pairs_map = new WeakMap();
var _Keyring_pairs, _Keyring_type, _Keyring_ss58;
const PairFromSeed = {

@@ -261,5 +246,2 @@ ecdsa: (seed) => utilCrypto.secp256k1PairFromSeed(seed),

constructor(options = {}) {
_Keyring_pairs.set(this, void 0);
_Keyring_type.set(this, void 0);
_Keyring_ss58.set(this, void 0);
this.decodeAddress = utilCrypto.decodeAddress;

@@ -269,3 +251,3 @@ this.encodeAddress = (address, ss58Format) => {

? utilCrypto.ethereumEncode(address)
: utilCrypto.encodeAddress(address, ss58Format ?? __classPrivateFieldGet(this, _Keyring_ss58, "f"));
: utilCrypto.encodeAddress(address, ss58Format ?? this.__internal__ss58);
};

@@ -276,5 +258,5 @@ options.type = options.type || 'ed25519';

}
__classPrivateFieldSet(this, _Keyring_pairs, new Pairs(), "f");
__classPrivateFieldSet(this, _Keyring_ss58, options.ss58Format, "f");
__classPrivateFieldSet(this, _Keyring_type, options.type, "f");
this.__internal__pairs = new Pairs();
this.__internal__ss58 = options.ss58Format;
this.__internal__type = options.type;
}

@@ -288,6 +270,6 @@ get pairs() {

get type() {
return __classPrivateFieldGet(this, _Keyring_type, "f");
return this.__internal__type;
}
addPair(pair) {
return __classPrivateFieldGet(this, _Keyring_pairs, "f").add(pair);
return this.__internal__pairs.add(pair);
}

@@ -369,23 +351,22 @@ addFromAddress(address, meta = {}, encoded = null, type = this.type, ignoreChecksum, encType) {

getPair(address) {
return __classPrivateFieldGet(this, _Keyring_pairs, "f").get(address);
return this.__internal__pairs.get(address);
}
getPairs() {
return __classPrivateFieldGet(this, _Keyring_pairs, "f").all();
return this.__internal__pairs.all();
}
getPublicKeys() {
return __classPrivateFieldGet(this, _Keyring_pairs, "f").all().map(pairToPublic);
return this.__internal__pairs.all().map(pairToPublic);
}
removePair(address) {
__classPrivateFieldGet(this, _Keyring_pairs, "f").remove(address);
this.__internal__pairs.remove(address);
}
setSS58Format(ss58) {
__classPrivateFieldSet(this, _Keyring_ss58, ss58, "f");
this.__internal__ss58 = ss58;
}
toJson(address, passphrase) {
return __classPrivateFieldGet(this, _Keyring_pairs, "f").get(address).toJson(passphrase);
return this.__internal__pairs.get(address).toJson(passphrase);
}
}
_Keyring_pairs = new WeakMap(), _Keyring_type = new WeakMap(), _Keyring_ss58 = new WeakMap();
const packageInfo = { name: '@polkadot/keyring', path: (({ url: (typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('bundle-polkadot-keyring.js', document.baseURI).href)) }) && (typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('bundle-polkadot-keyring.js', document.baseURI).href))) ? new URL((typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('bundle-polkadot-keyring.js', document.baseURI).href))).pathname.substring(0, new URL((typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('bundle-polkadot-keyring.js', document.baseURI).href))).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '12.0.1' };
const packageInfo = { name: '@polkadot/keyring', path: (({ url: (typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('bundle-polkadot-keyring.js', document.baseURI).href)) }) && (typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('bundle-polkadot-keyring.js', document.baseURI).href))) ? new URL((typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('bundle-polkadot-keyring.js', document.baseURI).href))).pathname.substring(0, new URL((typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('bundle-polkadot-keyring.js', document.baseURI).href))).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '12.1.1' };

@@ -392,0 +373,0 @@ const PAIRSSR25519 = [

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

import { Keyring } from './keyring.js';
export { decodeAddress, encodeAddress, setSS58Format } from '@polkadot/util-crypto';
export * from './defaults.js';
export { Keyring } from './keyring.js';
export { packageInfo } from './packageInfo.js';
export { createPair } from './pair/index.js';
export { packageInfo } from './packageInfo.js';
export { createTestKeyring } from './testing.js';
export { createTestPairs } from './testingPairs.js';
export { Keyring };
export * from './defaults.js';

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

import { Keyring } from './keyring.js';
export { decodeAddress, encodeAddress, setSS58Format } from '@polkadot/util-crypto';
export * from './defaults.js';
export { Keyring } from './keyring.js';
export { packageInfo } from './packageInfo.js';
export { createPair } from './pair/index.js';
export { packageInfo } from './packageInfo.js';
export { createTestKeyring } from './testing.js';
export { createTestPairs } from './testingPairs.js';
export { Keyring };
export * from './defaults.js';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Keyring = exports.createTestPairs = exports.createTestKeyring = exports.packageInfo = exports.createPair = exports.setSS58Format = exports.encodeAddress = exports.decodeAddress = void 0;
exports.createTestPairs = exports.createTestKeyring = exports.createPair = exports.packageInfo = exports.Keyring = exports.setSS58Format = exports.encodeAddress = exports.decodeAddress = void 0;
const tslib_1 = require("tslib");
const keyring_js_1 = require("./keyring.js");
Object.defineProperty(exports, "Keyring", { enumerable: true, get: function () { return keyring_js_1.Keyring; } });
var util_crypto_1 = require("@polkadot/util-crypto");

@@ -11,7 +9,8 @@ Object.defineProperty(exports, "decodeAddress", { enumerable: true, get: function () { return util_crypto_1.decodeAddress; } });

Object.defineProperty(exports, "setSS58Format", { enumerable: true, get: function () { return util_crypto_1.setSS58Format; } });
tslib_1.__exportStar(require("./defaults.js"), exports);
var keyring_js_1 = require("./keyring.js");
Object.defineProperty(exports, "Keyring", { enumerable: true, get: function () { return keyring_js_1.Keyring; } });
var packageInfo_js_1 = require("./packageInfo.js");
Object.defineProperty(exports, "packageInfo", { enumerable: true, get: function () { return packageInfo_js_1.packageInfo; } });
var index_js_1 = require("./pair/index.js");
Object.defineProperty(exports, "createPair", { enumerable: true, get: function () { return index_js_1.createPair; } });
var packageInfo_js_1 = require("./packageInfo.js");
Object.defineProperty(exports, "packageInfo", { enumerable: true, get: function () { return packageInfo_js_1.packageInfo; } });
var testing_js_1 = require("./testing.js");

@@ -21,1 +20,2 @@ Object.defineProperty(exports, "createTestKeyring", { enumerable: true, get: function () { return testing_js_1.createTestKeyring; } });

Object.defineProperty(exports, "createTestPairs", { enumerable: true, get: function () { return testingPairs_js_1.createTestPairs; } });
tslib_1.__exportStar(require("./defaults.js"), exports);
"use strict";
var _Keyring_pairs, _Keyring_type, _Keyring_ss58;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Keyring = void 0;
const tslib_1 = require("tslib");
const util_1 = require("@polkadot/util");

@@ -38,5 +36,2 @@ const util_crypto_1 = require("@polkadot/util-crypto");

constructor(options = {}) {
_Keyring_pairs.set(this, void 0);
_Keyring_type.set(this, void 0);
_Keyring_ss58.set(this, void 0);
this.decodeAddress = util_crypto_1.decodeAddress;

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

? (0, util_crypto_1.ethereumEncode)(address)
: (0, util_crypto_1.encodeAddress)(address, ss58Format ?? tslib_1.__classPrivateFieldGet(this, _Keyring_ss58, "f"));
: (0, util_crypto_1.encodeAddress)(address, ss58Format ?? this.__internal__ss58);
};

@@ -57,5 +52,5 @@ options.type = options.type || 'ed25519';

}
tslib_1.__classPrivateFieldSet(this, _Keyring_pairs, new pairs_js_1.Pairs(), "f");
tslib_1.__classPrivateFieldSet(this, _Keyring_ss58, options.ss58Format, "f");
tslib_1.__classPrivateFieldSet(this, _Keyring_type, options.type, "f");
this.__internal__pairs = new pairs_js_1.Pairs();
this.__internal__ss58 = options.ss58Format;
this.__internal__type = options.type;
}

@@ -78,3 +73,3 @@ /**

get type() {
return tslib_1.__classPrivateFieldGet(this, _Keyring_type, "f");
return this.__internal__type;
}

@@ -86,3 +81,3 @@ /**

addPair(pair) {
return tslib_1.__classPrivateFieldGet(this, _Keyring_pairs, "f").add(pair);
return this.__internal__pairs.add(pair);
}

@@ -224,3 +219,3 @@ /**

getPair(address) {
return tslib_1.__classPrivateFieldGet(this, _Keyring_pairs, "f").get(address);
return this.__internal__pairs.get(address);
}

@@ -233,3 +228,3 @@ /**

getPairs() {
return tslib_1.__classPrivateFieldGet(this, _Keyring_pairs, "f").all();
return this.__internal__pairs.all();
}

@@ -242,3 +237,3 @@ /**

getPublicKeys() {
return tslib_1.__classPrivateFieldGet(this, _Keyring_pairs, "f").all().map(pairToPublic);
return this.__internal__pairs.all().map(pairToPublic);
}

@@ -250,3 +245,3 @@ /**

removePair(address) {
tslib_1.__classPrivateFieldGet(this, _Keyring_pairs, "f").remove(address);
this.__internal__pairs.remove(address);
}

@@ -258,3 +253,3 @@ /**

setSS58Format(ss58) {
tslib_1.__classPrivateFieldSet(this, _Keyring_ss58, ss58, "f");
this.__internal__ss58 = ss58;
}

@@ -270,6 +265,5 @@ /**

toJson(address, passphrase) {
return tslib_1.__classPrivateFieldGet(this, _Keyring_pairs, "f").get(address).toJson(passphrase);
return this.__internal__pairs.get(address).toJson(passphrase);
}
}
exports.Keyring = Keyring;
_Keyring_pairs = new WeakMap(), _Keyring_type = new WeakMap(), _Keyring_ss58 = new WeakMap();
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.packageInfo = void 0;
exports.packageInfo = { name: '@polkadot/keyring', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '12.0.1' };
exports.packageInfo = { name: '@polkadot/keyring', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '12.1.1' };
"use strict";
var _Pairs_map;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Pairs = void 0;
const tslib_1 = require("tslib");
const util_1 = require("@polkadot/util");

@@ -10,13 +8,13 @@ const util_crypto_1 = require("@polkadot/util-crypto");

constructor() {
_Pairs_map.set(this, {});
this.__internal__map = {};
}
add(pair) {
tslib_1.__classPrivateFieldGet(this, _Pairs_map, "f")[(0, util_crypto_1.decodeAddress)(pair.address).toString()] = pair;
this.__internal__map[(0, util_crypto_1.decodeAddress)(pair.address).toString()] = pair;
return pair;
}
all() {
return Object.values(tslib_1.__classPrivateFieldGet(this, _Pairs_map, "f"));
return Object.values(this.__internal__map);
}
get(address) {
const pair = tslib_1.__classPrivateFieldGet(this, _Pairs_map, "f")[(0, util_crypto_1.decodeAddress)(address).toString()];
const pair = this.__internal__map[(0, util_crypto_1.decodeAddress)(address).toString()];
if (!pair) {

@@ -30,6 +28,5 @@ throw new Error(`Unable to retrieve keypair '${(0, util_1.isU8a)(address) || (0, util_1.isHex)(address)

remove(address) {
delete tslib_1.__classPrivateFieldGet(this, _Pairs_map, "f")[(0, util_crypto_1.decodeAddress)(address).toString()];
delete this.__internal__map[(0, util_crypto_1.decodeAddress)(address).toString()];
}
}
exports.Pairs = Pairs;
_Pairs_map = new WeakMap();

@@ -1,3 +0,1 @@

var _Keyring_pairs, _Keyring_type, _Keyring_ss58;
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
import { hexToU8a, isHex, stringToU8a } from '@polkadot/util';

@@ -35,5 +33,2 @@ import { base64Decode, decodeAddress, ed25519PairFromSeed as ed25519FromSeed, encodeAddress, ethereumEncode, hdEthereum, keyExtractSuri, keyFromPath, mnemonicToLegacySeed, mnemonicToMiniSecret, secp256k1PairFromSeed as secp256k1FromSeed, sr25519PairFromSeed as sr25519FromSeed } from '@polkadot/util-crypto';

constructor(options = {}) {
_Keyring_pairs.set(this, void 0);
_Keyring_type.set(this, void 0);
_Keyring_ss58.set(this, void 0);
this.decodeAddress = decodeAddress;

@@ -47,3 +42,3 @@ /**

? ethereumEncode(address)
: encodeAddress(address, ss58Format ?? __classPrivateFieldGet(this, _Keyring_ss58, "f"));
: encodeAddress(address, ss58Format ?? this.__internal__ss58);
};

@@ -54,5 +49,5 @@ options.type = options.type || 'ed25519';

}
__classPrivateFieldSet(this, _Keyring_pairs, new Pairs(), "f");
__classPrivateFieldSet(this, _Keyring_ss58, options.ss58Format, "f");
__classPrivateFieldSet(this, _Keyring_type, options.type, "f");
this.__internal__pairs = new Pairs();
this.__internal__ss58 = options.ss58Format;
this.__internal__type = options.type;
}

@@ -75,3 +70,3 @@ /**

get type() {
return __classPrivateFieldGet(this, _Keyring_type, "f");
return this.__internal__type;
}

@@ -83,3 +78,3 @@ /**

addPair(pair) {
return __classPrivateFieldGet(this, _Keyring_pairs, "f").add(pair);
return this.__internal__pairs.add(pair);
}

@@ -221,3 +216,3 @@ /**

getPair(address) {
return __classPrivateFieldGet(this, _Keyring_pairs, "f").get(address);
return this.__internal__pairs.get(address);
}

@@ -230,3 +225,3 @@ /**

getPairs() {
return __classPrivateFieldGet(this, _Keyring_pairs, "f").all();
return this.__internal__pairs.all();
}

@@ -239,3 +234,3 @@ /**

getPublicKeys() {
return __classPrivateFieldGet(this, _Keyring_pairs, "f").all().map(pairToPublic);
return this.__internal__pairs.all().map(pairToPublic);
}

@@ -247,3 +242,3 @@ /**

removePair(address) {
__classPrivateFieldGet(this, _Keyring_pairs, "f").remove(address);
this.__internal__pairs.remove(address);
}

@@ -255,3 +250,3 @@ /**

setSS58Format(ss58) {
__classPrivateFieldSet(this, _Keyring_ss58, ss58, "f");
this.__internal__ss58 = ss58;
}

@@ -267,5 +262,4 @@ /**

toJson(address, passphrase) {
return __classPrivateFieldGet(this, _Keyring_pairs, "f").get(address).toJson(passphrase);
return this.__internal__pairs.get(address).toJson(passphrase);
}
}
_Keyring_pairs = new WeakMap(), _Keyring_type = new WeakMap(), _Keyring_ss58 = new WeakMap();

@@ -21,3 +21,3 @@ {

"type": "module",
"version": "12.0.1",
"version": "12.1.1",
"main": "./cjs/index.js",

@@ -130,10 +130,10 @@ "module": "./index.js",

"dependencies": {
"@polkadot/util": "12.0.1",
"@polkadot/util-crypto": "12.0.1",
"@polkadot/util": "12.1.1",
"@polkadot/util-crypto": "12.1.1",
"tslib": "^2.5.0"
},
"peerDependencies": {
"@polkadot/util": "12.0.1",
"@polkadot/util-crypto": "12.0.1"
"@polkadot/util": "12.1.1",
"@polkadot/util-crypto": "12.1.1"
}
}

@@ -1,1 +0,1 @@

export const packageInfo = { name: '@polkadot/keyring', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '12.0.1' };
export const packageInfo = { name: '@polkadot/keyring', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '12.1.1' };

@@ -1,3 +0,1 @@

var _Pairs_map;
import { __classPrivateFieldGet } from "tslib";
import { isHex, isU8a, u8aToHex, u8aToU8a } from '@polkadot/util';

@@ -7,13 +5,13 @@ import { decodeAddress } from '@polkadot/util-crypto';

constructor() {
_Pairs_map.set(this, {});
this.__internal__map = {};
}
add(pair) {
__classPrivateFieldGet(this, _Pairs_map, "f")[decodeAddress(pair.address).toString()] = pair;
this.__internal__map[decodeAddress(pair.address).toString()] = pair;
return pair;
}
all() {
return Object.values(__classPrivateFieldGet(this, _Pairs_map, "f"));
return Object.values(this.__internal__map);
}
get(address) {
const pair = __classPrivateFieldGet(this, _Pairs_map, "f")[decodeAddress(address).toString()];
const pair = this.__internal__map[decodeAddress(address).toString()];
if (!pair) {

@@ -27,5 +25,4 @@ throw new Error(`Unable to retrieve keypair '${isU8a(address) || isHex(address)

remove(address) {
delete __classPrivateFieldGet(this, _Pairs_map, "f")[decodeAddress(address).toString()];
delete this.__internal__map[decodeAddress(address).toString()];
}
}
_Pairs_map = new WeakMap();
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