Skip to content

setStorageAt

Writes to a slot of an account's storage.

Usage

example.ts
import { testClient } from './client'
 
await testClient.setStorageAt({ 
  address: '0xe846c6fcf817734ca4527b28ccb4aea2b6663c79',
  index: 2,
  value: '0x0000000000000000000000000000000000000000000000000000000000000069'
})

Parameters

address

The account address.

await testClient.setStorageAt({
  address: '0xe846c6fcf817734ca4527b28ccb4aea2b6663c79', 
  index: 2,
  value: '0x0000000000000000000000000000000000000000000000000000000000000069'
})

index

  • Type: number | Hash

The storage slot (index). Can either be a number or hash value.

await testClient.setStorageAt({
  address: '0xe846c6fcf817734ca4527b28ccb4aea2b6663c79',
  index: '0xa6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb49', 
  value: '0x0000000000000000000000000000000000000000000000000000000000000069'
})

value

  • Type: number

The value to store as a 32 byte hex string.

await testClient.setStorageAt({
  address: '0xe846c6fcf817734ca4527b28ccb4aea2b6663c79',
  index: 2,
  value: '0x0000000000000000000000000000000000000000000000000000000000000069'
})