chore: update to version 14.0.11 and align website URLs

This commit is contained in:
2026-01-11 11:34:13 +03:00
parent ef74383349
commit 19c8d69bd8
1499 changed files with 53633 additions and 89 deletions
+2
View File
@@ -0,0 +1,2 @@
import type { HexString } from '@pezkuwi/util/types';
export declare function ethereumEncode(addressOrPublic?: string | Uint8Array): HexString;
@@ -0,0 +1,28 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ethereumEncode = ethereumEncode;
const util_1 = require("@pezkuwi/util");
const index_js_1 = require("../keccak/index.js");
const index_js_2 = require("../secp256k1/index.js");
function getH160(u8a) {
if ([33, 65].includes(u8a.length)) {
u8a = (0, index_js_1.keccakAsU8a)((0, index_js_2.secp256k1Expand)(u8a));
}
return u8a.slice(-20);
}
function ethereumEncode(addressOrPublic) {
if (!addressOrPublic) {
return '0x';
}
const u8aAddress = (0, util_1.u8aToU8a)(addressOrPublic);
if (![20, 32, 33, 65].includes(u8aAddress.length)) {
throw new Error(`Invalid address or publicKey provided, received ${u8aAddress.length} bytes input`);
}
const address = (0, util_1.u8aToHex)(getH160(u8aAddress), -1, false);
const hash = (0, util_1.u8aToHex)((0, index_js_1.keccakAsU8a)(address), -1, false);
let result = '';
for (let i = 0; i < 40; i++) {
result = `${result}${parseInt(hash[i], 16) > 7 ? address[i].toUpperCase() : address[i]}`;
}
return `0x${result}`;
}
+3
View File
@@ -0,0 +1,3 @@
export { ethereumEncode } from './encode.js';
export { isEthereumAddress } from './isAddress.js';
export { isEthereumChecksum } from './isChecksum.js';
@@ -0,0 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isEthereumChecksum = exports.isEthereumAddress = exports.ethereumEncode = void 0;
var encode_js_1 = require("./encode.js");
Object.defineProperty(exports, "ethereumEncode", { enumerable: true, get: function () { return encode_js_1.ethereumEncode; } });
var isAddress_js_1 = require("./isAddress.js");
Object.defineProperty(exports, "isEthereumAddress", { enumerable: true, get: function () { return isAddress_js_1.isEthereumAddress; } });
var isChecksum_js_1 = require("./isChecksum.js");
Object.defineProperty(exports, "isEthereumChecksum", { enumerable: true, get: function () { return isChecksum_js_1.isEthereumChecksum; } });
+1
View File
@@ -0,0 +1 @@
export declare function isEthereumAddress(address?: string): boolean;
@@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isEthereumAddress = isEthereumAddress;
const util_1 = require("@pezkuwi/util");
const isChecksum_js_1 = require("./isChecksum.js");
function isEthereumAddress(address) {
if (!address || address.length !== 42 || !(0, util_1.isHex)(address)) {
return false;
}
else if (/^(0x)?[0-9a-f]{40}$/.test(address) || /^(0x)?[0-9A-F]{40}$/.test(address)) {
return true;
}
return (0, isChecksum_js_1.isEthereumChecksum)(address);
}
+1
View File
@@ -0,0 +1 @@
export declare function isEthereumChecksum(_address: string): boolean;
@@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isEthereumChecksum = isEthereumChecksum;
const util_1 = require("@pezkuwi/util");
const index_js_1 = require("../keccak/index.js");
function isInvalidChar(char, byte) {
return char !== (byte > 7
? char.toUpperCase()
: char.toLowerCase());
}
function isEthereumChecksum(_address) {
const address = _address.replace('0x', '');
const hash = (0, util_1.u8aToHex)((0, index_js_1.keccakAsU8a)(address.toLowerCase()), -1, false);
for (let i = 0; i < 40; i++) {
if (isInvalidChar(address[i], parseInt(hash[i], 16))) {
return false;
}
}
return true;
}