diff --git a/relayer/proto/relayer.gen.go b/relayer/proto/relayer.gen.go index 9dc74471..f5aede92 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 17923978b5bea530cea7f2517b8c22eea7e51e57 // -- -// 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 "17923978b5bea530cea7f2517b8c22eea7e51e57" } // @@ -68,12 +68,12 @@ type RelayerClient interface { // TODO: deprecated, to be removed by https://github.com/0xsequence/stack/pull/356 at a later date UpdateMetaTxnGasLimits(ctx context.Context, walletAddress string, walletConfig interface{}, payload string) (string, error) FeeTokens(ctx context.Context) (bool, []*FeeToken, string, error) - FeeOptions(ctx context.Context, wallet string, to string, data string, simulate *bool) ([]*FeeOption, bool, *string, error) + FeeOptions(ctx context.Context, wallet string, to string, data string, simulate *bool, authorization *EIP7702Authorization) ([]*FeeOption, bool, *string, error) // Bridge gas endpoints for S2S calls // Used for bridge fees (e.g., LayerZero messaging fees) that require msg.value to be fronted at runtime. // bridgeGas will be included in fee calculation so the relayer gets reimbursed. SendMetaTxnWithBridgeGas(ctx context.Context, call *MetaTxn, quote *string, projectID *uint64, bridgeGas string, preconditions []*TransactionPrecondition) (bool, string, error) - FeeOptionsWithBridgeGas(ctx context.Context, wallet string, to string, data string, simulate *bool, bridgeGas string) ([]*FeeOption, bool, *string, error) + FeeOptionsWithBridgeGas(ctx context.Context, wallet string, to string, data string, simulate *bool, bridgeGas string, authorization *EIP7702Authorization) ([]*FeeOption, bool, *string, error) // TODO: deprecated, to be removed by https://github.com/0xsequence/stack/pull/356 at a later date GetMetaTxnNetworkFeeOptions(ctx context.Context, walletConfig interface{}, payload string) ([]*FeeOption, error) // @@ -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 { @@ -465,7 +528,16 @@ type MetaTxn struct { // TODO (later): rename this to `to: string` Contract string `json:"contract" db:"to_address"` // TODO: rename to 'execdata' - Input string `json:"input" db:"tx_data"` + Input string `json:"input" db:"tx_data"` + Authorization *EIP7702Authorization `json:"authorization"` +} + +type EIP7702Authorization struct { + ChainId uint64 `json:"chainId"` + Implementation string `json:"implementation"` + Nonce uint64 `json:"nonce"` + // 0x-prefixed 65-byte r || s || yParity signature + Signature string `json:"signature"` } // TODO: review @@ -569,11 +641,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 +699,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 +723,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", @@ -909,13 +974,14 @@ func (c *relayerClient) FeeTokens(ctx context.Context) (bool, []*FeeToken, strin return out.Ret0, out.Ret1, out.Ret2, err } -func (c *relayerClient) FeeOptions(ctx context.Context, wallet string, to string, data string, simulate *bool) ([]*FeeOption, bool, *string, error) { +func (c *relayerClient) FeeOptions(ctx context.Context, wallet string, to string, data string, simulate *bool, authorization *EIP7702Authorization) ([]*FeeOption, bool, *string, error) { in := struct { - Arg0 string `json:"wallet"` - Arg1 string `json:"to"` - Arg2 string `json:"data"` - Arg3 *bool `json:"simulate"` - }{wallet, to, data, simulate} + Arg0 string `json:"wallet"` + Arg1 string `json:"to"` + Arg2 string `json:"data"` + Arg3 *bool `json:"simulate"` + Arg4 *EIP7702Authorization `json:"authorization"` + }{wallet, to, data, simulate, authorization} out := struct { Ret0 []*FeeOption `json:"options"` Ret1 bool `json:"sponsored"` @@ -957,14 +1023,15 @@ func (c *relayerClient) SendMetaTxnWithBridgeGas(ctx context.Context, call *Meta return out.Ret0, out.Ret1, err } -func (c *relayerClient) FeeOptionsWithBridgeGas(ctx context.Context, wallet string, to string, data string, simulate *bool, bridgeGas string) ([]*FeeOption, bool, *string, error) { +func (c *relayerClient) FeeOptionsWithBridgeGas(ctx context.Context, wallet string, to string, data string, simulate *bool, bridgeGas string, authorization *EIP7702Authorization) ([]*FeeOption, bool, *string, error) { in := struct { - Arg0 string `json:"wallet"` - Arg1 string `json:"to"` - Arg2 string `json:"data"` - Arg3 *bool `json:"simulate"` - Arg4 string `json:"bridgeGas"` - }{wallet, to, data, simulate, bridgeGas} + Arg0 string `json:"wallet"` + Arg1 string `json:"to"` + Arg2 string `json:"data"` + Arg3 *bool `json:"simulate"` + Arg4 string `json:"bridgeGas"` + Arg5 *EIP7702Authorization `json:"authorization"` + }{wallet, to, data, simulate, bridgeGas, authorization} out := struct { Ret0 []*FeeOption `json:"options"` Ret1 bool `json:"sponsored"` @@ -1034,15 +1101,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 +1116,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 +1161,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 +1169,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 +1191,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 +1214,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 +1233,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 +1255,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 +1275,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 +1296,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 +1317,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 +1337,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 +1360,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 +1383,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 +1403,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 +1424,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 +1444,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 +1467,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 +1490,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 +1510,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 +1531,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 +1550,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 +1571,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 +1970,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