ContractAddress.from
Computes Contract Address generated by the CREATE or CREATE2 opcode.
Imports
Named
import { ContractAddress } from 'ox'
Examples
CREATE
Computes via the CREATE opcode. Shorthand for ContractAddress.fromCreate
.
import { ContractAddress } from 'ox'
ContractAddress.from({
from: '0x1a1e021a302c237453d3d45c7b82b19ceeb7e2e6',
nonce: 0n,
})
'0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2'
CREATE2
Computes via the CREATE2 opcode. Shorthand for ContractAddress.fromCreate2
.
import { ContractAddress, Hex } from 'ox'
ContractAddress.from({
from: '0x1a1e021a302c237453d3d45c7b82b19ceeb7e2e6',
bytecode: '0x6394198df16000526103ff60206004601c335afa6040516060f3',
salt: Hex.fromString('hello world'),
})
'0x59fbB593ABe27Cb193b6ee5C5DC7bbde312290aB'
Definition
function from(
options: from.Options,
): Address.Address
Source: src/ContractAddress.ts
Parameters
options
- Type:
from.Options
Options.
options.bytecode
- Type:
0x${string} | Uint8Array
options.bytecodeHash
- Type:
0x${string} | Uint8Array
options.from
- Type:
abitype_Address
options.nonce
- Type:
bigint
The nonce of the transaction which deployed the contract.
options.salt
- Type:
0x${string} | Uint8Array
Return Type
Contract Address.
Address.Address
Error Type
ContractAddress.from.ErrorType