id

Learn about the id utils method

Learn about the id utils method

Introduction

The id method is used to generate a unique identifier for an object.

Usage

This method should be used when you want to generate a unique identifier for an object. For example, you can use this method to generate a unique identifier for a contract instance.

Here’s a simple code example to demonstrate how to use this method:

Javascript
1const { Utils } = require("alchemy-sdk");
2
3let contractInstance = {
4 name: "My Contract",
5 address: "0x1234567890abcdef1234567890abcdef12345678",
6};
7
8let contractId = Utils.id(contractInstance);
9console.log(contractId); // '0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'