|
1 | 1 | package blockchain |
2 | 2 |
|
3 | 3 | import ( |
| 4 | + "context" |
4 | 5 | "fmt" |
5 | 6 |
|
6 | 7 | "github.com/testcontainers/testcontainers-go" |
@@ -93,29 +94,34 @@ type Node struct { |
93 | 94 | InternalHTTPUrl string `toml:"internal_http_url"` |
94 | 95 | } |
95 | 96 |
|
96 | | -// NewBlockchainNetwork this is an abstraction that can spin up various blockchain network simulators |
97 | 97 | func NewBlockchainNetwork(in *Input) (*Output, error) { |
| 98 | + // pass context to input if needed in the future |
| 99 | + return NewWithContext(context.Background(), in) |
| 100 | +} |
| 101 | + |
| 102 | +// NewBlockchainNetwork this is an abstraction that can spin up various blockchain network simulators |
| 103 | +func NewWithContext(ctx context.Context, in *Input) (*Output, error) { |
98 | 104 | var out *Output |
99 | 105 | var err error |
100 | 106 | switch in.Type { |
101 | 107 | case TypeAnvil: |
102 | | - out, err = newAnvil(in) |
| 108 | + out, err = newAnvil(ctx, in) |
103 | 109 | case TypeGeth: |
104 | | - out, err = newGeth(in) |
| 110 | + out, err = newGeth(ctx, in) |
105 | 111 | case TypeBesu: |
106 | | - out, err = newBesu(in) |
| 112 | + out, err = newBesu(ctx, in) |
107 | 113 | case TypeSolana: |
108 | | - out, err = newSolana(in) |
| 114 | + out, err = newSolana(ctx, in) |
109 | 115 | case TypeAptos: |
110 | | - out, err = newAptos(in) |
| 116 | + out, err = newAptos(ctx, in) |
111 | 117 | case TypeSui: |
112 | | - out, err = newSui(in) |
| 118 | + out, err = newSui(ctx, in) |
113 | 119 | case TypeTron: |
114 | | - out, err = newTron(in) |
| 120 | + out, err = newTron(ctx, in) |
115 | 121 | case TypeAnvilZKSync: |
116 | | - out, err = newAnvilZksync(in) |
| 122 | + out, err = newAnvilZksync(ctx, in) |
117 | 123 | case TypeTon: |
118 | | - out, err = newTon(in) |
| 124 | + out, err = newTon(ctx, in) |
119 | 125 | default: |
120 | 126 | return nil, fmt.Errorf("blockchain type is not supported or empty, must be 'anvil' or 'geth'") |
121 | 127 | } |
|
0 commit comments