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

Uploaded Source

Built Distribution

snet_contracts-1.0.1-py3-none-any.whl (56.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for snet_contracts-1.0.1.tar.gz
Algorithm Hash digest
SHA256 355eab6269c518b5166b00bd44d409b7c7c06798b19462acf96646f54bebb101
MD5 ec2966f7617dff0de6b55614431c835a
BLAKE2b-256 bf0f244ba5d120c62533d8e767f75b7e58c8c6238efcdccfa6e870ef47da1f43

See more details on using hashes here.

File details

Details for the file snet_contracts-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: snet_contracts-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 56.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.7

File hashes

Hashes for snet_contracts-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ba75670c2367a31cb67a1c3a6f71f1971acd9710e86787ca22a24e6e73c6b0f1
MD5 a0a8b5da1d8de0d3a753f66b32f791c4
BLAKE2b-256 011b944f29498c481751081775175dc5b05773068f469270bfb701097d9313a7

See more details on using hashes here.

Supported by

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