I am using IMX Golang SDK to build a K6 extension to interact with blockchain.
Reference: GitHub - immutable/imx-core-sdk-golang: The Immutable Core SDK Golang provides convenient access to the Immutable APIs and Ethereum contract methods for applications integrating with ImmutableX platform.
The SDK generates the L2 Stark key fine when executed independently. However it throws following error, when incorporated in a K6 extension.
INFO[0007] 2022/11/14 12:00:24 error in Generating Stark Private Key: open github.com\immutable\imx-core-sdk-golang@v0.2.2\imx\signers\stark/pedersen_params.json: The system cannot find the path specified.
ERRO[0007] panic: error in Generating Stark Private Key: open github.com\immutable\imx-core-sdk-golang@v0.2.2\imx\signers\stark/pedersen_params.json: The system cannot find the path specified.
The file path separator looks inconsistent to me, when working through extension. It is constructed in following file.
Relevant function which throws error:
func loadCurve() (*caigo.StarkCurve, error) {
dir, err := currentDirname()
if err != nil {
return nil, err
}
pedersenParamsFilePath := path.Join(dir, "pedersen_params.json")
sc, err := caigo.SC(caigo.WithConstants(pedersenParamsFilePath))
if err != nil {
return nil, err
}
return &sc, nil
}
Any suggestion on how to get rid of this error when working with K6?