-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from m-Peter/eth-call-endpoint
Implement the `eth_call` JSON-RPC endpoint
- Loading branch information
Showing
13 changed files
with
1,017 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,10 @@ check-tidy: | |
go mod tidy | ||
git diff --exit-code | ||
|
||
.PHONY: generate | ||
generate: | ||
go get -d github.com/vektra/mockery/[email protected] | ||
mockery --name=FlowAccessClient --dir=api/mocksiface --structname=MockAccessClient --output=api/mocks | ||
|
||
.PHONY: ci | ||
ci: check-tidy test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// TODO(m-Peter): Use proper address for each network | ||
import EVM from 0xf8d6e0586b0a20c7 | ||
|
||
access(all) | ||
fun main(data: [UInt8], contractAddress: [UInt8; 20]): [UInt8] { | ||
// TODO(m-Peter): Pass Flow address of bridged account as script argument | ||
let account = getAuthAccount<auth(Storage) &Account>(Address(0xf8d6e0586b0a20c7)) | ||
let bridgedAccount = account.storage.borrow<&EVM.BridgedAccount>( | ||
from: /storage/evm | ||
) ?? panic("Could not borrow reference to the bridged account!") | ||
|
||
let evmResult = bridgedAccount.call( | ||
to: EVM.EVMAddress(bytes: contractAddress), | ||
data: data, | ||
gasLimit: 300000, // TODO(m-Peter): Maybe also pass this as script argument | ||
value: EVM.Balance(flow: 0.0) | ||
) | ||
|
||
return evmResult | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package api | ||
|
||
import ( | ||
"github.com/onflow/flow-go-sdk/access" | ||
"github.com/onflow/flow-go-sdk/access/grpc" | ||
) | ||
|
||
func NewFlowClient(host string) (access.Client, error) { | ||
client, err := grpc.NewClient(host) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return client, nil | ||
} |
Oops, something went wrong.