diff --git a/package-lock.json b/package-lock.json index 484d48d4..6b2a534d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,19 +21,19 @@ "@solana/spl-name-service": "^0.2.0", "@solana/spl-token": "0.3.8", "@solana/web3.js": "^1.87.3", - "@toruslabs/base-controllers": "^4.7.0", + "@toruslabs/base-controllers": "^4.11.0", "@toruslabs/broadcast-channel": "^9.0.1", "@toruslabs/eccrypto": "^4.0.0", - "@toruslabs/http-helpers": "^5.0.0", + "@toruslabs/http-helpers": "^6.0.0", "@toruslabs/loglevel-sentry": "^6.0.1", "@toruslabs/metadata-helpers": "^5.0.0", "@toruslabs/openlogin": "^6.0.0", "@toruslabs/openlogin-ed25519": "^6.0.0", - "@toruslabs/openlogin-jrpc": "^6.0.0", + "@toruslabs/openlogin-jrpc": "^6.1.0", "@toruslabs/openlogin-session-manager": "^3.0.0", "@toruslabs/openlogin-subkey": "^6.0.0", - "@toruslabs/openlogin-utils": "^6.0.0", - "@toruslabs/solana-controllers": "^4.7.0", + "@toruslabs/openlogin-utils": "^6.1.0", + "@toruslabs/solana-controllers": "^4.11.0", "@toruslabs/tweetnacl-js": "^1.0.4", "@toruslabs/vue-components": "^2.0.1", "@toruslabs/vue-icons": "^2.0.0", @@ -4142,9 +4142,9 @@ } }, "node_modules/@solana/web3.js": { - "version": "1.87.3", - "resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.87.3.tgz", - "integrity": "sha512-WGLzTZpi00vP443qGK3gL+LZXQJwaWkh6bzNXYpMTCAH2Z102y3YbPWOoQzJUeRSZWSXKh7MFkA3vDMFlMvGZQ==", + "version": "1.87.6", + "resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.87.6.tgz", + "integrity": "sha512-LkqsEBgTZztFiccZZXnawWa8qNCATEqE97/d0vIwjTclmVlc8pBpD1DmjfVHtZ1HS5fZorFlVhXfpwnCNDZfyg==", "dependencies": { "@babel/runtime": "^7.23.2", "@noble/curves": "^1.2.0", @@ -4256,15 +4256,15 @@ } }, "node_modules/@toruslabs/base-controllers": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/@toruslabs/base-controllers/-/base-controllers-4.7.0.tgz", - "integrity": "sha512-64SMRr+iG2E/8Ytz+NW45yTMuVtRumrQbY5huxPv6/muB2VqzojCCMZHL5uC3ZEoybSvhu9DTMaz/sQ7j/dTAg==", + "version": "4.11.0", + "resolved": "https://registry.npmjs.org/@toruslabs/base-controllers/-/base-controllers-4.11.0.tgz", + "integrity": "sha512-WJBvAXHL2GpfDdeoBS7Egw/urX862NyS5jxTTOtsTwJrMW9rG482Qa/5oRkiqJafAjkSF5vtsZxVtqZicEzlsA==", "dependencies": { "@ethereumjs/util": "^9.0.1", "@metamask/rpc-errors": "^6.1.0", "@toruslabs/broadcast-channel": "^9.0.1", - "@toruslabs/http-helpers": "^5.0.0", - "@toruslabs/openlogin-jrpc": "^6.0.0", + "@toruslabs/http-helpers": "^6.0.0", + "@toruslabs/openlogin-jrpc": "^6.1.0", "async-mutex": "^0.4.0", "bignumber.js": "^9.1.2", "bowser": "^2.11.0", @@ -4294,6 +4294,28 @@ "@babel/runtime": "7.x" } }, + "node_modules/@toruslabs/base-session-manager/node_modules/@toruslabs/http-helpers": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@toruslabs/http-helpers/-/http-helpers-5.0.0.tgz", + "integrity": "sha512-GmezWz9JeF6YyhjLSm+9XDF4YaeICEckY0Jbo43i86SjhfJYgRWqEi63VSiNsaqc/z810Q0FQvEk1TnBRX2tgA==", + "dependencies": { + "lodash.merge": "^4.6.2", + "loglevel": "^1.8.1" + }, + "engines": { + "node": ">=18.x", + "npm": ">=9.x" + }, + "peerDependencies": { + "@babel/runtime": "^7.x", + "@sentry/types": "^7.x" + }, + "peerDependenciesMeta": { + "@sentry/types": { + "optional": true + } + } + }, "node_modules/@toruslabs/broadcast-channel": { "version": "9.0.1", "resolved": "https://registry.npmjs.org/@toruslabs/broadcast-channel/-/broadcast-channel-9.0.1.tgz", @@ -4327,9 +4349,9 @@ } }, "node_modules/@toruslabs/constants": { - "version": "13.0.3", - "resolved": "https://registry.npmjs.org/@toruslabs/constants/-/constants-13.0.3.tgz", - "integrity": "sha512-DiksceNFwzV4XBwcPdKpV6tfrvWIxhmwseTJbNnlzdy6uXgzvtagfapu+98pjrkNrjoRLiM17QBgBi8sNw7oGQ==", + "version": "13.1.0", + "resolved": "https://registry.npmjs.org/@toruslabs/constants/-/constants-13.1.0.tgz", + "integrity": "sha512-W1LyRoM5xCTyNivGnxa+mOit4yWPZjyYHfM+whYBujP1nQVnJ09nSFCBn1ePm6ONxB5mp58jsI3TJugeY2KFSg==", "engines": { "node": ">=18.x", "npm": ">=9.x" @@ -4393,9 +4415,9 @@ } }, "node_modules/@toruslabs/http-helpers": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@toruslabs/http-helpers/-/http-helpers-5.0.0.tgz", - "integrity": "sha512-GmezWz9JeF6YyhjLSm+9XDF4YaeICEckY0Jbo43i86SjhfJYgRWqEi63VSiNsaqc/z810Q0FQvEk1TnBRX2tgA==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@toruslabs/http-helpers/-/http-helpers-6.0.0.tgz", + "integrity": "sha512-/KrISB9fGV2TM+5Z+0CGj24d/G08kqbB+kodO3nbwNcS0a55dpy+RiB0naF3H1gbEt4Ah5YH8qCDyAZ+zcR2FQ==", "dependencies": { "lodash.merge": "^4.6.2", "loglevel": "^1.8.1" @@ -4450,6 +4472,28 @@ "@babel/runtime": "7.x" } }, + "node_modules/@toruslabs/metadata-helpers/node_modules/@toruslabs/http-helpers": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@toruslabs/http-helpers/-/http-helpers-5.0.0.tgz", + "integrity": "sha512-GmezWz9JeF6YyhjLSm+9XDF4YaeICEckY0Jbo43i86SjhfJYgRWqEi63VSiNsaqc/z810Q0FQvEk1TnBRX2tgA==", + "dependencies": { + "lodash.merge": "^4.6.2", + "loglevel": "^1.8.1" + }, + "engines": { + "node": ">=18.x", + "npm": ">=9.x" + }, + "peerDependencies": { + "@babel/runtime": "^7.x", + "@sentry/types": "^7.x" + }, + "peerDependenciesMeta": { + "@sentry/types": { + "optional": true + } + } + }, "node_modules/@toruslabs/openlogin": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/@toruslabs/openlogin/-/openlogin-6.0.0.tgz", @@ -4489,12 +4533,12 @@ } }, "node_modules/@toruslabs/openlogin-jrpc": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/@toruslabs/openlogin-jrpc/-/openlogin-jrpc-6.0.0.tgz", - "integrity": "sha512-qi4h0/abyreyeoL+mg4I8nkC/QmP7ID1nRCrz+Uzx/t8d7I11kmpVXwjclVxhd1qt+m4uXaWFaFZONBjYdBYqw==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@toruslabs/openlogin-jrpc/-/openlogin-jrpc-6.1.0.tgz", + "integrity": "sha512-0w3VSAjbHu5Mv+T5YSgAqC+jXjZtcPvBr5g7w2MeF6sICmk3OtMoGqD9XadLsOELcwSA35wrVvZuTbV+elXzhA==", "dependencies": { "@metamask/rpc-errors": "^6.1.0", - "@toruslabs/openlogin-utils": "^6.0.0", + "@toruslabs/openlogin-utils": "^6.1.0", "end-of-stream": "^1.4.4", "events": "^3.3.0", "fast-safe-stringify": "^2.1.1", @@ -4546,11 +4590,11 @@ } }, "node_modules/@toruslabs/openlogin-utils": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/@toruslabs/openlogin-utils/-/openlogin-utils-6.0.0.tgz", - "integrity": "sha512-BbKgkUCNpGTJxuPSDYBoKEDSJ+q3bC0Po4VOUjszBNtHMlAcubIkuTLPt7qBQkLAtbiW4cfkojTRRjIGEcUaQQ==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@toruslabs/openlogin-utils/-/openlogin-utils-6.1.0.tgz", + "integrity": "sha512-X3xBui0GKiK5JZ677Q4UhLvMn1FOjL1a+1y9qPAn+b+bh41Gg1c8G/VMGRqMuu7owdQGY3B6f7XWuRSEYNk8kQ==", "dependencies": { - "@toruslabs/constants": "^13.0.3", + "@toruslabs/constants": "^13.0.4", "base64url": "^3.0.1" }, "engines": { @@ -4580,18 +4624,40 @@ "@babel/runtime": "7.x" } }, + "node_modules/@toruslabs/secure-pub-sub/node_modules/@toruslabs/http-helpers": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@toruslabs/http-helpers/-/http-helpers-5.0.0.tgz", + "integrity": "sha512-GmezWz9JeF6YyhjLSm+9XDF4YaeICEckY0Jbo43i86SjhfJYgRWqEi63VSiNsaqc/z810Q0FQvEk1TnBRX2tgA==", + "dependencies": { + "lodash.merge": "^4.6.2", + "loglevel": "^1.8.1" + }, + "engines": { + "node": ">=18.x", + "npm": ">=9.x" + }, + "peerDependencies": { + "@babel/runtime": "^7.x", + "@sentry/types": "^7.x" + }, + "peerDependenciesMeta": { + "@sentry/types": { + "optional": true + } + } + }, "node_modules/@toruslabs/solana-controllers": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/@toruslabs/solana-controllers/-/solana-controllers-4.7.0.tgz", - "integrity": "sha512-Ed/ym7j+z/8JHTO2Ru+eJ/IRy+yxNXr60mVeQ8RrKy2v0IkjBretsSRpu064cwswRO+Fyjjw5PkRMrIJV0C18A==", + "version": "4.11.0", + "resolved": "https://registry.npmjs.org/@toruslabs/solana-controllers/-/solana-controllers-4.11.0.tgz", + "integrity": "sha512-4qXW9sZ7A3QrUaUN4Jp4tmcotWJ3mGT/iWoLH3FeEFIx4ZeYprsxzlnw2ogHyAnrjvEyZHjqrM9tNhu6cO1y/w==", "dependencies": { "@metaplex-foundation/mpl-token-metadata": "^2.13.0", - "@solana/spl-token": "0.3.8", - "@solana/web3.js": "^1.87.3", - "@toruslabs/base-controllers": "^4.7.0", - "@toruslabs/http-helpers": "^5.0.0", + "@solana/spl-token": "0.3.9", + "@solana/web3.js": "^1.87.6", + "@toruslabs/base-controllers": "^4.11.0", + "@toruslabs/http-helpers": "^6.0.0", "@toruslabs/openlogin-ed25519": "^6.0.0", - "@toruslabs/openlogin-jrpc": "^6.0.0", + "@toruslabs/openlogin-jrpc": "^6.1.0", "@toruslabs/tweetnacl-js": "^1.0.4", "async-mutex": "^0.4.0", "bignumber.js": "^9.1.2", @@ -4623,6 +4689,22 @@ "debug": "^4.3.4" } }, + "node_modules/@toruslabs/solana-controllers/node_modules/@solana/spl-token": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@solana/spl-token/-/spl-token-0.3.9.tgz", + "integrity": "sha512-1EXHxKICMnab35MvvY/5DBc/K/uQAOJCYnDZXw83McCAYUAfi+rwq6qfd6MmITmSTEhcfBcl/zYxmW/OSN0RmA==", + "dependencies": { + "@solana/buffer-layout": "^4.0.0", + "@solana/buffer-layout-utils": "^0.2.0", + "buffer": "^6.0.3" + }, + "engines": { + "node": ">=16" + }, + "peerDependencies": { + "@solana/web3.js": "^1.47.4" + } + }, "node_modules/@toruslabs/tweetnacl-js": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/@toruslabs/tweetnacl-js/-/tweetnacl-js-1.0.4.tgz", diff --git a/package.json b/package.json index 7ab96338..06bf1ef1 100644 --- a/package.json +++ b/package.json @@ -32,19 +32,19 @@ "@solana/spl-name-service": "^0.2.0", "@solana/spl-token": "0.3.8", "@solana/web3.js": "^1.87.3", - "@toruslabs/base-controllers": "^4.7.0", + "@toruslabs/base-controllers": "^4.11.0", "@toruslabs/broadcast-channel": "^9.0.1", "@toruslabs/eccrypto": "^4.0.0", - "@toruslabs/http-helpers": "^5.0.0", + "@toruslabs/http-helpers": "^6.0.0", "@toruslabs/loglevel-sentry": "^6.0.1", "@toruslabs/metadata-helpers": "^5.0.0", "@toruslabs/openlogin": "^6.0.0", "@toruslabs/openlogin-ed25519": "^6.0.0", - "@toruslabs/openlogin-jrpc": "^6.0.0", + "@toruslabs/openlogin-jrpc": "^6.1.0", "@toruslabs/openlogin-session-manager": "^3.0.0", "@toruslabs/openlogin-subkey": "^6.0.0", - "@toruslabs/openlogin-utils": "^6.0.0", - "@toruslabs/solana-controllers": "^4.7.0", + "@toruslabs/openlogin-utils": "^6.1.0", + "@toruslabs/solana-controllers": "^4.11.0", "@toruslabs/tweetnacl-js": "^1.0.4", "@toruslabs/vue-components": "^2.0.1", "@toruslabs/vue-icons": "^2.0.0", diff --git a/src/controllers/TorusController.ts b/src/controllers/TorusController.ts index ebd6b0b0..4e528f2a 100644 --- a/src/controllers/TorusController.ts +++ b/src/controllers/TorusController.ts @@ -1651,6 +1651,9 @@ export default class TorusController extends BaseController { throw new Error("Unsupported method"); }, + showWindowBlockAlert: () => { + throw new Error("Unsupported method"); + }, }; this.embedController.initializeProvider(commProviderHandlers); } diff --git a/src/utils/enums.ts b/src/utils/enums.ts index 3200a387..24e3b9b2 100644 --- a/src/utils/enums.ts +++ b/src/utils/enums.ts @@ -16,12 +16,12 @@ import { SolanaBlock, SolanaCurrencyControllerConfig, SolanaCurrencyControllerState, + SolanaNetworkState, SolanaPreferencesConfig, SolanaPreferencesState, } from "@toruslabs/solana-controllers"; -import { SolanaNetworkState } from "@toruslabs/solana-controllers/dist/types/Network/NetworkController"; import { TokenInfoState, TokensInfoConfig } from "@toruslabs/solana-controllers/dist/types/Tokens/TokenInfoController"; -import { TokensTrackerConfig, TokensTrackerState } from "@toruslabs/solana-controllers/dist/types/Tokens/TokensTrackerController"; +import type { TokensTrackerConfig, TokensTrackerState } from "@toruslabs/solana-controllers/dist/types/Tokens/TokensTrackerController"; export const LOCAL_STORAGE_KEY = "localStorage"; export const SESSION_STORAGE_KEY = "sessionStorage"; diff --git a/tests/controller/nockRequest.ts b/tests/controller/nockRequest.ts index f6801cfc..028a6fce 100644 --- a/tests/controller/nockRequest.ts +++ b/tests/controller/nockRequest.ts @@ -42,7 +42,7 @@ export default () => { .query(true) .reply(200, (_uri, _body) => { // log.error(uri); - return JSON.stringify(mockData.coingekco["usd-coin"]); + return mockData.coingekco["usd-coin"]; }); const nockBackend = nock("https://solana-api.tor.us").persist(); @@ -52,28 +52,34 @@ export default () => { .query(true) .reply(200, (_uri) => { log.error(_uri); - return JSON.stringify(mockData.backend.user); + return mockData.backend.user; }); - nockBackend.get("/currency?fsym=SOL&tsyms=USD").reply(200, () => JSON.stringify(mockData.backend.currency)); + nockBackend.get("/currency?fsym=SOL&tsyms=USD").reply(200, () => mockData.backend.currency); - nockBackend.post("/auth/message").reply(200, () => JSON.stringify(mockData.backend.message)); + nockBackend.post("/auth/message").reply(200, () => { + return mockData.backend.message; + }); - nockBackend.post("/auth/verify").reply(200, () => JSON.stringify(mockData.backend.verify)); + nockBackend.post("/auth/verify").reply(200, () => mockData.backend.verify); - nockBackend.post("/user").reply(200, (_uri, _requestbody) => JSON.stringify(mockData.backend.user)); + nockBackend.post("/user").reply(200, (_uri, _requestbody) => mockData.backend.user); - nockBackend.post("/contact").reply(200, (_uri, _requestbody) => JSON.stringify({ data: _requestbody, message: "Contact Added", success: true })); + nockBackend.post("/contact").reply(200, (_uri, _requestbody) => { + return { data: _requestbody, message: "Contact Added", success: true }; + }); nockBackend.post("/customtoken/fetchToken").reply(200, (_uri, _requestbody) => { return { response: mockTokens.tokens, success: true }; }); - nockBackend - .delete("/contact/46") - .reply(200, (_uri, _requestbody) => JSON.stringify({ data: { id: 46 }, message: "Contact Deleted", success: true })); + nockBackend.delete("/contact/46").reply(200, (_uri, _requestbody) => { + return { data: { id: 46 }, message: "Contact Deleted", success: true }; + }); - nockBackend.patch("/user").reply(201, (_uri, _requestbody) => JSON.stringify({ data: _requestbody, success: true })); + nockBackend.patch("/user").reply(201, (_uri, _requestbody) => { + return { data: _requestbody, success: true }; + }); nockBackend.get("/billboard").reply(200, (_uri, _requestbody) => { return { success: true, data: mockBillBoardEvent }; @@ -103,9 +109,9 @@ export default () => { return { response: mockTokens.tokens, success: true }; }); - nockBackend.post("/user/recordLogin").reply(200, () => JSON.stringify(mockData.backend.recordLogin)); + nockBackend.post("/user/recordLogin").reply(200, () => mockData.backend.recordLogin); - nockBackend.post("/transaction").reply(200, () => JSON.stringify(mockData.backend.transaction)); + nockBackend.post("/transaction").reply(200, () => mockData.backend.transaction); // api.mainnet-beta nock // nock("https://api.mainnet-beta.solana.com")