diff --git a/Makefile b/Makefile index cb8ea1fc4..6cde89f39 100644 --- a/Makefile +++ b/Makefile @@ -358,6 +358,7 @@ mock: ##@other Regenerate mocks mockgen -package=mock_collectibles -destination=services/wallet/collectibles/mock/collectible_data_db.go -source=services/wallet/collectibles/collectible_data_db.go mockgen -package=mock_thirdparty -destination=services/wallet/thirdparty/mock/collectible_types.go -source=services/wallet/thirdparty/collectible_types.go mockgen -package=mock_paraswap -destination=services/wallet/thirdparty/paraswap/mock/types.go -source=services/wallet/thirdparty/paraswap/types.go + mockgen -package=mock_onramp -destination=services/wallet/onramp/mock/types.go -source=services/wallet/onramp/types.go docker-test: ##@tests Run tests in a docker container with golang. docker run --privileged --rm -it -v "$(PWD):$(DOCKER_TEST_WORKDIR)" -w "$(DOCKER_TEST_WORKDIR)" $(DOCKER_TEST_IMAGE) go test ${ARGS} diff --git a/_assets/tests/ramps.json b/_assets/tests/ramps.json deleted file mode 100644 index 3cdeeda42..000000000 --- a/_assets/tests/ramps.json +++ /dev/null @@ -1,47 +0,0 @@ -[ - { - "name": "Wyre", - "description": "A secure bridge for fiat and crypto", - "fees": "from 2.9%", - "region": "US & Europe", - "logoUrl":"https://www.sendwyre.com/favicon.ico", - "siteUrl": "https://pay.sendwyre.com/purchase", - "hostname": "sendwyre.com" - }, - { - "name": "MoonPay", - "description": "The new standard for fiat to crypto", - "fees": "1%-4.5%", - "region": "US & Europe", - "logoUrl":"https://buy.moonpay.com/favicon-32x32.png", - "siteUrl": "https://buy.moonpay.com", - "hostname": "moonpay.com" - }, - { - "name": "Transak", - "description": "Global fiat <-> crypto payment gateway", - "fees": "1%-4.5%", - "region": "Global", - "logoUrl":"https://global.transak.com/favicon.png", - "siteUrl": "https://global.transak.com", - "hostname": "transak.com" - }, - { - "name": "Ramp", - "description": "Global crypto to fiat flow", - "fees": "1.5%", - "region": "Global", - "logoUrl":"https://ramp.network/assets/favicons/favicon-32x32.png", - "siteUrl": "https://ramp.network/buy/", - "hostname": "ramp.network" - }, - { - "name": "LocalCryptos", - "description": "Non-custodial crypto marketplace", - "fees": "1.5%", - "region": "Global", - "logoUrl":"https://localcryptos.com/images/favicon.png", - "siteUrl": "https://localcryptos.com", - "hostname": "localcryptos.com" - } -] \ No newline at end of file diff --git a/go.mod b/go.mod index e675fe01a..33ab41001 100644 --- a/go.mod +++ b/go.mod @@ -100,6 +100,7 @@ require ( github.com/wk8/go-ordered-map/v2 v2.1.7 github.com/yeqown/go-qrcode/v2 v2.2.1 github.com/yeqown/go-qrcode/writer/standard v1.2.1 + go.uber.org/mock v0.4.0 go.uber.org/multierr v1.11.0 golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 golang.org/x/net v0.25.0 @@ -278,7 +279,6 @@ require ( go.uber.org/atomic v1.11.0 // indirect go.uber.org/dig v1.17.1 // indirect go.uber.org/fx v1.22.1 // indirect - go.uber.org/mock v0.4.0 // indirect golang.org/x/mod v0.17.0 // indirect golang.org/x/sync v0.7.0 // indirect golang.org/x/sys v0.20.0 // indirect diff --git a/services/wallet/api.go b/services/wallet/api.go index 28f916303..9fc65be84 100644 --- a/services/wallet/api.go +++ b/services/wallet/api.go @@ -343,7 +343,13 @@ func (api *API) WatchTransactionByChainID(ctx context.Context, chainID uint64, t } func (api *API) GetCryptoOnRamps(ctx context.Context) ([]onramp.CryptoOnRamp, error) { - return api.s.cryptoOnRampManager.Get() + log.Debug("call to GetCryptoOnRamps") + return api.s.cryptoOnRampManager.GetProviders(ctx) +} + +func (api *API) GetCryptoOnRampURL(ctx context.Context, providerID string, parameters onramp.Parameters) (string, error) { + log.Debug("call to GetCryptoOnRampURL") + return api.s.cryptoOnRampManager.GetURL(ctx, providerID, parameters) } /* diff --git a/services/wallet/api_test.go b/services/wallet/api_test.go index 75688868f..a2e943f2c 100644 --- a/services/wallet/api_test.go +++ b/services/wallet/api_test.go @@ -2,10 +2,15 @@ package wallet import ( "context" + "errors" "testing" "github.com/stretchr/testify/require" + gomock "go.uber.org/mock/gomock" + + "github.com/status-im/status-go/services/wallet/onramp" + mock_onramp "github.com/status-im/status-go/services/wallet/onramp/mock" "github.com/status-im/status-go/services/wallet/walletconnect" ) @@ -41,3 +46,47 @@ func TestAPI_IsChecksumValidForAddress(t *testing.T) { require.NoError(t, err) require.True(t, res) } + +func TestAPI_GetCryptoOnRamps(t *testing.T) { + ctrl := gomock.NewController(t) + defer ctrl.Finish() + + provider0 := mock_onramp.NewMockProvider(ctrl) + id0 := "provider0" + provider0.EXPECT().ID().Return(id0).AnyTimes() + provider1 := mock_onramp.NewMockProvider(ctrl) + id1 := "provider1" + provider1.EXPECT().ID().Return(id1).AnyTimes() + providers := []onramp.Provider{provider0, provider1} + onrampManager := onramp.NewManager(providers) + + api := &API{ + s: &Service{cryptoOnRampManager: onrampManager}, + } + + ctx := context.Background() + + // Check returned providers + provider0.EXPECT().GetCryptoOnRamp(ctx).Return(onramp.CryptoOnRamp{ID: id0}, nil) + provider1.EXPECT().GetCryptoOnRamp(ctx).Return(onramp.CryptoOnRamp{ID: id1}, nil) + + retProviders, err := api.GetCryptoOnRamps(ctx) + require.NoError(t, err) + require.Equal(t, len(providers), len(retProviders)) + require.Equal(t, id0, retProviders[0].ID) + require.Equal(t, id1, retProviders[1].ID) + + // Check error handling + provider0.EXPECT().GetCryptoOnRamp(ctx).Return(onramp.CryptoOnRamp{}, errors.New("error")) + provider1.EXPECT().GetCryptoOnRamp(ctx).Return(onramp.CryptoOnRamp{ID: id1}, nil) + retProviders, err = api.GetCryptoOnRamps(ctx) + require.NoError(t, err) + require.Equal(t, 1, len(retProviders)) + require.Equal(t, id1, retProviders[0].ID) + + // Check URL retrieval + provider1.EXPECT().GetURL(ctx, onramp.Parameters{}).Return("url", nil) + url, err := api.GetCryptoOnRampURL(ctx, id1, onramp.Parameters{}) + require.NoError(t, err) + require.Equal(t, "url", url) +} diff --git a/services/wallet/common/const.go b/services/wallet/common/const.go index fa7dc817f..4f1a9e05b 100644 --- a/services/wallet/common/const.go +++ b/services/wallet/common/const.go @@ -47,6 +47,10 @@ func (c ChainID) String() string { return strconv.FormatUint(uint64(c), 10) } +func (c ChainID) ToUint() uint64 { + return uint64(c) +} + func (c ChainID) IsMainnet() bool { switch uint64(c) { case EthereumMainnet, OptimismMainnet, ArbitrumMainnet: diff --git a/services/wallet/onramp/mock/types.go b/services/wallet/onramp/mock/types.go new file mode 100644 index 000000000..d00ab03ea --- /dev/null +++ b/services/wallet/onramp/mock/types.go @@ -0,0 +1,85 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: services/wallet/onramp/types.go +// +// Generated by this command: +// +// mockgen -package=mock_onramp -destination=services/wallet/onramp/mock/types.go -source=services/wallet/onramp/types.go +// + +// Package mock_onramp is a generated GoMock package. +package mock_onramp + +import ( + context "context" + reflect "reflect" + + onramp "github.com/status-im/status-go/services/wallet/onramp" + gomock "go.uber.org/mock/gomock" +) + +// MockProvider is a mock of Provider interface. +type MockProvider struct { + ctrl *gomock.Controller + recorder *MockProviderMockRecorder +} + +// MockProviderMockRecorder is the mock recorder for MockProvider. +type MockProviderMockRecorder struct { + mock *MockProvider +} + +// NewMockProvider creates a new mock instance. +func NewMockProvider(ctrl *gomock.Controller) *MockProvider { + mock := &MockProvider{ctrl: ctrl} + mock.recorder = &MockProviderMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockProvider) EXPECT() *MockProviderMockRecorder { + return m.recorder +} + +// GetCryptoOnRamp mocks base method. +func (m *MockProvider) GetCryptoOnRamp(ctx context.Context) (onramp.CryptoOnRamp, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetCryptoOnRamp", ctx) + ret0, _ := ret[0].(onramp.CryptoOnRamp) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetCryptoOnRamp indicates an expected call of GetCryptoOnRamp. +func (mr *MockProviderMockRecorder) GetCryptoOnRamp(ctx any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCryptoOnRamp", reflect.TypeOf((*MockProvider)(nil).GetCryptoOnRamp), ctx) +} + +// GetURL mocks base method. +func (m *MockProvider) GetURL(ctx context.Context, parameters onramp.Parameters) (string, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetURL", ctx, parameters) + ret0, _ := ret[0].(string) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetURL indicates an expected call of GetURL. +func (mr *MockProviderMockRecorder) GetURL(ctx, parameters any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetURL", reflect.TypeOf((*MockProvider)(nil).GetURL), ctx, parameters) +} + +// ID mocks base method. +func (m *MockProvider) ID() string { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ID") + ret0, _ := ret[0].(string) + return ret0 +} + +// ID indicates an expected call of ID. +func (mr *MockProviderMockRecorder) ID() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ID", reflect.TypeOf((*MockProvider)(nil).ID)) +} diff --git a/services/wallet/onramp/on_ramp.go b/services/wallet/onramp/on_ramp.go index b9e12bad0..81553cf91 100644 --- a/services/wallet/onramp/on_ramp.go +++ b/services/wallet/onramp/on_ramp.go @@ -1,121 +1,45 @@ package onramp import ( - "encoding/json" + "context" "errors" - "fmt" - "io/ioutil" - "net/http" - "time" + + "github.com/ethereum/go-ethereum/log" ) -type DataSourceType int - -const ( - DataSourceHTTP DataSourceType = iota + 1 - DataSourceStatic -) - -type CryptoOnRamp struct { - Name string `json:"name"` - Description string `json:"description"` - Fees string `json:"fees"` - LogoURL string `json:"logoUrl"` - SiteURL string `json:"siteUrl"` - RecurrentSiteURL string `json:"recurrentSiteUrl"` - Hostname string `json:"hostname"` - Params map[string]string `json:"params"` // TODO implement params in JSON and parsing status-mobile - SupportedChainIDs []uint64 `json:"supportedChainIds"` -} - -type Options struct { - DataSource string - DataSourceType DataSourceType -} - type Manager struct { - options *Options - ramps []CryptoOnRamp - lastCalled time.Time + providers []Provider } -func NewManager(options *Options) *Manager { +func NewManager(providers []Provider) *Manager { return &Manager{ - options: options, + providers: providers, } } -func (c *Manager) Get() ([]CryptoOnRamp, error) { - var ramps []CryptoOnRamp - var err error - - switch c.options.DataSourceType { - case DataSourceHTTP: - if !c.hasCacheExpired(time.Now()) { - return c.ramps, nil +func (c *Manager) GetProviders(ctx context.Context) ([]CryptoOnRamp, error) { + ret := make([]CryptoOnRamp, 0, len(c.providers)) + for _, provider := range c.providers { + cryptoOnRamp, err := provider.GetCryptoOnRamp(ctx) + if err != nil { + log.Error("failed to get crypto on ramp", "id", provider.ID(), "error", err) + continue } - ramps, err = c.getFromHTTPDataSource() - c.lastCalled = time.Now() - case DataSourceStatic: - ramps, err = c.getFromStaticDataSource() - default: - return nil, fmt.Errorf("unsupported Manager.DataSourceType '%d'", c.options.DataSourceType) - } - if err != nil { - return nil, err + + ret = append(ret, cryptoOnRamp) } - c.ramps = ramps - - return c.ramps, nil + return ret, nil } -func (c *Manager) hasCacheExpired(t time.Time) bool { - // If lastCalled + 1 hour is before the given time, then 1 hour hasn't passed yet - return c.lastCalled.Add(time.Hour).Before(t) -} - -func (c *Manager) getFromHTTPDataSource() ([]CryptoOnRamp, error) { - if c.options.DataSource == "" { - return nil, errors.New("data source is not set for Manager") - } - - sgc := http.Client{ - Timeout: time.Second * 5, - } - - req, err := http.NewRequest(http.MethodGet, c.options.DataSource, nil) - if err != nil { - return nil, err - } - req.Header.Set("User-Agent", "status-go") - - res, err := sgc.Do(req) - if err != nil { - return nil, err - } - - if res.Body != nil { - defer res.Body.Close() - } - - body, err := ioutil.ReadAll(res.Body) - if err != nil { - return nil, err - } - - fmt.Println(string(body)) - - var ramps []CryptoOnRamp - - err = json.Unmarshal(body, &ramps) - if err != nil { - return nil, err - } - - return ramps, nil -} - -func (c *Manager) getFromStaticDataSource() ([]CryptoOnRamp, error) { - return getOnRampProviders(), nil +func (c *Manager) GetURL(ctx context.Context, providerID string, parameters Parameters) (string, error) { + for _, provider := range c.providers { + if provider.ID() != providerID { + continue + } + + return provider.GetURL(ctx, parameters) + } + + return "", errors.New("provider not found") } diff --git a/services/wallet/onramp/on_ramp_test.go b/services/wallet/onramp/on_ramp_test.go deleted file mode 100644 index 6cefaed4e..000000000 --- a/services/wallet/onramp/on_ramp_test.go +++ /dev/null @@ -1,54 +0,0 @@ -package onramp - -import ( - "net/http" - "net/http/httptest" - "testing" - "time" - - "github.com/stretchr/testify/require" -) - -const ( - path = "../../../_assets/tests/" -) - -func TestCryptoOnRamps_Get(t *testing.T) { - s := httptest.NewServer(http.FileServer(http.Dir(path))) - defer s.Close() - - cs := []*Manager{ - {options: &Options{DataSourceType: DataSourceStatic}}, - {options: &Options{ - DataSourceType: DataSourceHTTP, - DataSource: s.URL + "/ramps.json", - }}, - } - - for _, corm := range cs { - require.Equal(t, 0, len(corm.ramps)) - - rs, err := corm.Get() - require.NoError(t, err) - require.Greater(t, len(rs), 0) - } -} - -func TestCryptoOnRampManager_hasCacheExpired(t *testing.T) { - s := httptest.NewServer(http.FileServer(http.Dir(path))) - defer s.Close() - - corm := NewManager(&Options{ - DataSourceType: DataSourceHTTP, - DataSource: s.URL + "/ramps.json", - }) - nt := time.Time{}.Add(30 * time.Minute) - - require.False(t, corm.hasCacheExpired(nt)) - require.True(t, corm.hasCacheExpired(time.Now())) - - _, err := corm.Get() - require.NoError(t, err) - require.False(t, corm.hasCacheExpired(time.Now())) - require.True(t, corm.hasCacheExpired(time.Now().Add(2*time.Hour))) -} diff --git a/services/wallet/onramp/on_ramp_providers.go b/services/wallet/onramp/provider_mercuryo.go similarity index 65% rename from services/wallet/onramp/on_ramp_providers.go rename to services/wallet/onramp/provider_mercuryo.go index 12ef0cae6..36fb00cbf 100644 --- a/services/wallet/onramp/on_ramp_providers.go +++ b/services/wallet/onramp/provider_mercuryo.go @@ -1,46 +1,157 @@ package onramp -import walletCommon "github.com/status-im/status-go/services/wallet/common" +import ( + "context" + "crypto/sha512" + "errors" + "fmt" + "strings" + "sync" + "time" -func getOnRampProviders() []CryptoOnRamp { + "github.com/ethereum/go-ethereum/common" + + walletCommon "github.com/status-im/status-go/services/wallet/common" + "github.com/status-im/status-go/services/wallet/thirdparty/mercuryo" + "github.com/status-im/status-go/services/wallet/token" +) + +const mercuryoID = "mercuryo" +const mercuryioNoFeesBaseURL = "https://exchange.mercuryo.io/?type=buy&networks=ETHEREUM,ARBITRUM,OPTIMISM¤cy=ETH" +const supportedAssetsUpdateInterval = 24 * time.Hour + +type MercuryoProvider struct { + supportedTokens []*token.Token + supportedTokensTimestamp time.Time + supportedTokensLock sync.RWMutex + httpClient *mercuryo.Client + tokenManager token.ManagerInterface +} + +func NewMercuryoProvider(tokenManager token.ManagerInterface) *MercuryoProvider { + return &MercuryoProvider{ + httpClient: mercuryo.NewClient(), + tokenManager: tokenManager, + } +} + +func (p *MercuryoProvider) ID() string { + return mercuryoID +} + +func (p *MercuryoProvider) GetCryptoOnRamp(ctx context.Context) (CryptoOnRamp, error) { const ( logoMercuryo = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/4gKgSUNDX1BST0ZJTEUAAQEAAAKQbGNtcwQwAABtbnRyUkdCIFhZWiAAAAAAAAAAAAAAAABhY3NwQVBQTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLWxjbXMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAtkZXNjAAABCAAAADhjcHJ0AAABQAAAAE53dHB0AAABkAAAABRjaGFkAAABpAAAACxyWFlaAAAB0AAAABRiWFlaAAAB5AAAABRnWFlaAAAB+AAAABRyVFJDAAACDAAAACBnVFJDAAACLAAAACBiVFJDAAACTAAAACBjaHJtAAACbAAAACRtbHVjAAAAAAAAAAEAAAAMZW5VUwAAABwAAAAcAHMAUgBHAEIAIABiAHUAaQBsAHQALQBpAG4AAG1sdWMAAAAAAAAAAQ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V0u6hZ56vORcnKcIUuKu4lUOmi4O4TpS7Z71dS65L5DjfFLlnviVTtkvEuWuUu2e67Vu+SSua++UcGXORlPnT8ya1BlxQyNl3Gl7HqIvA9dK+MtMufyVy6jwtSMtIuaZ9rJi7ztEpkZttFXua4enwO3qJ5t4o9F3mZzicnGnQZQ+Ysky4JZIy6jC5j1mVkGcMuzt1w12L6nr7v3F9Mlt3bhA7nbZkyU+9k5m2yu4uECl1xZXy/l7M27sKWGemXLPK7cGXG+e0TDS48mXF+LUeHC0tm5R1Kf7dW48KQ2Ry9M9ef7buQZXpcnDvQZFS5OHeM/zXEAReizOf4+2zGjSAz4EKSUedCkBl0IcgodImWCXCJllHpEikT5BIpo9QlSibQJUpGrUuETLBLhIxil2CZCJdgGdUugTJRLoEyyl2CZCJdgmTUuwTIRLsEyBhwGZQhuAzKmHAZkCG5DMgYcemVIbr0yphx6ZEhu/TIGHLxyjBcvDKmXDwyLBePjDGXThmmS6fMF2suzu3/lnbpkPlCfJxH1loyAi5nMiZdWjIiLi0Zoy6uviB4sR/+66AOX5/qsLsTGpmj46fprJjNJ74vYikd/rnclbt3d2Z3F4QQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIe39C9vesmAqb7TPAAAAAElFTkSuQmCC" - - mercurioBaseURL = "https://exchange.mercuryo.io/?type=buy&networks=ETHEREUM,ARBITRUM,OPTIMISM¤cy=ETH&widget_id=6a7eb330-2b09-49b7-8fd3-1c77cfb6cd47" ) - ramps := []CryptoOnRamp{ - { - Name: "Mercuryo", - Description: "Buy crypto within 15 seconds", - Fees: "4.5%", - LogoURL: logoMercuryo, - SiteURL: mercurioBaseURL, - RecurrentSiteURL: mercurioBaseURL + "&widget_flow=recurrent", - Hostname: "mercuryo.io", - SupportedChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.ArbitrumMainnet, walletCommon.OptimismMainnet}, - }, - { - Name: "Ramp", - Description: "Global crypto to fiat flow", - Fees: "0.49% - 2.9%", - LogoURL: logoRamp, - SiteURL: "https://ramp.network/buy?hostApiKey=zrtf9u2uqebeyzcs37fu5857tktr3eg9w5tffove&swapAsset=DAI,ETH,USDC,USDT", - Hostname: "ramp.network", - SupportedChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.ArbitrumMainnet, walletCommon.OptimismMainnet}, - }, - { - Name: "MoonPay", - Description: "The new standard for fiat to crypto", - Fees: "1% - 4.5%", - LogoURL: logoMoonPay, - SiteURL: "https://buy.moonpay.com/?apiKey=pk_live_YQC6CQPA5qqDu0unEwHJyAYQyeIqFGR", - Hostname: "moonpay.com", - SupportedChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.ArbitrumMainnet, walletCommon.OptimismMainnet}, - }, + provider := CryptoOnRamp{ + ID: mercuryoID, + Name: "Mercuryo", + Description: "Buy crypto within 15 seconds", + Fees: "4.5%", + LogoURL: logoMercuryo, + Hostname: "mercuryo.io", + SupportsSinglePurchase: true, + SupportsRecurrentPurchase: true, + SupportedChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.ArbitrumMainnet, walletCommon.OptimismMainnet}, + URLsNeedParameters: true, + SiteURL: mercuryioNoFeesBaseURL, + RecurrentSiteURL: mercuryioNoFeesBaseURL + "&widget_flow=recurrent", } - return ramps + var err error + provider.SupportedTokens, err = p.getSupportedCurrencies(ctx) + return provider, err +} + +func (p *MercuryoProvider) getSupportedCurrencies(ctx context.Context) ([]*token.Token, error) { + p.supportedTokensLock.Lock() + defer p.supportedTokensLock.Unlock() + + if time.Since(p.supportedTokensTimestamp) < supportedAssetsUpdateInterval { + return p.supportedTokens, nil + } + + newSupportedCurrencies, err := p.httpClient.FetchCurrencies(ctx) + if err != nil { + return p.supportedTokens, err + } + + newSupportedTokens := make([]*token.Token, 0, len(newSupportedCurrencies)) + for _, currency := range newSupportedCurrencies { + chainID := mercuryo.NetworkToCommonChainID(currency.Network) + if chainID == walletCommon.UnknownChainID { + continue + } + token, isNative := p.tokenManager.LookupToken(&chainID, currency.Symbol) + if token == nil { + continue + } + if !isNative { + contractAddress := common.HexToAddress(currency.Contract) + if contractAddress != token.Address { + continue + } + } + newSupportedTokens = append(newSupportedTokens, token) + } + + p.supportedTokens = newSupportedTokens + p.supportedTokensTimestamp = time.Now() + + return p.supportedTokens, nil +} + +// Should generate the SHA512 hash of the string "AddressKey" +func getMercuryoSignature(address common.Address, key string) string { + addressString := address.Hex() + + hash := sha512.New() + hash.Write([]byte(addressString[:] + key)) + return fmt.Sprintf("%x", hash.Sum(nil)) +} + +func getMercuryoCurrency(symbol string) string { + return strings.ToUpper(symbol) +} + +func (p *MercuryoProvider) GetURL(ctx context.Context, parameters Parameters) (string, error) { + const ( + baseURL = "https://exchange.mercuryo.io/?type=buy" + widgetID = "6a7eb330-2b09-49b7-8fd3-1c77cfb6cd47" + widgetSecret = "AZ5fmxmrgyrXH3zre6yHU2Vw9fPqEw82" // #nosec G101 + ) + + if parameters.DestAddress == nil || *parameters.DestAddress == walletCommon.ZeroAddress { + return "", errors.New("destination address is required") + } + + if parameters.ChainID == nil || *parameters.ChainID == walletCommon.UnknownChainID { + return "", errors.New("chainID is required") + } + + if parameters.Symbol == nil || *parameters.Symbol == "" { + return "", errors.New("symbol is required") + } + + network := mercuryo.CommonChainIDToNetwork(*parameters.ChainID) + if network == "" { + return "", errors.New("unsupported chainID") + } + + currency := getMercuryoCurrency(*parameters.Symbol) + if currency == "" { + return "", errors.New("unsupported symbol") + } + + // TODO #16005: Move signature generation to proxy server + signature := getMercuryoSignature(*parameters.DestAddress, widgetSecret) + url := fmt.Sprintf("%s&network=%s¤cy=%s&address=%s&hide_address=false&fix_address=true&signature=%s&widget_id=%s", + baseURL, network, currency, parameters.DestAddress.Hex(), signature, widgetID) + + if parameters.IsRecurrent { + url = url + "&widget_flow=recurrent" + } + + return url, nil } diff --git a/services/wallet/onramp/provider_mercuryo_test.go b/services/wallet/onramp/provider_mercuryo_test.go new file mode 100644 index 000000000..76125ea8d --- /dev/null +++ b/services/wallet/onramp/provider_mercuryo_test.go @@ -0,0 +1,17 @@ +package onramp + +import ( + "testing" + + "github.com/ethereum/go-ethereum/common" + + "github.com/stretchr/testify/require" +) + +func TestCryptoOnRamps_MercuryoSignature(t *testing.T) { + address := common.HexToAddress("0x1234567890123456789012345678901234567890") + key := "asdbnm,asdb,mnabs=qweqwrhiuasdkj" + + signature := getMercuryoSignature(address, key) + require.Equal(t, "76e386d5957353e2ce51d9960540979e36472cb754cbd8dcee164b9b4300bdafaa04e9370a4fa47165600b6c15f30f444ec69b2a227741e34189d6c73231f391", signature) +} diff --git a/services/wallet/onramp/provider_moonpay.go b/services/wallet/onramp/provider_moonpay.go new file mode 100644 index 000000000..fb62b0325 --- /dev/null +++ b/services/wallet/onramp/provider_moonpay.go @@ -0,0 +1,50 @@ +package onramp + +import ( + "context" + "fmt" + + walletCommon "github.com/status-im/status-go/services/wallet/common" +) + +const moonpayID = "moonpay" +const moonpayURL = "https://buy.moonpay.com/?apiKey=pk_live_YQC6CQPA5qqDu0unEwHJyAYQyeIqFGR" + +type MoonPayProvider struct{} + +func NewMoonPayProvider() *MoonPayProvider { + return &MoonPayProvider{} +} + +func (p *MoonPayProvider) ID() string { + return moonpayID +} + +func (p *MoonPayProvider) GetCryptoOnRamp(ctx context.Context) (CryptoOnRamp, error) { + const ( + logoMoonPay = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/4gKgSUNDX1BST0ZJTEUAAQEAAAKQbGNtcwQwAABtbnRyUkdCIFhZWiAAAAAAAAAAAAAAAABhY3NwQVBQTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLWxjbXMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAtkZXNjAAABCAAAADhjcHJ0AAABQAAAAE53dHB0AAABkAAAABRjaGFkAAABpAAAACxyWFlaAAAB0AAAABRiWFlaAAAB5AAAABRnWFlaAAAB+AAA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5n+V0vj2IeMwebvo+RCVtJLZQbgnPpGhiRySRXtpVYcX0EGALsZaUkHdiB1YEo8UB2A98IKJIDDE5TdQKS1NUkZDbLYXNIIYRvpVVWVu+sGIFCCyJUdCuKJQFQkdCE0rVtiNL8+7G+1eB7lIfQ+LUlCtRqjEyFFks6Eisew1J8xrl2x/Iw1TwYLulHZqeOlXOtWpdlUgqq0NvfPpTzVLR1jah4FdMAyU4wCwYEBj8Y8lBQC9q+EuI11JoCE+7By4hww9EZVGBQSuWuLF1FJkc6l+VfsAUCAp+VMtWGrbHyDskIIhCRVRg5ESI5EaT0K3Ohsyp7A6f9rukfNVXJj86BUu3PBNZ5ULGhAIiNROg2C7hKCEXKcOwZ9ihaBCJUqXhvN1ugu8DGKUAbj7EBdBoUEquIi6AAyeybL+tc0fURV+X2MBnMcAfKHnoCrQkc0/ZJpB25GTQALJJ7+qUJcsfsg8XvAsH96AAoBB784pFOQP06g8P9lL7PYx6h7h9BwpaYJuTk7f5PYowCJKyYjNHZJ0EvTDdAFaVC9BL7FvCkLimOSEJjk6Ca6zZGhRkRTSqaoFEbnK1ZoMAPzsoAaHqG/koAxF6HXD18oXy2hkrcExN90mEyio5Pywg2qjJr/gZYNXS/t5c5SvFAgA6ITmaSOSDI4uNTIsudbs+lqnyWQZPxsQAljnPwGrwSlAWTCgubFYFA5Veiy7rUY2BrzHZkpoKOmiCqxgQCsEu2dTd1HfsjUfW4v47MQE6gKSAl1QKFqSItUaj/qhzl3XKyuekw0YiDG0InA6PTZXhmQSDl0aVFAjyQD+nTwErID8h+tFWLaTwj9am+/0XTnw1MTGx7cp5Q6ku4ACDm88pf5Nv/9k=" + ) + + onramp := CryptoOnRamp{ + ID: moonpayID, + Name: "MoonPay", + Description: "The new standard for fiat to crypto", + Fees: "1% - 4.5%", + LogoURL: logoMoonPay, + Hostname: "moonpay.com", + SupportsSinglePurchase: true, + SupportsRecurrentPurchase: false, + SupportedChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.ArbitrumMainnet, walletCommon.OptimismMainnet}, + URLsNeedParameters: false, + SiteURL: moonpayURL, + } + + return onramp, nil +} + +func (p *MoonPayProvider) GetURL(ctx context.Context, parameters Parameters) (string, error) { + if !parameters.IsRecurrent { + return moonpayURL, nil + } + return "", fmt.Errorf("Recurrent transactions are not supported by MoonPay") +} diff --git a/services/wallet/onramp/provider_ramp.go b/services/wallet/onramp/provider_ramp.go new file mode 100644 index 000000000..c7571c31d --- /dev/null +++ b/services/wallet/onramp/provider_ramp.go @@ -0,0 +1,50 @@ +package onramp + +import ( + "context" + "fmt" + + walletCommon "github.com/status-im/status-go/services/wallet/common" +) + +const rampID = "ramp" +const rampSiteURL = "https://app.ramp.network/?hostApiKey=zrtf9u2uqebeyzcs37fu5857tktr3eg9w5tffove&hostAppName=Status&swapAsset=ETH_*,ARBITRUM_*,OPTIMISM_*" + +type RampProvider struct{} + +func NewRampProvider() *RampProvider { + return &RampProvider{} +} + +func (p *RampProvider) ID() string { + return rampID +} + +func (p *RampProvider) GetCryptoOnRamp(ctx context.Context) (CryptoOnRamp, error) { + const ( + logoRamp = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARgAAAEYCAMAAACwUBm+AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAKtQTFRF////8fv3kN+5WM+WL8N7Ib9zS8uNgtuw4/fu0eThhLauOIl6GndmCm5cR5KFlL+44e3rdNen8Pb1da2kPceEKYBw1fPlGXdm0eTg8fv2ZqSZL8N8x+/cwtvW4O3rrOfLR5KEo8nCq+fLhbetnuPCddenOIl74/fthbats9HMLsN8uevUk7+3nePChLeuZtOfV5uPZqWZ7/b1lMC3o8jCKIBxN4l7SsuNda2jc0pF4QAABfxJREFUeJzt3Wt32kYQh/ENIMBxlBhKoMQOTmKn9Jbek/b7f7Ianzq6oJV2Z0a7Mz3/52185hz9IoQEK+EcQgghhB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dvElcR5THmJh3CeBrdgIz5M/8/0l2sW5XwW2o35jn/S1ksSx9zeCi9sLnKw2LoeFr64FXkm//0GBkTiNv258sCn6eQz5hvWaC41FREbzJ3h0FwmZ5t0kcp/5XmV1EZCZj/QtAfuFxHMRkFk152n5XonrIiAzxjeR7AMM30WHjEYXDTI6XfKtvxvLhXIdoFFGr0teGc0uOWV0u6hZ56vORcnKcIUuKu4lUOmi4O4TpS7Z71dS65L5DjfFLlnviVTtkvEuWuUu2e67Vu+SSua++UcGXORlPnT8ya1BlxQyNl3Gl7HqIvA9dK+MtMufyVy6jwtSMtIuaZ9rJi7ztEpkZttFXua4enwO3qJ5t4o9F3mZzicnGnQZQ+Ysky4JZIy6jC5j1mVkGcMuzt1w12L6nr7v3F9Mlt3bhA7nbZkyU+9k5m2yu4uECl1xZXy/l7M27sKWGemXLPK7cGXG+e0TDS48mXF+LUeHC0tm5R1Kf7dW48KQ2Ry9M9ef7buQZXpcnDvQZFS5OHeM/zXEAReizOf4+2zGjSAz4EKSUedCkBl0IcgodImWCXCJllHpEikT5BIpo9QlSibQJUpGrUuETLBLhIxil2CZCJdgGdUugTJRLoEyyl2CZCJdgmTUuwTIRLsEyBhwGZQhuAzKmHAZkCG5DMgYcemVIbr0yphx6ZEhu/TIGHLxyjBcvDKmXDwyLBePjDGXThmmS6fMF2suzu3/lnbpkPlCfJxH1loyAi5nMiZdWjIiLi0Zoy6uviB4sR/+66AOX5/qsLsTGpmj46fprJjNJ74vYikd/rnclbt3d2Z3F4QQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIe39C9vesmAqb7TPAAAAAElFTkSuQmCC" + ) + + onramp := CryptoOnRamp{ + ID: rampID, + Name: "Ramp", + Description: "Global crypto to fiat flow", + Fees: "0.49% - 2.9%", + LogoURL: logoRamp, + Hostname: "ramp.network", + SupportsSinglePurchase: true, + SupportsRecurrentPurchase: false, + SupportedChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.ArbitrumMainnet, walletCommon.OptimismMainnet}, + URLsNeedParameters: false, + SiteURL: rampSiteURL, + } + + return onramp, nil +} + +func (p *RampProvider) GetURL(ctx context.Context, parameters Parameters) (string, error) { + if !parameters.IsRecurrent { + return rampSiteURL, nil + } + return "", fmt.Errorf("recurrent transactions are not supported by Ramp") +} diff --git a/services/wallet/onramp/types.go b/services/wallet/onramp/types.go new file mode 100644 index 000000000..497cb7c36 --- /dev/null +++ b/services/wallet/onramp/types.go @@ -0,0 +1,40 @@ +package onramp + +import ( + "context" + + "github.com/ethereum/go-ethereum/common" + + "github.com/status-im/status-go/services/wallet/token" +) + +type Provider interface { + ID() string + GetCryptoOnRamp(ctx context.Context) (CryptoOnRamp, error) + GetURL(ctx context.Context, parameters Parameters) (string, error) +} + +type Parameters struct { + IsRecurrent bool `json:"isRecurrent"` + DestAddress *common.Address `json:"destAddress,omitempty"` + ChainID *uint64 `json:"chainID,omitempty"` + Symbol *string `json:"symbol,omitempty"` +} + +type CryptoOnRamp struct { + ID string `json:"id"` + Name string `json:"name"` + Description string `json:"description"` + Fees string `json:"fees"` + LogoURL string `json:"logoUrl"` + Hostname string `json:"hostname"` + SupportsSinglePurchase bool `json:"supportsSinglePurchase"` + SupportsRecurrentPurchase bool `json:"supportsRecurrentPurchase"` + SupportedChainIDs []uint64 `json:"supportedChainIds"` + SupportedTokens []*token.Token `json:"supportedTokens"` // Empty array means supported assets are not specified + URLsNeedParameters bool `json:"urlsNeedParameters"` // True means Parameters are required for URL generation + // Deprecated fields below, only used by mobile + Params map[string]string `json:"params"` + SiteURL string `json:"siteUrl"` // Replaced by call to GetURL + RecurrentSiteURL string `json:"recurrentSiteUrl"` // Replaced by call to GetURL +} diff --git a/services/wallet/service.go b/services/wallet/service.go index 1a71afd09..5e909cb99 100644 --- a/services/wallet/service.go +++ b/services/wallet/service.go @@ -62,10 +62,6 @@ func NewService( feed *event.Feed, mediaServer *server.MediaServer, ) *Service { - cryptoOnRampManager := onramp.NewManager(&onramp.Options{ - DataSourceType: onramp.DataSourceStatic, - }) - signals := &walletevent.SignalsTransmitter{ Publisher: feed, } @@ -105,6 +101,14 @@ func NewService( balanceCacher := balance.NewCacherWithTTL(5 * time.Minute) tokenManager := token.NewTokenManager(db, rpcClient, communityManager, rpcClient.NetworkManager, appDB, mediaServer, feed, accountFeed, accountsDB, token.NewPersistence(db)) tokenManager.Start() + + cryptoOnRampProviders := []onramp.Provider{ + onramp.NewMercuryoProvider(tokenManager), + onramp.NewRampProvider(), + onramp.NewMoonPayProvider(), + } + cryptoOnRampManager := onramp.NewManager(cryptoOnRampProviders) + savedAddressesManager := &SavedAddressesManager{db: db} transactionManager := transfer.NewTransactionManager(transfer.NewMultiTransactionDB(db), gethManager, transactor, config, accountsDB, pendingTxManager, feed) blockChainState := blockchainstate.NewBlockChainState() diff --git a/services/wallet/thirdparty/mercuryo/client.go b/services/wallet/thirdparty/mercuryo/client.go new file mode 100644 index 000000000..f04756ec1 --- /dev/null +++ b/services/wallet/thirdparty/mercuryo/client.go @@ -0,0 +1,15 @@ +package mercuryo + +import ( + "github.com/status-im/status-go/services/wallet/thirdparty" +) + +type Client struct { + httpClient *thirdparty.HTTPClient +} + +func NewClient() *Client { + return &Client{ + httpClient: thirdparty.NewHTTPClient(), + } +} diff --git a/services/wallet/thirdparty/mercuryo/request_currencies.go b/services/wallet/thirdparty/mercuryo/request_currencies.go new file mode 100644 index 000000000..dec404deb --- /dev/null +++ b/services/wallet/thirdparty/mercuryo/request_currencies.go @@ -0,0 +1,64 @@ +package mercuryo + +import ( + "context" + "encoding/json" + "fmt" + "net/http" +) + +const ( + currenciesURL = "https://api.mercuryo.io/v1.6/lib/currencies" // nolint: gosec +) + +type Token struct { + Symbol string `json:"symbol"` + Address string `json:"address"` + Decimals uint `json:"decimals"` + Img string `json:"img"` + Network int `json:"network"` +} + +type CurrenciesResponse struct { + Data CurrenciesData `json:"data"` + Status int `json:"status"` +} + +type CurrenciesData struct { + Config Config `json:"config"` +} + +type Config struct { + CryptoCurrencies []CryptoCurrency `json:"crypto_currencies"` +} + +type CryptoCurrency struct { + Symbol string `json:"currency"` + Network string `json:"network"` + Contract string `json:"contract"` +} + +func (c *Client) FetchCurrencies(ctx context.Context) ([]CryptoCurrency, error) { + response, err := c.httpClient.DoGetRequest(ctx, currenciesURL, nil, nil) + if err != nil { + return nil, err + } + + return handleCurrenciesResponse(response) +} + +func handleCurrenciesResponse(response []byte) ([]CryptoCurrency, error) { + var currenciesResponse CurrenciesResponse + err := json.Unmarshal(response, ¤ciesResponse) + if err != nil { + return nil, err + } + + if currenciesResponse.Status != http.StatusOK { + return nil, fmt.Errorf("unsuccessful request: %d %s", currenciesResponse.Status, http.StatusText(currenciesResponse.Status)) + } + + assets := currenciesResponse.Data.Config.CryptoCurrencies + + return assets, nil +} diff --git a/services/wallet/thirdparty/mercuryo/request_currencies_test.go b/services/wallet/thirdparty/mercuryo/request_currencies_test.go new file mode 100644 index 000000000..41dc2c797 --- /dev/null +++ b/services/wallet/thirdparty/mercuryo/request_currencies_test.go @@ -0,0 +1,36 @@ +package mercuryo + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestUnmarshallCurrencies(t *testing.T) { + requiredAssetIDs := []CryptoCurrency{ + { + Network: "ETHEREUM", + Symbol: "ETH", + Contract: "", + }, + { + Network: "OPTIMISM", + Symbol: "ETH", + Contract: "", + }, + { + Network: "ARBITRUM", + Symbol: "ETH", + Contract: "", + }, + { + Network: "ETHEREUM", + Symbol: "DAI", + Contract: "0x6b175474e89094c44da98b954eedeac495271d0f", + }, + } + + currencies, err := handleCurrenciesResponse(getTestCurrenciesOKResponse()) + assert.NoError(t, err) + assert.Subset(t, currencies, requiredAssetIDs) +} diff --git a/services/wallet/thirdparty/mercuryo/request_currencies_test_data.go b/services/wallet/thirdparty/mercuryo/request_currencies_test_data.go new file mode 100644 index 000000000..cdfbf82ed --- /dev/null +++ b/services/wallet/thirdparty/mercuryo/request_currencies_test_data.go @@ -0,0 +1,2153 @@ +package mercuryo + +func getTestCurrenciesOKResponse() []byte { + return []byte(`{ + "status": 200, + "data": { + "fiat": [ + "AED", + "AMD", + "AUD", + "BGN", + "BRL", + "CAD", + "CHF", + "COP", + "CZK", + "DKK", + "DOP", + "EUR", + "GBP", + "GHS", + "HKD", + "HUF", + "IDR", + "ILS", + "INR", + "ISK", + "JOD", + "JPY", + "KRW", + "KZT", + "LKR", + "MXN", + "NOK", + "NZD", + "PEN", + "PHP", + "PLN", + "QAR", + "RON", + "SEK", + "SGD", + "THB", + "TRY", + "TWD", + "USD", + "UYU", + "VND", + "ZAR" + ], + "crypto": [ + "BTC", + "ETH", + "BAT", + "USDT", + "ALGO", + "TRX", + "OKB", + "BCH", + "DAI", + "TON", + "BNB", + "1INCH", + "NEAR", + "SOL", + "DOT", + "ADA", + "KSM", + "MATIC", + "ATOM", + "AVAX", + "XLM", + "XRP", + "LTC", + "SAND", + "DYDX", + "MANA", + "USDC", + "CRV", + "SHIB", + "FTM", + "DOGE", + "LINK", + "XTZ", + "DASH", + "WEMIX", + "TIA", + "ARB", + "NOT", + "SWEAT", + "INJ" + ], + "config": { + "base": { + "BTC": "BTC", + "ETH": "ETH", + "BAT": "ETH", + "USDT": "ETH", + "ALGO": "ALGO", + "TRX": "TRX", + "OKB": "ETH", + "BCH": "BCH", + "DAI": "ETH", + "TON": "TON", + "BNB": "BNB", + "1INCH": "BNB", + "NEAR": "NEAR", + "SOL": "SOL", + "DOT": "DOT", + "ADA": "ADA", + "KSM": "KSM", + "MATIC": "MATIC", + "ATOM": "ATOM", + "AVAX": "AVAX", + "XLM": "XLM", + "XRP": "XRP", + "LTC": "LTC", + "SAND": "ETH", + "DYDX": "ETH", + "MANA": "ETH", + "USDC": "ETH", + "CRV": "ETH", + "SHIB": "ETH", + "FTM": "FTM", + "DOGE": "DOGE", + "LINK": "ETH", + "XTZ": "XTZ", + "DASH": "DASH", + "WEMIX": "WEMIX", + "TIA": "TIA", + "ARB": "ARB", + "NOT": "NOT", + "SWEAT": "NEAR", + "INJ": "INJ" + }, + "has_withdrawal_fee": { + "BTC": true, + "ETH": true, + "BAT": true, + "USDT": true, + "ALGO": true, + "TRX": true, + "OKB": true, + "BCH": true, + "DAI": true, + "TON": false, + "BNB": true, + "1INCH": true, + "NEAR": true, + "SOL": true, + "DOT": true, + "ADA": true, + "KSM": true, + "MATIC": true, + "ATOM": true, + "AVAX": true, + "XLM": true, + "XRP": true, + "LTC": true, + "SAND": true, + "DYDX": true, + "MANA": true, + "USDC": true, + "CRV": true, + "SHIB": true, + "FTM": true, + "DOGE": true, + "LINK": true, + "XTZ": true, + "DASH": true, + "WEMIX": true, + "TIA": true, + "ARB": true, + "NOT": true, + "SWEAT": true, + "INJ": true + }, + "display_options": { + "AED": { + "fullname": "United Arab Emirates Dirham", + "total_digits": 2, + "display_digits": 2 + }, + "AMD": { + "fullname": "Armenian Dram", + "total_digits": 2, + "display_digits": 2 + }, + "ARS": { + "fullname": "Argentine peso", + "total_digits": 2, + "display_digits": 2 + }, + "AUD": { + "fullname": "Australian dollar", + "total_digits": 2, + "display_digits": 2 + }, + "BGN": { + "fullname": "Bulgarian lev", + "total_digits": 2, + "display_digits": 2 + }, + "BRL": { + "fullname": "Brazilian real", + "total_digits": 2, + "display_digits": 2 + }, + "CAD": { + "fullname": "Canadian dollar", + "total_digits": 2, + "display_digits": 2 + }, + "CHF": { + "fullname": "Swiss frank", + "total_digits": 2, + "display_digits": 2 + }, + "COP": { + "fullname": "Colombian Peso", + "total_digits": 2, + "display_digits": 2 + }, + "CZK": { + "fullname": "Czech koruna", + "total_digits": 2, + "display_digits": 2 + }, + "DKK": { + "fullname": "Danish krone", + "total_digits": 2, + "display_digits": 2 + }, + "DOP": { + "fullname": "Dominican Peso", + "total_digits": 2, + "display_digits": 2 + }, + "EUR": { + "fullname": "Euro", + "total_digits": 2, + "display_digits": 2 + }, + "GBP": { + "fullname": "Pound sterling", + "total_digits": 2, + "display_digits": 2 + }, + "GEL": { + "fullname": "Georgian Lari", + "total_digits": 2, + "display_digits": 2 + }, + "GHS": { + "fullname": "Ghanaian cedi", + "total_digits": 2, + "display_digits": 2 + }, + "HKD": { + "fullname": "Hong Kong dollar", + "total_digits": 2, + "display_digits": 2 + }, + "HUF": { + "fullname": "Hungarian Forint", + "total_digits": 2, + "display_digits": 2 + }, + "IDR": { + "fullname": "Indonesian rupiah", + "total_digits": 0, + "display_digits": 0 + }, + "ILS": { + "fullname": "Israeli shekel", + "total_digits": 2, + "display_digits": 2 + }, + "INR": { + "fullname": "Indian rupee", + "total_digits": 2, + "display_digits": 2 + }, + "ISK": { + "fullname": "Icelandic Krona", + "total_digits": 0, + "display_digits": 0 + }, + "JOD": { + "fullname": "Jordanian Dinar", + "total_digits": 2, + "display_digits": 2 + }, + "JPY": { + "fullname": "Japanese yen", + "total_digits": 0, + "display_digits": 0 + }, + "KES": { + "fullname": "Kenyan shilling", + "total_digits": 2, + "display_digits": 2 + }, + "KRW": { + "fullname": "South Korean won", + "total_digits": 0, + "display_digits": 0 + }, + "KZT": { + "fullname": "Kazakhstani Tenge", + "total_digits": 2, + "display_digits": 2 + }, + "LKR": { + "fullname": "Sri Lankan Rupee", + "total_digits": 2, + "display_digits": 2 + }, + "MXN": { + "fullname": "Mexican peso", + "total_digits": 2, + "display_digits": 2 + }, + "NGN": { + "fullname": "Nigerian naira", + "total_digits": 2, + "display_digits": 2 + }, + "NOK": { + "fullname": "Norwegian krone", + "total_digits": 2, + "display_digits": 2 + }, + "NZD": { + "fullname": "New Zealand Dollar", + "total_digits": 2, + "display_digits": 2 + }, + "PEN": { + "fullname": "Peruvian Nuevo Sol", + "total_digits": 2, + "display_digits": 2 + }, + "PHP": { + "fullname": "Philippine peso", + "total_digits": 2, + "display_digits": 2 + }, + "PLN": { + "fullname": "Polish zloty", + "total_digits": 2, + "display_digits": 2 + }, + "QAR": { + "fullname": "Qatari Riyal", + "total_digits": 2, + "display_digits": 2 + }, + "RON": { + "fullname": "New Romanian Lei", + "total_digits": 2, + "display_digits": 2 + }, + "RUB": { + "fullname": "Russian ruble", + "total_digits": 2, + "display_digits": 2 + }, + "SEK": { + "fullname": "Swedish krona", + "total_digits": 2, + "display_digits": 2 + }, + "SGD": { + "fullname": "Singapore Dollar", + "total_digits": 2, + "display_digits": 2 + }, + "THB": { + "fullname": "Thai Baht", + "total_digits": 2, + "display_digits": 2 + }, + "TRY": { + "fullname": "Turkish lira", + "total_digits": 2, + "display_digits": 2 + }, + "TWD": { + "fullname": "New Taiwan dollar", + "total_digits": 2, + "display_digits": 2 + }, + "TZS": { + "fullname": "Tanzanian shilling", + "total_digits": 2, + "display_digits": 2 + }, + "UAH": { + "fullname": "Ukrainian hryvnia", + "total_digits": 2, + "display_digits": 2 + }, + "UGX": { + "fullname": "Ugandan shilling", + "total_digits": 2, + "display_digits": 2 + }, + "USD": { + "fullname": "US dollar", + "total_digits": 2, + "display_digits": 2 + }, + "UYU": { + "fullname": "Uruguayan Peso", + "total_digits": 2, + "display_digits": 2 + }, + "VND": { + "fullname": "Vietnamese Dong", + "total_digits": 2, + "display_digits": 2 + }, + "ZAR": { + "fullname": "South African Rand", + "total_digits": 2, + "display_digits": 2 + }, + "BTC": { + "fullname": "Bitcoin", + "total_digits": 8, + "display_digits": 5 + }, + "ETH": { + "fullname": "ETH", + "total_digits": 18, + "display_digits": 5 + }, + "BAT": { + "fullname": "Basic attention token", + "total_digits": 18, + "display_digits": 5 + }, + "USDT": { + "fullname": "Tether", + "total_digits": 6, + "display_digits": 2 + }, + "ALGO": { + "fullname": "Algorand", + "total_digits": 6, + "display_digits": 6 + }, + "TRX": { + "fullname": "Tron", + "total_digits": 8, + "display_digits": 2 + }, + "OKB": { + "fullname": "OKB", + "total_digits": 18, + "display_digits": 4 + }, + "BCH": { + "fullname": "Bitcoin cash", + "total_digits": 8, + "display_digits": 5 + }, + "DAI": { + "fullname": "Dai Stablecoin", + "total_digits": 18, + "display_digits": 5 + }, + "TON": { + "fullname": "The Open Network", + "total_digits": 9, + "display_digits": 4 + }, + "BNB": { + "fullname": "Binance Coin", + "total_digits": 18, + "display_digits": 6 + }, + "1INCH": { + "fullname": "1inch Network", + "total_digits": 18, + "display_digits": 6 + }, + "NEAR": { + "fullname": "NEAR Protocol", + "total_digits": 18, + "display_digits": 6 + }, + "SOL": { + "fullname": "Solana", + "total_digits": 9, + "display_digits": 6 + }, + "DOT": { + "fullname": "Polkadot", + "total_digits": 10, + "display_digits": 6 + }, + "ADA": { + "fullname": "Cardano", + "total_digits": 18, + "display_digits": 6 + }, + "KSM": { + "fullname": "Kusama", + "total_digits": 18, + "display_digits": 6 + }, + "MATIC": { + "fullname": "Polygon", + "total_digits": 18, + "display_digits": 6 + }, + "ATOM": { + "fullname": "Cosmos", + "total_digits": 18, + "display_digits": 6 + }, + "AVAX": { + "fullname": "Avalanche (C-Chain)", + "total_digits": 18, + "display_digits": 6 + }, + "XLM": { + "fullname": "Stellar", + "total_digits": 18, + "display_digits": 6 + }, + "XRP": { + "fullname": "XRP", + "total_digits": 6, + "display_digits": 6 + }, + "LTC": { + "fullname": "Litecoin", + "total_digits": 8, + "display_digits": 8 + }, + "SAND": { + "fullname": "The Sandbox", + "total_digits": 18, + "display_digits": 6 + }, + "DYDX": { + "fullname": "dYdX", + "total_digits": 18, + "display_digits": 6 + }, + "MANA": { + "fullname": "Decentraland", + "total_digits": 18, + "display_digits": 6 + }, + "USDC": { + "fullname": "USDC", + "total_digits": 6, + "display_digits": 6 + }, + "CRV": { + "fullname": "Curve DAO Token", + "total_digits": 18, + "display_digits": 6 + }, + "SHIB": { + "fullname": "Shiba Inu", + "total_digits": 18, + "display_digits": 6 + }, + "FTM": { + "fullname": "Fantom", + "total_digits": 18, + "display_digits": 6 + }, + "DOGE": { + "fullname": "Dogecoin", + "total_digits": 8, + "display_digits": 8 + }, + "LINK": { + "fullname": "Chainlink", + "total_digits": 18, + "display_digits": 6 + }, + "XTZ": { + "fullname": "Tezos", + "total_digits": 18, + "display_digits": 6 + }, + "DASH": { + "fullname": "DASH", + "total_digits": 18, + "display_digits": 6 + }, + "WEMIX": { + "fullname": "WEMIX", + "total_digits": 10, + "display_digits": 6 + }, + "TIA": { + "fullname": "TIA", + "total_digits": 10, + "display_digits": 6 + }, + "ARB": { + "fullname": "ARB", + "total_digits": 10, + "display_digits": 6 + }, + "NOT": { + "fullname": "NOTCOIN", + "total_digits": 10, + "display_digits": 3 + }, + "SWEAT": { + "fullname": "Sweat", + "total_digits": 18, + "display_digits": 4 + }, + "INJ": { + "fullname": "Injective", + "total_digits": 18, + "display_digits": 6 + } + }, + "icons": { + "AED": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/aed.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/aed.svg", + "png": "v1.6/img/icons/currencies/aed.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/aed.png" + }, + "AMD": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/amd.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/amd.svg", + "png": "v1.6/img/icons/currencies/amd.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/amd.png" + }, + "ARS": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/ars.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/ars.svg", + "png": "v1.6/img/icons/currencies/ars.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/ars.png" + }, + "AUD": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/aud.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/aud.svg", + "png": "v1.6/img/icons/currencies/aud.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/aud.png" + }, + "BGN": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/bgn.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/bgn.svg", + "png": "v1.6/img/icons/currencies/bgn.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/bgn.png" + }, + "BRL": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/brl.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/brl.svg", + "png": "v1.6/img/icons/currencies/brl.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/brl.png" + }, + "CAD": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/cad.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/cad.svg", + "png": "v1.6/img/icons/currencies/cad.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/cad.png" + }, + "CHF": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/chf.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/chf.svg", + "png": "v1.6/img/icons/currencies/chf.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/chf.png" + }, + "COP": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/cop.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/cop.svg", + "png": "v1.6/img/icons/currencies/cop.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/cop.png" + }, + "CZK": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/czk.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/czk.svg", + "png": "v1.6/img/icons/currencies/czk.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/czk.png" + }, + "DKK": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/dkk.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/dkk.svg", + "png": "v1.6/img/icons/currencies/dkk.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/dkk.png" + }, + "DOP": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/dop.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/dop.svg", + "png": "v1.6/img/icons/currencies/dop.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/dop.png" + }, + "EUR": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/eur.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/eur.svg", + "png": "v1.6/img/icons/currencies/eur.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/eur.png" + }, + "GBP": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/gbp.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/gbp.svg", + "png": "v1.6/img/icons/currencies/gbp.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/gbp.png" + }, + "GEL": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/default.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/default.svg", + "png": "v1.6/img/icons/currencies/default.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/default.png" + }, + "GHS": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/ghs.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/ghs.svg", + "png": "v1.6/img/icons/currencies/ghs.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/ghs.png" + }, + "HKD": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/hkd.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/hkd.svg", + "png": "v1.6/img/icons/currencies/hkd.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/hkd.png" + }, + "HUF": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/huf.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/huf.svg", + "png": "v1.6/img/icons/currencies/huf.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/huf.png" + }, + "IDR": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/idr.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/idr.svg", + "png": "v1.6/img/icons/currencies/idr.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/idr.png" + }, + "ILS": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/ils.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/ils.svg", + "png": "v1.6/img/icons/currencies/ils.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/ils.png" + }, + "INR": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/inr.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/inr.svg", + "png": "v1.6/img/icons/currencies/inr.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/inr.png" + }, + "ISK": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/isk.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/isk.svg", + "png": "v1.6/img/icons/currencies/isk.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/isk.png" + }, + "JOD": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/jod.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/jod.svg", + "png": "v1.6/img/icons/currencies/jod.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/jod.png" + }, + "JPY": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/jpy.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/jpy.svg", + "png": "v1.6/img/icons/currencies/jpy.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/jpy.png" + }, + "KES": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/kes.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/kes.svg", + "png": "v1.6/img/icons/currencies/kes.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/kes.png" + }, + "KRW": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/krw.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/krw.svg", + "png": "v1.6/img/icons/currencies/krw.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/krw.png" + }, + "KZT": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/kzt.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/kzt.svg", + "png": "v1.6/img/icons/currencies/kzt.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/kzt.png" + }, + "LKR": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/lkr.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/lkr.svg", + "png": "v1.6/img/icons/currencies/lkr.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/lkr.png" + }, + "MXN": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/mxn.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/mxn.svg", + "png": "v1.6/img/icons/currencies/mxn.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/mxn.png" + }, + "NGN": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/ngn.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/ngn.svg", + "png": "v1.6/img/icons/currencies/ngn.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/ngn.png" + }, + "NOK": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/nok.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/nok.svg", + "png": "v1.6/img/icons/currencies/nok.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/nok.png" + }, + "NZD": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/nzd.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/nzd.svg", + "png": "v1.6/img/icons/currencies/nzd.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/nzd.png" + }, + "PEN": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/pen.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/pen.svg", + "png": "v1.6/img/icons/currencies/pen.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/pen.png" + }, + "PHP": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/php.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/php.svg", + "png": "v1.6/img/icons/currencies/php.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/php.png" + }, + "PLN": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/pln.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/pln.svg", + "png": "v1.6/img/icons/currencies/pln.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/pln.png" + }, + "QAR": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/qar.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/qar.svg", + "png": "v1.6/img/icons/currencies/qar.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/qar.png" + }, + "RON": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/ron.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/ron.svg", + "png": "v1.6/img/icons/currencies/ron.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/ron.png" + }, + "RUB": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/rub.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/rub.svg", + "png": "v1.6/img/icons/currencies/rub.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/rub.png" + }, + "SEK": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/sek.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/sek.svg", + "png": "v1.6/img/icons/currencies/sek.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/sek.png" + }, + "SGD": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/sgd.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/sgd.svg", + "png": "v1.6/img/icons/currencies/sgd.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/sgd.png" + }, + "THB": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/thb.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/thb.svg", + "png": "v1.6/img/icons/currencies/thb.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/thb.png" + }, + "TRY": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/try.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/try.svg", + "png": "v1.6/img/icons/currencies/try.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/try.png" + }, + "TWD": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/twd.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/twd.svg", + "png": "v1.6/img/icons/currencies/twd.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/twd.png" + }, + "TZS": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/tzs.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/tzs.svg", + "png": "v1.6/img/icons/currencies/tzs.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/tzs.png" + }, + "UAH": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/uah.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/uah.svg", + "png": "v1.6/img/icons/currencies/uah.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/uah.png" + }, + "UGX": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/ugx.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/ugx.svg", + "png": "v1.6/img/icons/currencies/ugx.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/ugx.png" + }, + "USD": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/usd.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/usd.svg", + "png": "v1.6/img/icons/currencies/usd.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/usd.png" + }, + "UYU": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/uyu.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/uyu.svg", + "png": "v1.6/img/icons/currencies/uyu.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/uyu.png" + }, + "VND": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/vnd.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/vnd.svg", + "png": "v1.6/img/icons/currencies/vnd.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/vnd.png" + }, + "ZAR": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/zar.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/zar.svg", + "png": "v1.6/img/icons/currencies/zar.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/zar.png" + }, + "BTC": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/btc.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/btc.svg", + "png": "v1.6/img/icons/currencies/btc.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/btc.png" + }, + "ETH": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/eth.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/eth.svg", + "png": "v1.6/img/icons/currencies/eth.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/eth.png" + }, + "BAT": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/bat.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/bat.svg", + "png": "v1.6/img/icons/currencies/bat.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/bat.png" + }, + "USDT": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/usdt.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/usdt.svg", + "png": "v1.6/img/icons/currencies/usdt.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/usdt.png" + }, + "ALGO": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/algo.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/algo.svg", + "png": "v1.6/img/icons/currencies/algo.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/algo.png" + }, + "TRX": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/trx.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/trx.svg", + "png": "v1.6/img/icons/currencies/trx.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/trx.png" + }, + "OKB": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/okb.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/okb.svg", + "png": "v1.6/img/icons/currencies/okb.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/okb.png" + }, + "BCH": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/bch.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/bch.svg", + "png": "v1.6/img/icons/currencies/bch.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/bch.png" + }, + "DAI": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/dai.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/dai.svg", + "png": "v1.6/img/icons/currencies/dai.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/dai.png" + }, + "TON": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/ton.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/ton.svg", + "png": "v1.6/img/icons/currencies/ton.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/ton.png" + }, + "BNB": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/bnb.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/bnb.svg", + "png": "v1.6/img/icons/currencies/bnb.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/bnb.png" + }, + "1INCH": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/1inch.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/1inch.svg", + "png": "v1.6/img/icons/currencies/1inch.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/1inch.png" + }, + "NEAR": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/near.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/near.svg", + "png": "v1.6/img/icons/currencies/near.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/near.png" + }, + "SOL": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/sol.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/sol.svg", + "png": "v1.6/img/icons/currencies/sol.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/sol.png" + }, + "DOT": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/dot.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/dot.svg", + "png": "v1.6/img/icons/currencies/dot.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/dot.png" + }, + "ADA": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/ada.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/ada.svg", + "png": "v1.6/img/icons/currencies/ada.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/ada.png" + }, + "KSM": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/ksm.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/ksm.svg", + "png": "v1.6/img/icons/currencies/ksm.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/ksm.png" + }, + "MATIC": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/matic.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/matic.svg", + "png": "v1.6/img/icons/currencies/matic.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/matic.png" + }, + "ATOM": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/atom.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/atom.svg", + "png": "v1.6/img/icons/currencies/atom.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/atom.png" + }, + "AVAX": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/avax.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/avax.svg", + "png": "v1.6/img/icons/currencies/avax.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/avax.png" + }, + "XLM": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/xlm.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/xlm.svg", + "png": "v1.6/img/icons/currencies/xlm.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/xlm.png" + }, + "XRP": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/xrp.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/xrp.svg", + "png": "v1.6/img/icons/currencies/xrp.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/xrp.png" + }, + "LTC": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/ltc.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/ltc.svg", + "png": "v1.6/img/icons/currencies/ltc.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/ltc.png" + }, + "SAND": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/sand.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/sand.svg", + "png": "v1.6/img/icons/currencies/sand.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/sand.png" + }, + "DYDX": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/dydx.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/dydx.svg", + "png": "v1.6/img/icons/currencies/dydx.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/dydx.png" + }, + "MANA": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/mana.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/mana.svg", + "png": "v1.6/img/icons/currencies/mana.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/mana.png" + }, + "USDC": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/usdc.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/usdc.svg", + "png": "v1.6/img/icons/currencies/usdc.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/usdc.png" + }, + "CRV": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/crv.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/crv.svg", + "png": "v1.6/img/icons/currencies/crv.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/crv.png" + }, + "SHIB": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/shib.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/shib.svg", + "png": "v1.6/img/icons/currencies/shib.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/shib.png" + }, + "FTM": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/ftm.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/ftm.svg", + "png": "v1.6/img/icons/currencies/ftm.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/ftm.png" + }, + "DOGE": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/doge.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/doge.svg", + "png": "v1.6/img/icons/currencies/doge.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/doge.png" + }, + "LINK": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/link.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/link.svg", + "png": "v1.6/img/icons/currencies/link.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/link.png" + }, + "XTZ": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/xtz.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/xtz.svg", + "png": "v1.6/img/icons/currencies/xtz.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/xtz.png" + }, + "DASH": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/dash.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/dash.svg", + "png": "v1.6/img/icons/currencies/dash.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/dash.png" + }, + "WEMIX": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/wemix.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/wemix.svg", + "png": "v1.6/img/icons/currencies/wemix.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/wemix.png" + }, + "TIA": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/tia.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/tia.svg", + "png": "v1.6/img/icons/currencies/tia.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/tia.png" + }, + "ARB": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/arb.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/arb.svg", + "png": "v1.6/img/icons/currencies/arb.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/arb.png" + }, + "NOT": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/not.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/not.svg", + "png": "v1.6/img/icons/currencies/not.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/not.png" + }, + "SWEAT": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/sweat.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/sweat.svg", + "png": "v1.6/img/icons/currencies/sweat.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/sweat.png" + }, + "INJ": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/currencies/inj.svg", + "relative": { + "svg": "v1.6/img/icons/currencies/inj.svg", + "png": "v1.6/img/icons/currencies/inj.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/currencies/inj.png" + } + }, + "networks": { + "ALGORAND": { + "name": "ALGORAND", + "icons": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/networks/default.svg", + "relative": { + "svg": "v1.6/img/icons/networks/default.svg", + "png": "v1.6/img/icons/networks/default.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/networks/default.png" + } + }, + "ARBITRUM": { + "name": "ARBITRUM", + "icons": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/networks/arbitrum.svg", + "relative": { + "svg": "v1.6/img/icons/networks/arbitrum.svg", + "png": "v1.6/img/icons/networks/arbitrum.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/networks/arbitrum.png" + } + }, + "AVALANCHE": { + "name": "AVALANCHE", + "icons": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/networks/default.svg", + "relative": { + "svg": "v1.6/img/icons/networks/default.svg", + "png": "v1.6/img/icons/networks/default.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/networks/default.png" + } + }, + "BASE": { + "name": "BASE", + "icons": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/networks/base.svg", + "relative": { + "svg": "v1.6/img/icons/networks/base.svg", + "png": "v1.6/img/icons/networks/base.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/networks/base.png" + } + }, + "BINANCESMARTCHAIN": { + "name": "BINANCESMARTCHAIN", + "icons": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/networks/binancesmartchain.svg", + "relative": { + "svg": "v1.6/img/icons/networks/binancesmartchain.svg", + "png": "v1.6/img/icons/networks/binancesmartchain.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/networks/binancesmartchain.png" + } + }, + "BITCOIN": { + "name": "BITCOIN", + "icons": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/networks/default.svg", + "relative": { + "svg": "v1.6/img/icons/networks/default.svg", + "png": "v1.6/img/icons/networks/default.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/networks/default.png" + } + }, + "BITCOINCASH": { + "name": "BITCOINCASH", + "icons": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/networks/default.svg", + "relative": { + "svg": "v1.6/img/icons/networks/default.svg", + "png": "v1.6/img/icons/networks/default.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/networks/default.png" + } + }, + "CARDANO": { + "name": "CARDANO", + "icons": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/networks/default.svg", + "relative": { + "svg": "v1.6/img/icons/networks/default.svg", + "png": "v1.6/img/icons/networks/default.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/networks/default.png" + } + }, + "CELESTIA": { + "name": "CELESTIA", + "icons": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/networks/celestia.svg", + "relative": { + "svg": "v1.6/img/icons/networks/celestia.svg", + "png": "v1.6/img/icons/networks/celestia.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/networks/celestia.png" + } + }, + "COSMOS": { + "name": "COSMOS", + "icons": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/networks/default.svg", + "relative": { + "svg": "v1.6/img/icons/networks/default.svg", + "png": "v1.6/img/icons/networks/default.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/networks/default.png" + } + }, + "CRONOS": { + "name": "CRONOS", + "icons": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/networks/default.svg", + "relative": { + "svg": "v1.6/img/icons/networks/default.svg", + "png": "v1.6/img/icons/networks/default.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/networks/default.png" + } + }, + "DASH": { + "name": "DASH", + "icons": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/networks/default.svg", + "relative": { + "svg": "v1.6/img/icons/networks/default.svg", + "png": "v1.6/img/icons/networks/default.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/networks/default.png" + } + }, + "DOGECOIN": { + "name": "DOGECOIN", + "icons": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/networks/default.svg", + "relative": { + "svg": "v1.6/img/icons/networks/default.svg", + "png": "v1.6/img/icons/networks/default.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/networks/default.png" + } + }, + "ETHEREUM": { + "name": "ETHEREUM", + "icons": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/networks/ethereum.svg", + "relative": { + "svg": "v1.6/img/icons/networks/ethereum.svg", + "png": "v1.6/img/icons/networks/ethereum.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/networks/ethereum.png" + } + }, + "FANTOM": { + "name": "FANTOM", + "icons": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/networks/default.svg", + "relative": { + "svg": "v1.6/img/icons/networks/default.svg", + "png": "v1.6/img/icons/networks/default.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/networks/default.png" + } + }, + "FLOW": { + "name": "FLOW", + "icons": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/networks/default.svg", + "relative": { + "svg": "v1.6/img/icons/networks/default.svg", + "png": "v1.6/img/icons/networks/default.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/networks/default.png" + } + }, + "INJECTIVE": { + "name": "INJECTIVE", + "icons": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/networks/injective.svg", + "relative": { + "svg": "v1.6/img/icons/networks/injective.svg", + "png": "v1.6/img/icons/networks/injective.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/networks/injective.png" + } + }, + "KAVA": { + "name": "KAVA", + "icons": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/networks/default.svg", + "relative": { + "svg": "v1.6/img/icons/networks/default.svg", + "png": "v1.6/img/icons/networks/default.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/networks/default.png" + } + }, + "KUSAMA": { + "name": "KUSAMA", + "icons": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/networks/default.svg", + "relative": { + "svg": "v1.6/img/icons/networks/default.svg", + "png": "v1.6/img/icons/networks/default.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/networks/default.png" + } + }, + "LINEA": { + "name": "LINEA", + "icons": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/networks/linea.svg", + "relative": { + "svg": "v1.6/img/icons/networks/linea.svg", + "png": "v1.6/img/icons/networks/linea.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/networks/linea.png" + } + }, + "LITECOIN": { + "name": "LITECOIN", + "icons": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/networks/default.svg", + "relative": { + "svg": "v1.6/img/icons/networks/default.svg", + "png": "v1.6/img/icons/networks/default.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/networks/default.png" + } + }, + "NEAR_PROTOCOL": { + "name": "NEAR_PROTOCOL", + "icons": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/networks/near_protocol.svg", + "relative": { + "svg": "v1.6/img/icons/networks/near_protocol.svg", + "png": "v1.6/img/icons/networks/near_protocol.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/networks/near_protocol.png" + } + }, + "NEWTON": { + "name": "NEWTON", + "icons": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/networks/default.svg", + "relative": { + "svg": "v1.6/img/icons/networks/default.svg", + "png": "v1.6/img/icons/networks/default.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/networks/default.png" + } + }, + "OPTIMISM": { + "name": "OPTIMISM", + "icons": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/networks/optimism.svg", + "relative": { + "svg": "v1.6/img/icons/networks/optimism.svg", + "png": "v1.6/img/icons/networks/optimism.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/networks/optimism.png" + } + }, + "POLKADOT": { + "name": "POLKADOT", + "icons": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/networks/default.svg", + "relative": { + "svg": "v1.6/img/icons/networks/default.svg", + "png": "v1.6/img/icons/networks/default.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/networks/default.png" + } + }, + "POLYGON": { + "name": "POLYGON", + "icons": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/networks/polygon.svg", + "relative": { + "svg": "v1.6/img/icons/networks/polygon.svg", + "png": "v1.6/img/icons/networks/polygon.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/networks/polygon.png" + } + }, + "RIPPLE": { + "name": "RIPPLE", + "icons": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/networks/default.svg", + "relative": { + "svg": "v1.6/img/icons/networks/default.svg", + "png": "v1.6/img/icons/networks/default.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/networks/default.png" + } + }, + "SOLANA": { + "name": "SOLANA", + "icons": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/networks/solana.svg", + "relative": { + "svg": "v1.6/img/icons/networks/solana.svg", + "png": "v1.6/img/icons/networks/solana.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/networks/solana.png" + } + }, + "STELLAR": { + "name": "STELLAR", + "icons": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/networks/stellar.svg", + "relative": { + "svg": "v1.6/img/icons/networks/stellar.svg", + "png": "v1.6/img/icons/networks/stellar.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/networks/stellar.png" + } + }, + "TERRA": { + "name": "TERRA", + "icons": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/networks/terra.svg", + "relative": { + "svg": "v1.6/img/icons/networks/terra.svg", + "png": "v1.6/img/icons/networks/terra.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/networks/terra.png" + } + }, + "TEZOS": { + "name": "TEZOS", + "icons": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/networks/default.svg", + "relative": { + "svg": "v1.6/img/icons/networks/default.svg", + "png": "v1.6/img/icons/networks/default.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/networks/default.png" + } + }, + "TRON": { + "name": "TRON", + "icons": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/networks/tron.svg", + "relative": { + "svg": "v1.6/img/icons/networks/tron.svg", + "png": "v1.6/img/icons/networks/tron.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/networks/tron.png" + } + }, + "WEMIX": { + "name": "WEMIX", + "icons": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/networks/wemix.svg", + "relative": { + "svg": "v1.6/img/icons/networks/wemix.svg", + "png": "v1.6/img/icons/networks/wemix.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/networks/wemix.png" + } + }, + "ZKSYNC": { + "name": "ZKSYNC", + "icons": { + "svg": "https://api.mercuryo.io/v1.6/img/icons/networks/zksync.svg", + "relative": { + "svg": "v1.6/img/icons/networks/zksync.svg", + "png": "v1.6/img/icons/networks/zksync.png" + }, + "png": "https://api.mercuryo.io/v1.6/img/icons/networks/zksync.png" + } + } + }, + "crypto_currencies": [ + { + "currency": "BTC", + "network": "BITCOIN", + "show_network_icon": false, + "network_label": "BITCOIN", + "contract": "" + }, + { + "currency": "ETH", + "network": "ZKSYNC", + "show_network_icon": true, + "network_label": "ZKSYNC", + "contract": "" + }, + { + "currency": "ETH", + "network": "ARBITRUM", + "show_network_icon": true, + "network_label": "ARBITRUM", + "contract": "" + }, + { + "currency": "ETH", + "network": "OPTIMISM", + "show_network_icon": true, + "network_label": "OPTIMISM", + "contract": "" + }, + { + "currency": "ETH", + "network": "BASE", + "show_network_icon": true, + "network_label": "BASE", + "contract": "" + }, + { + "currency": "ETH", + "network": "LINEA", + "show_network_icon": true, + "network_label": "LINEA", + "contract": "" + }, + { + "currency": "ETH", + "network": "ETHEREUM", + "show_network_icon": true, + "network_label": "ETHEREUM", + "contract": "" + }, + { + "currency": "BAT", + "network": "ETHEREUM", + "show_network_icon": true, + "network_label": "ERC-20", + "contract": "0x0d8775f648430679a709e98d2b0cb6250d2887ef" + }, + { + "currency": "USDT", + "network": "POLYGON", + "show_network_icon": true, + "network_label": "POLYGON", + "contract": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F" + }, + { + "currency": "USDT", + "network": "NEWTON", + "show_network_icon": true, + "network_label": "TON", + "contract": "EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs" + }, + { + "currency": "USDT", + "network": "ETHEREUM", + "show_network_icon": true, + "network_label": "ERC-20", + "contract": "0xdac17f958d2ee523a2206206994597c13d831ec7", + "network_ud": "ERC20" + }, + { + "currency": "USDT", + "network": "TRON", + "show_network_icon": true, + "network_label": "TRC-20", + "contract": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t", + "network_ud": "TRON" + }, + { + "currency": "ALGO", + "network": "ALGORAND", + "show_network_icon": false, + "network_label": "ALGORAND", + "contract": "" + }, + { + "currency": "TRX", + "network": "TRON", + "show_network_icon": false, + "network_label": "TRC-20", + "contract": "" + }, + { + "currency": "OKB", + "network": "ETHEREUM", + "show_network_icon": true, + "network_label": "ERC-20", + "contract": "0x75231f58b43240c9718dd58b4967c5114342a86c" + }, + { + "currency": "BCH", + "network": "BITCOINCASH", + "show_network_icon": false, + "network_label": "BITCOINCASH", + "contract": "" + }, + { + "currency": "DAI", + "network": "ETHEREUM", + "show_network_icon": true, + "network_label": "ERC-20", + "contract": "0x6b175474e89094c44da98b954eedeac495271d0f" + }, + { + "currency": "TON", + "network": "NEWTON", + "show_network_icon": false, + "network_label": "NEWTON", + "contract": "" + }, + { + "currency": "BNB", + "network": "BINANCESMARTCHAIN", + "show_network_icon": false, + "network_label": "BEP-20", + "contract": "" + }, + { + "currency": "1INCH", + "network": "BINANCESMARTCHAIN", + "show_network_icon": true, + "network_label": "BEP-20", + "contract": "0x111111111117dc0aa78b770fa6a738034120c302" + }, + { + "currency": "NEAR", + "network": "NEAR_PROTOCOL", + "show_network_icon": false, + "network_label": "NEAR_PROTOCOL", + "contract": "" + }, + { + "currency": "SOL", + "network": "SOLANA", + "show_network_icon": false, + "network_label": "SOLANA", + "contract": "" + }, + { + "currency": "DOT", + "network": "POLKADOT", + "show_network_icon": false, + "network_label": "POLKADOT", + "contract": "" + }, + { + "currency": "ADA", + "network": "CARDANO", + "show_network_icon": false, + "network_label": "CARDANO", + "contract": "" + }, + { + "currency": "KSM", + "network": "KUSAMA", + "show_network_icon": false, + "network_label": "KUSAMA", + "contract": "" + }, + { + "currency": "MATIC", + "network": "POLYGON", + "show_network_icon": false, + "network_label": "POLYGON", + "contract": "", + "network_ud": "MATIC" + }, + { + "currency": "ATOM", + "network": "COSMOS", + "show_network_icon": false, + "network_label": "COSMOS", + "contract": "" + }, + { + "currency": "AVAX", + "network": "AVALANCHE", + "show_network_icon": false, + "network_label": "AVALANCHE", + "contract": "" + }, + { + "currency": "XLM", + "network": "STELLAR", + "show_network_icon": false, + "network_label": "STELLAR", + "contract": "" + }, + { + "currency": "XRP", + "network": "RIPPLE", + "show_network_icon": false, + "network_label": "RIPPLE", + "contract": "" + }, + { + "currency": "LTC", + "network": "LITECOIN", + "show_network_icon": false, + "network_label": "LITECOIN", + "contract": "" + }, + { + "currency": "SAND", + "network": "ETHEREUM", + "show_network_icon": true, + "network_label": "ERC-20", + "contract": "0x3845badade8e6dff049820680d1f14bd3903a5d0", + "network_ud": "ERC20" + }, + { + "currency": "DYDX", + "network": "ETHEREUM", + "show_network_icon": true, + "network_label": "ERC-20", + "contract": "0x92d6c1e31e14520e676a687f0a93788b716beff5" + }, + { + "currency": "MANA", + "network": "ETHEREUM", + "show_network_icon": true, + "network_label": "ERC-20", + "contract": "0x0f5d2fb29fb7d3cfee444a200298f468908cc942", + "network_ud": "ERC20" + }, + { + "currency": "USDC", + "network": "ETHEREUM", + "show_network_icon": true, + "network_label": "ETHEREUM", + "contract": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" + }, + { + "currency": "USDC", + "network": "POLYGON", + "show_network_icon": true, + "network_label": "POLYGON", + "contract": "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359" + }, + { + "currency": "USDC", + "network": "ARBITRUM", + "show_network_icon": true, + "network_label": "ARBITRUM", + "contract": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831" + }, + { + "currency": "USDC", + "network": "NEAR_PROTOCOL", + "show_network_icon": true, + "network_label": "NEAR", + "contract": "17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1" + }, + { + "currency": "USDC", + "network": "SOLANA", + "show_network_icon": true, + "network_label": "SOLANA", + "contract": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" + }, + { + "currency": "USDC", + "network": "STELLAR", + "show_network_icon": true, + "network_label": "STELLAR", + "contract": "GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN" + }, + { + "currency": "CRV", + "network": "ETHEREUM", + "show_network_icon": true, + "network_label": "ERC-20", + "contract": "0xd533a949740bb3306d119cc777fa900ba034cd52", + "network_ud": "ERC20" + }, + { + "currency": "SHIB", + "network": "ETHEREUM", + "show_network_icon": true, + "network_label": "ERC-20", + "contract": "0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE", + "network_ud": "ERC20" + }, + { + "currency": "FTM", + "network": "FANTOM", + "show_network_icon": false, + "network_label": "FANTOM", + "contract": "" + }, + { + "currency": "DOGE", + "network": "DOGECOIN", + "show_network_icon": false, + "network_label": "DOGECOIN", + "contract": "" + }, + { + "currency": "LINK", + "network": "ETHEREUM", + "show_network_icon": true, + "network_label": "ERC-20", + "contract": "0x514910771AF9Ca656af840dff83E8264EcF986CA" + }, + { + "currency": "XTZ", + "network": "TEZOS", + "show_network_icon": false, + "network_label": "TEZOS", + "contract": "" + }, + { + "currency": "DASH", + "network": "DASH", + "show_network_icon": false, + "network_label": "DASH", + "contract": "" + }, + { + "currency": "WEMIX", + "network": "WEMIX", + "show_network_icon": false, + "network_label": "WEMIX", + "contract": "" + }, + { + "currency": "TIA", + "network": "CELESTIA", + "show_network_icon": false, + "network_label": "CELESTIA", + "contract": "" + }, + { + "currency": "ARB", + "network": "ARBITRUM", + "show_network_icon": true, + "network_label": "ARBITRUM", + "contract": "0x912CE59144191C1204E64559FE8253a0e49E6548" + }, + { + "currency": "NOT", + "network": "NEWTON", + "show_network_icon": true, + "network_label": "TON", + "contract": "EQAvlWFDxGF2lXm67y4yzC17wYKD9A0guwPkMs1gOsM__NOT" + }, + { + "currency": "SWEAT", + "network": "NEAR_PROTOCOL", + "show_network_icon": true, + "network_label": "NEAR", + "contract": "token.sweat" + }, + { + "currency": "INJ", + "network": "INJECTIVE", + "show_network_icon": false, + "network_label": "INJECTIVE", + "contract": "" + } + ], + "default_networks": { + "BTC": "BITCOIN", + "ETH": "ETHEREUM", + "BAT": "ETHEREUM", + "USDT": "ETHEREUM", + "ALGO": "ALGORAND", + "TRX": "TRON", + "OKB": "ETHEREUM", + "BCH": "BITCOINCASH", + "DAI": "ETHEREUM", + "TON": "NEWTON", + "BNB": "BINANCESMARTCHAIN", + "1INCH": "BINANCESMARTCHAIN", + "NEAR": "NEAR_PROTOCOL", + "SOL": "SOLANA", + "DOT": "POLKADOT", + "ADA": "CARDANO", + "KSM": "KUSAMA", + "MATIC": "POLYGON", + "ATOM": "COSMOS", + "AVAX": "AVALANCHE", + "XLM": "STELLAR", + "XRP": "RIPPLE", + "LTC": "LITECOIN", + "SAND": "ETHEREUM", + "DYDX": "ETHEREUM", + "MANA": "ETHEREUM", + "USDC": "ETHEREUM", + "CRV": "ETHEREUM", + "SHIB": "ETHEREUM", + "FTM": "FANTOM", + "DOGE": "DOGECOIN", + "LINK": "ETHEREUM", + "XTZ": "TEZOS", + "DASH": "DASH", + "WEMIX": "WEMIX", + "TIA": "CELESTIA", + "ARB": "ARBITRUM", + "NOT": "NEWTON", + "SWEAT": "NEAR_PROTOCOL", + "INJ": "INJECTIVE" + } + } + } + }`) +} diff --git a/services/wallet/thirdparty/mercuryo/types.go b/services/wallet/thirdparty/mercuryo/types.go new file mode 100644 index 000000000..12f3d9c5a --- /dev/null +++ b/services/wallet/thirdparty/mercuryo/types.go @@ -0,0 +1,28 @@ +package mercuryo + +import walletCommon "github.com/status-im/status-go/services/wallet/common" + +func NetworkToCommonChainID(network string) uint64 { + switch network { + case "ETHEREUM": + return walletCommon.EthereumMainnet + case "OPTIMISM": + return walletCommon.OptimismMainnet + case "ARBITRUM": + return walletCommon.ArbitrumMainnet + } + return walletCommon.UnknownChainID +} + +func CommonChainIDToNetwork(chainID uint64) string { + switch chainID { + case walletCommon.EthereumMainnet: + return "ETHEREUM" + case walletCommon.ArbitrumMainnet: + return "ARBITRUM" + case walletCommon.OptimismMainnet: + return "OPTIMISM" + default: + return "" + } +} diff --git a/vendor/go.uber.org/mock/gomock/call.go b/vendor/go.uber.org/mock/gomock/call.go new file mode 100644 index 000000000..e1ea82637 --- /dev/null +++ b/vendor/go.uber.org/mock/gomock/call.go @@ -0,0 +1,508 @@ +// Copyright 2010 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package gomock + +import ( + "fmt" + "reflect" + "strconv" + "strings" +) + +// Call represents an expected call to a mock. +type Call struct { + t TestHelper // for triggering test failures on invalid call setup + + receiver any // the receiver of the method call + method string // the name of the method + methodType reflect.Type // the type of the method + args []Matcher // the args + origin string // file and line number of call setup + + preReqs []*Call // prerequisite calls + + // Expectations + minCalls, maxCalls int + + numCalls int // actual number made + + // actions are called when this Call is called. Each action gets the args and + // can set the return values by returning a non-nil slice. Actions run in the + // order they are created. + actions []func([]any) []any +} + +// newCall creates a *Call. It requires the method type in order to support +// unexported methods. +func newCall(t TestHelper, receiver any, method string, methodType reflect.Type, args ...any) *Call { + t.Helper() + + // TODO: check arity, types. + mArgs := make([]Matcher, len(args)) + for i, arg := range args { + if m, ok := arg.(Matcher); ok { + mArgs[i] = m + } else if arg == nil { + // Handle nil specially so that passing a nil interface value + // will match the typed nils of concrete args. + mArgs[i] = Nil() + } else { + mArgs[i] = Eq(arg) + } + } + + // callerInfo's skip should be updated if the number of calls between the user's test + // and this line changes, i.e. this code is wrapped in another anonymous function. + // 0 is us, 1 is RecordCallWithMethodType(), 2 is the generated recorder, and 3 is the user's test. + origin := callerInfo(3) + actions := []func([]any) []any{func([]any) []any { + // Synthesize the zero value for each of the return args' types. + rets := make([]any, methodType.NumOut()) + for i := 0; i < methodType.NumOut(); i++ { + rets[i] = reflect.Zero(methodType.Out(i)).Interface() + } + return rets + }} + return &Call{t: t, receiver: receiver, method: method, methodType: methodType, + args: mArgs, origin: origin, minCalls: 1, maxCalls: 1, actions: actions} +} + +// AnyTimes allows the expectation to be called 0 or more times +func (c *Call) AnyTimes() *Call { + c.minCalls, c.maxCalls = 0, 1e8 // close enough to infinity + return c +} + +// MinTimes requires the call to occur at least n times. If AnyTimes or MaxTimes have not been called or if MaxTimes +// was previously called with 1, MinTimes also sets the maximum number of calls to infinity. +func (c *Call) MinTimes(n int) *Call { + c.minCalls = n + if c.maxCalls == 1 { + c.maxCalls = 1e8 + } + return c +} + +// MaxTimes limits the number of calls to n times. If AnyTimes or MinTimes have not been called or if MinTimes was +// previously called with 1, MaxTimes also sets the minimum number of calls to 0. +func (c *Call) MaxTimes(n int) *Call { + c.maxCalls = n + if c.minCalls == 1 { + c.minCalls = 0 + } + return c +} + +// DoAndReturn declares the action to run when the call is matched. +// The return values from this function are returned by the mocked function. +// It takes an any argument to support n-arity functions. +// The anonymous function must match the function signature mocked method. +func (c *Call) DoAndReturn(f any) *Call { + // TODO: Check arity and types here, rather than dying badly elsewhere. + v := reflect.ValueOf(f) + + c.addAction(func(args []any) []any { + c.t.Helper() + ft := v.Type() + if c.methodType.NumIn() != ft.NumIn() { + if ft.IsVariadic() { + c.t.Fatalf("wrong number of arguments in DoAndReturn func for %T.%v The function signature must match the mocked method, a variadic function cannot be used.", + c.receiver, c.method) + } else { + c.t.Fatalf("wrong number of arguments in DoAndReturn func for %T.%v: got %d, want %d [%s]", + c.receiver, c.method, ft.NumIn(), c.methodType.NumIn(), c.origin) + } + return nil + } + vArgs := make([]reflect.Value, len(args)) + for i := 0; i < len(args); i++ { + if args[i] != nil { + vArgs[i] = reflect.ValueOf(args[i]) + } else { + // Use the zero value for the arg. + vArgs[i] = reflect.Zero(ft.In(i)) + } + } + vRets := v.Call(vArgs) + rets := make([]any, len(vRets)) + for i, ret := range vRets { + rets[i] = ret.Interface() + } + return rets + }) + return c +} + +// Do declares the action to run when the call is matched. The function's +// return values are ignored to retain backward compatibility. To use the +// return values call DoAndReturn. +// It takes an any argument to support n-arity functions. +// The anonymous function must match the function signature mocked method. +func (c *Call) Do(f any) *Call { + // TODO: Check arity and types here, rather than dying badly elsewhere. + v := reflect.ValueOf(f) + + c.addAction(func(args []any) []any { + c.t.Helper() + ft := v.Type() + if c.methodType.NumIn() != ft.NumIn() { + if ft.IsVariadic() { + c.t.Fatalf("wrong number of arguments in Do func for %T.%v The function signature must match the mocked method, a variadic function cannot be used.", + c.receiver, c.method) + } else { + c.t.Fatalf("wrong number of arguments in Do func for %T.%v: got %d, want %d [%s]", + c.receiver, c.method, ft.NumIn(), c.methodType.NumIn(), c.origin) + } + return nil + } + vArgs := make([]reflect.Value, len(args)) + for i := 0; i < len(args); i++ { + if args[i] != nil { + vArgs[i] = reflect.ValueOf(args[i]) + } else { + // Use the zero value for the arg. + vArgs[i] = reflect.Zero(ft.In(i)) + } + } + v.Call(vArgs) + return nil + }) + return c +} + +// Return declares the values to be returned by the mocked function call. +func (c *Call) Return(rets ...any) *Call { + c.t.Helper() + + mt := c.methodType + if len(rets) != mt.NumOut() { + c.t.Fatalf("wrong number of arguments to Return for %T.%v: got %d, want %d [%s]", + c.receiver, c.method, len(rets), mt.NumOut(), c.origin) + } + for i, ret := range rets { + if got, want := reflect.TypeOf(ret), mt.Out(i); got == want { + // Identical types; nothing to do. + } else if got == nil { + // Nil needs special handling. + switch want.Kind() { + case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: + // ok + default: + c.t.Fatalf("argument %d to Return for %T.%v is nil, but %v is not nillable [%s]", + i, c.receiver, c.method, want, c.origin) + } + } else if got.AssignableTo(want) { + // Assignable type relation. Make the assignment now so that the generated code + // can return the values with a type assertion. + v := reflect.New(want).Elem() + v.Set(reflect.ValueOf(ret)) + rets[i] = v.Interface() + } else { + c.t.Fatalf("wrong type of argument %d to Return for %T.%v: %v is not assignable to %v [%s]", + i, c.receiver, c.method, got, want, c.origin) + } + } + + c.addAction(func([]any) []any { + return rets + }) + + return c +} + +// Times declares the exact number of times a function call is expected to be executed. +func (c *Call) Times(n int) *Call { + c.minCalls, c.maxCalls = n, n + return c +} + +// SetArg declares an action that will set the nth argument's value, +// indirected through a pointer. Or, in the case of a slice and map, SetArg +// will copy value's elements/key-value pairs into the nth argument. +func (c *Call) SetArg(n int, value any) *Call { + c.t.Helper() + + mt := c.methodType + // TODO: This will break on variadic methods. + // We will need to check those at invocation time. + if n < 0 || n >= mt.NumIn() { + c.t.Fatalf("SetArg(%d, ...) called for a method with %d args [%s]", + n, mt.NumIn(), c.origin) + } + // Permit setting argument through an interface. + // In the interface case, we don't (nay, can't) check the type here. + at := mt.In(n) + switch at.Kind() { + case reflect.Ptr: + dt := at.Elem() + if vt := reflect.TypeOf(value); !vt.AssignableTo(dt) { + c.t.Fatalf("SetArg(%d, ...) argument is a %v, not assignable to %v [%s]", + n, vt, dt, c.origin) + } + case reflect.Interface: + // nothing to do + case reflect.Slice: + // nothing to do + case reflect.Map: + // nothing to do + default: + c.t.Fatalf("SetArg(%d, ...) referring to argument of non-pointer non-interface non-slice non-map type %v [%s]", + n, at, c.origin) + } + + c.addAction(func(args []any) []any { + v := reflect.ValueOf(value) + switch reflect.TypeOf(args[n]).Kind() { + case reflect.Slice: + setSlice(args[n], v) + case reflect.Map: + setMap(args[n], v) + default: + reflect.ValueOf(args[n]).Elem().Set(v) + } + return nil + }) + return c +} + +// isPreReq returns true if other is a direct or indirect prerequisite to c. +func (c *Call) isPreReq(other *Call) bool { + for _, preReq := range c.preReqs { + if other == preReq || preReq.isPreReq(other) { + return true + } + } + return false +} + +// After declares that the call may only match after preReq has been exhausted. +func (c *Call) After(preReq *Call) *Call { + c.t.Helper() + + if c == preReq { + c.t.Fatalf("A call isn't allowed to be its own prerequisite") + } + if preReq.isPreReq(c) { + c.t.Fatalf("Loop in call order: %v is a prerequisite to %v (possibly indirectly).", c, preReq) + } + + c.preReqs = append(c.preReqs, preReq) + return c +} + +// Returns true if the minimum number of calls have been made. +func (c *Call) satisfied() bool { + return c.numCalls >= c.minCalls +} + +// Returns true if the maximum number of calls have been made. +func (c *Call) exhausted() bool { + return c.numCalls >= c.maxCalls +} + +func (c *Call) String() string { + args := make([]string, len(c.args)) + for i, arg := range c.args { + args[i] = arg.String() + } + arguments := strings.Join(args, ", ") + return fmt.Sprintf("%T.%v(%s) %s", c.receiver, c.method, arguments, c.origin) +} + +// Tests if the given call matches the expected call. +// If yes, returns nil. If no, returns error with message explaining why it does not match. +func (c *Call) matches(args []any) error { + if !c.methodType.IsVariadic() { + if len(args) != len(c.args) { + return fmt.Errorf("expected call at %s has the wrong number of arguments. Got: %d, want: %d", + c.origin, len(args), len(c.args)) + } + + for i, m := range c.args { + if !m.Matches(args[i]) { + return fmt.Errorf( + "expected call at %s doesn't match the argument at index %d.\nGot: %v\nWant: %v", + c.origin, i, formatGottenArg(m, args[i]), m, + ) + } + } + } else { + if len(c.args) < c.methodType.NumIn()-1 { + return fmt.Errorf("expected call at %s has the wrong number of matchers. Got: %d, want: %d", + c.origin, len(c.args), c.methodType.NumIn()-1) + } + if len(c.args) != c.methodType.NumIn() && len(args) != len(c.args) { + return fmt.Errorf("expected call at %s has the wrong number of arguments. Got: %d, want: %d", + c.origin, len(args), len(c.args)) + } + if len(args) < len(c.args)-1 { + return fmt.Errorf("expected call at %s has the wrong number of arguments. Got: %d, want: greater than or equal to %d", + c.origin, len(args), len(c.args)-1) + } + + for i, m := range c.args { + if i < c.methodType.NumIn()-1 { + // Non-variadic args + if !m.Matches(args[i]) { + return fmt.Errorf("expected call at %s doesn't match the argument at index %s.\nGot: %v\nWant: %v", + c.origin, strconv.Itoa(i), formatGottenArg(m, args[i]), m) + } + continue + } + // The last arg has a possibility of a variadic argument, so let it branch + + // sample: Foo(a int, b int, c ...int) + if i < len(c.args) && i < len(args) { + if m.Matches(args[i]) { + // Got Foo(a, b, c) want Foo(matcherA, matcherB, gomock.Any()) + // Got Foo(a, b, c) want Foo(matcherA, matcherB, someSliceMatcher) + // Got Foo(a, b, c) want Foo(matcherA, matcherB, matcherC) + // Got Foo(a, b) want Foo(matcherA, matcherB) + // Got Foo(a, b, c, d) want Foo(matcherA, matcherB, matcherC, matcherD) + continue + } + } + + // The number of actual args don't match the number of matchers, + // or the last matcher is a slice and the last arg is not. + // If this function still matches it is because the last matcher + // matches all the remaining arguments or the lack of any. + // Convert the remaining arguments, if any, into a slice of the + // expected type. + vArgsType := c.methodType.In(c.methodType.NumIn() - 1) + vArgs := reflect.MakeSlice(vArgsType, 0, len(args)-i) + for _, arg := range args[i:] { + vArgs = reflect.Append(vArgs, reflect.ValueOf(arg)) + } + if m.Matches(vArgs.Interface()) { + // Got Foo(a, b, c, d, e) want Foo(matcherA, matcherB, gomock.Any()) + // Got Foo(a, b, c, d, e) want Foo(matcherA, matcherB, someSliceMatcher) + // Got Foo(a, b) want Foo(matcherA, matcherB, gomock.Any()) + // Got Foo(a, b) want Foo(matcherA, matcherB, someEmptySliceMatcher) + break + } + // Wrong number of matchers or not match. Fail. + // Got Foo(a, b) want Foo(matcherA, matcherB, matcherC, matcherD) + // Got Foo(a, b, c) want Foo(matcherA, matcherB, matcherC, matcherD) + // Got Foo(a, b, c, d) want Foo(matcherA, matcherB, matcherC, matcherD, matcherE) + // Got Foo(a, b, c, d, e) want Foo(matcherA, matcherB, matcherC, matcherD) + // Got Foo(a, b, c) want Foo(matcherA, matcherB) + + return fmt.Errorf("expected call at %s doesn't match the argument at index %s.\nGot: %v\nWant: %v", + c.origin, strconv.Itoa(i), formatGottenArg(m, args[i:]), c.args[i]) + } + } + + // Check that all prerequisite calls have been satisfied. + for _, preReqCall := range c.preReqs { + if !preReqCall.satisfied() { + return fmt.Errorf("expected call at %s doesn't have a prerequisite call satisfied:\n%v\nshould be called before:\n%v", + c.origin, preReqCall, c) + } + } + + // Check that the call is not exhausted. + if c.exhausted() { + return fmt.Errorf("expected call at %s has already been called the max number of times", c.origin) + } + + return nil +} + +// dropPrereqs tells the expected Call to not re-check prerequisite calls any +// longer, and to return its current set. +func (c *Call) dropPrereqs() (preReqs []*Call) { + preReqs = c.preReqs + c.preReqs = nil + return +} + +func (c *Call) call() []func([]any) []any { + c.numCalls++ + return c.actions +} + +// InOrder declares that the given calls should occur in order. +// It panics if the type of any of the arguments isn't *Call or a generated +// mock with an embedded *Call. +func InOrder(args ...any) { + calls := make([]*Call, 0, len(args)) + for i := 0; i < len(args); i++ { + if call := getCall(args[i]); call != nil { + calls = append(calls, call) + continue + } + panic(fmt.Sprintf( + "invalid argument at position %d of type %T, InOrder expects *gomock.Call or generated mock types with an embedded *gomock.Call", + i, + args[i], + )) + } + for i := 1; i < len(calls); i++ { + calls[i].After(calls[i-1]) + } +} + +// getCall checks if the parameter is a *Call or a generated struct +// that wraps a *Call and returns the *Call pointer - if neither, it returns nil. +func getCall(arg any) *Call { + if call, ok := arg.(*Call); ok { + return call + } + t := reflect.ValueOf(arg) + if t.Kind() != reflect.Ptr && t.Kind() != reflect.Interface { + return nil + } + t = t.Elem() + for i := 0; i < t.NumField(); i++ { + f := t.Field(i) + if !f.CanInterface() { + continue + } + if call, ok := f.Interface().(*Call); ok { + return call + } + } + return nil +} + +func setSlice(arg any, v reflect.Value) { + va := reflect.ValueOf(arg) + for i := 0; i < v.Len(); i++ { + va.Index(i).Set(v.Index(i)) + } +} + +func setMap(arg any, v reflect.Value) { + va := reflect.ValueOf(arg) + for _, e := range va.MapKeys() { + va.SetMapIndex(e, reflect.Value{}) + } + for _, e := range v.MapKeys() { + va.SetMapIndex(e, v.MapIndex(e)) + } +} + +func (c *Call) addAction(action func([]any) []any) { + c.actions = append(c.actions, action) +} + +func formatGottenArg(m Matcher, arg any) string { + got := fmt.Sprintf("%v (%T)", arg, arg) + if gs, ok := m.(GotFormatter); ok { + got = gs.Got(arg) + } + return got +} diff --git a/vendor/go.uber.org/mock/gomock/callset.go b/vendor/go.uber.org/mock/gomock/callset.go new file mode 100644 index 000000000..f5cc592d6 --- /dev/null +++ b/vendor/go.uber.org/mock/gomock/callset.go @@ -0,0 +1,164 @@ +// Copyright 2011 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package gomock + +import ( + "bytes" + "errors" + "fmt" + "sync" +) + +// callSet represents a set of expected calls, indexed by receiver and method +// name. +type callSet struct { + // Calls that are still expected. + expected map[callSetKey][]*Call + expectedMu *sync.Mutex + // Calls that have been exhausted. + exhausted map[callSetKey][]*Call + // when set to true, existing call expectations are overridden when new call expectations are made + allowOverride bool +} + +// callSetKey is the key in the maps in callSet +type callSetKey struct { + receiver any + fname string +} + +func newCallSet() *callSet { + return &callSet{ + expected: make(map[callSetKey][]*Call), + expectedMu: &sync.Mutex{}, + exhausted: make(map[callSetKey][]*Call), + } +} + +func newOverridableCallSet() *callSet { + return &callSet{ + expected: make(map[callSetKey][]*Call), + expectedMu: &sync.Mutex{}, + exhausted: make(map[callSetKey][]*Call), + allowOverride: true, + } +} + +// Add adds a new expected call. +func (cs callSet) Add(call *Call) { + key := callSetKey{call.receiver, call.method} + + cs.expectedMu.Lock() + defer cs.expectedMu.Unlock() + + m := cs.expected + if call.exhausted() { + m = cs.exhausted + } + if cs.allowOverride { + m[key] = make([]*Call, 0) + } + + m[key] = append(m[key], call) +} + +// Remove removes an expected call. +func (cs callSet) Remove(call *Call) { + key := callSetKey{call.receiver, call.method} + + cs.expectedMu.Lock() + defer cs.expectedMu.Unlock() + + calls := cs.expected[key] + for i, c := range calls { + if c == call { + // maintain order for remaining calls + cs.expected[key] = append(calls[:i], calls[i+1:]...) + cs.exhausted[key] = append(cs.exhausted[key], call) + break + } + } +} + +// FindMatch searches for a matching call. Returns error with explanation message if no call matched. +func (cs callSet) FindMatch(receiver any, method string, args []any) (*Call, error) { + key := callSetKey{receiver, method} + + cs.expectedMu.Lock() + defer cs.expectedMu.Unlock() + + // Search through the expected calls. + expected := cs.expected[key] + var callsErrors bytes.Buffer + for _, call := range expected { + err := call.matches(args) + if err != nil { + _, _ = fmt.Fprintf(&callsErrors, "\n%v", err) + } else { + return call, nil + } + } + + // If we haven't found a match then search through the exhausted calls so we + // get useful error messages. + exhausted := cs.exhausted[key] + for _, call := range exhausted { + if err := call.matches(args); err != nil { + _, _ = fmt.Fprintf(&callsErrors, "\n%v", err) + continue + } + _, _ = fmt.Fprintf( + &callsErrors, "all expected calls for method %q have been exhausted", method, + ) + } + + if len(expected)+len(exhausted) == 0 { + _, _ = fmt.Fprintf(&callsErrors, "there are no expected calls of the method %q for that receiver", method) + } + + return nil, errors.New(callsErrors.String()) +} + +// Failures returns the calls that are not satisfied. +func (cs callSet) Failures() []*Call { + cs.expectedMu.Lock() + defer cs.expectedMu.Unlock() + + failures := make([]*Call, 0, len(cs.expected)) + for _, calls := range cs.expected { + for _, call := range calls { + if !call.satisfied() { + failures = append(failures, call) + } + } + } + return failures +} + +// Satisfied returns true in case all expected calls in this callSet are satisfied. +func (cs callSet) Satisfied() bool { + cs.expectedMu.Lock() + defer cs.expectedMu.Unlock() + + for _, calls := range cs.expected { + for _, call := range calls { + if !call.satisfied() { + return false + } + } + } + + return true +} diff --git a/vendor/go.uber.org/mock/gomock/controller.go b/vendor/go.uber.org/mock/gomock/controller.go new file mode 100644 index 000000000..9d17a2f0c --- /dev/null +++ b/vendor/go.uber.org/mock/gomock/controller.go @@ -0,0 +1,318 @@ +// Copyright 2010 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package gomock + +import ( + "context" + "fmt" + "reflect" + "runtime" + "sync" +) + +// A TestReporter is something that can be used to report test failures. It +// is satisfied by the standard library's *testing.T. +type TestReporter interface { + Errorf(format string, args ...any) + Fatalf(format string, args ...any) +} + +// TestHelper is a TestReporter that has the Helper method. It is satisfied +// by the standard library's *testing.T. +type TestHelper interface { + TestReporter + Helper() +} + +// cleanuper is used to check if TestHelper also has the `Cleanup` method. A +// common pattern is to pass in a `*testing.T` to +// `NewController(t TestReporter)`. In Go 1.14+, `*testing.T` has a cleanup +// method. This can be utilized to call `Finish()` so the caller of this library +// does not have to. +type cleanuper interface { + Cleanup(func()) +} + +// A Controller represents the top-level control of a mock ecosystem. It +// defines the scope and lifetime of mock objects, as well as their +// expectations. It is safe to call Controller's methods from multiple +// goroutines. Each test should create a new Controller and invoke Finish via +// defer. +// +// func TestFoo(t *testing.T) { +// ctrl := gomock.NewController(t) +// // .. +// } +// +// func TestBar(t *testing.T) { +// t.Run("Sub-Test-1", st) { +// ctrl := gomock.NewController(st) +// // .. +// }) +// t.Run("Sub-Test-2", st) { +// ctrl := gomock.NewController(st) +// // .. +// }) +// }) +type Controller struct { + // T should only be called within a generated mock. It is not intended to + // be used in user code and may be changed in future versions. T is the + // TestReporter passed in when creating the Controller via NewController. + // If the TestReporter does not implement a TestHelper it will be wrapped + // with a nopTestHelper. + T TestHelper + mu sync.Mutex + expectedCalls *callSet + finished bool +} + +// NewController returns a new Controller. It is the preferred way to create a Controller. +// +// Passing [*testing.T] registers cleanup function to automatically call [Controller.Finish] +// when the test and all its subtests complete. +func NewController(t TestReporter, opts ...ControllerOption) *Controller { + h, ok := t.(TestHelper) + if !ok { + h = &nopTestHelper{t} + } + ctrl := &Controller{ + T: h, + expectedCalls: newCallSet(), + } + for _, opt := range opts { + opt.apply(ctrl) + } + if c, ok := isCleanuper(ctrl.T); ok { + c.Cleanup(func() { + ctrl.T.Helper() + ctrl.finish(true, nil) + }) + } + + return ctrl +} + +// ControllerOption configures how a Controller should behave. +type ControllerOption interface { + apply(*Controller) +} + +type overridableExpectationsOption struct{} + +// WithOverridableExpectations allows for overridable call expectations +// i.e., subsequent call expectations override existing call expectations +func WithOverridableExpectations() overridableExpectationsOption { + return overridableExpectationsOption{} +} + +func (o overridableExpectationsOption) apply(ctrl *Controller) { + ctrl.expectedCalls = newOverridableCallSet() +} + +type cancelReporter struct { + t TestHelper + cancel func() +} + +func (r *cancelReporter) Errorf(format string, args ...any) { + r.t.Errorf(format, args...) +} +func (r *cancelReporter) Fatalf(format string, args ...any) { + defer r.cancel() + r.t.Fatalf(format, args...) +} + +func (r *cancelReporter) Helper() { + r.t.Helper() +} + +// WithContext returns a new Controller and a Context, which is cancelled on any +// fatal failure. +func WithContext(ctx context.Context, t TestReporter) (*Controller, context.Context) { + h, ok := t.(TestHelper) + if !ok { + h = &nopTestHelper{t: t} + } + + ctx, cancel := context.WithCancel(ctx) + return NewController(&cancelReporter{t: h, cancel: cancel}), ctx +} + +type nopTestHelper struct { + t TestReporter +} + +func (h *nopTestHelper) Errorf(format string, args ...any) { + h.t.Errorf(format, args...) +} +func (h *nopTestHelper) Fatalf(format string, args ...any) { + h.t.Fatalf(format, args...) +} + +func (h nopTestHelper) Helper() {} + +// RecordCall is called by a mock. It should not be called by user code. +func (ctrl *Controller) RecordCall(receiver any, method string, args ...any) *Call { + ctrl.T.Helper() + + recv := reflect.ValueOf(receiver) + for i := 0; i < recv.Type().NumMethod(); i++ { + if recv.Type().Method(i).Name == method { + return ctrl.RecordCallWithMethodType(receiver, method, recv.Method(i).Type(), args...) + } + } + ctrl.T.Fatalf("gomock: failed finding method %s on %T", method, receiver) + panic("unreachable") +} + +// RecordCallWithMethodType is called by a mock. It should not be called by user code. +func (ctrl *Controller) RecordCallWithMethodType(receiver any, method string, methodType reflect.Type, args ...any) *Call { + ctrl.T.Helper() + + call := newCall(ctrl.T, receiver, method, methodType, args...) + + ctrl.mu.Lock() + defer ctrl.mu.Unlock() + ctrl.expectedCalls.Add(call) + + return call +} + +// Call is called by a mock. It should not be called by user code. +func (ctrl *Controller) Call(receiver any, method string, args ...any) []any { + ctrl.T.Helper() + + // Nest this code so we can use defer to make sure the lock is released. + actions := func() []func([]any) []any { + ctrl.T.Helper() + ctrl.mu.Lock() + defer ctrl.mu.Unlock() + + expected, err := ctrl.expectedCalls.FindMatch(receiver, method, args) + if err != nil { + // callerInfo's skip should be updated if the number of calls between the user's test + // and this line changes, i.e. this code is wrapped in another anonymous function. + // 0 is us, 1 is controller.Call(), 2 is the generated mock, and 3 is the user's test. + origin := callerInfo(3) + ctrl.T.Fatalf("Unexpected call to %T.%v(%v) at %s because: %s", receiver, method, args, origin, err) + } + + // Two things happen here: + // * the matching call no longer needs to check prerequite calls, + // * and the prerequite calls are no longer expected, so remove them. + preReqCalls := expected.dropPrereqs() + for _, preReqCall := range preReqCalls { + ctrl.expectedCalls.Remove(preReqCall) + } + + actions := expected.call() + if expected.exhausted() { + ctrl.expectedCalls.Remove(expected) + } + return actions + }() + + var rets []any + for _, action := range actions { + if r := action(args); r != nil { + rets = r + } + } + + return rets +} + +// Finish checks to see if all the methods that were expected to be called were called. +// It is not idempotent and therefore can only be invoked once. +func (ctrl *Controller) Finish() { + // If we're currently panicking, probably because this is a deferred call. + // This must be recovered in the deferred function. + err := recover() + ctrl.finish(false, err) +} + +// Satisfied returns whether all expected calls bound to this Controller have been satisfied. +// Calling Finish is then guaranteed to not fail due to missing calls. +func (ctrl *Controller) Satisfied() bool { + ctrl.mu.Lock() + defer ctrl.mu.Unlock() + return ctrl.expectedCalls.Satisfied() +} + +func (ctrl *Controller) finish(cleanup bool, panicErr any) { + ctrl.T.Helper() + + ctrl.mu.Lock() + defer ctrl.mu.Unlock() + + if ctrl.finished { + if _, ok := isCleanuper(ctrl.T); !ok { + ctrl.T.Fatalf("Controller.Finish was called more than once. It has to be called exactly once.") + } + return + } + ctrl.finished = true + + // Short-circuit, pass through the panic. + if panicErr != nil { + panic(panicErr) + } + + // Check that all remaining expected calls are satisfied. + failures := ctrl.expectedCalls.Failures() + for _, call := range failures { + ctrl.T.Errorf("missing call(s) to %v", call) + } + if len(failures) != 0 { + if !cleanup { + ctrl.T.Fatalf("aborting test due to missing call(s)") + return + } + ctrl.T.Errorf("aborting test due to missing call(s)") + } +} + +// callerInfo returns the file:line of the call site. skip is the number +// of stack frames to skip when reporting. 0 is callerInfo's call site. +func callerInfo(skip int) string { + if _, file, line, ok := runtime.Caller(skip + 1); ok { + return fmt.Sprintf("%s:%d", file, line) + } + return "unknown file" +} + +// isCleanuper checks it if t's base TestReporter has a Cleanup method. +func isCleanuper(t TestReporter) (cleanuper, bool) { + tr := unwrapTestReporter(t) + c, ok := tr.(cleanuper) + return c, ok +} + +// unwrapTestReporter unwraps TestReporter to the base implementation. +func unwrapTestReporter(t TestReporter) TestReporter { + tr := t + switch nt := t.(type) { + case *cancelReporter: + tr = nt.t + if h, check := tr.(*nopTestHelper); check { + tr = h.t + } + case *nopTestHelper: + tr = nt.t + default: + // not wrapped + } + return tr +} diff --git a/vendor/go.uber.org/mock/gomock/doc.go b/vendor/go.uber.org/mock/gomock/doc.go new file mode 100644 index 000000000..696dda388 --- /dev/null +++ b/vendor/go.uber.org/mock/gomock/doc.go @@ -0,0 +1,60 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package gomock is a mock framework for Go. +// +// Standard usage: +// +// (1) Define an interface that you wish to mock. +// type MyInterface interface { +// SomeMethod(x int64, y string) +// } +// (2) Use mockgen to generate a mock from the interface. +// (3) Use the mock in a test: +// func TestMyThing(t *testing.T) { +// mockCtrl := gomock.NewController(t) +// mockObj := something.NewMockMyInterface(mockCtrl) +// mockObj.EXPECT().SomeMethod(4, "blah") +// // pass mockObj to a real object and play with it. +// } +// +// By default, expected calls are not enforced to run in any particular order. +// Call order dependency can be enforced by use of InOrder and/or Call.After. +// Call.After can create more varied call order dependencies, but InOrder is +// often more convenient. +// +// The following examples create equivalent call order dependencies. +// +// Example of using Call.After to chain expected call order: +// +// firstCall := mockObj.EXPECT().SomeMethod(1, "first") +// secondCall := mockObj.EXPECT().SomeMethod(2, "second").After(firstCall) +// mockObj.EXPECT().SomeMethod(3, "third").After(secondCall) +// +// Example of using InOrder to declare expected call order: +// +// gomock.InOrder( +// mockObj.EXPECT().SomeMethod(1, "first"), +// mockObj.EXPECT().SomeMethod(2, "second"), +// mockObj.EXPECT().SomeMethod(3, "third"), +// ) +// +// The standard TestReporter most users will pass to `NewController` is a +// `*testing.T` from the context of the test. Note that this will use the +// standard `t.Error` and `t.Fatal` methods to report what happened in the test. +// In some cases this can leave your testing package in a weird state if global +// state is used since `t.Fatal` is like calling panic in the middle of a +// function. In these cases it is recommended that you pass in your own +// `TestReporter`. +package gomock diff --git a/vendor/go.uber.org/mock/gomock/matchers.go b/vendor/go.uber.org/mock/gomock/matchers.go new file mode 100644 index 000000000..c17255096 --- /dev/null +++ b/vendor/go.uber.org/mock/gomock/matchers.go @@ -0,0 +1,443 @@ +// Copyright 2010 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package gomock + +import ( + "fmt" + "reflect" + "regexp" + "strings" +) + +// A Matcher is a representation of a class of values. +// It is used to represent the valid or expected arguments to a mocked method. +type Matcher interface { + // Matches returns whether x is a match. + Matches(x any) bool + + // String describes what the matcher matches. + String() string +} + +// WantFormatter modifies the given Matcher's String() method to the given +// Stringer. This allows for control on how the "Want" is formatted when +// printing . +func WantFormatter(s fmt.Stringer, m Matcher) Matcher { + type matcher interface { + Matches(x any) bool + } + + return struct { + matcher + fmt.Stringer + }{ + matcher: m, + Stringer: s, + } +} + +// StringerFunc type is an adapter to allow the use of ordinary functions as +// a Stringer. If f is a function with the appropriate signature, +// StringerFunc(f) is a Stringer that calls f. +type StringerFunc func() string + +// String implements fmt.Stringer. +func (f StringerFunc) String() string { + return f() +} + +// GotFormatter is used to better print failure messages. If a matcher +// implements GotFormatter, it will use the result from Got when printing +// the failure message. +type GotFormatter interface { + // Got is invoked with the received value. The result is used when + // printing the failure message. + Got(got any) string +} + +// GotFormatterFunc type is an adapter to allow the use of ordinary +// functions as a GotFormatter. If f is a function with the appropriate +// signature, GotFormatterFunc(f) is a GotFormatter that calls f. +type GotFormatterFunc func(got any) string + +// Got implements GotFormatter. +func (f GotFormatterFunc) Got(got any) string { + return f(got) +} + +// GotFormatterAdapter attaches a GotFormatter to a Matcher. +func GotFormatterAdapter(s GotFormatter, m Matcher) Matcher { + return struct { + GotFormatter + Matcher + }{ + GotFormatter: s, + Matcher: m, + } +} + +type anyMatcher struct{} + +func (anyMatcher) Matches(any) bool { + return true +} + +func (anyMatcher) String() string { + return "is anything" +} + +type condMatcher struct { + fn func(x any) bool +} + +func (c condMatcher) Matches(x any) bool { + return c.fn(x) +} + +func (condMatcher) String() string { + return "adheres to a custom condition" +} + +type eqMatcher struct { + x any +} + +func (e eqMatcher) Matches(x any) bool { + // In case, some value is nil + if e.x == nil || x == nil { + return reflect.DeepEqual(e.x, x) + } + + // Check if types assignable and convert them to common type + x1Val := reflect.ValueOf(e.x) + x2Val := reflect.ValueOf(x) + + if x1Val.Type().AssignableTo(x2Val.Type()) { + x1ValConverted := x1Val.Convert(x2Val.Type()) + return reflect.DeepEqual(x1ValConverted.Interface(), x2Val.Interface()) + } + + return false +} + +func (e eqMatcher) String() string { + return fmt.Sprintf("is equal to %v (%T)", e.x, e.x) +} + +type nilMatcher struct{} + +func (nilMatcher) Matches(x any) bool { + if x == nil { + return true + } + + v := reflect.ValueOf(x) + switch v.Kind() { + case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, + reflect.Ptr, reflect.Slice: + return v.IsNil() + } + + return false +} + +func (nilMatcher) String() string { + return "is nil" +} + +type notMatcher struct { + m Matcher +} + +func (n notMatcher) Matches(x any) bool { + return !n.m.Matches(x) +} + +func (n notMatcher) String() string { + return "not(" + n.m.String() + ")" +} + +type regexMatcher struct { + regex *regexp.Regexp +} + +func (m regexMatcher) Matches(x any) bool { + switch t := x.(type) { + case string: + return m.regex.MatchString(t) + case []byte: + return m.regex.Match(t) + default: + return false + } +} + +func (m regexMatcher) String() string { + return "matches regex " + m.regex.String() +} + +type assignableToTypeOfMatcher struct { + targetType reflect.Type +} + +func (m assignableToTypeOfMatcher) Matches(x any) bool { + return reflect.TypeOf(x).AssignableTo(m.targetType) +} + +func (m assignableToTypeOfMatcher) String() string { + return "is assignable to " + m.targetType.Name() +} + +type anyOfMatcher struct { + matchers []Matcher +} + +func (am anyOfMatcher) Matches(x any) bool { + for _, m := range am.matchers { + if m.Matches(x) { + return true + } + } + return false +} + +func (am anyOfMatcher) String() string { + ss := make([]string, 0, len(am.matchers)) + for _, matcher := range am.matchers { + ss = append(ss, matcher.String()) + } + return strings.Join(ss, " | ") +} + +type allMatcher struct { + matchers []Matcher +} + +func (am allMatcher) Matches(x any) bool { + for _, m := range am.matchers { + if !m.Matches(x) { + return false + } + } + return true +} + +func (am allMatcher) String() string { + ss := make([]string, 0, len(am.matchers)) + for _, matcher := range am.matchers { + ss = append(ss, matcher.String()) + } + return strings.Join(ss, "; ") +} + +type lenMatcher struct { + i int +} + +func (m lenMatcher) Matches(x any) bool { + v := reflect.ValueOf(x) + switch v.Kind() { + case reflect.Array, reflect.Chan, reflect.Map, reflect.Slice, reflect.String: + return v.Len() == m.i + default: + return false + } +} + +func (m lenMatcher) String() string { + return fmt.Sprintf("has length %d", m.i) +} + +type inAnyOrderMatcher struct { + x any +} + +func (m inAnyOrderMatcher) Matches(x any) bool { + given, ok := m.prepareValue(x) + if !ok { + return false + } + wanted, ok := m.prepareValue(m.x) + if !ok { + return false + } + + if given.Len() != wanted.Len() { + return false + } + + usedFromGiven := make([]bool, given.Len()) + foundFromWanted := make([]bool, wanted.Len()) + for i := 0; i < wanted.Len(); i++ { + wantedMatcher := Eq(wanted.Index(i).Interface()) + for j := 0; j < given.Len(); j++ { + if usedFromGiven[j] { + continue + } + if wantedMatcher.Matches(given.Index(j).Interface()) { + foundFromWanted[i] = true + usedFromGiven[j] = true + break + } + } + } + + missingFromWanted := 0 + for _, found := range foundFromWanted { + if !found { + missingFromWanted++ + } + } + extraInGiven := 0 + for _, used := range usedFromGiven { + if !used { + extraInGiven++ + } + } + + return extraInGiven == 0 && missingFromWanted == 0 +} + +func (m inAnyOrderMatcher) prepareValue(x any) (reflect.Value, bool) { + xValue := reflect.ValueOf(x) + switch xValue.Kind() { + case reflect.Slice, reflect.Array: + return xValue, true + default: + return reflect.Value{}, false + } +} + +func (m inAnyOrderMatcher) String() string { + return fmt.Sprintf("has the same elements as %v", m.x) +} + +// Constructors + +// All returns a composite Matcher that returns true if and only all of the +// matchers return true. +func All(ms ...Matcher) Matcher { return allMatcher{ms} } + +// Any returns a matcher that always matches. +func Any() Matcher { return anyMatcher{} } + +// Cond returns a matcher that matches when the given function returns true +// after passing it the parameter to the mock function. +// This is particularly useful in case you want to match over a field of a custom struct, or dynamic logic. +// +// Example usage: +// +// Cond(func(x any){return x.(int) == 1}).Matches(1) // returns true +// Cond(func(x any){return x.(int) == 2}).Matches(1) // returns false +func Cond(fn func(x any) bool) Matcher { return condMatcher{fn} } + +// AnyOf returns a composite Matcher that returns true if at least one of the +// matchers returns true. +// +// Example usage: +// +// AnyOf(1, 2, 3).Matches(2) // returns true +// AnyOf(1, 2, 3).Matches(10) // returns false +// AnyOf(Nil(), Len(2)).Matches(nil) // returns true +// AnyOf(Nil(), Len(2)).Matches("hi") // returns true +// AnyOf(Nil(), Len(2)).Matches("hello") // returns false +func AnyOf(xs ...any) Matcher { + ms := make([]Matcher, 0, len(xs)) + for _, x := range xs { + if m, ok := x.(Matcher); ok { + ms = append(ms, m) + } else { + ms = append(ms, Eq(x)) + } + } + return anyOfMatcher{ms} +} + +// Eq returns a matcher that matches on equality. +// +// Example usage: +// +// Eq(5).Matches(5) // returns true +// Eq(5).Matches(4) // returns false +func Eq(x any) Matcher { return eqMatcher{x} } + +// Len returns a matcher that matches on length. This matcher returns false if +// is compared to a type that is not an array, chan, map, slice, or string. +func Len(i int) Matcher { + return lenMatcher{i} +} + +// Nil returns a matcher that matches if the received value is nil. +// +// Example usage: +// +// var x *bytes.Buffer +// Nil().Matches(x) // returns true +// x = &bytes.Buffer{} +// Nil().Matches(x) // returns false +func Nil() Matcher { return nilMatcher{} } + +// Not reverses the results of its given child matcher. +// +// Example usage: +// +// Not(Eq(5)).Matches(4) // returns true +// Not(Eq(5)).Matches(5) // returns false +func Not(x any) Matcher { + if m, ok := x.(Matcher); ok { + return notMatcher{m} + } + return notMatcher{Eq(x)} +} + +// Regex checks whether parameter matches the associated regex. +// +// Example usage: +// +// Regex("[0-9]{2}:[0-9]{2}").Matches("23:02") // returns true +// Regex("[0-9]{2}:[0-9]{2}").Matches([]byte{'2', '3', ':', '0', '2'}) // returns true +// Regex("[0-9]{2}:[0-9]{2}").Matches("hello world") // returns false +// Regex("[0-9]{2}").Matches(21) // returns false as it's not a valid type +func Regex(regexStr string) Matcher { + return regexMatcher{regex: regexp.MustCompile(regexStr)} +} + +// AssignableToTypeOf is a Matcher that matches if the parameter to the mock +// function is assignable to the type of the parameter to this function. +// +// Example usage: +// +// var s fmt.Stringer = &bytes.Buffer{} +// AssignableToTypeOf(s).Matches(time.Second) // returns true +// AssignableToTypeOf(s).Matches(99) // returns false +// +// var ctx = reflect.TypeOf((*context.Context)(nil)).Elem() +// AssignableToTypeOf(ctx).Matches(context.Background()) // returns true +func AssignableToTypeOf(x any) Matcher { + if xt, ok := x.(reflect.Type); ok { + return assignableToTypeOfMatcher{xt} + } + return assignableToTypeOfMatcher{reflect.TypeOf(x)} +} + +// InAnyOrder is a Matcher that returns true for collections of the same elements ignoring the order. +// +// Example usage: +// +// InAnyOrder([]int{1, 2, 3}).Matches([]int{1, 3, 2}) // returns true +// InAnyOrder([]int{1, 2, 3}).Matches([]int{1, 2}) // returns false +func InAnyOrder(x any) Matcher { + return inAnyOrderMatcher{x} +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 3d2de5c73..59971d34c 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1162,6 +1162,7 @@ go.uber.org/fx/internal/fxreflect go.uber.org/fx/internal/lifecycle # go.uber.org/mock v0.4.0 ## explicit; go 1.20 +go.uber.org/mock/gomock go.uber.org/mock/mockgen go.uber.org/mock/mockgen/model # go.uber.org/multierr v1.11.0