diff --git a/examples/dapp.html b/examples/dapp.html index 83fb4e8d2..e51568711 100644 --- a/examples/dapp.html +++ b/examples/dapp.html @@ -39,6 +39,12 @@

+

+ +

+ +

+



@@ -111,9 +117,6 @@

--- -

- -

diff --git a/lerna.json b/lerna.json index 9694f9ccf..c67b06206 100644 --- a/lerna.json +++ b/lerna.json @@ -1,4 +1,4 @@ { "useWorkspaces": true, - "version": "4.0.4" + "version": "4.0.5" } diff --git a/package-lock.json b/package-lock.json index d7567f6ba..4fb6eb081 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,9 +22,9 @@ "@airgap/beacon-ui": "file:packages/beacon-ui", "@airgap/beacon-utils": "file:packages/beacon-utils", "@airgap/beacon-wallet": "file:packages/beacon-wallet", - "@walletconnect/sign-client": "^2.7.5", - "@walletconnect/types": "^2.7.5", - "@walletconnect/utils": "^2.7.5", + "@walletconnect/sign-client": "^2.9.0", + "@walletconnect/types": "^2.9.0", + "@walletconnect/utils": "^2.9.0", "@web3modal/standalone": "2.0.0", "stream-browserify": "^3.0.0" }, @@ -5612,22 +5612,23 @@ } }, "node_modules/@walletconnect/core": { - "version": "2.7.5", - "resolved": "https://registry.npmjs.org/@walletconnect/core/-/core-2.7.5.tgz", - "integrity": "sha512-nI5RTGZAOcheCcrVUWHLO4iEnyDrDa8HnuNRm9jbYf7ESLdmunShQ+jStnb0pmjEJ8uI/oIEahQwzTN8iLIjpA==", + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@walletconnect/core/-/core-2.9.0.tgz", + "integrity": "sha512-MZYJghS9YCvGe32UOgDj0mCasaOoGHQaYXWeQblXE/xb8HuaM6kAWhjIQN9P+MNp5QP134BHP5olQostcCotXQ==", "dependencies": { "@walletconnect/heartbeat": "1.2.1", - "@walletconnect/jsonrpc-provider": "^1.0.12", - "@walletconnect/jsonrpc-utils": "^1.0.7", - "@walletconnect/jsonrpc-ws-connection": "^1.0.11", + "@walletconnect/jsonrpc-provider": "1.0.13", + "@walletconnect/jsonrpc-types": "1.0.3", + "@walletconnect/jsonrpc-utils": "1.0.8", + "@walletconnect/jsonrpc-ws-connection": "1.0.12", "@walletconnect/keyvaluestorage": "^1.0.2", "@walletconnect/logger": "^2.0.1", "@walletconnect/relay-api": "^1.0.9", "@walletconnect/relay-auth": "^1.0.4", "@walletconnect/safe-json": "^1.0.2", "@walletconnect/time": "^1.0.2", - "@walletconnect/types": "2.7.5", - "@walletconnect/utils": "2.7.5", + "@walletconnect/types": "2.9.0", + "@walletconnect/utils": "2.9.0", "events": "^3.3.0", "lodash.isequal": "4.5.0", "uint8arrays": "^3.1.0" @@ -5643,7 +5644,8 @@ }, "node_modules/@walletconnect/events": { "version": "1.0.1", - "license": "MIT", + "resolved": "https://registry.npmjs.org/@walletconnect/events/-/events-1.0.1.tgz", + "integrity": "sha512-NPTqaoi0oPBVNuLv7qPaJazmGHs5JGyO8eEAk5VGKmJzDR7AHzD4k6ilox5kxk1iwiOnFopBOOMLs86Oa76HpQ==", "dependencies": { "keyvaluestorage-interface": "^1.0.0", "tslib": "1.14.1" @@ -5689,9 +5691,9 @@ } }, "node_modules/@walletconnect/jsonrpc-ws-connection": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-ws-connection/-/jsonrpc-ws-connection-1.0.11.tgz", - "integrity": "sha512-TiFJ6saasKXD+PwGkm5ZGSw0837nc6EeFmurSPgIT/NofnOV4Tv7CVJqGQN0rQYoJUSYu21cwHNYaFkzNpUN+w==", + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-ws-connection/-/jsonrpc-ws-connection-1.0.12.tgz", + "integrity": "sha512-HAcadga3Qjt1Cqy+qXEW6zjaCs8uJGdGQrqltzl3OjiK4epGZRdvSzTe63P+t/3z+D2wG+ffEPn0GVcDozmN1w==", "dependencies": { "@walletconnect/jsonrpc-utils": "^1.0.6", "@walletconnect/safe-json": "^1.0.2", @@ -5761,56 +5763,56 @@ } }, "node_modules/@walletconnect/sign-client": { - "version": "2.7.5", - "resolved": "https://registry.npmjs.org/@walletconnect/sign-client/-/sign-client-2.7.5.tgz", - "integrity": "sha512-99oc0g4eR4hllrB0m4N74EsnNKDrl0L5HdLDGBHQIYnl+/FUjn652QCTOjPzqiUlxvQCo0wrIugb/tgtIGPTfg==", + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@walletconnect/sign-client/-/sign-client-2.9.0.tgz", + "integrity": "sha512-mEKc4LlLMebCe45qzqh+MX4ilQK4kOEBzLY6YJpG8EhyT45eX4JMNA7qQoYa9MRMaaVb/7USJcc4e3ZrjZvQmA==", "dependencies": { - "@walletconnect/core": "2.7.5", + "@walletconnect/core": "2.9.0", "@walletconnect/events": "^1.0.1", "@walletconnect/heartbeat": "1.2.1", - "@walletconnect/jsonrpc-utils": "^1.0.7", + "@walletconnect/jsonrpc-utils": "1.0.8", "@walletconnect/logger": "^2.0.1", "@walletconnect/time": "^1.0.2", - "@walletconnect/types": "2.7.5", - "@walletconnect/utils": "2.7.5", + "@walletconnect/types": "2.9.0", + "@walletconnect/utils": "2.9.0", "events": "^3.3.0" } }, "node_modules/@walletconnect/time": { "version": "1.0.2", - "license": "MIT", + "resolved": "https://registry.npmjs.org/@walletconnect/time/-/time-1.0.2.tgz", + "integrity": "sha512-uzdd9woDcJ1AaBZRhqy5rNC9laqWGErfc4dxA9a87mPdKOgWMD85mcFo9dIYIts/Jwocfwn07EC6EzclKubk/g==", "dependencies": { "tslib": "1.14.1" } }, "node_modules/@walletconnect/types": { - "version": "2.7.5", - "resolved": "https://registry.npmjs.org/@walletconnect/types/-/types-2.7.5.tgz", - "integrity": "sha512-uEsMXtVbhT5+E/g3loyfNBrjEsPeUaPZkFeVsOErWhxg25CL+MrrWUKerV6tC/ACbFVR5KgKS+uioMath/cV7A==", + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@walletconnect/types/-/types-2.9.0.tgz", + "integrity": "sha512-ORopsMfSRvUYqtjKKd6scfg8o4/aGebipLxx92AuuUgMTERSU6cGmIrK6rdLu7W6FBJkmngPLEGc9mRqAb9Lug==", "dependencies": { "@walletconnect/events": "^1.0.1", "@walletconnect/heartbeat": "1.2.1", - "@walletconnect/jsonrpc-types": "^1.0.2", + "@walletconnect/jsonrpc-types": "1.0.3", "@walletconnect/keyvaluestorage": "^1.0.2", "@walletconnect/logger": "^2.0.1", "events": "^3.3.0" } }, "node_modules/@walletconnect/utils": { - "version": "2.7.5", - "resolved": "https://registry.npmjs.org/@walletconnect/utils/-/utils-2.7.5.tgz", - "integrity": "sha512-uSf71P3kFMC+S4RidQYFIWXglVvYTCLK7AaO9PrUDLO9ocRnBk6hNmOhYSA5jSP6OLf1vYm4ADHbzkeOb4u6aQ==", + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@walletconnect/utils/-/utils-2.9.0.tgz", + "integrity": "sha512-7Tu3m6dZL84KofrNBcblsgpSqU2vdo9ImLD7zWimLXERVGNQ8smXG+gmhQYblebIBhsPzjy9N38YMC3nPlfQNw==", "dependencies": { "@stablelib/chacha20poly1305": "1.0.1", "@stablelib/hkdf": "1.0.1", "@stablelib/random": "^1.0.2", "@stablelib/sha256": "1.0.1", "@stablelib/x25519": "^1.0.3", - "@walletconnect/jsonrpc-utils": "^1.0.7", "@walletconnect/relay-api": "^1.0.9", "@walletconnect/safe-json": "^1.0.2", "@walletconnect/time": "^1.0.2", - "@walletconnect/types": "2.7.5", + "@walletconnect/types": "2.9.0", "@walletconnect/window-getters": "^1.0.1", "@walletconnect/window-metadata": "^1.0.1", "detect-browser": "5.3.0", @@ -12011,7 +12013,8 @@ }, "node_modules/keyvaluestorage-interface": { "version": "1.0.0", - "license": "MIT" + "resolved": "https://registry.npmjs.org/keyvaluestorage-interface/-/keyvaluestorage-interface-1.0.0.tgz", + "integrity": "sha512-8t6Q3TclQ4uZynJY9IGr2+SsIGwK9JHcO6ootkHCGA0CrQCRy+VkouYNO2xicET6b9al7QKzpebNow+gkpCL8g==" }, "node_modules/kind-of": { "version": "6.0.3", @@ -20146,38 +20149,38 @@ }, "packages/beacon-blockchain-substrate": { "name": "@airgap/beacon-blockchain-substrate", - "version": "4.0.4", + "version": "4.0.5", "license": "ISC", "dependencies": { - "@airgap/beacon-types": "4.0.4", - "@airgap/beacon-ui": "4.0.4" + "@airgap/beacon-types": "4.0.5", + "@airgap/beacon-ui": "4.0.5" } }, "packages/beacon-blockchain-tezos": { "name": "@airgap/beacon-blockchain-tezos", - "version": "4.0.4", + "version": "4.0.5", "license": "ISC", "dependencies": { - "@airgap/beacon-types": "4.0.4", - "@airgap/beacon-ui": "4.0.4" + "@airgap/beacon-types": "4.0.5", + "@airgap/beacon-ui": "4.0.5" } }, "packages/beacon-blockchain-tezos-sapling": { "name": "@airgap/beacon-blockchain-tezos-sapling", - "version": "4.0.4", + "version": "4.0.5", "license": "ISC", "dependencies": { - "@airgap/beacon-types": "4.0.4", - "@airgap/beacon-ui": "4.0.4" + "@airgap/beacon-types": "4.0.5", + "@airgap/beacon-ui": "4.0.5" } }, "packages/beacon-core": { "name": "@airgap/beacon-core", - "version": "4.0.4", + "version": "4.0.5", "license": "ISC", "dependencies": { - "@airgap/beacon-types": "4.0.4", - "@airgap/beacon-utils": "4.0.4", + "@airgap/beacon-types": "4.0.5", + "@airgap/beacon-utils": "4.0.5", "@stablelib/ed25519": "^1.0.3", "@stablelib/nacl": "^1.0.4", "@stablelib/utf8": "^1.0.1", @@ -20187,40 +20190,40 @@ }, "packages/beacon-dapp": { "name": "@airgap/beacon-dapp", - "version": "4.0.4", + "version": "4.0.5", "license": "ISC", "dependencies": { - "@airgap/beacon-core": "4.0.4", - "@airgap/beacon-transport-matrix": "4.0.4", - "@airgap/beacon-transport-postmessage": "4.0.4", - "@airgap/beacon-transport-walletconnect": "4.0.4", - "@airgap/beacon-ui": "4.0.4" + "@airgap/beacon-core": "4.0.5", + "@airgap/beacon-transport-matrix": "4.0.5", + "@airgap/beacon-transport-postmessage": "4.0.5", + "@airgap/beacon-transport-walletconnect": "4.0.5", + "@airgap/beacon-ui": "4.0.5" } }, "packages/beacon-sdk": { "name": "@airgap/beacon-sdk", - "version": "4.0.4", + "version": "4.0.5", "license": "ISC", "dependencies": { - "@airgap/beacon-blockchain-substrate": "4.0.4", - "@airgap/beacon-blockchain-tezos": "4.0.4", - "@airgap/beacon-core": "4.0.4", - "@airgap/beacon-dapp": "4.0.4", - "@airgap/beacon-transport-matrix": "4.0.4", - "@airgap/beacon-transport-postmessage": "4.0.4", - "@airgap/beacon-types": "4.0.4", - "@airgap/beacon-ui": "4.0.4", - "@airgap/beacon-utils": "4.0.4", - "@airgap/beacon-wallet": "4.0.4" + "@airgap/beacon-blockchain-substrate": "4.0.5", + "@airgap/beacon-blockchain-tezos": "4.0.5", + "@airgap/beacon-core": "4.0.5", + "@airgap/beacon-dapp": "4.0.5", + "@airgap/beacon-transport-matrix": "4.0.5", + "@airgap/beacon-transport-postmessage": "4.0.5", + "@airgap/beacon-types": "4.0.5", + "@airgap/beacon-ui": "4.0.5", + "@airgap/beacon-utils": "4.0.5", + "@airgap/beacon-wallet": "4.0.5" } }, "packages/beacon-transport-matrix": { "name": "@airgap/beacon-transport-matrix", - "version": "4.0.4", + "version": "4.0.5", "license": "ISC", "dependencies": { - "@airgap/beacon-core": "4.0.4", - "@airgap/beacon-utils": "4.0.4", + "@airgap/beacon-core": "4.0.5", + "@airgap/beacon-utils": "4.0.5", "axios": "0.24.0" } }, @@ -20233,28 +20236,28 @@ }, "packages/beacon-transport-postmessage": { "name": "@airgap/beacon-transport-postmessage", - "version": "4.0.4", + "version": "4.0.5", "license": "ISC", "dependencies": { - "@airgap/beacon-core": "4.0.4", - "@airgap/beacon-types": "4.0.4", - "@airgap/beacon-utils": "4.0.4" + "@airgap/beacon-core": "4.0.5", + "@airgap/beacon-types": "4.0.5", + "@airgap/beacon-utils": "4.0.5" } }, "packages/beacon-transport-walletconnect": { "name": "@airgap/beacon-transport-walletconnect", - "version": "4.0.4", + "version": "4.0.5", "license": "ISC", "dependencies": { - "@airgap/beacon-core": "4.0.4", - "@airgap/beacon-types": "4.0.4", - "@airgap/beacon-utils": "4.0.4", - "@walletconnect/sign-client": "^2.7.5" + "@airgap/beacon-core": "4.0.5", + "@airgap/beacon-types": "4.0.5", + "@airgap/beacon-utils": "4.0.5", + "@walletconnect/sign-client": "^2.9.0" } }, "packages/beacon-types": { "name": "@airgap/beacon-types", - "version": "4.0.4", + "version": "4.0.5", "license": "ISC", "dependencies": { "@types/chrome": "0.0.163" @@ -20262,13 +20265,13 @@ }, "packages/beacon-ui": { "name": "@airgap/beacon-ui", - "version": "4.0.4", + "version": "4.0.5", "license": "ISC", "dependencies": { - "@airgap/beacon-core": "4.0.4", - "@airgap/beacon-transport-postmessage": "4.0.4", - "@airgap/beacon-types": "4.0.4", - "@airgap/beacon-utils": "4.0.4", + "@airgap/beacon-core": "4.0.5", + "@airgap/beacon-transport-postmessage": "4.0.5", + "@airgap/beacon-types": "4.0.5", + "@airgap/beacon-utils": "4.0.5", "qrcode-svg": "^1.1.0", "solid-js": "^1.6.6" }, @@ -20307,7 +20310,7 @@ }, "packages/beacon-utils": { "name": "@airgap/beacon-utils", - "version": "4.0.4", + "version": "4.0.5", "license": "ISC", "dependencies": { "@stablelib/ed25519": "^1.0.3", @@ -20319,12 +20322,12 @@ }, "packages/beacon-wallet": { "name": "@airgap/beacon-wallet", - "version": "4.0.4", + "version": "4.0.5", "license": "ISC", "dependencies": { - "@airgap/beacon-core": "4.0.4", - "@airgap/beacon-transport-matrix": "4.0.4", - "@airgap/beacon-transport-postmessage": "4.0.4" + "@airgap/beacon-core": "4.0.5", + "@airgap/beacon-transport-matrix": "4.0.5", + "@airgap/beacon-transport-postmessage": "4.0.5" } } }, @@ -20332,29 +20335,29 @@ "@airgap/beacon-blockchain-substrate": { "version": "file:packages/beacon-blockchain-substrate", "requires": { - "@airgap/beacon-types": "4.0.4", - "@airgap/beacon-ui": "4.0.4" + "@airgap/beacon-types": "4.0.5", + "@airgap/beacon-ui": "4.0.5" } }, "@airgap/beacon-blockchain-tezos": { "version": "file:packages/beacon-blockchain-tezos", "requires": { - "@airgap/beacon-types": "4.0.4", - "@airgap/beacon-ui": "4.0.4" + "@airgap/beacon-types": "4.0.5", + "@airgap/beacon-ui": "4.0.5" } }, "@airgap/beacon-blockchain-tezos-sapling": { "version": "file:packages/beacon-blockchain-tezos-sapling", "requires": { - "@airgap/beacon-types": "4.0.4", - "@airgap/beacon-ui": "4.0.4" + "@airgap/beacon-types": "4.0.5", + "@airgap/beacon-ui": "4.0.5" } }, "@airgap/beacon-core": { "version": "file:packages/beacon-core", "requires": { - "@airgap/beacon-types": "4.0.4", - "@airgap/beacon-utils": "4.0.4", + "@airgap/beacon-types": "4.0.5", + "@airgap/beacon-utils": "4.0.5", "@stablelib/ed25519": "^1.0.3", "@stablelib/nacl": "^1.0.4", "@stablelib/utf8": "^1.0.1", @@ -20365,33 +20368,33 @@ "@airgap/beacon-dapp": { "version": "file:packages/beacon-dapp", "requires": { - "@airgap/beacon-core": "4.0.4", - "@airgap/beacon-transport-matrix": "4.0.4", - "@airgap/beacon-transport-postmessage": "4.0.4", - "@airgap/beacon-transport-walletconnect": "4.0.4", - "@airgap/beacon-ui": "4.0.4" + "@airgap/beacon-core": "4.0.5", + "@airgap/beacon-transport-matrix": "4.0.5", + "@airgap/beacon-transport-postmessage": "4.0.5", + "@airgap/beacon-transport-walletconnect": "4.0.5", + "@airgap/beacon-ui": "4.0.5" } }, "@airgap/beacon-sdk": { "version": "file:packages/beacon-sdk", "requires": { - "@airgap/beacon-blockchain-substrate": "4.0.4", - "@airgap/beacon-blockchain-tezos": "4.0.4", - "@airgap/beacon-core": "4.0.4", - "@airgap/beacon-dapp": "4.0.4", - "@airgap/beacon-transport-matrix": "4.0.4", - "@airgap/beacon-transport-postmessage": "4.0.4", - "@airgap/beacon-types": "4.0.4", - "@airgap/beacon-ui": "4.0.4", - "@airgap/beacon-utils": "4.0.4", - "@airgap/beacon-wallet": "4.0.4" + "@airgap/beacon-blockchain-substrate": "4.0.5", + "@airgap/beacon-blockchain-tezos": "4.0.5", + "@airgap/beacon-core": "4.0.5", + "@airgap/beacon-dapp": "4.0.5", + "@airgap/beacon-transport-matrix": "4.0.5", + "@airgap/beacon-transport-postmessage": "4.0.5", + "@airgap/beacon-types": "4.0.5", + "@airgap/beacon-ui": "4.0.5", + "@airgap/beacon-utils": "4.0.5", + "@airgap/beacon-wallet": "4.0.5" } }, "@airgap/beacon-transport-matrix": { "version": "file:packages/beacon-transport-matrix", "requires": { - "@airgap/beacon-core": "4.0.4", - "@airgap/beacon-utils": "4.0.4", + "@airgap/beacon-core": "4.0.5", + "@airgap/beacon-utils": "4.0.5", "axios": "0.24.0" }, "dependencies": { @@ -20406,18 +20409,18 @@ "@airgap/beacon-transport-postmessage": { "version": "file:packages/beacon-transport-postmessage", "requires": { - "@airgap/beacon-core": "4.0.4", - "@airgap/beacon-types": "4.0.4", - "@airgap/beacon-utils": "4.0.4" + "@airgap/beacon-core": "4.0.5", + "@airgap/beacon-types": "4.0.5", + "@airgap/beacon-utils": "4.0.5" } }, "@airgap/beacon-transport-walletconnect": { "version": "file:packages/beacon-transport-walletconnect", "requires": { - "@airgap/beacon-core": "4.0.4", - "@airgap/beacon-types": "4.0.4", - "@airgap/beacon-utils": "4.0.4", - "@walletconnect/sign-client": "^2.7.5" + "@airgap/beacon-core": "4.0.5", + "@airgap/beacon-types": "4.0.5", + "@airgap/beacon-utils": "4.0.5", + "@walletconnect/sign-client": "^2.9.0" } }, "@airgap/beacon-types": { @@ -20429,10 +20432,10 @@ "@airgap/beacon-ui": { "version": "file:packages/beacon-ui", "requires": { - "@airgap/beacon-core": "4.0.4", - "@airgap/beacon-transport-postmessage": "4.0.4", - "@airgap/beacon-types": "4.0.4", - "@airgap/beacon-utils": "4.0.4", + "@airgap/beacon-core": "4.0.5", + "@airgap/beacon-transport-postmessage": "4.0.5", + "@airgap/beacon-types": "4.0.5", + "@airgap/beacon-utils": "4.0.5", "@rollup/plugin-commonjs": "^24.0.1", "@rollup/plugin-image": "^3.0.2", "@types/node": "^18.13.0", @@ -20473,9 +20476,9 @@ "@airgap/beacon-wallet": { "version": "file:packages/beacon-wallet", "requires": { - "@airgap/beacon-core": "4.0.4", - "@airgap/beacon-transport-matrix": "4.0.4", - "@airgap/beacon-transport-postmessage": "4.0.4" + "@airgap/beacon-core": "4.0.5", + "@airgap/beacon-transport-matrix": "4.0.5", + "@airgap/beacon-transport-postmessage": "4.0.5" } }, "@ampproject/remapping": { @@ -24156,22 +24159,23 @@ } }, "@walletconnect/core": { - "version": "2.7.5", - "resolved": "https://registry.npmjs.org/@walletconnect/core/-/core-2.7.5.tgz", - "integrity": "sha512-nI5RTGZAOcheCcrVUWHLO4iEnyDrDa8HnuNRm9jbYf7ESLdmunShQ+jStnb0pmjEJ8uI/oIEahQwzTN8iLIjpA==", + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@walletconnect/core/-/core-2.9.0.tgz", + "integrity": "sha512-MZYJghS9YCvGe32UOgDj0mCasaOoGHQaYXWeQblXE/xb8HuaM6kAWhjIQN9P+MNp5QP134BHP5olQostcCotXQ==", "requires": { "@walletconnect/heartbeat": "1.2.1", - "@walletconnect/jsonrpc-provider": "^1.0.12", - "@walletconnect/jsonrpc-utils": "^1.0.7", - "@walletconnect/jsonrpc-ws-connection": "^1.0.11", + "@walletconnect/jsonrpc-provider": "1.0.13", + "@walletconnect/jsonrpc-types": "1.0.3", + "@walletconnect/jsonrpc-utils": "1.0.8", + "@walletconnect/jsonrpc-ws-connection": "1.0.12", "@walletconnect/keyvaluestorage": "^1.0.2", "@walletconnect/logger": "^2.0.1", "@walletconnect/relay-api": "^1.0.9", "@walletconnect/relay-auth": "^1.0.4", "@walletconnect/safe-json": "^1.0.2", "@walletconnect/time": "^1.0.2", - "@walletconnect/types": "2.7.5", - "@walletconnect/utils": "2.7.5", + "@walletconnect/types": "2.9.0", + "@walletconnect/utils": "2.9.0", "events": "^3.3.0", "lodash.isequal": "4.5.0", "uint8arrays": "^3.1.0" @@ -24187,6 +24191,8 @@ }, "@walletconnect/events": { "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@walletconnect/events/-/events-1.0.1.tgz", + "integrity": "sha512-NPTqaoi0oPBVNuLv7qPaJazmGHs5JGyO8eEAk5VGKmJzDR7AHzD4k6ilox5kxk1iwiOnFopBOOMLs86Oa76HpQ==", "requires": { "keyvaluestorage-interface": "^1.0.0", "tslib": "1.14.1" @@ -24232,9 +24238,9 @@ } }, "@walletconnect/jsonrpc-ws-connection": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-ws-connection/-/jsonrpc-ws-connection-1.0.11.tgz", - "integrity": "sha512-TiFJ6saasKXD+PwGkm5ZGSw0837nc6EeFmurSPgIT/NofnOV4Tv7CVJqGQN0rQYoJUSYu21cwHNYaFkzNpUN+w==", + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-ws-connection/-/jsonrpc-ws-connection-1.0.12.tgz", + "integrity": "sha512-HAcadga3Qjt1Cqy+qXEW6zjaCs8uJGdGQrqltzl3OjiK4epGZRdvSzTe63P+t/3z+D2wG+ffEPn0GVcDozmN1w==", "requires": { "@walletconnect/jsonrpc-utils": "^1.0.6", "@walletconnect/safe-json": "^1.0.2", @@ -24292,55 +24298,56 @@ } }, "@walletconnect/sign-client": { - "version": "2.7.5", - "resolved": "https://registry.npmjs.org/@walletconnect/sign-client/-/sign-client-2.7.5.tgz", - "integrity": "sha512-99oc0g4eR4hllrB0m4N74EsnNKDrl0L5HdLDGBHQIYnl+/FUjn652QCTOjPzqiUlxvQCo0wrIugb/tgtIGPTfg==", + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@walletconnect/sign-client/-/sign-client-2.9.0.tgz", + "integrity": "sha512-mEKc4LlLMebCe45qzqh+MX4ilQK4kOEBzLY6YJpG8EhyT45eX4JMNA7qQoYa9MRMaaVb/7USJcc4e3ZrjZvQmA==", "requires": { - "@walletconnect/core": "2.7.5", + "@walletconnect/core": "2.9.0", "@walletconnect/events": "^1.0.1", "@walletconnect/heartbeat": "1.2.1", - "@walletconnect/jsonrpc-utils": "^1.0.7", + "@walletconnect/jsonrpc-utils": "1.0.8", "@walletconnect/logger": "^2.0.1", "@walletconnect/time": "^1.0.2", - "@walletconnect/types": "2.7.5", - "@walletconnect/utils": "2.7.5", + "@walletconnect/types": "2.9.0", + "@walletconnect/utils": "2.9.0", "events": "^3.3.0" } }, "@walletconnect/time": { "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@walletconnect/time/-/time-1.0.2.tgz", + "integrity": "sha512-uzdd9woDcJ1AaBZRhqy5rNC9laqWGErfc4dxA9a87mPdKOgWMD85mcFo9dIYIts/Jwocfwn07EC6EzclKubk/g==", "requires": { "tslib": "1.14.1" } }, "@walletconnect/types": { - "version": "2.7.5", - "resolved": "https://registry.npmjs.org/@walletconnect/types/-/types-2.7.5.tgz", - "integrity": "sha512-uEsMXtVbhT5+E/g3loyfNBrjEsPeUaPZkFeVsOErWhxg25CL+MrrWUKerV6tC/ACbFVR5KgKS+uioMath/cV7A==", + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@walletconnect/types/-/types-2.9.0.tgz", + "integrity": "sha512-ORopsMfSRvUYqtjKKd6scfg8o4/aGebipLxx92AuuUgMTERSU6cGmIrK6rdLu7W6FBJkmngPLEGc9mRqAb9Lug==", "requires": { "@walletconnect/events": "^1.0.1", "@walletconnect/heartbeat": "1.2.1", - "@walletconnect/jsonrpc-types": "^1.0.2", + "@walletconnect/jsonrpc-types": "1.0.3", "@walletconnect/keyvaluestorage": "^1.0.2", "@walletconnect/logger": "^2.0.1", "events": "^3.3.0" } }, "@walletconnect/utils": { - "version": "2.7.5", - "resolved": "https://registry.npmjs.org/@walletconnect/utils/-/utils-2.7.5.tgz", - "integrity": "sha512-uSf71P3kFMC+S4RidQYFIWXglVvYTCLK7AaO9PrUDLO9ocRnBk6hNmOhYSA5jSP6OLf1vYm4ADHbzkeOb4u6aQ==", + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@walletconnect/utils/-/utils-2.9.0.tgz", + "integrity": "sha512-7Tu3m6dZL84KofrNBcblsgpSqU2vdo9ImLD7zWimLXERVGNQ8smXG+gmhQYblebIBhsPzjy9N38YMC3nPlfQNw==", "requires": { "@stablelib/chacha20poly1305": "1.0.1", "@stablelib/hkdf": "1.0.1", "@stablelib/random": "^1.0.2", "@stablelib/sha256": "1.0.1", "@stablelib/x25519": "^1.0.3", - "@walletconnect/jsonrpc-utils": "^1.0.7", "@walletconnect/relay-api": "^1.0.9", "@walletconnect/safe-json": "^1.0.2", "@walletconnect/time": "^1.0.2", - "@walletconnect/types": "2.7.5", + "@walletconnect/types": "2.9.0", "@walletconnect/window-getters": "^1.0.1", "@walletconnect/window-metadata": "^1.0.1", "detect-browser": "5.3.0", @@ -28465,7 +28472,9 @@ "dev": true }, "keyvaluestorage-interface": { - "version": "1.0.0" + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/keyvaluestorage-interface/-/keyvaluestorage-interface-1.0.0.tgz", + "integrity": "sha512-8t6Q3TclQ4uZynJY9IGr2+SsIGwK9JHcO6ootkHCGA0CrQCRy+VkouYNO2xicET6b9al7QKzpebNow+gkpCL8g==" }, "kind-of": { "version": "6.0.3", diff --git a/package.json b/package.json index eb4ed3c53..e78948efa 100644 --- a/package.json +++ b/package.json @@ -72,9 +72,9 @@ "@airgap/beacon-ui": "file:packages/beacon-ui", "@airgap/beacon-utils": "file:packages/beacon-utils", "@airgap/beacon-wallet": "file:packages/beacon-wallet", - "@walletconnect/sign-client": "^2.7.5", - "@walletconnect/types": "^2.7.5", - "@walletconnect/utils": "^2.7.5", + "@walletconnect/sign-client": "^2.9.0", + "@walletconnect/types": "^2.9.0", + "@walletconnect/utils": "^2.9.0", "@web3modal/standalone": "2.0.0", "stream-browserify": "^3.0.0" }, diff --git a/packages/beacon-blockchain-substrate/package.json b/packages/beacon-blockchain-substrate/package.json index d5045ce6f..16fa01876 100644 --- a/packages/beacon-blockchain-substrate/package.json +++ b/packages/beacon-blockchain-substrate/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/beacon-blockchain-substrate", - "version": "4.0.4", + "version": "4.0.5", "description": "> TODO: description", "author": "Andreas Gassmann ", "homepage": "https://walletbeacon.io", @@ -34,7 +34,7 @@ "url": "https://github.com/airgap-it/beacon-sdk/issues" }, "dependencies": { - "@airgap/beacon-types": "4.0.4", - "@airgap/beacon-ui": "4.0.4" + "@airgap/beacon-types": "4.0.5", + "@airgap/beacon-ui": "4.0.5" } } diff --git a/packages/beacon-blockchain-tezos-sapling/package.json b/packages/beacon-blockchain-tezos-sapling/package.json index 4b73c894d..bc34cfd6d 100644 --- a/packages/beacon-blockchain-tezos-sapling/package.json +++ b/packages/beacon-blockchain-tezos-sapling/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/beacon-blockchain-tezos-sapling", - "version": "4.0.4", + "version": "4.0.5", "description": "> TODO: description", "author": "Andreas Gassmann ", "homepage": "https://walletbeacon.io", @@ -34,7 +34,7 @@ "url": "https://github.com/airgap-it/beacon-sdk/issues" }, "dependencies": { - "@airgap/beacon-types": "4.0.4", - "@airgap/beacon-ui": "4.0.4" + "@airgap/beacon-types": "4.0.5", + "@airgap/beacon-ui": "4.0.5" } } diff --git a/packages/beacon-blockchain-tezos/package.json b/packages/beacon-blockchain-tezos/package.json index 33110059a..6c808f465 100644 --- a/packages/beacon-blockchain-tezos/package.json +++ b/packages/beacon-blockchain-tezos/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/beacon-blockchain-tezos", - "version": "4.0.4", + "version": "4.0.5", "description": "> TODO: description", "author": "Andreas Gassmann ", "homepage": "https://walletbeacon.io", @@ -34,7 +34,7 @@ "url": "https://github.com/airgap-it/beacon-sdk/issues" }, "dependencies": { - "@airgap/beacon-types": "4.0.4", - "@airgap/beacon-ui": "4.0.4" + "@airgap/beacon-types": "4.0.5", + "@airgap/beacon-ui": "4.0.5" } } diff --git a/packages/beacon-core/package.json b/packages/beacon-core/package.json index 5bcea45cd..f8cd03bdd 100644 --- a/packages/beacon-core/package.json +++ b/packages/beacon-core/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/beacon-core", - "version": "4.0.4", + "version": "4.0.5", "description": "> TODO: description", "author": "Andreas Gassmann ", "homepage": "https://walletbeacon.io", @@ -34,8 +34,8 @@ "url": "https://github.com/airgap-it/beacon-sdk/issues" }, "dependencies": { - "@airgap/beacon-types": "4.0.4", - "@airgap/beacon-utils": "4.0.4", + "@airgap/beacon-types": "4.0.5", + "@airgap/beacon-utils": "4.0.5", "@stablelib/ed25519": "^1.0.3", "@stablelib/nacl": "^1.0.4", "@stablelib/utf8": "^1.0.1", diff --git a/packages/beacon-core/src/constants.ts b/packages/beacon-core/src/constants.ts index 56eb37ddb..340362d44 100644 --- a/packages/beacon-core/src/constants.ts +++ b/packages/beacon-core/src/constants.ts @@ -1,4 +1,4 @@ -export const SDK_VERSION: string = '4.0.4' +export const SDK_VERSION: string = '4.0.5' export const BEACON_VERSION: string = '3' export const NOTIFICATION_ORACLE_URL: string = diff --git a/packages/beacon-dapp/package.json b/packages/beacon-dapp/package.json index a38198a75..ed4fc77cd 100644 --- a/packages/beacon-dapp/package.json +++ b/packages/beacon-dapp/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/beacon-dapp", - "version": "4.0.4", + "version": "4.0.5", "description": "> TODO: description", "author": "Andreas Gassmann ", "homepage": "https://walletbeacon.io", @@ -35,10 +35,10 @@ "url": "https://github.com/airgap-it/beacon-sdk/issues" }, "dependencies": { - "@airgap/beacon-core": "4.0.4", - "@airgap/beacon-transport-matrix": "4.0.4", - "@airgap/beacon-transport-postmessage": "4.0.4", - "@airgap/beacon-transport-walletconnect": "4.0.4", - "@airgap/beacon-ui": "4.0.4" + "@airgap/beacon-core": "4.0.5", + "@airgap/beacon-transport-matrix": "4.0.5", + "@airgap/beacon-transport-postmessage": "4.0.5", + "@airgap/beacon-transport-walletconnect": "4.0.5", + "@airgap/beacon-ui": "4.0.5" } } diff --git a/packages/beacon-dapp/src/dapp-client/DAppClient.ts b/packages/beacon-dapp/src/dapp-client/DAppClient.ts index c53e3887f..38e876e84 100644 --- a/packages/beacon-dapp/src/dapp-client/DAppClient.ts +++ b/packages/beacon-dapp/src/dapp-client/DAppClient.ts @@ -77,7 +77,13 @@ import { getSenderId, Logger } from '@airgap/beacon-core' -import { getAddressFromPublicKey, ExposedPromise, generateGUID, toHex } from '@airgap/beacon-utils' +import { + getAddressFromPublicKey, + ExposedPromise, + generateGUID, + toHex, + prefixPublicKey +} from '@airgap/beacon-utils' import { messageEvents } from '../beacon-message-events' import { BlockExplorer } from '../utils/block-explorer' import { TzktBlockExplorer } from '../utils/tzkt-blockexplorer' @@ -504,29 +510,30 @@ export class DAppClient extends Client { PostMessageTransport.getAvailableExtensions() .then(async (extensions) => { this.analytics.track('event', 'DAppClient', 'Extensions detected', { extensions }) - this.events - .emit(BeaconEvent.PAIR_INIT, { - p2pPeerInfo: () => { - p2pTransport.connect().then().catch(console.error) - return p2pTransport.getPairingRequestInfo() - }, - postmessagePeerInfo: () => postMessageTransport.getPairingRequestInfo(), - walletConnectPeerInfo: () => walletConnectTransport.getPairingRequestInfo(), - preferredNetwork: this.preferredNetwork, - abortedHandler: () => { - console.log('ABORTED') - this._initPromise = undefined - }, - disclaimerText: this.disclaimerText, - analytics: this.analytics, - featuredWallets: this.featuredWallets - }) - .catch((emitError) => console.warn(emitError)) }) .catch((error) => { this._initPromise = undefined console.error(error) }) + + this.events + .emit(BeaconEvent.PAIR_INIT, { + p2pPeerInfo: () => { + p2pTransport.connect().then().catch(console.error) + return p2pTransport.getPairingRequestInfo() + }, + postmessagePeerInfo: () => postMessageTransport.getPairingRequestInfo(), + walletConnectPeerInfo: () => walletConnectTransport.getPairingRequestInfo(), + preferredNetwork: this.preferredNetwork, + abortedHandler: () => { + console.log('ABORTED') + this._initPromise = undefined + }, + disclaimerText: this.disclaimerText, + analytics: this.analytics, + featuredWallets: this.featuredWallets + }) + .catch((emitError) => console.warn(emitError)) } } }) @@ -937,7 +944,9 @@ export class DAppClient extends Client { }) // TODO: Migration code. Remove sometime after 1.0.0 release. - const publicKey = message.publicKey || (message as any).pubkey || (message as any).pubKey + const publicKey = await prefixPublicKey( + message.publicKey || (message as any).pubkey || (message as any).pubKey + ) const address = await getAddressFromPublicKey(publicKey) console.log('######## MESSAGE #######') diff --git a/packages/beacon-sdk/package.json b/packages/beacon-sdk/package.json index 9c8b64585..8dc0e074a 100644 --- a/packages/beacon-sdk/package.json +++ b/packages/beacon-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/beacon-sdk", - "version": "4.0.4", + "version": "4.0.5", "description": "> TODO: description", "author": "Andreas Gassmann ", "homepage": "https://walletbeacon.io", @@ -35,15 +35,15 @@ "url": "https://github.com/airgap-it/beacon-sdk/issues" }, "dependencies": { - "@airgap/beacon-blockchain-substrate": "4.0.4", - "@airgap/beacon-blockchain-tezos": "4.0.4", - "@airgap/beacon-core": "4.0.4", - "@airgap/beacon-dapp": "4.0.4", - "@airgap/beacon-transport-matrix": "4.0.4", - "@airgap/beacon-transport-postmessage": "4.0.4", - "@airgap/beacon-types": "4.0.4", - "@airgap/beacon-ui": "4.0.4", - "@airgap/beacon-utils": "4.0.4", - "@airgap/beacon-wallet": "4.0.4" + "@airgap/beacon-blockchain-substrate": "4.0.5", + "@airgap/beacon-blockchain-tezos": "4.0.5", + "@airgap/beacon-core": "4.0.5", + "@airgap/beacon-dapp": "4.0.5", + "@airgap/beacon-transport-matrix": "4.0.5", + "@airgap/beacon-transport-postmessage": "4.0.5", + "@airgap/beacon-types": "4.0.5", + "@airgap/beacon-ui": "4.0.5", + "@airgap/beacon-utils": "4.0.5", + "@airgap/beacon-wallet": "4.0.5" } } diff --git a/packages/beacon-transport-matrix/package.json b/packages/beacon-transport-matrix/package.json index 55eead0be..fa48554be 100644 --- a/packages/beacon-transport-matrix/package.json +++ b/packages/beacon-transport-matrix/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/beacon-transport-matrix", - "version": "4.0.4", + "version": "4.0.5", "description": "> TODO: description", "author": "Andreas Gassmann ", "homepage": "https://walletbeacon.io", @@ -34,8 +34,8 @@ "url": "https://github.com/airgap-it/beacon-sdk/issues" }, "dependencies": { - "@airgap/beacon-core": "4.0.4", - "@airgap/beacon-utils": "4.0.4", + "@airgap/beacon-core": "4.0.5", + "@airgap/beacon-utils": "4.0.5", "axios": "0.24.0" } } diff --git a/packages/beacon-transport-matrix/src/communication-client/P2PCommunicationClient.ts b/packages/beacon-transport-matrix/src/communication-client/P2PCommunicationClient.ts index 7d8d14e1d..bce1ec117 100644 --- a/packages/beacon-transport-matrix/src/communication-client/P2PCommunicationClient.ts +++ b/packages/beacon-transport-matrix/src/communication-client/P2PCommunicationClient.ts @@ -161,6 +161,10 @@ export class P2PCommunicationClient extends CommunicationClient { keys.forEach((key) => { const nodes = this.ENABLED_RELAY_SERVERS[key] ?? [] + if (nodes.length === 0) { + return + } + const index = Math.floor(Math.random() * nodes.length) allPromises.push( this.getBeaconInfo(nodes[index]) diff --git a/packages/beacon-transport-postmessage/package.json b/packages/beacon-transport-postmessage/package.json index 11c7c2b18..d6eacf583 100644 --- a/packages/beacon-transport-postmessage/package.json +++ b/packages/beacon-transport-postmessage/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/beacon-transport-postmessage", - "version": "4.0.4", + "version": "4.0.5", "description": "> TODO: description", "author": "Andreas Gassmann ", "homepage": "https://walletbeacon.io", @@ -34,8 +34,8 @@ "url": "https://github.com/airgap-it/beacon-sdk/issues" }, "dependencies": { - "@airgap/beacon-core": "4.0.4", - "@airgap/beacon-types": "4.0.4", - "@airgap/beacon-utils": "4.0.4" + "@airgap/beacon-core": "4.0.5", + "@airgap/beacon-types": "4.0.5", + "@airgap/beacon-utils": "4.0.5" } } diff --git a/packages/beacon-transport-postmessage/src/PostMessageTransport.ts b/packages/beacon-transport-postmessage/src/PostMessageTransport.ts index ca796609a..89480835e 100644 --- a/packages/beacon-transport-postmessage/src/PostMessageTransport.ts +++ b/packages/beacon-transport-postmessage/src/PostMessageTransport.ts @@ -178,3 +178,6 @@ export class PostMessageTransport< }) } } + +// Start loading wallets async so they will be ready when the modal is opened +PostMessageTransport.getAvailableExtensions() diff --git a/packages/beacon-transport-walletconnect/package.json b/packages/beacon-transport-walletconnect/package.json index 38c77fa65..a0ec432e0 100644 --- a/packages/beacon-transport-walletconnect/package.json +++ b/packages/beacon-transport-walletconnect/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/beacon-transport-walletconnect", - "version": "4.0.4", + "version": "4.0.5", "description": "Beacon WalletConnect", "author": "Papers AG", "homepage": "https://walletbeacon.io", @@ -34,9 +34,9 @@ "url": "https://github.com/airgap-it/beacon-sdk/issues" }, "dependencies": { - "@airgap/beacon-core": "4.0.4", - "@airgap/beacon-types": "4.0.4", - "@airgap/beacon-utils": "4.0.4", - "@walletconnect/sign-client": "^2.7.5" + "@airgap/beacon-core": "4.0.5", + "@airgap/beacon-types": "4.0.5", + "@airgap/beacon-utils": "4.0.5", + "@walletconnect/sign-client": "^2.9.0" } } diff --git a/packages/beacon-transport-walletconnect/src/communication-client/WalletConnectCommunicationClient.ts b/packages/beacon-transport-walletconnect/src/communication-client/WalletConnectCommunicationClient.ts index 83d723273..b422e33cc 100644 --- a/packages/beacon-transport-walletconnect/src/communication-client/WalletConnectCommunicationClient.ts +++ b/packages/beacon-transport-walletconnect/src/communication-client/WalletConnectCommunicationClient.ts @@ -13,17 +13,23 @@ import { NotConnected } from '../error' import { + BeaconBaseMessage, BeaconErrorType, BeaconMessageType, + BeaconResponseInputMessage, ConnectionContext, ErrorResponse, + ErrorResponseInput, ExtendedWalletConnectPairingRequest, ExtendedWalletConnectPairingResponse, OperationRequest, + OperationResponseInput, Origin, + PermissionResponseInput, PermissionScope, SignPayloadRequest, - SignPayloadResponse + SignPayloadResponse, + SignPayloadResponseInput } from '@airgap/beacon-types' import { generateGUID } from '@airgap/beacon-utils' @@ -176,24 +182,20 @@ export class WalletConnectCommunicationClient extends CommunicationClient { throw new Error('Public Key in `tezos_getAccounts` is empty!') } - const serializer = new Serializer() - const serialized = await serializer.serialize({ + const permissionResponse: PermissionResponseInput = { type: BeaconMessageType.PermissionResponse, appMetadata: { - senderId: this.session?.peer.publicKey, - name: this.session?.peer.metadata.name + senderId: session.peer.publicKey, + name: session.peer.metadata.name, + icon: session.peer.metadata.icons[0] }, publicKey: result[0]?.pubkey, network: { type: NetworkType.MAINNET }, scopes: [PermissionScope.SIGN, PermissionScope.OPERATION_REQUEST], id: this.currentMessageId! - }) - this.activeListeners.forEach((listener) => { - listener(serialized, { - origin: Origin.WALLETCONNECT, - id: this.currentMessageId! - }) - }) + } + + this.sendResponse(session, permissionResponse) } /** @@ -209,19 +211,6 @@ export class WalletConnectCommunicationClient extends CommunicationClient { const account = await this.getPKH() this.validateNetworkAndAccount(network, account) - const serializer = new Serializer() - - const sendResponse = async (response: unknown) => { - const serialized = await serializer.serialize(response) - - this.activeListeners.forEach((listener) => { - listener(serialized, { - origin: Origin.WALLETCONNECT, - id: this.currentMessageId! - }) - }) - } - // TODO: Type this.signClient ?.request<{ signature: string }>({ @@ -236,23 +225,23 @@ export class WalletConnectCommunicationClient extends CommunicationClient { } }) .then((response) => { - const signPayloadResponse = { + const signPayloadResponse: SignPayloadResponseInput = { type: BeaconMessageType.SignPayloadResponse, signingType: signPayloadRequest.signingType, signature: response?.signature, id: this.currentMessageId! } as SignPayloadResponse - sendResponse(signPayloadResponse) + this.sendResponse(session, signPayloadResponse) }) .catch(async () => { - const errorResponse = { + const errorResponse: ErrorResponseInput = { type: BeaconMessageType.Error, id: this.currentMessageId!, errorType: BeaconErrorType.ABORTED_ERROR } as ErrorResponse - sendResponse(errorResponse) + this.sendResponse(session, errorResponse) }) } @@ -270,21 +259,14 @@ export class WalletConnectCommunicationClient extends CommunicationClient { const account = await this.getPKH() this.validateNetworkAndAccount(network, account) - const serializer = new Serializer() - - const sendResponse = async (response: unknown) => { - const serialized = await serializer.serialize(response) - - this.activeListeners.forEach((listener) => { - listener(serialized, { - origin: Origin.WALLETCONNECT, - id: this.currentMessageId! - }) - }) - } - this.signClient - ?.request<{ hash: string }>({ + ?.request<{ + // The `operationHash` field should be provided to specify the operation hash, + // while the `transactionHash` and `hash` fields are supported for backwards compatibility. + operationHash?: string + transactionHash?: string + hash?: string + }>({ topic: session.topic, chainId: `${TEZOS_PLACEHOLDER}:${network}`, request: { @@ -296,22 +278,22 @@ export class WalletConnectCommunicationClient extends CommunicationClient { } }) .then((response) => { - const sendOperationResponse = { + const sendOperationResponse: OperationResponseInput = { type: BeaconMessageType.OperationResponse, - transactionHash: response.hash, + transactionHash: response.operationHash ?? response.transactionHash ?? response.hash ?? '', id: this.currentMessageId! } - sendResponse(sendOperationResponse) + this.sendResponse(session, sendOperationResponse) }) .catch(async () => { - const errorResponse = { + const errorResponse: ErrorResponseInput = { type: BeaconMessageType.Error, id: this.currentMessageId!, errorType: BeaconErrorType.ABORTED_ERROR } as ErrorResponse - sendResponse(errorResponse) + this.sendResponse(session, errorResponse) }) } @@ -608,6 +590,23 @@ export class WalletConnectCommunicationClient extends CommunicationClient { // } } + private async sendResponse(session: SessionTypes.Struct, partialResponse: BeaconResponseInputMessage) { + const response: BeaconBaseMessage = { + ...partialResponse, + version: '2', + senderId: session.peer.publicKey + } + const serializer = new Serializer() + const serialized = await serializer.serialize(response) + + this.activeListeners.forEach((listener) => { + listener(serialized, { + origin: Origin.WALLETCONNECT, + id: this.currentMessageId! + }) + }) + } + public currentSession(): SessionTypes.Struct | undefined { return this.session } diff --git a/packages/beacon-types/package.json b/packages/beacon-types/package.json index e12fc61d9..fdff2db2a 100644 --- a/packages/beacon-types/package.json +++ b/packages/beacon-types/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/beacon-types", - "version": "4.0.4", + "version": "4.0.5", "description": "> TODO: description", "author": "Andreas Gassmann ", "homepage": "https://walletbeacon.io", diff --git a/packages/beacon-ui/package.json b/packages/beacon-ui/package.json index 68ef13512..11ee113ab 100644 --- a/packages/beacon-ui/package.json +++ b/packages/beacon-ui/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/beacon-ui", - "version": "4.0.4", + "version": "4.0.5", "description": "> TODO: description", "author": "Andreas Gassmann ", "homepage": "https://walletbeacon.io", @@ -34,10 +34,10 @@ "url": "https://github.com/airgap-it/beacon-sdk/issues" }, "dependencies": { - "@airgap/beacon-core": "4.0.4", - "@airgap/beacon-transport-postmessage": "4.0.4", - "@airgap/beacon-types": "4.0.4", - "@airgap/beacon-utils": "4.0.4", + "@airgap/beacon-core": "4.0.5", + "@airgap/beacon-transport-postmessage": "4.0.5", + "@airgap/beacon-types": "4.0.5", + "@airgap/beacon-utils": "4.0.5", "qrcode-svg": "^1.1.0", "solid-js": "^1.6.6" }, diff --git a/packages/beacon-ui/src/components/pair-other/pair-other.tsx b/packages/beacon-ui/src/components/pair-other/pair-other.tsx new file mode 100644 index 000000000..44eae7958 --- /dev/null +++ b/packages/beacon-ui/src/components/pair-other/pair-other.tsx @@ -0,0 +1,86 @@ +import { Component, createSignal, onMount } from 'solid-js' +import QR from '../qr' +import { MergedWallet } from '../../utils/wallets' +import { P2PPairingRequest, WalletConnectPairingRequest } from '@airgap/beacon-types' +import styles from './styles.css' +import { Serializer } from '@airgap/beacon-core' + +export interface PairOtherProps { + walletList: MergedWallet[] + p2pPayload: Promise | undefined + wcPayload: Promise | undefined + onClickLearnMore: () => void +} + +const [uiState, setUiState] = createSignal<'selection' | 'p2p' | 'walletconnect'>('selection') +const [hasBeacon, setHasBeacon] = createSignal(false) +const [hasWalletConnect, setHasWalletConnect] = createSignal(false) +const [qrData, setQrData] = createSignal('') + +const PairOther: Component = (props: PairOtherProps) => { + onMount(() => { + setUiState('selection') + setQrData('') + }) + + setHasBeacon(!!props.p2pPayload) + setHasWalletConnect(!!props.wcPayload) + + const buttonClickHandler = (state: 'p2p' | 'walletconnect') => { + if (state === 'p2p' && !!props.p2pPayload) { + props.p2pPayload.then(async (payload) => { + const serializer = new Serializer() + const codeQR = await serializer.serialize(payload) + setQrData(codeQR) + }) + } else if (state === 'walletconnect' && !!props.wcPayload) { + props.wcPayload.then(async (payload) => { + setQrData(payload.uri) + }) + } + setUiState(state) + } + + return ( + <> + {uiState() === 'selection' && ( +
+ Select QR Type +
+ {hasBeacon() && ( + + )} + {hasWalletConnect() && ( + + )} +
+ )} + {uiState() !== 'selection' && !!qrData() && ( + + )} + + ) +} + +export { styles } +export default PairOther diff --git a/packages/beacon-ui/src/components/pair-other/styles.css b/packages/beacon-ui/src/components/pair-other/styles.css new file mode 100644 index 000000000..79c865e8e --- /dev/null +++ b/packages/beacon-ui/src/components/pair-other/styles.css @@ -0,0 +1,7 @@ +.pair-other-info { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + color: #b5b8be; +} \ No newline at end of file diff --git a/packages/beacon-ui/src/components/toast/index.tsx b/packages/beacon-ui/src/components/toast/index.tsx index c1d38513c..7a4697950 100644 --- a/packages/beacon-ui/src/components/toast/index.tsx +++ b/packages/beacon-ui/src/components/toast/index.tsx @@ -1,4 +1,4 @@ -import { Component, For } from 'solid-js' +import { Component, For, createSignal } from 'solid-js' import { CloseIcon } from '../icons' import Loader from '../loader' @@ -39,10 +39,21 @@ export interface ToastProps { name: string type?: string } + openWalletAction?: () => void } +const [showMoreInfo, setShowMoreInfo] = createSignal(true) + const Toast: Component = (props: ToastProps) => { const hasWalletObject = props.label.includes('{{wallet}}') && props.walletInfo + const isRequestSentToast = props.label.includes('Request sent to') + + if (isRequestSentToast) { + setShowMoreInfo(false) + setTimeout(() => { + setShowMoreInfo(true) + }, 3000) + } return (
@@ -50,11 +61,23 @@ const Toast: Component = (props: ToastProps) => { {hasWalletObject && props.walletInfo && <>{parseWallet(props.label, props.walletInfo)}} {!hasWalletObject &&

props.label

} + {props.openWalletAction && ( +
{ + if (props && props.openWalletAction) { + props?.openWalletAction() + } + }} + > + Open Wallet +
+ )}
- {props.actions && ( + {props.actions && showMoreInfo() && (
{(action) => ( diff --git a/packages/beacon-ui/src/components/wallets/index.tsx b/packages/beacon-ui/src/components/wallets/index.tsx index 4b4d55d07..f54ff9845 100644 --- a/packages/beacon-ui/src/components/wallets/index.tsx +++ b/packages/beacon-ui/src/components/wallets/index.tsx @@ -7,6 +7,7 @@ interface WalletProps { wallets: MergedWallet[] onClickWallet: (id: string) => void onClickOther: () => void + isMobile: boolean small?: boolean disabled?: boolean } @@ -33,7 +34,7 @@ const Wallets: Component = (props: WalletProps) => {
) diff --git a/packages/beacon-ui/src/ui/alert/index.tsx b/packages/beacon-ui/src/ui/alert/index.tsx index ceef34e37..9aab68140 100644 --- a/packages/beacon-ui/src/ui/alert/index.tsx +++ b/packages/beacon-ui/src/ui/alert/index.tsx @@ -25,6 +25,7 @@ import * as walletStyles from '../../components/wallet/styles.css' import * as infoStyles from '../../components/info/styles.css' import * as qrStyles from '../../components/qr/styles.css' import * as loaderStyles from '../../components/loader/styles.css' +import * as pairOtherStyles from '../../components/pair-other/styles.css' import { Serializer, windowRef } from '@airgap/beacon-core' import { PostMessageTransport } from '@airgap/beacon-transport-postmessage' @@ -38,6 +39,7 @@ import { import { getTzip10Link } from 'src/utils/get-tzip10-link' import { isAndroid, isIOS, isTwBrowser } from 'src/utils/platform' import { getColorMode } from 'src/utils/colorMode' +import PairOther from 'src/components/pair-other/pair-other' // Interfaces export interface AlertButton { @@ -69,13 +71,14 @@ const [isOpen, setIsOpen] = createSignal(false) const [isLoading, setIsLoading] = createSignal(false) const [showMoreContent, setShowMoreContent] = createSignal(false) const [codeQR, setCodeQR] = createSignal('') +const [walletList, setWalletList] = createSignal([]) const [currentWallet, setCurrentWallet] = createSignal(undefined) const [previousInfo, setPreviousInfo] = createSignal< - 'top-wallets' | 'wallets' | 'install' | 'help' + 'top-wallets' | 'wallets' | 'install' | 'help' | 'qr' +>('top-wallets') +const [currentInfo, setCurrentInfo] = createSignal< + 'top-wallets' | 'wallets' | 'install' | 'help' | 'qr' >('top-wallets') -const [currentInfo, setCurrentInfo] = createSignal<'top-wallets' | 'wallets' | 'install' | 'help'>( - 'top-wallets' -) const [analytics, setAnalytics] = createSignal(undefined) type VoidFunction = () => void @@ -133,16 +136,16 @@ const closeAlerts = async (): Promise => */ // eslint-disable-next-line complexity const openAlert = async (config: AlertConfig): Promise => { - const p2ppayload = config.pairingPayload?.p2pSyncCode() - const wcpaylouad = config.pairingPayload?.walletConnectSyncCode() + const p2pPayload = config.pairingPayload?.p2pSyncCode() + const wcPayload = config.pairingPayload?.walletConnectSyncCode() setAnalytics(config.analytics) // TODO: Remove eager connection - p2ppayload?.then(() => { + p2pPayload?.then(() => { console.log('P2P LOADED') }) - wcpaylouad?.then(() => { + wcPayload?.then(() => { console.log('WC LOADED') }) @@ -152,12 +155,22 @@ const openAlert = async (config: AlertConfig): Promise => { } if (!isOpen()) { - const availableExtensions = await PostMessageTransport.getAvailableExtensions() + let availableExtensions = await PostMessageTransport.getAvailableExtensions() + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const extensionsUpdatedFn = async (event: any): Promise => { + if (event.data === 'extensionsUpdated') { + availableExtensions = await PostMessageTransport.getAvailableExtensions() + setWalletList(createWalletList()) + } + } + + windowRef.addEventListener('message', extensionsUpdatedFn) const setDefaultPayload = async () => { if (config.pairingPayload) { const serializer = new Serializer() - const codeQR = await serializer.serialize(await p2ppayload) + const codeQR = await serializer.serialize(await p2pPayload) setCodeQR(codeQR) } } @@ -207,77 +220,109 @@ const openAlert = async (config: AlertConfig): Promise => { style7.textContent = loaderStyles.default shadowRoot.appendChild(style7) + // PairOther styles + const style8 = document.createElement('style') + style8.textContent = pairOtherStyles.default + shadowRoot.appendChild(style8) + // Inject font styles const styleFonts = document.createElement('style') styleFonts.textContent = "* { font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif;}" shadowRoot.appendChild(styleFonts) - const wallets: Wallet[] = [ - ...desktopList.map((wallet) => { - return { - id: wallet.key, - key: wallet.key, - name: wallet.shortName, - image: wallet.logo, - description: 'Desktop App', - type: 'desktop', - link: wallet.downloadLink, - deepLink: wallet.deepLink - } - }), - ...extensionList.map((wallet) => { - return { - id: wallet.id, - key: wallet.key, - name: wallet.shortName, - image: wallet.logo, - description: 'Browser Extension', - type: 'extension', - link: wallet.link - } - }), - ...iOSList.map((wallet) => { - return { - id: wallet.key, - key: wallet.key, - name: wallet.shortName, - image: wallet.logo, - description: 'Mobile App', - supportedInteractionStandards: wallet.supportedInteractionStandards, - type: 'ios', - link: wallet.universalLink, - deepLink: wallet.deepLink - } - }), - ...webList.map((wallet) => { - const link = wallet.links[config.pairingPayload?.preferredNetwork ?? NetworkType.MAINNET] - return { - id: wallet.key, - key: wallet.key, - name: wallet.shortName, - image: wallet.logo, - description: 'Web App', - type: 'web', - link: link ?? wallet.links.mainnet - } - }) - ] + const createWalletList = () => { + const wallets: Wallet[] = [ + ...desktopList + // This is used for a special case where desktop wallets have inApp browsers. + // In this case, the wallet will act like an extension. This means we have to remove + // the desktop app from the list to make the user experience better. One example of this + // is Infinity Wallet. + .filter( + (wallet) => !availableExtensions.some((extWallet) => wallet.name === extWallet.name) + ) + .map((wallet) => { + return { + id: wallet.key, + key: wallet.key, + name: wallet.shortName, + image: wallet.logo, + description: 'Desktop App', + type: 'desktop', + link: wallet.downloadLink, + deepLink: wallet.deepLink + } + }), + ...extensionList.map((wallet) => { + return { + id: wallet.id, + key: wallet.key, + name: wallet.shortName, + image: wallet.logo, + description: 'Browser Extension', + type: 'extension', + link: wallet.link + } + }), + ...iOSList.map((wallet) => { + return { + id: wallet.key, + key: wallet.key, + name: wallet.shortName, + image: wallet.logo, + description: 'Mobile App', + supportedInteractionStandards: wallet.supportedInteractionStandards, + type: 'ios', + link: wallet.universalLink, + deepLink: wallet.deepLink + } + }), + ...webList.map((wallet) => { + const link = wallet.links[config.pairingPayload?.preferredNetwork ?? NetworkType.MAINNET] + return { + id: wallet.key, + key: wallet.key, + name: wallet.shortName, + image: wallet.logo, + description: 'Web App', + type: 'web', + link: link ?? wallet.links.mainnet + } + }), + ...availableExtensions + .filter((newExt) => !extensionList.some((ext) => ext.id === newExt.id)) + .map((wallet) => { + return { + id: wallet.id, + key: wallet.id, + name: wallet.shortName ?? wallet.name ?? '', + image: wallet.iconUrl ?? '', + description: 'Browser Extension', + type: 'extension', + link: (wallet as any).link ?? '' + } + }) + ] - // Parse wallet names - const parsedWallets = parseWallets(wallets) + // Parse wallet names + const parsedWallets = parseWallets(wallets) - // Merge wallets by name - const mergedWallets = mergeWallets(parsedWallets) + // Merge wallets by name + const mergedWallets = mergeWallets(parsedWallets) - // Default selection of featured wallets - const defaultWalletList = ['kukai', 'temple', 'naan', 'umami'] + // Default selection of featured wallets + const defaultWalletList = ['kukai', 'temple', 'naan', 'umami'] - // Sort wallets by top4 - const arrangedWallets = arrangeTopWallets( - mergedWallets, - config.featuredWallets ?? defaultWalletList - ) + // Sort wallets by top4 + const arrangedWallets = arrangeTopWallets( + mergedWallets, + config.featuredWallets ?? defaultWalletList + ) + + return arrangedWallets + } + + setWalletList(createWalletList()) const isMobile = window.innerWidth <= 800 @@ -299,6 +344,7 @@ const openAlert = async (config: AlertConfig): Promise => { const handleCloseAlert = () => { closeAlert('') + windowRef.removeEventListener('message', extensionsUpdatedFn) if (config.closeButtonCallback) config.closeButtonCallback() } @@ -307,7 +353,7 @@ const openAlert = async (config: AlertConfig): Promise => { setIsLoading(true) setShowMoreContent(false) - const wallet = arrangedWallets.find((wallet) => wallet.id === id) + const wallet = walletList().find((wallet) => wallet.id === id) setCurrentWallet(wallet) if (wallet?.key) { analytics()?.track('click', 'ui', 'opened wallet', { key: wallet.key }) @@ -315,18 +361,31 @@ const openAlert = async (config: AlertConfig): Promise => { } if (wallet?.types.includes('web')) { - if (config.pairingPayload) { + if (p2pPayload) { + // Noopener feature parameter cannot be used, because Chrome will open + // about:blank#blocked instead and it will no longer work. + const newTab = window.open('', '_blank') + + if (newTab) { + newTab.opener = null + } + const serializer = new Serializer() - const code = await serializer.serialize(await p2ppayload) + const code = await serializer.serialize(await p2pPayload) const link = getTzip10Link(wallet.link, code) - window.open(link, '_blank', 'noopener') + + if (newTab) { + newTab.location.href = link + } else { + window.open(link, '_blank', 'noopener') + } } setIsLoading(false) return } if (wallet && wallet.supportedInteractionStandards?.includes('wallet_connect')) { - const uri = (await wcpaylouad)?.uri + const uri = (await wcPayload)?.uri if (uri) { if (isAndroid(window) || isIOS(window)) { @@ -356,7 +415,7 @@ const openAlert = async (config: AlertConfig): Promise => { if (config.pairingPayload) { const serializer = new Serializer() - const code = await serializer.serialize(await p2ppayload) + const code = await serializer.serialize(await p2pPayload) const link = getTzip10Link( isIOS(window) && wallet.deepLink @@ -388,16 +447,7 @@ const openAlert = async (config: AlertConfig): Promise => { const handleClickOther = async () => { analytics()?.track('click', 'ui', 'other wallet') - setShowMoreContent(false) - setCurrentWallet({ - ...arrangedWallets[0], - name: '', - types: ['ios'] - }) - // TODO: replace with storage class - localStorage.setItem(StorageKey.LAST_SELECTED_WALLET, arrangedWallets[0].key) - setDefaultPayload() - setCurrentInfo('install') + setCurrentInfo('qr') } const handleClickConnectExtension = async () => { @@ -441,9 +491,9 @@ const openAlert = async (config: AlertConfig): Promise => { setShowMoreContent(false) analytics()?.track('click', 'ui', 'open desktop', { key: currentWallet()?.key }) - if (config.pairingPayload?.p2pSyncCode) { + if (p2pPayload) { const serializer = new Serializer() - const code = await serializer.serialize(await config.pairingPayload?.p2pSyncCode()) + const code = await serializer.serialize(await p2pPayload) const link = getTzip10Link(currentWallet()?.deepLink || '', code) window.open(link, '_blank', 'noopener') } @@ -474,107 +524,122 @@ const openAlert = async (config: AlertConfig): Promise => { showMore={showMoreContent()} content={
-
+ {!isMobile && currentWallet()?.types.includes('extension') && ( + - {!isMobile && currentWallet()?.types.includes('extension') && ( - handleClickConnectExtension() - } - ] - : [ - { - label: 'Install extension', - type: 'primary', - onClick: () => handleClickInstallExtension() - } - ] - } - /> - )} - {!isMobile && currentWallet()?.types.includes('desktop') && ( - handleClickOpenDesktopApp() - }, - { - label: 'Download desktop app', - type: 'secondary', - onClick: () => handleClickDownloadDesktopApp() + description={ + hasExtension() + ? `Please connect below to use your ${ + currentWallet()?.name + } Wallet browser extension.` + : `To connect your ${ + currentWallet()?.name + } Wallet, install the browser extension.` } - ]} - /> - )} - {!isMobile && - codeQR().length > 0 && - currentWallet()?.types.includes('ios') && - (currentWallet()?.types.length as number) > 1 && ( - handleClickConnectExtension() + } + ] + : [ + { + label: 'Install extension', + type: 'primary', + onClick: () => handleClickInstallExtension() + } + ] } - isMobile={false} - walletName={currentWallet()?.name || 'AirGap'} - code={codeQR()} - onClickLearnMore={handleClickLearnMore} - onClickQrCode={handleClickQrCode} /> )} - {!isMobile && - codeQR().length > 0 && - currentWallet()?.types.includes('ios') && - (currentWallet()?.types.length as number) <= 1 && ( + {!isMobile && currentWallet()?.types.includes('desktop') && ( + handleClickOpenDesktopApp() + }, + { + label: 'Download desktop app', + type: 'secondary', + onClick: () => handleClickDownloadDesktopApp() + } + ]} + /> + )} + {!isMobile && + codeQR().length > 0 && + currentWallet()?.types.includes('ios') && + (currentWallet()?.types.length as number) > 1 && ( + + )} + {!isMobile && + codeQR().length > 0 && + currentWallet()?.types.includes('ios') && + (currentWallet()?.types.length as number) <= 1 && ( + + )} + {isMobile && codeQR().length > 0 && ( => { ) || false } isMobile={true} - walletName={currentWallet()?.name || 'Airgap'} + walletName={currentWallet()?.name || 'AirGap'} code={codeQR()} onClickLearnMore={handleClickLearnMore} onClickQrCode={handleClickQrCode} /> )} - {isMobile && codeQR().length > 0 && ( - + )} + {currentInfo() === 'qr' && ( +
+ - )} -
+ p2pPayload={p2pPayload} + wcPayload={wcPayload} + > +
+ )}
=> { > @@ -704,6 +789,7 @@ const openAlert = async (config: AlertConfig): Promise => {
=> { > setCurrentInfo('wallets') } @@ -748,7 +834,8 @@ const openAlert = async (config: AlertConfig): Promise => { @@ -758,6 +845,8 @@ const openAlert = async (config: AlertConfig): Promise => { onCloseClick={() => handleCloseAlert()} onBackClick={ currentInfo() === 'install' && !isMobile + ? () => setCurrentInfo('top-wallets') + : currentInfo() === 'qr' ? () => setCurrentInfo('top-wallets') : currentInfo() === 'install' && isMobile ? () => setCurrentInfo('wallets') diff --git a/packages/beacon-ui/src/ui/toast/index.tsx b/packages/beacon-ui/src/ui/toast/index.tsx index 388a500db..42f1dbf20 100644 --- a/packages/beacon-ui/src/ui/toast/index.tsx +++ b/packages/beacon-ui/src/ui/toast/index.tsx @@ -68,6 +68,7 @@ const createToast = (config: ToastConfig) => { }} actions={config.actions} walletInfo={config.walletInfo} + openWalletAction={config.openWalletAction} /> ), shadowRoot diff --git a/packages/beacon-utils/__tests__/beacon-utils.spec.ts b/packages/beacon-utils/__tests__/beacon-utils.spec.ts index ce009dd07..66b2674c3 100644 --- a/packages/beacon-utils/__tests__/beacon-utils.spec.ts +++ b/packages/beacon-utils/__tests__/beacon-utils.spec.ts @@ -3,7 +3,7 @@ import * as chai from 'chai' import * as chaiAsPromised from 'chai-as-promised' import 'mocha' -import { getAddressFromPublicKey } from '../src/utils/crypto' +import { getAddressFromPublicKey, prefixPublicKey } from '../src/utils/crypto' import { generateGUID } from '../src/utils/generate-uuid' // use chai-as-promised plugin @@ -104,4 +104,24 @@ describe(`Crypto`, () => { expect(typeof GUID).to.deep.equal('string') }) }) + + it(`should prefix a public key`, async () => { + const publicKey = '370ffb098088e67f8284ca4938f8f1eac02c3e2ab150f29adc8a7075a5ce7e63' + + const prefixedPublicKey = await prefixPublicKey(publicKey) + + expect(prefixedPublicKey).to.deep.equal( + 'edpku4US3ZykcZifjzSGFCmFr3zRgCKndE82estE4irj4d5oqDNDvf' + ) + }) + + it(`should not prefix a public key that is already prefixed`, async () => { + const publicKey = 'edpku4US3ZykcZifjzSGFCmFr3zRgCKndE82estE4irj4d5oqDNDvf' + + const prefixedPublicKey = await prefixPublicKey(publicKey) + + expect(prefixedPublicKey).to.deep.equal( + 'edpku4US3ZykcZifjzSGFCmFr3zRgCKndE82estE4irj4d5oqDNDvf' + ) + }) }) diff --git a/packages/beacon-utils/package.json b/packages/beacon-utils/package.json index e7c115dd5..595d86819 100644 --- a/packages/beacon-utils/package.json +++ b/packages/beacon-utils/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/beacon-utils", - "version": "4.0.4", + "version": "4.0.5", "description": "> TODO: description", "author": "Andreas Gassmann ", "homepage": "https://walletbeacon.io", diff --git a/packages/beacon-utils/src/index.ts b/packages/beacon-utils/src/index.ts index 0f450be8a..5d3197b11 100644 --- a/packages/beacon-utils/src/index.ts +++ b/packages/beacon-utils/src/index.ts @@ -10,7 +10,8 @@ export { sealCryptobox, openCryptobox, recipientString, - signMessage + signMessage, + prefixPublicKey } from './utils/crypto' export { generateGUID } from './utils/generate-uuid' diff --git a/packages/beacon-utils/src/utils/crypto.ts b/packages/beacon-utils/src/utils/crypto.ts index f995be2fb..9c5c03dad 100644 --- a/packages/beacon-utils/src/utils/crypto.ts +++ b/packages/beacon-utils/src/utils/crypto.ts @@ -196,6 +196,21 @@ export async function getAddressFromPublicKey(publicKey: string): Promise { + if (publicKey.length !== 64) { + return publicKey + } + + const payload: Uint8Array = Buffer.from(publicKey, 'hex') + + return bs58check.encode(Buffer.concat([new Uint8Array([13, 15, 37, 217]), Buffer.from(payload)])) +} + /** * Get the recipient string used in the matrix message * diff --git a/packages/beacon-wallet/package.json b/packages/beacon-wallet/package.json index b2268829d..1d4abb5d1 100644 --- a/packages/beacon-wallet/package.json +++ b/packages/beacon-wallet/package.json @@ -1,6 +1,6 @@ { "name": "@airgap/beacon-wallet", - "version": "4.0.4", + "version": "4.0.5", "description": "> TODO: description", "author": "Andreas Gassmann ", "homepage": "https://walletbeacon.io", @@ -35,8 +35,8 @@ "url": "https://github.com/airgap-it/beacon-sdk/issues" }, "dependencies": { - "@airgap/beacon-core": "4.0.4", - "@airgap/beacon-transport-matrix": "4.0.4", - "@airgap/beacon-transport-postmessage": "4.0.4" + "@airgap/beacon-core": "4.0.5", + "@airgap/beacon-transport-matrix": "4.0.5", + "@airgap/beacon-transport-postmessage": "4.0.5" } }