polkadot

package
v1.1.15 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2021 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const (
	FeeTransfer string = "100000000"

	ModuleBalances string = "balances"
	ModuleStaking  string = "staking"

	ModuleFunctionTransfer string = "transfer"
)

Variables

View Source
var NetworkByteMap = map[string]byte{
	"DOT": 0x00,
	"KSM": 0x02,
}

Functions

func PublicKeyToAddress

func PublicKeyToAddress(bytes []byte, network byte) string

PublicKeyToAddress returns an ss58 address string given public key bytes see: https://github.com/paritytech/substrate/wiki/External-Address-Format-(SS58)

Types

type BlockRequest

type BlockRequest struct {
	BlockNumber int64 `json:"block_num"`
}

type CallData

type CallData struct {
	Name  string `json:"name"`
	Type  string `json:"type"`
	Value string `json:"value"`
}

type Client

type Client struct {
	client.Request
}

func (*Client) GetBlockByNumber

func (c *Client) GetBlockByNumber(number int64) ([]Extrinsic, error)

func (*Client) GetCurrentBlock

func (c *Client) GetCurrentBlock() (int64, error)

func (*Client) GetExtrinsicsOfAddress

func (c *Client) GetExtrinsicsOfAddress(address string) ([]Extrinsic, error)

func (*Client) GetTransfersOfAddress

func (c *Client) GetTransfersOfAddress(address string) ([]Transfer, error)

type Extrinsic

type Extrinsic struct {
	Timestamp          uint64 `json:"block_timestamp"`
	BlockNumber        uint64 `json:"block_num"`
	CallModuleFunction string `json:"call_module_function"`
	CallModule         string `json:"call_module"`
	Params             string `json:"params"`
	AccountId          string `json:"account_id"`
	Nonce              uint64 `json:"nonce"`
	Hash               string `json:"extrinsic_hash"`
	Success            bool   `json:"success"`
	Fee                string `json:"fee"`
}

type Platform

type Platform struct {
	CoinIndex uint
	// contains filtered or unexported fields
}

func Init added in v1.1.0

func Init(coin uint, api string) *Platform

func (*Platform) Coin

func (p *Platform) Coin() coin.Coin

func (*Platform) CurrentBlockNumber

func (p *Platform) CurrentBlockNumber() (int64, error)

func (*Platform) GetBlockByNumber

func (p *Platform) GetBlockByNumber(num int64) (*types.Block, error)

func (*Platform) GetTxsByAddress

func (p *Platform) GetTxsByAddress(address string) (types.TxPage, error)

func (*Platform) NormalizeAddress

func (p *Platform) NormalizeAddress(valueRaw string) string

func (*Platform) NormalizeExtrinsic

func (p *Platform) NormalizeExtrinsic(srcTx *Extrinsic) *types.Tx

func (*Platform) NormalizeExtrinsics

func (p *Platform) NormalizeExtrinsics(extrinsics []Extrinsic) []types.Tx

func (*Platform) NormalizeTransfer

func (p *Platform) NormalizeTransfer(srcTx *Transfer) types.Tx

type SubscanResponse

type SubscanResponse struct {
	Code    int                 `json:"code"`
	Message string              `json:"message"`
	Data    SubscanResponseData `json:"data"`
}

type SubscanResponseData

type SubscanResponseData struct {
	BlockNumber string      `json:"blockNum,omitempty"`
	Transfers   []Transfer  `json:"transfers,omitempty"`
	Extrinsics  []Extrinsic `json:"extrinsics,omitempty"`
}

type Transfer

type Transfer struct {
	From        string `json:"from"`
	To          string `json:"to"`
	Module      string `json:"module"`
	Amount      string `json:"amount"`
	Hash        string `json:"hash"`
	Timestamp   uint64 `json:"block_timestamp"`
	BlockNumber uint64 `json:"block_num"`
	Success     bool   `json:"success"`
}

type TransfersRequest

type TransfersRequest struct {
	Address string `json:"address"`
	Row     int    `json:"row"`
}

Jump to

Keyboard shortcuts

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