Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion book/src/framework/components/blockchains/tron.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
```toml
[blockchain_a]
type = "tron"
# image = "tronbox/tre" is default image
# image = "tronbox/tre:1.0.3" is default image
```
Default port is `9090`

Expand Down
3 changes: 3 additions & 0 deletions framework/.changeset/v0.7.5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Add chain type to output
- Expose constants for types and families
- Pin tronbox/tre image, recent changes do not work on amd64
3 changes: 2 additions & 1 deletion framework/components/blockchain/aptos.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ func newAptos(in *Input) (*Output, error) {
}
return &Output{
UseCache: true,
Family: "aptos",
Type: in.Type,
Family: FamilyAptos,
ContainerName: containerName,
Nodes: []*Node{
{
Expand Down
38 changes: 30 additions & 8 deletions framework/components/blockchain/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,27 @@ import (
"github.com/smartcontractkit/chainlink-testing-framework/framework"
)

// Blockchain node type
const (
TypeAnvil = "anvil"
TypeAnvilZKSync = "anvil-zksync"
TypeGeth = "geth"
TypeBesu = "besu"
TypeSolana = "solana"
TypeAptos = "aptos"
TypeSui = "sui"
TypeTron = "tron"
)

// Blockchain node family
const (
FamilyEVM = "evm"
FamilySolana = "solana"
FamilyAptos = "aptos"
FamilySui = "sui"
FamilyTron = "tron"
)

// Input is a blockchain network configuration params
type Input struct {
// Common EVM fields
Expand Down Expand Up @@ -36,6 +57,7 @@ type Input struct {
// Output is a blockchain network output, ChainID and one or more nodes that forms the network
type Output struct {
UseCache bool `toml:"use_cache"`
Type string `toml:"type"`
Family string `toml:"family"`
ContainerName string `toml:"container_name"`
NetworkSpecificData *NetworkSpecificData `toml:"network_specific_data"`
Expand All @@ -61,21 +83,21 @@ func NewBlockchainNetwork(in *Input) (*Output, error) {
var out *Output
var err error
switch in.Type {
case "anvil":
case TypeAnvil:
out, err = newAnvil(in)
case "geth":
case TypeGeth:
out, err = newGeth(in)
case "besu":
case TypeBesu:
out, err = newBesu(in)
case "solana":
case TypeSolana:
out, err = newSolana(in)
case "aptos":
case TypeAptos:
out, err = newAptos(in)
case "sui":
case TypeSui:
out, err = newSui(in)
case "tron":
case TypeTron:
out, err = newTron(in)
case "anvil-zksync":
case TypeAnvilZKSync:
out, err = newAnvilZksync(in)
default:
return nil, fmt.Errorf("blockchain type is not supported or empty, must be 'anvil' or 'geth'")
Expand Down
3 changes: 2 additions & 1 deletion framework/components/blockchain/containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ func createGenericEvmContainer(in *Input, req testcontainers.ContainerRequest, u

output := Output{
UseCache: true,
Family: "evm",
Type: in.Type,
Family: FamilyEVM,
ChainID: in.ChainID,
ContainerName: containerName,
Container: c,
Expand Down
3 changes: 2 additions & 1 deletion framework/components/blockchain/solana.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ func newSolana(in *Input) (*Output, error) {

return &Output{
UseCache: true,
Family: "solana",
Type: in.Type,
Family: FamilySolana,
ContainerName: containerName,
Container: c,
Nodes: []*Node{
Expand Down
3 changes: 2 additions & 1 deletion framework/components/blockchain/sui.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ func newSui(in *Input) (*Output, error) {
}
return &Output{
UseCache: true,
Family: "sui",
Type: in.Type,
Family: FamilySui,
ContainerName: containerName,
NetworkSpecificData: &NetworkSpecificData{SuiAccount: suiAccount},
Nodes: []*Node{
Expand Down
3 changes: 2 additions & 1 deletion framework/components/blockchain/tron.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ func newTron(in *Input) (*Output, error) {
return &Output{
UseCache: true,
ChainID: in.ChainID,
Family: "tron",
Type: in.Type,
Family: FamilyTron,
ContainerName: containerName,
Nodes: []*Node{
{
Expand Down
2 changes: 1 addition & 1 deletion framework/examples/myproject/smoke_tron.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[blockchain_a]
type = "tron"
image = "tronbox/tre"
image = "tronbox/tre:1.0.3"
Loading