From 4e1420f39be8691ba8fc960c20544b427aa8913b Mon Sep 17 00:00:00 2001 From: Tudor Morar Date: Mon, 23 Sep 2024 16:44:38 +0300 Subject: [PATCH] Remove callbackRoute from signMessage and upgrade to Message --- package.json | 15 +++++++------ src/core/methods/signMessage/signMessage.ts | 7 +----- yarn.lock | 24 ++++++++++----------- 3 files changed, 21 insertions(+), 25 deletions(-) diff --git a/package.json b/package.json index c0c42a8..f033ef1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@multiversx/sdk-dapp-core", - "version": "0.0.0-alpha.9", + "version": "0.0.0-alpha.10", "main": "out/index.js", "module": "out/index.js", "types": "out/index.d.ts", @@ -21,7 +21,7 @@ "scripts": { "compile": "tsc && tsc-alias", "build-esbuild": "rimraf out && node esbuild.js", - "publish-verdaccio": "npm unpublish --registry http://localhost:4873 @multiversx/sdk-dapp-core@0.0.0-alpha.3 && rimraf out && yarn compile && npm publish --registry http://localhost:4873", + "publish-verdaccio": "npm unpublish --registry http://localhost:4873 @multiversx/sdk-dapp-core@0.0.0-alpha.11 && rimraf out && yarn compile && npm publish --registry http://localhost:4873", "build": "yarn build-esbuild && yarn compile", "test": "jest", "compile-next": "rimraf out && tsc --p tsconfig.next.json && tsc-alias --project tsconfig.next.json" @@ -32,7 +32,7 @@ "dependencies": { "@lifeomic/axios-fetch": "3.0.1", "@multiversx/sdk-extension-provider": "4.0.0-alpha.0", - "@multiversx/sdk-hw-provider": "7.0.0-alpha.0", + "@multiversx/sdk-hw-provider": "7.0.0", "@multiversx/sdk-metamask-provider": "0.0.7", "@multiversx/sdk-native-auth-client": "^1.0.8", "@multiversx/sdk-opera-provider": "1.0.0-alpha.1", @@ -41,22 +41,24 @@ "@multiversx/sdk-web-wallet-provider": "3.2.1", "isomorphic-fetch": "3.0.0", "lodash": "4.17.21", + "protobufjs": "7.3.0", "socket.io-client": "4.7.5", "zustand": "4.4.7" }, "peerDependencies": { "@multiversx/sdk-core": ">= 13.5.0", - "@multiversx/sdk-dapp-utils": ">= 0.1.0", + "@multiversx/sdk-dapp-utils": ">= 1.0.1", "@multiversx/sdk-web-wallet-cross-window-provider": ">= 2.0.1", "axios": ">=1.6.5", - "bignumber.js": "9.x" + "bignumber.js": "9.x", + "immer": "10.x" }, "resolutions": { "string-width": "4.1.0" }, "devDependencies": { "@multiversx/sdk-core": ">= 13.5.0", - "@multiversx/sdk-dapp-utils": ">= 0.1.0", + "@multiversx/sdk-dapp-utils": "1.0.1", "@multiversx/sdk-web-wallet-cross-window-provider": ">= 2.0.1", "@swc/core": "^1.4.17", "@swc/jest": "^0.2.36", @@ -85,7 +87,6 @@ "msw": "1.3.1", "node-stdlib-browser": "1.2.0", "prettier": "3.2.5", - "protobufjs": "^7.3.0", "react": "^18.3.1", "rimraf": "^5.0.6", "ts-jest": "29.1.2", diff --git a/src/core/methods/signMessage/signMessage.ts b/src/core/methods/signMessage/signMessage.ts index c52211b..750b80a 100644 --- a/src/core/methods/signMessage/signMessage.ts +++ b/src/core/methods/signMessage/signMessage.ts @@ -15,17 +15,14 @@ export interface SignMessageType { }; } -// TODO: upgrade to Message export const signMessage = async ({ message, - callbackRoute, options }: SignMessageType): Promise> => { const address = getAddress(); const provider = getAccountProvider(); const providerType = getProviderType(provider); - const callbackUrl = addOriginToLocationPath(callbackRoute); const messageToSign = new Message({ address: new Address(address), data: message.data @@ -41,9 +38,7 @@ export const signMessage = async ({ } // TODO upgrade sdk-dapp-utils to use Message as input for signMessage method and remove the cast - const signedMessage = await provider.signMessage(messageToSign as any, { - callbackUrl: encodeURIComponent(callbackUrl) - }); + const signedMessage = await provider.signMessage(messageToSign, options); // TODO upgrade sdk-dapp-utils to return Message instead of SignableMessage and remove the cast return signedMessage as Nullable; diff --git a/yarn.lock b/yarn.lock index 9ddfb63..4460edb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -977,20 +977,20 @@ json-bigint "1.0.0" keccak "3.0.2" -"@multiversx/sdk-dapp-utils@>= 0.1.0": - version "0.1.0" - resolved "https://registry.yarnpkg.com/@multiversx/sdk-dapp-utils/-/sdk-dapp-utils-0.1.0.tgz#3103c2ffc648703e75f96acd229af299cb0840ab" - integrity sha512-EFvktZ/S1WQ1ie02nnKZHARC4r23JZWwoTFd5py1qi/Z/UoLHIzJ394HLjXFb6gBTsp4wnvNwIXBA/DNrd2Yeg== +"@multiversx/sdk-dapp-utils@1.0.1": + version "1.0.1" + resolved "http://localhost:4873/@multiversx/sdk-dapp-utils/-/sdk-dapp-utils-1.0.1.tgz#242a82c1f523efdcdec9a0be7816e079216215f0" + integrity sha512-ccmRjbWyxbPqEITwAHdtJ10VXQS6R565gZILMXoyQU7M7yUDnauV15vOfMmYko4MnCJq40U/zxx4dN3mJW4Mgw== "@multiversx/sdk-extension-provider@4.0.0-alpha.0": version "4.0.0-alpha.0" resolved "https://registry.yarnpkg.com/@multiversx/sdk-extension-provider/-/sdk-extension-provider-4.0.0-alpha.0.tgz#e00ba0df0d1ef8ac0330ff3f6f0c5ced8163c5b3" integrity sha512-LPRy2sgWG1Ti3KMxembP0/13GHntenFK1kbXAfHUJiOH29s4nbGDqBlTI0p42en4c1BGlEbVJEfpUq1LtO5ZYA== -"@multiversx/sdk-hw-provider@7.0.0-alpha.0": - version "7.0.0-alpha.0" - resolved "https://registry.yarnpkg.com/@multiversx/sdk-hw-provider/-/sdk-hw-provider-7.0.0-alpha.0.tgz#449b96d63ec1efa945ae15a6f217b90338a7a131" - integrity sha512-Mrv+AKXoe95CvxoGRVSF7d1MLNjvI3ot+/1muuBc3cgiwcKBFTbdW9cp5P79mEEDizI5foy/Gscn1Qs5Nh2Hrg== +"@multiversx/sdk-hw-provider@7.0.0": + version "7.0.0" + resolved "http://localhost:4873/@multiversx/sdk-hw-provider/-/sdk-hw-provider-7.0.0.tgz#dafb239179949e23a75805c7cd386d618b1855cd" + integrity sha512-ZRGp5q985v5wvjnSZw+uvEXKGwe5YORuULhYMVoh63cPtGhyHIxl7H9D190KtSV0/LJfTcVUDDrtKoepOoKuVA== dependencies: "@ledgerhq/devices" "8.0.3" "@ledgerhq/errors" "6.12.6" @@ -5859,10 +5859,10 @@ prompts@^2.0.1: kleur "^3.0.3" sisteransi "^1.0.5" -protobufjs@^7.3.0: - version "7.4.0" - resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-7.4.0.tgz#7efe324ce9b3b61c82aae5de810d287bc08a248a" - integrity sha512-mRUWCc3KUU4w1jU8sGxICXH/gNS94DvI1gxqDvBzhj1JpcsimQkYiOJfwsPUykUI5ZaspFbSgmBLER8IrQ3tqw== +protobufjs@7.3.0: + version "7.3.0" + resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-7.3.0.tgz#a32ec0422c039798c41a0700306a6e305b9cb32c" + integrity sha512-YWD03n3shzV9ImZRX3ccbjqLxj7NokGN0V/ESiBV5xWqrommYHYiihuIyavq03pWSGqlyvYUFmfoMKd+1rPA/g== dependencies: "@protobufjs/aspromise" "^1.1.2" "@protobufjs/base64" "^1.1.2"