Documentation ¶
Index ¶
- Variables
- func CreateTcKeyPair(bitSize, k, l int) (shares tcrsa.KeyShareList, meta *tcrsa.KeyMeta, err error)
- func SignBundleItem(signatureType int, signer interface{}, item *types.BundleItem) error
- type Client
- func (c *Client) Arql(arql string) (ids []string, err error)
- func (c *Client) BroadcastData(txId string, data []byte, numOfNodes int64, peers ...string) error
- func (c *Client) ConcurrentDownloadChunkData(id string, concurrentNum int) ([]byte, error)
- func (c *Client) ConcurrentDownloadChunkDataStream(id string, concurrentNum int) (dataFile *os.File, err error)
- func (c *Client) DataSyncRecord(endOffset string, intervalsNum int) ([]string, error)
- func (c *Client) DownloadChunkData(id string) ([]byte, error)
- func (c *Client) DownloadChunkDataStream(id string) (*os.File, error)
- func (c *Client) ExistTxData(arId string) (bool, error)
- func (c *Client) GetBlockByHeight(height int64) (block *types.Block, err error)
- func (c *Client) GetBlockByID(id string) (block *types.Block, err error)
- func (c *Client) GetBlockFromPeers(height int64, peers ...string) (*types.Block, error)
- func (c *Client) GetBlockHashList(from, to int) ([]string, error)
- func (c *Client) GetBundleItems(bundleInId string, itemsIds []string) (items []*types.BundleItem, err error)
- func (c *Client) GetInfo() (info *types.NetworkInfo, err error)
- func (c *Client) GetLastTransactionID(address string) (id string, err error)
- func (c *Client) GetPeers() ([]string, error)
- func (c *Client) GetPendingTxIds() ([]string, error)
- func (c *Client) GetTransactionAnchor() (anchor string, err error)
- func (c *Client) GetTransactionByID(id string) (tx *types.Transaction, err error)
- func (c *Client) GetTransactionData(id string, extension ...string) ([]byte, error)
- func (c *Client) GetTransactionDataByGateway(id string) (body []byte, err error)
- func (c *Client) GetTransactionDataStream(id string, extension ...string) (*os.File, error)
- func (c *Client) GetTransactionDataStreamByGateway(id string) (*os.File, error)
- func (c *Client) GetTransactionField(id string, field string) (string, error)
- func (c *Client) GetTransactionPrice(dataSize int, target *string) (reward int64, err error)
- func (c *Client) GetTransactionPriceFloat(dataSize int, target *string) (reward float64, err error)
- func (c *Client) GetTransactionStatus(id string) (*types.TxStatus, error)
- func (c *Client) GetTransactionTags(id string) ([]types.Tag, error)
- func (c *Client) GetTxDataFromPeers(txId string, peers ...string) ([]byte, error)
- func (c *Client) GetTxFromPeers(arId string, peers ...string) (*types.Transaction, error)
- func (c *Client) GetUnconfirmedTx(arId string) (*types.Transaction, error)
- func (c *Client) GetUnconfirmedTxFromPeers(arId string, peers ...string) (*types.Transaction, error)
- func (c *Client) GetWalletBalance(address string) (arAmount *big.Float, err error)
- func (c *Client) GetWalletWinstonBalance(address string) (arAmount *big.Int, err error)
- func (c *Client) GraphQL(query string) ([]byte, error)
- func (c *Client) SetTempConnUrl(url string)
- func (c *Client) SetTimeout(timeout time.Duration)
- func (c *Client) SubmitChunks(gc *types.GetChunk) (status string, code int, err error)
- func (c *Client) SubmitToWarp(tx *types.Transaction) ([]byte, error)
- func (c *Client) SubmitTransaction(tx *types.Transaction) (status string, code int, err error)
- type ItemSigner
- func (i *ItemSigner) CreateAndSignItem(data []byte, target string, anchor string, tags []types.Tag) (types.BundleItem, error)
- func (i *ItemSigner) CreateAndSignItemStream(data io.Reader, target string, anchor string, tags []types.Tag) (types.BundleItem, error)
- func (i *ItemSigner) CreateAndSignNestedItem(target string, anchor string, tags []types.Tag, items ...types.BundleItem) (types.BundleItem, error)
- type SerializedUploader
- type Signer
- type TcSign
- type TransactionUploader
- func (tt *TransactionUploader) ConcurrentOnce(ctx context.Context, concurrentNum int) error
- func (tt *TransactionUploader) FormatSerializedUploader() *SerializedUploader
- func (tt *TransactionUploader) FromSerialized(serialized *SerializedUploader, data []byte) (*TransactionUploader, error)
- func (tt *TransactionUploader) FromTransactionId(id string) (*SerializedUploader, error)
- func (tt *TransactionUploader) IsComplete() bool
- func (tt *TransactionUploader) Once() (err error)
- func (tt *TransactionUploader) PctComplete() float64
- func (tt *TransactionUploader) TotalChunks() int
- func (tt *TransactionUploader) UploadChunk() error
- func (tt *TransactionUploader) UploadedChunks() int
- type Wallet
- func (w *Wallet) Owner() string
- func (w *Wallet) SendAR(amount *big.Float, target string, tags []types.Tag) (types.Transaction, error)
- func (w *Wallet) SendARSpeedUp(amount *big.Float, target string, tags []types.Tag, speedFactor int64) (types.Transaction, error)
- func (w *Wallet) SendBundleTx(ctx context.Context, concurrentNum int, bundleBinary []byte, tags []types.Tag) (types.Transaction, error)
- func (w *Wallet) SendBundleTxSpeedUp(ctx context.Context, concurrentNum int, bundleBinary interface{}, ...) (types.Transaction, error)
- func (w *Wallet) SendBundleTxStream(ctx context.Context, concurrentNum int, bundleReader *os.File, ...) (types.Transaction, error)
- func (w *Wallet) SendData(data []byte, tags []types.Tag) (types.Transaction, error)
- func (w *Wallet) SendDataConcurrentSpeedUp(ctx context.Context, concurrentNum int, data interface{}, tags []types.Tag, ...) (types.Transaction, error)
- func (w *Wallet) SendDataSpeedUp(data []byte, tags []types.Tag, speedFactor int64) (types.Transaction, error)
- func (w *Wallet) SendDataStream(data *os.File, tags []types.Tag) (types.Transaction, error)
- func (w *Wallet) SendDataStreamSpeedUp(data *os.File, tags []types.Tag, speedFactor int64) (types.Transaction, error)
- func (w *Wallet) SendPst(contractId string, target string, qty *big.Int, customTags []types.Tag, ...) (types.Transaction, error)
- func (w *Wallet) SendTransaction(tx *types.Transaction) (types.Transaction, error)
- func (w *Wallet) SendTransactionConcurrent(ctx context.Context, concurrentNum int, tx *types.Transaction) (types.Transaction, error)
- func (w *Wallet) SendWinston(amount *big.Int, target string, tags []types.Tag) (types.Transaction, error)
- func (w *Wallet) SendWinstonSpeedUp(amount *big.Int, target string, tags []types.Tag, speedFactor int64) (types.Transaction, error)
- func (w *Wallet) WarpTransfer(contractId, target string, qty int64) (id string, err error)
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func CreateTcKeyPair ¶
CreateTcKeyPair bitSize: Is used to generate key shares with a security level equivalent to a RSA private of that size. l: creates l key shares for a k-threshold signing scheme. k: The generated key shares have a threshold parameter of k
func SignBundleItem ¶
func SignBundleItem(signatureType int, signer interface{}, item *types.BundleItem) error
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewTempConn ¶
func NewTempConn() *Client
func (*Client) BroadcastData ¶
func (*Client) ConcurrentDownloadChunkData ¶
func (*Client) ConcurrentDownloadChunkDataStream ¶
func (*Client) DataSyncRecord ¶
DataSyncRecord you can use GET /data_sync_record/<end_offset>/<number_of_intervals> to fetch the first intervals with end offset >= end_offset; set Content-Type: application/json to get the reply in JSON
func (*Client) DownloadChunkDataStream ¶
func (*Client) GetBlockByHeight ¶
func (*Client) GetBlockByID ¶
Block
func (*Client) GetBlockFromPeers ¶
func (*Client) GetBundleItems ¶
func (*Client) GetLastTransactionID ¶
func (*Client) GetPendingTxIds ¶
func (*Client) GetTransactionAnchor ¶
func (*Client) GetTransactionByID ¶
func (c *Client) GetTransactionByID(id string) (tx *types.Transaction, err error)
GetTransactionByID status: Pending/Invalid hash/overspend
func (*Client) GetTransactionData ¶
func (*Client) GetTransactionDataByGateway ¶
GetTransactionDataByGateway
func (*Client) GetTransactionDataStream ¶
func (*Client) GetTransactionDataStreamByGateway ¶
func (*Client) GetTransactionField ¶
func (*Client) GetTransactionPrice ¶
func (*Client) GetTransactionPriceFloat ¶
func (*Client) GetTransactionStatus ¶
GetTransactionStatus
func (*Client) GetTransactionTags ¶
func (*Client) GetTxDataFromPeers ¶
func (*Client) GetTxFromPeers ¶
func (*Client) GetUnconfirmedTx ¶
func (c *Client) GetUnconfirmedTx(arId string) (*types.Transaction, error)
func (*Client) GetUnconfirmedTxFromPeers ¶
func (*Client) GetWalletBalance ¶
Wallet
func (*Client) GetWalletWinstonBalance ¶
func (*Client) SetTempConnUrl ¶
func (*Client) SetTimeout ¶
func (*Client) SubmitChunks ¶
func (*Client) SubmitToWarp ¶
func (c *Client) SubmitToWarp(tx *types.Transaction) ([]byte, error)
func (*Client) SubmitTransaction ¶
type ItemSigner ¶
type ItemSigner struct {
// contains filtered or unexported fields
}
func NewItemSigner ¶
func NewItemSigner(signer interface{}) (*ItemSigner, error)
func (*ItemSigner) CreateAndSignItem ¶
func (i *ItemSigner) CreateAndSignItem(data []byte, target string, anchor string, tags []types.Tag) (types.BundleItem, error)
func (*ItemSigner) CreateAndSignItemStream ¶
func (i *ItemSigner) CreateAndSignItemStream(data io.Reader, target string, anchor string, tags []types.Tag) (types.BundleItem, error)
func (*ItemSigner) CreateAndSignNestedItem ¶
func (i *ItemSigner) CreateAndSignNestedItem(target string, anchor string, tags []types.Tag, items ...types.BundleItem) (types.BundleItem, error)
type SerializedUploader ¶
type SerializedUploader struct {
// contains filtered or unexported fields
}
type Signer ¶
type Signer struct { Address string PubKey *rsa.PublicKey PrvKey *rsa.PrivateKey }
func NewSignerByPrivateKey ¶
func NewSignerByPrivateKey(privateKey *rsa.PrivateKey) *Signer
func NewSignerFromPath ¶
type TcSign ¶
type TcSign struct {
// contains filtered or unexported fields
}
func (*TcSign) AssembleSigShares ¶
func (ts *TcSign) AssembleSigShares(signedShares tcrsa.SigShareList) ([]byte, error)
for server hub AssembleSigShares
func (*TcSign) ThresholdSign ¶
for signer ThresholdSignTx single share sign tx
func (*TcSign) VerifySigShare ¶
VerifySigShare verify share sig
type TransactionUploader ¶
type TransactionUploader struct { Client *Client `json:"-"` ChunkIndex int TxPosted bool Transaction *types.Transaction Data []byte DataReader *os.File LastRequestTimeEnd int64 TotalErrors int // Not serialized. LastResponseStatus int LastResponseError string }
func CreateUploader ¶
func CreateUploader(api *Client, upload interface{}, data []byte) (*TransactionUploader, error)
CreateUploader @param upload: Transaction | SerializedUploader | string, @param Data the Data of the Transaction. Required when resuming an upload.
func (*TransactionUploader) ConcurrentOnce ¶
func (tt *TransactionUploader) ConcurrentOnce(ctx context.Context, concurrentNum int) error
func (*TransactionUploader) FormatSerializedUploader ¶
func (tt *TransactionUploader) FormatSerializedUploader() *SerializedUploader
func (*TransactionUploader) FromSerialized ¶
func (tt *TransactionUploader) FromSerialized(serialized *SerializedUploader, data []byte) (*TransactionUploader, error)
*
- Reconstructs an upload from its serialized state and data.
- Checks if data matches the expected data_root. *
- @param serialized
- @param data
func (*TransactionUploader) FromTransactionId ¶
func (tt *TransactionUploader) FromTransactionId(id string) (*SerializedUploader, error)
*
- Reconstruct an upload from the tx metadata, ie /tx/<id>. *
- @param api
- @param id
- @param data
func (*TransactionUploader) IsComplete ¶
func (tt *TransactionUploader) IsComplete() bool
func (*TransactionUploader) Once ¶
func (tt *TransactionUploader) Once() (err error)
func (*TransactionUploader) PctComplete ¶
func (tt *TransactionUploader) PctComplete() float64
func (*TransactionUploader) TotalChunks ¶
func (tt *TransactionUploader) TotalChunks() int
func (*TransactionUploader) UploadChunk ¶
func (tt *TransactionUploader) UploadChunk() error
*
- Uploads the next part of the Transaction.
- On the first call this posts the Transaction
- itself and on any subsequent calls uploads the
- next chunk until it completes.
func (*TransactionUploader) UploadedChunks ¶
func (tt *TransactionUploader) UploadedChunks() int
type Wallet ¶
func NewWalletFromPath ¶
proxyUrl: option
func (*Wallet) SendARSpeedUp ¶
func (*Wallet) SendBundleTx ¶
func (*Wallet) SendBundleTxSpeedUp ¶
func (*Wallet) SendBundleTxStream ¶
func (*Wallet) SendDataConcurrentSpeedUp ¶
func (*Wallet) SendDataSpeedUp ¶
func (w *Wallet) SendDataSpeedUp(data []byte, tags []types.Tag, speedFactor int64) (types.Transaction, error)
SendDataSpeedUp set speedFactor for speed up eg: speedFactor = 10, reward = 1.1 * reward
func (*Wallet) SendDataStream ¶
func (*Wallet) SendDataStreamSpeedUp ¶
func (*Wallet) SendTransaction ¶
func (w *Wallet) SendTransaction(tx *types.Transaction) (types.Transaction, error)
SendTransaction: if send success, should return pending
func (*Wallet) SendTransactionConcurrent ¶
func (w *Wallet) SendTransactionConcurrent(ctx context.Context, concurrentNum int, tx *types.Transaction) (types.Transaction, error)