diff --git a/relayer/proto/relayer.gen.go b/relayer/proto/relayer.gen.go index 9dc74471..4a7ad2ab 100644 --- a/relayer/proto/relayer.gen.go +++ b/relayer/proto/relayer.gen.go @@ -1,6 +1,6 @@ -// sequence-relayer v0.4.1 fb3b85b73856f333cbba355861050f23c7b2af48 +// sequence-relayer v0.4.1 0a2503bc893179ba968b0015d7580aabf6a88dd4 // -- -// Code generated by webrpc-gen@v0.31.2 with golang generator. DO NOT EDIT. +// Code generated by webrpc-gen@v0.32.2 with golang generator. DO NOT EDIT. // // webrpc-gen -schema=relayer.ridl -target=golang -pkg=proto -client -out=./clients/relayer.gen.go package proto @@ -35,7 +35,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "fb3b85b73856f333cbba355861050f23c7b2af48" + return "0a2503bc893179ba968b0015d7580aabf6a88dd4" } // @@ -81,14 +81,9 @@ type RelayerClient interface { // StartSender(ctx context.Context, sender int) error StopSender(ctx context.Context, sender int) error - ResetSender(ctx context.Context, sender int) (uint64, error) + RepairSender(ctx context.Context, sender int, nonce uint64, operation RepairOperation) error GetMetaTransactions(ctx context.Context, projectId uint64, page *Page) (*Page, []*MetaTxnLog, error) GetTransactionCost(ctx context.Context, projectId uint64, from time.Time, to time.Time) (float64, error) - // Sent transactions from an account. If filter is omitted then it will return all transactions. - SentTransactions(ctx context.Context, filter *SentTransactionsFilter, page *Page) (*Page, []*Transaction, error) - // Pending transactions waiting to be mined for an account. This endpoint is just a sugar of `SentTransactions` - // with the filter set to pending: true. - PendingTransactions(ctx context.Context, page *Page) (*Page, []*Transaction, error) // Legacy Gas Tank GetGasTank(ctx context.Context, id uint64) (*GasTank, error) AddGasTank(ctx context.Context, name string, feeMarkupFactor float64, unlimited *bool) (bool, *GasTank, error) @@ -121,6 +116,51 @@ type RelayerClient interface { // Schema types // +type RepairOperation int + +const ( + RepairOperation_SKIP RepairOperation = 0 + RepairOperation_REQUEUE RepairOperation = 1 + RepairOperation_DROP RepairOperation = 2 +) + +var RepairOperation_name = map[int]string{ + 0: "SKIP", + 1: "REQUEUE", + 2: "DROP", +} + +var RepairOperation_value = map[string]int{ + "SKIP": 0, + "REQUEUE": 1, + "DROP": 2, +} + +func (x RepairOperation) String() string { + return RepairOperation_name[int(x)] +} + +func (x RepairOperation) MarshalText() ([]byte, error) { + return []byte(RepairOperation_name[int(x)]), nil +} + +func (x *RepairOperation) UnmarshalText(b []byte) error { + *x = RepairOperation(RepairOperation_value[string(b)]) + return nil +} + +func (x *RepairOperation) Is(values ...RepairOperation) bool { + if x == nil { + return false + } + for _, v := range values { + if *x == v { + return true + } + } + return false +} + type ETHTxnStatus uint const ( @@ -395,11 +435,34 @@ type RuntimeStatus struct { } type SenderStatus struct { - Index uint32 `json:"index"` - Address string `json:"address"` - EtherBalance float64 `json:"etherBalance"` - Enabled bool `json:"enabled"` - Active bool `json:"active"` + Index uint32 `json:"index"` + Address string `json:"address"` + EtherBalance float64 `json:"etherBalance"` + Enabled bool `json:"enabled"` + Active bool `json:"active"` + Nonce *NonceStatus `json:"nonce,omitempty"` + Current *CurrentStatus `json:"current,omitempty"` +} + +type NonceStatus struct { + Chain uint64 `json:"chain"` + Mempool uint64 `json:"mempool"` +} + +type CurrentStatus struct { + Transaction string `json:"transaction"` + First *TransactionStatus `json:"first"` + Latest *TransactionStatus `json:"latest,omitempty"` +} + +type TransactionStatus struct { + Transaction prototyp.Hash `json:"transaction"` + Gas uint64 `json:"gas"` + GasPrice prototyp.BigInt `json:"gasPrice"` + PriorityFee prototyp.BigInt `json:"priorityFee"` + Time time.Time `json:"time"` + Age string `json:"age"` + Error *string `json:"error,omitempty"` } type RuntimeChecks struct { @@ -569,11 +632,6 @@ type TxnLogTransfer struct { Amounts []prototyp.BigInt `json:"amounts"` } -type SentTransactionsFilter struct { - Pending *bool `json:"pending"` - Failed *bool `json:"failed"` -} - type SimulateResult struct { Executed bool `json:"executed"` Succeeded bool `json:"succeeded"` @@ -632,12 +690,12 @@ const RelayerPathPrefix = "/rpc/Relayer/" type relayerClient struct { client HTTPClient - urls [43]string + urls [41]string } func NewRelayerClient(addr string, client HTTPClient) RelayerClient { prefix := urlBase(addr) + RelayerPathPrefix - urls := [43]string{ + urls := [41]string{ prefix + "Ping", prefix + "Version", prefix + "RuntimeStatus", @@ -656,11 +714,9 @@ func NewRelayerClient(addr string, client HTTPClient) RelayerClient { prefix + "GetMetaTxnNetworkFeeOptions", prefix + "StartSender", prefix + "StopSender", - prefix + "ResetSender", + prefix + "RepairSender", prefix + "GetMetaTransactions", prefix + "GetTransactionCost", - prefix + "SentTransactions", - prefix + "PendingTransactions", prefix + "GetGasTank", prefix + "AddGasTank", prefix + "UpdateGasTank", @@ -1034,15 +1090,14 @@ func (c *relayerClient) StopSender(ctx context.Context, sender int) error { return err } -func (c *relayerClient) ResetSender(ctx context.Context, sender int) (uint64, error) { +func (c *relayerClient) RepairSender(ctx context.Context, sender int, nonce uint64, operation RepairOperation) error { in := struct { - Arg0 int `json:"sender"` - }{sender} - out := struct { - Ret0 uint64 `json:"deleted"` - }{} + Arg0 int `json:"sender"` + Arg1 uint64 `json:"nonce"` + Arg2 RepairOperation `json:"operation"` + }{sender, nonce, operation} - resp, err := doHTTPRequest(ctx, c.client, c.urls[18], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[18], in, nil) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1050,7 +1105,7 @@ func (c *relayerClient) ResetSender(ctx context.Context, sender int) (uint64, er } } - return out.Ret0, err + return err } func (c *relayerClient) GetMetaTransactions(ctx context.Context, projectId uint64, page *Page) (*Page, []*MetaTxnLog, error) { @@ -1095,47 +1150,6 @@ func (c *relayerClient) GetTransactionCost(ctx context.Context, projectId uint64 return out.Ret0, err } -func (c *relayerClient) SentTransactions(ctx context.Context, filter *SentTransactionsFilter, page *Page) (*Page, []*Transaction, error) { - in := struct { - Arg0 *SentTransactionsFilter `json:"filter"` - Arg1 *Page `json:"page"` - }{filter, page} - out := struct { - Ret0 *Page `json:"page"` - Ret1 []*Transaction `json:"transactions"` - }{} - - resp, err := doHTTPRequest(ctx, c.client, c.urls[21], in, &out) - if resp != nil { - cerr := resp.Body.Close() - if err == nil && cerr != nil { - err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) - } - } - - return out.Ret0, out.Ret1, err -} - -func (c *relayerClient) PendingTransactions(ctx context.Context, page *Page) (*Page, []*Transaction, error) { - in := struct { - Arg0 *Page `json:"page"` - }{page} - out := struct { - Ret0 *Page `json:"page"` - Ret1 []*Transaction `json:"transactions"` - }{} - - resp, err := doHTTPRequest(ctx, c.client, c.urls[22], in, &out) - if resp != nil { - cerr := resp.Body.Close() - if err == nil && cerr != nil { - err = ErrWebrpcRequestFailed.WithCausef("failed to close response body: %w", cerr) - } - } - - return out.Ret0, out.Ret1, err -} - func (c *relayerClient) GetGasTank(ctx context.Context, id uint64) (*GasTank, error) { in := struct { Arg0 uint64 `json:"id"` @@ -1144,7 +1158,7 @@ func (c *relayerClient) GetGasTank(ctx context.Context, id uint64) (*GasTank, er Ret0 *GasTank `json:"gasTank"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[23], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[21], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1166,7 +1180,7 @@ func (c *relayerClient) AddGasTank(ctx context.Context, name string, feeMarkupFa Ret1 *GasTank `json:"gasTank"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[24], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[22], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1189,7 +1203,7 @@ func (c *relayerClient) UpdateGasTank(ctx context.Context, id uint64, name *stri Ret1 *GasTank `json:"gasTank"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[25], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[23], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1208,7 +1222,7 @@ func (c *relayerClient) NextGasTankBalanceAdjustmentNonce(ctx context.Context, i Ret0 uint64 `json:"nonce"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[26], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[24], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1230,7 +1244,7 @@ func (c *relayerClient) AdjustGasTankBalance(ctx context.Context, id uint64, non Ret1 *GasTankBalanceAdjustment `json:"adjustment"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[27], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[25], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1250,7 +1264,7 @@ func (c *relayerClient) GetGasTankBalanceAdjustment(ctx context.Context, id uint Ret0 *GasTankBalanceAdjustment `json:"adjustment"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[28], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[26], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1271,7 +1285,7 @@ func (c *relayerClient) ListGasTankBalanceAdjustments(ctx context.Context, id ui Ret1 []*GasTankBalanceAdjustment `json:"adjustments"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[29], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[27], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1292,7 +1306,7 @@ func (c *relayerClient) ListGasSponsors(ctx context.Context, projectId uint64, p Ret1 []*GasSponsor `json:"gasSponsors"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[30], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[28], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1312,7 +1326,7 @@ func (c *relayerClient) GetGasSponsor(ctx context.Context, projectId uint64, id Ret0 *GasSponsor `json:"gasSponsor"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[31], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[29], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1335,7 +1349,7 @@ func (c *relayerClient) AddGasSponsor(ctx context.Context, projectId uint64, add Ret1 *GasSponsor `json:"gasSponsor"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[32], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[30], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1358,7 +1372,7 @@ func (c *relayerClient) UpdateGasSponsor(ctx context.Context, projectId uint64, Ret1 *GasSponsor `json:"gasSponsor"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[33], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[31], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1378,7 +1392,7 @@ func (c *relayerClient) RemoveGasSponsor(ctx context.Context, projectId uint64, Ret0 bool `json:"status"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[34], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[32], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1399,7 +1413,7 @@ func (c *relayerClient) ListEcosystemGasSponsors(ctx context.Context, ecosystemI Ret1 []*GasSponsor `json:"gasSponsors"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[35], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[33], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1419,7 +1433,7 @@ func (c *relayerClient) GetEcosystemGasSponsor(ctx context.Context, ecosystemId Ret0 *GasSponsor `json:"gasSponsor"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[36], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[34], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1442,7 +1456,7 @@ func (c *relayerClient) AddEcosystemGasSponsor(ctx context.Context, ecosystemId Ret1 *GasSponsor `json:"gasSponsor"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[37], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[35], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1465,7 +1479,7 @@ func (c *relayerClient) UpdateEcosystemGasSponsor(ctx context.Context, ecosystem Ret1 *GasSponsor `json:"gasSponsor"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[38], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[36], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1485,7 +1499,7 @@ func (c *relayerClient) RemoveEcosystemGasSponsor(ctx context.Context, ecosystem Ret0 bool `json:"status"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[39], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[37], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1506,7 +1520,7 @@ func (c *relayerClient) AddressGasSponsors(ctx context.Context, address string, Ret1 []*GasSponsor `json:"gasSponsors"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[40], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[38], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1525,7 +1539,7 @@ func (c *relayerClient) GetProjectBalance(ctx context.Context, projectId uint64) Ret0 float64 `json:"balance"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[41], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[39], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1546,7 +1560,7 @@ func (c *relayerClient) AdjustProjectBalance(ctx context.Context, projectId uint Ret0 float64 `json:"balance"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[42], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[40], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1945,7 +1959,7 @@ var ( const WebrpcHeader = "Webrpc" -const WebrpcHeaderValue = "webrpc@v0.31.2;gen-golang@v0.23.3;sequence-relayer@v0.4.1" +const WebrpcHeaderValue = "webrpc@v0.32.2;gen-golang@v0.24.0;sequence-relayer@v0.4.1" type WebrpcGenVersions struct { WebrpcGenVersion string