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

web3-eth-contract

Package Overview
Dependencies
Maintainers
4
Versions
517
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

web3-eth-contract - npm Package Compare versions

Comparing version 4.7.3-dev.594f83a.0 to 4.7.3-dev.ae99434.0

23

lib/commonjs/utils.d.ts

@@ -41,3 +41,26 @@ import { TransactionForAccessList, AbiFunctionFragment, TransactionWithSenderAPI, TransactionCall, HexString, Address, NonPayableCallOptions, PayableCallOptions, ContractOptions, Numbers, AbiConstructorFragment } from 'web3-types';

}) => TransactionForAccessList;
/**
* Generates the Ethereum address of a contract created via a regular transaction.
*
* This function calculates the contract address based on the sender's address and nonce,
* following Ethereum's address generation rules.
*
* @param from The sender’s Ethereum {@link Address}, from which the contract will be deployed.
* @param nonce The transaction count (or {@link Numbers}) of the sender account at the time of contract creation.
* You can get it here: https://docs.web3js.org/api/web3/class/Web3Eth#getTransactionCount.
* @returns An Ethereum {@link Address} of the contract in checksum address format.
* @throws An {@link InvalidAddressError} if the provided address ('from') is invalid.
* @throws An {@link InvalidNumberError} if the provided nonce value is not in a valid format.
* @example
* ```ts
* const from = "0x1234567890abcdef1234567890abcdef12345678";
* const nonce = (await web3.eth.getTransactionCount(from)) + 1; // The nonce value for the transaction
*
* const res = createContractAddress(from, nonce);
*
* console.log(res);
* // > "0x604f1ECbA68f4B4Da57D49C2b945A75bAb331208"
* ```
*/
export declare const createContractAddress: (from: Address, nonce: Numbers) => Address;
export declare const create2ContractAddress: (from: Address, salt: HexString, initCode: HexString) => Address;

@@ -124,2 +124,25 @@ "use strict";

exports.getCreateAccessListParams = getCreateAccessListParams;
/**
* Generates the Ethereum address of a contract created via a regular transaction.
*
* This function calculates the contract address based on the sender's address and nonce,
* following Ethereum's address generation rules.
*
* @param from The sender’s Ethereum {@link Address}, from which the contract will be deployed.
* @param nonce The transaction count (or {@link Numbers}) of the sender account at the time of contract creation.
* You can get it here: https://docs.web3js.org/api/web3/class/Web3Eth#getTransactionCount.
* @returns An Ethereum {@link Address} of the contract in checksum address format.
* @throws An {@link InvalidAddressError} if the provided address ('from') is invalid.
* @throws An {@link InvalidNumberError} if the provided nonce value is not in a valid format.
* @example
* ```ts
* const from = "0x1234567890abcdef1234567890abcdef12345678";
* const nonce = (await web3.eth.getTransactionCount(from)) + 1; // The nonce value for the transaction
*
* const res = createContractAddress(from, nonce);
*
* console.log(res);
* // > "0x604f1ECbA68f4B4Da57D49C2b945A75bAb331208"
* ```
*/
const createContractAddress = (from, nonce) => {

@@ -126,0 +149,0 @@ if (!(0, web3_validator_1.isAddress)(from))

@@ -116,2 +116,25 @@ /*

};
/**
* Generates the Ethereum address of a contract created via a regular transaction.
*
* This function calculates the contract address based on the sender's address and nonce,
* following Ethereum's address generation rules.
*
* @param from The sender’s Ethereum {@link Address}, from which the contract will be deployed.
* @param nonce The transaction count (or {@link Numbers}) of the sender account at the time of contract creation.
* You can get it here: https://docs.web3js.org/api/web3/class/Web3Eth#getTransactionCount.
* @returns An Ethereum {@link Address} of the contract in checksum address format.
* @throws An {@link InvalidAddressError} if the provided address ('from') is invalid.
* @throws An {@link InvalidNumberError} if the provided nonce value is not in a valid format.
* @example
* ```ts
* const from = "0x1234567890abcdef1234567890abcdef12345678";
* const nonce = (await web3.eth.getTransactionCount(from)) + 1; // The nonce value for the transaction
*
* const res = createContractAddress(from, nonce);
*
* console.log(res);
* // > "0x604f1ECbA68f4B4Da57D49C2b945A75bAb331208"
* ```
*/
export const createContractAddress = (from, nonce) => {

@@ -118,0 +141,0 @@ if (!isAddress(from))

@@ -41,4 +41,27 @@ import { TransactionForAccessList, AbiFunctionFragment, TransactionWithSenderAPI, TransactionCall, HexString, Address, NonPayableCallOptions, PayableCallOptions, ContractOptions, Numbers, AbiConstructorFragment } from 'web3-types';

}) => TransactionForAccessList;
/**
* Generates the Ethereum address of a contract created via a regular transaction.
*
* This function calculates the contract address based on the sender's address and nonce,
* following Ethereum's address generation rules.
*
* @param from The sender’s Ethereum {@link Address}, from which the contract will be deployed.
* @param nonce The transaction count (or {@link Numbers}) of the sender account at the time of contract creation.
* You can get it here: https://docs.web3js.org/api/web3/class/Web3Eth#getTransactionCount.
* @returns An Ethereum {@link Address} of the contract in checksum address format.
* @throws An {@link InvalidAddressError} if the provided address ('from') is invalid.
* @throws An {@link InvalidNumberError} if the provided nonce value is not in a valid format.
* @example
* ```ts
* const from = "0x1234567890abcdef1234567890abcdef12345678";
* const nonce = (await web3.eth.getTransactionCount(from)) + 1; // The nonce value for the transaction
*
* const res = createContractAddress(from, nonce);
*
* console.log(res);
* // > "0x604f1ECbA68f4B4Da57D49C2b945A75bAb331208"
* ```
*/
export declare const createContractAddress: (from: Address, nonce: Numbers) => Address;
export declare const create2ContractAddress: (from: Address, salt: HexString, initCode: HexString) => Address;
//# sourceMappingURL=utils.d.ts.map

22

package.json
{
"name": "web3-eth-contract",
"version": "4.7.3-dev.594f83a.0+594f83a",
"version": "4.7.3-dev.ae99434.0+ae99434",
"description": "Web3 module to interact with Ethereum smart contracts.",

@@ -49,9 +49,9 @@ "main": "./lib/commonjs/index.js",

"@ethereumjs/rlp": "^5.0.2",
"web3-core": "4.7.2-dev.594f83a.0+594f83a",
"web3-errors": "1.3.2-dev.594f83a.0+594f83a",
"web3-eth": "4.11.2-dev.594f83a.0+594f83a",
"web3-eth-abi": "4.4.2-dev.594f83a.0+594f83a",
"web3-types": "1.10.1-dev.594f83a.0+594f83a",
"web3-utils": "4.3.4-dev.594f83a.0+594f83a",
"web3-validator": "2.0.7-dev.594f83a.0+594f83a"
"web3-core": "4.7.2-dev.ae99434.0+ae99434",
"web3-errors": "1.3.2-dev.ae99434.0+ae99434",
"web3-eth": "4.11.2-dev.ae99434.0+ae99434",
"web3-eth-abi": "4.4.2-dev.ae99434.0+ae99434",
"web3-types": "1.10.1-dev.ae99434.0+ae99434",
"web3-utils": "4.3.4-dev.ae99434.0+ae99434",
"web3-validator": "2.0.7-dev.ae99434.0+ae99434"
},

@@ -73,6 +73,6 @@ "devDependencies": {

"typescript": "^5.5.4",
"web3-eth-accounts": "4.3.2-dev.594f83a.0+594f83a",
"web3-providers-ws": "4.0.9-dev.594f83a.0+594f83a"
"web3-eth-accounts": "4.3.2-dev.ae99434.0+ae99434",
"web3-providers-ws": "4.0.9-dev.ae99434.0+ae99434"
},
"gitHead": "594f83aa9a39e4c12d182ead45d6150e3361f63c"
"gitHead": "ae994346a656688b8e9b907e1ab4731be8c5736e"
}

@@ -230,2 +230,25 @@ /*

/**
* Generates the Ethereum address of a contract created via a regular transaction.
*
* This function calculates the contract address based on the sender's address and nonce,
* following Ethereum's address generation rules.
*
* @param from The sender’s Ethereum {@link Address}, from which the contract will be deployed.
* @param nonce The transaction count (or {@link Numbers}) of the sender account at the time of contract creation.
* You can get it here: https://docs.web3js.org/api/web3/class/Web3Eth#getTransactionCount.
* @returns An Ethereum {@link Address} of the contract in checksum address format.
* @throws An {@link InvalidAddressError} if the provided address ('from') is invalid.
* @throws An {@link InvalidNumberError} if the provided nonce value is not in a valid format.
* @example
* ```ts
* const from = "0x1234567890abcdef1234567890abcdef12345678";
* const nonce = (await web3.eth.getTransactionCount(from)) + 1; // The nonce value for the transaction
*
* const res = createContractAddress(from, nonce);
*
* console.log(res);
* // > "0x604f1ECbA68f4B4Da57D49C2b945A75bAb331208"
* ```
*/
export const createContractAddress = (from: Address, nonce: Numbers): Address => {

@@ -232,0 +255,0 @@ if (!isAddress(from)) throw new InvalidAddressError(`Invalid address given ${from}`);

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