-
Notifications
You must be signed in to change notification settings - Fork 2
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 #87 from multiversx/feat/spica
Merge feat/spica into main
- Loading branch information
Showing
108 changed files
with
7,043 additions
and
1,235 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,14 @@ | ||
# Default (placeholder): mnemonic of "testwallets" (friends: Alice, Bob, Carol etc.): | ||
# https://github.com/multiversx/mx-sdk-testwallets/blob/main/users/mnemonic.txt. | ||
# This works fine for localnet. | ||
# For the Github workflows, a repository secret is being used. | ||
export USERS_MNEMONIC="moral volcano peasant pass circle pen over picture flat shop clap goat never lyrics gather prepare woman film husband gravity behind test tiger improve" | ||
|
||
# Default (placeholder): Alice's secret key: | ||
# https://github.com/multiversx/mx-sdk-testwallets/blob/main/users/alice.pem. | ||
# This works fine for localnet. | ||
# For the Github workflows, a repository secret is being used. | ||
export SPONSOR_SECRET_KEY=413f42575f7f26fad3317a778771212fdb80245850981e48b58a4f25e344e8f9 | ||
|
||
# For the Github workflows, a repository secret (private deep history instance) is being used. | ||
export MAINNET_PROXY_URL="https://gateway.multiversx.com" |
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,34 @@ | ||
name: Check with Mesh CLI (mainnet) | ||
|
||
on: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.11 | ||
|
||
- uses: actions/checkout@v4 | ||
|
||
- name: Install dependencies | ||
run: | | ||
pip install -r ./requirements-dev.txt | ||
curl -sSfL https://raw.githubusercontent.com/coinbase/mesh-cli/master/scripts/install.sh | sh -s -- -b "$HOME/.local/bin" | ||
echo "$HOME/.local/bin" >> $GITHUB_PATH | ||
- name: Build | ||
run: | | ||
cd $GITHUB_WORKSPACE/cmd/rosetta && go build . | ||
cd $GITHUB_WORKSPACE/systemtests && go build ./proxyToObserverAdapter.go | ||
- name: check:data | ||
run: | | ||
PYTHONPATH=. python3 ./systemtests/check_with_mesh_cli.py --mode=data --network=mainnet | ||
env: | ||
MAINNET_PROXY_URL: ${{ secrets.MAINNET_PROXY_URL }} | ||
|
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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
cmd/rosetta/rosetta | ||
cmd/rosetta/logs/** | ||
systemtests/logs/** | ||
systemtests/memento/** | ||
systemtests/**/check-data/** | ||
logs/** | ||
|
||
**/__pycache__/** | ||
venv/** |
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,6 @@ | ||
{ | ||
"[json]": { | ||
"editor.tabSize": 4 | ||
}, | ||
"prettier" | ||
} |
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,33 @@ | ||
package main | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
"os" | ||
|
||
"github.com/multiversx/mx-chain-rosetta/server/resources" | ||
) | ||
|
||
func decideCustomCurrencies(configFileCustomCurrencies string) ([]resources.Currency, error) { | ||
if len(configFileCustomCurrencies) == 0 { | ||
return make([]resources.Currency, 0), nil | ||
} | ||
|
||
return loadConfigOfCustomCurrencies(configFileCustomCurrencies) | ||
} | ||
|
||
func loadConfigOfCustomCurrencies(configFile string) ([]resources.Currency, error) { | ||
fileContent, err := os.ReadFile(configFile) | ||
if err != nil { | ||
return nil, fmt.Errorf("error when reading custom currencies config file: %w", err) | ||
} | ||
|
||
var customCurrencies []resources.Currency | ||
|
||
err = json.Unmarshal(fileContent, &customCurrencies) | ||
if err != nil { | ||
return nil, fmt.Errorf("error when loading custom currencies from file: %w", err) | ||
} | ||
|
||
return customCurrencies, 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,50 @@ | ||
package main | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/multiversx/mx-chain-rosetta/server/resources" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestDecideCustomCurrencies(t *testing.T) { | ||
t.Run("with success (file provided)", func(t *testing.T) { | ||
customCurrencies, err := decideCustomCurrencies("testdata/custom-currencies.json") | ||
require.NoError(t, err) | ||
require.Len(t, customCurrencies, 2) | ||
}) | ||
|
||
t.Run("with success (file not provided)", func(t *testing.T) { | ||
customCurrencies, err := decideCustomCurrencies("") | ||
require.NoError(t, err) | ||
require.Empty(t, customCurrencies) | ||
}) | ||
} | ||
|
||
func TestLoadConfigOfCustomCurrencies(t *testing.T) { | ||
t.Run("with success", func(t *testing.T) { | ||
customCurrencies, err := loadConfigOfCustomCurrencies("testdata/custom-currencies.json") | ||
require.NoError(t, err) | ||
require.NoError(t, err) | ||
require.Equal(t, []resources.Currency{ | ||
{ | ||
Symbol: "WEGLD-bd4d79", | ||
Decimals: 18, | ||
}, | ||
{ | ||
Symbol: "USDC-c76f1f", | ||
Decimals: 6, | ||
}, | ||
}, customCurrencies) | ||
}) | ||
|
||
t.Run("with error (missing file)", func(t *testing.T) { | ||
_, err := loadConfigOfCustomCurrencies("testdata/missing-file.json") | ||
require.ErrorContains(t, err, "error when reading custom currencies config file") | ||
}) | ||
|
||
t.Run("with error (invalid file)", func(t *testing.T) { | ||
_, err := loadConfigOfCustomCurrencies("testdata/custom-currencies-bad.json") | ||
require.ErrorContains(t, err, "error when loading custom currencies from file") | ||
}) | ||
} |
Oops, something went wrong.