Smart Contract Event SDK
In this document, you will learn how to retrieve smart contract events or manage your smart contracts using the CDP SDK.
You can retrieve smart contract events via CDP API.
You can also management your smart contract events via CDP Portal or CDP API.
To learn more about smart contracts options, please follow this document.
What You’ll Learn
- How to retrieve smart contracts events
Prerequisites
Before you get started, please follow this guide to install CDP SDK.
Smart Contract Events
List Smart Contract Events
To start, create a CDP API key. Then, initialize the CDP SDK by passing your downloaded API key file, and retrieve smart contracts events.
This will allow you to authenticate with the Platform APIs.
Smart Contract ABI Management
Authentication
To get started, create a secret API key in the Portal’s API Key section if you don’t already have one. Suppose you store your secret API key at ~/Downloads/cdp_api_key.json
Before making any SDK calls, import the necessary package and authenticate using your downloaded API key.
Register A Smart Contract
Below is an example of a smart contract registration call. You can upload the smart contract you’re interested in. Remember to replace the network, contract address, contract name and abi with your own values. Note that attempting to register the same contract again will result in an error.
List Smart Contracts
Below is an example call that lists all of your smart contracts.
Update The Smart Contract
Below is an example of a smart contract update call. Remember to replace network, contract address, contract name and abi with your own values. Currently, only the ABI and contract name can be updated. You should perform the update call on an existing Smart Contract object.