From a2ca82bba85077762b52d95e5a02869bc879e9ca Mon Sep 17 00:00:00 2001 From: Lautaro Petaccio <1120791+LautaroPetaccio@users.noreply.github.com> Date: Mon, 11 Mar 2024 12:29:58 -0300 Subject: [PATCH] feat: Use new cross chain transaction payload action (#2167) * feat: Use new cross chain transaction payload action * feat: Use new cross chain transaction * fix: Don't log on prod * fix: Add toasts * fix: Remove unused variable * fix: PR fixes --- webapp/package-lock.json | 727 ++---------------- webapp/package.json | 2 +- .../ActivityPage/Transaction/Transaction.tsx | 1 - .../TransactionDetail/TransactionDetail.tsx | 35 +- .../TransactionDetail.types.ts | 1 - .../BuyWithCryptoModal/BuyWithCryptoModal.tsx | 156 ++-- .../SuccessPage/SuccessPage.container.ts | 11 +- webapp/src/config/env/dev.json | 1 + webapp/src/config/env/prod.json | 1 + webapp/src/config/env/stg.json | 1 + webapp/src/modules/ens/sagas.spec.ts | 25 +- webapp/src/modules/ens/sagas.ts | 6 +- webapp/src/modules/item/actions.ts | 59 +- webapp/src/modules/item/sagas.spec.ts | 83 +- webapp/src/modules/item/sagas.ts | 176 ++--- webapp/src/modules/routing/locations.ts | 1 - webapp/src/modules/routing/sagas.spec.ts | 8 +- webapp/src/modules/routing/sagas.ts | 7 +- webapp/src/modules/sagas.ts | 13 +- webapp/src/modules/toast/sagas.spec.ts | 44 +- webapp/src/modules/toast/sagas.ts | 26 +- 21 files changed, 334 insertions(+), 1050 deletions(-) diff --git a/webapp/package-lock.json b/webapp/package-lock.json index a63a396796..f3e6be4045 100644 --- a/webapp/package-lock.json +++ b/webapp/package-lock.json @@ -27,7 +27,7 @@ "dcl-catalyst-commons": "^9.0.1", "decentraland-connect": "^6.2.0", "decentraland-crypto-fetch": "^1.0.3", - "decentraland-dapps": "^18.5.0", + "decentraland-dapps": "^19.0.0", "decentraland-transactions": "^2.3.1", "decentraland-ui": "^5.8.0", "ethers": "^5.6.8", @@ -326,16 +326,6 @@ "typescript": "^5.3.3" } }, - "node_modules/@aashutoshrathi/word-wrap": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", - "integrity": "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==", - "dev": true, - "peer": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/@adobe/css-tools": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.1.0.tgz", @@ -2303,37 +2293,6 @@ "node": ">=12" } }, - "node_modules/@eslint/eslintrc": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz", - "integrity": "sha512-J6KFFz5QCYUJq3pf0mjEcCJVERbzv71PUIDczuh9JkwGEzced6CO5ADLHB1rbf/+oPBtoPfMYNOpGDzCANlbXw==", - "dev": true, - "peer": true, - "dependencies": { - "ajv": "^6.12.4", - "debug": "^4.1.1", - "espree": "^7.3.0", - "globals": "^13.9.0", - "ignore": "^4.0.6", - "import-fresh": "^3.2.1", - "js-yaml": "^3.13.1", - "minimatch": "^3.0.4", - "strip-json-comments": "^3.1.1" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/@eslint/eslintrc/node_modules/ignore": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", - "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", - "dev": true, - "peer": true, - "engines": { - "node": ">= 4" - } - }, "node_modules/@ethereumjs/common": { "version": "2.6.5", "resolved": "https://registry.npmjs.org/@ethereumjs/common/-/common-2.6.5.tgz", @@ -3429,6 +3388,28 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" }, + "node_modules/@formatjs/intl": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@formatjs/intl/-/intl-2.2.1.tgz", + "integrity": "sha512-vgvyUOOrzqVaOFYzTf2d3+ToSkH2JpR7x/4U1RyoHQLmvEaTQvXJ7A2qm1Iy3brGNXC/+/7bUlc3lpH+h/LOJA==", + "dependencies": { + "@formatjs/ecma402-abstract": "1.11.4", + "@formatjs/fast-memoize": "1.2.1", + "@formatjs/icu-messageformat-parser": "2.1.0", + "@formatjs/intl-displaynames": "5.4.3", + "@formatjs/intl-listformat": "6.5.3", + "intl-messageformat": "9.13.0", + "tslib": "^2.1.0" + }, + "peerDependencies": { + "typescript": "^4.5" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, "node_modules/@formatjs/intl-displaynames": { "version": "5.4.3", "resolved": "https://registry.npmjs.org/@formatjs/intl-displaynames/-/intl-displaynames-5.4.3.tgz", @@ -3472,27 +3453,10 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" }, - "node_modules/@humanwhocodes/config-array": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.5.0.tgz", - "integrity": "sha512-FagtKFz74XrTl7y6HCzQpwDfXP0yhxe9lHLD1UZxjvZIcbyRz8zTFF/yYNfSfzU414eDwZ1SrO0Qvtyf+wFMQg==", - "dev": true, - "peer": true, - "dependencies": { - "@humanwhocodes/object-schema": "^1.2.0", - "debug": "^4.1.1", - "minimatch": "^3.0.4" - }, - "engines": { - "node": ">=10.10.0" - } - }, - "node_modules/@humanwhocodes/object-schema": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", - "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", - "dev": true, - "peer": true + "node_modules/@formatjs/intl/node_modules/tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" }, "node_modules/@ioredis/commands": { "version": "1.2.0", @@ -8443,16 +8407,6 @@ "node": ">=0.4.0" } }, - "node_modules/acorn-jsx": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", - "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", - "dev": true, - "peer": true, - "peerDependencies": { - "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" - } - }, "node_modules/acorn-walk": { "version": "8.3.2", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.2.tgz", @@ -8506,16 +8460,6 @@ "version": "0.4.1", "license": "MIT" }, - "node_modules/ansi-colors": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", - "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", - "dev": true, - "peer": true, - "engines": { - "node": ">=6" - } - }, "node_modules/ansi-escapes": { "version": "4.3.2", "dev": true, @@ -8633,16 +8577,6 @@ "node": ">=0.8" } }, - "node_modules/astral-regex": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", - "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", - "dev": true, - "peer": true, - "engines": { - "node": ">=8" - } - }, "node_modules/async-limiter": { "version": "1.0.1", "license": "MIT" @@ -11052,20 +10986,6 @@ "typescript": "^2.2.0 || ^3.0.0" } }, - "node_modules/dcl-tslint-config-standard/node_modules/typescript": { - "version": "3.9.10", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz", - "integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==", - "dev": true, - "peer": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" - } - }, "node_modules/debug": { "version": "4.3.4", "license": "MIT", @@ -11204,9 +11124,9 @@ } }, "node_modules/decentraland-dapps": { - "version": "18.5.0", - "resolved": "https://registry.npmjs.org/decentraland-dapps/-/decentraland-dapps-18.5.0.tgz", - "integrity": "sha512-QvYwfLHDU1CD4W/Wc901Dlsvp5OR1GxpyZdVyswB3nE6DsiulfA/Gvd3DrzU1gA8O5MHKu/Zzh5FBEFxQ2H1iw==", + "version": "19.0.0", + "resolved": "https://registry.npmjs.org/decentraland-dapps/-/decentraland-dapps-19.0.0.tgz", + "integrity": "sha512-/HbMbf6rIIRSbW8pX/h5Iw10Ep+DsNpJgKyhJs6U+TBlK6qhU4ieesiVgbAJNZf3rsFseLW4nMiQdi2krbtX+g==", "dependencies": { "@0xsequence/multicall": "^0.25.1", "@0xsequence/relayer": "^0.25.1", @@ -11223,7 +11143,7 @@ "dcl-catalyst-client": "^21.1.0", "decentraland-connect": "^6.2.0", "decentraland-crypto-fetch": "^2.0.1", - "decentraland-transactions": "^2.0.3", + "decentraland-transactions": "^2.3.1", "decentraland-ui": "^5.8.0", "ethers": "^5.6.8", "events": "^3.3.0", @@ -11249,28 +11169,6 @@ "redux-saga": "^1.1.3" } }, - "node_modules/decentraland-dapps/node_modules/@formatjs/intl": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/@formatjs/intl/-/intl-2.2.1.tgz", - "integrity": "sha512-vgvyUOOrzqVaOFYzTf2d3+ToSkH2JpR7x/4U1RyoHQLmvEaTQvXJ7A2qm1Iy3brGNXC/+/7bUlc3lpH+h/LOJA==", - "dependencies": { - "@formatjs/ecma402-abstract": "1.11.4", - "@formatjs/fast-memoize": "1.2.1", - "@formatjs/icu-messageformat-parser": "2.1.0", - "@formatjs/intl-displaynames": "5.4.3", - "@formatjs/intl-listformat": "6.5.3", - "intl-messageformat": "9.13.0", - "tslib": "^2.1.0" - }, - "peerDependencies": { - "typescript": "^4.5" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, "node_modules/decentraland-dapps/node_modules/date-fns": { "version": "1.30.1", "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-1.30.1.tgz", @@ -11289,37 +11187,6 @@ "npm": ">=6" } }, - "node_modules/decentraland-dapps/node_modules/react-intl": { - "version": "5.25.1", - "resolved": "https://registry.npmjs.org/react-intl/-/react-intl-5.25.1.tgz", - "integrity": "sha512-pkjdQDvpJROoXLMltkP/5mZb0/XqrqLoPGKUCfbdkP8m6U9xbK40K51Wu+a4aQqTEvEK5lHBk0fWzUV72SJ3Hg==", - "dependencies": { - "@formatjs/ecma402-abstract": "1.11.4", - "@formatjs/icu-messageformat-parser": "2.1.0", - "@formatjs/intl": "2.2.1", - "@formatjs/intl-displaynames": "5.4.3", - "@formatjs/intl-listformat": "6.5.3", - "@types/hoist-non-react-statics": "^3.3.1", - "@types/react": "16 || 17 || 18", - "hoist-non-react-statics": "^3.3.2", - "intl-messageformat": "9.13.0", - "tslib": "^2.1.0" - }, - "peerDependencies": { - "react": "^16.3.0 || 17 || 18", - "typescript": "^4.5" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/decentraland-dapps/node_modules/tslib": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" - }, "node_modules/decentraland-dapps/node_modules/typesafe-actions": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/typesafe-actions/-/typesafe-actions-2.2.0.tgz", @@ -11328,20 +11195,6 @@ "node": ">= 4" } }, - "node_modules/decentraland-dapps/node_modules/typescript": { - "version": "4.9.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", - "optional": true, - "peer": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" - } - }, "node_modules/decentraland-transactions": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/decentraland-transactions/-/decentraland-transactions-2.3.1.tgz", @@ -11473,13 +11326,6 @@ "node": ">=4.0.0" } }, - "node_modules/deep-is": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", - "dev": true, - "peer": true - }, "node_modules/deepmerge": { "version": "4.2.2", "license": "MIT", @@ -11618,19 +11464,6 @@ "node": ">=8" } }, - "node_modules/doctrine": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", - "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", - "dev": true, - "peer": true, - "dependencies": { - "esutils": "^2.0.2" - }, - "engines": { - "node": ">=6.0.0" - } - }, "node_modules/dom-accessibility-api": { "version": "0.5.16", "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz", @@ -11850,20 +11683,6 @@ "node": ">=10.0.0" } }, - "node_modules/enquirer": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.4.1.tgz", - "integrity": "sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ==", - "dev": true, - "peer": true, - "dependencies": { - "ansi-colors": "^4.1.1", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8.6" - } - }, "node_modules/err-code": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/err-code/-/err-code-3.0.1.tgz", @@ -12040,64 +11859,6 @@ "node": ">=0.10.0" } }, - "node_modules/eslint": { - "version": "7.32.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.32.0.tgz", - "integrity": "sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA==", - "dev": true, - "peer": true, - "dependencies": { - "@babel/code-frame": "7.12.11", - "@eslint/eslintrc": "^0.4.3", - "@humanwhocodes/config-array": "^0.5.0", - "ajv": "^6.10.0", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", - "debug": "^4.0.1", - "doctrine": "^3.0.0", - "enquirer": "^2.3.5", - "escape-string-regexp": "^4.0.0", - "eslint-scope": "^5.1.1", - "eslint-utils": "^2.1.0", - "eslint-visitor-keys": "^2.0.0", - "espree": "^7.3.1", - "esquery": "^1.4.0", - "esutils": "^2.0.2", - "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^6.0.1", - "functional-red-black-tree": "^1.0.1", - "glob-parent": "^5.1.2", - "globals": "^13.6.0", - "ignore": "^4.0.6", - "import-fresh": "^3.0.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "js-yaml": "^3.13.1", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", - "lodash.merge": "^4.6.2", - "minimatch": "^3.0.4", - "natural-compare": "^1.4.0", - "optionator": "^0.9.1", - "progress": "^2.0.0", - "regexpp": "^3.1.0", - "semver": "^7.2.1", - "strip-ansi": "^6.0.0", - "strip-json-comments": "^3.1.0", - "table": "^6.0.9", - "text-table": "^0.2.0", - "v8-compile-cache": "^2.0.3" - }, - "bin": { - "eslint": "bin/eslint.js" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, "node_modules/eslint-scope": { "version": "5.1.1", "dev": true, @@ -12135,80 +11896,6 @@ "node": ">=10" } }, - "node_modules/eslint/node_modules/eslint-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", - "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", - "dev": true, - "peer": true, - "dependencies": { - "eslint-visitor-keys": "^1.1.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - } - }, - "node_modules/eslint/node_modules/eslint-utils/node_modules/eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", - "dev": true, - "peer": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/eslint/node_modules/ignore": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", - "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", - "dev": true, - "peer": true, - "engines": { - "node": ">= 4" - } - }, - "node_modules/espree": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz", - "integrity": "sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==", - "dev": true, - "peer": true, - "dependencies": { - "acorn": "^7.4.0", - "acorn-jsx": "^5.3.1", - "eslint-visitor-keys": "^1.3.0" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/espree/node_modules/acorn": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", - "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", - "dev": true, - "peer": true, - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/espree/node_modules/eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", - "dev": true, - "peer": true, - "engines": { - "node": ">=4" - } - }, "node_modules/esprima": { "version": "4.0.1", "dev": true, @@ -12221,29 +11908,6 @@ "node": ">=4" } }, - "node_modules/esquery": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", - "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", - "dev": true, - "peer": true, - "dependencies": { - "estraverse": "^5.1.0" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/esquery/node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true, - "peer": true, - "engines": { - "node": ">=4.0" - } - }, "node_modules/esrecurse": { "version": "4.3.0", "dev": true, @@ -13630,13 +13294,6 @@ "version": "2.1.0", "license": "MIT" }, - "node_modules/fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", - "dev": true, - "peer": true - }, "node_modules/fast-redact": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/fast-redact/-/fast-redact-3.3.0.tgz", @@ -13698,19 +13355,6 @@ } } }, - "node_modules/file-entry-cache": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", - "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", - "dev": true, - "peer": true, - "dependencies": { - "flat-cache": "^3.0.4" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - } - }, "node_modules/file-uri-to-path": { "version": "1.0.0", "license": "MIT" @@ -13780,28 +13424,6 @@ "flat": "cli.js" } }, - "node_modules/flat-cache": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", - "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==", - "dev": true, - "peer": true, - "dependencies": { - "flatted": "^3.2.9", - "keyv": "^4.5.3", - "rimraf": "^3.0.2" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/flatted": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.1.tgz", - "integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==", - "dev": true, - "peer": true - }, "node_modules/follow-redirects": { "version": "1.15.3", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", @@ -14063,22 +13685,6 @@ "process": "^0.11.10" } }, - "node_modules/globals": { - "version": "13.24.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", - "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", - "dev": true, - "peer": true, - "dependencies": { - "type-fest": "^0.20.2" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/globalthis": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz", @@ -14632,23 +14238,6 @@ "npm": ">=2.13.0" } }, - "node_modules/import-fresh": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", - "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", - "dev": true, - "peer": true, - "dependencies": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/import-local": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", @@ -17615,13 +17204,6 @@ "version": "1.0.0", "license": "MIT" }, - "node_modules/json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", - "dev": true, - "peer": true - }, "node_modules/json-stringify-safe": { "version": "5.0.1", "license": "ISC" @@ -17741,20 +17323,6 @@ "node": ">=6" } }, - "node_modules/levn": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", - "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", - "dev": true, - "peer": true, - "dependencies": { - "prelude-ls": "^1.2.1", - "type-check": "~0.4.0" - }, - "engines": { - "node": ">= 0.8.0" - } - }, "node_modules/libsodium-sumo": { "version": "0.7.13", "resolved": "https://registry.npmjs.org/libsodium-sumo/-/libsodium-sumo-0.7.13.tgz", @@ -17929,13 +17497,6 @@ "resolved": "https://registry.npmjs.org/lodash.throttle/-/lodash.throttle-4.1.1.tgz", "integrity": "sha512-wIkUCfVKpVsWo3JSZlc+8MB5it+2AN5W8J7YVMST30UrvcQNZ1Okbj+rbVniijTWE6FGYy4XJq/rHkas8qJMLQ==" }, - "node_modules/lodash.truncate": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz", - "integrity": "sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw==", - "dev": true, - "peer": true - }, "node_modules/lodash.unset": { "version": "4.5.2", "resolved": "https://registry.npmjs.org/lodash.unset/-/lodash.unset-4.5.2.tgz", @@ -18695,24 +18256,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/optionator": { - "version": "0.9.3", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", - "integrity": "sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==", - "dev": true, - "peer": true, - "dependencies": { - "@aashutoshrathi/word-wrap": "^1.2.3", - "deep-is": "^0.1.3", - "fast-levenshtein": "^2.0.6", - "levn": "^0.4.1", - "prelude-ls": "^1.2.1", - "type-check": "^0.4.0" - }, - "engines": { - "node": ">= 0.8.0" - } - }, "node_modules/p-cancelable": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-2.1.1.tgz", @@ -18750,19 +18293,6 @@ "raf": "^3.3.0" } }, - "node_modules/parent-module": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "dev": true, - "peer": true, - "dependencies": { - "callsites": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/parse-headers": { "version": "2.0.5", "license": "MIT" @@ -18967,16 +18497,6 @@ "url": "https://opencollective.com/preact" } }, - "node_modules/prelude-ls": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", - "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", - "dev": true, - "peer": true, - "engines": { - "node": ">= 0.8.0" - } - }, "node_modules/prettier": { "version": "1.19.1", "dev": true, @@ -19464,6 +18984,37 @@ "react": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0" } }, + "node_modules/react-intl": { + "version": "5.25.1", + "resolved": "https://registry.npmjs.org/react-intl/-/react-intl-5.25.1.tgz", + "integrity": "sha512-pkjdQDvpJROoXLMltkP/5mZb0/XqrqLoPGKUCfbdkP8m6U9xbK40K51Wu+a4aQqTEvEK5lHBk0fWzUV72SJ3Hg==", + "dependencies": { + "@formatjs/ecma402-abstract": "1.11.4", + "@formatjs/icu-messageformat-parser": "2.1.0", + "@formatjs/intl": "2.2.1", + "@formatjs/intl-displaynames": "5.4.3", + "@formatjs/intl-listformat": "6.5.3", + "@types/hoist-non-react-statics": "^3.3.1", + "@types/react": "16 || 17 || 18", + "hoist-non-react-statics": "^3.3.2", + "intl-messageformat": "9.13.0", + "tslib": "^2.1.0" + }, + "peerDependencies": { + "react": "^16.3.0 || 17 || 18", + "typescript": "^4.5" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/react-intl/node_modules/tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" + }, "node_modules/react-is": { "version": "16.13.1", "license": "MIT" @@ -20083,16 +19634,6 @@ "node": ">=8" } }, - "node_modules/resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "dev": true, - "peer": true, - "engines": { - "node": ">=4" - } - }, "node_modules/resolve-pathname": { "version": "3.0.0", "license": "MIT" @@ -20131,22 +19672,6 @@ "resolved": "https://registry.npmjs.org/right-now/-/right-now-1.0.0.tgz", "integrity": "sha512-DA8+YS+sMIVpbsuKgy+Z67L9Lxb1p05mNxRpDPNksPDEFir4vmBlUtuN9jkTGn9YMMdlBuK7XQgFiz6ws+yhSg==" }, - "node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "peer": true, - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/ripemd160": { "version": "2.0.2", "license": "MIT", @@ -20660,60 +20185,6 @@ "node": ">=8" } }, - "node_modules/slice-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", - "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", - "dev": true, - "peer": true, - "dependencies": { - "ansi-styles": "^4.0.0", - "astral-regex": "^2.0.0", - "is-fullwidth-code-point": "^3.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/slice-ansi?sponsor=1" - } - }, - "node_modules/slice-ansi/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "peer": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/slice-ansi/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "peer": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/slice-ansi/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "peer": true - }, "node_modules/socket.io-client": { "version": "4.7.3", "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.7.3.tgz", @@ -21113,23 +20584,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/table": { - "version": "6.8.1", - "resolved": "https://registry.npmjs.org/table/-/table-6.8.1.tgz", - "integrity": "sha512-Y4X9zqrCftUhMeH2EptSSERdVKt/nEdijTOacGD/97EKjhQ/Qs8RTlEGABSJNNN8lac9kheH+af7yAkEWlgneA==", - "dev": true, - "peer": true, - "dependencies": { - "ajv": "^8.0.1", - "lodash.truncate": "^4.4.2", - "slice-ansi": "^4.0.0", - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=10.0.0" - } - }, "node_modules/table-layout": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/table-layout/-/table-layout-1.0.2.tgz", @@ -21163,23 +20617,6 @@ "node": ">=8" } }, - "node_modules/table/node_modules/ajv": { - "version": "8.12.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", - "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", - "dev": true, - "peer": true, - "dependencies": { - "fast-deep-equal": "^3.1.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, "node_modules/tar": { "version": "4.4.19", "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.19.tgz", @@ -21231,13 +20668,6 @@ "resolved": "https://registry.npmjs.org/text-encoding-utf-8/-/text-encoding-utf-8-1.0.2.tgz", "integrity": "sha512-8bw4MY9WjdsD2aMtO0OzOCY3pXGYNx2d2FfHRVUKkiCPDWjKuOlhLVASS+pD7VkLTVjW268LYJHwsnPFlBpbAg==" }, - "node_modules/text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", - "dev": true, - "peer": true - }, "node_modules/thread-stream": { "version": "0.15.2", "resolved": "https://registry.npmjs.org/thread-stream/-/thread-stream-0.15.2.tgz", @@ -21653,19 +21083,6 @@ "version": "1.2.0", "license": "ISC" }, - "node_modules/type-check": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", - "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", - "dev": true, - "peer": true, - "dependencies": { - "prelude-ls": "^1.2.1" - }, - "engines": { - "node": ">= 0.8.0" - } - }, "node_modules/type-detect": { "version": "4.0.8", "dev": true, @@ -21674,19 +21091,6 @@ "node": ">=4" } }, - "node_modules/type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true, - "peer": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/type-is": { "version": "1.6.18", "license": "MIT", @@ -22077,13 +21481,6 @@ "uuid": "dist/bin/uuid" } }, - "node_modules/v8-compile-cache": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.4.0.tgz", - "integrity": "sha512-ocyWc3bAHBB/guyqJQVI5o4BZkPhznPYUG2ea80Gond/BgNWpap8TOmLSeeQG7bnh2KMISxskdADG59j7zruhw==", - "dev": true, - "peer": true - }, "node_modules/v8-compile-cache-lib": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", diff --git a/webapp/package.json b/webapp/package.json index cd8c761596..33d278d648 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -22,7 +22,7 @@ "dcl-catalyst-commons": "^9.0.1", "decentraland-connect": "^6.2.0", "decentraland-crypto-fetch": "^1.0.3", - "decentraland-dapps": "^18.5.0", + "decentraland-dapps": "^19.0.0", "decentraland-transactions": "^2.3.1", "decentraland-ui": "^5.8.0", "ethers": "^5.6.8", diff --git a/webapp/src/components/ActivityPage/Transaction/Transaction.tsx b/webapp/src/components/ActivityPage/Transaction/Transaction.tsx index 125bb14b52..9fcf8c25cd 100644 --- a/webapp/src/components/ActivityPage/Transaction/Transaction.tsx +++ b/webapp/src/components/ActivityPage/Transaction/Transaction.tsx @@ -219,7 +219,6 @@ const Transaction = (props: Props) => { /> } tx={tx} - isCrossChain={tx.actionType === BUY_ITEM_CROSS_CHAIN_SUCCESS} /> )} diff --git a/webapp/src/components/ActivityPage/Transaction/TransactionDetail/TransactionDetail.tsx b/webapp/src/components/ActivityPage/Transaction/TransactionDetail/TransactionDetail.tsx index e22654fe28..f076578804 100644 --- a/webapp/src/components/ActivityPage/Transaction/TransactionDetail/TransactionDetail.tsx +++ b/webapp/src/components/ActivityPage/Transaction/TransactionDetail/TransactionDetail.tsx @@ -1,17 +1,11 @@ -import React, { useEffect, useState } from 'react' +import React from 'react' import { Link } from 'react-router-dom' import { Loader, Icon } from 'decentraland-ui' import { Network } from '@dcl/schemas' import { getChainConfiguration } from 'decentraland-dapps/dist/lib/chainConfiguration' import { t } from 'decentraland-dapps/dist/modules/translation/utils' -import { - isPending, - getTransactionHref -} from 'decentraland-dapps/dist/modules/transaction/utils' -import { - TransactionStatus, - Transaction -} from 'decentraland-dapps/dist/modules/transaction/types' +import { isPending } from 'decentraland-dapps/dist/modules/transaction/utils' +import { TransactionStatus } from 'decentraland-dapps/dist/modules/transaction/types' import { formatDistanceToNow } from '../../../../lib/date' import { getAssetUrl } from '../../../../modules/asset/utils' import { AssetImage } from '../../../AssetImage' @@ -21,26 +15,9 @@ import { Mana } from '../../../Mana' import { Props } from './TransactionDetail.types' import './TransactionDetail.css' -const getHref = (tx: Transaction) => { - if (tx.status === null) { - return - } - return getTransactionHref({ txHash: tx.replacedBy || tx.hash }, tx.chainId) -} - const TransactionDetail = (props: Props) => { - const { asset, text, tx, isCrossChain = false } = props - const [txLink, setTxLink] = useState(getHref(tx)) - useEffect(() => { - ;(async () => { - if (isCrossChain) { - const { AxelarProvider } = await import( - 'decentraland-transactions/crossChain' - ) - setTxLink(await AxelarProvider.getTxLink(tx.hash)) - } - })() - }) + const { asset, text, tx } = props + return ( @@ -69,7 +46,7 @@ const TransactionDetail = (props: Props) => { { onBuyCrossChain, onGetMana, onClose, - onGoBack + onGoBack, } = props const crossChainSupportedChains = useRef([]) const analytics = getAnalytics() const manaAddressOnAssetChain = getContract( ContractName.MANAToken, - asset.chainId + asset.chainId, ).address const abortControllerRef = useRef(new AbortController()) // useStates - const [providerChains, setProviderChains] = useState( - getDefaultChains() - ) + const [providerChains, setProviderChains] = + useState(getDefaultChains()) const [providerTokens, setProviderTokens] = useState([]) const [selectedChain, setSelectedChain] = useState(asset.chainId) const [selectedToken, setSelectedToken] = useState( - getMANAToken(asset.chainId) + getMANAToken(asset.chainId), ) const [canBuyAsset, setCanBuyAsset] = useState() const [insufficientToken, setInsufficientToken] = useState< @@ -89,40 +92,39 @@ export const BuyWithCryptoModal = (props: Props) => { >() const [showChainSelector, setShowChainSelector] = useState(false) const [showTokenSelector, setShowTokenSelector] = useState(false) - const [crossChainProvider, setCrossChainProvider] = useState< - CrossChainProvider - >() + const [crossChainProvider, setCrossChainProvider] = + useState() const manaTokenOnSelectedChain: Token | undefined = useMemo(() => { return providerTokens.find( - t => t.symbol === 'MANA' && t.chainId === selectedChain.toString() + (t) => t.symbol === 'MANA' && t.chainId === selectedChain.toString(), ) }, [providerTokens, selectedChain]) const manaTokenOnAssetChain: Token | undefined = useMemo(() => { return providerTokens.find( - t => + (t) => t.address.toLocaleLowerCase() === - manaAddressOnAssetChain.toLocaleLowerCase() + manaAddressOnAssetChain.toLocaleLowerCase(), ) }, [providerTokens, manaAddressOnAssetChain]) const selectedProviderChain = useMemo(() => { return providerChains.find( - c => c.chainId.toString() === selectedChain.toString() + (c) => c.chainId.toString() === selectedChain.toString(), ) }, [providerChains, selectedChain]) const chainNativeToken = useMemo(() => { return providerTokens.find( - t => + (t) => +t.chainId === selectedChain && - t.symbol === selectedProviderChain?.nativeCurrency.symbol + t.symbol === selectedProviderChain?.nativeCurrency.symbol, ) }, [selectedChain, selectedProviderChain, providerTokens]) const { gasCost, isFetchingGasCost } = onGetGasCost( selectedToken, chainNativeToken, - wallet + wallet, ) const { @@ -131,18 +133,20 @@ export const BuyWithCryptoModal = (props: Props) => { routeFeeCost, routeTotalUSDCost, isFetchingRoute, - routeFailed + routeFailed, } = onGetCrossChainRoute( selectedToken, selectedChain, providerTokens, crossChainProvider, - wallet + wallet, ) useEffect(() => { const initializeCrossChainProvider = async () => { - const { AxelarProvider, CROSS_CHAIN_SUPPORTED_CHAINS } = await import('decentraland-transactions/crossChain') + const { AxelarProvider, CROSS_CHAIN_SUPPORTED_CHAINS } = await import( + 'decentraland-transactions/crossChain' + ) const provider = new AxelarProvider(squidURL) crossChainSupportedChains.current = CROSS_CHAIN_SUPPORTED_CHAINS await provider.init() // init the provider on the mount @@ -152,15 +156,13 @@ export const BuyWithCryptoModal = (props: Props) => { initializeCrossChainProvider() }, []) - const { - isFetchingBalance, - tokenBalance: selectedTokenBalance - } = useTokenBalance(selectedToken, selectedChain, wallet?.address) + const { isFetchingBalance, tokenBalance: selectedTokenBalance } = + useTokenBalance(selectedToken, selectedChain, wallet?.address) // if the tx should be done through the provider const shouldUseCrossChainProvider = useShouldUseCrossChainProvider( selectedToken, - asset.network + asset.network, ) // Compute if the process should use a meta tx (connected in ETH and buying a L2 NFT) @@ -173,7 +175,7 @@ export const BuyWithCryptoModal = (props: Props) => { selectedChain, selectedToken.address, manaAddressOnAssetChain, - wallet.network + wallet.network, ) ) }, [asset, manaAddressOnAssetChain, selectedChain, selectedToken, wallet]) @@ -181,7 +183,7 @@ export const BuyWithCryptoModal = (props: Props) => { // Compute if the price is too low for meta tx const hasLowPriceForMetaTx = useMemo( () => wallet?.chainId !== ChainId.MATIC_MAINNET && isPriceTooLow(price), // not connected to polygon AND has price < minimum for meta tx - [price, wallet?.chainId] + [price, wallet?.chainId], ) // init lib if necessary and fetch chains & supported tokens @@ -198,19 +200,21 @@ export const BuyWithCryptoModal = (props: Props) => { ...defaultChains, ...crossChainProvider .getSupportedChains() - .filter(c => defaultChains.every(dc => dc.chainId !== c.chainId)) + .filter((c) => + defaultChains.every((dc) => dc.chainId !== c.chainId), + ), ] // keep the defaults since we support MANA on them natively setProviderChains( supportedChains.filter( - c => - crossChainSupportedChains.current.includes(+c.chainId) && - defaultChains.find(t => t.chainId === c.chainId) - ) + (c) => + crossChainSupportedChains.current.includes(+c.chainId) && + defaultChains.find((t) => t.chainId === c.chainId), + ), ) setProviderTokens( - supportedTokens.filter(t => - crossChainSupportedChains.current.includes(+t.chainId) - ) + supportedTokens.filter((t) => + crossChainSupportedChains.current.includes(+t.chainId), + ), ) } } catch (error) { @@ -228,11 +232,11 @@ export const BuyWithCryptoModal = (props: Props) => { ) { try { setSelectedToken( - manaTokenOnSelectedChain || getMANAToken(selectedChain) + manaTokenOnSelectedChain || getMANAToken(selectedChain), ) // if it's not in the providerTokens, create the object manually with the right conectract address } catch (error) { const selectedChainTokens = providerTokens.filter( - t => t.chainId === selectedChain.toString() + (t) => t.chainId === selectedChain.toString(), ) setSelectedToken(selectedChainTokens[0]) } @@ -242,7 +246,7 @@ export const BuyWithCryptoModal = (props: Props) => { providerTokens.length, manaTokenOnSelectedChain, selectedChain, - selectedToken + selectedToken, ]) // computes if the user can buy the item with the selected token @@ -273,8 +277,8 @@ export const BuyWithCryptoModal = (props: Props) => { const balance = parseFloat( ethers.utils.formatUnits( selectedTokenBalance, - selectedToken.decimals - ) + selectedToken.decimals, + ), ) if ( @@ -292,21 +296,21 @@ export const BuyWithCryptoModal = (props: Props) => { } } else { const networkProvider = await getNetworkProvider( - Number(routeFeeCost.token.chainId) + Number(routeFeeCost.token.chainId), ) const provider = new ethers.providers.Web3Provider( - networkProvider + networkProvider, ) const balanceNativeTokenWei = await provider.getBalance( - wallet.address + wallet.address, ) const canPayForGas = balanceNativeTokenWei.gte( - ethers.utils.parseEther(routeFeeCost.totalCost) + ethers.utils.parseEther(routeFeeCost.totalCost), ) canBuy = canPayForGas && balance > Number(fromAmount) if (!canBuy) { setInsufficientToken( - !canPayForGas ? routeFeeCost.token : selectedToken + !canPayForGas ? routeFeeCost.token : selectedToken, ) } } @@ -325,7 +329,7 @@ export const BuyWithCryptoModal = (props: Props) => { selectedChain, selectedToken, selectedTokenBalance, - wallet + wallet, ]) const handleCrossChainBuy = useCallback(async () => { @@ -351,7 +355,7 @@ export const BuyWithCryptoModal = (props: Props) => { ) : ( t('buy_with_crypto_modal.switch_network', { - chain: selectedProviderChain?.networkName + chain: selectedProviderChain?.networkName, }) )} @@ -360,7 +364,7 @@ export const BuyWithCryptoModal = (props: Props) => { isSwitchingNetwork, onSwitchNetwork, selectedProviderChain, - selectedChain + selectedChain, ]) const handleBuyWithCard = useCallback(() => { @@ -407,7 +411,7 @@ export const BuyWithCryptoModal = (props: Props) => { onBuyWithCard, handleBuyWithCard, onGetMana, - onClose + onClose, ]) const renderBuyNowButton = useCallback(() => { @@ -454,7 +458,7 @@ export const BuyWithCryptoModal = (props: Props) => { isFetchingBalance, onBuyNatively, handleCrossChainBuy, - shouldUseCrossChainProvider + shouldUseCrossChainProvider, ]) const renderMainActionButton = useCallback(() => { @@ -489,8 +493,8 @@ export const BuyWithCryptoModal = (props: Props) => { return wallet.network === Network.MATIC ? renderBuyNowButton() : isPriceTooLow(price) - ? renderSwitchNetworkButton() // switch to MATIC to pay for the gas - : renderBuyNowButton() + ? renderSwitchNetworkButton() // switch to MATIC to pay for the gas + : renderBuyNowButton() } // can buy it with MANA from other chain through the provider @@ -510,7 +514,7 @@ export const BuyWithCryptoModal = (props: Props) => { selectedChain, renderBuyNowButton, renderSwitchNetworkButton, - renderGetMANAButton + renderGetMANAButton, ]) const onTokenOrChainSelection = useCallback( @@ -522,25 +526,25 @@ export const BuyWithCryptoModal = (props: Props) => { abortControllerRef.current.abort() const selectedToken = providerTokens.find( - t => + (t) => t.address === selectedOption.address && - t.chainId === selectedChain.toString() + t.chainId === selectedChain.toString(), ) as Token // reset all fields setSelectedToken(selectedToken) setCanBuyAsset(undefined) abortControllerRef.current = new AbortController() analytics.track(events.CROSS_CHAIN_TOKEN_SELECTION, { - selectedToken + selectedToken, }) } else { setSelectedChain(Number(selectedOption.chainId) as ChainId) const manaDestinyChain = providerTokens.find( - t => t.symbol === 'MANA' && t.chainId === selectedOption.chainId + (t) => t.symbol === 'MANA' && t.chainId === selectedOption.chainId, ) // set the selected token on the new chain selected to MANA or the first one found const selectedToken = providerTokens.find( - t => t.chainId === selectedOption.chainId + (t) => t.chainId === selectedOption.chainId, ) const token = manaDestinyChain || selectedToken if (token) { @@ -548,11 +552,11 @@ export const BuyWithCryptoModal = (props: Props) => { } analytics.track(events.CROSS_CHAIN_CHAIN_SELECTION, { - selectedChain: selectedOption.chainId + selectedChain: selectedOption.chainId, }) } }, - [analytics, providerTokens, selectedChain] + [analytics, providerTokens, selectedChain], ) const renderModalNavigation = useCallback(() => { @@ -562,7 +566,7 @@ export const BuyWithCryptoModal = (props: Props) => { title={t( `buy_with_crypto_modal.token_and_chain_selector.select_${ showChainSelector ? 'chain' : 'token' - }` + }`, )} onBack={() => { setShowChainSelector(false) @@ -575,7 +579,7 @@ export const BuyWithCryptoModal = (props: Props) => { {children} + b: (children: React.ReactChildren) => {children}, })} onBack={!isBuyingAsset ? onGoBack : undefined} onClose={!isBuyingAsset ? onClose : undefined} @@ -590,7 +594,7 @@ export const BuyWithCryptoModal = (props: Props) => { ? 'with_card' : 'with_mana' : null, - 'page' + 'page', ]).join('_') const location = useLocation() @@ -602,7 +606,7 @@ export const BuyWithCryptoModal = (props: Props) => { if (hasModalQueryParam) { search.delete('buyWithCrypto') history.replace({ - search: search.toString() + search: search.toString(), }) } onClose() @@ -732,7 +736,7 @@ export const BuyWithCryptoModal = (props: Props) => { {' '} {t( - 'buy_with_crypto_modal.durations.transaction_duration' + 'buy_with_crypto_modal.durations.transaction_duration', )}{' '} {route ? ( @@ -741,15 +745,15 @@ export const BuyWithCryptoModal = (props: Props) => { route.route.estimate.estimatedRouteDuration === 0 ? 'fast' : route.route.estimate.estimatedRouteDuration === 20 - ? 'normal' - : 'slow' - }` + ? 'normal' + : 'slow' + }`, ) ) : ( )} @@ -768,7 +772,7 @@ export const BuyWithCryptoModal = (props: Props) => { )} @@ -786,7 +790,7 @@ export const BuyWithCryptoModal = (props: Props) => { {t('buy_with_crypto_modal.covered_for_you_by_dao')} - ) + ), })} ) : null} @@ -807,7 +811,7 @@ export const BuyWithCryptoModal = (props: Props) => { {/* TODO: add this URL */} {t('buy_with_crypto_modal.learn_more')} - ) + ), })} ) : null} @@ -816,7 +820,7 @@ export const BuyWithCryptoModal = (props: Props) => { !isFetchingRoute ? ( {t('buy_with_crypto_modal.insufficient_funds', { - token: insufficientToken?.symbol || 'MANA' + token: insufficientToken?.symbol || 'MANA', })} ) : null} @@ -824,7 +828,7 @@ export const BuyWithCryptoModal = (props: Props) => { {' '} {t('buy_with_crypto_modal.route_unavailable', { - token: selectedToken.symbol + token: selectedToken.symbol, })} ) : null} @@ -837,7 +841,7 @@ export const BuyWithCryptoModal = (props: Props) => {
{renderMainActionButton()} diff --git a/webapp/src/components/SuccessPage/SuccessPage.container.ts b/webapp/src/components/SuccessPage/SuccessPage.container.ts index 4cced01428..1a75345c35 100644 --- a/webapp/src/components/SuccessPage/SuccessPage.container.ts +++ b/webapp/src/components/SuccessPage/SuccessPage.container.ts @@ -14,22 +14,13 @@ import { SuccessPage } from './SuccessPage' const mapState = (state: RootState): MapStateProps => { const search = new URLSearchParams(getSearch(state)) - const isCrossChain = search.get('isCrossChain') === 'true' const transaction = getTransaction(state, search.get('txHash') || '') - const destinationTx = isCrossChain - ? getTransaction(state, search.get('destinationTxHash') || '') - : null const address = getAddress(state) const isLoadingTx = Boolean( transaction && transaction.status !== TransactionStatus.CONFIRMED ) - const isDestinationTxLoading = Boolean( - destinationTx && destinationTx.status !== TransactionStatus.CONFIRMED - ) return { - isLoading: isCrossChain - ? isLoadingTx || isDestinationTxLoading - : isLoadingTx, + isLoading: isLoadingTx, mintedTokenId: getTokenIdFromLogs( ChainId.MATIC_MUMBAI, transaction?.receipt?.logs diff --git a/webapp/src/config/env/dev.json b/webapp/src/config/env/dev.json index 4c69e04dc8..a84ea93478 100644 --- a/webapp/src/config/env/dev.json +++ b/webapp/src/config/env/dev.json @@ -44,6 +44,7 @@ "SUBGRAPH_WORKER": "https://subgraph.decentraland.zone", "SENTRY_DSN": "https://1dc401149e1c819b8477565c9cdd9b70@o4504361728212992.ingest.sentry.io/4505743351676928", "SQUID_API_URL": "https://testnet.v2.api.squidrouter.com/", + "SQUID_RETRY_DELAY": "2000", "DCL_LISTS_SERVER": "https://dcl-lists.decentraland.zone", "AUTH_URL": "/auth", "WERT_URL": "https://sandbox.wert.io", diff --git a/webapp/src/config/env/prod.json b/webapp/src/config/env/prod.json index 34b4218837..4f71cc4c79 100644 --- a/webapp/src/config/env/prod.json +++ b/webapp/src/config/env/prod.json @@ -44,6 +44,7 @@ "SUBGRAPH_WORKER": "https://subgraph.decentraland.org", "SENTRY_DSN": "https://1dc401149e1c819b8477565c9cdd9b70@o4504361728212992.ingest.sentry.io/4505743351676928", "SQUID_API_URL": "https://apiplus.squidrouter.com/api", + "SQUID_RETRY_DELAY": "2000", "DCL_LISTS_SERVER": "https://dcl-lists.decentraland.org", "AUTH_URL": "/auth", "WERT_URL": "https://widget.wert.io", diff --git a/webapp/src/config/env/stg.json b/webapp/src/config/env/stg.json index 3cfe9d214d..ba6d7cfffe 100644 --- a/webapp/src/config/env/stg.json +++ b/webapp/src/config/env/stg.json @@ -44,6 +44,7 @@ "SUBGRAPH_WORKER": "https://subgraph.decentraland.today", "SENTRY_DSN": "https://1dc401149e1c819b8477565c9cdd9b70@o4504361728212992.ingest.sentry.io/4505743351676928", "SQUID_API_URL": "https://apiplus.squidrouter.com/api", + "SQUID_RETRY_DELAY": "2000", "DCL_LISTS_SERVER": "https://dcl-lists.decentraland.org", "AUTH_URL": "/auth", "WERT_URL": "https://widget.wert.io", diff --git a/webapp/src/modules/ens/sagas.spec.ts b/webapp/src/modules/ens/sagas.spec.ts index 63a0833b5a..8a5717dd25 100644 --- a/webapp/src/modules/ens/sagas.spec.ts +++ b/webapp/src/modules/ens/sagas.spec.ts @@ -9,10 +9,7 @@ import { getSigner, getConnectedProvider } from 'decentraland-dapps/dist/lib/eth' -import { - TRANSACTION_ACTION_FLAG, - waitForTx -} from 'decentraland-dapps/dist/modules/transaction/utils' +import { waitForTx } from 'decentraland-dapps/dist/modules/transaction/utils' import { Wallet } from 'decentraland-dapps/dist/modules/wallet/types' import { closeModal } from 'decentraland-dapps/dist/modules/modal/actions' import { ensSaga } from './sagas' @@ -22,7 +19,6 @@ import { claimNameFailure, claimNameTransactionSubmitted, claimNameRequest, - CLAIM_NAME_TRANSACTION_SUBMITTED, claimNameCrossChainRequest, claimNameCrossChainFailure, claimNameCrossChainSuccess @@ -287,19 +283,12 @@ describe('ENS Saga', () => { mockTransaction = { hash: '0xTransactionHash' } as ethers.ContractTransaction - mockAction = { - type: CLAIM_NAME_TRANSACTION_SUBMITTED, - payload: { - [TRANSACTION_ACTION_FLAG]: { - chainId: mockWallet.chainId, - hash: mockTransaction.hash, - payload: { - address: mockWallet.address, - subdomain: mockName - } - } - } - } + mockAction = claimNameTransactionSubmitted( + mockName, + mockWallet.address, + ChainId.ARBITRUM_MAINNET, + mockTransaction.hash + ) mockTokenId = BigNumber.from(1) dclRegistrarContract = { address: '0xAnAddress' } mockENS = { diff --git a/webapp/src/modules/ens/sagas.ts b/webapp/src/modules/ens/sagas.ts index 5ea7405b72..e18366f0aa 100644 --- a/webapp/src/modules/ens/sagas.ts +++ b/webapp/src/modules/ens/sagas.ts @@ -5,10 +5,8 @@ import { getSigner } from 'decentraland-dapps/dist/lib/eth' import { Provider, Wallet } from 'decentraland-dapps/dist/modules/wallet/types' -import { - TRANSACTION_ACTION_FLAG, - waitForTx -} from 'decentraland-dapps/dist/modules/transaction/utils' +import { waitForTx } from 'decentraland-dapps/dist/modules/transaction/utils' +import { TRANSACTION_ACTION_FLAG } from 'decentraland-dapps/dist/modules/transaction/types' import { t } from 'decentraland-dapps/dist/modules/translation' import { closeModal } from 'decentraland-dapps/dist/modules/modal/actions' import { DCLController } from '../../contracts' diff --git a/webapp/src/modules/item/actions.ts b/webapp/src/modules/item/actions.ts index 24b9886066..a032596136 100644 --- a/webapp/src/modules/item/actions.ts +++ b/webapp/src/modules/item/actions.ts @@ -1,8 +1,9 @@ import { ChainId, Item, ItemFilters, Order } from '@dcl/schemas' import { NFTPurchase } from 'decentraland-dapps/dist/modules/gateway/types' import { + buildCrossChainTransactionFromPayload, buildTransactionWithFromPayload, - buildTransactionWithReceiptPayload + buildTransactionWithReceiptPayload, } from 'decentraland-dapps/dist/modules/transaction/utils' import type { Route } from 'decentraland-transactions/crossChain' import { action } from 'typesafe-actions' @@ -24,7 +25,7 @@ export const fetchItemsSuccess = ( items: Item[], total: number, options: ItemBrowseOptions, - timestamp: number + timestamp: number, ) => action(FETCH_ITEMS_SUCCESS, { items, total, options, timestamp }) export const fetchItemsFailure = (error: string, options: ItemBrowseOptions) => @@ -66,7 +67,7 @@ export const FETCH_COLLECTION_ITEMS_SUCCESS = '[Success] Fetch Collection Items' export const FETCH_COLLECTION_ITEMS_FAILURE = '[Failure] Fetch Collection Items' export const fetchCollectionItemsRequest = ( - options: Pick + options: Pick, ) => action(FETCH_COLLECTION_ITEMS_REQUEST, options) export const fetchCollectionItemsSuccess = (items: Item[]) => @@ -102,8 +103,8 @@ export const buyItemSuccess = (chainId: ChainId, txHash: string, item: Item) => contractAddress: item.contractAddress, network: item.network, name: getAssetName(item), - price: formatWeiMANA(item.price) - }) + price: formatWeiMANA(item.price), + }), }) export const buyItemFailure = (error: string) => @@ -114,48 +115,48 @@ export type BuyItemSuccessAction = ReturnType export type BuyItemFailureAction = ReturnType // Buy Item Cross Chain -export const TRACK_CROSS_CHAIN_TX_REQUEST = '[Request] Track Buy item cross-chain tx' export const BUY_ITEM_CROSS_CHAIN_REQUEST = '[Request] Buy item cross-chain' export const BUY_ITEM_CROSS_CHAIN_SUCCESS = '[Success] Buy item cross-chain' export const BUY_ITEM_CROSS_CHAIN_FAILURE = '[Failure] Buy item cross-chain' -export const buyItemCrossChainRequest = (item: Item, route: Route, order?: Order) => - action(BUY_ITEM_CROSS_CHAIN_REQUEST, { item, route, order }) +export const buyItemCrossChainRequest = ( + item: Item, + route: Route, + order?: Order, +) => action(BUY_ITEM_CROSS_CHAIN_REQUEST, { item, route, order }) export const buyItemCrossChainSuccess = ( route: Route, chainId: ChainId, txHash: string, item: Item, - order?: Order + order?: Order, ) => action(BUY_ITEM_CROSS_CHAIN_SUCCESS, { route, item, txHash, order, - ...buildTransactionWithReceiptPayload(chainId, txHash, { - itemId: item.itemId, - contractAddress: item.contractAddress, - network: item.network, - name: getAssetName(item), - price: formatWeiMANA(order?.price ?? item.price) - }) - }) - - export const trackCrossChainTx = ( - chainId: ChainId, - txHash: string, -) => - action(TRACK_CROSS_CHAIN_TX_REQUEST, { - ...buildTransactionWithReceiptPayload(chainId, txHash ) + ...buildCrossChainTransactionFromPayload( + chainId, + Number(route.route.params.toChain) as ChainId, + txHash, + route.requestId ?? 'Unknown', + { + itemId: item.itemId, + contractAddress: item.contractAddress, + network: item.network, + name: getAssetName(item), + price: formatWeiMANA(order?.price ?? item.price), + }, + ), }) export const buyItemCrossChainFailure = ( route: Route, item: Item, price: string, - error: string + error: string, ) => action(BUY_ITEM_CROSS_CHAIN_FAILURE, { route, item, price, error }) export type BuyItemCrossChainRequestAction = ReturnType< @@ -179,7 +180,7 @@ export const buyItemWithCardSuccess = ( chainId: ChainId, txHash: string, item: Item, - purchase: NFTPurchase + purchase: NFTPurchase, ) => action(BUY_ITEM_WITH_CARD_SUCCESS, { item, @@ -189,8 +190,8 @@ export const buyItemWithCardSuccess = ( contractAddress: item.contractAddress, network: item.network, name: getAssetName(item), - price: purchase.nft.cryptoAmount.toString() - }) + price: purchase.nft.cryptoAmount.toString(), + }), }) export const buyItemWithCardFailure = (error: string) => action(BUY_ITEM_WITH_CARD_FAILURE, { error }) @@ -218,7 +219,7 @@ export const fetchItemSuccess = (item: Item) => export const fetchItemFailure = ( contractAddress: string, tokenId: string, - error: string + error: string, ) => action(FETCH_ITEM_FAILURE, { contractAddress, tokenId, error }) export type FetchItemRequestAction = ReturnType diff --git a/webapp/src/modules/item/sagas.spec.ts b/webapp/src/modules/item/sagas.spec.ts index c9232f4089..812066fe68 100644 --- a/webapp/src/modules/item/sagas.spec.ts +++ b/webapp/src/modules/item/sagas.spec.ts @@ -1,7 +1,7 @@ -import { getLocation, push } from 'connected-react-router' +import { getLocation } from 'connected-react-router' import { expectSaga } from 'redux-saga-test-plan' import * as matchers from 'redux-saga-test-plan/matchers' -import { call, delay, select, take } from 'redux-saga/effects' +import { call, select, take } from 'redux-saga/effects' import { ChainId, Item, Network, Rarity } from '@dcl/schemas' import { Wallet } from 'decentraland-dapps/dist/modules/wallet/types' import { sendTransaction } from 'decentraland-dapps/dist/modules/wallet/utils' @@ -48,24 +48,14 @@ import { fetchCollectionItemsRequest, fetchCollectionItemsSuccess, fetchCollectionItemsFailure, - FETCH_ITEMS_CANCELLED_ERROR_MESSAGE, - buyItemCrossChainSuccess, - trackCrossChainTx + FETCH_ITEMS_CANCELLED_ERROR_MESSAGE } from './actions' -import { - AxelarProvider, - RouteResponse, - StatusResponse -} from 'decentraland-transactions/crossChain' import { CANCEL_FETCH_ITEMS, itemSaga } from './sagas' import { getData as getItems } from './selectors' import { getItem } from './utils' import { ItemBrowseOptions } from './types' import { getIsMarketplaceServerEnabled } from '../features/selectors' import { waitForFeatureFlagsToBeLoaded } from '../features/utils' -import { AssetType } from '../asset/types' -import { showToast } from 'decentraland-dapps/dist/modules/toast/actions' -import { getCrossChainTransactionSuccessToast } from '../toast/toasts' const item = { itemId: 'anItemId', @@ -770,70 +760,3 @@ describe('when handling the fetch trending items request action', () => { }) }) }) - -describe('when handling the buy item cross chain success action', () => { - let route: RouteResponse - let chainId: ChainId - let txHash: string - let statusResponse: StatusResponse - beforeEach(() => { - chainId = ChainId.ETHEREUM_MAINNET - txHash = 'aHash' - }) - describe('and its an actual cross chain purchase', () => { - beforeEach(() => { - route = { - requestId: 'aRequestId', - route: { - params: { - fromChain: ChainId.ETHEREUM_MAINNET.toString(), - toChain: ChainId.MATIC_MAINNET.toString() - } - } - } as RouteResponse - statusResponse = { - status: 'success', - toChain: { - transactionId: 'destinationChainTx' - } - } as StatusResponse - }) - it('should get the status of the transaction and put the trackCrossChainTx action, put location success and put the cross chain success toast', () => { - return expectSaga(itemSaga, getIdentity) - .provide([ - [ - matchers.call.fn(AxelarProvider.prototype.getStatus), - statusResponse - ], - [delay(1000), void 0] - ]) - .put( - trackCrossChainTx( - parseInt(route.route.params.toChain) as ChainId, - statusResponse.toChain!.transactionId - ) - ) - .put( - showToast( - getCrossChainTransactionSuccessToast( - AxelarProvider.getTxLink(txHash) - ) - ) - ) - .put( - push( - locations.success({ - txHash, - destinationTxHash: statusResponse.toChain?.transactionId, - tokenId: item.itemId, - assetType: AssetType.ITEM, - contractAddress: item.contractAddress, - isCrossChain: 'true' - }) - ) - ) - .dispatch(buyItemCrossChainSuccess(route, chainId, txHash, item)) - .run({ silenceTimeout: true }) - }) - }) -}) diff --git a/webapp/src/modules/item/sagas.ts b/webapp/src/modules/item/sagas.ts index a95dff3552..02fb4f9d5b 100644 --- a/webapp/src/modules/item/sagas.ts +++ b/webapp/src/modules/item/sagas.ts @@ -1,19 +1,18 @@ import { matchPath } from 'react-router-dom' -import { getLocation, push } from 'connected-react-router' +import { getLocation } from 'connected-react-router' import { SagaIterator } from 'redux-saga' import { put, takeEvery } from '@redux-saga/core/effects' import { call, cancel, cancelled, - delay, fork, race, select, - take + take, } from 'redux-saga/effects' import { ethers } from 'ethers' -import { ChainId, Item } from '@dcl/schemas' +import { Item } from '@dcl/schemas' import { getConnectedProvider } from 'decentraland-dapps/dist/lib/eth' import { ContractName, getContract } from 'decentraland-transactions' import { Provider } from 'decentraland-connect' @@ -22,14 +21,11 @@ import { sendTransaction } from 'decentraland-dapps/dist/modules/wallet/utils' import { t } from 'decentraland-dapps/dist/modules/translation/utils' import { SetPurchaseAction, - SET_PURCHASE + SET_PURCHASE, } from 'decentraland-dapps/dist/modules/gateway/actions' import { isNFTPurchase } from 'decentraland-dapps/dist/modules/gateway/utils' import { PurchaseStatus } from 'decentraland-dapps/dist/modules/gateway/types' import { isErrorWithMessage } from '../../lib/error' -import { StatusResponse } from 'decentraland-transactions/crossChain' -import { showToast } from 'decentraland-dapps/dist/modules/toast/actions' -import { getCrossChainTransactionSuccessToast } from '../toast/toasts' import { config } from '../../config' import { ItemAPI } from '../vendor/decentraland/item/api' import { getWallet } from '../wallet/selectors' @@ -78,12 +74,8 @@ import { BUY_ITEM_CROSS_CHAIN_REQUEST, buyItemCrossChainSuccess, buyItemCrossChainFailure, - BUY_ITEM_CROSS_CHAIN_SUCCESS, - BuyItemCrossChainSuccessAction, - trackCrossChainTx } from './actions' import { getData as getItems } from './selectors' -import { AssetType } from '../asset/types' import { getItem } from './utils' export const NFT_SERVER_URL = config.get('NFT_SERVER_URL')! @@ -93,24 +85,23 @@ export function* itemSaga(getIdentity: () => AuthIdentity | undefined) { const API_OPTS = { retries: retryParams.attempts, retryDelay: retryParams.delay, - identity: getIdentity + identity: getIdentity, } const itemAPI = new ItemAPI(NFT_SERVER_URL, API_OPTS) const marketplaceServerCatalogAPI = new CatalogAPI( MARKETPLACE_SERVER_URL, - API_OPTS + API_OPTS, ) const catalogAPI = new CatalogAPI(NFT_SERVER_URL, API_OPTS) yield fork(() => takeLatestByPath(FETCH_ITEMS_REQUEST, locations.browse())) yield takeEvery( FETCH_COLLECTION_ITEMS_REQUEST, - handleFetchCollectionItemsRequest + handleFetchCollectionItemsRequest, ) yield takeEvery(FETCH_TRENDING_ITEMS_REQUEST, handleFetchTrendingItemsRequest) yield takeEvery(BUY_ITEM_REQUEST, handleBuyItem) yield takeEvery(BUY_ITEM_CROSS_CHAIN_REQUEST, handleBuyItemCrossChain) - yield takeEvery(BUY_ITEM_CROSS_CHAIN_SUCCESS, handleBuyItemCrossChainSuccess) yield takeEvery(BUY_ITEM_WITH_CARD_REQUEST, handleBuyItemWithCardRequest) yield takeEvery(SET_PURCHASE, handleSetItemPurchaseWithCard) yield takeEvery(FETCH_ITEM_REQUEST, handleFetchItemRequest) @@ -121,9 +112,8 @@ export function* itemSaga(getIdentity: () => AuthIdentity | undefined) { while (true) { const action: FetchItemsRequestAction = yield take(actionType) - const { - pathname: currentPathname - }: ReturnType = yield select(getLocation) + const { pathname: currentPathname }: ReturnType = + yield select(getLocation) // if we have a task running in the browse path, we cancel the previous one if (matchPath(currentPathname, { path }) && task && task.isRunning()) { @@ -135,7 +125,7 @@ export function* itemSaga(getIdentity: () => AuthIdentity | undefined) { } function* handleFetchTrendingItemsRequest( - action: FetchTrendingItemsRequestAction + action: FetchTrendingItemsRequestAction, ) { const { size } = action.payload @@ -145,7 +135,7 @@ export function* itemSaga(getIdentity: () => AuthIdentity | undefined) { yield call(waitForWalletConnectionAndIdentityIfConnecting) const { data }: { data: Item[] } = yield call( [itemAPI, 'getTrendings'], - size + size, ) if (!data.length) { @@ -153,9 +143,9 @@ export function* itemSaga(getIdentity: () => AuthIdentity | undefined) { return } - const ids = data.map(item => item.id) + const ids = data.map((item) => item.id) const isMarketplaceServerEnabled: boolean = yield select( - getIsMarketplaceServerEnabled + getIsMarketplaceServerEnabled, ) const api = isMarketplaceServerEnabled ? marketplaceServerCatalogAPI @@ -163,40 +153,40 @@ export function* itemSaga(getIdentity: () => AuthIdentity | undefined) { const { data: itemData }: { data: Item[]; total: number } = yield call( [api, 'get'], { - ids - } + ids, + }, ) yield put(fetchTrendingItemsSuccess(itemData)) } catch (error) { yield put( fetchTrendingItemsFailure( - isErrorWithMessage(error) ? error.message : t('global.unknown_error') - ) + isErrorWithMessage(error) ? error.message : t('global.unknown_error'), + ), ) } } function* handleFetchCollectionItemsRequest( - action: FetchCollectionItemsRequestAction + action: FetchCollectionItemsRequestAction, ) { const { contractAddresses, first } = action.payload try { const { data }: { data: Item[]; total: number } = yield call( [itemAPI, 'get'], - { first, contractAddresses } + { first, contractAddresses }, ) yield put(fetchCollectionItemsSuccess(data)) } catch (error) { yield put( fetchCollectionItemsFailure( - isErrorWithMessage(error) ? error.message : t('global.unknown_error') - ) + isErrorWithMessage(error) ? error.message : t('global.unknown_error'), + ), ) } } function* handleFetchItemsRequest( - action: FetchItemsRequestAction + action: FetchItemsRequestAction, ): SagaIterator { const { filters, view } = action.payload @@ -205,7 +195,7 @@ export function* itemSaga(getIdentity: () => AuthIdentity | undefined) { yield call(waitForWalletConnectionAndIdentityIfConnecting) yield call(waitForFeatureFlagsToBeLoaded) const isMarketplaceServerEnabled: boolean = yield select( - getIsMarketplaceServerEnabled + getIsMarketplaceServerEnabled, ) const catalogViewAPI = isMarketplaceServerEnabled ? marketplaceServerCatalogAPI @@ -213,21 +203,24 @@ export function* itemSaga(getIdentity: () => AuthIdentity | undefined) { const api = isCatalogView(view) ? catalogViewAPI : itemAPI const { data, total }: { data: Item[]; total: number } = yield call( [api, 'get'], - filters + filters, ) yield put(fetchItemsSuccess(data, total, action.payload, Date.now())) } catch (error) { yield put( fetchItemsFailure( isErrorWithMessage(error) ? error.message : t('global.unknown_error'), - action.payload - ) + action.payload, + ), ) } finally { if (yield cancelled()) { // if cancelled, we dispatch a failure action so it cleans the loading state yield put( - fetchItemsFailure(FETCH_ITEMS_CANCELLED_ERROR_MESSAGE, action.payload) + fetchItemsFailure( + FETCH_ITEMS_CANCELLED_ERROR_MESSAGE, + action.payload, + ), ) } } @@ -243,7 +236,7 @@ export function* itemSaga(getIdentity: () => AuthIdentity | undefined) { const item: Item = yield call( [itemAPI, 'getOne'], contractAddress, - tokenId + tokenId, ) yield put(fetchItemSuccess(item)) if (item.data?.wearable?.isSmart && item.urn) { @@ -254,8 +247,8 @@ export function* itemSaga(getIdentity: () => AuthIdentity | undefined) { fetchItemFailure( contractAddress, tokenId, - isErrorWithMessage(error) ? error.message : t('global.unknown_error') - ) + isErrorWithMessage(error) ? error.message : t('global.unknown_error'), + ), ) } } @@ -275,85 +268,27 @@ export function* itemSaga(getIdentity: () => AuthIdentity | undefined) { const txHash: string = yield call( sendTransaction, contract, - collectionStore => + (collectionStore) => collectionStore.buy([ [ item.contractAddress, [item.itemId], [item.price], - [wallet.address] - ] - ]) + [wallet.address], + ], + ]), ) yield put(buyItemSuccess(wallet.chainId, txHash, item)) } catch (error) { yield put( buyItemFailure( - isErrorWithMessage(error) ? error.message : t('global.unknown_error') - ) + isErrorWithMessage(error) ? error.message : t('global.unknown_error'), + ), ) } } - function* handleBuyItemCrossChainSuccess( - action: BuyItemCrossChainSuccessAction - ) { - const { route, item, order, txHash } = action.payload - // if it's an actual cross-chain interaction, we need to get the tx hash in the destination chain - if ( - route.requestId && - route.route.params.fromChain !== route.route.params.toChain - ) { - let status: StatusResponse | undefined - const crossChainModule = import('decentraland-transactions/crossChain') - const { - AxelarProvider - }: Awaited = yield crossChainModule - const crossChainProvider = new AxelarProvider(config.get('SQUID_API_URL')) - const destinationChain = Number(route.route.params.toChain) as ChainId - while (!status || !status?.toChain?.transactionId) { - // wrapping in try-catch since it throws an error if the tx is not found (the first seconds after triggering it) - try { - status = yield call( - [crossChainProvider, 'getStatus'], - route.requestId, - txHash - ) - } catch (error) { - console.error('error: ', error) - } - yield delay(1000) - } - if (status?.toChain?.transactionId) { - yield put( - trackCrossChainTx(destinationChain, status?.toChain?.transactionId) - ) - yield put( - push( - locations.success({ - txHash, - destinationTxHash: status?.toChain?.transactionId, - tokenId: item.itemId, - assetType: order ? AssetType.NFT : AssetType.ITEM, - contractAddress: order - ? order.contractAddress - : item.contractAddress, - isCrossChain: ('route' in action.payload).toString() - }) - ) - ) - yield put( - showToast( - getCrossChainTransactionSuccessToast( - AxelarProvider.getTxLink(txHash) - ) - ) - ) - } - } - } - function* handleBuyItemCrossChain(action: BuyItemCrossChainRequestAction) { const { item, route, order } = action.payload try { @@ -367,16 +302,15 @@ export function* itemSaga(getIdentity: () => AuthIdentity | undefined) { if (provider) { const crossChainModule = import('decentraland-transactions/crossChain') - const { - AxelarProvider - }: Awaited = yield crossChainModule + const { AxelarProvider }: Awaited = + yield crossChainModule const crossChainProvider = new AxelarProvider( - config.get('SQUID_API_URL') + config.get('SQUID_API_URL'), ) const txResponse: ethers.providers.TransactionReceipt = yield call( [crossChainProvider, 'executeRoute'], route, - provider + provider, ) yield put( @@ -385,8 +319,8 @@ export function* itemSaga(getIdentity: () => AuthIdentity | undefined) { Number(route.route.params.fromChain), txResponse.transactionHash, item, - order - ) + order, + ), ) } } catch (error) { @@ -395,8 +329,8 @@ export function* itemSaga(getIdentity: () => AuthIdentity | undefined) { route, item, order?.price || item.price, - isErrorWithMessage(error) ? error.message : t('global.unknown_error') - ) + isErrorWithMessage(error) ? error.message : t('global.unknown_error'), + ), ) } } @@ -408,8 +342,8 @@ export function* itemSaga(getIdentity: () => AuthIdentity | undefined) { } catch (error) { yield put( buyItemWithCardFailure( - isErrorWithMessage(error) ? error.message : t('global.unknown_error') - ) + isErrorWithMessage(error) ? error.message : t('global.unknown_error'), + ), ) } } @@ -426,7 +360,7 @@ export function* itemSaga(getIdentity: () => AuthIdentity | undefined) { txHash ) { const { - nft: { contractAddress, itemId } + nft: { contractAddress, itemId }, } = purchase const items: ReturnType = yield select(getItems) @@ -434,7 +368,7 @@ export function* itemSaga(getIdentity: () => AuthIdentity | undefined) { getItem, contractAddress, itemId, - items + items, ) if (!item) { @@ -442,13 +376,13 @@ export function* itemSaga(getIdentity: () => AuthIdentity | undefined) { const { success, - failure + failure, }: { success: FetchItemSuccessAction failure: FetchItemFailureAction } = yield race({ success: take(FETCH_ITEM_SUCCESS), - failure: take(FETCH_ITEM_FAILURE) + failure: take(FETCH_ITEM_FAILURE), }) if (failure) throw new Error(failure.payload.error) @@ -461,8 +395,8 @@ export function* itemSaga(getIdentity: () => AuthIdentity | undefined) { } catch (error) { yield put( buyItemWithCardFailure( - isErrorWithMessage(error) ? error.message : t('global.unknown_error') - ) + isErrorWithMessage(error) ? error.message : t('global.unknown_error'), + ), ) } } diff --git a/webapp/src/modules/routing/locations.ts b/webapp/src/modules/routing/locations.ts index 07aed22f0e..36fc3f610f 100644 --- a/webapp/src/modules/routing/locations.ts +++ b/webapp/src/modules/routing/locations.ts @@ -132,7 +132,6 @@ export const locations = { assetType: string contractAddress: string subdomain?: string - isCrossChain?: string destinationTxHash?: string }) => `/success${ diff --git a/webapp/src/modules/routing/sagas.spec.ts b/webapp/src/modules/routing/sagas.spec.ts index 4fd87e486d..2b6e801552 100644 --- a/webapp/src/modules/routing/sagas.spec.ts +++ b/webapp/src/modules/routing/sagas.spec.ts @@ -1386,10 +1386,10 @@ describe('handleRedirectToSuccessPage saga', () => { txHash: 'txHash', tokenId: order.tokenId, assetType: AssetType.NFT, - contractAddress: item.contractAddress, - isCrossChain: 'true' + contractAddress: item.contractAddress } }) + it('should redirect to success page with the correct query params', () => { return expectSaga(routingSaga) .put(push(locations.success(searchParams))) @@ -1412,10 +1412,10 @@ describe('handleRedirectToSuccessPage saga', () => { txHash: 'txHash', tokenId: item.itemId, assetType: AssetType.ITEM, - contractAddress: item.contractAddress, - isCrossChain: 'true' + contractAddress: item.contractAddress } }) + it('should redirect to success page with the correct query params', () => { return expectSaga(routingSaga) .put(push(locations.success(searchParams))) diff --git a/webapp/src/modules/routing/sagas.ts b/webapp/src/modules/routing/sagas.ts index 89f5b3191a..7421f02f41 100644 --- a/webapp/src/modules/routing/sagas.ts +++ b/webapp/src/modules/routing/sagas.ts @@ -32,7 +32,7 @@ import { ConnectWalletSuccessAction } from 'decentraland-dapps/dist/modules/wallet/actions' import { openModal } from 'decentraland-dapps/dist/modules/modal/actions' -import { TRANSACTION_ACTION_FLAG } from 'decentraland-dapps/dist/modules/transaction/utils' +import { TRANSACTION_ACTION_FLAG } from 'decentraland-dapps/dist/modules/transaction/types' import { getSigner } from 'decentraland-dapps/dist/lib/eth' import { Wallet } from 'decentraland-dapps/dist/modules/wallet/types' import { isLegacyOrder } from '../../lib/orders' @@ -806,10 +806,7 @@ function* handleRedirectToSuccessPage( ? payload.nft.contractAddress : 'ens' in payload ? payload.ens.contractAddress - : '', - ...(isCrossChainAction - ? { isCrossChain: isCrossChainAction.toString() } - : {}) + : '' } yield put(push(locations.success(successParams))) } diff --git a/webapp/src/modules/sagas.ts b/webapp/src/modules/sagas.ts index f00121f0ce..bef660aba8 100644 --- a/webapp/src/modules/sagas.ts +++ b/webapp/src/modules/sagas.ts @@ -83,6 +83,13 @@ const gatewaySaga = createGatewaySaga({ } }) +const getCrossChainProvider = async () => { + const { AxelarProvider } = await import( + 'decentraland-transactions/crossChain' + ) + return AxelarProvider +} + export function* rootSaga(getIdentity: () => AuthIdentity | undefined) { yield all([ analyticsSaga(), @@ -97,7 +104,11 @@ export function* rootSaga(getIdentity: () => AuthIdentity | undefined) { routingSaga(), tileSaga(), toastSaga(), - transactionSaga(), + transactionSaga({ + crossChainProviderUrl: config.get('SQUID_API_URL'), + crossChainProviderRetryDelay: Number(config.get('SQUID_RETRY_DELAY')), + getCrossChainProvider + }), translationSaga(), uiSaga(), walletSaga(), diff --git a/webapp/src/modules/toast/sagas.spec.ts b/webapp/src/modules/toast/sagas.spec.ts index 2e589ac753..704ed86ddc 100644 --- a/webapp/src/modules/toast/sagas.spec.ts +++ b/webapp/src/modules/toast/sagas.spec.ts @@ -1,9 +1,13 @@ -import { Item, Order, RentalListing } from '@dcl/schemas' +import { ChainId, Item, Order, RentalListing } from '@dcl/schemas' import { hideAllToasts, showToast } from 'decentraland-dapps/dist/modules/toast/actions' import { getState } from 'decentraland-dapps/dist/modules/toast/selectors' +import { + CrossChainProviderType, + getTransactionHref +} from 'decentraland-dapps/dist/modules/transaction' import { expectSaga } from 'redux-saga-test-plan' import { select } from 'redux-saga/effects' import { @@ -16,6 +20,7 @@ import { } from '../favorites/actions' import { FetchItemsFailureAction, + buyItemCrossChainSuccess, buyItemWithCardFailure, fetchItemsFailure } from '../item/actions' @@ -45,7 +50,8 @@ import { getBulkPickItemSuccessToast, getBulkPickItemFailureToast, getUpdateListSuccessToast, - getNameClaimSuccessToast + getNameClaimSuccessToast, + getCrossChainTransactionSuccessToast } from '../toast/toasts' import { ItemBrowseOptions } from '../item/types' import { FetchNFTsFailureAction, fetchNFTsFailure } from '../nft/actions' @@ -307,7 +313,7 @@ describe('when handling a put into the toastDispatchableActionsChannel', () => { }) }) -describe('when handling a success claiming actiono', () => { +describe('when handling a success claiming action', () => { it('should call the showToast', () => { return expectSaga(toastSaga) .provide([[select(getState), []]]) @@ -316,3 +322,35 @@ describe('when handling a success claiming actiono', () => { .silentRun() }) }) + +describe('when handling a successful cross chain item purchase', () => { + let action: ReturnType + let actionLink: string + + beforeEach(() => { + const txHash = '0xHash' + const crossChainProviderType = CrossChainProviderType.SQUID + + action = buyItemCrossChainSuccess( + { + route: { params: { toChain: ChainId.MATIC_MAINNET } }, + requestId: 'aRequestId' + } as any, + ChainId.ETHEREUM_MAINNET, + txHash, + { name: 'aName', price: '1000000000000' } as Item + ) + actionLink = getTransactionHref({ + txHash, + crossChainProviderType + }) + }) + + it('should put the showToast action with the cross chain toast', () => { + return expectSaga(toastSaga) + .provide([[select(getState), []]]) + .dispatch(action) + .put(showToast(getCrossChainTransactionSuccessToast(actionLink))) + .silentRun() + }) +}) diff --git a/webapp/src/modules/toast/sagas.ts b/webapp/src/modules/toast/sagas.ts index 50991a5185..6e5a7b8c4f 100644 --- a/webapp/src/modules/toast/sagas.ts +++ b/webapp/src/modules/toast/sagas.ts @@ -4,6 +4,10 @@ import { showToast, hideAllToasts } from 'decentraland-dapps/dist/modules/toast/actions' +import { + TRANSACTION_ACTION_FLAG, + getTransactionHref +} from 'decentraland-dapps/dist/modules/transaction' import { UPDATE_STORE_SUCCESS } from '../store/actions' import { CLAIM_ASSET_SUCCESS, @@ -12,7 +16,9 @@ import { UPSERT_RENTAL_SUCCESS } from '../rental/actions' import { + BUY_ITEM_CROSS_CHAIN_SUCCESS, BUY_ITEM_WITH_CARD_FAILURE, + BuyItemCrossChainSuccessAction, FETCH_ITEMS_CANCELLED_ERROR_MESSAGE, FETCH_ITEMS_FAILURE, FetchItemsFailureAction @@ -35,7 +41,8 @@ import { getListingRemoveSuccessToast, getStoreUpdateSuccessToast, getUpdateListSuccessToast, - getUpsertRentalSuccessToast + getUpsertRentalSuccessToast, + getCrossChainTransactionSuccessToast } from './toasts' import { DeleteListSuccessAction, @@ -82,6 +89,7 @@ function* successToastSagas() { ) yield takeEvery(BULK_PICK_SUCCESS, handleBulkPickUnpickSuccess) yield takeEvery(BULK_PICK_FAILURE, handleBulkPickUnpickFailure) + yield takeEvery(BUY_ITEM_CROSS_CHAIN_SUCCESS, handleBuyItemCrossChainSuccess) function* handleToastTryAgainActionChannel( action: DispatchableFromToastActions @@ -177,3 +185,19 @@ function* handleBulkPickUnpickFailure(action: BulkPickUnpickFailureAction) { ) ) } + +function* handleBuyItemCrossChainSuccess( + action: BuyItemCrossChainSuccessAction +) { + yield put( + showToast( + getCrossChainTransactionSuccessToast( + getTransactionHref({ + txHash: action.payload[TRANSACTION_ACTION_FLAG].hash, + crossChainProviderType: + action.payload[TRANSACTION_ACTION_FLAG].crossChainProviderType + }) + ) + ) + ) +}