diff --git a/package-lock.json b/package-lock.json index 35cd9f921..acbd93bbb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -43,7 +43,7 @@ "decentraland": "3.3.0", "decentraland-builder-scripts": "^0.24.0", "decentraland-crypto-fetch": "^2.0.1", - "decentraland-dapps": "^19.2.0", + "decentraland-dapps": "^19.2.4", "decentraland-ecs": "6.12.4-7784644013.commit-f770b3e", "decentraland-experiments": "^1.0.2", "decentraland-transactions": "^2.0.3", @@ -7020,6 +7020,11 @@ "@types/node": "*" } }, + "node_modules/@types/segment-analytics": { + "version": "0.0.38", + "resolved": "https://registry.npmjs.org/@types/segment-analytics/-/segment-analytics-0.0.38.tgz", + "integrity": "sha512-0clAuA7t6HxtpyXl4veE/oNVdcQFhlxnxgYlk0LeEYSoW3s3zZV5xa6DVHcOtozUO4u15Ipet5TdP88GbwKHvg==" + }, "node_modules/@types/semver": { "version": "7.5.6", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.6.tgz", @@ -11195,9 +11200,9 @@ } }, "node_modules/decentraland-dapps": { - "version": "19.2.0", - "resolved": "https://registry.npmjs.org/decentraland-dapps/-/decentraland-dapps-19.2.0.tgz", - "integrity": "sha512-R/2yZLnzeRZBO33Zqx6enRQfyi0p3IAoU9c3g8GHqfuNyx1Ye7HqcwkYaJwQlGDvHCcVZFDZsXSCjfFpwlwkAA==", + "version": "19.2.4", + "resolved": "https://registry.npmjs.org/decentraland-dapps/-/decentraland-dapps-19.2.4.tgz", + "integrity": "sha512-yoALXNbORNac5RhzGhPd0i30CtPA4hICHpjd9Yn0lisU94WLOURUzPTWIpxZaMswS4/16POu08e0DXTb+vEPPw==", "dependencies": { "@0xsequence/multicall": "^0.25.1", "@0xsequence/relayer": "^0.25.1", @@ -11207,6 +11212,7 @@ "@dcl/ui-env": "^1.5.0", "@transak/transak-sdk": "^1.0.31", "@types/flat": "0.0.28", + "@types/segment-analytics": "^0.0.38", "@well-known-components/fetch-component": "^2.0.1", "@wert-io/widget-initializer": "^5.2.0", "axios": "^0.21.1", @@ -11215,7 +11221,7 @@ "decentraland-connect": "^6.2.0", "decentraland-crypto-fetch": "^2.0.1", "decentraland-transactions": "^2.3.2", - "decentraland-ui": "^5.10.1", + "decentraland-ui": "^5.13.2", "ethers": "^5.6.8", "events": "^3.3.0", "flat": "^5.0.2", @@ -11468,9 +11474,9 @@ } }, "node_modules/decentraland-ui": { - "version": "5.10.1", - "resolved": "https://registry.npmjs.org/decentraland-ui/-/decentraland-ui-5.10.1.tgz", - "integrity": "sha512-OrZGWLtKsWjlntciglebHh9UOs/SDRVJeUgWmSSoXtpblSrGR6QL0NgJoY9rupudtlTM7rjENj5ufbbTkvwpgA==", + "version": "5.13.2", + "resolved": "https://registry.npmjs.org/decentraland-ui/-/decentraland-ui-5.13.2.tgz", + "integrity": "sha512-IOe4BeDr3PeGPkLH4ZIflPg8M0s/GCKP8x+6dr6nstMAd/m2hajngwnRDbhknYgCB+aEv6nbzZVBljBnYCsDPQ==", "dependencies": { "@dcl/schemas": "^10.2.0", "@dcl/ui-env": "^1.4.0", diff --git a/package.json b/package.json index f9d8a5004..e8e8c5e2e 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "decentraland": "3.3.0", "decentraland-builder-scripts": "^0.24.0", "decentraland-crypto-fetch": "^2.0.1", - "decentraland-dapps": "^19.2.0", + "decentraland-dapps": "^19.2.4", "decentraland-ecs": "6.12.4-7784644013.commit-f770b3e", "decentraland-experiments": "^1.0.2", "decentraland-transactions": "^2.0.3", diff --git a/src/modules/collection/utils.spec.ts b/src/modules/collection/utils.spec.ts index 21fb76516..6d28bfee3 100644 --- a/src/modules/collection/utils.spec.ts +++ b/src/modules/collection/utils.spec.ts @@ -277,8 +277,8 @@ describe('when getting the fiat commodity amount', () => { unitPrice = '10000000000' }) - it('should return 0.00000001', () => { - expect(getFiatGatewayCommodityAmount(unitPrice, items)).toBe(0.00000001) + it('should return 0.00000002', () => { + expect(getFiatGatewayCommodityAmount(unitPrice, items)).toBe(0.00000002) }) }) @@ -287,8 +287,8 @@ describe('when getting the fiat commodity amount', () => { unitPrice = '123456789000000000' }) - it('should return 0.12345679', () => { - expect(getFiatGatewayCommodityAmount(unitPrice, items)).toBe(0.12345679) + it('should return 0.12382716', () => { + expect(getFiatGatewayCommodityAmount(unitPrice, items)).toBe(0.12382716) }) }) @@ -298,7 +298,7 @@ describe('when getting the fiat commodity amount', () => { }) it('should return 1', () => { - expect(getFiatGatewayCommodityAmount(unitPrice, items)).toBe(1) + expect(getFiatGatewayCommodityAmount(unitPrice, items)).toBe(1.003) }) }) }) @@ -314,7 +314,7 @@ describe('when getting the fiat commodity amount', () => { }) it('should return 10', () => { - expect(getFiatGatewayCommodityAmount(unitPrice, items)).toBe(10) + expect(getFiatGatewayCommodityAmount(unitPrice, items)).toBe(10.03) }) }) }) diff --git a/src/modules/collection/utils.ts b/src/modules/collection/utils.ts index 157d4e68e..90da1bb90 100644 --- a/src/modules/collection/utils.ts +++ b/src/modules/collection/utils.ts @@ -203,10 +203,10 @@ export const toPaginationStats = (collectionPaginationData: CollectionPagination export const getFiatGatewayCommodityAmount = (unitPrice: string, items: number) => { const unitPriceWei = ethers.BigNumber.from(unitPrice) const totalPriceWei = unitPriceWei.mul(items) - const totalPriceEth = ethers.utils.formatEther(totalPriceWei.toString()) + const totalPriceEth = Number(ethers.utils.formatEther(totalPriceWei.toString())) * 1.003 // 0.3% extra to safeguard against price fluctuations. const factor = Math.pow(10, 8) // Wert supports up to 8 decimal places. // It is important to round up to this amount of decimal places to avoid issues with the widget. - return Math.ceil(Number(totalPriceEth) * factor) / factor + return Math.ceil(totalPriceEth * factor) / factor }