From 65cb0233f62d961b7ad77fe3e653ab81ec86ee02 Mon Sep 17 00:00:00 2001 From: Sebastian Pape Date: Fri, 4 Mar 2022 15:31:42 +0100 Subject: [PATCH] v5.3.1: use public endpoint --- dist/esm/index.js | 2 +- dist/umd/index.js | 2 +- package.json | 2 +- src/index.js | 2 +- tests/units/getAssets.spec.js | 10 +++++----- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dist/esm/index.js b/dist/esm/index.js index 3c7781a..3480ad6 100644 --- a/dist/esm/index.js +++ b/dist/esm/index.js @@ -42,7 +42,7 @@ const getAssets = async (options) => { let assets = Promise.all( (options.blockchain ? [options.blockchain] : wallet.blockchains).map((blockchain) =>{ - return fetch(`https://api.depay.fi/v2/accounts/${blockchain}/${account}/assets`) + return fetch(`https://public.depay.fi/accounts/${blockchain}/${account}/assets`) .then((response) => response.json()) .then(async (assets) => { return await ensureNativeTokenAsset({ diff --git a/dist/umd/index.js b/dist/umd/index.js index 732f359..a46975d 100644 --- a/dist/umd/index.js +++ b/dist/umd/index.js @@ -44,7 +44,7 @@ let assets = Promise.all( (options.blockchain ? [options.blockchain] : wallet.blockchains).map((blockchain) =>{ - return fetch(`https://api.depay.fi/v2/accounts/${blockchain}/${account}/assets`) + return fetch(`https://public.depay.fi/accounts/${blockchain}/${account}/assets`) .then((response) => response.json()) .then(async (assets) => { return await ensureNativeTokenAsset({ diff --git a/package.json b/package.json index 62b7e06..de3bed5 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@depay/web3-assets", "moduleName": "Web3Assets", - "version": "5.3.0", + "version": "5.3.1", "description": "", "main": "dist/umd/index.js", "module": "dist/esm/index.js", diff --git a/src/index.js b/src/index.js index 9eea753..cf16468 100644 --- a/src/index.js +++ b/src/index.js @@ -42,7 +42,7 @@ const getAssets = async (options) => { let assets = Promise.all( (options.blockchain ? [options.blockchain] : undefined || wallet.blockchains).map((blockchain) =>{ - return fetch(`https://api.depay.fi/v2/accounts/${blockchain}/${account}/assets`) + return fetch(`https://public.depay.fi/accounts/${blockchain}/${account}/assets`) .then((response) => response.json()) .then(async (assets) => { return await ensureNativeTokenAsset({ diff --git a/tests/units/getAssets.spec.js b/tests/units/getAssets.spec.js index 0a9d571..39146c6 100644 --- a/tests/units/getAssets.spec.js +++ b/tests/units/getAssets.spec.js @@ -20,7 +20,7 @@ describe('assets', ()=>{ beforeEach(()=>{ mock({ blockchain: 'ethereum', wallet: 'metamask' }) fetchMock.get({ - url: 'https://api.depay.fi/v2/accounts/ethereum/0xd8da6bf26964af9d7eed9e03e53415d37aa96045/assets', + url: 'https://public.depay.fi/v2/accounts/ethereum/0xd8da6bf26964af9d7eed9e03e53415d37aa96045/assets', }, [{ "name": "Ether", "symbol": "ETH", @@ -34,7 +34,7 @@ describe('assets', ()=>{ }] ) fetchMock.get({ - url: 'https://api.depay.fi/v2/accounts/bsc/0xd8da6bf26964af9d7eed9e03e53415d37aa96045/assets', + url: 'https://public.depay.fi/v2/accounts/bsc/0xd8da6bf26964af9d7eed9e03e53415d37aa96045/assets', }, [{ "name": "Binance Coin", "symbol": "BNB", @@ -124,7 +124,7 @@ describe('assets', ()=>{ it('fetches the assets for a given account without any connected wallet', async()=> { let account = '0xEcA533Ef096f191A35DE76aa4580FA3A722724bE' fetchMock.get({ - url: `https://api.depay.fi/v2/accounts/ethereum/${account}/assets`, + url: `https://public.depay.fi/v2/accounts/ethereum/${account}/assets`, }, [{ "name": "Ether", "symbol": "ETH", @@ -164,7 +164,7 @@ describe('assets', ()=>{ beforeEach(()=>{ mock({ blockchain: 'ethereum', wallet: 'metamask' }) fetchMock.get({ - url: 'https://api.depay.fi/v2/accounts/ethereum/0xd8da6bf26964af9d7eed9e03e53415d37aa96045/assets', + url: 'https://public.depay.fi/v2/accounts/ethereum/0xd8da6bf26964af9d7eed9e03e53415d37aa96045/assets', }, [{ "name": "Dai Stablecoin", "symbol": "DAI", @@ -173,7 +173,7 @@ describe('assets', ()=>{ }] ) fetchMock.get({ - url: 'https://api.depay.fi/v2/accounts/bsc/0xd8da6bf26964af9d7eed9e03e53415d37aa96045/assets', + url: 'https://public.depay.fi/v2/accounts/bsc/0xd8da6bf26964af9d7eed9e03e53415d37aa96045/assets', }, [{ "name": "PancakeSwap", "symbol": "CAKE",