Get Contracts Self-Destructions
Overview
The Get Contracts Self-Destructions endpoint obtains data on smart contracts' self-destructions.
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 self-destructed, caller
represents the
address of a smart contract that triggers the self-destruction of another smart contract. To retrieve specific
details about contracts' self-destructions, follow the guidelines below.
- For getting data on a contract's self-destruction, specify
contract
. - For all contracts' self-destructions initiated by an EOA wallet, specify
origin
. - For all contracts' self-destructions triggered by another smart contract, specify
caller
. - For all contracts' elf-destructions 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 self-destruction
of another smart contract.
Usage
In this example, we receive all contracts' self-destructions from the first block initiated
by the 0xcc2c2cd417a9c39cf0e48622988dbec0b1b37064
address specified as the origin.
import * as Parsiq from '@parsiq/parsiq.js';
const client = Parsiq.createClient(process.env.API_KEY, Parsiq.ChainId.ETH_MAINNET);
const selfDestructions = client.contracts.selfDestructions.getByBlockRange(1, 'latest', {
origin: '0xcc2c2cd417a9c39cf0e48622988dbec0b1b37064'
});
for await (const selfDestruction of selfDestructions) {
console.log(selfDestruction);
}
Output:
{
id: '0000000000250d9e-0002-000005c1',
contract: '0x2ff5cf2708a1308c10daf8573d3401f00fe6b281',
caller: '0x6ca5c7266b920e80e0f4ff7f8f0ff7c8da468a33',
tx_hash: '0x40eccc35fbeb58ed88ecfd7ce40e26ebd24082f1377d411ff28f5dc7c149c857',
block_hash: '0xb09f9ca8fdbbe6c7ac9b6a286b5351f11bcf69dfe2e216c26f5e9c14721ddeea',
data: null,
origin: '0xcc2c2cd417a9c39cf0e48622988dbec0b1b37064',
block_number: 2428318,
timestamp: 1476300910,
value: '0',
op_code: 'SELFDESTRUCT'
}
Parameters
chainId
version
block_number_start
block_number_end
origin
contract
caller
offset
limit
estimate_cu