client

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: Apache-2.0, MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultTimeout is the default HTTP client timeout
	DefaultTimeout = 30 * time.Second
)

Variables

View Source
var ErrNotFound = errors.New("not found")

ErrNotFound is returned when a resource is not found (HTTP 404)

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a client for the bridgeservice REST API

func New

func New(cfg Config) *Client

New creates a new bridgeservice client

func (*Client) GetBridgeByDepositCount

func (c *Client) GetBridgeByDepositCount(
	ctx context.Context, networkID uint32, depositCount uint32,
) (*types.BridgeResponse, error)

GetBridgeByDepositCount retrieves the bridge for the given network and deposit count. Returns ErrNotFound if the bridge does not exist in bridge or bridge_archive.

func (*Client) GetBridges

func (c *Client) GetBridges(ctx context.Context, params GetBridgesParams) (*types.BridgesResult, error)

GetBridges retrieves paginated bridge events

func (*Client) GetBridgesByContent

func (c *Client) GetBridgesByContent(
	ctx context.Context, params GetBridgesByContentParams,
) (*types.BridgesByContentResult, error)

GetBridgesByContent retrieves bridges matching the given content fields for the specified network.

func (*Client) GetClaimProof

func (c *Client) GetClaimProof(
	ctx context.Context, networkID, leafIndex, depositCount uint32,
) (*types.ClaimProof, error)

GetClaimProof retrieves Merkle proofs for claim verification

func (*Client) GetClaims

func (c *Client) GetClaims(ctx context.Context, params GetClaimsParams) (*types.ClaimsResult, error)

GetClaims retrieves paginated claims

func (*Client) GetClaimsByGER

func (c *Client) GetClaimsByGER(ctx context.Context, networkID uint32, ger string) (*types.ClaimsByGERResult, error)

GetClaimsByGER retrieves all claims matching the given global exit root (0x-prefixed hex hash) for the specified network (0 for L1, L2 network ID otherwise).

func (*Client) GetInjectedL1InfoLeaf

func (c *Client) GetInjectedL1InfoLeaf(
	ctx context.Context, networkID, leafIndex int,
) (*types.L1InfoTreeLeafResponse, error)

GetInjectedL1InfoLeaf retrieves an injected L1 info tree leaf

func (*Client) GetL1InfoTreeIndex

func (c *Client) GetL1InfoTreeIndex(ctx context.Context, networkID, depositCount int) (uint32, error)

GetL1InfoTreeIndex retrieves the L1 Info Tree index for a bridge

func (*Client) GetLastReorgEvent

func (c *Client) GetLastReorgEvent(ctx context.Context, networkID int) (*bridgesync.LastReorg, error)

GetLastReorgEvent retrieves the last reorganization event

func (*Client) GetLegacyTokenMigrations

func (c *Client) GetLegacyTokenMigrations(
	ctx context.Context, params GetLegacyTokenMigrationsParams,
) (*types.LegacyTokenMigrationsResult, error)

GetLegacyTokenMigrations retrieves legacy token migrations

func (*Client) GetRemoveGEREvents

func (c *Client) GetRemoveGEREvents(
	ctx context.Context, params GetRemoveGEREventsParams,
) (*types.RemoveGEREventsResult, error)

GetRemoveGEREvents retrieves removed GER (Global Exit Root) events

func (*Client) GetSetClaims

func (c *Client) GetSetClaims(ctx context.Context, params GetSetClaimsParams) (*types.SetClaimsResult, error)

GetSetClaims retrieves set claims (L2 only)

func (*Client) GetSyncStatus

func (c *Client) GetSyncStatus(ctx context.Context) (*types.SyncStatus, error)

GetSyncStatus retrieves the bridge synchronization status

func (*Client) GetTokenMappings

func (c *Client) GetTokenMappings(
	ctx context.Context, params GetTokenMappingsParams,
) (*types.TokenMappingsResult, error)

GetTokenMappings retrieves token mappings

func (*Client) GetUnsetClaims

func (c *Client) GetUnsetClaims(ctx context.Context, params GetUnsetClaimsParams) (*types.UnsetClaimsResult, error)

GetUnsetClaims retrieves unset claims (L2 only)

func (*Client) HealthCheck

func (c *Client) HealthCheck(ctx context.Context) (*types.HealthCheckResponse, error)

HealthCheck performs a health check

type Config

type Config struct {
	BaseURL string
	Timeout time.Duration
}

Config contains configuration for the client

type GetBridgesByContentParams

type GetBridgesByContentParams struct {
	NetworkID          uint32
	LeafType           uint8
	OriginAddress      string
	DestinationNetwork uint32
	DestinationAddress string
	Amount             *big.Int
	Metadata           []byte
}

GetBridgesByContentParams holds the content fields for GetBridgesByContent

type GetBridgesParams

type GetBridgesParams struct {
	NetworkID    uint32
	PageNumber   *uint32
	PageSize     *uint32
	DepositCount *uint64
	FromAddress  *string
	NetworkIDs   []uint32
}

GetBridgesParams contains parameters for GetBridges

type GetClaimsParams

type GetClaimsParams struct {
	NetworkID        uint32
	PageNumber       *uint32
	PageSize         *uint32
	NetworkIDs       []uint32
	IncludeAllFields *bool
	GlobalIndex      *big.Int
}

GetClaimsParams contains parameters for GetClaims

type GetLegacyTokenMigrationsParams

type GetLegacyTokenMigrationsParams struct {
	NetworkID  int
	PageNumber *int
	PageSize   *int
}

GetLegacyTokenMigrationsParams contains parameters for GetLegacyTokenMigrations

type GetRemoveGEREventsParams

type GetRemoveGEREventsParams struct {
	GlobalExitRoot *string
	Limit          *int
}

GetRemoveGEREventsParams contains parameters for GetRemoveGEREvents

type GetSetClaimsParams

type GetSetClaimsParams struct {
	PageNumber  *int
	PageSize    *int
	GlobalIndex *big.Int
}

GetSetClaimsParams contains parameters for GetSetClaims

type GetTokenMappingsParams

type GetTokenMappingsParams struct {
	NetworkID          int
	PageNumber         *int
	PageSize           *int
	OriginTokenAddress *string
}

GetTokenMappingsParams contains parameters for GetTokenMappings

type GetUnsetClaimsParams

type GetUnsetClaimsParams struct {
	PageNumber  *int
	PageSize    *int
	GlobalIndex *big.Int
}

GetUnsetClaimsParams contains parameters for GetUnsetClaims

Jump to

Keyboard shortcuts

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