utils

package
v0.0.0-...-29137c7 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2025 License: MIT Imports: 10 Imported by: 2

Documentation

Index

Constants

View Source
const CtxKeyTracingID = "tracingID"

CtxKeyTracingID is the context key for tracing ID

Variables

View Source
var BackoffStrategyDefault = backoff.Backoff{
	Min:    100 * time.Millisecond,
	Max:    3 * time.Second,
	Factor: 2,
}

Exponential backoff (default) is used to handle retries with increasing wait times in case of errors

Functions

func Ed25519PublicKeyToAddress

func Ed25519PublicKeyToAddress(key ed25519.PublicKey) aptos.AccountAddress

Ed25519PublicKeyToAddress converts an Ed25519 public key to an Aptos account address.

func HexAddressToAddress

func HexAddressToAddress(addr string) (aptos.AccountAddress, error)

HexAddressToAddress converts a hex string to an Aptos account address. Notice: will force [32]byte hex decoding for canonical address representation

func HexPublicKeyToAddress

func HexPublicKeyToAddress(key string) (aptos.AccountAddress, error)

func HexPublicKeyToAddressString

func HexPublicKeyToAddressString(key string) (string, error)

func HexPublicKeyToEd25519PublicKey

func HexPublicKeyToEd25519PublicKey(key string) (ed25519.PublicKey, error)

HexPublicKeyToEd25519PublicKey converts a hex string to an Ed25519 public key.

func PublicKeyBytesToAddress

func PublicKeyBytesToAddress(publicKey []byte) (aptos.AccountAddress, error)

func WithRetry

func WithRetry[R any](ctx context.Context, lggr logger.Logger, fn func(ctx context.Context) (R, error)) (R, error)

WithRetry applies a default retry strategy to a given function.

func WithRetryStrategy

func WithRetryStrategy[R any](ctx context.Context, lggr logger.Logger, strategy backoff.Backoff, fn func(ctx context.Context) (R, error)) (R, error)

WithRetryStrategy applies a retry strategy to a given function.

Types

This section is empty.

Jump to

Keyboard shortcuts

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