Skip to content

Commit

Permalink
fix rpc GenerateTx
Browse files Browse the repository at this point in the history
  • Loading branch information
wlawt committed Apr 25, 2024
1 parent 93c5b3b commit 4b07f8c
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions rpc/jsonrpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,18 @@ func (cli *JSONRPCClient) GenerateTransaction(
return nil, nil, 0, err
}

maxUnits, err := chain.EstimateMaxUnits(parser.Rules(time.Now().UnixMilli()), actions, authFactory)
if err != nil {
return nil, nil, 0, err
var totalUnits fees.Dimensions
for _, action := range actions {

Check failure on line 136 in rpc/jsonrpc_client.go

View workflow job for this annotation

GitHub Actions / hypersdk-lint

action declared and not used

Check failure on line 136 in rpc/jsonrpc_client.go

View workflow job for this annotation

GitHub Actions / hypersdk-lint

action declared and not used

Check failure on line 136 in rpc/jsonrpc_client.go

View workflow job for this annotation

GitHub Actions / hypersdk-lint

action declared and not used

Check failure on line 136 in rpc/jsonrpc_client.go

View workflow job for this annotation

GitHub Actions / hypersdk-lint

action declared and not used

Check failure on line 136 in rpc/jsonrpc_client.go

View workflow job for this annotation

GitHub Actions / hypersdk-unit-tests

action declared and not used

Check warning

Code scanning / CodeQL

Useless assignment to local variable Warning

This definition of action is never used.
maxUnits, err := chain.EstimateMaxUnits(parser.Rules(time.Now().UnixMilli()), actions, authFactory)

Check failure on line 137 in rpc/jsonrpc_client.go

View workflow job for this annotation

GitHub Actions / hypersdk-lint

cannot use actions (variable of type []chain.Action) as chain.Action value in argument to chain.EstimateMaxUnits: []chain.Action does not implement chain.Action (missing method Execute) (typecheck)

Check failure on line 137 in rpc/jsonrpc_client.go

View workflow job for this annotation

GitHub Actions / hypersdk-lint

cannot use actions (variable of type []chain.Action) as chain.Action value in argument to chain.EstimateMaxUnits: []chain.Action does not implement chain.Action (missing method Execute)) (typecheck)

Check failure on line 137 in rpc/jsonrpc_client.go

View workflow job for this annotation

GitHub Actions / hypersdk-lint

cannot use actions (variable of type []chain.Action) as chain.Action value in argument to chain.EstimateMaxUnits: []chain.Action does not implement chain.Action (missing method Execute)) (typecheck)

Check failure on line 137 in rpc/jsonrpc_client.go

View workflow job for this annotation

GitHub Actions / hypersdk-lint

cannot use actions (variable of type []chain.Action) as chain.Action value in argument to chain.EstimateMaxUnits: []chain.Action does not implement chain.Action (missing method Execute) (typecheck)

Check failure on line 137 in rpc/jsonrpc_client.go

View workflow job for this annotation

GitHub Actions / hypersdk-unit-tests

cannot use actions (variable of type []chain.Action) as chain.Action value in argument to chain.EstimateMaxUnits: []chain.Action does not implement chain.Action (missing method Execute)
if err != nil {
return nil, nil, 0, err
}
totalUnits, err = fees.Add(totalUnits, maxUnits)
if err != nil {
return nil, nil, 0, err
}
}
maxFee, err := fees.MulSum(unitPrices, maxUnits)
maxFee, err := fees.MulSum(unitPrices, totalUnits)
if err != nil {
return nil, nil, 0, err
}
Expand Down

0 comments on commit 4b07f8c

Please sign in to comment.