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.0.8.tar.gz (32.0 kB view details)

Uploaded Source

Built Distribution

snet.contracts-0.0.8-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file snet.contracts-0.0.8.tar.gz.

File metadata

  • Download URL: snet.contracts-0.0.8.tar.gz
  • Upload date:
  • Size: 32.0 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.0.8.tar.gz
Algorithm Hash digest
SHA256 3c8fe56497344dd47f9fef97a0a03f8404db44d41822da201db7bdaf468318d6
MD5 a6ae8e49651cb3a131af31f01962ea68
BLAKE2b-256 d5dde1c4668a3e2a019b14d2630d54c1ca4b4aed4a34f8d5c146de053e3cfa77

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snet.contracts-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 92248b2edc11640ee9894a618bbf99ff1491722c7f6e8e148638a004f2893f99
MD5 43a6577e9bab94bb27978ffe7d38b95e
BLAKE2b-256 3fe92283807be3833bb33c0807b42ecab99cd84a7ab7f3364856ad3b3731b803

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