diff --git a/package-lock.json b/package-lock.json index 7149ddb91..7b9810718 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.2", + "decentraland-dapps": "^19.2.4", "decentraland-ecs": "6.12.4-7784644013.commit-f770b3e", "decentraland-experiments": "^1.0.2", "decentraland-transactions": "^2.0.3", @@ -10846,9 +10846,9 @@ } }, "node_modules/decentraland-dapps": { - "version": "19.2.2", - "resolved": "https://registry.npmjs.org/decentraland-dapps/-/decentraland-dapps-19.2.2.tgz", - "integrity": "sha512-cC3y0lhACi+MTmEIkrCN+8c+L4reFAdt1l+7cPj/3L66yF5aznxV5kbRvQCfRDcqlLse74OMqxKaOvjjNO9Khw==", + "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", @@ -10867,7 +10867,7 @@ "decentraland-connect": "^6.2.0", "decentraland-crypto-fetch": "^2.0.1", "decentraland-transactions": "^2.3.2", - "decentraland-ui": "^5.13.1", + "decentraland-ui": "^5.13.2", "ethers": "^5.6.8", "events": "^3.3.0", "flat": "^5.0.2", @@ -11120,9 +11120,9 @@ } }, "node_modules/decentraland-ui": { - "version": "5.13.1", - "resolved": "https://registry.npmjs.org/decentraland-ui/-/decentraland-ui-5.13.1.tgz", - "integrity": "sha512-yFBoqsBTjp9shmakMqUaqasDSCrWew3pVvA1TXCgq+sm76fS6/I4zamTy9iDxD1HWtmRHWE3WAfCZsNIvHtF/A==", + "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 0731c35bf..5fe91cb58 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.2", + "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 }