From eade6746288812c4b158a54f5159c7287a301a70 Mon Sep 17 00:00:00 2001 From: Shun Kakinoki Date: Mon, 26 Jan 2026 15:26:27 +0900 Subject: [PATCH 1/5] Update relayer proto for nativeValue fee options --- relayer/proto/relayer.gen.go | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/relayer/proto/relayer.gen.go b/relayer/proto/relayer.gen.go index 06a881473..01b6471c1 100644 --- a/relayer/proto/relayer.gen.go +++ b/relayer/proto/relayer.gen.go @@ -1,4 +1,4 @@ -// sequence-relayer v0.4.1 7f8a4b83b00e0b6849c76c2ff0e23931e26b3d9f +// sequence-relayer v0.4.1 f727656d293708e0aef6fc567b7591894ffcf77c // -- // Code generated by webrpc-gen@v0.31.2 with golang generator. DO NOT EDIT. // @@ -35,7 +35,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "7f8a4b83b00e0b6849c76c2ff0e23931e26b3d9f" + return "f727656d293708e0aef6fc567b7591894ffcf77c" } // @@ -68,7 +68,9 @@ 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) + // Used for bridge fees (e.g., LayerZero messaging fees) that require msg.value. to be fronted at runtime. + // This value will be included in the fee calculation so the relayer gets reimbursed. + FeeOptions(ctx context.Context, wallet string, to string, data string, simulate *bool, nativeValue *string) ([]*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) GetMetaTransactions(ctx context.Context, projectId uint64, page *Page) (*Page, []*MetaTxnLog, error) @@ -122,6 +124,8 @@ const ( ETHTxnStatus_FAILED ETHTxnStatus = 6 // txn accepted by relayer, waiting for preconditions to be satisfied ETHTxnStatus_PENDING_PRECONDITION ETHTxnStatus = 7 + // waiting for receipt + ETHTxnStatus_MINED ETHTxnStatus = 8 ) var ETHTxnStatus_name = map[uint]string{ @@ -133,6 +137,7 @@ var ETHTxnStatus_name = map[uint]string{ 5: "PARTIALLY_FAILED", 6: "FAILED", 7: "PENDING_PRECONDITION", + 8: "MINED", } var ETHTxnStatus_value = map[string]uint{ @@ -144,6 +149,7 @@ var ETHTxnStatus_value = map[string]uint{ "PARTIALLY_FAILED": 5, "FAILED": 6, "PENDING_PRECONDITION": 7, + "MINED": 8, } func (x ETHTxnStatus) String() string { @@ -458,6 +464,9 @@ type MetaTxn struct { Contract string `json:"contract" db:"to_address"` // TODO: rename to 'execdata' Input string `json:"input" db:"tx_data"` + // Native value (in wei) to be fronted at runtime with the transaction. + // Used for bridge fees (e.g., LayerZero messaging fees) that require msg.value. + NativeValue *prototyp.BigInt `json:"nativeValue" db:"native_value"` } // TODO: review @@ -480,6 +489,9 @@ type MetaTxnLog struct { MinedAt *time.Time `json:"minedAt" db:"mined_at,omitempty"` Target prototyp.Hash `json:"target" db:"target"` Input prototyp.Hash `json:"input" db:"input"` + // Native value (in wei) to be fronted at runtime with the transaction. + // Used for bridge fees (e.g., LayerZero messaging fees) that require msg.value. + NativeValue *prototyp.BigInt `json:"nativeValue" db:"native_value"` // TODO: review this field.. we may not want it.. what goes in here..? is it just // the input/target from MetaTxn above? we already have these as separate columns.. TxnArgs map[string]interface{} `json:"txnArgs" db:"txn_args"` @@ -898,13 +910,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, nativeValue *string) ([]*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 *string `json:"nativeValue"` + }{wallet, to, data, simulate, nativeValue} out := struct { Ret0 []*FeeOption `json:"options"` Ret1 bool `json:"sponsored"` From 376e61a74e1d394fe405ccc0f10d04fac0b477a0 Mon Sep 17 00:00:00 2001 From: Shun Kakinoki Date: Mon, 26 Jan 2026 15:49:53 +0900 Subject: [PATCH 2/5] Update relayer fee options call signature --- relayer/relayer.go | 1 + 1 file changed, 1 insertion(+) diff --git a/relayer/relayer.go b/relayer/relayer.go index 723b88322..4e9030708 100644 --- a/relayer/relayer.go +++ b/relayer/relayer.go @@ -283,6 +283,7 @@ func (r *Client) FeeOptions(ctx context.Context, signedTxs *sequence.SignedTrans signedTxs.WalletAddress.String(), "0x"+common.Bytes2Hex(data), nil, + nil, ) if err != nil { return nil, nil, err From 8752434c36868434401ca36e6a85333e131d4c94 Mon Sep 17 00:00:00 2001 From: Shun Kakinoki Date: Mon, 26 Jan 2026 15:51:57 +0900 Subject: [PATCH 3/5] Update relayer mock FeeOptions signature --- lib/mock/relayer.mock.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/mock/relayer.mock.go b/lib/mock/relayer.mock.go index b6eaa9bd3..7a4014a9f 100644 --- a/lib/mock/relayer.mock.go +++ b/lib/mock/relayer.mock.go @@ -122,9 +122,9 @@ func (mr *RelayerMockRecorder) AdjustProjectBalance(ctx, projectId, amount, iden } // FeeOptions mocks base method. -func (m *Relayer) FeeOptions(ctx context.Context, wallet, to, data string, simulate *bool) ([]*proto.FeeOption, bool, *string, error) { +func (m *Relayer) FeeOptions(ctx context.Context, wallet, to, data string, simulate *bool, nativeValue *string) ([]*proto.FeeOption, bool, *string, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "FeeOptions", ctx, wallet, to, data, simulate) + ret := m.ctrl.Call(m, "FeeOptions", ctx, wallet, to, data, simulate, nativeValue) ret0, _ := ret[0].([]*proto.FeeOption) ret1, _ := ret[1].(bool) ret2, _ := ret[2].(*string) @@ -133,9 +133,9 @@ func (m *Relayer) FeeOptions(ctx context.Context, wallet, to, data string, simul } // FeeOptions indicates an expected call of FeeOptions. -func (mr *RelayerMockRecorder) FeeOptions(ctx, wallet, to, data, simulate any) *gomock.Call { +func (mr *RelayerMockRecorder) FeeOptions(ctx, wallet, to, data, simulate, nativeValue any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FeeOptions", reflect.TypeOf((*Relayer)(nil).FeeOptions), ctx, wallet, to, data, simulate) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FeeOptions", reflect.TypeOf((*Relayer)(nil).FeeOptions), ctx, wallet, to, data, simulate, nativeValue) } // FeeTokens mocks base method. From 25dcf102d1b6635ac082d95462f90419965bb460 Mon Sep 17 00:00:00 2001 From: Shun Kakinoki Date: Wed, 4 Feb 2026 17:45:48 +0900 Subject: [PATCH 4/5] Update relayer mock and proto for bridge gas handling --- lib/mock/relayer.mock.go | 28 +++++++-- relayer/proto/relayer.gen.go | 108 ++++++++++++++++++++++------------- 2 files changed, 90 insertions(+), 46 deletions(-) diff --git a/lib/mock/relayer.mock.go b/lib/mock/relayer.mock.go index 7a4014a9f..2bcf745d0 100644 --- a/lib/mock/relayer.mock.go +++ b/lib/mock/relayer.mock.go @@ -1,9 +1,9 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: ../../relayer/proto (interfaces: RelayerClient) +// Source: ./relayer/proto (interfaces: RelayerClient) // // Generated by this command: // -// mockgen -destination relayer.mock.go -package mock -mock_names RelayerClient=Relayer ../../relayer/proto RelayerClient +// mockgen -destination lib/mock/relayer.mock.go -package mock -mock_names RelayerClient=Relayer ./relayer/proto RelayerClient // // Package mock is a generated GoMock package. @@ -122,9 +122,9 @@ func (mr *RelayerMockRecorder) AdjustProjectBalance(ctx, projectId, amount, iden } // FeeOptions mocks base method. -func (m *Relayer) FeeOptions(ctx context.Context, wallet, to, data string, simulate *bool, nativeValue *string) ([]*proto.FeeOption, bool, *string, error) { +func (m *Relayer) FeeOptions(ctx context.Context, wallet, to, data string, simulate *bool, bridgeGas *string) ([]*proto.FeeOption, bool, *string, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "FeeOptions", ctx, wallet, to, data, simulate, nativeValue) + ret := m.ctrl.Call(m, "FeeOptions", ctx, wallet, to, data, simulate, bridgeGas) ret0, _ := ret[0].([]*proto.FeeOption) ret1, _ := ret[1].(bool) ret2, _ := ret[2].(*string) @@ -133,9 +133,9 @@ func (m *Relayer) FeeOptions(ctx context.Context, wallet, to, data string, simul } // FeeOptions indicates an expected call of FeeOptions. -func (mr *RelayerMockRecorder) FeeOptions(ctx, wallet, to, data, simulate, nativeValue any) *gomock.Call { +func (mr *RelayerMockRecorder) FeeOptions(ctx, wallet, to, data, simulate, bridgeGas any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FeeOptions", reflect.TypeOf((*Relayer)(nil).FeeOptions), ctx, wallet, to, data, simulate, nativeValue) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FeeOptions", reflect.TypeOf((*Relayer)(nil).FeeOptions), ctx, wallet, to, data, simulate, bridgeGas) } // FeeTokens mocks base method. @@ -445,6 +445,22 @@ func (mr *RelayerMockRecorder) SendMetaTxn(ctx, call, quote, projectID, precondi return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMetaTxn", reflect.TypeOf((*Relayer)(nil).SendMetaTxn), ctx, call, quote, projectID, preconditions) } +// SendMetaTxnWithBridgeGas mocks base method. +func (m *Relayer) SendMetaTxnWithBridgeGas(ctx context.Context, call *proto.MetaTxn, bridgeGas string, quote *string, projectID *uint64, preconditions []*proto.TransactionPrecondition) (bool, string, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SendMetaTxnWithBridgeGas", ctx, call, bridgeGas, quote, projectID, preconditions) + ret0, _ := ret[0].(bool) + ret1, _ := ret[1].(string) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// SendMetaTxnWithBridgeGas indicates an expected call of SendMetaTxnWithBridgeGas. +func (mr *RelayerMockRecorder) SendMetaTxnWithBridgeGas(ctx, call, bridgeGas, quote, projectID, preconditions any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMetaTxnWithBridgeGas", reflect.TypeOf((*Relayer)(nil).SendMetaTxnWithBridgeGas), ctx, call, bridgeGas, quote, projectID, preconditions) +} + // SentTransactions mocks base method. func (m *Relayer) SentTransactions(ctx context.Context, filter *proto.SentTransactionsFilter, page *proto.Page) (*proto.Page, []*proto.Transaction, error) { m.ctrl.T.Helper() diff --git a/relayer/proto/relayer.gen.go b/relayer/proto/relayer.gen.go index 01b6471c1..e5b4d827a 100644 --- a/relayer/proto/relayer.gen.go +++ b/relayer/proto/relayer.gen.go @@ -1,4 +1,4 @@ -// sequence-relayer v0.4.1 f727656d293708e0aef6fc567b7591894ffcf77c +// sequence-relayer v0.4.1 a868298438a2fab314581c4ba7e21b0dcca1db60 // -- // Code generated by webrpc-gen@v0.31.2 with golang generator. DO NOT EDIT. // @@ -35,7 +35,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "f727656d293708e0aef6fc567b7591894ffcf77c" + return "a868298438a2fab314581c4ba7e21b0dcca1db60" } // @@ -55,6 +55,9 @@ type RelayerClient interface { // Project ID is only used by service and admin calls. Other clients must have projectID passed via the context // TODO: rename return txnHash: string to metaTxnID: string SendMetaTxn(ctx context.Context, call *MetaTxn, quote *string, projectID *uint64, preconditions []*TransactionPrecondition) (bool, string, error) + // Internal endpoint for service-to-service calls that require bridge gas fronting + // Used by Trails/Excalibur for LayerZero OFT bridge transactions + SendMetaTxnWithBridgeGas(ctx context.Context, call *MetaTxn, bridgeGas string, quote *string, projectID *uint64, preconditions []*TransactionPrecondition) (bool, string, error) GetMetaTxnNonce(ctx context.Context, walletContractAddress string, space *string) (string, error) // TODO: one day, make GetMetaTxnReceipt respond immediately with receipt or not // and add WaitTransactionReceipt method, which will block and wait, similar to how GetMetaTxnReceipt @@ -68,9 +71,9 @@ 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) - // Used for bridge fees (e.g., LayerZero messaging fees) that require msg.value. to be fronted at runtime. + // Used for bridge fees (e.g., LayerZero messaging fees) that require msg.value to be fronted at runtime. // This value will be included in the fee calculation so the relayer gets reimbursed. - FeeOptions(ctx context.Context, wallet string, to string, data string, simulate *bool, nativeValue *string) ([]*FeeOption, bool, *string, error) + FeeOptions(ctx context.Context, wallet string, to string, data string, simulate *bool, bridgeGas *string) ([]*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) GetMetaTransactions(ctx context.Context, projectId uint64, page *Page) (*Page, []*MetaTxnLog, error) @@ -464,9 +467,9 @@ type MetaTxn struct { Contract string `json:"contract" db:"to_address"` // TODO: rename to 'execdata' Input string `json:"input" db:"tx_data"` - // Native value (in wei) to be fronted at runtime with the transaction. + // Bridge gas (in wei) to be fronted at runtime with the transaction. // Used for bridge fees (e.g., LayerZero messaging fees) that require msg.value. - NativeValue *prototyp.BigInt `json:"nativeValue" db:"native_value"` + BridgeGas *prototyp.BigInt `json:"bridgeGas" db:"bridge_gas"` } // TODO: review @@ -489,9 +492,9 @@ type MetaTxnLog struct { MinedAt *time.Time `json:"minedAt" db:"mined_at,omitempty"` Target prototyp.Hash `json:"target" db:"target"` Input prototyp.Hash `json:"input" db:"input"` - // Native value (in wei) to be fronted at runtime with the transaction. + // Bridge gas (in wei) to be fronted at runtime with the transaction. // Used for bridge fees (e.g., LayerZero messaging fees) that require msg.value. - NativeValue *prototyp.BigInt `json:"nativeValue" db:"native_value"` + BridgeGas *prototyp.BigInt `json:"bridgeGas" db:"bridge_gas"` // TODO: review this field.. we may not want it.. what goes in here..? is it just // the input/target from MetaTxn above? we already have these as separate columns.. TxnArgs map[string]interface{} `json:"txnArgs" db:"txn_args"` @@ -643,18 +646,19 @@ const RelayerPathPrefix = "/rpc/Relayer/" type relayerClient struct { client HTTPClient - urls [33]string + urls [34]string } func NewRelayerClient(addr string, client HTTPClient) RelayerClient { prefix := urlBase(addr) + RelayerPathPrefix - urls := [33]string{ + urls := [34]string{ prefix + "Ping", prefix + "Version", prefix + "RuntimeStatus", prefix + "GetSequenceContext", prefix + "GetChainID", prefix + "SendMetaTxn", + prefix + "SendMetaTxnWithBridgeGas", prefix + "GetMetaTxnNonce", prefix + "GetMetaTxnReceipt", prefix + "Simulate", @@ -792,6 +796,30 @@ func (c *relayerClient) SendMetaTxn(ctx context.Context, call *MetaTxn, quote *s return out.Ret0, out.Ret1, err } +func (c *relayerClient) SendMetaTxnWithBridgeGas(ctx context.Context, call *MetaTxn, bridgeGas string, quote *string, projectID *uint64, preconditions []*TransactionPrecondition) (bool, string, error) { + in := struct { + Arg0 *MetaTxn `json:"call"` + Arg1 string `json:"bridgeGas"` + Arg2 *string `json:"quote"` + Arg3 *uint64 `json:"projectID"` + Arg4 []*TransactionPrecondition `json:"preconditions"` + }{call, bridgeGas, quote, projectID, preconditions} + out := struct { + Ret0 bool `json:"status"` + Ret1 string `json:"txnHash"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[6], 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) GetMetaTxnNonce(ctx context.Context, walletContractAddress string, space *string) (string, error) { in := struct { Arg0 string `json:"walletContractAddress"` @@ -801,7 +829,7 @@ func (c *relayerClient) GetMetaTxnNonce(ctx context.Context, walletContractAddre Ret0 string `json:"nonce"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[6], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[7], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -820,7 +848,7 @@ func (c *relayerClient) GetMetaTxnReceipt(ctx context.Context, metaTxID string) Ret0 *MetaTxnReceipt `json:"receipt"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[7], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[8], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -840,7 +868,7 @@ func (c *relayerClient) Simulate(ctx context.Context, wallet string, transaction Ret0 []*SimulateResult `json:"results"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[8], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[9], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -860,7 +888,7 @@ func (c *relayerClient) SimulateV3(ctx context.Context, wallet string, calls str Ret0 []*SimulateV3Result `json:"results"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[9], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[10], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -881,7 +909,7 @@ func (c *relayerClient) UpdateMetaTxnGasLimits(ctx context.Context, walletAddres Ret0 string `json:"payload"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[10], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[11], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -899,7 +927,7 @@ func (c *relayerClient) FeeTokens(ctx context.Context) (bool, []*FeeToken, strin Ret2 string `json:"paymentAddress"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[11], nil, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[12], nil, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -910,21 +938,21 @@ 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, nativeValue *string) ([]*FeeOption, bool, *string, error) { +func (c *relayerClient) FeeOptions(ctx context.Context, wallet string, to string, data string, simulate *bool, bridgeGas *string) ([]*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:"nativeValue"` - }{wallet, to, data, simulate, nativeValue} + Arg4 *string `json:"bridgeGas"` + }{wallet, to, data, simulate, bridgeGas} out := struct { Ret0 []*FeeOption `json:"options"` Ret1 bool `json:"sponsored"` Ret2 *string `json:"quote"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[12], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[13], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -944,7 +972,7 @@ func (c *relayerClient) GetMetaTxnNetworkFeeOptions(ctx context.Context, walletC Ret0 []*FeeOption `json:"options"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[13], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[14], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -965,7 +993,7 @@ func (c *relayerClient) GetMetaTransactions(ctx context.Context, projectId uint6 Ret1 []*MetaTxnLog `json:"transactions"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[14], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[15], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -986,7 +1014,7 @@ func (c *relayerClient) GetTransactionCost(ctx context.Context, projectId uint64 Ret0 float64 `json:"cost"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[15], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[16], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1007,7 +1035,7 @@ func (c *relayerClient) SentTransactions(ctx context.Context, filter *SentTransa Ret1 []*Transaction `json:"transactions"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[16], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[17], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1027,7 +1055,7 @@ func (c *relayerClient) PendingTransactions(ctx context.Context, page *Page) (*P Ret1 []*Transaction `json:"transactions"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[17], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[18], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1046,7 +1074,7 @@ func (c *relayerClient) GetGasTank(ctx context.Context, id uint64) (*GasTank, er Ret0 *GasTank `json:"gasTank"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[18], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[19], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1068,7 +1096,7 @@ func (c *relayerClient) AddGasTank(ctx context.Context, name string, feeMarkupFa Ret1 *GasTank `json:"gasTank"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[19], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[20], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1091,7 +1119,7 @@ func (c *relayerClient) UpdateGasTank(ctx context.Context, id uint64, name *stri Ret1 *GasTank `json:"gasTank"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[20], 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 { @@ -1110,7 +1138,7 @@ func (c *relayerClient) NextGasTankBalanceAdjustmentNonce(ctx context.Context, i Ret0 uint64 `json:"nonce"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[21], 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 { @@ -1132,7 +1160,7 @@ func (c *relayerClient) AdjustGasTankBalance(ctx context.Context, id uint64, non Ret1 *GasTankBalanceAdjustment `json:"adjustment"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[22], 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 { @@ -1152,7 +1180,7 @@ func (c *relayerClient) GetGasTankBalanceAdjustment(ctx context.Context, id uint Ret0 *GasTankBalanceAdjustment `json:"adjustment"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[23], 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 { @@ -1173,7 +1201,7 @@ func (c *relayerClient) ListGasTankBalanceAdjustments(ctx context.Context, id ui Ret1 []*GasTankBalanceAdjustment `json:"adjustments"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[24], 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 { @@ -1194,7 +1222,7 @@ func (c *relayerClient) ListGasSponsors(ctx context.Context, projectId uint64, p Ret1 []*GasSponsor `json:"gasSponsors"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[25], 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 { @@ -1214,7 +1242,7 @@ func (c *relayerClient) GetGasSponsor(ctx context.Context, projectId uint64, id Ret0 *GasSponsor `json:"gasSponsor"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[26], 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 { @@ -1237,7 +1265,7 @@ func (c *relayerClient) AddGasSponsor(ctx context.Context, projectId uint64, add Ret1 *GasSponsor `json:"gasSponsor"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[27], 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 { @@ -1260,7 +1288,7 @@ func (c *relayerClient) UpdateGasSponsor(ctx context.Context, projectId uint64, Ret1 *GasSponsor `json:"gasSponsor"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[28], 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 { @@ -1280,7 +1308,7 @@ func (c *relayerClient) RemoveGasSponsor(ctx context.Context, projectId uint64, Ret0 bool `json:"status"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[29], 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 { @@ -1301,7 +1329,7 @@ func (c *relayerClient) AddressGasSponsors(ctx context.Context, address string, Ret1 []*GasSponsor `json:"gasSponsors"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[30], 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 { @@ -1320,7 +1348,7 @@ func (c *relayerClient) GetProjectBalance(ctx context.Context, projectId uint64) Ret0 float64 `json:"balance"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[31], 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 { @@ -1341,7 +1369,7 @@ func (c *relayerClient) AdjustProjectBalance(ctx context.Context, projectId uint Ret0 float64 `json:"balance"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[32], 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 { From 6699da64ec2781ef4ef27c71a322dc65e6290a94 Mon Sep 17 00:00:00 2001 From: Shun Kakinoki Date: Fri, 20 Feb 2026 22:06:30 +0900 Subject: [PATCH 5/5] chore(relayer): sync bridge-gas client structs with relayer --- lib/mock/relayer.mock.go | 33 +++-- relayer/proto/relayer.gen.go | 225 +++++++++++++++++------------------ relayer/relayer.go | 1 - 3 files changed, 136 insertions(+), 123 deletions(-) diff --git a/lib/mock/relayer.mock.go b/lib/mock/relayer.mock.go index 2bcf745d0..4a5452786 100644 --- a/lib/mock/relayer.mock.go +++ b/lib/mock/relayer.mock.go @@ -122,9 +122,9 @@ func (mr *RelayerMockRecorder) AdjustProjectBalance(ctx, projectId, amount, iden } // FeeOptions mocks base method. -func (m *Relayer) FeeOptions(ctx context.Context, wallet, to, data string, simulate *bool, bridgeGas *string) ([]*proto.FeeOption, bool, *string, error) { +func (m *Relayer) FeeOptions(ctx context.Context, wallet, to, data string, simulate *bool) ([]*proto.FeeOption, bool, *string, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "FeeOptions", ctx, wallet, to, data, simulate, bridgeGas) + ret := m.ctrl.Call(m, "FeeOptions", ctx, wallet, to, data, simulate) ret0, _ := ret[0].([]*proto.FeeOption) ret1, _ := ret[1].(bool) ret2, _ := ret[2].(*string) @@ -133,9 +133,26 @@ func (m *Relayer) FeeOptions(ctx context.Context, wallet, to, data string, simul } // FeeOptions indicates an expected call of FeeOptions. -func (mr *RelayerMockRecorder) FeeOptions(ctx, wallet, to, data, simulate, bridgeGas any) *gomock.Call { +func (mr *RelayerMockRecorder) FeeOptions(ctx, wallet, to, data, simulate any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FeeOptions", reflect.TypeOf((*Relayer)(nil).FeeOptions), ctx, wallet, to, data, simulate, bridgeGas) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FeeOptions", reflect.TypeOf((*Relayer)(nil).FeeOptions), ctx, wallet, to, data, simulate) +} + +// FeeOptionsWithBridgeGas mocks base method. +func (m *Relayer) FeeOptionsWithBridgeGas(ctx context.Context, wallet, to, data string, simulate *bool, bridgeGas string) ([]*proto.FeeOption, bool, *string, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "FeeOptionsWithBridgeGas", ctx, wallet, to, data, simulate, bridgeGas) + ret0, _ := ret[0].([]*proto.FeeOption) + ret1, _ := ret[1].(bool) + ret2, _ := ret[2].(*string) + ret3, _ := ret[3].(error) + return ret0, ret1, ret2, ret3 +} + +// FeeOptionsWithBridgeGas indicates an expected call of FeeOptionsWithBridgeGas. +func (mr *RelayerMockRecorder) FeeOptionsWithBridgeGas(ctx, wallet, to, data, simulate, bridgeGas any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FeeOptionsWithBridgeGas", reflect.TypeOf((*Relayer)(nil).FeeOptionsWithBridgeGas), ctx, wallet, to, data, simulate, bridgeGas) } // FeeTokens mocks base method. @@ -446,9 +463,9 @@ func (mr *RelayerMockRecorder) SendMetaTxn(ctx, call, quote, projectID, precondi } // SendMetaTxnWithBridgeGas mocks base method. -func (m *Relayer) SendMetaTxnWithBridgeGas(ctx context.Context, call *proto.MetaTxn, bridgeGas string, quote *string, projectID *uint64, preconditions []*proto.TransactionPrecondition) (bool, string, error) { +func (m *Relayer) SendMetaTxnWithBridgeGas(ctx context.Context, call *proto.MetaTxn, quote *string, projectID *uint64, bridgeGas string, preconditions []*proto.TransactionPrecondition) (bool, string, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SendMetaTxnWithBridgeGas", ctx, call, bridgeGas, quote, projectID, preconditions) + ret := m.ctrl.Call(m, "SendMetaTxnWithBridgeGas", ctx, call, quote, projectID, bridgeGas, preconditions) ret0, _ := ret[0].(bool) ret1, _ := ret[1].(string) ret2, _ := ret[2].(error) @@ -456,9 +473,9 @@ func (m *Relayer) SendMetaTxnWithBridgeGas(ctx context.Context, call *proto.Meta } // SendMetaTxnWithBridgeGas indicates an expected call of SendMetaTxnWithBridgeGas. -func (mr *RelayerMockRecorder) SendMetaTxnWithBridgeGas(ctx, call, bridgeGas, quote, projectID, preconditions any) *gomock.Call { +func (mr *RelayerMockRecorder) SendMetaTxnWithBridgeGas(ctx, call, quote, projectID, bridgeGas, preconditions any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMetaTxnWithBridgeGas", reflect.TypeOf((*Relayer)(nil).SendMetaTxnWithBridgeGas), ctx, call, bridgeGas, quote, projectID, preconditions) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMetaTxnWithBridgeGas", reflect.TypeOf((*Relayer)(nil).SendMetaTxnWithBridgeGas), ctx, call, quote, projectID, bridgeGas, preconditions) } // SentTransactions mocks base method. diff --git a/relayer/proto/relayer.gen.go b/relayer/proto/relayer.gen.go index e5b4d827a..258d0ec98 100644 --- a/relayer/proto/relayer.gen.go +++ b/relayer/proto/relayer.gen.go @@ -1,4 +1,4 @@ -// sequence-relayer v0.4.1 a868298438a2fab314581c4ba7e21b0dcca1db60 +// sequence-relayer v0.4.1 85b179936a987ac6427a2973fb5f872df47ca89d // -- // Code generated by webrpc-gen@v0.31.2 with golang generator. DO NOT EDIT. // @@ -35,7 +35,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "a868298438a2fab314581c4ba7e21b0dcca1db60" + return "85b179936a987ac6427a2973fb5f872df47ca89d" } // @@ -55,9 +55,6 @@ type RelayerClient interface { // Project ID is only used by service and admin calls. Other clients must have projectID passed via the context // TODO: rename return txnHash: string to metaTxnID: string SendMetaTxn(ctx context.Context, call *MetaTxn, quote *string, projectID *uint64, preconditions []*TransactionPrecondition) (bool, string, error) - // Internal endpoint for service-to-service calls that require bridge gas fronting - // Used by Trails/Excalibur for LayerZero OFT bridge transactions - SendMetaTxnWithBridgeGas(ctx context.Context, call *MetaTxn, bridgeGas string, quote *string, projectID *uint64, preconditions []*TransactionPrecondition) (bool, string, error) GetMetaTxnNonce(ctx context.Context, walletContractAddress string, space *string) (string, error) // TODO: one day, make GetMetaTxnReceipt respond immediately with receipt or not // and add WaitTransactionReceipt method, which will block and wait, similar to how GetMetaTxnReceipt @@ -71,9 +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) + // Bridge gas endpoints for S2S calls // Used for bridge fees (e.g., LayerZero messaging fees) that require msg.value to be fronted at runtime. - // This value will be included in the fee calculation so the relayer gets reimbursed. - FeeOptions(ctx context.Context, wallet string, to string, data string, simulate *bool, bridgeGas *string) ([]*FeeOption, bool, *string, error) + // 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) // 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) GetMetaTransactions(ctx context.Context, projectId uint64, page *Page) (*Page, []*MetaTxnLog, error) @@ -333,37 +333,23 @@ func (x *FeeTokenType) Is(values ...FeeTokenType) bool { return false } -type SortOrder uint32 +type Order string const ( - SortOrder_DESC SortOrder = 0 - SortOrder_ASC SortOrder = 1 + Order_DESC Order = "DESC" + Order_ASC Order = "ASC" ) -var SortOrder_name = map[uint32]string{ - 0: "DESC", - 1: "ASC", +func (x Order) MarshalText() ([]byte, error) { + return []byte(x), nil } -var SortOrder_value = map[string]uint32{ - "DESC": 0, - "ASC": 1, -} - -func (x SortOrder) String() string { - return SortOrder_name[uint32(x)] -} - -func (x SortOrder) MarshalText() ([]byte, error) { - return []byte(SortOrder_name[uint32(x)]), nil -} - -func (x *SortOrder) UnmarshalText(b []byte) error { - *x = SortOrder(SortOrder_value[string(b)]) +func (x *Order) UnmarshalText(b []byte) error { + *x = Order(string(b)) return nil } -func (x *SortOrder) Is(values ...SortOrder) bool { +func (x *Order) Is(values ...Order) bool { if x == nil { return false } @@ -459,17 +445,13 @@ type GasSponsorUsage struct { EndTime *time.Time `json:"endTime"` } -// TODO: rename this to MetaTxnRaw (eventually), we can leave it for now to not break compat -// or name it, MetaTxnArgs ..? +// TODO: rename fields eventually (contract -> to, input -> execdata), rename struct to MetaTxnRaw type MetaTxn struct { WalletAddress string `json:"walletAddress" db:"wallet_address"` // 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"` - // Bridge gas (in wei) to be fronted at runtime with the transaction. - // Used for bridge fees (e.g., LayerZero messaging fees) that require msg.value. - BridgeGas *prototyp.BigInt `json:"bridgeGas" db:"bridge_gas"` } // TODO: review @@ -616,26 +598,16 @@ type FeeToken struct { // Page represents a results page. This can be used both to request a page and // to store the state of a page. type Page struct { - // Common for both numbered pages and cursor: Number of items per page - PageSize *uint32 `json:"pageSize"` - // Numbered pages: Page number, this is multiplied by the value of the parameter. - Page *uint32 `json:"page"` - More *bool `json:"more"` - // Number of total items on this query. - TotalRecords *uint64 `json:"total_records,omitempty"` - // Cursor: column to compare before/after to - Column *string `json:"column,omitempty"` - // Cursor: return column < before - include to get previous page - Before *interface{} `json:"before,omitempty"` - // Cursor: return column > after - include to get next page - After *interface{} `json:"after,omitempty"` - // Sorting filter - Sort []*SortBy `json:"sort,omitempty"` -} - -type SortBy struct { - Column string `json:"column"` - Order SortOrder `json:"order"` + PageSize uint32 `json:"pageSize"` + Page uint32 `json:"page"` + More bool `json:"more"` + Column string `json:"column"` + Sort []*Sort `json:"sort"` +} + +type Sort struct { + Column string `json:"column"` + Order Order `json:"order"` } // @@ -646,19 +618,18 @@ const RelayerPathPrefix = "/rpc/Relayer/" type relayerClient struct { client HTTPClient - urls [34]string + urls [35]string } func NewRelayerClient(addr string, client HTTPClient) RelayerClient { prefix := urlBase(addr) + RelayerPathPrefix - urls := [34]string{ + urls := [35]string{ prefix + "Ping", prefix + "Version", prefix + "RuntimeStatus", prefix + "GetSequenceContext", prefix + "GetChainID", prefix + "SendMetaTxn", - prefix + "SendMetaTxnWithBridgeGas", prefix + "GetMetaTxnNonce", prefix + "GetMetaTxnReceipt", prefix + "Simulate", @@ -666,6 +637,8 @@ func NewRelayerClient(addr string, client HTTPClient) RelayerClient { prefix + "UpdateMetaTxnGasLimits", prefix + "FeeTokens", prefix + "FeeOptions", + prefix + "SendMetaTxnWithBridgeGas", + prefix + "FeeOptionsWithBridgeGas", prefix + "GetMetaTxnNetworkFeeOptions", prefix + "GetMetaTransactions", prefix + "GetTransactionCost", @@ -796,30 +769,6 @@ func (c *relayerClient) SendMetaTxn(ctx context.Context, call *MetaTxn, quote *s return out.Ret0, out.Ret1, err } -func (c *relayerClient) SendMetaTxnWithBridgeGas(ctx context.Context, call *MetaTxn, bridgeGas string, quote *string, projectID *uint64, preconditions []*TransactionPrecondition) (bool, string, error) { - in := struct { - Arg0 *MetaTxn `json:"call"` - Arg1 string `json:"bridgeGas"` - Arg2 *string `json:"quote"` - Arg3 *uint64 `json:"projectID"` - Arg4 []*TransactionPrecondition `json:"preconditions"` - }{call, bridgeGas, quote, projectID, preconditions} - out := struct { - Ret0 bool `json:"status"` - Ret1 string `json:"txnHash"` - }{} - - resp, err := doHTTPRequest(ctx, c.client, c.urls[6], 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) GetMetaTxnNonce(ctx context.Context, walletContractAddress string, space *string) (string, error) { in := struct { Arg0 string `json:"walletContractAddress"` @@ -829,7 +778,7 @@ func (c *relayerClient) GetMetaTxnNonce(ctx context.Context, walletContractAddre Ret0 string `json:"nonce"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[7], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[6], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -848,7 +797,7 @@ func (c *relayerClient) GetMetaTxnReceipt(ctx context.Context, metaTxID string) Ret0 *MetaTxnReceipt `json:"receipt"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[8], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[7], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -868,7 +817,7 @@ func (c *relayerClient) Simulate(ctx context.Context, wallet string, transaction Ret0 []*SimulateResult `json:"results"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[9], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[8], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -888,7 +837,7 @@ func (c *relayerClient) SimulateV3(ctx context.Context, wallet string, calls str Ret0 []*SimulateV3Result `json:"results"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[10], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[9], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -909,7 +858,7 @@ func (c *relayerClient) UpdateMetaTxnGasLimits(ctx context.Context, walletAddres Ret0 string `json:"payload"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[11], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[10], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -927,7 +876,7 @@ func (c *relayerClient) FeeTokens(ctx context.Context) (bool, []*FeeToken, strin Ret2 string `json:"paymentAddress"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[12], nil, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[11], nil, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -938,20 +887,43 @@ 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, bridgeGas *string) ([]*FeeOption, bool, *string, error) { +func (c *relayerClient) FeeOptions(ctx context.Context, wallet string, to string, data string, simulate *bool) ([]*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"` + }{wallet, to, data, simulate} out := struct { Ret0 []*FeeOption `json:"options"` Ret1 bool `json:"sponsored"` Ret2 *string `json:"quote"` }{} + resp, err := doHTTPRequest(ctx, c.client, c.urls[12], 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, out.Ret2, err +} + +func (c *relayerClient) SendMetaTxnWithBridgeGas(ctx context.Context, call *MetaTxn, quote *string, projectID *uint64, bridgeGas string, preconditions []*TransactionPrecondition) (bool, string, error) { + in := struct { + Arg0 *MetaTxn `json:"call"` + Arg1 *string `json:"quote"` + Arg2 *uint64 `json:"projectID"` + Arg3 string `json:"bridgeGas"` + Arg4 []*TransactionPrecondition `json:"preconditions"` + }{call, quote, projectID, bridgeGas, preconditions} + out := struct { + Ret0 bool `json:"status"` + Ret1 string `json:"txnHash"` + }{} + resp, err := doHTTPRequest(ctx, c.client, c.urls[13], in, &out) if resp != nil { cerr := resp.Body.Close() @@ -960,6 +932,31 @@ func (c *relayerClient) FeeOptions(ctx context.Context, wallet string, to string } } + 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) { + 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} + out := struct { + Ret0 []*FeeOption `json:"options"` + Ret1 bool `json:"sponsored"` + Ret2 *string `json:"quote"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[14], 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, out.Ret2, err } @@ -972,7 +969,7 @@ func (c *relayerClient) GetMetaTxnNetworkFeeOptions(ctx context.Context, walletC Ret0 []*FeeOption `json:"options"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[14], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[15], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -993,7 +990,7 @@ func (c *relayerClient) GetMetaTransactions(ctx context.Context, projectId uint6 Ret1 []*MetaTxnLog `json:"transactions"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[15], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[16], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1014,7 +1011,7 @@ func (c *relayerClient) GetTransactionCost(ctx context.Context, projectId uint64 Ret0 float64 `json:"cost"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[16], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[17], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1035,7 +1032,7 @@ func (c *relayerClient) SentTransactions(ctx context.Context, filter *SentTransa Ret1 []*Transaction `json:"transactions"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[17], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[18], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1055,7 +1052,7 @@ func (c *relayerClient) PendingTransactions(ctx context.Context, page *Page) (*P Ret1 []*Transaction `json:"transactions"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[18], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[19], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1074,7 +1071,7 @@ func (c *relayerClient) GetGasTank(ctx context.Context, id uint64) (*GasTank, er Ret0 *GasTank `json:"gasTank"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[19], in, &out) + resp, err := doHTTPRequest(ctx, c.client, c.urls[20], in, &out) if resp != nil { cerr := resp.Body.Close() if err == nil && cerr != nil { @@ -1096,7 +1093,7 @@ func (c *relayerClient) AddGasTank(ctx context.Context, name string, feeMarkupFa Ret1 *GasTank `json:"gasTank"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[20], 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 { @@ -1119,7 +1116,7 @@ func (c *relayerClient) UpdateGasTank(ctx context.Context, id uint64, name *stri Ret1 *GasTank `json:"gasTank"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[21], 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 { @@ -1138,7 +1135,7 @@ func (c *relayerClient) NextGasTankBalanceAdjustmentNonce(ctx context.Context, i Ret0 uint64 `json:"nonce"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[22], 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 { @@ -1160,7 +1157,7 @@ func (c *relayerClient) AdjustGasTankBalance(ctx context.Context, id uint64, non Ret1 *GasTankBalanceAdjustment `json:"adjustment"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[23], 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 { @@ -1180,7 +1177,7 @@ func (c *relayerClient) GetGasTankBalanceAdjustment(ctx context.Context, id uint Ret0 *GasTankBalanceAdjustment `json:"adjustment"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[24], 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 { @@ -1201,7 +1198,7 @@ func (c *relayerClient) ListGasTankBalanceAdjustments(ctx context.Context, id ui Ret1 []*GasTankBalanceAdjustment `json:"adjustments"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[25], 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 { @@ -1222,7 +1219,7 @@ func (c *relayerClient) ListGasSponsors(ctx context.Context, projectId uint64, p Ret1 []*GasSponsor `json:"gasSponsors"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[26], 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 { @@ -1242,7 +1239,7 @@ func (c *relayerClient) GetGasSponsor(ctx context.Context, projectId uint64, id Ret0 *GasSponsor `json:"gasSponsor"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[27], 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 { @@ -1265,7 +1262,7 @@ func (c *relayerClient) AddGasSponsor(ctx context.Context, projectId uint64, add Ret1 *GasSponsor `json:"gasSponsor"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[28], 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 { @@ -1288,7 +1285,7 @@ func (c *relayerClient) UpdateGasSponsor(ctx context.Context, projectId uint64, Ret1 *GasSponsor `json:"gasSponsor"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[29], 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 { @@ -1308,7 +1305,7 @@ func (c *relayerClient) RemoveGasSponsor(ctx context.Context, projectId uint64, Ret0 bool `json:"status"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[30], 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 { @@ -1329,7 +1326,7 @@ func (c *relayerClient) AddressGasSponsors(ctx context.Context, address string, Ret1 []*GasSponsor `json:"gasSponsors"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[31], 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 { @@ -1348,7 +1345,7 @@ func (c *relayerClient) GetProjectBalance(ctx context.Context, projectId uint64) Ret0 float64 `json:"balance"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[32], 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 { @@ -1369,7 +1366,7 @@ func (c *relayerClient) AdjustProjectBalance(ctx context.Context, projectId uint Ret0 float64 `json:"balance"` }{} - resp, err := doHTTPRequest(ctx, c.client, c.urls[33], 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 { diff --git a/relayer/relayer.go b/relayer/relayer.go index 4e9030708..723b88322 100644 --- a/relayer/relayer.go +++ b/relayer/relayer.go @@ -283,7 +283,6 @@ func (r *Client) FeeOptions(ctx context.Context, signedTxs *sequence.SignedTrans signedTxs.WalletAddress.String(), "0x"+common.Bytes2Hex(data), nil, - nil, ) if err != nil { return nil, nil, err