Skip to main content

SingularityNET Ecosystem Contracts Package

The package was created to easily work with SingularityNET ecosystem EVM contracts

Python

Usage

Easily get an instance of the contract you need from any SingularityNET product with just one call to one of the functions

Install:

pip install snet-contracts

Usage:

from snet.contracts import get_contract_deployment_block, get_contract_object

import web3

provider = web3.HTTPProvider("https://mainnet.infura.io/v3/")
w3 = web3.Web3(provider)

token_contract_instance = get_contract_object(w3, "SingularityNetToken")
deployed_block = get_contract_deployment_block(w3, "SingularityNetToken")
print("Block:", deployed_block)

Result:

Block: 12326815

Optional: get an instance at the contract address

token_contract_instance = get_contract_object(w3, "SingularityNetToken" "0x5B7533812759B45C2B44C19e320ba2cD2681b542")

Get the ABI of a token converter by network id, token name (AGIX, NTX, CGV, RJV, WMTX, FET) and converter address. Tokens use different converter versions, so the right ABI is resolved by the deployment address:

from snet.contracts import get_converter_abi

abi = get_converter_abi(1, "AGIX", "0x611192364cc6962F433A5dc52cD500A423dd7bE4")  # TokenConversionManager
abi = get_converter_abi(11155111, "FET", "0xeD3D39b5e2318aA219F51DA57D10a76Dedcc935a")  # TokenConversionManagerV3

A ValueError is raised if the token is unknown or there is no converter of this token with this address in the network.

Tests

python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python3 test/unit_test.py

Golang

Install

go get -u github.com/singnet/snet-ecosystem-contracts

Usage

package main

import (
	"fmt"
	"github.com/singnet/snet-ecosystem-contracts"
)

func main() {

	// get list of all contracts
	fmt.Println(contracts.List)
	
	// get ABI of contract Registry
	fmt.Println(string(contracts.GetABI(contracts.Registry)))

	// get bytecode of contract SingularityNetToken
	fmt.Println(string(contracts.GetBytecode(contracts.SingularityNetToken)))

	// get addresses, events, and more for smart contracts for different networks
	fmt.Println(string(contracts.GetNetworks(contracts.Registry)))

	// clean methods returns content without spaces and line breaks
	fmt.Println(string(contracts.GetABIClean(contracts.SingularityNetToken)))
	fmt.Println(string(contracts.GetBytecodeClean(contracts.Registry)))
	fmt.Println(string(contracts.GetNetworksClean(contracts.SingularityNetToken)))
}

Metadata

Release files for snet-contracts 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for snet-contracts 2.0.0
File Size Uploaded Provenance Actions
snet_contracts-2.0.0.tar.gz 49.0 kB Without provenance Details for snet_contracts-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for snet-contracts 2.0.0
File Interpreter ABI Platform Actions
snet_contracts-2.0.0-py3-none-any.whl Python 3 none any Details for snet_contracts-2.0.0-py3-none-any.whl

Total release size: 109.2 kB

Release files / snet_contracts-2.0.0.tar.gz

Download URL snet_contracts-2.0.0.tar.gz
Size 49.0 kB
Tags Source
SHA-256 checksum
How to use checksums
86fb6ada6f8e6c28c4f676f8a3a351862a4a320bb921ef73f7e0f599e710d90d
BLAKE2b-256 checksum
How to use checksums
1250a03a6389c083a4cb9d2526054627df131c0cab4b3eff05e52bd2f43e78f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.9

Release files / snet_contracts-2.0.0-py3-none-any.whl

Download URL snet_contracts-2.0.0-py3-none-any.whl
Size 60.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ea39b2987a733b7fa87822d73d1a83eb2bb1b6d104872f1db6cb23748ac12ce1
BLAKE2b-256 checksum
How to use checksums
de765260795f2011eed9a3f65be5010851c38cf6c17f8852549dac26f5c20546
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.9

Security for snet-contracts 2.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page