New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@polkadot/params

Package Overview
Dependencies
Maintainers
1
Versions
163
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@polkadot/params - npm Package Compare versions

Comparing version 0.17.27 to 0.17.28

16

decode/index.js

@@ -12,7 +12,7 @@ "use strict";

function decodeTuple(type, input) {
function decodeTuple(type, input, version) {
const value = [];
let length = 0;
type.forEach(_type => {
const decoded = decode(_type, input.subarray(length));
const decoded = decode(_type, input.subarray(length), version);
value.push(decoded.value);

@@ -27,3 +27,3 @@ length += decoded.length;

function decodeArray([type], input) {
function decodeArray([type], input, version) {
const arrayLength = u8aToBn(input.subarray(0, 4), true).toNumber();

@@ -34,3 +34,3 @@ const value = [];

for (let index = 0; index < arrayLength; index++) {
const decoded = decode(type, input.subarray(length));
const decoded = decode(type, input.subarray(length), version);
value.push(decoded.value);

@@ -46,15 +46,15 @@ length += decoded.length;

function decode(type, input) {
function decode(type, input, version) {
if (Array.isArray(type)) {
// Arrays have single entries, Tuples will have multiple types
if (type.length === 1) {
return decodeArray(type, input);
return decodeArray(type, input, version);
} else {
return decodeTuple(type, input);
return decodeTuple(type, input, version);
}
}
return decodeValue(decode, type, input);
return decodeValue(decode, type, input, version);
}
module.exports = decode;

@@ -36,3 +36,3 @@ "use strict";

module.exports = function decodeValue(decode, type, input) {
module.exports = function decodeValue(decode, type, input, version) {
try {

@@ -42,3 +42,3 @@ switch (type) {

case 'AccountId':
return u8a(input, 256);
return u8a(input, 256, version === 'poc-1' ? 0 : 1);

@@ -61,3 +61,3 @@ case 'Balance':

case 'Proposal':
return method(decode, input, type === 'Call');
return method(decode, input, type === 'Call', version);

@@ -77,3 +77,3 @@ case 'Code':

case 'Hash':
return u8a(input, 256);
return u8a(input, 256, 0);

@@ -98,3 +98,3 @@ case 'Index':

case 'Signature':
return u8a(input, 512);
return u8a(input, 512, 0);

@@ -101,0 +101,0 @@ case 'String':

@@ -12,3 +12,3 @@ "use strict";

module.exports = function call(decode, input, isPublic) {
module.exports = function call(decode, input, isPublic, version) {
const section = (0, _keys.default)(extrinsics).find(name => extrinsics[name].index[0] === input[0]);

@@ -42,3 +42,3 @@

}) => {
const decoded = decode(type, input.subarray(length));
const decoded = decode(type, input.subarray(length), version);
value.params.push(decoded.value);

@@ -45,0 +45,0 @@ return {

@@ -6,8 +6,8 @@ "use strict";

// of the ISC license. See the LICENSE file for details.
module.exports = function u8a(input, bitLength) {
const length = bitLength / 8;
module.exports = function u8a(input, bitLength, offset) {
const length = bitLength / 8 + offset;
return {
length,
value: input.subarray(0, length)
value: input.subarray(offset, length)
};
};

@@ -6,2 +6,4 @@ "use strict";

// of the ISC license. See the LICENSE file for details.
const addrPrefixes = require('@polkadot/extrinsics-codec/encode/prefixes');
const bnToU8a = require('@polkadot/util/bn/toU8a');

@@ -24,3 +26,3 @@

case 'AccountId':
return addressDecode(value);
return u8aConcat(version === 'poc-1' ? addrPrefixes.none : addrPrefixes.publicKey, addressDecode(value));

@@ -27,0 +29,0 @@ case 'Balance':

{
"name": "@polkadot/params",
"version": "0.17.27",
"version": "0.17.28",
"description": "Type defintions for parameters as passed in calls",

@@ -37,6 +37,7 @@ "main": "index.js",

"@babel/runtime": "^7.0.0-beta.47",
"@polkadot/extrinsics": "^0.17.27",
"@polkadot/primitives": "^0.17.27",
"@polkadot/extrinsics": "^0.17.28",
"@polkadot/extrinsics-codec": "^0.17.28",
"@polkadot/primitives": "^0.17.28",
"@polkadot/util": "^0.22.11"
}
}

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

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