iconsdk

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 20 Imported by: 0

README

ICONation logo

ICON SDK for Go

This is an SDK to communicate with the ICON blockchain, built for Go.

Disclaimer: I cannot guarantee optimal performance of this software. It is provided as is and without any assurances. Use it at your own risk.

Features

  • Wallet management
  • Read data from the blockchain
  • Send ICX transactions
  • Perform SCORE calls
  • Transaction builder

Testing

To run tests, ensure you have Go installed and run:

go test

Usage

TODO

Coming soon

  • Documentation examples - see the tests for now
  • IRC2 token support

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IconService

type IconService struct {
	IconServiceURL string
}

IconService holds the URL to the ICON service.

func NewIconService

func NewIconService(iconServiceURL *string) *IconService

NewIconService creates a new instance of IconService with a default or specified URL.

func (*IconService) Call

func (i *IconService) Call(score string, params map[string]interface{}) (map[string]interface{}, error)

func (*IconService) GetBalance

func (i *IconService) GetBalance(address string) (map[string]interface{}, error)

func (*IconService) GetBlockByHash

func (i *IconService) GetBlockByHash(hash string) (map[string]interface{}, error)

func (*IconService) GetBlockByHeight

func (i *IconService) GetBlockByHeight(height string) (map[string]interface{}, error)

func (*IconService) GetLastBlock

func (i *IconService) GetLastBlock() (map[string]interface{}, error)

func (*IconService) GetTransactionResult

func (i *IconService) GetTransactionResult(txHash string) (map[string]interface{}, error)

func (*IconService) SendTransaction

func (i *IconService) SendTransaction(wallet Wallet, to string, value string, version string, nid string, nonce string, stepLimit string) (map[string]interface{}, error)

func (*IconService) SendTransactionWithMessage

func (i *IconService) SendTransactionWithMessage(wallet Wallet, to string, value string, version string, nid string, nonce string, stepLimit string, message string) (map[string]interface{}, error)

type Transaction

type Transaction struct {
	// contains filtered or unexported fields
}

func NewTransaction

func NewTransaction(iconService *IconService) *Transaction

func (*Transaction) Send

func (t *Transaction) Send() (map[string]interface{}, error)

func (*Transaction) SetMethod

func (t *Transaction) SetMethod(method string)

func (*Transaction) SetParams

func (t *Transaction) SetParams(newParams map[string]interface{})

type TransactionBuilder

type TransactionBuilder struct {
	// contains filtered or unexported fields
}

func NewTransactionBuilder

func NewTransactionBuilder(iconService *IconService) *TransactionBuilder

func (*TransactionBuilder) Address

func (t *TransactionBuilder) Address(address string) *TransactionBuilder

func (*TransactionBuilder) BlockHash

func (t *TransactionBuilder) BlockHash(hash string) *TransactionBuilder

func (*TransactionBuilder) BlockHeight

func (t *TransactionBuilder) BlockHeight(height string) *TransactionBuilder

func (*TransactionBuilder) Build

func (t *TransactionBuilder) Build() Transaction

func (*TransactionBuilder) Call

func (t *TransactionBuilder) Call(call_params map[string]interface{}) *TransactionBuilder

func (*TransactionBuilder) From

func (*TransactionBuilder) Message

func (t *TransactionBuilder) Message(message string) *TransactionBuilder

func (*TransactionBuilder) Method

func (t *TransactionBuilder) Method(method string) *TransactionBuilder

func (*TransactionBuilder) Nid

func (*TransactionBuilder) Nonce

func (t *TransactionBuilder) Nonce(nonce string) *TransactionBuilder

func (*TransactionBuilder) Sign

func (t *TransactionBuilder) Sign(wallet Wallet) *TransactionBuilder

func (*TransactionBuilder) StepLimit

func (t *TransactionBuilder) StepLimit(stepLimit string) *TransactionBuilder

func (*TransactionBuilder) Timestamp

func (t *TransactionBuilder) Timestamp() *TransactionBuilder

func (*TransactionBuilder) To

func (*TransactionBuilder) TxHash

func (t *TransactionBuilder) TxHash(txHash string) *TransactionBuilder

func (*TransactionBuilder) Value

func (t *TransactionBuilder) Value(value string) *TransactionBuilder

func (*TransactionBuilder) Version

func (t *TransactionBuilder) Version(version string) *TransactionBuilder

type Wallet

type Wallet struct {
	PrivateKey    string
	PublicKey     string
	PublicAddress string
}

func NewWallet

func NewWallet(existingKey *string) *Wallet

Jump to

Keyboard shortcuts

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