Get Contracts Creations
Overview
The Get Contracts Creations endpoint obtains data on smart contracts' creations. At least one
of the following parameters must be specified: contract
, origin
, or caller
. The range should
be defined by either block_number
, timestamp
, or block_hash
.
Multiple values can be set for the contract
parameter with a maximum of five items.
Use Cases
Several possible combinations of parameters should be considered, where origin
refers to the address
of an EOA wallet, contract
is the address of a smart contract being created, caller
represents the
address of a smart contract that triggers the creation of another smart contract. To retrieve specific
details about contracts' creations, follow the guidelines below.
- For getting data on a contract's creation, specify
contract
. - For all contracts' creations initiated by an EOA wallet, specify
origin
. - For all contracts' creations triggered by another smart contract, specify
caller
. - For all contracts' creations triggered by another smart contract but initiated by
an EOA wallet, specify both
origin
andcaller
.
The caller
and origin
parameters can both represent an EOA wallet but the actual purpose
of the caller
field is to be used as the smart contract's address that triggers the creation
of another smart contract.
Usage
In this example, we receive all contracts' creations from the first block initiated
by the 0xcc2c2cd417a9c39cf0e48622988dbec0b1b37064
address specified as origin.
import * as Parsiq from '@parsiq/parsiq.js';
const client = Parsiq.createClient(process.env.API_KEY, Parsiq.ChainId.ETH_MAINNET);
const creations = client.contracts.creations.getByBlockRange(1, 'latest', {
origin: '0xcc2c2cd417a9c39cf0e48622988dbec0b1b37064'
});
for await (const creation of creations) {
console.log(creation);
}
Output:
{
id: '00000000002539d7-000c-00000001',
contract: '0xf7b8c2f306de632b2d5b4af46d0e26103ea69617',
caller: '0x7c20218efc2e07c8fe2532ff860d4a5d8287cb31',
tx_hash: '0xd52f793223730a91758f7557beb43c04affa75109a08cab1464bfff17161f107',
block_hash: '0xb813abb6f0ca0a0c21f717807bf6bd8db2e5910d47f30ad72d9105c1fe66193d',
data: '0x6004600c60003960046000f3600035ff00000000000000000000000000000000',
origin: '0xcc2c2cd417a9c39cf0e48622988dbec0b1b37064',
block_number: 2439639,
timestamp: 1476462282,
value: '0',
op_code: 'CREATE'
}
Parameters
chainId
version
block_number_start
block_number_end
origin
contract
caller
offset
limit
estimate_cu