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

micro-eth-signer

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

micro-eth-signer - npm Package Compare versions

Comparing version 0.7.1 to 0.7.2

3

lib/_type_test.js

@@ -65,5 +65,2 @@ "use strict";

]));
assertType(web3.mapArgs([{ type: 'uint32[1][]' }]));
// zero sized arrays not supported by types
assertType(web3.mapArgs([{ type: 'uint32[0][]' }]));
// Without const

@@ -70,0 +67,0 @@ assertType(web3.mapArgs([

@@ -63,5 +63,2 @@ import * as web3 from './web3.js';

]));
assertType(web3.mapArgs([{ type: 'uint32[1][]' }]));
// zero sized arrays not supported by types
assertType(web3.mapArgs([{ type: 'uint32[0][]' }]));
// Without const

@@ -68,0 +65,0 @@ assertType(web3.mapArgs([

15

lib/esm/web3.js

@@ -30,2 +30,5 @@ import { keccak_256 } from '@noble/hashes/sha3';

// Save pointers values next to array. ETH only stuff.
// By some reason, ptr value inside arrays is placed right after ptr.
// This should work by default without 'wrappedArray'.
// TODO: Debug more later.
function wrappedArray(len, inner) {

@@ -38,3 +41,3 @@ return P.wrap({

},
decodeStream: (r) => P.array(r.length(len), inner).decodeStream(new P.Reader(r.absBytes(r.pos), r.path, r.fieldPath)),
decodeStream: (r) => P.array(r.length(len), inner).decodeStream(r.offsetReader(r.pos)),
});

@@ -89,5 +92,6 @@ }

if (m[3] !== undefined) {
if (!Number.isSafeInteger(+m[3]))
const m3 = Number.parseInt(m[3]);
if (!Number.isSafeInteger(m3))
throw new Error(`mapComponent: wrong array size=${m[3]}`);
let out = P.array(+m[3], inner);
let out = P.array(m3, inner);
// Static array of dynamic values should be behind pointer too, again without reason.

@@ -141,5 +145,6 @@ if (inner.size === undefined)

if ((m = /^bytes([0-9]{1,2})$/.exec(c.type))) {
if (!+m[1] || +m[1] > 32)
const parsed = +m[1];
if (!parsed || parsed > 32)
throw new Error('wrong bytes<N> type');
return P.padRight(32, P.bytes(+m[1]), P.ZeroPad);
return P.padRight(32, P.bytes(parsed), P.ZeroPad);
}

@@ -146,0 +151,0 @@ throw new Error(`mapComponent: unknown component=${c}`);

@@ -37,2 +37,5 @@ "use strict";

// Save pointers values next to array. ETH only stuff.
// By some reason, ptr value inside arrays is placed right after ptr.
// This should work by default without 'wrappedArray'.
// TODO: Debug more later.
function wrappedArray(len, inner) {

@@ -45,3 +48,3 @@ return P.wrap({

},
decodeStream: (r) => P.array(r.length(len), inner).decodeStream(new P.Reader(r.absBytes(r.pos), r.path, r.fieldPath)),
decodeStream: (r) => P.array(r.length(len), inner).decodeStream(r.offsetReader(r.pos)),
});

@@ -96,5 +99,6 @@ }

if (m[3] !== undefined) {
if (!Number.isSafeInteger(+m[3]))
const m3 = Number.parseInt(m[3]);
if (!Number.isSafeInteger(m3))
throw new Error(`mapComponent: wrong array size=${m[3]}`);
let out = P.array(+m[3], inner);
let out = P.array(m3, inner);
// Static array of dynamic values should be behind pointer too, again without reason.

@@ -148,5 +152,6 @@ if (inner.size === undefined)

if ((m = /^bytes([0-9]{1,2})$/.exec(c.type))) {
if (!+m[1] || +m[1] > 32)
const parsed = +m[1];
if (!parsed || parsed > 32)
throw new Error('wrong bytes<N> type');
return P.padRight(32, P.bytes(+m[1]), P.ZeroPad);
return P.padRight(32, P.bytes(parsed), P.ZeroPad);
}

@@ -153,0 +158,0 @@ throw new Error(`mapComponent: unknown component=${c}`);

{
"name": "micro-eth-signer",
"version": "0.7.1",
"description": "Small tool for Ethereum transactions, addresses and smart contracts",
"version": "0.7.2",
"description": "Minimal library for Ethereum transactions, addresses and smart contracts",
"files": [

@@ -16,3 +16,4 @@ "lib",

"@noble/hashes": "~1.3.3",
"micro-packed": "~0.5.0"
"@scure/base": "~1.1.5",
"micro-packed": "~0.5.1"
},

@@ -54,2 +55,2 @@ "devDependencies": {

}
}
}
# micro-eth-signer
Small tool for Ethereum transactions, addresses and smart contracts.
Minimal library for Ethereum transactions, addresses and smart contracts.

@@ -273,3 +273,4 @@ - 🔓 Secure: minimum deps, audited [noble](https://paulmillr.com/noble/) cryptography

Transaction signature matches `noble-curves` `sign()` speed, which means over 4000 times per second on ARM Mac.
Transaction signature matches `noble-curves` `sign()` speed,
which means over 4000 times per second on macs.

@@ -276,0 +277,0 @@ The first call of `sign` will take 20ms+ due to noble-curves secp256k1 `utils.precompute`.

@@ -93,5 +93,2 @@ import * as P from 'micro-packed';

);
assertType<P.CoderType<bigint[][]>>(web3.mapArgs([{ type: 'uint32[1][]' }] as const));
// zero sized arrays not supported by types
assertType<P.CoderType<unknown>>(web3.mapArgs([{ type: 'uint32[0][]' }] as const));
// Without const

@@ -98,0 +95,0 @@ assertType<P.CoderType<Record<string, unknown>>>(

@@ -58,2 +58,5 @@ import { keccak_256 } from '@noble/hashes/sha3';

// Save pointers values next to array. ETH only stuff.
// By some reason, ptr value inside arrays is placed right after ptr.
// This should work by default without 'wrappedArray'.
// TODO: Debug more later.
function wrappedArray<T>(len: P.Length, inner: P.CoderType<T>): P.CoderType<T[]> {

@@ -67,5 +70,3 @@ return P.wrap({

decodeStream: (r: P.Reader): T[] =>
P.array(r.length(len), inner).decodeStream(
new P.Reader(r.absBytes(r.pos), r.path, r.fieldPath)
),
P.array(r.length(len), inner).decodeStream(r.offsetReader(r.pos)),
});

@@ -203,4 +204,5 @@ }

if (m[3] !== undefined) {
if (!Number.isSafeInteger(+m[3])) throw new Error(`mapComponent: wrong array size=${m[3]}`);
let out = P.array(+m[3], inner);
const m3 = Number.parseInt(m[3]);
if (!Number.isSafeInteger(m3)) throw new Error(`mapComponent: wrong array size=${m[3]}`);
let out = P.array(m3, inner);
// Static array of dynamic values should be behind pointer too, again without reason.

@@ -245,4 +247,5 @@ if (inner.size === undefined) out = P.pointer(PTR, out);

if ((m = /^bytes([0-9]{1,2})$/.exec(c.type))) {
if (!+m[1] || +m[1] > 32) throw new Error('wrong bytes<N> type');
return P.padRight(32, P.bytes(+m[1]), P.ZeroPad) as any;
const parsed = +m[1];
if (!parsed || parsed > 32) throw new Error('wrong bytes<N> type');
return P.padRight(32, P.bytes(parsed), P.ZeroPad) as any;
}

@@ -249,0 +252,0 @@ throw new Error(`mapComponent: unknown component=${c}`);

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