Documentation ¶
Index ¶
- type Client
- func (c *Client) BasicUpload(ctx context.Context, file []byte, tags ...types.Tag) (types.Transaction, error)
- func (c *Client) ChunkUpload(ctx context.Context, file io.Reader, chunkId string, tags ...types.Tag) (types.Transaction, error)
- func (c *Client) Close()
- func (c *Client) Download(ctx context.Context, txId string) (*types.File, error)
- func (c *Client) GetBalance(ctx context.Context) (*big.Int, error)
- func (c *Client) GetMetaData(ctx context.Context, txId string) (types.Transaction, error)
- func (c *Client) GetPrice(ctx context.Context, fileSize int) (*big.Int, error)
- func (c *Client) GetReceipt(ctx context.Context, txId string) (types.Receipt, error)
- func (c *Client) TopUpBalance(ctx context.Context, amount *big.Int) error
- func (c *Client) Upload(ctx context.Context, file []byte, tags ...types.Tag) (types.Transaction, error)
- type Irys
- type Node
- type Option
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶ added in v0.5.1
type Client struct {
// contains filtered or unexported fields
}
func (*Client) BasicUpload ¶ added in v0.5.1
func (*Client) ChunkUpload ¶ added in v0.5.1
func (*Client) GetBalance ¶ added in v0.5.1
func (*Client) GetMetaData ¶ added in v0.5.1
func (*Client) GetReceipt ¶ added in v0.5.6
func (*Client) TopUpBalance ¶ added in v0.5.1
type Irys ¶
type Irys interface { // GetPrice return fee base on fileSize in byte for selected currency GetPrice(ctx context.Context, fileSize int) (*big.Int, error) // BasicUpload file with calculate price and topUp balance base on price (this is slower for upload) BasicUpload(ctx context.Context, file []byte, tags ...types.Tag) (types.Transaction, error) // Upload file with check balance Upload(ctx context.Context, file []byte, tags ...types.Tag) (types.Transaction, error) // ChunkUpload upload file chunk concurrent for big files (min size: 500 KB, max size: 95 MB) // // chunkId used for resume upload, chunkId expired after 30 min. // // Note: this feature is experimental, maybe not work. ChunkUpload(ctx context.Context, file io.Reader, chunkId string, tags ...types.Tag) (types.Transaction, error) // Download get file with header details Download(ctx context.Context, txId string) (*types.File, error) // GetMetaData get transaction details GetMetaData(ctx context.Context, txId string) (types.Transaction, error) // GetBalance return current balance in irys node GetBalance(ctx context.Context) (*big.Int, error) // TopUpBalance top up your balance base on your amount in selected node TopUpBalance(ctx context.Context, amount *big.Int) error // GetReceipt get receipt information from node GetReceipt(ctx context.Context, txId string) (types.Receipt, error) // Close stop irys client request Close() }
func New ¶
New create IrysClient object
Example ¶
matic, err := currency.NewMatic("foo", "bar") if err != nil { log.Fatal(err) } c, err := New(DefaultNode1, matic, false) if err != nil { log.Fatal(err) } p, err := c.GetPrice(context.Background(), 100000) if err != nil { log.Fatal(err) } fmt.Println(p.Int64())
Output:
type Option ¶
type Option func(irys *Client)
func WithCustomClient ¶
WithCustomClient set custom http client for irys
func WithCustomLogging ¶ added in v0.5.1
WithCustomLogging create custom logging
func WithCustomRetryMax ¶ added in v0.4.0
WithCustomRetryMax maximum number of retries
func WithCustomRetryWaitMax ¶ added in v0.4.0
WithCustomRetryWaitMax maximum time to wait
func WithCustomRetryWaitMin ¶ added in v0.4.0
WithCustomRetryWaitMin minimum time to wait
Click to show internal directories.
Click to hide internal directories.