Contracts API
Get Contracts Self-Destructions

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.

  1. For getting data on a contract's self-destruction, specify contract.
  2. For all contracts' self-destructions initiated by an EOA wallet, specify origin.
  3. For all contracts' self-destructions triggered by another smart contract, specify caller.
  4. For all contracts' elf-destructions triggered by another smart contract but initiated by an EOA wallet, specify both origin and caller.
📘️

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

Path params
chainId
string
REQUIRED
version
string
REQUIRED
Query params
block_number_start
string
number
REQUIRED
block_number_end
string
number
REQUIRED
origin
string
OR
contract
string
array of strings
OR
caller
string
offset
string
limit
number
estimate_cu
boolean