Documentation
¶
Index ¶
- type Irys
- type IrysClient
- func (i *IrysClient) BasicUpload(ctx context.Context, file io.Reader, tags ...types.Tag) (types.Transaction, error)
- func (i *IrysClient) Download(ctx context.Context, hash string) (*types.File, error)
- func (i *IrysClient) GetBalance(ctx context.Context) (*big.Int, error)
- func (i *IrysClient) GetMetaData(ctx context.Context, hash string) (types.Transaction, error)
- func (i *IrysClient) GetPrice(ctx context.Context, fileSize int) (*big.Int, error)
- func (i *IrysClient) TopUpBalance(ctx context.Context, amount *big.Int) (types.TopUpConfirmation, error)
- func (i *IrysClient) Upload(ctx context.Context, file io.Reader, price *big.Int, tags ...types.Tag) (types.Transaction, error)
- type Node
- type Option
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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 io.Reader, tags ...types.Tag) (types.Transaction, error)
// Upload file with check balance
Upload(ctx context.Context, file io.Reader, price *big.Int, tags ...types.Tag) (types.Transaction, error)
// Download get file with header details
Download(ctx context.Context, hash string) (*types.File, error)
// GetMetaData get transaction details
GetMetaData(ctx context.Context, hash 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) (types.TopUpConfirmation, error)
}
func New ¶
New create IrysClient object
Example ¶
matic, err := currency.NewMatic("foo", "bar")
if err != nil {
log.Fatal(err)
}
c, err := New(DefaultNode1, matic)
if err != nil {
log.Fatal(err)
}
p, err := c.GetPrice(context.Background(), 100000)
if err != nil {
log.Fatal(err)
}
fmt.Println(p.Int64())
type IrysClient ¶ added in v0.4.0
type IrysClient struct {
// contains filtered or unexported fields
}
func (*IrysClient) BasicUpload ¶ added in v0.4.0
func (i *IrysClient) BasicUpload(ctx context.Context, file io.Reader, tags ...types.Tag) (types.Transaction, error)
func (*IrysClient) GetBalance ¶ added in v0.4.0
func (*IrysClient) GetMetaData ¶ added in v0.4.0
func (i *IrysClient) GetMetaData(ctx context.Context, hash string) (types.Transaction, error)
func (*IrysClient) TopUpBalance ¶ added in v0.4.0
func (i *IrysClient) TopUpBalance(ctx context.Context, amount *big.Int) (types.TopUpConfirmation, error)
type Option ¶
type Option func(irys *IrysClient)
func WithCustomClient ¶
WithCustomClient set custom http client for irys
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.