Documentation ¶
Index ¶
Constants ¶
const (
DefaultTimeout = 3 * time.Second
)
Variables ¶
var DefaultClient = lo.Must(NewClient())
DefaultClient is the default client.
var DefaultGateways = []string{ GatewayArweave.String(), GatewayARIO.String(), GatewayPermagate.String(), GatewayLove4Src.String(), GatewayARBR.String(), GatewayBobInstein.String(), GatewayAleko0o.String(), GatewaySulapan.String(), GatewayFllstck.String(), GatewayBicem.String(), }
Functions ¶
func Base64Decode ¶
Base64Decode returns the bytes represented by the base64 string.
func Base64Encode ¶
Base64Encode returns the base64 encoding of data.
func GatewayStrings ¶
func GatewayStrings() []string
GatewayStrings returns a slice of all String values of the enum
func PublicKeyToAddress ¶
PublicKeyToAddress returns the arweave address of the owner.
Types ¶
type Block ¶
type Block struct { Nonce string `json:"nonce"` Timestamp int64 `json:"timestamp"` Height int64 `json:"height"` Hash string `json:"hash"` Txs []string `json:"txs"` }
Block represents a block on the Arweave network.
type Client ¶
type Client interface { GetTransactionData(ctx context.Context, id string) (io.ReadCloser, error) GetBlockHeight(ctx context.Context) (blockHeight int64, err error) GetBlockByHeight(ctx context.Context, height int64) (block *Block, err error) GetTransactionByID(ctx context.Context, id string) (transaction *Transaction, err error) }
Client is the interface that wraps the Fetch method.
func NewClient ¶
func NewClient(options ...ClientOption) (Client, error)
NewClient creates a new Client with the given options.
type ClientOption ¶
type ClientOption func(client *client) error
ClientOption is the type of the options passed to NewClient.
func WithGateways ¶
func WithGateways(gateways []string) ClientOption
WithGateways sets the client with Arweave gateways.
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ClientOption
WithTimeout sets the client with the given timeout.
type Gateway ¶
type Gateway uint
const ( GatewayArweave Gateway = iota // https://arweave.net/ GatewayARIO // https://ar-io.dev/ GatewayPermagate // https://permagate.io/ GatewayLove4Src // https://love4src.com/ GatewayARBR // https://arbr.pro/ GatewayBobInstein // https://bobinstein.com/ GatewayAleko0o // https://aleko0o.store/ GatewaySulapan // https://sulapan.com/ GatewayFllstck // https://arweave.fllstck.dev/ GatewayBicem // https://bicem.xyz GatewayDilsinay // https://dilsinay.online/ GatewayLostGame // https://lostgame.online/ GatewayKhalDrogo // https://khaldrogo.site/ GatewayDasamuka // https://dasamuka.cloud/ GatewayArendor // http://arendor.xyz/ GatewayVelaryon // https://velaryon.xyz/ )
func GatewayString ¶
GatewayString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func (Gateway) IsAGateway ¶
IsAGateway returns "true" if the value is listed in the enum definition. "false" otherwise
type Network ¶
type Network struct {
Blocks int64 `json:"blocks"`
}
Network represents the Network information of the Arweave network.
type Transaction ¶
type Transaction struct { Format int `json:"format"` ID string `json:"id"` Owner string `json:"owner"` Tags []Tag `json:"tags"` Target string `json:"target"` Quantity string `json:"quantity"` Data string `json:"data"` DataReader io.Reader `json:"-"` DataSize string `json:"data_size"` DataRoot string `json:"data_root"` Reward string `json:"reward"` Signature string `json:"signature"` }
Transaction represents a transaction on the Arweave network.