Skip to content

Commit

Permalink
chore: fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
EnoRage committed May 14, 2024
1 parent e927576 commit 8288086
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 68 deletions.
25 changes: 3 additions & 22 deletions codegen/openapi/traces-openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@
"example": "0x3e48f"
},
"gasUsed": {
"type": "string",
"type": "number",
"example": "0x5da9"
},
"input": {
Expand Down Expand Up @@ -358,25 +358,6 @@
"CoreBuiltinTransactionRootSuccessTraceDto": {
"type": "object",
"properties": {
"chainId": {
"type": "number",
"example": 1,
"enum": [
1,
45,
137,
10,
56,
42161,
43114,
100,
250,
1313161554,
8217,
324,
8453
]
},
"type": {
"type": "string",
"enum": [
Expand Down Expand Up @@ -410,7 +391,7 @@
"example": "0x3e48f"
},
"gasUsed": {
"type": "string",
"type": "number",
"example": "0x5da9"
},
"input": {
Expand Down Expand Up @@ -506,7 +487,7 @@
"type": "string",
"example": "v1.2.3"
},
"number": {
"blockNumber": {
"type": "number",
"example": "16123123"
},
Expand Down
8 changes: 4 additions & 4 deletions sdk-clients/traces/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (api *api) GetBlockTraceByNumber(ctx context.Context, param GetBlockTraceBy
}

// GetTxTraceByNumberAndHash Get transaction trace by block number and transaction hash
func (api *api) GetTxTraceByNumberAndHash(ctx context.Context, param GetTxTraceByNumberAndHashParams) (*PlainTransactionTraceWithTypeDto, error) {
func (api *api) GetTxTraceByNumberAndHash(ctx context.Context, param GetTxTraceByNumberAndHashParams) (*TransactionTraceResponse, error) {
u := fmt.Sprintf("traces/v1.0/chain/%d/block-trace/%d/tx-hash/%s", api.chainId, param.BlockNumber, param.TransactionHash)

payload := common.RequestPayload{
Expand All @@ -58,7 +58,7 @@ func (api *api) GetTxTraceByNumberAndHash(ctx context.Context, param GetTxTraceB
Body: nil,
}

var response PlainTransactionTraceWithTypeDto
var response TransactionTraceResponse
err := api.httpExecutor.ExecuteRequest(ctx, payload, &response)
if err != nil {
return nil, err
Expand All @@ -68,7 +68,7 @@ func (api *api) GetTxTraceByNumberAndHash(ctx context.Context, param GetTxTraceB
}

// GetTxTraceByNumberAndOffset Get transaction trace by block number and offset of transaction in block
func (api *api) GetTxTraceByNumberAndOffset(ctx context.Context, param GetTxTraceByNumberAndOffsetParams) (*PlainTransactionTraceWithTypeDto, error) {
func (api *api) GetTxTraceByNumberAndOffset(ctx context.Context, param GetTxTraceByNumberAndOffsetParams) (*TransactionTraceResponse, error) {
u := fmt.Sprintf("traces/v1.0/chain/%d/block-trace/%d/offset/%d", api.chainId, param.BlockNumber, param.Offset)

payload := common.RequestPayload{
Expand All @@ -78,7 +78,7 @@ func (api *api) GetTxTraceByNumberAndOffset(ctx context.Context, param GetTxTrac
Body: nil,
}

var response PlainTransactionTraceWithTypeDto
var response TransactionTraceResponse
err := api.httpExecutor.ExecuteRequest(ctx, payload, &response)
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion sdk-clients/traces/examples/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func main() {
fmt.Println("GetSyncedInterval:", interval)
time.Sleep(time.Second)

blockTrace, err := client.GetBlockTraceByNumber(ctx, traces.GetBlockTraceByNumberParam(17378177))
blockTrace, err := client.GetBlockTraceByNumber(ctx, traces.GetBlockTraceByNumberParam(17378176))
if err != nil {
fmt.Println("failed to GetBlockTraceByNumber: %w", err)
return
Expand Down
61 changes: 20 additions & 41 deletions sdk-clients/traces/traces_types.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

61 changes: 61 additions & 0 deletions sdk-clients/traces/traces_types_extended.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,64 @@ type GetTxTraceByNumberAndOffsetParams struct {
BlockNumber int `json:"blockNumber" uri:"blockNumber"`
Offset int `json:"offset" uri:"offset"`
}

type TransactionTraceResponse struct {
TransactionTrace TransactionTrace `json:"transactionTrace"`
Type string `json:"type"`
}

type TransactionTrace struct {
TxHash string `json:"txHash"`
Nonce string `json:"nonce"`
GasPrice string `json:"gasPrice"`
Type string `json:"type"`
From string `json:"from"`
To string `json:"to"`
GasLimit int `json:"gasLimit"`
GasActual int `json:"gasActual"`
GasHex string `json:"gasHex"`
GasUsed int `json:"gasUsed"`
IntrinsicGas int `json:"intrinsicGas"`
GasRefund int `json:"gasRefund"`
Input string `json:"input"`
Calls []Call `json:"calls"`
Logs []Log `json:"logs"`
Status string `json:"status"`
Storage []StorageItem `json:"storage"`
Value string `json:"value"`
MaxFeePerGas string `json:"maxFeePerGas"`
MaxPriorityFeePerGas string `json:"maxPriorityFeePerGas"`
Depth int `json:"depth"`
}

type Call struct {
Type string `json:"type"`
From string `json:"from"`
To string `json:"to"`
GasLimit int `json:"gasLimit"`
GasUsed int `json:"gasUsed"`
PrevGasLimit int `json:"prevGasLimit"`
Gas string `json:"gas"`
GasCost int `json:"gasCost"`
Input string `json:"input"`
Calls []Call `json:"calls"`
Logs []Log `json:"logs"`
Status string `json:"status"`
Storage []StorageItem `json:"storage"`
Success int `json:"success"`
Res string `json:"res"`
Depth int `json:"depth"`
Value string `json:"value"`
}

type Log struct {
Topics []string `json:"topics"`
Contract string `json:"contract"`
Data string `json:"data"`
}

type StorageItem struct {
Type string `json:"type"`
Key string `json:"key"`
Value string `json:"value"`
}

0 comments on commit 8288086

Please sign in to comment.