refactor: move brother_node development artifact to dev/test-nodes subdirectory
Development Artifact Cleanup: ✅ BROTHER_NODE REORGANIZATION: Moved development test node to appropriate location - dev/test-nodes/brother_node/: Moved from root directory for better organization - Contains development configuration, test logs, and test chain data - No impact on production systems - purely development/testing artifact ✅ DEVELOPMENT ARTIFACTS IDENTIFIED: - Chain ID: aitbc-brother-chain (test/development chain) - Ports: 8010 (P2P) and 8011 (RPC) - different from production - Environment: .env file with test configuration - Logs: rpc.log and node.log from development testing session (March 15, 2026) ✅ ROOT DIRECTORY CLEANUP: Removed development clutter from production directory - brother_node/ moved to dev/test-nodes/brother_node/ - Root directory now contains only production-ready components - Development artifacts properly organized in dev/ subdirectory DIRECTORY STRUCTURE IMPROVEMENT: 📁 dev/test-nodes/: Development and testing node configurations 🏗️ Root Directory: Clean production structure with only essential components 🧪 Development Isolation: Test environments separated from production BENEFITS: ✅ Clean Production Directory: No development artifacts in root ✅ Better Organization: Development nodes grouped in dev/ subdirectory ✅ Clear Separation: Production vs development environments clearly distinguished ✅ Maintainability: Easier to identify and manage development components RESULT: Successfully moved brother_node development artifact to dev/test-nodes/ subdirectory, cleaning up the root directory while preserving development testing environment for future use.
This commit is contained in:
173
dev/env/node_modules/ethers/src.ts/address/address.ts
generated
vendored
Executable file
173
dev/env/node_modules/ethers/src.ts/address/address.ts
generated
vendored
Executable file
@@ -0,0 +1,173 @@
|
||||
import { keccak256 } from "../crypto/index.js";
|
||||
import { getBytes, assertArgument } from "../utils/index.js";
|
||||
|
||||
|
||||
const BN_0 = BigInt(0);
|
||||
const BN_36 = BigInt(36);
|
||||
|
||||
function getChecksumAddress(address: string): string {
|
||||
// if (!isHexString(address, 20)) {
|
||||
// logger.throwArgumentError("invalid address", "address", address);
|
||||
// }
|
||||
|
||||
address = address.toLowerCase();
|
||||
|
||||
const chars = address.substring(2).split("");
|
||||
|
||||
const expanded = new Uint8Array(40);
|
||||
for (let i = 0; i < 40; i++) {
|
||||
expanded[i] = chars[i].charCodeAt(0);
|
||||
}
|
||||
|
||||
const hashed = getBytes(keccak256(expanded));
|
||||
|
||||
for (let i = 0; i < 40; i += 2) {
|
||||
if ((hashed[i >> 1] >> 4) >= 8) {
|
||||
chars[i] = chars[i].toUpperCase();
|
||||
}
|
||||
if ((hashed[i >> 1] & 0x0f) >= 8) {
|
||||
chars[i + 1] = chars[i + 1].toUpperCase();
|
||||
}
|
||||
}
|
||||
|
||||
return "0x" + chars.join("");
|
||||
}
|
||||
|
||||
// See: https://en.wikipedia.org/wiki/International_Bank_Account_Number
|
||||
|
||||
// Create lookup table
|
||||
const ibanLookup: { [character: string]: string } = { };
|
||||
for (let i = 0; i < 10; i++) { ibanLookup[String(i)] = String(i); }
|
||||
for (let i = 0; i < 26; i++) { ibanLookup[String.fromCharCode(65 + i)] = String(10 + i); }
|
||||
|
||||
// How many decimal digits can we process? (for 64-bit float, this is 15)
|
||||
// i.e. Math.floor(Math.log10(Number.MAX_SAFE_INTEGER));
|
||||
const safeDigits = 15;
|
||||
|
||||
function ibanChecksum(address: string): string {
|
||||
address = address.toUpperCase();
|
||||
address = address.substring(4) + address.substring(0, 2) + "00";
|
||||
|
||||
let expanded = address.split("").map((c) => { return ibanLookup[c]; }).join("");
|
||||
|
||||
// Javascript can handle integers safely up to 15 (decimal) digits
|
||||
while (expanded.length >= safeDigits){
|
||||
let block = expanded.substring(0, safeDigits);
|
||||
expanded = parseInt(block, 10) % 97 + expanded.substring(block.length);
|
||||
}
|
||||
|
||||
let checksum = String(98 - (parseInt(expanded, 10) % 97));
|
||||
while (checksum.length < 2) { checksum = "0" + checksum; }
|
||||
|
||||
return checksum;
|
||||
};
|
||||
|
||||
const Base36 = (function() {;
|
||||
const result: Record<string, bigint> = { };
|
||||
for (let i = 0; i < 36; i++) {
|
||||
const key = "0123456789abcdefghijklmnopqrstuvwxyz"[i];
|
||||
result[key] = BigInt(i);
|
||||
}
|
||||
return result;
|
||||
})();
|
||||
|
||||
function fromBase36(value: string): bigint {
|
||||
value = value.toLowerCase();
|
||||
|
||||
let result = BN_0;
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
result = result * BN_36 + Base36[value[i]];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a normalized and checksumed address for %%address%%.
|
||||
* This accepts non-checksum addresses, checksum addresses and
|
||||
* [[getIcapAddress]] formats.
|
||||
*
|
||||
* The checksum in Ethereum uses the capitalization (upper-case
|
||||
* vs lower-case) of the characters within an address to encode
|
||||
* its checksum, which offers, on average, a checksum of 15-bits.
|
||||
*
|
||||
* If %%address%% contains both upper-case and lower-case, it is
|
||||
* assumed to already be a checksum address and its checksum is
|
||||
* validated, and if the address fails its expected checksum an
|
||||
* error is thrown.
|
||||
*
|
||||
* If you wish the checksum of %%address%% to be ignore, it should
|
||||
* be converted to lower-case (i.e. ``.toLowercase()``) before
|
||||
* being passed in. This should be a very rare situation though,
|
||||
* that you wish to bypass the safegaurds in place to protect
|
||||
* against an address that has been incorrectly copied from another
|
||||
* source.
|
||||
*
|
||||
* @example:
|
||||
* // Adds the checksum (via upper-casing specific letters)
|
||||
* getAddress("0x8ba1f109551bd432803012645ac136ddd64dba72")
|
||||
* //_result:
|
||||
*
|
||||
* // Converts ICAP address and adds checksum
|
||||
* getAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36");
|
||||
* //_result:
|
||||
*
|
||||
* // Throws an error if an address contains mixed case,
|
||||
* // but the checksum fails
|
||||
* getAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72")
|
||||
* //_error:
|
||||
*/
|
||||
export function getAddress(address: string): string {
|
||||
|
||||
assertArgument(typeof(address) === "string", "invalid address", "address", address);
|
||||
|
||||
if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) {
|
||||
|
||||
// Missing the 0x prefix
|
||||
if (!address.startsWith("0x")) { address = "0x" + address; }
|
||||
|
||||
const result = getChecksumAddress(address);
|
||||
|
||||
// It is a checksummed address with a bad checksum
|
||||
assertArgument(!address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) || result === address,
|
||||
"bad address checksum", "address", address);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Maybe ICAP? (we only support direct mode)
|
||||
if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {
|
||||
// It is an ICAP address with a bad checksum
|
||||
assertArgument(address.substring(2, 4) === ibanChecksum(address), "bad icap checksum", "address", address);
|
||||
|
||||
let result = fromBase36(address.substring(4)).toString(16);
|
||||
while (result.length < 40) { result = "0" + result; }
|
||||
return getChecksumAddress("0x" + result);
|
||||
}
|
||||
|
||||
assertArgument(false, "invalid address", "address", address);
|
||||
}
|
||||
|
||||
/**
|
||||
* The [ICAP Address format](link-icap) format is an early checksum
|
||||
* format which attempts to be compatible with the banking
|
||||
* industry [IBAN format](link-wiki-iban) for bank accounts.
|
||||
*
|
||||
* It is no longer common or a recommended format.
|
||||
*
|
||||
* @example:
|
||||
* getIcapAddress("0x8ba1f109551bd432803012645ac136ddd64dba72");
|
||||
* //_result:
|
||||
*
|
||||
* getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36");
|
||||
* //_result:
|
||||
*
|
||||
* // Throws an error if the ICAP checksum is wrong
|
||||
* getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK37");
|
||||
* //_error:
|
||||
*/
|
||||
export function getIcapAddress(address: string): string {
|
||||
//let base36 = _base16To36(getAddress(address).substring(2)).toUpperCase();
|
||||
let base36 = BigInt(getAddress(address)).toString(36).toUpperCase();
|
||||
while (base36.length < 30) { base36 = "0" + base36; }
|
||||
return "XE" + ibanChecksum("XE00" + base36) + base36;
|
||||
}
|
||||
123
dev/env/node_modules/ethers/src.ts/address/checks.ts
generated
vendored
Executable file
123
dev/env/node_modules/ethers/src.ts/address/checks.ts
generated
vendored
Executable file
@@ -0,0 +1,123 @@
|
||||
import { assert, assertArgument } from "../utils/index.js";
|
||||
|
||||
import { getAddress } from "./address.js";
|
||||
|
||||
import type { Addressable, AddressLike, NameResolver } from "./index.js";
|
||||
|
||||
|
||||
/**
|
||||
* Returns true if %%value%% is an object which implements the
|
||||
* [[Addressable]] interface.
|
||||
*
|
||||
* @example:
|
||||
* // Wallets and AbstractSigner sub-classes
|
||||
* isAddressable(Wallet.createRandom())
|
||||
* //_result:
|
||||
*
|
||||
* // Contracts
|
||||
* contract = new Contract("dai.tokens.ethers.eth", [ ], provider)
|
||||
* isAddressable(contract)
|
||||
* //_result:
|
||||
*/
|
||||
export function isAddressable(value: any): value is Addressable {
|
||||
return (value && typeof(value.getAddress) === "function");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if %%value%% is a valid address.
|
||||
*
|
||||
* @example:
|
||||
* // Valid address
|
||||
* isAddress("0x8ba1f109551bD432803012645Ac136ddd64DBA72")
|
||||
* //_result:
|
||||
*
|
||||
* // Valid ICAP address
|
||||
* isAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36")
|
||||
* //_result:
|
||||
*
|
||||
* // Invalid checksum
|
||||
* isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBa72")
|
||||
* //_result:
|
||||
*
|
||||
* // Invalid ICAP checksum
|
||||
* isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72")
|
||||
* //_result:
|
||||
*
|
||||
* // Not an address (an ENS name requires a provided and an
|
||||
* // asynchronous API to access)
|
||||
* isAddress("ricmoo.eth")
|
||||
* //_result:
|
||||
*/
|
||||
export function isAddress(value: any): value is string {
|
||||
try {
|
||||
getAddress(value);
|
||||
return true;
|
||||
} catch (error) { }
|
||||
return false;
|
||||
}
|
||||
|
||||
async function checkAddress(target: any, promise: Promise<null | string>): Promise<string> {
|
||||
const result = await promise;
|
||||
if (result == null || result === "0x0000000000000000000000000000000000000000") {
|
||||
assert(typeof(target) !== "string", "unconfigured name", "UNCONFIGURED_NAME", { value: target });
|
||||
assertArgument(false, "invalid AddressLike value; did not resolve to a value address", "target", target);
|
||||
}
|
||||
return getAddress(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves to an address for the %%target%%, which may be any
|
||||
* supported address type, an [[Addressable]] or a Promise which
|
||||
* resolves to an address.
|
||||
*
|
||||
* If an ENS name is provided, but that name has not been correctly
|
||||
* configured a [[UnconfiguredNameError]] is thrown.
|
||||
*
|
||||
* @example:
|
||||
* addr = "0x6B175474E89094C44Da98b954EedeAC495271d0F"
|
||||
*
|
||||
* // Addresses are return synchronously
|
||||
* resolveAddress(addr, provider)
|
||||
* //_result:
|
||||
*
|
||||
* // Address promises are resolved asynchronously
|
||||
* resolveAddress(Promise.resolve(addr))
|
||||
* //_result:
|
||||
*
|
||||
* // ENS names are resolved asynchronously
|
||||
* resolveAddress("dai.tokens.ethers.eth", provider)
|
||||
* //_result:
|
||||
*
|
||||
* // Addressable objects are resolved asynchronously
|
||||
* contract = new Contract(addr, [ ])
|
||||
* resolveAddress(contract, provider)
|
||||
* //_result:
|
||||
*
|
||||
* // Unconfigured ENS names reject
|
||||
* resolveAddress("nothing-here.ricmoo.eth", provider)
|
||||
* //_error:
|
||||
*
|
||||
* // ENS names require a NameResolver object passed in
|
||||
* // (notice the provider was omitted)
|
||||
* resolveAddress("nothing-here.ricmoo.eth")
|
||||
* //_error:
|
||||
*/
|
||||
export function resolveAddress(target: AddressLike, resolver?: null | NameResolver): string | Promise<string> {
|
||||
|
||||
if (typeof(target) === "string") {
|
||||
if (target.match(/^0x[0-9a-f]{40}$/i)) { return getAddress(target); }
|
||||
|
||||
assert(resolver != null, "ENS resolution requires a provider",
|
||||
"UNSUPPORTED_OPERATION", { operation: "resolveName" });
|
||||
|
||||
return checkAddress(target, resolver.resolveName(target));
|
||||
|
||||
} else if (isAddressable(target)) {
|
||||
return checkAddress(target, target.getAddress());
|
||||
|
||||
} else if (target && typeof(target.then) === "function") {
|
||||
return checkAddress(target, target);
|
||||
}
|
||||
|
||||
assertArgument(false, "unsupported addressable value", "target", target);
|
||||
}
|
||||
80
dev/env/node_modules/ethers/src.ts/address/contract-address.ts
generated
vendored
Executable file
80
dev/env/node_modules/ethers/src.ts/address/contract-address.ts
generated
vendored
Executable file
@@ -0,0 +1,80 @@
|
||||
import { keccak256 } from "../crypto/index.js";
|
||||
import {
|
||||
concat, dataSlice, getBigInt, getBytes, encodeRlp, assertArgument
|
||||
} from "../utils/index.js";
|
||||
|
||||
import { getAddress } from "./address.js";
|
||||
|
||||
import type { BigNumberish, BytesLike } from "../utils/index.js";
|
||||
|
||||
|
||||
// http://ethereum.stackexchange.com/questions/760/how-is-the-address-of-an-ethereum-contract-computed
|
||||
|
||||
/**
|
||||
* Returns the address that would result from a ``CREATE`` for %%tx%%.
|
||||
*
|
||||
* This can be used to compute the address a contract will be
|
||||
* deployed to by an EOA when sending a deployment transaction (i.e.
|
||||
* when the ``to`` address is ``null``).
|
||||
*
|
||||
* This can also be used to compute the address a contract will be
|
||||
* deployed to by a contract, by using the contract's address as the
|
||||
* ``to`` and the contract's nonce.
|
||||
*
|
||||
* @example
|
||||
* from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72";
|
||||
* nonce = 5;
|
||||
*
|
||||
* getCreateAddress({ from, nonce });
|
||||
* //_result:
|
||||
*/
|
||||
export function getCreateAddress(tx: { from: string, nonce: BigNumberish }): string {
|
||||
const from = getAddress(tx.from);
|
||||
const nonce = getBigInt(tx.nonce, "tx.nonce");
|
||||
|
||||
let nonceHex = nonce.toString(16);
|
||||
if (nonceHex === "0") {
|
||||
nonceHex = "0x";
|
||||
} else if (nonceHex.length % 2) {
|
||||
nonceHex = "0x0" + nonceHex;
|
||||
} else {
|
||||
nonceHex = "0x" + nonceHex;
|
||||
}
|
||||
|
||||
return getAddress(dataSlice(keccak256(encodeRlp([ from, nonceHex ])), 12));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the address that would result from a ``CREATE2`` operation
|
||||
* with the given %%from%%, %%salt%% and %%initCodeHash%%.
|
||||
*
|
||||
* To compute the %%initCodeHash%% from a contract's init code, use
|
||||
* the [[keccak256]] function.
|
||||
*
|
||||
* For a quick overview and example of ``CREATE2``, see [[link-ricmoo-wisps]].
|
||||
*
|
||||
* @example
|
||||
* // The address of the contract
|
||||
* from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72"
|
||||
*
|
||||
* // The salt
|
||||
* salt = id("HelloWorld")
|
||||
*
|
||||
* // The hash of the initCode
|
||||
* initCode = "0x6394198df16000526103ff60206004601c335afa6040516060f3";
|
||||
* initCodeHash = keccak256(initCode)
|
||||
*
|
||||
* getCreate2Address(from, salt, initCodeHash)
|
||||
* //_result:
|
||||
*/
|
||||
export function getCreate2Address(_from: string, _salt: BytesLike, _initCodeHash: BytesLike): string {
|
||||
const from = getAddress(_from);
|
||||
const salt = getBytes(_salt, "salt");
|
||||
const initCodeHash = getBytes(_initCodeHash, "initCodeHash");
|
||||
|
||||
assertArgument(salt.length === 32, "salt must be 32 bytes", "salt", _salt);
|
||||
|
||||
assertArgument(initCodeHash.length === 32, "initCodeHash must be 32 bytes", "initCodeHash", _initCodeHash);
|
||||
|
||||
return getAddress(dataSlice(keccak256(concat([ "0xff", from, salt, initCodeHash ])), 12))
|
||||
}
|
||||
57
dev/env/node_modules/ethers/src.ts/address/index.ts
generated
vendored
Executable file
57
dev/env/node_modules/ethers/src.ts/address/index.ts
generated
vendored
Executable file
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* Addresses are a fundamental part of interacting with Ethereum. They
|
||||
* represent the global identity of Externally Owned Accounts (accounts
|
||||
* backed by a private key) and contracts.
|
||||
*
|
||||
* The Ethereum Naming Service (ENS) provides an interconnected ecosystem
|
||||
* of contracts, standards and libraries which enable looking up an
|
||||
* address for an ENS name.
|
||||
*
|
||||
* These functions help convert between various formats, validate
|
||||
* addresses and safely resolve ENS names.
|
||||
*
|
||||
* @_section: api/address:Addresses [about-addresses]
|
||||
*/
|
||||
|
||||
null;
|
||||
|
||||
/**
|
||||
* An interface for objects which have an address, and can
|
||||
* resolve it asyncronously.
|
||||
*
|
||||
* This allows objects such as [[Signer]] or [[Contract]] to
|
||||
* be used most places an address can be, for example getting
|
||||
* the [balance](Provider-getBalance).
|
||||
*/
|
||||
export interface Addressable {
|
||||
/**
|
||||
* Get the object address.
|
||||
*/
|
||||
getAddress(): Promise<string>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Anything that can be used to return or resolve an address.
|
||||
*/
|
||||
export type AddressLike = string | Promise<string> | Addressable;
|
||||
|
||||
/**
|
||||
* An interface for any object which can resolve an ENS name.
|
||||
*/
|
||||
export interface NameResolver {
|
||||
/**
|
||||
* Resolve to the address for the ENS %%name%%.
|
||||
*
|
||||
* Resolves to ``null`` if the name is unconfigued. Use
|
||||
* [[resolveAddress]] (passing this object as %%resolver%%) to
|
||||
* throw for names that are unconfigured.
|
||||
*/
|
||||
resolveName(name: string): Promise<null | string>;
|
||||
}
|
||||
|
||||
export { getAddress, getIcapAddress } from "./address.js";
|
||||
|
||||
export { getCreateAddress, getCreate2Address } from "./contract-address.js";
|
||||
|
||||
|
||||
export { isAddressable, isAddress, resolveAddress } from "./checks.js";
|
||||
Reference in New Issue
Block a user