-
Notifications
You must be signed in to change notification settings - Fork 5
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 #73 from moonstream-to/fix-missing-utils
Add file.
- Loading branch information
Showing
2 changed files
with
117 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package common | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
|
||
"github.com/ethereum/go-ethereum/accounts/abi" | ||
) | ||
|
||
func GetABI(abistr string) (*abi.ABI, error) { | ||
// Retrieve or create AbiEntry | ||
// ... | ||
|
||
parsedABI, err := abi.JSON(strings.NewReader(abistr)) | ||
if err != nil { | ||
fmt.Println("string: ", abistr) | ||
fmt.Println("Error parsing ABI: ", err) | ||
return nil, err | ||
} | ||
|
||
return &parsedABI, nil | ||
|
||
} |
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,94 @@ | ||
package blockchain | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
) | ||
|
||
var BlockchainURLs map[string]string | ||
|
||
func CheckVariablesForBlockchains() error { | ||
|
||
MOONSTREAM_NODE_ETHEREUM_A_EXTERNAL_URI := os.Getenv("MOONSTREAM_NODE_ETHEREUM_A_EXTERNAL_URI") | ||
if MOONSTREAM_NODE_ETHEREUM_A_EXTERNAL_URI == "" { | ||
return fmt.Errorf("MOONSTREAM_NODE_ETHEREUM_A_EXTERNAL_URI environment variable is required") | ||
} | ||
MOONSTREAM_NODE_SEPOLIA_A_EXTERNAL_URI := os.Getenv("MOONSTREAM_NODE_SEPOLIA_A_EXTERNAL_URI") | ||
if MOONSTREAM_NODE_SEPOLIA_A_EXTERNAL_URI == "" { | ||
return fmt.Errorf("MOONSTREAM_NODE_SEPOLIA_A_EXTERNAL_URI environment variable is required") | ||
} | ||
MOONSTREAM_NODE_POLYGON_A_EXTERNAL_URI := os.Getenv("MOONSTREAM_NODE_POLYGON_A_EXTERNAL_URI") | ||
if MOONSTREAM_NODE_POLYGON_A_EXTERNAL_URI == "" { | ||
return fmt.Errorf("MOONSTREAM_NODE_POLYGON_A_EXTERNAL_URI environment variable is required") | ||
} | ||
MOONSTREAM_NODE_ARBITRUM_ONE_A_EXTERNAL_URI := os.Getenv("MOONSTREAM_NODE_ARBITRUM_ONE_A_EXTERNAL_URI") | ||
if MOONSTREAM_NODE_ARBITRUM_ONE_A_EXTERNAL_URI == "" { | ||
return fmt.Errorf("MOONSTREAM_NODE_ARBITRUM_ONE_A_EXTERNAL_URI environment variable is required") | ||
} | ||
MOONSTREAM_NODE_ARBITRUM_SEPOLIA_A_EXTERNAL_URI := os.Getenv("MOONSTREAM_NODE_ARBITRUM_SEPOLIA_A_EXTERNAL_URI") | ||
if MOONSTREAM_NODE_ARBITRUM_SEPOLIA_A_EXTERNAL_URI == "" { | ||
return fmt.Errorf("MOONSTREAM_NODE_ARBITRUM_SEPOLIA_A_EXTERNAL_URI environment variable is required") | ||
} | ||
MOONSTREAM_NODE_GAME7_ORBIT_ARBITRUM_SEPOLIA_A_EXTERNAL_URI := os.Getenv("MOONSTREAM_NODE_GAME7_ORBIT_ARBITRUM_SEPOLIA_A_EXTERNAL_URI") | ||
if MOONSTREAM_NODE_GAME7_ORBIT_ARBITRUM_SEPOLIA_A_EXTERNAL_URI == "" { | ||
return fmt.Errorf("MOONSTREAM_NODE_GAME7_ORBIT_ARBITRUM_SEPOLIA_A_EXTERNAL_URI environment variable is required") | ||
} | ||
MOONSTREAM_NODE_XAI_A_EXTERNAL_URI := os.Getenv("MOONSTREAM_NODE_XAI_A_EXTERNAL_URI") | ||
if MOONSTREAM_NODE_XAI_A_EXTERNAL_URI == "" { | ||
return fmt.Errorf("MOONSTREAM_NODE_XAI_A_EXTERNAL_URI environment variable is required") | ||
} | ||
MOONSTREAM_NODE_XAI_SEPOLIA_A_EXTERNAL_URI := os.Getenv("MOONSTREAM_NODE_XAI_SEPOLIA_A_EXTERNAL_URI") | ||
if MOONSTREAM_NODE_XAI_SEPOLIA_A_EXTERNAL_URI == "" { | ||
return fmt.Errorf("MOONSTREAM_NODE_XAI_SEPOLIA_A_EXTERNAL_URI environment variable is required") | ||
} | ||
MOONSTREAM_NODE_MANTLE_A_EXTERNAL_URI := os.Getenv("MOONSTREAM_NODE_MANTLE_A_EXTERNAL_URI") | ||
if MOONSTREAM_NODE_MANTLE_A_EXTERNAL_URI == "" { | ||
return fmt.Errorf("MOONSTREAM_NODE_MANTLE_A_EXTERNAL_URI environment variable is required") | ||
} | ||
MOONSTREAM_NODE_MANTLE_SEPOLIA_A_EXTERNAL_URI := os.Getenv("MOONSTREAM_NODE_MANTLE_SEPOLIA_A_EXTERNAL_URI") | ||
if MOONSTREAM_NODE_MANTLE_SEPOLIA_A_EXTERNAL_URI == "" { | ||
return fmt.Errorf("MOONSTREAM_NODE_MANTLE_SEPOLIA_A_EXTERNAL_URI environment variable is required") | ||
} | ||
MOONSTREAM_NODE_IMX_ZKEVM_A_EXTERNAL_URI := os.Getenv("MOONSTREAM_NODE_IMX_ZKEVM_A_EXTERNAL_URI") | ||
if MOONSTREAM_NODE_IMX_ZKEVM_A_EXTERNAL_URI == "" { | ||
return fmt.Errorf("MOONSTREAM_NODE_IMX_ZKEVM_A_EXTERNAL_URI environment variable is required") | ||
} | ||
MOONSTREAM_NODE_IMX_ZKEVM_SEPOLIA_A_EXTERNAL_URI := os.Getenv("MOONSTREAM_NODE_IMX_ZKEVM_SEPOLIA_A_EXTERNAL_URI") | ||
if MOONSTREAM_NODE_IMX_ZKEVM_SEPOLIA_A_EXTERNAL_URI == "" { | ||
return fmt.Errorf("MOONSTREAM_NODE_IMX_ZKEVM_SEPOLIA_A_EXTERNAL_URI environment variable is required") | ||
} | ||
MOONSTREAM_NODE_GAME7_TESTNET_A_EXTERNAL_URI := os.Getenv("MOONSTREAM_NODE_GAME7_TESTNET_A_EXTERNAL_URI") | ||
if MOONSTREAM_NODE_GAME7_TESTNET_A_EXTERNAL_URI == "" { | ||
return fmt.Errorf("MOONSTREAM_NODE_GAME7_TESTNET_A_EXTERNAL_URI environment variable is required") | ||
} | ||
|
||
MOONSTREAM_NODE_B3_A_EXTERNAL_URI := os.Getenv("MOONSTREAM_NODE_B3_A_EXTERNAL_URI") | ||
if MOONSTREAM_NODE_B3_A_EXTERNAL_URI == "" { | ||
return fmt.Errorf("MOONSTREAM_NODE_B3_A_EXTERNAL_URI environment variable is required") | ||
} | ||
|
||
MOONSTREAM_NODE_B3_SEPOLIA_A_EXTERNAL_URI := os.Getenv("MOONSTREAM_NODE_B3_SEPOLIA_A_EXTERNAL_URI") | ||
if MOONSTREAM_NODE_B3_SEPOLIA_A_EXTERNAL_URI == "" { | ||
return fmt.Errorf("MOONSTREAM_NODE_B3_SEPOLIA_A_EXTERNAL_URI environment variable is required") | ||
} | ||
|
||
BlockchainURLs = map[string]string{ | ||
"ethereum": MOONSTREAM_NODE_ETHEREUM_A_EXTERNAL_URI, | ||
"sepolia": MOONSTREAM_NODE_SEPOLIA_A_EXTERNAL_URI, | ||
"polygon": MOONSTREAM_NODE_POLYGON_A_EXTERNAL_URI, | ||
"arbitrum_one": MOONSTREAM_NODE_ARBITRUM_ONE_A_EXTERNAL_URI, | ||
"arbitrum_sepolia": MOONSTREAM_NODE_ARBITRUM_SEPOLIA_A_EXTERNAL_URI, | ||
"game7_orbit_arbitrum_sepolia": MOONSTREAM_NODE_GAME7_ORBIT_ARBITRUM_SEPOLIA_A_EXTERNAL_URI, | ||
"game7_testnet": MOONSTREAM_NODE_GAME7_TESTNET_A_EXTERNAL_URI, | ||
"xai": MOONSTREAM_NODE_XAI_A_EXTERNAL_URI, | ||
"xai_sepolia": MOONSTREAM_NODE_XAI_SEPOLIA_A_EXTERNAL_URI, | ||
"mantle": MOONSTREAM_NODE_MANTLE_A_EXTERNAL_URI, | ||
"mantle_sepolia": MOONSTREAM_NODE_MANTLE_SEPOLIA_A_EXTERNAL_URI, | ||
"imx_zkevm": MOONSTREAM_NODE_IMX_ZKEVM_A_EXTERNAL_URI, | ||
"imx_zkevm_sepolia": MOONSTREAM_NODE_IMX_ZKEVM_SEPOLIA_A_EXTERNAL_URI, | ||
"b3": MOONSTREAM_NODE_B3_A_EXTERNAL_URI, | ||
"b3_sepolia": MOONSTREAM_NODE_B3_SEPOLIA_A_EXTERNAL_URI, | ||
} | ||
|
||
return nil | ||
} |