Skip to main content

SingularityNET Ecosystem Contracts

Project description

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")

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)))
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

snet_contracts-0.1.1.tar.gz (32.2 kB view details)

Uploaded Source

Built Distribution

snet.contracts-0.1.1-py3-none-any.whl (40.7 kB view details)

Uploaded Python 3

File details

Details for the file snet_contracts-0.1.1.tar.gz.

File metadata

  • Download URL: snet_contracts-0.1.1.tar.gz
  • Upload date:
  • Size: 32.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for snet_contracts-0.1.1.tar.gz
Algorithm Hash digest
SHA256 214a72c07245dcd196d0b00c09ff8fadb2a3373734e6dd653ae315386690e80e
MD5 528e96b503bed8cd4b3c866575e5e483
BLAKE2b-256 c184383858c74581cb8bc64b4e01e5f360940ddc4b114f11503801671e843102

See more details on using hashes here.

File details

Details for the file snet.contracts-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for snet.contracts-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dbba7d92a71df0cd6ffb822415288e73a24d836aa2ae4c17141c66245c3573a8
MD5 8038bb19d54e3eb82bf10f00e3e4befd
BLAKE2b-256 a4f452a077d8848d91d07f3cce6d75fbaf1d54e921444c5e5ad3369b59d33e95

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page