Skip to content

Commit

Permalink
Add actual fee
Browse files Browse the repository at this point in the history
  • Loading branch information
aopoltorzhicky committed Mar 7, 2024
1 parent 2c8edb3 commit 8fb2de9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/dipdup-io/starknet-indexer
go 1.21

require (
github.com/dipdup-io/starknet-go-api v0.0.0-20240130002112-e07f784ea34e
github.com/dipdup-io/starknet-go-api v0.0.0-20240307134453-42ca4ba88776
github.com/dipdup-io/workerpool v0.0.4
github.com/dipdup-net/go-lib v0.3.3
github.com/dipdup-net/indexer-sdk v0.0.4
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ github.com/dipdup-io/starknet-go-api v0.0.0-20240110155038-c97c6d82a0eb h1:IAJCA
github.com/dipdup-io/starknet-go-api v0.0.0-20240110155038-c97c6d82a0eb/go.mod h1:y3KGLFQtwzUBcT0X2LMj6CxocUimr/A9XYg+j0KIRDE=
github.com/dipdup-io/starknet-go-api v0.0.0-20240130002112-e07f784ea34e h1:oFFZ77W368tOQuCwReeB3PEpjkJeEGOciOgJFYp+1Y8=
github.com/dipdup-io/starknet-go-api v0.0.0-20240130002112-e07f784ea34e/go.mod h1:y3KGLFQtwzUBcT0X2LMj6CxocUimr/A9XYg+j0KIRDE=
github.com/dipdup-io/starknet-go-api v0.0.0-20240307134453-42ca4ba88776 h1:j7CcqHyilB750xiPtUO/HueGE7VtTzixRvLKp4ccPsY=
github.com/dipdup-io/starknet-go-api v0.0.0-20240307134453-42ca4ba88776/go.mod h1:y3KGLFQtwzUBcT0X2LMj6CxocUimr/A9XYg+j0KIRDE=
github.com/dipdup-io/workerpool v0.0.4 h1:m58fuFY3VIPRc+trWpjw2Lsm4FvIgtjP/4VRe79r+/s=
github.com/dipdup-io/workerpool v0.0.4/go.mod h1:m6YMqx7M+fORTyabHD/auKymBRpbDax0t1aPZ1i7GZA=
github.com/dipdup-net/go-lib v0.3.3 h1:vTUI+sT4L+x+eiMf712Cg8EtlqUCMiN6M3vcNaPlCw8=
Expand Down
12 changes: 6 additions & 6 deletions pkg/indexer/receiver/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func NewNode(cfg config.DataSource) *Node {
}

func (n *Node) GetBlock(ctx context.Context, blockId starknetData.BlockID) (block Block, err error) {
response, err := n.api.GetBlockWithTxs(ctx, blockId)
response, err := n.api.GetBlockWithReceipts(ctx, blockId)
if err != nil {
return
}
Expand All @@ -47,11 +47,11 @@ func (n *Node) GetBlock(ctx context.Context, blockId starknetData.BlockID) (bloc
block.Transactions = make([]Transaction, len(response.Result.Transactions))

for i := range response.Result.Transactions {
block.Transactions[i].Hash = response.Result.Transactions[i].TransactionHash
block.Transactions[i].Type = response.Result.Transactions[i].Type
block.Transactions[i].Version = response.Result.Transactions[i].Version
block.Transactions[i].Body = response.Result.Transactions[i].Body
// TODO: resolve actual fee | block.Transactions[i].ActualFee = ""
block.Transactions[i].Hash = response.Result.Transactions[i].Transaction.TransactionHash
block.Transactions[i].Type = response.Result.Transactions[i].Transaction.Type
block.Transactions[i].Version = response.Result.Transactions[i].Transaction.Version
block.Transactions[i].Body = response.Result.Transactions[i].Transaction.Body
block.Transactions[i].ActualFee = response.Result.Transactions[i].Receipt.ActualFee.Amount
}

return
Expand Down

0 comments on commit 8fb2de9

Please sign in to comment.