Version: v0.2.0 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2022 License: AGPL-3.0 Imports: 12 Imported by: 0




View Source
const (
	KitabuChainId = 6060

KitabuChainId represents the mainnet chain ID and Network ID.


This section is empty.


func ChecksumToSarafuAddress

func ChecksumToSarafuAddress(address string) (string, error)

ChecksumToSarafuAddress returns a lowercased 40 len hex address representation compatible with cic-stack database schemas

0x02b0DF387A3A68AA3134668752dd82bE70B7dE1C -> 02b0df387a3a68aa3134668752dd82be70b7de1c

func SarafuAddressToChecksum

func SarafuAddressToChecksum(address string) string

SarafuAddressToChecksum returns a checksumed address from a lowercased sarafu address representations ready to be used with w3.A()

02b0df387a3a68aa3134668752dd82be70b7de1c -> 0x02b0DF387A3A68AA3134668752dd82bE70B7dE1C


type ERC20TokenMetadata

type ERC20TokenMetadata struct {
	Name               string
	Symbol             string
	Decimals           big.Int
	TotalSupply        big.Int
	Owner              common.Address
	DemurrageToken     bool
	SinkAddress        common.Address
	DemurrageAmount    big.Int
	DemurrageTimestamp big.Int
	PeriodStart        big.Int
	PeriodDuration     big.Int
	TaxLevel           big.Int

ERC20TokenMetadata represents a tokens's metadata

type Provider

type Provider struct {
	EthClient *w3.Client
	Signer    types.Signer

Provider returns an RPC client and a legacy signer compatible with the Kitabu Chain.

func NewProvider

func NewProvider(rpcEndpoint string) (*Provider, error)

NewProvider returns a new RPC provider given an RPC endpoint.

func (*Provider) BuildGasTransferTx added in v0.2.0

func (p *Provider) BuildGasTransferTx(privateKey *ecdsa.PrivateKey, txData TransactionData, value *big.Int) (*types.Transaction, error)

BuildGasTransferTx returns a signed transaction compatible with Kitabu chain, it is specific to gas transfers

func (*Provider) BuildKitabuTx

func (p *Provider) BuildKitabuTx(privateKey *ecdsa.PrivateKey, txData TransactionData) (*types.Transaction, error)

BuildKitabuTx returns a signed transaction compatible with Kitabu chain, it is specific to contrtact execution

func (*Provider) Close

func (p *Provider) Close() error

Close closes the RPC connection and cancels any in-flight requests.

func (*Provider) ERC20TokenInfo

func (p *Provider) ERC20TokenInfo(ctx context.Context, tokenAddress common.Address) (ERC20TokenMetadata, error)

ERC20TokenInfo returns all getter only token metadata that requires no args, also includes all demurrage token info if applicable

func (*Provider) NetworkNonce

func (p *Provider) NetworkNonce(ctx context.Context, address common.Address) (uint64, error)

NetworkNonce returns the nonce for the given address

func (*Provider) TokensBalance

func (p *Provider) TokensBalance(ctx context.Context, ownerAddress common.Address, tokensAddresses []common.Address) ([]*big.Int, error)

TokensBalance returns balances of an address from multiple token addresses batched into a single on-chain evm call

type TransactionData

type TransactionData struct {
	To        common.Address
	InputData []byte
	GasLimit  uint64
	Nonce     uint64

TransactionData represents a prepared tx data ready to be signed

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL