UNPKG

1.62 kBTypeScriptView Raw
1import type { BigNumberish, BytesLike } from "../utils/index.js";
2/**
3 * Returns the address that would result from a ``CREATE`` for %%tx%%.
4 *
5 * This can be used to compute the address a contract will be
6 * deployed to by an EOA when sending a deployment transaction (i.e.
7 * when the ``to`` address is ``null``).
8 *
9 * This can also be used to compute the address a contract will be
10 * deployed to by a contract, by using the contract's address as the
11 * ``to`` and the contract's nonce.
12 *
13 * @example
14 * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72";
15 * nonce = 5;
16 *
17 * getCreateAddress({ from, nonce });
18 * //_result:
19 */
20export declare function getCreateAddress(tx: {
21 from: string;
22 nonce: BigNumberish;
23}): string;
24/**
25 * Returns the address that would result from a ``CREATE2`` operation
26 * with the given %%from%%, %%salt%% and %%initCodeHash%%.
27 *
28 * To compute the %%initCodeHash%% from a contract's init code, use
29 * the [[keccak256]] function.
30 *
31 * For a quick overview and example of ``CREATE2``, see [[link-ricmoo-wisps]].
32 *
33 * @example
34 * // The address of the contract
35 * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72"
36 *
37 * // The salt
38 * salt = id("HelloWorld")
39 *
40 * // The hash of the initCode
41 * initCode = "0x6394198df16000526103ff60206004601c335afa6040516060f3";
42 * initCodeHash = keccak256(initCode)
43 *
44 * getCreate2Address(from, salt, initCodeHash)
45 * //_result:
46 */
47export declare function getCreate2Address(_from: string, _salt: BytesLike, _initCodeHash: BytesLike): string;
48//# sourceMappingURL=contract-address.d.ts.map
\No newline at end of file