Skip to content

Commit dcc0d43

Browse files
committed
Update logs
1 parent 68f2260 commit dcc0d43

File tree

1 file changed

+57
-1
lines changed

1 file changed

+57
-1
lines changed

pkg/txm/clientwrappers/dualbroadcast/meta_client.go

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ type MetaClient struct {
136136

137137
func NewMetaClient(lggr logger.Logger, c MetaClientRPC, ks MetaClientKeystore, customURL *url.URL, chainID *big.Int) *MetaClient {
138138
return &MetaClient{
139-
lggr: logger.Sugared(logger.Named(lggr, "MetaClient")),
139+
lggr: logger.Sugared(logger.Named(lggr, "Txm.Txm.MetaClient")),
140140
c: c,
141141
ks: ks,
142142
customURL: customURL,
@@ -159,6 +159,7 @@ func (a *MetaClient) SendTransaction(ctx context.Context, tx *types.Transaction,
159159
}
160160

161161
if meta != nil && meta.DualBroadcast != nil && *meta.DualBroadcast && !tx.IsPurgeable && meta.DualBroadcastParams != nil && meta.FwdrDestAddress != nil {
162+
a.lggr.Info("Meta: ", *meta)
162163
meta, err := a.SendRequest(ctx, tx, attempt, *meta.DualBroadcastParams, tx.ToAddress)
163164
if err != nil {
164165
return fmt.Errorf("error sending request for transactionID(%d): %w", tx.ID, err)
@@ -172,6 +173,7 @@ func (a *MetaClient) SendTransaction(ctx context.Context, tx *types.Transaction,
172173
a.lggr.Info("No bids for transactionID(%d): ", tx.ID)
173174
return nil
174175
}
176+
a.lggr.Infow("Broadcasting attempt to public mempool", "tx", tx)
175177
return a.c.SendTransaction(ctx, attempt.SignedTransaction)
176178
}
177179

@@ -192,7 +194,55 @@ type RequestResponse struct {
192194
}
193195
}
194196

197+
type UORaw struct {
198+
From common.Address `json:"from"`
199+
To common.Address `json:"to"`
200+
Value *hexutil.Big `json:"value"`
201+
Gas *hexutil.Big `json:"gas"`
202+
MaxFeePerGas *hexutil.Big `json:"maxFeePerGas"`
203+
Nonce *hexutil.Big `json:"nonce"`
204+
Deadline *hexutil.Big `json:"deadline"`
205+
Dapp common.Address `json:"dapp"`
206+
Control common.Address `json:"control"`
207+
CallConfig *hexutil.Big `json:"callConfig"`
208+
DappGasLimit *hexutil.Big `json:"dappGasLimit,omitempty"`
209+
SessionKey common.Address `json:"sessionKey"`
210+
Data hexutil.Bytes `json:"data"`
211+
Signature hexutil.Bytes `json:"signature"`
212+
}
213+
214+
type SORaw struct {
215+
From common.Address `json:"from"`
216+
To common.Address `json:"to"`
217+
Value *hexutil.Big `json:"value"`
218+
Gas *hexutil.Big `json:"gas"`
219+
MaxFeePerGas *hexutil.Big `json:"maxFeePerGas"`
220+
Deadline *hexutil.Big `json:"deadline"`
221+
Solver common.Address `json:"solver"`
222+
Control common.Address `json:"control"`
223+
UserOpHash common.Hash `json:"userOpHash"`
224+
BidToken common.Address `json:"bidToken"`
225+
BidAmount *hexutil.Big `json:"bidAmount"`
226+
Data hexutil.Bytes `json:"data"`
227+
Signature hexutil.Bytes `json:"signature"`
228+
}
229+
230+
type DORaw struct {
231+
From common.Address `json:"from"`
232+
To common.Address `json:"to"`
233+
Nonce *hexutil.Big `json:"nonce"`
234+
Deadline *hexutil.Big `json:"deadline"`
235+
Control common.Address `json:"control"`
236+
Bundler common.Address `json:"bundler"`
237+
UserOpHash common.Hash `json:"userOpHash"`
238+
CallChainHash common.Hash `json:"callChainHash"`
239+
Signature hexutil.Bytes `json:"signature"`
240+
}
241+
195242
type ResponseResult struct {
243+
UO *UORaw `json:"userOperation"`
244+
SOS []*SORaw `json:"solverOperations"`
245+
DO *DORaw `json:"dAppOperation"`
196246
MetacalldataResponse
197247
}
198248

@@ -309,6 +359,12 @@ func (a *MetaClient) SendRequest(parentCtx context.Context, tx *types.Transactio
309359
return nil, nil
310360
}
311361

362+
r, err := json.MarshalIndent(response.Result, "", " ")
363+
if err != nil {
364+
return nil, err
365+
}
366+
a.lggr.Info("Response: ", string(r))
367+
312368
return VerifyResponse(response.Result.MetacalldataResponse, dualBroadcastParams, tx.Data, tx.FromAddress, fwdrDestAddress)
313369
}
314370

0 commit comments

Comments
 (0)