From fc0f79fa0ef4f3de3f3c9cf88b42d0c564272e62 Mon Sep 17 00:00:00 2001 From: Brendon Votteler Date: Fri, 31 Mar 2023 02:00:54 +1100 Subject: [PATCH 01/21] chore: add resolutions for various polkadot packages (#1089) --- package.json | 18 +- yarn.lock | 1101 +++----------------------------------------------- 2 files changed, 77 insertions(+), 1042 deletions(-) diff --git a/package.json b/package.json index a04eeee39b..e1686ea0b0 100644 --- a/package.json +++ b/package.json @@ -128,7 +128,23 @@ "bn.js": "4.12.0", "react-error-overlay": "6.0.9", "styled-components": "^5", - "@types/history": "^4.7.1" + "@types/history": "^4.7.1", + "@polkadot/api": "^9.14.2", + "@polkadot/api-augment": "^9.14.2", + "@polkadot/api-base": "^9.14.2", + "@polkadot/api-contract": "^9.14.2", + "@polkadot/api-derive": "^9.14.2", + "@polkadot/rpc-augment": "^9.14.2", + "@polkadot/rpc-core": "^9.14.2", + "@polkadot/rpc-provider": "^9.14.2", + "@polkadot/types": "^9.14.2", + "@polkadot/types-augment": "^9.14.2", + "@polkadot/types-codec": "^9.14.2", + "@polkadot/types-create": "^9.14.2", + "@polkadot/types-known": "^9.14.2", + "@polkadot/types-support": "^9.14.2", + "@polkadot/util": "^10.2.4", + "@polkadot/util-crypto": "^10.2.4" }, "scripts": { "start": "craco start", diff --git a/yarn.lock b/yarn.lock index ee187abc45..a6278b49e8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1536,7 +1536,7 @@ dependencies: regenerator-runtime "^0.13.4" -"@babel/runtime@^7.14.6", "@babel/runtime@^7.17.2", "@babel/runtime@^7.18.6", "@babel/runtime@^7.20.13", "@babel/runtime@^7.20.6": +"@babel/runtime@^7.14.6", "@babel/runtime@^7.18.6", "@babel/runtime@^7.20.13", "@babel/runtime@^7.20.6": version "7.21.0" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.21.0.tgz#5b55c9d394e5fcf304909a8b00c07dc217b56673" integrity sha512-xwII0//EObnq89Ji5AKYQaRYiW/nZ3llSv29d49IuxPhKbtJoLP+9QUUZ4nVragQVtaVGeZrpB+ZtG/Pdy/POw== @@ -3026,31 +3026,11 @@ call-me-maybe "^1.0.1" glob-to-regexp "^0.3.0" -"@noble/hashes@1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.0.0.tgz#d5e38bfbdaba174805a4e649f13be9a9ed3351ae" - integrity sha512-DZVbtY62kc3kkBtMHqwCOfXrT/hnoORy5BJ4+HU1IR59X0KWAOqsfzQPcUl/lQLlG7qXbe/fZ3r/emxtAl+sqg== - -"@noble/hashes@1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.1.2.tgz#e9e035b9b166ca0af657a7848eb2718f0f22f183" - integrity sha512-KYRCASVTv6aeUi1tsF8/vpyR7zpfs3FUzy2Jqm+MU+LmUKhQ0y2FpfwqkCcxSg2ua4GALJd8k2R76WxwZGbQpA== - "@noble/hashes@1.2.0": version "1.2.0" resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.2.0.tgz#a3150eeb09cc7ab207ebf6d7b9ad311a9bdbed12" integrity sha512-FZfhjEDbT5GRswV3C6uvLPHMiVD6lQBmpoX5+eSiPaMTXte/IKqI5dykDxzZB/WBeK/CDuQRBWarPdi3FNY2zQ== -"@noble/secp256k1@1.5.5": - version "1.5.5" - resolved "https://registry.yarnpkg.com/@noble/secp256k1/-/secp256k1-1.5.5.tgz#315ab5745509d1a8c8e90d0bdf59823ccf9bcfc3" - integrity sha512-sZ1W6gQzYnu45wPrWx8D3kwI2/U29VYTx9OjbDAd7jwRItJ0cSTMPRL/C8AWZFn9kWFLQGqEXVEE86w4Z8LpIQ== - -"@noble/secp256k1@1.6.0": - version "1.6.0" - resolved "https://registry.yarnpkg.com/@noble/secp256k1/-/secp256k1-1.6.0.tgz#602afbbfcfb7e169210469b697365ef740d7e930" - integrity sha512-DWSsg8zMHOYMYBqIQi96BQuthZrp98LCeMNcUOaffCIVYQ5yxDbNikLF+H7jEnmNNmXbtVic46iCuVWzar+MgA== - "@noble/secp256k1@1.7.1": version "1.7.1" resolved "https://registry.yarnpkg.com/@noble/secp256k1/-/secp256k1-1.7.1.tgz#b251c70f824ce3ca7f8dc3df08d58f005cc0507c" @@ -3324,33 +3304,7 @@ resolved "https://registry.yarnpkg.com/@polka/url/-/url-1.0.0-next.21.tgz#5de5a2385a35309427f6011992b544514d559aa1" integrity sha512-a5Sab1C4/icpTZVzZc5Ghpz88yQtGOyNqYXcZgOssB2uuAr+wF/MvN6bgtW32q7HHrvBki+BsZ0OuNv6EV3K9g== -"@polkadot/api-augment@7.15.1": - version "7.15.1" - resolved "https://registry.yarnpkg.com/@polkadot/api-augment/-/api-augment-7.15.1.tgz#120b766feeaa96996f1c6717a5261c2e0845c1e0" - integrity sha512-7csQLS6zuYuGq7W1EkTBz1ZmxyRvx/Qpz7E7zPSwxmY8Whb7Yn2effU9XF0eCcRpyfSW8LodF8wMmLxGYs1OaQ== - dependencies: - "@babel/runtime" "^7.17.8" - "@polkadot/api-base" "7.15.1" - "@polkadot/rpc-augment" "7.15.1" - "@polkadot/types" "7.15.1" - "@polkadot/types-augment" "7.15.1" - "@polkadot/types-codec" "7.15.1" - "@polkadot/util" "^8.7.1" - -"@polkadot/api-augment@8.14.1": - version "8.14.1" - resolved "https://registry.yarnpkg.com/@polkadot/api-augment/-/api-augment-8.14.1.tgz#f44a2e1952cb158bce55db687be9e3ac7113c87e" - integrity sha512-65GMlgVnZd08Ifh8uAj+p/+MlXxvsAfBcCHjQhOmbCE0dki+rzTPUR31LsWyDKtuw+nUBj0iZN4PelO+wU4r0g== - dependencies: - "@babel/runtime" "^7.18.9" - "@polkadot/api-base" "8.14.1" - "@polkadot/rpc-augment" "8.14.1" - "@polkadot/types" "8.14.1" - "@polkadot/types-augment" "8.14.1" - "@polkadot/types-codec" "8.14.1" - "@polkadot/util" "^10.1.1" - -"@polkadot/api-augment@9.14.2": +"@polkadot/api-augment@9.14.2", "@polkadot/api-augment@9.9.1", "@polkadot/api-augment@^9.14.2": version "9.14.2" resolved "https://registry.yarnpkg.com/@polkadot/api-augment/-/api-augment-9.14.2.tgz#2c49cdcfdf7057523db1dc8d7b0801391a8a2e69" integrity sha512-19MmW8AHEcLkdcUIo3LLk0eCQgREWqNSxkUyOeWn7UiNMY1AhDOOwMStUBNCvrIDK6VL6GGc1sY7rkPCLMuKSw== @@ -3363,42 +3317,7 @@ "@polkadot/types-codec" "9.14.2" "@polkadot/util" "^10.4.2" -"@polkadot/api-augment@9.9.1": - version "9.9.1" - resolved "https://registry.yarnpkg.com/@polkadot/api-augment/-/api-augment-9.9.1.tgz#5615ed8117a385d7ade3609fb51ea6119b79b8ef" - integrity sha512-0HS6Kit9ZiO2iQU/aS/jpOjXl9rFcwW6FdUs1eSXvWjvAFpoxwCMG8bv8wVjNZcCUuA2w5U0+2B+Xa612QEQQg== - dependencies: - "@babel/runtime" "^7.20.1" - "@polkadot/api-base" "9.9.1" - "@polkadot/rpc-augment" "9.9.1" - "@polkadot/types" "9.9.1" - "@polkadot/types-augment" "9.9.1" - "@polkadot/types-codec" "9.9.1" - "@polkadot/util" "^10.1.13" - -"@polkadot/api-base@7.15.1": - version "7.15.1" - resolved "https://registry.yarnpkg.com/@polkadot/api-base/-/api-base-7.15.1.tgz#7567595be68431cc4085c48b18ba66933ff7b4d9" - integrity sha512-UlhLdljJPDwGpm5FxOjvJNFTxXMRFaMuVNx6EklbuetbBEJ/Amihhtj0EJRodxQwtZ4ZtPKYKt+g+Dn7OJJh4g== - dependencies: - "@babel/runtime" "^7.17.8" - "@polkadot/rpc-core" "7.15.1" - "@polkadot/types" "7.15.1" - "@polkadot/util" "^8.7.1" - rxjs "^7.5.5" - -"@polkadot/api-base@8.14.1": - version "8.14.1" - resolved "https://registry.yarnpkg.com/@polkadot/api-base/-/api-base-8.14.1.tgz#a9380b11b74f2bc60dbf62b562b78c779e1d5b24" - integrity sha512-EXFhNXIfpirf18IsqcG2pGQW1/Xn+bfjqVYQMMJ4ZONtYH4baZZlXk7SoXCCHonN2x1ixs4DOcRx5oVxjabdIQ== - dependencies: - "@babel/runtime" "^7.18.9" - "@polkadot/rpc-core" "8.14.1" - "@polkadot/types" "8.14.1" - "@polkadot/util" "^10.1.1" - rxjs "^7.5.6" - -"@polkadot/api-base@9.14.2": +"@polkadot/api-base@9.14.2", "@polkadot/api-base@^9.14.2": version "9.14.2" resolved "https://registry.yarnpkg.com/@polkadot/api-base/-/api-base-9.14.2.tgz#605b44e3692a125bd8d97eed9cea8af9d0c454e2" integrity sha512-ky9fmzG1Tnrjr/SBZ0aBB21l0TFr+CIyQenQczoUyVgiuxVaI/2Bp6R2SFrHhG28P+PW2/RcYhn2oIAR2Z2fZQ== @@ -3409,50 +3328,21 @@ "@polkadot/util" "^10.4.2" rxjs "^7.8.0" -"@polkadot/api-base@9.9.1": - version "9.9.1" - resolved "https://registry.yarnpkg.com/@polkadot/api-base/-/api-base-9.9.1.tgz#716143c3a9849570a499a7b44d82fd2533f141de" - integrity sha512-uJDLi+nHQ08QZ+p1ldzwMeNjCyIkpR1DOzvKV3M3bLepglF8r7V/7W5dXk+qlClMqgB92RgKwo4R6EPRgr5BcA== - dependencies: - "@babel/runtime" "^7.20.1" - "@polkadot/rpc-core" "9.9.1" - "@polkadot/types" "9.9.1" - "@polkadot/util" "^10.1.13" - rxjs "^7.5.7" - -"@polkadot/api-derive@7.15.1": - version "7.15.1" - resolved "https://registry.yarnpkg.com/@polkadot/api-derive/-/api-derive-7.15.1.tgz#450542bb7d848013225d6c8480648340e5ee6a61" - integrity sha512-CsOQppksQBaa34L1fWRzmfQQpoEBwfH0yTTQxgj3h7rFYGVPxEKGeFjo1+IgI2vXXvOO73Z8E4H/MnbxvKrs1Q== - dependencies: - "@babel/runtime" "^7.17.8" - "@polkadot/api" "7.15.1" - "@polkadot/api-augment" "7.15.1" - "@polkadot/api-base" "7.15.1" - "@polkadot/rpc-core" "7.15.1" - "@polkadot/types" "7.15.1" - "@polkadot/types-codec" "7.15.1" - "@polkadot/util" "^8.7.1" - "@polkadot/util-crypto" "^8.7.1" - rxjs "^7.5.5" - -"@polkadot/api-derive@8.14.1", "@polkadot/api-derive@^8.5.1": - version "8.14.1" - resolved "https://registry.yarnpkg.com/@polkadot/api-derive/-/api-derive-8.14.1.tgz#9079ad58f66e6a2d45d57947e3d8a40135eba9b9" - integrity sha512-eWG1MrQhHMUjt9gDHN9/9/ZMATu1MolqcalPFhNoGtdON3+I0J3ntjQ4y5X7+p2OGwQplpYRKqbK4k7tKzu8tA== +"@polkadot/api-contract@^9.14.2": + version "9.14.2" + resolved "https://registry.yarnpkg.com/@polkadot/api-contract/-/api-contract-9.14.2.tgz#42ca46eecd6cef64b6c453b452bdb5d22a29b6a3" + integrity sha512-gAAHEh+tOIKuAJWxbAuB8Imo+Z8s0FHdICN6/q4JOxBhONJNA9beHB4wmqWSKvYqYmWrJvtv3HensLaITzAcrQ== dependencies: - "@babel/runtime" "^7.18.9" - "@polkadot/api" "8.14.1" - "@polkadot/api-augment" "8.14.1" - "@polkadot/api-base" "8.14.1" - "@polkadot/rpc-core" "8.14.1" - "@polkadot/types" "8.14.1" - "@polkadot/types-codec" "8.14.1" - "@polkadot/util" "^10.1.1" - "@polkadot/util-crypto" "^10.1.1" - rxjs "^7.5.6" + "@babel/runtime" "^7.20.13" + "@polkadot/api" "9.14.2" + "@polkadot/types" "9.14.2" + "@polkadot/types-codec" "9.14.2" + "@polkadot/types-create" "9.14.2" + "@polkadot/util" "^10.4.2" + "@polkadot/util-crypto" "^10.4.2" + rxjs "^7.8.0" -"@polkadot/api-derive@9.14.2", "@polkadot/api-derive@^9.7.1", "@polkadot/api-derive@^9.9.1": +"@polkadot/api-derive@9.14.2", "@polkadot/api-derive@^8.5.1", "@polkadot/api-derive@^9.14.2", "@polkadot/api-derive@^9.7.1", "@polkadot/api-derive@^9.9.1": version "9.14.2" resolved "https://registry.yarnpkg.com/@polkadot/api-derive/-/api-derive-9.14.2.tgz#e8fcd4ee3f2b80b9fe34d4dec96169c3bdb4214d" integrity sha512-yw9OXucmeggmFqBTMgza0uZwhNjPxS7MaT7lSCUIRKckl1GejdV+qMhL3XFxPFeYzXwzFpdPG11zWf+qJlalqw== @@ -3468,53 +3358,7 @@ "@polkadot/util-crypto" "^10.4.2" rxjs "^7.8.0" -"@polkadot/api@7.15.1", "@polkadot/api@^7.2.1": - version "7.15.1" - resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-7.15.1.tgz#24eaeaa8ffbc6f30ff3d9846a816a18a688ceb8b" - integrity sha512-z0z6+k8+R9ixRMWzfsYrNDnqSV5zHKmyhTCL0I7+1I081V18MJTCFUKubrh0t1gD0/FCt3U9Ibvr4IbtukYLrQ== - dependencies: - "@babel/runtime" "^7.17.8" - "@polkadot/api-augment" "7.15.1" - "@polkadot/api-base" "7.15.1" - "@polkadot/api-derive" "7.15.1" - "@polkadot/keyring" "^8.7.1" - "@polkadot/rpc-augment" "7.15.1" - "@polkadot/rpc-core" "7.15.1" - "@polkadot/rpc-provider" "7.15.1" - "@polkadot/types" "7.15.1" - "@polkadot/types-augment" "7.15.1" - "@polkadot/types-codec" "7.15.1" - "@polkadot/types-create" "7.15.1" - "@polkadot/types-known" "7.15.1" - "@polkadot/util" "^8.7.1" - "@polkadot/util-crypto" "^8.7.1" - eventemitter3 "^4.0.7" - rxjs "^7.5.5" - -"@polkadot/api@8.14.1": - version "8.14.1" - resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-8.14.1.tgz#e2f543700db84f89e873c4e1f8eb78d9e648797e" - integrity sha512-jg26eIKFYqVfDBTAopHL3aDaNw9j6TdUkXuvYJOnynpecU4xwbTVKcOtSOjJ2eRX4MgMQ4zlyMHJx3iKw0uUTA== - dependencies: - "@babel/runtime" "^7.18.9" - "@polkadot/api-augment" "8.14.1" - "@polkadot/api-base" "8.14.1" - "@polkadot/api-derive" "8.14.1" - "@polkadot/keyring" "^10.1.1" - "@polkadot/rpc-augment" "8.14.1" - "@polkadot/rpc-core" "8.14.1" - "@polkadot/rpc-provider" "8.14.1" - "@polkadot/types" "8.14.1" - "@polkadot/types-augment" "8.14.1" - "@polkadot/types-codec" "8.14.1" - "@polkadot/types-create" "8.14.1" - "@polkadot/types-known" "8.14.1" - "@polkadot/util" "^10.1.1" - "@polkadot/util-crypto" "^10.1.1" - eventemitter3 "^4.0.7" - rxjs "^7.5.6" - -"@polkadot/api@9.14.2", "@polkadot/api@^9.11.1", "@polkadot/api@^9.4.2", "@polkadot/api@^9.7.1", "@polkadot/api@^9.8.1", "@polkadot/api@^9.9.1", "@polkadot/api@latest": +"@polkadot/api@9.14.2", "@polkadot/api@^7.2.1", "@polkadot/api@^9.11.1", "@polkadot/api@^9.14.2", "@polkadot/api@^9.4.2", "@polkadot/api@^9.7.1", "@polkadot/api@^9.8.1", "@polkadot/api@^9.9.1", "@polkadot/api@latest": version "9.14.2" resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-9.14.2.tgz#d5cee02236654c6063d7c4b70c78c290db5aba8d" integrity sha512-R3eYFj2JgY1zRb+OCYQxNlJXCs2FA+AU4uIEiVcXnVLmR3M55tkRNEwYAZmiFxx0pQmegGgPMc33q7TWGdw24A== @@ -3602,7 +3446,7 @@ "@polkadot/util-crypto" "^9.4.1" "@polkadot/x-global" "^9.4.1" -"@polkadot/keyring@^10.1.1", "@polkadot/keyring@^10.1.13", "@polkadot/keyring@^10.1.6", "@polkadot/keyring@^10.4.2": +"@polkadot/keyring@^10.1.13", "@polkadot/keyring@^10.1.6", "@polkadot/keyring@^10.4.2": version "10.4.2" resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-10.4.2.tgz#793377fdb9076df0af771df11388faa6be03c70d" integrity sha512-7iHhJuXaHrRTG6cJDbZE9G+c1ts1dujp0qbO4RfAPmT7YUvphHvAtCKueN9UKPz5+TYDL+rP/jDEaSKU8jl/qQ== @@ -3629,7 +3473,7 @@ "@polkadot/util" "7.9.2" "@polkadot/util-crypto" "7.9.2" -"@polkadot/keyring@^8.2.2", "@polkadot/keyring@^8.7.1": +"@polkadot/keyring@^8.2.2": version "8.7.1" resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-8.7.1.tgz#07cf6d6ee351dcf70fbf965b1d6d96c5025ae1b8" integrity sha512-t6ZgQVC+nQT7XwbWtEhkDpiAzxKVJw8Xd/gWdww6xIrawHu7jo3SGB4QNdPgkf8TvDHYAAJiupzVQYAlOIq3GA== @@ -3638,18 +3482,7 @@ "@polkadot/util" "8.7.1" "@polkadot/util-crypto" "8.7.1" -"@polkadot/metadata@4.17.1": - version "4.17.1" - resolved "https://registry.yarnpkg.com/@polkadot/metadata/-/metadata-4.17.1.tgz#4da9ee5b2b816493910abfd302a50b58141ceca2" - integrity sha512-219isiCWVfbu5JxZnOPj+cV4T+S0XHS4+Jal3t3xz9y4nbgr+25Pa4KInEsJPx0u8EZAxMeiUCX3vd5U7oe72g== - dependencies: - "@babel/runtime" "^7.14.6" - "@polkadot/types" "4.17.1" - "@polkadot/types-known" "4.17.1" - "@polkadot/util" "^6.11.1" - "@polkadot/util-crypto" "^6.11.1" - -"@polkadot/networks@10.4.2", "@polkadot/networks@^10.1.1", "@polkadot/networks@^10.1.11", "@polkadot/networks@^10.1.6", "@polkadot/networks@^10.4.2": +"@polkadot/networks@10.4.2", "@polkadot/networks@^10.1.11", "@polkadot/networks@^10.1.6", "@polkadot/networks@^10.4.2": version "10.4.2" resolved "https://registry.yarnpkg.com/@polkadot/networks/-/networks-10.4.2.tgz#d7878c6aad8173c800a21140bfe5459261724456" integrity sha512-FAh/znrEvWBiA/LbcT5GXHsCFUl//y9KqxLghSr/CreAmAergiJNT0MVUezC7Y36nkATgmsr4ylFwIxhVtuuCw== @@ -3658,61 +3491,7 @@ "@polkadot/util" "10.4.2" "@substrate/ss58-registry" "^1.38.0" -"@polkadot/networks@6.11.1", "@polkadot/networks@^6.11.1": - version "6.11.1" - resolved "https://registry.yarnpkg.com/@polkadot/networks/-/networks-6.11.1.tgz#8fd189593f6ee4f8bf64378d0aaae09e39a37d35" - integrity sha512-0C6Ha2kvr42se3Gevx6UhHzv3KnPHML0N73Amjwvdr4y0HLZ1Nfw+vcm5yqpz5gpiehqz97XqFrsPRauYdcksQ== - dependencies: - "@babel/runtime" "^7.14.6" - -"@polkadot/networks@7.9.2": - version "7.9.2" - resolved "https://registry.yarnpkg.com/@polkadot/networks/-/networks-7.9.2.tgz#03e3f3ac6bdea177517436537826055df60bcb9a" - integrity sha512-4obI1RdW5/7TFwbwKA9oqw8aggVZ65JAUvIFMd2YmMC2T4+NiZLnok0WhRkhZkUnqjLIHXYNwq7Ho1i39dte0g== - dependencies: - "@babel/runtime" "^7.16.3" - -"@polkadot/networks@8.7.1", "@polkadot/networks@^8.1.2", "@polkadot/networks@^8.7.1": - version "8.7.1" - resolved "https://registry.yarnpkg.com/@polkadot/networks/-/networks-8.7.1.tgz#26c2ec6158c985bb77c510d98a3ab1c7e049f89c" - integrity sha512-8xAmhDW0ry5EKcEjp6VTuwoTm0DdDo/zHsmx88P6sVL87gupuFsL+B6TrsYLl8GcaqxujwrOlKB+CKTUg7qFKg== - dependencies: - "@babel/runtime" "^7.17.8" - "@polkadot/util" "8.7.1" - "@substrate/ss58-registry" "^1.17.0" - -"@polkadot/networks@9.7.2": - version "9.7.2" - resolved "https://registry.yarnpkg.com/@polkadot/networks/-/networks-9.7.2.tgz#9064f0578b293245bee263367d6f1674eb06e506" - integrity sha512-oMAdF8Y9CLBI0EUZBcycHcvbQQdbkJHevPJ/lwnZXJTaueXuav/Xm2yiFj5J3V8meIjLocURlMawgsAVItXOBQ== - dependencies: - "@babel/runtime" "^7.18.6" - "@polkadot/util" "9.7.2" - "@substrate/ss58-registry" "^1.23.0" - -"@polkadot/rpc-augment@7.15.1": - version "7.15.1" - resolved "https://registry.yarnpkg.com/@polkadot/rpc-augment/-/rpc-augment-7.15.1.tgz#391a42a9c3e553335a2a544598a717b47654ad6e" - integrity sha512-sK0+mphN7nGz/eNPsshVi0qd0+N0Pqxuebwc1YkUGP0f9EkDxzSGp6UjGcSwWVaAtk9WZZ1MpK1Jwb/2GrKV7Q== - dependencies: - "@babel/runtime" "^7.17.8" - "@polkadot/rpc-core" "7.15.1" - "@polkadot/types" "7.15.1" - "@polkadot/types-codec" "7.15.1" - "@polkadot/util" "^8.7.1" - -"@polkadot/rpc-augment@8.14.1": - version "8.14.1" - resolved "https://registry.yarnpkg.com/@polkadot/rpc-augment/-/rpc-augment-8.14.1.tgz#1b55c9e66a8aaafb76e6ed6a37b0682a4331b2a7" - integrity sha512-0dIsNVIMeCp0kV7+Obz0Odt6K32Ka2ygwhiV5jhhJthy8GJBPo94mKDed5gzln3Dgl2LEdJJt1h/pgCx4a2i4A== - dependencies: - "@babel/runtime" "^7.18.9" - "@polkadot/rpc-core" "8.14.1" - "@polkadot/types" "8.14.1" - "@polkadot/types-codec" "8.14.1" - "@polkadot/util" "^10.1.1" - -"@polkadot/rpc-augment@9.14.2": +"@polkadot/rpc-augment@9.14.2", "@polkadot/rpc-augment@^9.14.2": version "9.14.2" resolved "https://registry.yarnpkg.com/@polkadot/rpc-augment/-/rpc-augment-9.14.2.tgz#eb70d5511463dab8d995faeb77d4edfe4952fe26" integrity sha512-mOubRm3qbKZTbP9H01XRrfTk7k5it9WyzaWAg72DJBQBYdgPUUkGSgpPD/Srkk5/5GAQTWVWL1I2UIBKJ4TJjQ== @@ -3723,42 +3502,7 @@ "@polkadot/types-codec" "9.14.2" "@polkadot/util" "^10.4.2" -"@polkadot/rpc-augment@9.9.1": - version "9.9.1" - resolved "https://registry.yarnpkg.com/@polkadot/rpc-augment/-/rpc-augment-9.9.1.tgz#84f71a818bfcc5c33ff87252ffa263344f69255b" - integrity sha512-t3gTendxM9KD9Sg+hT7Wn72Xdusl25EsXcdOjFqQWUtFL8xjYcFngrTTifG90e+ciFIk1DWps2+zc6lbDwBfeA== - dependencies: - "@babel/runtime" "^7.20.1" - "@polkadot/rpc-core" "9.9.1" - "@polkadot/types" "9.9.1" - "@polkadot/types-codec" "9.9.1" - "@polkadot/util" "^10.1.13" - -"@polkadot/rpc-core@7.15.1": - version "7.15.1" - resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-7.15.1.tgz#47855cf05bd2f8dbf87d9f1f77343114e61c664a" - integrity sha512-4Sb0e0PWmarCOizzxQAE1NQSr5z0n+hdkrq3+aPohGu9Rh4PodG+OWeIBy7Ov/3GgdhNQyBLG+RiVtliXecM3g== - dependencies: - "@babel/runtime" "^7.17.8" - "@polkadot/rpc-augment" "7.15.1" - "@polkadot/rpc-provider" "7.15.1" - "@polkadot/types" "7.15.1" - "@polkadot/util" "^8.7.1" - rxjs "^7.5.5" - -"@polkadot/rpc-core@8.14.1": - version "8.14.1" - resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-8.14.1.tgz#0b9a408a03ecde820d0d55287efbfb4cb95b537a" - integrity sha512-deQ8Ob59ao/1fZQdaVtFjYR/HCBdxSYvQGt7/alBu1Uig9Sahx9oKcMkU5rWY36XqGZYos4zLay98W2hDlf+6Q== - dependencies: - "@babel/runtime" "^7.18.9" - "@polkadot/rpc-augment" "8.14.1" - "@polkadot/rpc-provider" "8.14.1" - "@polkadot/types" "8.14.1" - "@polkadot/util" "^10.1.1" - rxjs "^7.5.6" - -"@polkadot/rpc-core@9.14.2", "@polkadot/rpc-core@^9.9.1": +"@polkadot/rpc-core@9.14.2", "@polkadot/rpc-core@^9.14.2", "@polkadot/rpc-core@^9.9.1": version "9.14.2" resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-9.14.2.tgz#26d4f00ac7abbf880f8280e9b96235880d35794b" integrity sha512-krA/mtQ5t9nUQEsEVC1sjkttLuzN6z6gyJxK2IlpMS3S5ncy/R6w4FOpy+Q0H18Dn83JBo0p7ZtY7Y6XkK48Kw== @@ -3770,57 +3514,7 @@ "@polkadot/util" "^10.4.2" rxjs "^7.8.0" -"@polkadot/rpc-core@9.9.1": - version "9.9.1" - resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-9.9.1.tgz#f66318fe54f66652287dab9c4d611b71863b266a" - integrity sha512-ij1OxDfbPpdZ9+aN8oicZrysIfUjC7INBhDwwoZ4R/4jhqJvIV1fisgj6XOdHGlZGl+vQBnObOw0nEOU7apdQg== - dependencies: - "@babel/runtime" "^7.20.1" - "@polkadot/rpc-augment" "9.9.1" - "@polkadot/rpc-provider" "9.9.1" - "@polkadot/types" "9.9.1" - "@polkadot/util" "^10.1.13" - rxjs "^7.5.7" - -"@polkadot/rpc-provider@7.15.1": - version "7.15.1" - resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-7.15.1.tgz#a213de907a6f4f480c3c819aa95e4e60d4247f84" - integrity sha512-n0RWfSaD/r90JXeJkKry1aGZwJeBUUiMpXUQ9Uvp6DYBbYEDs0fKtWLpdT3PdFrMbe5y3kwQmNLxwe6iF4+mzg== - dependencies: - "@babel/runtime" "^7.17.8" - "@polkadot/keyring" "^8.7.1" - "@polkadot/types" "7.15.1" - "@polkadot/types-support" "7.15.1" - "@polkadot/util" "^8.7.1" - "@polkadot/util-crypto" "^8.7.1" - "@polkadot/x-fetch" "^8.7.1" - "@polkadot/x-global" "^8.7.1" - "@polkadot/x-ws" "^8.7.1" - "@substrate/connect" "0.7.0-alpha.0" - eventemitter3 "^4.0.7" - mock-socket "^9.1.2" - nock "^13.2.4" - -"@polkadot/rpc-provider@8.14.1", "@polkadot/rpc-provider@^8.7.1": - version "8.14.1" - resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-8.14.1.tgz#d318a3cb3c71410cea6a9c2c609d39e3fc62d8bb" - integrity sha512-pAUSHZiSWLhBSYf4LmLc8iCaeqTu7Ajn8AzyqxvZDHGnIrzV5M7eTjpNDP84qno6jWRHKQ/IILr62hausEmS5w== - dependencies: - "@babel/runtime" "^7.18.9" - "@polkadot/keyring" "^10.1.1" - "@polkadot/types" "8.14.1" - "@polkadot/types-support" "8.14.1" - "@polkadot/util" "^10.1.1" - "@polkadot/util-crypto" "^10.1.1" - "@polkadot/x-fetch" "^10.1.1" - "@polkadot/x-global" "^10.1.1" - "@polkadot/x-ws" "^10.1.1" - "@substrate/connect" "0.7.9" - eventemitter3 "^4.0.7" - mock-socket "^9.1.5" - nock "^13.2.9" - -"@polkadot/rpc-provider@9.14.2": +"@polkadot/rpc-provider@9.14.2", "@polkadot/rpc-provider@^8.7.1", "@polkadot/rpc-provider@^9.14.2": version "9.14.2" resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-9.14.2.tgz#0dea667f3a03bf530f202cba5cd360df19b32e30" integrity sha512-YTSywjD5PF01V47Ru5tln2LlpUwJiSOdz6rlJXPpMaY53hUp7+xMU01FVAQ1bllSBNisSD1Msv/mYHq84Oai2g== @@ -3840,46 +3534,7 @@ optionalDependencies: "@substrate/connect" "0.7.19" -"@polkadot/rpc-provider@9.9.1": - version "9.9.1" - resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-9.9.1.tgz#1dcddb127aca53fcf1f269bbf7cac68982c67854" - integrity sha512-YyIwYDAgeEAAjvsH/v5v6sFkhkoaER98rPIcfP+81sGcxpjBCArg4feDtzTPQMsnUcbj3708ppJicu6ECc1xFg== - dependencies: - "@babel/runtime" "^7.20.1" - "@polkadot/keyring" "^10.1.13" - "@polkadot/types" "9.9.1" - "@polkadot/types-support" "9.9.1" - "@polkadot/util" "^10.1.13" - "@polkadot/util-crypto" "^10.1.13" - "@polkadot/x-fetch" "^10.1.13" - "@polkadot/x-global" "^10.1.13" - "@polkadot/x-ws" "^10.1.13" - "@substrate/connect" "0.7.17" - eventemitter3 "^4.0.7" - mock-socket "^9.1.5" - nock "^13.2.9" - -"@polkadot/types-augment@7.15.1": - version "7.15.1" - resolved "https://registry.yarnpkg.com/@polkadot/types-augment/-/types-augment-7.15.1.tgz#437047f961b8d29e5ffd4fd59cd35f0e6374750b" - integrity sha512-aqm7xT/66TCna0I2utpIekoquKo0K5pnkA/7WDzZ6gyD8he2h0IXfe8xWjVmuyhjxrT/C/7X1aUF2Z0xlOCwzQ== - dependencies: - "@babel/runtime" "^7.17.8" - "@polkadot/types" "7.15.1" - "@polkadot/types-codec" "7.15.1" - "@polkadot/util" "^8.7.1" - -"@polkadot/types-augment@8.14.1": - version "8.14.1" - resolved "https://registry.yarnpkg.com/@polkadot/types-augment/-/types-augment-8.14.1.tgz#6868d7f1321f6cd2b5028374bc496e5174fcf15e" - integrity sha512-Xa4TUFqyZT+IJ6pBSwDjWcF42u/E34OyC+gbs5Z2vWQ4EzSDkq4xNoUKjJlEEgTemsD9lhPOIc4jvqTCefwxEw== - dependencies: - "@babel/runtime" "^7.18.9" - "@polkadot/types" "8.14.1" - "@polkadot/types-codec" "8.14.1" - "@polkadot/util" "^10.1.1" - -"@polkadot/types-augment@9.14.2", "@polkadot/types-augment@^9.11.1": +"@polkadot/types-augment@9.14.2", "@polkadot/types-augment@^9.11.1", "@polkadot/types-augment@^9.14.2": version "9.14.2" resolved "https://registry.yarnpkg.com/@polkadot/types-augment/-/types-augment-9.14.2.tgz#1a478e18e713b04038f3e171287ee5abe908f0aa" integrity sha512-WO9d7RJufUeY3iFgt2Wz762kOu1tjEiGBR5TT4AHtpEchVHUeosVTrN9eycC+BhleqYu52CocKz6u3qCT/jKLg== @@ -3889,34 +3544,7 @@ "@polkadot/types-codec" "9.14.2" "@polkadot/util" "^10.4.2" -"@polkadot/types-augment@9.9.1": - version "9.9.1" - resolved "https://registry.yarnpkg.com/@polkadot/types-augment/-/types-augment-9.9.1.tgz#77e7d9df2a3bd69236c7fa8c02b6574b1e232d84" - integrity sha512-h4DhtVPbe7/6Mdwickqih3ltvEV9y08a8LVvjxVVaGw1gRcoQpcMLkvsyWh5caYBPCKuJvXV40p4PnvO/HtW2A== - dependencies: - "@babel/runtime" "^7.20.1" - "@polkadot/types" "9.9.1" - "@polkadot/types-codec" "9.9.1" - "@polkadot/util" "^10.1.13" - -"@polkadot/types-codec@7.15.1": - version "7.15.1" - resolved "https://registry.yarnpkg.com/@polkadot/types-codec/-/types-codec-7.15.1.tgz#c0155867efd3ae35e15fea6a8aab49c2c63988fa" - integrity sha512-nI11dT7FGaeDd/fKPD8iJRFGhosOJoyjhZ0gLFFDlKCaD3AcGBRTTY8HFJpP/5QXXhZzfZsD93fVKrosnegU0Q== - dependencies: - "@babel/runtime" "^7.17.8" - "@polkadot/util" "^8.7.1" - -"@polkadot/types-codec@8.14.1": - version "8.14.1" - resolved "https://registry.yarnpkg.com/@polkadot/types-codec/-/types-codec-8.14.1.tgz#b5342fa38e17eb1183434981e23334d5bd1ecd2e" - integrity sha512-y6YDN4HwvEgSWlgrEV04QBBxDxES1cTuUQFzZJzOTuZCWpA371Mdj3M9wYxGXMnj0wa+rCQGECHPZZaNxBMiKg== - dependencies: - "@babel/runtime" "^7.18.9" - "@polkadot/util" "^10.1.1" - "@polkadot/x-bigint" "^10.1.1" - -"@polkadot/types-codec@9.14.2": +"@polkadot/types-codec@9.14.2", "@polkadot/types-codec@^9.14.2": version "9.14.2" resolved "https://registry.yarnpkg.com/@polkadot/types-codec/-/types-codec-9.14.2.tgz#d625c80495d7a68237b3d5c0a60ff10d206131fa" integrity sha512-AJ4XF7W1no4PENLBRU955V6gDxJw0h++EN3YoDgThozZ0sj3OxyFupKgNBZcZb2V23H8JxQozzIad8k+nJbO1w== @@ -3925,34 +3553,7 @@ "@polkadot/util" "^10.4.2" "@polkadot/x-bigint" "^10.4.2" -"@polkadot/types-codec@9.9.1": - version "9.9.1" - resolved "https://registry.yarnpkg.com/@polkadot/types-codec/-/types-codec-9.9.1.tgz#4a5f789bedb29f27af612afe789d91e78d6bd136" - integrity sha512-vBzInneVp2ClDD/bmrf9HUp9La0udBJnhvyqwdLA2IKQBjIYOxVtuC62D4dg1Svp34NH4+b/nAtWlOvflSjOQQ== - dependencies: - "@babel/runtime" "^7.20.1" - "@polkadot/util" "^10.1.13" - "@polkadot/x-bigint" "^10.1.13" - -"@polkadot/types-create@7.15.1": - version "7.15.1" - resolved "https://registry.yarnpkg.com/@polkadot/types-create/-/types-create-7.15.1.tgz#ec4cafa314a82a25a109f0f52207e9169fc9b003" - integrity sha512-+HiaHn7XOwP0kv/rVdORlVkNuMoxuvt+jd67A/CeEreJiXqRLu+S61Mdk7wi6719PTaOal1hTDFfyGrtUd8FSQ== - dependencies: - "@babel/runtime" "^7.17.8" - "@polkadot/types-codec" "7.15.1" - "@polkadot/util" "^8.7.1" - -"@polkadot/types-create@8.14.1": - version "8.14.1" - resolved "https://registry.yarnpkg.com/@polkadot/types-create/-/types-create-8.14.1.tgz#46af719c33581576eed03658baf3aaa932b3d89c" - integrity sha512-fb9yyblj5AYAPzeCIq0kYSfzDxRDi/0ud9gN2UzB3H7M/O4n2mPC1vD4UOLF+B7l9QzCrt4e+k+/riGp7GfvyA== - dependencies: - "@babel/runtime" "^7.18.9" - "@polkadot/types-codec" "8.14.1" - "@polkadot/util" "^10.1.1" - -"@polkadot/types-create@9.14.2": +"@polkadot/types-create@9.14.2", "@polkadot/types-create@^9.14.2": version "9.14.2" resolved "https://registry.yarnpkg.com/@polkadot/types-create/-/types-create-9.14.2.tgz#aec515a2d3bc7e7b7802095cdd35ece48dc442bc" integrity sha512-nSnKpBierlmGBQT8r6/SHf6uamBIzk4WmdMsAsR4uJKJF1PtbIqx2W5PY91xWSiMSNMzjkbCppHkwaDAMwLGaw== @@ -3961,60 +3562,7 @@ "@polkadot/types-codec" "9.14.2" "@polkadot/util" "^10.4.2" -"@polkadot/types-create@9.9.1": - version "9.9.1" - resolved "https://registry.yarnpkg.com/@polkadot/types-create/-/types-create-9.9.1.tgz#4a9c6596a2adb879e878a6fba6f1bb967567a637" - integrity sha512-fzHTdWdXPbJxAYNP2nFzM9B1Nom7wiIFalltIj3jLQYF8uCgPuMF4/nLDi5uEg5YpCBCTagqyoVUuEd4riDS/Q== - dependencies: - "@babel/runtime" "^7.20.1" - "@polkadot/types-codec" "9.9.1" - "@polkadot/util" "^10.1.13" - -"@polkadot/types-known@4.17.1": - version "4.17.1" - resolved "https://registry.yarnpkg.com/@polkadot/types-known/-/types-known-4.17.1.tgz#71c18dda4967a13ec34fbbf0c4ef264e882c2688" - integrity sha512-YkOwGrO+k9aVrBR8FgYHnfJKhOfpdgC5ZRYNL/xJ9oa7lBYqPts9ENAxeBmJS/5IGeDF9f32MNyrCP2umeCXWg== - dependencies: - "@babel/runtime" "^7.14.6" - "@polkadot/networks" "^6.11.1" - "@polkadot/types" "4.17.1" - "@polkadot/util" "^6.11.1" - -"@polkadot/types-known@6.12.1": - version "6.12.1" - resolved "https://registry.yarnpkg.com/@polkadot/types-known/-/types-known-6.12.1.tgz#2dd3ca4e4aa20b86ef182eb75672690f8c14a84e" - integrity sha512-Z8bHpPQy+mqUm0uR1tai6ra0bQIoPmgRcGFYUM+rJtW1kx/6kZLh10HAICjLpPeA1cwLRzaxHRDqH5MCU6OgXw== - dependencies: - "@babel/runtime" "^7.16.3" - "@polkadot/networks" "^8.1.2" - "@polkadot/types" "6.12.1" - "@polkadot/util" "^8.1.2" - -"@polkadot/types-known@7.15.1": - version "7.15.1" - resolved "https://registry.yarnpkg.com/@polkadot/types-known/-/types-known-7.15.1.tgz#71dbf0835a48cdc97d0f50b0000298687e29818d" - integrity sha512-LMcNP0CxT84DqAKV62/qDeeIVIJCR5yzE9b+9AsYhyfhE4apwxjrThqZA7K0CF56bOdQJSexAerYB/jwk2IijA== - dependencies: - "@babel/runtime" "^7.17.8" - "@polkadot/networks" "^8.7.1" - "@polkadot/types" "7.15.1" - "@polkadot/types-codec" "7.15.1" - "@polkadot/types-create" "7.15.1" - "@polkadot/util" "^8.7.1" - -"@polkadot/types-known@8.14.1": - version "8.14.1" - resolved "https://registry.yarnpkg.com/@polkadot/types-known/-/types-known-8.14.1.tgz#86103e2b58da15cf74d2babc0cba544a2b12702a" - integrity sha512-GP7gRo9nmitykkrRnoLF61Qm19UFdTwMsOnJkdm7AOeWDmZGxutacgO6k1tBsHr38hsiCCGsB/JiseUgywvGIw== - dependencies: - "@babel/runtime" "^7.18.9" - "@polkadot/networks" "^10.1.1" - "@polkadot/types" "8.14.1" - "@polkadot/types-codec" "8.14.1" - "@polkadot/types-create" "8.14.1" - "@polkadot/util" "^10.1.1" - -"@polkadot/types-known@9.14.2": +"@polkadot/types-known@9.14.2", "@polkadot/types-known@^9.14.2": version "9.14.2" resolved "https://registry.yarnpkg.com/@polkadot/types-known/-/types-known-9.14.2.tgz#17fe5034a5b907bd006093a687f112b07edadf10" integrity sha512-iM8WOCgguzJ3TLMqlm4K1gKQEwWm2zxEKT1HZZ1irs/lAbBk9MquDWDvebryiw3XsLB8xgrp3RTIBn2Q4FjB2A== @@ -4026,23 +3574,7 @@ "@polkadot/types-create" "9.14.2" "@polkadot/util" "^10.4.2" -"@polkadot/types-support@7.15.1": - version "7.15.1" - resolved "https://registry.yarnpkg.com/@polkadot/types-support/-/types-support-7.15.1.tgz#9c274759647dd89d46ea9cf74d593bcedcd85527" - integrity sha512-FIK251ffVo+NaUXLlaJeB5OvT7idDd3uxaoBM6IwsS87rzt2CcWMyCbu0uX89AHZUhSviVx7xaBxfkGEqMePWA== - dependencies: - "@babel/runtime" "^7.17.8" - "@polkadot/util" "^8.7.1" - -"@polkadot/types-support@8.14.1": - version "8.14.1" - resolved "https://registry.yarnpkg.com/@polkadot/types-support/-/types-support-8.14.1.tgz#a227266aa296847c43f6d51426c22ce68357bd2c" - integrity sha512-XqR4qq6pCZyNBuFVod8nFSNUmLssrjoU9bOIn4Ua2cqNlI9xsuKaI1X5ySEn/oWOtKQ2L5hbCm9vkXrEtXBl1w== - dependencies: - "@babel/runtime" "^7.18.9" - "@polkadot/util" "^10.1.1" - -"@polkadot/types-support@9.14.2": +"@polkadot/types-support@9.14.2", "@polkadot/types-support@^9.14.2": version "9.14.2" resolved "https://registry.yarnpkg.com/@polkadot/types-support/-/types-support-9.14.2.tgz#d25e8d4e5ec3deef914cb55fc8bc5448431ddd18" integrity sha512-VWCOPgXDK3XtXT7wMLyIWeNDZxUbNcw/8Pn6n6vMogs7o/n4h6WGbGMeTIQhPWyn831/RmkVs5+2DUC+2LlOhw== @@ -4050,65 +3582,7 @@ "@babel/runtime" "^7.20.13" "@polkadot/util" "^10.4.2" -"@polkadot/types-support@9.9.1": - version "9.9.1" - resolved "https://registry.yarnpkg.com/@polkadot/types-support/-/types-support-9.9.1.tgz#d93ddf1d68de39ff7241d7962cf50b9f7fe6d0f6" - integrity sha512-PGu80mMvyr+rD6pi8Z/r9l650cadpW4X+pWt4tJnKYAbtiaE9mQJGFwq+HgY3vExzRDhaXNOUDg9d1ry5XUvJQ== - dependencies: - "@babel/runtime" "^7.20.1" - "@polkadot/util" "^10.1.13" - -"@polkadot/types@4.17.1", "@polkadot/types@^4.13.1": - version "4.17.1" - resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-4.17.1.tgz#41d43621d53820ee930ba4036bfa8b16cf98ca6f" - integrity sha512-rjW4OFdwvFekzN3ATLibC2JPSd8AWt5YepJhmuCPdwH26r3zB8bEC6dM7YQExLVUmygVPvgXk5ffHI6RAdXBMg== - dependencies: - "@babel/runtime" "^7.14.6" - "@polkadot/metadata" "4.17.1" - "@polkadot/util" "^6.11.1" - "@polkadot/util-crypto" "^6.11.1" - "@polkadot/x-rxjs" "^6.11.1" - -"@polkadot/types@6.12.1", "@polkadot/types@^6.0.5": - version "6.12.1" - resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-6.12.1.tgz#e5d6dff997740c3da947fa67abe2e1ec144c4757" - integrity sha512-O37cAGUL0xiXTuO3ySweVh0OuFUD6asrd0TfuzGsEp3jAISWdElEHV5QDiftWq8J9Vf8BMgTcP2QLFbmSusxqA== - dependencies: - "@babel/runtime" "^7.16.3" - "@polkadot/types-known" "6.12.1" - "@polkadot/util" "^8.1.2" - "@polkadot/util-crypto" "^8.1.2" - rxjs "^7.4.0" - -"@polkadot/types@7.15.1", "@polkadot/types@^7.2.1": - version "7.15.1" - resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-7.15.1.tgz#fb78886f4437fbc472e01019846fb1f229d2a177" - integrity sha512-KawZVS+eLR1D6O7c/P5cSUwr6biM9Qd2KwKtJIO8l1Mrxp7r+y2tQnXSSXVAd6XPdb3wVMhnIID+NW3W99TAnQ== - dependencies: - "@babel/runtime" "^7.17.8" - "@polkadot/keyring" "^8.7.1" - "@polkadot/types-augment" "7.15.1" - "@polkadot/types-codec" "7.15.1" - "@polkadot/types-create" "7.15.1" - "@polkadot/util" "^8.7.1" - "@polkadot/util-crypto" "^8.7.1" - rxjs "^7.5.5" - -"@polkadot/types@8.14.1", "@polkadot/types@^8.7.1": - version "8.14.1" - resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-8.14.1.tgz#a0149680d06b02bc23b842865b84840a5bc8b870" - integrity sha512-Xza16ejKrSd4XhTOlbfISyxZ2sRmbMAZk5pX7VEMHVZHqV98o+bJ2f9Kk7F8YJijkHHGosCLDestP9R5nLoOoA== - dependencies: - "@babel/runtime" "^7.18.9" - "@polkadot/keyring" "^10.1.1" - "@polkadot/types-augment" "8.14.1" - "@polkadot/types-codec" "8.14.1" - "@polkadot/types-create" "8.14.1" - "@polkadot/util" "^10.1.1" - "@polkadot/util-crypto" "^10.1.1" - rxjs "^7.5.6" - -"@polkadot/types@9.14.2", "@polkadot/types@^9.11.1", "@polkadot/types@^9.7.1", "@polkadot/types@^9.9.1": +"@polkadot/types@9.14.2", "@polkadot/types@^4.13.1", "@polkadot/types@^6.0.5", "@polkadot/types@^7.2.1", "@polkadot/types@^8.7.1", "@polkadot/types@^9.11.1", "@polkadot/types@^9.14.2", "@polkadot/types@^9.7.1", "@polkadot/types@^9.9.1": version "9.14.2" resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-9.14.2.tgz#5105f41eb9e8ea29938188d21497cbf1753268b8" integrity sha512-hGLddTiJbvowhhUZJ3k+olmmBc1KAjWIQxujIUIYASih8FQ3/YJDKxaofGOzh0VygOKW3jxQBN2VZPofyDP9KQ== @@ -4122,20 +3596,6 @@ "@polkadot/util-crypto" "^10.4.2" rxjs "^7.8.0" -"@polkadot/types@9.9.1": - version "9.9.1" - resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-9.9.1.tgz#ef223eb82066303c807828d23668672a8153712e" - integrity sha512-WK0CPj0LZhb5ZSfhMvT5ZZv0nnqz9wQdRSehjqeuq7DD2TgTIPZL22zP4UjJPAJEyTtwyfcRn6+ZhL2JS5w0Jg== - dependencies: - "@babel/runtime" "^7.20.1" - "@polkadot/keyring" "^10.1.13" - "@polkadot/types-augment" "9.9.1" - "@polkadot/types-codec" "9.9.1" - "@polkadot/types-create" "9.9.1" - "@polkadot/util" "^10.1.13" - "@polkadot/util-crypto" "^10.1.13" - rxjs "^7.5.7" - "@polkadot/ui-keyring@^2.9.7": version "2.9.7" resolved "https://registry.yarnpkg.com/@polkadot/ui-keyring/-/ui-keyring-2.9.7.tgz#b79b056b4c26866b3e87569407bcc16b95894545" @@ -4161,7 +3621,7 @@ eventemitter3 "^4.0.7" store "^2.0.12" -"@polkadot/util-crypto@10.4.2", "@polkadot/util-crypto@^10.1.1", "@polkadot/util-crypto@^10.1.12", "@polkadot/util-crypto@^10.1.13", "@polkadot/util-crypto@^10.1.6", "@polkadot/util-crypto@^10.4.2": +"@polkadot/util-crypto@10.4.2", "@polkadot/util-crypto@6.11.1", "@polkadot/util-crypto@7.9.2", "@polkadot/util-crypto@8.7.1", "@polkadot/util-crypto@^10.1.12", "@polkadot/util-crypto@^10.1.13", "@polkadot/util-crypto@^10.1.6", "@polkadot/util-crypto@^10.2.4", "@polkadot/util-crypto@^10.4.2", "@polkadot/util-crypto@^9.0.1", "@polkadot/util-crypto@^9.4.1": version "10.4.2" resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-10.4.2.tgz#871fb69c65768bd48c57bb5c1f76a85d979fb8b5" integrity sha512-RxZvF7C4+EF3fzQv8hZOLrYCBq5+wA+2LWv98nECkroChY3C2ZZvyWDqn8+aonNULt4dCVTWDZM0QIY6y4LUAQ== @@ -4178,85 +3638,7 @@ ed2curve "^0.3.0" tweetnacl "^1.0.3" -"@polkadot/util-crypto@6.11.1", "@polkadot/util-crypto@^6.11.1": - version "6.11.1" - resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-6.11.1.tgz#7a36acf5c8bf52541609ec0b0b2a69af295d652e" - integrity sha512-fWA1Nz17FxWJslweZS4l0Uo30WXb5mYV1KEACVzM+BSZAvG5eoiOAYX6VYZjyw6/7u53XKrWQlD83iPsg3KvZw== - dependencies: - "@babel/runtime" "^7.14.6" - "@polkadot/networks" "6.11.1" - "@polkadot/util" "6.11.1" - "@polkadot/wasm-crypto" "^4.0.2" - "@polkadot/x-randomvalues" "6.11.1" - base-x "^3.0.8" - base64-js "^1.5.1" - blakejs "^1.1.1" - bn.js "^4.11.9" - create-hash "^1.2.0" - elliptic "^6.5.4" - hash.js "^1.1.7" - js-sha3 "^0.8.0" - scryptsy "^2.1.0" - tweetnacl "^1.0.3" - xxhashjs "^0.2.2" - -"@polkadot/util-crypto@7.9.2": - version "7.9.2" - resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-7.9.2.tgz#cdc336f92a6bc3d40c5a23734e1974fb777817f0" - integrity sha512-nNwqUwP44eCH9jKKcPie+IHLKkg9LMe6H7hXo91hy3AtoslnNrT51tP3uAm5yllhLvswJfnAgnlHq7ybCgqeFw== - dependencies: - "@babel/runtime" "^7.16.3" - "@polkadot/networks" "7.9.2" - "@polkadot/util" "7.9.2" - "@polkadot/wasm-crypto" "^4.4.1" - "@polkadot/x-randomvalues" "7.9.2" - blakejs "^1.1.1" - bn.js "^4.12.0" - create-hash "^1.2.0" - ed2curve "^0.3.0" - elliptic "^6.5.4" - hash.js "^1.1.7" - js-sha3 "^0.8.0" - micro-base "^0.9.0" - scryptsy "^2.1.0" - tweetnacl "^1.0.3" - xxhashjs "^0.2.2" - -"@polkadot/util-crypto@8.7.1", "@polkadot/util-crypto@^8.1.2", "@polkadot/util-crypto@^8.7.1": - version "8.7.1" - resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-8.7.1.tgz#f9fcca2895b5f160ce1c2faa0aa3054cc7aa4655" - integrity sha512-TaSuJ2aNrB5sYK7YXszkEv24nYJKRFqjF2OrggoMg6uYxUAECvTkldFnhtgeizMweRMxJIBu6bMHlSIutbWgjw== - dependencies: - "@babel/runtime" "^7.17.8" - "@noble/hashes" "1.0.0" - "@noble/secp256k1" "1.5.5" - "@polkadot/networks" "8.7.1" - "@polkadot/util" "8.7.1" - "@polkadot/wasm-crypto" "^5.1.1" - "@polkadot/x-bigint" "8.7.1" - "@polkadot/x-randomvalues" "8.7.1" - "@scure/base" "1.0.0" - ed2curve "^0.3.0" - tweetnacl "^1.0.3" - -"@polkadot/util-crypto@^9.0.1", "@polkadot/util-crypto@^9.4.1": - version "9.7.2" - resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-9.7.2.tgz#0a097f4e197cd344d101ab748a740c2d99a4c5b9" - integrity sha512-tfz6mJtPwoNteivKCmR+QklC4mr1/hGZRsDJLWKaFhanDinYZ3V2pJM1EbCI6WONLuuzlTxsDXjAffWzzRqlPA== - dependencies: - "@babel/runtime" "^7.18.6" - "@noble/hashes" "1.1.2" - "@noble/secp256k1" "1.6.0" - "@polkadot/networks" "9.7.2" - "@polkadot/util" "9.7.2" - "@polkadot/wasm-crypto" "^6.2.2" - "@polkadot/x-bigint" "9.7.2" - "@polkadot/x-randomvalues" "9.7.2" - "@scure/base" "1.1.1" - ed2curve "^0.3.0" - tweetnacl "^1.0.3" - -"@polkadot/util@10.4.2", "@polkadot/util@^10.1.1", "@polkadot/util@^10.1.11", "@polkadot/util@^10.1.12", "@polkadot/util@^10.1.13", "@polkadot/util@^10.1.6", "@polkadot/util@^10.4.2": +"@polkadot/util@10.4.2", "@polkadot/util@6.11.1", "@polkadot/util@7.9.2", "@polkadot/util@8.7.1", "@polkadot/util@^10.1.11", "@polkadot/util@^10.1.12", "@polkadot/util@^10.1.13", "@polkadot/util@^10.1.6", "@polkadot/util@^10.2.4", "@polkadot/util@^10.4.2", "@polkadot/util@^9.4.1": version "10.4.2" resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-10.4.2.tgz#df41805cb27f46b2b4dad24c371fa2a68761baa1" integrity sha512-0r5MGICYiaCdWnx+7Axlpvzisy/bi1wZGXgCSw5+ZTyPTOqvsYRqM2X879yxvMsGfibxzWqNzaiVjToz1jvUaA== @@ -4269,60 +3651,6 @@ "@types/bn.js" "^5.1.1" bn.js "^5.2.1" -"@polkadot/util@6.11.1", "@polkadot/util@^6.11.1": - version "6.11.1" - resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-6.11.1.tgz#8950b038ba3e6ebfc0a7ff47feeb972e81b2626c" - integrity sha512-TEdCetr9rsdUfJZqQgX/vxLuV4XU8KMoKBMJdx+JuQ5EWemIdQkEtMBdL8k8udNGbgSNiYFA6rPppATeIxAScg== - dependencies: - "@babel/runtime" "^7.14.6" - "@polkadot/x-textdecoder" "6.11.1" - "@polkadot/x-textencoder" "6.11.1" - "@types/bn.js" "^4.11.6" - bn.js "^4.11.9" - camelcase "^5.3.1" - ip-regex "^4.3.0" - -"@polkadot/util@7.9.2": - version "7.9.2" - resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-7.9.2.tgz#567ac659516d6b685ed7e796919901d92e5cbe6b" - integrity sha512-6ABY6ErgkCsM4C6+X+AJSY4pBGwbKlHZmUtHftaiTvbaj4XuA4nTo3GU28jw8wY0Jh2cJZJvt6/BJ5GVkm5tBA== - dependencies: - "@babel/runtime" "^7.16.3" - "@polkadot/x-textdecoder" "7.9.2" - "@polkadot/x-textencoder" "7.9.2" - "@types/bn.js" "^4.11.6" - bn.js "^4.12.0" - camelcase "^6.2.1" - ip-regex "^4.3.0" - -"@polkadot/util@8.7.1", "@polkadot/util@^8.1.2", "@polkadot/util@^8.7.1": - version "8.7.1" - resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-8.7.1.tgz#27fe93bf7b8345276f10cfe9c0380510cd4584f6" - integrity sha512-XjY1bTo7V6OvOCe4yn8H2vifeuBciCy0gq0k5P1tlGUQLI/Yt0hvDmxcA0FEPtqg8CL+rYRG7WXGPVNjkrNvyQ== - dependencies: - "@babel/runtime" "^7.17.8" - "@polkadot/x-bigint" "8.7.1" - "@polkadot/x-global" "8.7.1" - "@polkadot/x-textdecoder" "8.7.1" - "@polkadot/x-textencoder" "8.7.1" - "@types/bn.js" "^5.1.0" - bn.js "^5.2.0" - ip-regex "^4.3.0" - -"@polkadot/util@9.7.2", "@polkadot/util@^9.4.1": - version "9.7.2" - resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-9.7.2.tgz#0f97fa92b273e6ce4b53fe869a957ac99342007d" - integrity sha512-ivTmA+KkPCq5i3O0Gk+dTds/hwdwlYCh89aKfeaG9ni3XHUbbuBgTqHneo648HqxwAwSAyiDiwE9EdXrzAdO4Q== - dependencies: - "@babel/runtime" "^7.18.6" - "@polkadot/x-bigint" "9.7.2" - "@polkadot/x-global" "9.7.2" - "@polkadot/x-textdecoder" "9.7.2" - "@polkadot/x-textencoder" "9.7.2" - "@types/bn.js" "^5.1.0" - bn.js "^5.2.1" - ip-regex "^4.3.0" - "@polkadot/wasm-bridge@6.4.1": version "6.4.1" resolved "https://registry.yarnpkg.com/@polkadot/wasm-bridge/-/wasm-bridge-6.4.1.tgz#e97915dd67ba543ec3381299c2a5b9330686e27e" @@ -4337,20 +3665,6 @@ dependencies: "@babel/runtime" "^7.20.6" -"@polkadot/wasm-crypto-asmjs@^4.6.1": - version "4.6.1" - resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-asmjs/-/wasm-crypto-asmjs-4.6.1.tgz#4f4a5adcf8dce65666eaa0fb16b6ff7b0243aead" - integrity sha512-1oHQjz2oEO1kCIcQniOP+dZ9N2YXf2yCLHLsKaKSvfXiWaetVCaBNB8oIHIVYvuLnVc8qlMi66O6xc1UublHsw== - dependencies: - "@babel/runtime" "^7.17.2" - -"@polkadot/wasm-crypto-asmjs@^5.1.1": - version "5.1.1" - resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-asmjs/-/wasm-crypto-asmjs-5.1.1.tgz#6648e9c6f627501f61aef570e110022f2be1eff2" - integrity sha512-1WBwc2G3pZMKW1T01uXzKE30Sg22MXmF3RbbZiWWk3H2d/Er4jZQRpjumxO5YGWan+xOb7HQQdwnrUnrPgbDhg== - dependencies: - "@babel/runtime" "^7.17.8" - "@polkadot/wasm-crypto-init@6.4.1": version "6.4.1" resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-init/-/wasm-crypto-init-6.4.1.tgz#4d9ab0030db52cf177bf707ef8e77aa4ca721668" @@ -4369,39 +3683,7 @@ "@babel/runtime" "^7.20.6" "@polkadot/wasm-util" "6.4.1" -"@polkadot/wasm-crypto-wasm@^4.6.1": - version "4.6.1" - resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-wasm/-/wasm-crypto-wasm-4.6.1.tgz#882d8199e216966c612f56a18e31f6aaae77e7eb" - integrity sha512-NI3JVwmLjrSYpSVuhu0yeQYSlsZrdpK41UC48sY3kyxXC71pi6OVePbtHS1K3xh3FFmDd9srSchExi3IwzKzMw== - dependencies: - "@babel/runtime" "^7.17.2" - -"@polkadot/wasm-crypto-wasm@^5.1.1": - version "5.1.1" - resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-wasm/-/wasm-crypto-wasm-5.1.1.tgz#dc371755a05fe93f87a2754a2bcf1ff42e4bb541" - integrity sha512-F9PZ30J2S8vUNl2oY7Myow5Xsx5z5uNVpnNlJwlmY8IXBvyucvyQ4HSdhJsrbs4W1BfFc0mHghxgp0FbBCnf/Q== - dependencies: - "@babel/runtime" "^7.17.8" - -"@polkadot/wasm-crypto@^4.0.2", "@polkadot/wasm-crypto@^4.4.1": - version "4.6.1" - resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto/-/wasm-crypto-4.6.1.tgz#12f8481e6f9021928435168beb0697d57ff573e9" - integrity sha512-2wEftBDxDG+TN8Ah6ogtvzjdZdcF0mAjU4UNNOfpmkBCxQYZOrAHB8HXhzo3noSsKkLX7PDX57NxvJ9OhoTAjw== - dependencies: - "@babel/runtime" "^7.17.2" - "@polkadot/wasm-crypto-asmjs" "^4.6.1" - "@polkadot/wasm-crypto-wasm" "^4.6.1" - -"@polkadot/wasm-crypto@^5.1.1": - version "5.1.1" - resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto/-/wasm-crypto-5.1.1.tgz#d1f8a0da631028ba904c374c1e8496ab3ba4636b" - integrity sha512-JCcAVfH8DhYuEyd4oX1ouByxhou0TvpErKn8kHjtzt7+tRoFi0nzWlmK4z49vszsV3JJgXxV81i10C0BYlwTcQ== - dependencies: - "@babel/runtime" "^7.17.8" - "@polkadot/wasm-crypto-asmjs" "^5.1.1" - "@polkadot/wasm-crypto-wasm" "^5.1.1" - -"@polkadot/wasm-crypto@^6.2.2", "@polkadot/wasm-crypto@^6.4.1": +"@polkadot/wasm-crypto@^6.4.1": version "6.4.1" resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto/-/wasm-crypto-6.4.1.tgz#79310e23ad1ca62362ba893db6a8567154c2536a" integrity sha512-FH+dcDPdhSLJvwL0pMLtn/LIPd62QDPODZRCmDyw+pFjLOMaRBc7raomWUOqyRWJTnqVf/iscc2rLVLNMyt7ag== @@ -4420,7 +3702,7 @@ dependencies: "@babel/runtime" "^7.20.6" -"@polkadot/x-bigint@10.4.2", "@polkadot/x-bigint@^10.1.1", "@polkadot/x-bigint@^10.1.13", "@polkadot/x-bigint@^10.4.2": +"@polkadot/x-bigint@10.4.2", "@polkadot/x-bigint@^10.4.2": version "10.4.2" resolved "https://registry.yarnpkg.com/@polkadot/x-bigint/-/x-bigint-10.4.2.tgz#7eb2ec732259df48b5a00f07879a1331e05606ec" integrity sha512-awRiox+/XSReLzimAU94fPldowiwnnMUkQJe8AebYhNocAj6SJU00GNoj6j6tAho6yleOwrTJXZaWFBaQVJQNg== @@ -4428,23 +3710,7 @@ "@babel/runtime" "^7.20.13" "@polkadot/x-global" "10.4.2" -"@polkadot/x-bigint@8.7.1": - version "8.7.1" - resolved "https://registry.yarnpkg.com/@polkadot/x-bigint/-/x-bigint-8.7.1.tgz#a496225def32e98c430c76b91c1579f48acf501a" - integrity sha512-ClkhgdB/KqcAKk3zA6Qw8wBL6Wz67pYTPkrAtImpvoPJmR+l4RARauv+MH34JXMUNlNb3aUwqN6lq2Z1zN+mJg== - dependencies: - "@babel/runtime" "^7.17.8" - "@polkadot/x-global" "8.7.1" - -"@polkadot/x-bigint@9.7.2": - version "9.7.2" - resolved "https://registry.yarnpkg.com/@polkadot/x-bigint/-/x-bigint-9.7.2.tgz#ec79977335dce173a81e45247bdfd46f3b301702" - integrity sha512-qi8/DTGypFSt5vvNOsYcEaqH72lymfyidGlsHlZ6e7nNASnEhk/NaOcINiTr1ds+fpu4dtKXWAIPZufujf2JeQ== - dependencies: - "@babel/runtime" "^7.18.6" - "@polkadot/x-global" "9.7.2" - -"@polkadot/x-fetch@^10.1.1", "@polkadot/x-fetch@^10.1.11", "@polkadot/x-fetch@^10.1.13", "@polkadot/x-fetch@^10.4.2": +"@polkadot/x-fetch@^10.1.11", "@polkadot/x-fetch@^10.4.2": version "10.4.2" resolved "https://registry.yarnpkg.com/@polkadot/x-fetch/-/x-fetch-10.4.2.tgz#bc6ba70de71a252472fbe36180511ed920e05f05" integrity sha512-Ubb64yaM4qwhogNP+4mZ3ibRghEg5UuCYRMNaCFoPgNAY8tQXuDKrHzeks3+frlmeH9YRd89o8wXLtWouwZIcw== @@ -4454,45 +3720,14 @@ "@types/node-fetch" "^2.6.2" node-fetch "^3.3.0" -"@polkadot/x-fetch@^8.7.1": - version "8.7.1" - resolved "https://registry.yarnpkg.com/@polkadot/x-fetch/-/x-fetch-8.7.1.tgz#dc866e7aa87c39b2e64c87f734b8fbaf1b9190e1" - integrity sha512-ygNparcalYFGbspXtdtZOHvNXZBkNgmNO+um9C0JYq74K5OY9/be93uyfJKJ8JcRJtOqBfVDsJpbiRkuJ1PRfg== - dependencies: - "@babel/runtime" "^7.17.8" - "@polkadot/x-global" "8.7.1" - "@types/node-fetch" "^2.6.1" - node-fetch "^2.6.7" - -"@polkadot/x-global@10.4.2", "@polkadot/x-global@^10.1.1", "@polkadot/x-global@^10.1.13", "@polkadot/x-global@^10.4.2": +"@polkadot/x-global@10.4.2", "@polkadot/x-global@^10.4.2": version "10.4.2" resolved "https://registry.yarnpkg.com/@polkadot/x-global/-/x-global-10.4.2.tgz#5662366e3deda0b4c8f024b2d902fa838f9e60a4" integrity sha512-g6GXHD/ykZvHap3M6wh19dO70Zm43l4jEhlxf5LtTo5/0/UporFCXr2YJYZqfbn9JbQwl1AU+NroYio+vtJdiA== dependencies: "@babel/runtime" "^7.20.13" -"@polkadot/x-global@6.11.1": - version "6.11.1" - resolved "https://registry.yarnpkg.com/@polkadot/x-global/-/x-global-6.11.1.tgz#c292b3825fea60e9b33fff1790323fc57de1ca5d" - integrity sha512-lsBK/e4KbjfieyRmnPs7bTiGbP/6EoCZz7rqD/voNS5qsJAaXgB9LR+ilubun9gK/TDpebyxgO+J19OBiQPIRw== - dependencies: - "@babel/runtime" "^7.14.6" - -"@polkadot/x-global@7.9.2": - version "7.9.2" - resolved "https://registry.yarnpkg.com/@polkadot/x-global/-/x-global-7.9.2.tgz#b272b0a3bedaad3bcbf075ec4682abe68cf2a850" - integrity sha512-JX5CrGWckHf1P9xKXq4vQCAuMUbL81l2hOWX7xeP8nv4caHEpmf5T1wD1iMdQBL5PFifo6Pg0V6/oZBB+bts7A== - dependencies: - "@babel/runtime" "^7.16.3" - -"@polkadot/x-global@8.7.1", "@polkadot/x-global@^8.7.1": - version "8.7.1" - resolved "https://registry.yarnpkg.com/@polkadot/x-global/-/x-global-8.7.1.tgz#b972044125a4fe059f4aef7c15a4e22d18179095" - integrity sha512-WOgUor16IihgNVdiTVGAWksYLUAlqjmODmIK1cuWrLOZtV1VBomWcb3obkO9sh5P6iWziAvCB/i+L0vnTN9ZCA== - dependencies: - "@babel/runtime" "^7.17.8" - -"@polkadot/x-global@9.7.2", "@polkadot/x-global@^9.4.1": +"@polkadot/x-global@^9.4.1": version "9.7.2" resolved "https://registry.yarnpkg.com/@polkadot/x-global/-/x-global-9.7.2.tgz#9847fd1da13989f321ca621e85477ba70fd8d55a" integrity sha512-3NN5JhjosaelaFWBJSlv9mb/gDAlt7RuZ8NKlOjB+LQHd9g6ZbnYi5wwjW+i/x/3E4IVbBx66uvWgNaw7IBrkg== @@ -4507,46 +3742,6 @@ "@babel/runtime" "^7.20.13" "@polkadot/x-global" "10.4.2" -"@polkadot/x-randomvalues@6.11.1": - version "6.11.1" - resolved "https://registry.yarnpkg.com/@polkadot/x-randomvalues/-/x-randomvalues-6.11.1.tgz#f006fa250c8e82c92ccb769976a45a8e7f3df28b" - integrity sha512-2MfUfGZSOkuPt7GF5OJkPDbl4yORI64SUuKM25EGrJ22o1UyoBnPOClm9eYujLMD6BfDZRM/7bQqqoLW+NuHVw== - dependencies: - "@babel/runtime" "^7.14.6" - "@polkadot/x-global" "6.11.1" - -"@polkadot/x-randomvalues@7.9.2": - version "7.9.2" - resolved "https://registry.yarnpkg.com/@polkadot/x-randomvalues/-/x-randomvalues-7.9.2.tgz#0c9bb7b48a0791c2a32e9605a31a5ce56fee621d" - integrity sha512-svQfG31yCXf6yVyIgP0NgCzEy7oc3Lw054ZspkaqjOivxYdrXaf5w3JSSUyM/MRjI2+nk+B/EyJoMYcfSwTfsQ== - dependencies: - "@babel/runtime" "^7.16.3" - "@polkadot/x-global" "7.9.2" - -"@polkadot/x-randomvalues@8.7.1": - version "8.7.1" - resolved "https://registry.yarnpkg.com/@polkadot/x-randomvalues/-/x-randomvalues-8.7.1.tgz#b7cc358c2a6d20f7e7798d45d1d5c7ac8c9ab4f2" - integrity sha512-njt17MlfN6yNyNEti7fL12lr5qM6A1aSGkWKVuqzc7XwSBesifJuW4km5u6r2gwhXjH2eHDv9SoQ7WXu8vrrkg== - dependencies: - "@babel/runtime" "^7.17.8" - "@polkadot/x-global" "8.7.1" - -"@polkadot/x-randomvalues@9.7.2": - version "9.7.2" - resolved "https://registry.yarnpkg.com/@polkadot/x-randomvalues/-/x-randomvalues-9.7.2.tgz#d580b0e9149ea22b2afebba5d7b1368371f7086d" - integrity sha512-819slnXNpoVtqdhjI19ao7w5m+Zwx11VfwCZkFQypVv3b/1UEoKG/baJA9dVI6yMvhnBN//i8mLgNy3IXWbVVw== - dependencies: - "@babel/runtime" "^7.18.6" - "@polkadot/x-global" "9.7.2" - -"@polkadot/x-rxjs@^6.11.1": - version "6.11.1" - resolved "https://registry.yarnpkg.com/@polkadot/x-rxjs/-/x-rxjs-6.11.1.tgz#5454708b61da70eea05708611d9148fce9372498" - integrity sha512-zIciEmij7SUuXXg9g/683Irx6GogxivrQS2pgBir2DI/YZq+um52+Dqg1mqsEZt74N4KMTMnzAZAP6LJOBOMww== - dependencies: - "@babel/runtime" "^7.14.6" - rxjs "^6.6.7" - "@polkadot/x-textdecoder@10.4.2": version "10.4.2" resolved "https://registry.yarnpkg.com/@polkadot/x-textdecoder/-/x-textdecoder-10.4.2.tgz#93202f3e5ad0e7f75a3fa02d2b8a3343091b341b" @@ -4555,38 +3750,6 @@ "@babel/runtime" "^7.20.13" "@polkadot/x-global" "10.4.2" -"@polkadot/x-textdecoder@6.11.1": - version "6.11.1" - resolved "https://registry.yarnpkg.com/@polkadot/x-textdecoder/-/x-textdecoder-6.11.1.tgz#6cc314645681cc4639085c03b65328671c7f182c" - integrity sha512-DI1Ym2lyDSS/UhnTT2e9WutukevFZ0WGpzj4eotuG2BTHN3e21uYtYTt24SlyRNMrWJf5+TkZItmZeqs1nwAfQ== - dependencies: - "@babel/runtime" "^7.14.6" - "@polkadot/x-global" "6.11.1" - -"@polkadot/x-textdecoder@7.9.2": - version "7.9.2" - resolved "https://registry.yarnpkg.com/@polkadot/x-textdecoder/-/x-textdecoder-7.9.2.tgz#a78548e33efeb3a25f761fec9787b2bcae7f0608" - integrity sha512-wfwbSHXPhrOAl12QvlIOGNkMH/N/h8PId2ytIjvM/8zPPFB5Il6DWSFLtVapOGEpIFjEWbd5t8Td4pHBVXIEbg== - dependencies: - "@babel/runtime" "^7.16.3" - "@polkadot/x-global" "7.9.2" - -"@polkadot/x-textdecoder@8.7.1": - version "8.7.1" - resolved "https://registry.yarnpkg.com/@polkadot/x-textdecoder/-/x-textdecoder-8.7.1.tgz#b706ef98d5a033d02c633009fb8dab4a4f9d7d55" - integrity sha512-ia0Ie2zi4VdQdNVD2GE2FZzBMfX//hEL4w546RMJfZM2LqDS674LofHmcyrsv5zscLnnRyCxZC1+J2dt+6MDIA== - dependencies: - "@babel/runtime" "^7.17.8" - "@polkadot/x-global" "8.7.1" - -"@polkadot/x-textdecoder@9.7.2": - version "9.7.2" - resolved "https://registry.yarnpkg.com/@polkadot/x-textdecoder/-/x-textdecoder-9.7.2.tgz#c94ea6c8f510fdf579659248ede9421854e32b42" - integrity sha512-hhrMNZwJBmusdpqjDRpOHZoMB4hpyJt9Gu9Bi9is7/D/vq/hpxq8z7s6NxrbRyXJf1SIk6NMK0jf5XjRLdKdbw== - dependencies: - "@babel/runtime" "^7.18.6" - "@polkadot/x-global" "9.7.2" - "@polkadot/x-textencoder@10.4.2": version "10.4.2" resolved "https://registry.yarnpkg.com/@polkadot/x-textencoder/-/x-textencoder-10.4.2.tgz#cd2e6c8a66b0b400a73f0164e99c510fb5c83501" @@ -4595,39 +3758,7 @@ "@babel/runtime" "^7.20.13" "@polkadot/x-global" "10.4.2" -"@polkadot/x-textencoder@6.11.1": - version "6.11.1" - resolved "https://registry.yarnpkg.com/@polkadot/x-textencoder/-/x-textencoder-6.11.1.tgz#73e89da5b91954ae380042c19314c90472f59d9e" - integrity sha512-8ipjWdEuqFo+R4Nxsc3/WW9CSEiprX4XU91a37ZyRVC4e9R1bmvClrpXmRQLVcAQyhRvG8DKOOtWbz8xM+oXKg== - dependencies: - "@babel/runtime" "^7.14.6" - "@polkadot/x-global" "6.11.1" - -"@polkadot/x-textencoder@7.9.2": - version "7.9.2" - resolved "https://registry.yarnpkg.com/@polkadot/x-textencoder/-/x-textencoder-7.9.2.tgz#b32bfd6fbff8587c56452f58252a52d62bbcd5b9" - integrity sha512-A19wwYINuZwU2dUyQ/mMzB0ISjyfc4cISfL4zCMUAVgj7xVoXMYV2GfjNdMpA8Wsjch3su6pxLbtJ2wU03sRTQ== - dependencies: - "@babel/runtime" "^7.16.3" - "@polkadot/x-global" "7.9.2" - -"@polkadot/x-textencoder@8.7.1": - version "8.7.1" - resolved "https://registry.yarnpkg.com/@polkadot/x-textencoder/-/x-textencoder-8.7.1.tgz#7820e30081e8e0a607c1c27b9e3486d82d1a723e" - integrity sha512-XDO0A27Xy+eJCKSxENroB8Dcnl+UclGG4ZBei+P/BqZ9rsjskUyd2Vsl6peMXAcsxwOE7g0uTvujoGM8jpKOXw== - dependencies: - "@babel/runtime" "^7.17.8" - "@polkadot/x-global" "8.7.1" - -"@polkadot/x-textencoder@9.7.2": - version "9.7.2" - resolved "https://registry.yarnpkg.com/@polkadot/x-textencoder/-/x-textencoder-9.7.2.tgz#2ae29fa5ca2c0353e7a1913eef710b2d45bdf0b2" - integrity sha512-GHbSdbMPixDAOnJ9cvL/x9sPNeHegPoDSqCAzY5H6/zHc/fNn0vUu0To9VpPgPhp/Jb9dbc0h8YqEyvOcOlphw== - dependencies: - "@babel/runtime" "^7.18.6" - "@polkadot/x-global" "9.7.2" - -"@polkadot/x-ws@^10.1.1", "@polkadot/x-ws@^10.1.13", "@polkadot/x-ws@^10.4.2": +"@polkadot/x-ws@^10.4.2": version "10.4.2" resolved "https://registry.yarnpkg.com/@polkadot/x-ws/-/x-ws-10.4.2.tgz#4e9d88f37717570ccf942c6f4f63b06260f45025" integrity sha512-3gHSTXAWQu1EMcMVTF5QDKHhEHzKxhAArweEyDXE7VsgKUP/ixxw4hVZBrkX122iI5l5mjSiooRSnp/Zl3xqDQ== @@ -4637,16 +3768,6 @@ "@types/websocket" "^1.0.5" websocket "^1.0.34" -"@polkadot/x-ws@^8.7.1": - version "8.7.1" - resolved "https://registry.yarnpkg.com/@polkadot/x-ws/-/x-ws-8.7.1.tgz#501c63c575e04bba68bdc32448e2c9b692f0411e" - integrity sha512-Mt0tcNzGXyKnN3DQ06alkv+JLtTfXWu6zSypFrrKHSQe3u79xMQ1nSicmpT3gWLhIa8YF+8CYJXMrqaXgCnDhw== - dependencies: - "@babel/runtime" "^7.17.8" - "@polkadot/x-global" "8.7.1" - "@types/websocket" "^1.0.5" - websocket "^1.0.34" - "@polymathnetwork/polymesh-types@0.0.2": version "0.0.2" resolved "https://registry.yarnpkg.com/@polymathnetwork/polymesh-types/-/polymesh-types-0.0.2.tgz#a9f07bc9e1e659e59afa7a5409b2d91301b5fef9" @@ -5724,11 +4845,6 @@ estree-walker "^1.0.1" picomatch "^2.2.2" -"@scure/base@1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.0.0.tgz#109fb595021de285f05a7db6806f2f48296fcee7" - integrity sha512-gIVaYhUsy+9s58m/ETjSJVKHhKTBMmcRb9cEV5/5dwvfDlfORjKrFsDeDHWRrm6RjcPvCLZFwGJjAjLj1gg4HA== - "@scure/base@1.1.1": version "1.1.1" resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.1.tgz#ebb651ee52ff84f420097055f4bf46cfba403938" @@ -6746,29 +5862,11 @@ "@polkadot/api" latest lodash.camelcase "^4.3.0" -"@substrate/connect-extension-protocol@^1.0.0", "@substrate/connect-extension-protocol@^1.0.1": +"@substrate/connect-extension-protocol@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@substrate/connect-extension-protocol/-/connect-extension-protocol-1.0.1.tgz#fa5738039586c648013caa6a0c95c43265dbe77d" integrity sha512-161JhCC1csjH3GE5mPLEd7HbWtwNSPJBg3p1Ksz9SFlTzj/bgEwudiRN2y5i0MoLGCIJRYKyKGMxVnd29PzNjg== -"@substrate/connect@0.7.0-alpha.0": - version "0.7.0-alpha.0" - resolved "https://registry.yarnpkg.com/@substrate/connect/-/connect-0.7.0-alpha.0.tgz#df605f4e808b58d146ad0272a79b2c4b870459a5" - integrity sha512-fvO7w++M8R95R/pGJFW9+cWOt8OYnnTfgswxtlPqSgzqX4tta8xcNQ51crC72FcL5agwSGkA1gc2/+eyTj7O8A== - dependencies: - "@substrate/connect-extension-protocol" "^1.0.0" - "@substrate/smoldot-light" "0.6.8" - eventemitter3 "^4.0.7" - -"@substrate/connect@0.7.17": - version "0.7.17" - resolved "https://registry.yarnpkg.com/@substrate/connect/-/connect-0.7.17.tgz#b76ce23d24255e89028db81b3cb280c7f86db72e" - integrity sha512-s0XBmGpUCFWZFa+TS0TEvOKtWjJP2uT4xKmvzApH8INB5xbz79wqWFX6WWh3AlK/X1P0Smt+RVEH7HQiLJAYAw== - dependencies: - "@substrate/connect-extension-protocol" "^1.0.1" - "@substrate/smoldot-light" "0.7.7" - eventemitter3 "^4.0.7" - "@substrate/connect@0.7.19": version "0.7.19" resolved "https://registry.yarnpkg.com/@substrate/connect/-/connect-0.7.19.tgz#7c879cb275bc7ac2fe9edbf797572d4ff8d8b86a" @@ -6778,39 +5876,6 @@ "@substrate/smoldot-light" "0.7.9" eventemitter3 "^4.0.7" -"@substrate/connect@0.7.9": - version "0.7.9" - resolved "https://registry.yarnpkg.com/@substrate/connect/-/connect-0.7.9.tgz#0bb65fef28c70051e6158e10f633005e899fbb5b" - integrity sha512-E6bdBhzsfHNAKlmQSvbTW1jyb0WcIvgbrEBfJ4B6FZ3t1wpGjldL6GrYtegVtKr9/ySQ/pFNn0uVbugukpMDjQ== - dependencies: - "@substrate/connect-extension-protocol" "^1.0.1" - "@substrate/smoldot-light" "0.6.25" - eventemitter3 "^4.0.7" - -"@substrate/smoldot-light@0.6.25": - version "0.6.25" - resolved "https://registry.yarnpkg.com/@substrate/smoldot-light/-/smoldot-light-0.6.25.tgz#3025ba5134b1be470855f901ffeb028a0f93460c" - integrity sha512-OQ9/bnJJy90xSRg5Vp9MIvrgbrVt/r/FwXYSmyLeBBNbJt6o1gSeshVo8icD+2VWwd/TJ2oHl5CVQWe89MyByA== - dependencies: - websocket "^1.0.32" - -"@substrate/smoldot-light@0.6.8": - version "0.6.8" - resolved "https://registry.yarnpkg.com/@substrate/smoldot-light/-/smoldot-light-0.6.8.tgz#e626e25cd2386824f1164e7d7dda7258580c36e4" - integrity sha512-9lVwbG6wrtss0sd6013BJGe4WN4taujsGG49pwyt1Lj36USeL2Sb164TTUxmZF/g2NQEqDPwPROBdekQ2gFmgg== - dependencies: - buffer "^6.0.1" - pako "^2.0.4" - websocket "^1.0.32" - -"@substrate/smoldot-light@0.7.7": - version "0.7.7" - resolved "https://registry.yarnpkg.com/@substrate/smoldot-light/-/smoldot-light-0.7.7.tgz#ee5f89bb25af64d2014d97548b959b7da4c67f08" - integrity sha512-ksxeAed6dIUtYSl0f8ehgWQjwXnpDGTIJt+WVRIGt3OObZkA96ZdBWx0xP7GrXZtj37u4n/Y1z7TyTm4bwQvrw== - dependencies: - pako "^2.0.4" - ws "^8.8.1" - "@substrate/smoldot-light@0.7.9": version "0.7.9" resolved "https://registry.yarnpkg.com/@substrate/smoldot-light/-/smoldot-light-0.7.9.tgz#68449873a25558e547e9468289686ee228a9930f" @@ -6819,7 +5884,7 @@ pako "^2.0.4" ws "^8.8.1" -"@substrate/ss58-registry@^1.17.0", "@substrate/ss58-registry@^1.23.0", "@substrate/ss58-registry@^1.38.0": +"@substrate/ss58-registry@^1.38.0": version "1.39.0" resolved "https://registry.yarnpkg.com/@substrate/ss58-registry/-/ss58-registry-1.39.0.tgz#eb916ff5fea7fa02e77745823fde21af979273d2" integrity sha512-qZYpuE6n+mwew+X71dOur/CbMXj6rNW27o63JeJwdQH/GvcSKm3JLNhd+bGzwUKg0D/zD30Qc6p4JykArzM+tA== @@ -7110,14 +6175,7 @@ resolved "https://registry.yarnpkg.com/@types/big.js/-/big.js-6.1.2.tgz#68a952b629a6aaa2b5855a2f63363d1e77f6dd91" integrity sha512-h24JIZ52rvSvi2jkpYDk2yLH99VzZoCJiSfDWwjst7TwJVuXN61XVCUlPCzRl7mxKEMsGf8z42Q+J4TZwU3z2w== -"@types/bn.js@^4.11.6": - version "4.11.6" - resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-4.11.6.tgz#c306c70d9358aaea33cd4eda092a742b9505967c" - integrity sha512-pqr857jrp2kPuO9uRjZ3PwnJTjoQy+fcdxvBTvHm6dkmEL9q+hDD/2j/0ELOBPtPnS8LjCX0gI9nbl8lVkadpg== - dependencies: - "@types/node" "*" - -"@types/bn.js@^5.1.0", "@types/bn.js@^5.1.1": +"@types/bn.js@^5.1.1": version "5.1.1" resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-5.1.1.tgz#b51e1b55920a4ca26e9285ff79936bbdec910682" integrity sha512-qNrYbZqMx0uJAfKnKclPh+dTwK33KfLHYqtyODwd5HnXOjnkhc4qgn3BrK6RWyGZm5+sIFE7Q7Vz6QQtJB7w7g== @@ -7310,7 +6368,7 @@ "@types/node" "*" form-data "^3.0.0" -"@types/node-fetch@^2.6.1", "@types/node-fetch@^2.6.2": +"@types/node-fetch@^2.6.2": version "2.6.2" resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.2.tgz#d1a9c5fd049d9415dce61571557104dec3ec81da" integrity sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A== @@ -8903,14 +7961,14 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== -base-x@^3.0.2, base-x@^3.0.8: +base-x@^3.0.2: version "3.0.9" resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.9.tgz#6349aaabb58526332de9f60995e548a53fe21320" integrity sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ== dependencies: safe-buffer "^5.0.1" -base64-js@^1.0.2, base64-js@^1.3.1, base64-js@^1.5.1: +base64-js@^1.0.2, base64-js@^1.3.1: version "1.5.1" resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== @@ -9082,17 +8140,12 @@ bl@^5.0.0: inherits "^2.0.4" readable-stream "^3.4.0" -blakejs@^1.1.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/blakejs/-/blakejs-1.2.1.tgz#5057e4206eadb4a97f7c0b6e197a505042fc3814" - integrity sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ== - bluebird@^3.3.5, bluebird@^3.5.5: version "3.7.2" resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== -bn.js@4.12.0, bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.11.8, bn.js@^4.11.9, bn.js@^4.12.0, bn.js@^5.0.0, bn.js@^5.1.1, bn.js@^5.2.0, bn.js@^5.2.1, bn.js@~5.2.0: +bn.js@4.12.0, bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.11.8, bn.js@^4.11.9, bn.js@^5.0.0, bn.js@^5.1.1, bn.js@^5.2.1, bn.js@~5.2.0: version "4.12.0" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== @@ -9360,7 +8413,7 @@ buffer@^4.3.0: ieee754 "^1.1.4" isarray "^1.0.0" -buffer@^6.0.1, buffer@^6.0.3: +buffer@^6.0.3: version "6.0.3" resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6" integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA== @@ -9578,7 +8631,7 @@ camelcase@^2.0.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-2.1.1.tgz#7c1d16d679a1bbe59ca02cacecfb011e201f5a1f" integrity sha512-DLIsRzJVBQu72meAKPkWQOLcujdXT32hwdfnkI1frSiSRMK1MofjKHf+MEx0SB6fjEFXL8fBDv1dKymBlOp4Qw== -camelcase@^6.0.0, camelcase@^6.1.0, camelcase@^6.2.0, camelcase@^6.2.1: +camelcase@^6.0.0, camelcase@^6.1.0, camelcase@^6.2.0: version "6.3.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== @@ -10761,11 +9814,6 @@ csstype@^3.0.2, csstype@^3.0.6: resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.0.11.tgz#d66700c5eacfac1940deb4e3ee5642792d85cd33" integrity sha512-sa6P2wJ+CAbgyy4KFssIb/JNMLxFvKF1pCYCSXS8ZMuqZnMsrxqI2E5sPyoTpxoPU/gVZMzr2zjOfg8GIZOMsw== -cuint@^0.2.2: - version "0.2.2" - resolved "https://registry.yarnpkg.com/cuint/-/cuint-0.2.2.tgz#408086d409550c2631155619e9fa7bcadc3b991b" - integrity sha512-d4ZVpCW31eWwCMe1YT3ur7mUDnTXbgwyzaL320DrcRT45rfjYxkt5QWLrmOJ+/UEAI2+fQgKe/fCjR8l4TpRgw== - currently-unhandled@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/currently-unhandled/-/currently-unhandled-0.4.1.tgz#988df33feab191ef799a61369dd76c17adf957ea" @@ -11387,7 +10435,7 @@ electron-to-chromium@^1.4.118: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.138.tgz#3ec41ca589aaf505dfe2034fde913329af801730" integrity sha512-IOyp2Seq3w4QLln+yZWcMF3VXhhduz4bwg9gfI+CnP5TkzwNXQ8FCZuwwPsnes73AfWdf5J2n2OXdUwDUspDPQ== -elliptic@6.5.4, elliptic@^6.4.0, elliptic@^6.5.3, elliptic@^6.5.4: +elliptic@6.5.4, elliptic@^6.4.0, elliptic@^6.5.3: version "6.5.4" resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb" integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ== @@ -13354,7 +12402,7 @@ hash-base@^3.0.0: readable-stream "^3.6.0" safe-buffer "^5.2.0" -hash.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3, hash.js@^1.1.7: +hash.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3: version "1.1.7" resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== @@ -14014,11 +13062,6 @@ ip-regex@^2.1.0: resolved "https://registry.yarnpkg.com/ip-regex/-/ip-regex-2.1.0.tgz#fa78bf5d2e6913c911ce9f819ee5146bb6d844e9" integrity sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk= -ip-regex@^4.3.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/ip-regex/-/ip-regex-4.3.0.tgz#687275ab0f57fa76978ff8f4dddc8a23d5990db5" - integrity sha512-B9ZWJxHHOHUhUjCPrMpLD4xEq35bUTClHM1S6CBU5ixQnkZmwipwgc96vAd7AAGM9TGHvJR+Uss+/Ak6UphK+Q== - ip@^1.1.0, ip@^1.1.5: version "1.1.5" resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.5.tgz#bdded70114290828c0a039e72ef25f5aaec4354a" @@ -15190,7 +14233,7 @@ js-cookie@^2.2.1: resolved "https://registry.yarnpkg.com/js-cookie/-/js-cookie-2.2.1.tgz#69e106dc5d5806894562902aa5baec3744e9b2b8" integrity sha512-HvdH2LzI/EAZcUwA8+0nKNtWHqS+ZmijLA30RwZA0bo7ToCckjK5MkGhjED9KoRcXO6BaGI3I9UIzSA1FKFPOQ== -js-sha3@0.8.0, js-sha3@^0.8.0: +js-sha3@0.8.0: version "0.8.0" resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.8.0.tgz#b9b7a5da73afad7dedd0f8c463954cbde6818840" integrity sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q== @@ -16037,11 +15080,6 @@ methods@~1.1.2: resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" integrity sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4= -micro-base@^0.9.0: - version "0.9.0" - resolved "https://registry.yarnpkg.com/micro-base/-/micro-base-0.9.0.tgz#09cfe20285bec0ea97f41dc3d10e3fba3d0266ee" - integrity sha512-4+tOMKidYT5nQ6/UNmYrGVO5PMcnJdfuR4NC8HK8s2H61B4itOhA9yrsjBdqGV7ecdtej36x3YSIfPLRmPrspg== - microevent.ts@~0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/microevent.ts/-/microevent.ts-0.1.1.tgz#70b09b83f43df5172d0205a63025bce0f7357fa0" @@ -16289,7 +15327,7 @@ mobx@^5.15.7: resolved "https://registry.yarnpkg.com/mobx/-/mobx-5.15.7.tgz#b9a5f2b6251f5d96980d13c78e9b5d8d4ce22665" integrity sha512-wyM3FghTkhmC+hQjyPGGFdpehrcX1KOXsDuERhfK2YbJemkUhEB+6wzEN639T21onxlfYBmriA1PFnvxTUhcKw== -mock-socket@^9.1.2, mock-socket@^9.1.5, mock-socket@^9.2.1: +mock-socket@^9.2.1: version "9.2.1" resolved "https://registry.yarnpkg.com/mock-socket/-/mock-socket-9.2.1.tgz#cc9c0810aa4d0afe02d721dcb2b7e657c00e2282" integrity sha512-aw9F9T9G2zpGipLLhSNh6ZpgUyUl4frcVmRN08uE1NWPWg43Wx6+sGPDbQ7E5iFZZDJW5b5bypMeAEHqTbIFag== @@ -16491,7 +15529,7 @@ no-case@^3.0.4: lower-case "^2.0.2" tslib "^2.0.3" -nock@^13.2.4, nock@^13.2.9, nock@^13.3.0: +nock@^13.3.0: version "13.3.0" resolved "https://registry.yarnpkg.com/nock/-/nock-13.3.0.tgz#b13069c1a03f1ad63120f994b04bfd2556925768" integrity sha512-HHqYQ6mBeiMc+N038w8LkMpDCRquCHWeNmN3v6645P3NhN2+qXOBqvPqo7Rt1VyCMzKhJ733wZqw5B7cQVFNPg== @@ -19847,13 +18885,6 @@ run-queue@^1.0.0, run-queue@^1.0.3: dependencies: aproba "^1.1.1" -rxjs@^6.6.7: - version "6.6.7" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.7.tgz#90ac018acabf491bf65044235d5863c4dab804c9" - integrity sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ== - dependencies: - tslib "^1.9.0" - rxjs@^7.2.0, rxjs@^7.5.6, rxjs@^7.5.7: version "7.5.7" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.5.7.tgz#2ec0d57fdc89ece220d2e702730ae8f1e49def39" @@ -19861,13 +18892,6 @@ rxjs@^7.2.0, rxjs@^7.5.6, rxjs@^7.5.7: dependencies: tslib "^2.1.0" -rxjs@^7.4.0, rxjs@^7.5.5, rxjs@^7.8.0: - version "7.8.0" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.0.tgz#90a938862a82888ff4c7359811a595e14e1e09a4" - integrity sha512-F2+gxDshqmIub1KdvZkaEfGDwLNpPvk9Fs6LD/MyQxNgMds/WH9OdDDXOmxUZpME+iSK3rQCctkL0DYyytUqMg== - dependencies: - tslib "^2.1.0" - rxjs@^7.5.1: version "7.5.5" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.5.5.tgz#2ebad89af0f560f460ad5cc4213219e1f7dd4e9f" @@ -19875,6 +18899,13 @@ rxjs@^7.5.1: dependencies: tslib "^2.1.0" +rxjs@^7.8.0: + version "7.8.0" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.0.tgz#90a938862a82888ff4c7359811a595e14e1e09a4" + integrity sha512-F2+gxDshqmIub1KdvZkaEfGDwLNpPvk9Fs6LD/MyQxNgMds/WH9OdDDXOmxUZpME+iSK3rQCctkL0DYyytUqMg== + dependencies: + tslib "^2.1.0" + safe-buffer@5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" @@ -20004,11 +19035,6 @@ scrypt-js@3.0.1: resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-3.0.1.tgz#d314a57c2aef69d1ad98a138a21fe9eafa9ee312" integrity sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA== -scryptsy@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/scryptsy/-/scryptsy-2.1.0.tgz#8d1e8d0c025b58fdd25b6fa9a0dc905ee8faa790" - integrity sha512-1CdSqHQowJBnMAFyPEBRfqag/YP9OF394FV+4YREIJX4ljD7OxvQRDayyoyyCk+senRjSkP6VnUNQmVQqB6g7w== - select-hose@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/select-hose/-/select-hose-2.0.0.tgz#625d8658f865af43ec962bfc376a37359a4994ca" @@ -21501,7 +20527,7 @@ tslib@2.4.0: resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== -tslib@^1.10.0, tslib@^1.8.1, tslib@^1.9.0: +tslib@^1.10.0, tslib@^1.8.1: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== @@ -22492,7 +21518,7 @@ websocket-extensions@>=0.1.1: resolved "https://registry.yarnpkg.com/websocket-extensions/-/websocket-extensions-0.1.4.tgz#7f8473bc839dfd87608adb95d7eb075211578a42" integrity sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg== -websocket@^1.0.32, websocket@^1.0.34: +websocket@^1.0.34: version "1.0.34" resolved "https://registry.yarnpkg.com/websocket/-/websocket-1.0.34.tgz#2bdc2602c08bf2c82253b730655c0ef7dcab3111" integrity sha512-PRDso2sGwF6kM75QykIesBijKSVceR6jL2G8NGYyq2XrItNC2P5/qL5XeR056GhA+Ly7JMFvJb9I312mJfmqnQ== @@ -22904,13 +21930,6 @@ xtend@^4.0.0, xtend@^4.0.1, xtend@^4.0.2, xtend@~4.0.1: resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== -xxhashjs@^0.2.2: - version "0.2.2" - resolved "https://registry.yarnpkg.com/xxhashjs/-/xxhashjs-0.2.2.tgz#8a6251567621a1c46a5ae204da0249c7f8caa9d8" - integrity sha512-AkTuIuVTET12tpsVIQo+ZU6f/qDmKuRUcjaqR+OIvm+aCBsZ95i7UVY5WJ9TMsSaZ0DA2WxoZ4acu0sPH+OKAw== - dependencies: - cuint "^0.2.2" - y18n@^4.0.0: version "4.0.3" resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.3.tgz#b5f259c82cd6e336921efd7bfd8bf560de9eeedf" From b7e3540f9a77f1b22a3f0631f2464c3d6a61e002 Mon Sep 17 00:00:00 2001 From: Chanakya888 Date: Fri, 31 Mar 2023 13:04:05 +0530 Subject: [PATCH 02/21] Fix input field width issue (#1090) * fix: input field width * fix: rename max weeks to total weeks * chore: bump ui version --- package.json | 2 +- src/pages/Staking/LockTimeField/index.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index e1686ea0b0..41a9207291 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "interbtc-ui", - "version": "2.28.8", + "version": "2.28.9", "private": true, "dependencies": { "@craco/craco": "^6.1.1", diff --git a/src/pages/Staking/LockTimeField/index.tsx b/src/pages/Staking/LockTimeField/index.tsx index 983e3df038..1e55b5f43c 100644 --- a/src/pages/Staking/LockTimeField/index.tsx +++ b/src/pages/Staking/LockTimeField/index.tsx @@ -50,7 +50,7 @@ const LockTimeField = React.forwardRef( className={clsx('!text-xs', LABEL_TEXT_COLOR_CLASSES)} required={optional === false} > - Max {STAKE_LOCK_TIME.MAX} Weeks + Total {STAKE_LOCK_TIME.MAX} Weeks
{optional === true && ( @@ -65,7 +65,7 @@ const LockTimeField = React.forwardRef( Date: Mon, 3 Apr 2023 09:18:55 +0100 Subject: [PATCH 03/21] chore: bump XCM bridge (#1093) --- package.json | 2 +- src/utils/hooks/api/xcm/use-xcm-bridge.ts | 6 +- yarn.lock | 346 ++++++++++++---------- 3 files changed, 192 insertions(+), 162 deletions(-) diff --git a/package.json b/package.json index 41a9207291..c8eab474d9 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "@craco/craco": "^6.1.1", "@headlessui/react": "^1.1.1", "@heroicons/react": "^2.0.0", - "@interlay/bridge": "^0.2.3", + "@interlay/bridge": "^0.3.2", "@interlay/interbtc-api": "2.0.3", "@interlay/monetary-js": "0.7.2", "@polkadot/api": "9.14.2", diff --git a/src/utils/hooks/api/xcm/use-xcm-bridge.ts b/src/utils/hooks/api/xcm/use-xcm-bridge.ts index 390d10958f..3fc7d7c4bb 100644 --- a/src/utils/hooks/api/xcm/use-xcm-bridge.ts +++ b/src/utils/hooks/api/xcm/use-xcm-bridge.ts @@ -3,15 +3,11 @@ import { useEffect, useState } from 'react'; import { firstValueFrom } from 'rxjs'; import { XCM_ADAPTERS } from '@/config/relay-chains'; -import { BITCOIN_NETWORK } from '@/constants'; const XCMBridge = new Bridge({ adapters: Object.values(XCM_ADAPTERS) }); -// MEMO: BitcoinNetwork type is not available on XCM bridge -const XCMNetwork = BITCOIN_NETWORK === 'mainnet' ? 'mainnet' : 'testnet'; - // TODO: This config needs to be pushed higher up the app. // Not sure how this will look: something to decide when // adding USDT support. @@ -41,7 +37,7 @@ const useXCMBridge = (): { XCMProvider: ApiProvider; XCMBridge: Bridge } => { useEffect(() => { const createBridge = async () => { - const XCMProvider = new ApiProvider(XCMNetwork); + const XCMProvider = new ApiProvider(); const chains = Object.keys(XCM_ADAPTERS) as ChainName[]; // Check connection diff --git a/yarn.lock b/yarn.lock index a6278b49e8..d4e566a66b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,16 @@ # yarn lockfile v1 +"@acala-network/api-derive@4.1.8-13": + version "4.1.8-13" + resolved "https://registry.yarnpkg.com/@acala-network/api-derive/-/api-derive-4.1.8-13.tgz#0ac02da5494c9f6ea8d52235836ecb369dea443d" + integrity sha512-Bm7005fPvFMcohvlpbGJMpm0Vm/63PTkRcg0shZvcjuMak3YSR0NhceZRnMoHz+I0Ond5XGRjZVZA/eyRMbSsg== + dependencies: + "@acala-network/types" "4.1.8-13" + "@babel/runtime" "^7.10.2" + "@open-web3/orml-types" "^1.1.4" + "@polkadot/api-derive" "^8.5.1" + "@acala-network/api-derive@4.1.8-9": version "4.1.8-9" resolved "https://registry.yarnpkg.com/@acala-network/api-derive/-/api-derive-4.1.8-9.tgz#f4d3969665fe2e92d2fca73d2c403e4f26b519bd" @@ -12,7 +22,19 @@ "@open-web3/orml-types" "^1.1.4" "@polkadot/api-derive" "^8.5.1" -"@acala-network/api@4.1.8-9", "@acala-network/api@~4.1.8-9": +"@acala-network/api@4.1.8-13": + version "4.1.8-13" + resolved "https://registry.yarnpkg.com/@acala-network/api/-/api-4.1.8-13.tgz#8127edaba9802eaa6a20678e823f43f2affb6067" + integrity sha512-+m032NiYPAvbOHeaJrCKQuACe9hykNTpQpDKeKkg0RME9JnFKeR7TYLkWtInhbmql6b8LxAAdpy2gdQctrsCRA== + dependencies: + "@acala-network/api-derive" "4.1.8-13" + "@acala-network/types" "4.1.8-13" + "@babel/runtime" "^7.10.2" + "@open-web3/orml-api-derive" "^1.1.4" + "@polkadot/api" "^9.9.1" + "@polkadot/rpc-core" "^9.9.1" + +"@acala-network/api@~4.1.8-9": version "4.1.8-9" resolved "https://registry.yarnpkg.com/@acala-network/api/-/api-4.1.8-9.tgz#9213e09b7c43b3df95eaf47fe78c989ddfe4207e" integrity sha512-9kpYQYe5vBCKWlyABh+Q2sjONDdtNfdv0PL0Tek3bpt00a3VjNIZvQro5ZSwzdpGJs5YcsiWPRMBq3iMgJNtGQ== @@ -29,14 +51,14 @@ resolved "https://registry.yarnpkg.com/@acala-network/contracts/-/contracts-4.3.4.tgz#f37cf54894c72b762df539042a61f90b10b68600" integrity sha512-oBgXGUjRW+lRo9TWGtCB1+OpEOFfhxW//wReb7V/YdbEElVvYuKw3lmfly/eZ/mdBgqxA3eXxNW0AgXiyOn2NQ== -"@acala-network/eth-providers@^2.5.4": - version "2.5.9" - resolved "https://registry.yarnpkg.com/@acala-network/eth-providers/-/eth-providers-2.5.9.tgz#8cd6cb2932f5c270892a4e9c5e754d7c52e0b2a3" - integrity sha512-qYDRxr9XNTIsekuSju+oZPFiRj0Hhg7gkkBEhnn5AOYsj83zh4rgGHEtLef7D6Xk7Uf6+X+Ute7qtlw8XRj6hQ== +"@acala-network/eth-providers@^2.5.9": + version "2.6.5" + resolved "https://registry.yarnpkg.com/@acala-network/eth-providers/-/eth-providers-2.6.5.tgz#9087abe44a0686de5188ea962961519ecff20e66" + integrity sha512-Y0hi0LRN8pJ144dv9WcSi9nPn5Wez0h745EGa1/6NFtU7jsua0jg25WYJ53s17rXIMz8GUKdln9SAIeShQiEtw== dependencies: "@acala-network/api" "~4.1.8-9" "@acala-network/contracts" "~4.3.4" - "@acala-network/eth-transactions" "2.5.9" + "@acala-network/eth-transactions" "2.6.5" "@acala-network/types" "~4.1.8-9" "@ethersproject/abstract-provider" "~5.7.0" "@ethersproject/address" "~5.7.0" @@ -50,23 +72,23 @@ "@ethersproject/providers" "~5.7.0" "@ethersproject/transactions" "~5.7.0" "@ethersproject/wallet" "~5.7.0" - "@polkadot/api" "^9.9.1" - "@polkadot/api-augment" "9.9.1" - "@polkadot/api-derive" "^9.9.1" - "@polkadot/keyring" "^10.1.13" - "@polkadot/types" "^9.9.1" - "@polkadot/util" "^10.1.13" - "@polkadot/util-crypto" "^10.1.13" + "@polkadot/api" "9.10.3" + "@polkadot/api-augment" "9.10.3" + "@polkadot/api-derive" "9.10.3" + "@polkadot/keyring" "^10.2.1" + "@polkadot/types" "9.10.3" + "@polkadot/util" "^10.2.1" + "@polkadot/util-crypto" "^10.2.1" bn.js "~5.2.0" ethers "~5.7.0" graphql "~16.0.1" graphql-request "~3.6.1" lru-cache "~7.8.2" -"@acala-network/eth-transactions@2.5.9": - version "2.5.9" - resolved "https://registry.yarnpkg.com/@acala-network/eth-transactions/-/eth-transactions-2.5.9.tgz#5e8d7c0e1ef1e49290aabd08ae2161f3321bf564" - integrity sha512-Aev44uUwDuYLXDuLrPTl99W9TgJevKhFUuBUUmeb00Uwf4KWzHFbDbI/PD1GwgetCmOe+wv7IqYrHha+R627kQ== +"@acala-network/eth-transactions@2.6.5": + version "2.6.5" + resolved "https://registry.yarnpkg.com/@acala-network/eth-transactions/-/eth-transactions-2.6.5.tgz#ddc93a3cd766c89aa81acdcd4aa9d00854b2116d" + integrity sha512-r+1i3AWHpg+vWZbiTldDSztZAPh+lJl4d9NKh7DCRgEd5/yOXgK5D05j1tTISut3ckENHBE2m0MKDp/4xX+3Eg== dependencies: "@ethersproject/address" "~5.7.0" "@ethersproject/bignumber" "~5.7.0" @@ -77,12 +99,12 @@ "@ethersproject/rlp" "~5.7.0" "@ethersproject/transactions" "~5.7.0" "@ethersproject/wallet" "~5.7.0" - "@polkadot/util-crypto" "^9.0.1" + "@polkadot/util-crypto" "^10.2.1" -"@acala-network/sdk-core@4.1.8-9": - version "4.1.8-9" - resolved "https://registry.yarnpkg.com/@acala-network/sdk-core/-/sdk-core-4.1.8-9.tgz#47de650483f74aa9320d9ff9a8cdcf0e48b4a192" - integrity sha512-hjJ4Qs20aacg9vUnt2xZne3nN+c73zS7sBklVwtzXLlW87QWKDHdvkRkGZyeeKujaGRnqODhYIPtGtPqd0t+ag== +"@acala-network/sdk-core@4.1.8-13": + version "4.1.8-13" + resolved "https://registry.yarnpkg.com/@acala-network/sdk-core/-/sdk-core-4.1.8-13.tgz#ff69ef993f5a36caa31744384c389765ede7cc96" + integrity sha512-4q9lksLJ/8lXA/f/t9GHQqv8ePIT2vId7rkaoqE/jASq6ngRFg2heV/6eScCKudr2aJN68YX3Jf0hwH6eazVLQ== dependencies: "@polkadot/api" "^9.9.1" "@polkadot/types" "^9.9.1" @@ -91,14 +113,14 @@ events "^3.2.0" lodash "^4.17.20" -"@acala-network/sdk@4.1.8-9": - version "4.1.8-9" - resolved "https://registry.yarnpkg.com/@acala-network/sdk/-/sdk-4.1.8-9.tgz#3501296ec663346e2118dcfcc72e31afcdf63fbb" - integrity sha512-/e624PRyzwUJUEW4g7y4kVjs4WsDU2S6KPvn2Nbojl0bz0wrm05ghjD3lW98m8CcLLLv4wa4hldegFzx79LYgw== +"@acala-network/sdk@4.1.8-13": + version "4.1.8-13" + resolved "https://registry.yarnpkg.com/@acala-network/sdk/-/sdk-4.1.8-13.tgz#f603a6c84c4654971495676345f4a24041ff1c02" + integrity sha512-3apYrmQ+WZWzEYd0sdLCpTYe8SagMMK2+0vj35ANVvD92FHUUkHTtJAEiCu81y0ujFuFbtx/VxA0uGVb/fBZ6A== dependencies: - "@acala-network/api" "4.1.8-9" - "@acala-network/eth-providers" "^2.5.4" - "@acala-network/type-definitions" "4.1.8-9" + "@acala-network/api" "4.1.8-13" + "@acala-network/eth-providers" "^2.5.9" + "@acala-network/type-definitions" "4.1.8-13" "@ethersproject/bignumber" "^5.7.0" "@polkadot/api" "^9.9.1" "@polkadot/types" "^9.9.1" @@ -114,6 +136,13 @@ lru-cache "^7.14.1" rxjs "^7.5.7" +"@acala-network/type-definitions@4.1.8-13", "@acala-network/type-definitions@^4.1.8-1": + version "4.1.8-13" + resolved "https://registry.yarnpkg.com/@acala-network/type-definitions/-/type-definitions-4.1.8-13.tgz#a295d3f3feb1d36cadbda634c180f53eb90cca61" + integrity sha512-AMXbqsJehhDcwEngSB173eQvuCAsXEm/7rNZMQ8KLG56a8FrNAgrEz+83foogLuTcehCPUPfC0R1Ef/+874rRw== + dependencies: + "@open-web3/orml-type-definitions" "^1.1.4" + "@acala-network/type-definitions@4.1.8-9": version "4.1.8-9" resolved "https://registry.yarnpkg.com/@acala-network/type-definitions/-/type-definitions-4.1.8-9.tgz#be238e2e269cd701b79b0af5f9ed4d9c168d94c0" @@ -121,12 +150,15 @@ dependencies: "@open-web3/orml-type-definitions" "^1.1.4" -"@acala-network/type-definitions@^4.1.5": - version "4.1.5" - resolved "https://registry.yarnpkg.com/@acala-network/type-definitions/-/type-definitions-4.1.5.tgz#c02624ba9bb637588ddd184a4ce35ab7d9de2bf6" - integrity sha512-XwXtKf5ESfzGk32N1sE3MlBtnamz2JZYtjB6KcKe9eOyv+3lowQvRn4Z347rNSEp+tpenZWnLwBXk4XWhdiSoQ== +"@acala-network/types@4.1.8-13": + version "4.1.8-13" + resolved "https://registry.yarnpkg.com/@acala-network/types/-/types-4.1.8-13.tgz#919fc5ad818f535caba0fc2ea0477085e570d93b" + integrity sha512-XBIupGrNyY1xSptC59GNE89C4wJ2pb/QwRiRkQUNzDSTfLbjUSCOpDqjSfZIxj21+/zhZtw+6+uS+HnoTpsQeg== dependencies: - "@open-web3/orml-type-definitions" "^1.1.4" + "@acala-network/type-definitions" "4.1.8-13" + "@babel/runtime" "^7.10.2" + "@open-web3/api-mobx" "^1.1.4" + "@open-web3/orml-types" "^1.1.4" "@acala-network/types@4.1.8-9", "@acala-network/types@~4.1.8-9": version "4.1.8-9" @@ -1564,13 +1596,6 @@ dependencies: regenerator-runtime "^0.13.4" -"@babel/runtime@^7.20.1": - version "7.20.1" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.20.1.tgz#1148bb33ab252b165a06698fde7576092a78b4a9" - integrity sha512-mrzLkl6U9YLF8qpqI7TB82PESyEGjm/0Ly91jG575eVxMMlb8fYfOXFZIJ8XfLrJZQbm7dlKry2bJmXBUEkdFg== - dependencies: - regenerator-runtime "^0.13.10" - "@babel/template@^7.10.4", "@babel/template@^7.12.7", "@babel/template@^7.16.7", "@babel/template@^7.3.3": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.16.7.tgz#8d126c8701fde4d66b264b3eba3d96f07666d155" @@ -1688,10 +1713,10 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@bifrost-finance/type-definitions@1.7.1": - version "1.7.1" - resolved "https://registry.yarnpkg.com/@bifrost-finance/type-definitions/-/type-definitions-1.7.1.tgz#d64e89eebf5d325ecca636261373945e14c4c508" - integrity sha512-9AJIFFtlTKUGNJ8ITkgDUUJD+Iodb2Cp6qbVl5mAKuaws9QrLpgKYTT09GoKltQTg5bbDc8+ygbcabntUeTZGw== +"@bifrost-finance/type-definitions@1.7.2": + version "1.7.2" + resolved "https://registry.yarnpkg.com/@bifrost-finance/type-definitions/-/type-definitions-1.7.2.tgz#13139a69e3e98d175a4751d7fd78dcfebac29943" + integrity sha512-JL19CHFL4DxO29LRrv9o7r7Au9TtY+8pwG4fMP8M6jq2/MkvWd7OQFn1lmEy58akntNrVReIkZPuP81MFKv9jg== dependencies: "@open-web3/orml-type-definitions" "^0.9.4-38" @@ -1919,10 +1944,10 @@ resolved "https://registry.yarnpkg.com/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz#1d572bfbbe14b7704e0ba0f39b74815b84870d70" integrity sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw== -"@docknetwork/node-types@0.13.0": - version "0.13.0" - resolved "https://registry.yarnpkg.com/@docknetwork/node-types/-/node-types-0.13.0.tgz#8b643f9cb52c3563d3db91ac84e06836b0f6f199" - integrity sha512-k+NZksUGqc1Cz8eG+EzCPRyRalgho/xy4fh5Dqsbe9LwLeklrrtfAMaklPRtkt0yja8ueg1DGnCtHq00e99j4Q== +"@docknetwork/node-types@0.15.0": + version "0.15.0" + resolved "https://registry.yarnpkg.com/@docknetwork/node-types/-/node-types-0.15.0.tgz#eed5c719380865bf989ccd2550844dadb7abdd19" + integrity sha512-ACIHUIiAt82nhYxtwHSyS4JaJ28UbWS+fAwbTblKcsQBe7YRM2tjbLmkaqQjGPjxJS+wmh/xf7/PnA8PfboNZg== "@edgeware/node-types@3.6.2-wako": version "3.6.2-wako" @@ -2043,10 +2068,10 @@ resolved "https://registry.yarnpkg.com/@emotion/weak-memoize/-/weak-memoize-0.2.5.tgz#8eed982e2ee6f7f4e44c253e12962980791efd46" integrity sha512-6U71C2Wp7r5XtFtQzYrW5iKFT67OixrSxjI4MptCHzdSVlgabczzqLe0ZSgnub/5Kp4hSbpDB1tMytZY9pwxxA== -"@equilab/definitions@1.4.14": - version "1.4.14" - resolved "https://registry.yarnpkg.com/@equilab/definitions/-/definitions-1.4.14.tgz#c384f3eca003293d5f2c0a42235bdbe0a60626dd" - integrity sha512-F8jDESrhUpapqGSTXWND+5/DOqFlnh/oEejIYVIzF2WeUreHJzUPpI8a8Hb9plCLxj5sxYJ+3JL/5epMcrXDaQ== +"@equilab/definitions@1.4.18": + version "1.4.18" + resolved "https://registry.yarnpkg.com/@equilab/definitions/-/definitions-1.4.18.tgz#e544951b50278705af3d9fa4ba91e04df53a3d06" + integrity sha512-rFEPaHmdn5I1QItbQun9H/x+o3hgjA6kLYLrNN6nl/ndtQMY2tqx/mQfcGIlKA1xVmyn9mUAqD8G0P/nBHD3yA== "@eslint/eslintrc@^0.4.3": version "0.4.3" @@ -2483,6 +2508,15 @@ dependencies: tslib "2.4.0" +"@frequency-chain/api-augment@^1.0.0": + version "1.3.1" + resolved "https://registry.yarnpkg.com/@frequency-chain/api-augment/-/api-augment-1.3.1.tgz#172c44527db00818571c9fef4959d3edc071972d" + integrity sha512-ndkLp9gZ75rWR5Og+3XKWz3eKqR5ZjBjSKG3OEgoeKNU4hZ5YE1ypvNfDThOij8sqiAsOKe4ltFpCXMgqcBe3A== + dependencies: + "@polkadot/api" "^9.14.2" + "@polkadot/rpc-provider" "^9.14.2" + "@polkadot/types" "^9.14.2" + "@gar/promisify@^1.0.1": version "1.1.3" resolved "https://registry.yarnpkg.com/@gar/promisify/-/promisify-1.1.3.tgz#555193ab2e3bb3b6adc3d551c9c030d9e860daf6" @@ -2549,18 +2583,17 @@ resolved "https://registry.yarnpkg.com/@iarna/toml/-/toml-2.2.5.tgz#b32366c89b43c6f8cefbdefac778b9c828e3ba8c" integrity sha512-trnsAYxU3xnS1gPHPyU961coFyLkh4gAD/0zQ5mymY4yOZ+CYvsPqUbOFSw0aDM4y0tV7tiFxL/1XfXPNC6IPg== -"@interlay/bridge@^0.2.3": - version "0.2.3" - resolved "https://registry.yarnpkg.com/@interlay/bridge/-/bridge-0.2.3.tgz#60e2329a036ef328d82d11f098b9cf2170ede4cb" - integrity sha512-zS8b4uGU7pqsihQR5BH3cNg4tEQUSY0YOVkjBC34p9WRAvE0NsllwEZe26eVjliHIPYOPD7LtiqyU4eHogogag== - dependencies: - "@acala-network/api" "4.1.8-9" - "@acala-network/sdk" "4.1.8-9" - "@acala-network/sdk-core" "4.1.8-9" - "@polkadot/api" "^9.11.1" - "@polkadot/apps-config" "^0.122.2" - "@polkadot/types" "^9.11.1" - "@polkadot/types-augment" "^9.11.1" +"@interlay/bridge@^0.3.2": + version "0.3.2" + resolved "https://registry.yarnpkg.com/@interlay/bridge/-/bridge-0.3.2.tgz#51624d07f8c44cf28cbfbbf12aa3214be42155d6" + integrity sha512-Gm7S3VM1osXp6YYMdpRUTujA27/U5bp52hjiWk4RBec2lOxI4EgrV5al5czKWY9Bd0TayPYVaQtKLGgJ7oYPLg== + dependencies: + "@acala-network/api" "4.1.8-13" + "@acala-network/sdk" "4.1.8-13" + "@acala-network/sdk-core" "4.1.8-13" + "@polkadot/api" "^9.14.2" + "@polkadot/apps-config" "^0.124.1" + "@polkadot/types" "^9.14.2" axios "^0.27.2" lodash "^4.17.20" @@ -2588,16 +2621,16 @@ isomorphic-fetch "^3.0.0" regtest-client "^0.2.0" +"@interlay/interbtc-types@1.11.0": + version "1.11.0" + resolved "https://registry.yarnpkg.com/@interlay/interbtc-types/-/interbtc-types-1.11.0.tgz#5b94066ddee1fd677de928531db36e6ae439e08f" + integrity sha512-bn3XjyRlXyhe1QKUHx5IEQJDNC6LoSCJJIkTnSp5xm52GRBEWgHOvLAnfJi3gyj7A3lV/yA2Xjqf294bZgMmfw== + "@interlay/interbtc-types@1.12.0": version "1.12.0" resolved "https://registry.yarnpkg.com/@interlay/interbtc-types/-/interbtc-types-1.12.0.tgz#07dc8e15690292387124dbc2bbb7bf5bc8b68001" integrity sha512-ELJa2ftIbe8Ds2ejS7kO5HumN9EB5l2OBi3Qsy5iHJsHKq2HtXfFoKnW38HarM6hADrWG+e/yNGHSKJIJzEZuA== -"@interlay/interbtc-types@1.9.0": - version "1.9.0" - resolved "https://registry.yarnpkg.com/@interlay/interbtc-types/-/interbtc-types-1.9.0.tgz#beffd3b04bc1d9dba49f3ddc338b5867b81dec3d" - integrity sha512-G/jOHXM6lqoFAPquESAxsjt5ETrmcPTDC36WFRWYpoRUfFxcjq6TkWGxUC5/RS6jIoWMQ6lEJZupmlm/QNdbAg== - "@interlay/monetary-js@0.7.2": version "0.7.2" resolved "https://registry.yarnpkg.com/@interlay/monetary-js/-/monetary-js-0.7.2.tgz#a54a315b60be12f5b1a9c31f0d71d5e8ee7ba174" @@ -2947,10 +2980,10 @@ "@jridgewell/resolve-uri" "^3.0.3" "@jridgewell/sourcemap-codec" "^1.4.10" -"@kiltprotocol/type-definitions@^0.2.1": - version "0.2.1" - resolved "https://registry.yarnpkg.com/@kiltprotocol/type-definitions/-/type-definitions-0.2.1.tgz#0469b0bcc58063be0b02ffbf6f779176c6b0a00d" - integrity sha512-By09MH20P+rXadiZDnw2XeAw7bQLgNazOyNS3gPdU1L4Jx+lU9OtvIgZEA+T/TY/KM5nTv32s3c4wZ7v1s2znw== +"@kiltprotocol/type-definitions@^0.30.0": + version "0.30.0" + resolved "https://registry.yarnpkg.com/@kiltprotocol/type-definitions/-/type-definitions-0.30.0.tgz#00e99636a1c4405071021242cd509090c8f14287" + integrity sha512-1UpPDjX8PFqTFm3lRRfYUPEY9M8KrbpRinf4q4K843lY5GdTxQaevrVdK9/WCHKywLyDa4tSrlUv9KQjrTP4bg== "@laminar/type-definitions@0.3.1": version "0.3.1" @@ -2959,22 +2992,22 @@ dependencies: "@open-web3/orml-type-definitions" "^0.8.2-9" -"@logion/node-api@^0.7.0": - version "0.7.2" - resolved "https://registry.yarnpkg.com/@logion/node-api/-/node-api-0.7.2.tgz#af164f13831f1b89b130597ca70bf0e863f0b79f" - integrity sha512-EAyRp1MAAS4bGuxnuAYExssfwvFHLsmCyPWH0wMIik5eLHqNiPA1LwylYH5AQx8P1w11/nHVqRc5ly7dlf5E+w== +"@logion/node-api@^0.9.0-3": + version "0.9.0-3" + resolved "https://registry.yarnpkg.com/@logion/node-api/-/node-api-0.9.0-3.tgz#b02741acbf30517d537d48b75ffc83b366f09b87" + integrity sha512-6m2My8yI9jmhqP6FHPJdrsqdg/1vyJtY1/4cnuqCByJaVgNDGrcdtcmzW4BXCww+hJMrdm3PeLthKHCrwpo0gA== dependencies: - "@polkadot/api" "^9.8.1" - "@polkadot/util" "^10.1.12" - "@polkadot/util-crypto" "^10.1.12" + "@polkadot/api" "^9.10.1" + "@polkadot/util" "^10.2.1" + "@polkadot/util-crypto" "^10.2.1" "@types/uuid" "^8.3.4" fast-sha256 "^1.3.0" uuid "^8.3.2" -"@mangata-finance/types@^0.9.0": - version "0.9.0" - resolved "https://registry.yarnpkg.com/@mangata-finance/types/-/types-0.9.0.tgz#8272a01d87243f693d0e0889070afb0d00b4f91f" - integrity sha512-37yIP9xh+6kTt+UQJsbPt0OCrDIZsqGRh3f7sEtK7zX4G8uWrg/GHcHtGZQRruNIOAO8+1PLXuMfLokSzojVBw== +"@mangata-finance/types@^0.17.0": + version "0.17.0" + resolved "https://registry.yarnpkg.com/@mangata-finance/types/-/types-0.17.0.tgz#299b0bd21e30e17ee65c25f18d4a89871f521930" + integrity sha512-v0o7rePG4P2fDH1yVvSfuHpHQCA7Xki9IwPMTu51Y4FoQdvD1zHUOI4mIOc3ssjOAJsCePNdsTm+/xj3DeiSxQ== "@mdx-js/mdx@^1.6.22": version "1.6.22" @@ -3245,17 +3278,17 @@ dependencies: "@open-web3/orml-type-definitions" "1.1.4" -"@parallel-finance/type-definitions@1.7.13": - version "1.7.13" - resolved "https://registry.yarnpkg.com/@parallel-finance/type-definitions/-/type-definitions-1.7.13.tgz#08c92e07496d2757d9a89879e7d3d08b2bf49744" - integrity sha512-v2M1uCfBnQ2wiYEk/2ftTdSB4OV8nTL38qhB6ApykxHCdXu4Nz1lJKFjW8OW1DTXB8xCfkj8VX8eY0UDez535g== +"@parallel-finance/type-definitions@1.7.14": + version "1.7.14" + resolved "https://registry.yarnpkg.com/@parallel-finance/type-definitions/-/type-definitions-1.7.14.tgz#02ca0d8a8d2894fa1d22c8625bd4edfcfbeffc4c" + integrity sha512-64cIrOcS5z2SSzTAITg3qDdQReoBLCZhAGHzR1VnYQzF0u59Ow6XnWmg0/R4EuyhnsqW4aMhnrmlVE7RhG9kPg== dependencies: "@open-web3/orml-type-definitions" "^1.1.4" -"@phala/typedefs@0.2.32": - version "0.2.32" - resolved "https://registry.yarnpkg.com/@phala/typedefs/-/typedefs-0.2.32.tgz#4c66dce9b5a975226bbbdbdef09bccfde2e54878" - integrity sha512-G1ifICDNW6NtixqCVfJHBI82Detwzzmzs4gpE1RrMsTxfoKIbxkX8nx3DxZUhFYqikGEkQVxNmEi3jpC0zDrsw== +"@phala/typedefs@0.2.33": + version "0.2.33" + resolved "https://registry.yarnpkg.com/@phala/typedefs/-/typedefs-0.2.33.tgz#6f18d73b5104db6a594d08be571954385b3e509b" + integrity sha512-CaRzIGfU6CUIKLPswYtOw/xbtTttqmJZpr3fhkxLvkBQMXIH14iISD763OFXtWui7DrAMBKo/bHawvFNgWGKTg== "@pmmmwh/react-refresh-webpack-plugin@0.4.3", "@pmmmwh/react-refresh-webpack-plugin@^0.4.3": version "0.4.3" @@ -3304,7 +3337,7 @@ resolved "https://registry.yarnpkg.com/@polka/url/-/url-1.0.0-next.21.tgz#5de5a2385a35309427f6011992b544514d559aa1" integrity sha512-a5Sab1C4/icpTZVzZc5Ghpz88yQtGOyNqYXcZgOssB2uuAr+wF/MvN6bgtW32q7HHrvBki+BsZ0OuNv6EV3K9g== -"@polkadot/api-augment@9.14.2", "@polkadot/api-augment@9.9.1", "@polkadot/api-augment@^9.14.2": +"@polkadot/api-augment@9.10.3", "@polkadot/api-augment@9.14.2", "@polkadot/api-augment@^9.14.2": version "9.14.2" resolved "https://registry.yarnpkg.com/@polkadot/api-augment/-/api-augment-9.14.2.tgz#2c49cdcfdf7057523db1dc8d7b0801391a8a2e69" integrity sha512-19MmW8AHEcLkdcUIo3LLk0eCQgREWqNSxkUyOeWn7UiNMY1AhDOOwMStUBNCvrIDK6VL6GGc1sY7rkPCLMuKSw== @@ -3342,7 +3375,7 @@ "@polkadot/util-crypto" "^10.4.2" rxjs "^7.8.0" -"@polkadot/api-derive@9.14.2", "@polkadot/api-derive@^8.5.1", "@polkadot/api-derive@^9.14.2", "@polkadot/api-derive@^9.7.1", "@polkadot/api-derive@^9.9.1": +"@polkadot/api-derive@9.10.3", "@polkadot/api-derive@9.14.2", "@polkadot/api-derive@^8.5.1", "@polkadot/api-derive@^9.13.2", "@polkadot/api-derive@^9.14.2": version "9.14.2" resolved "https://registry.yarnpkg.com/@polkadot/api-derive/-/api-derive-9.14.2.tgz#e8fcd4ee3f2b80b9fe34d4dec96169c3bdb4214d" integrity sha512-yw9OXucmeggmFqBTMgza0uZwhNjPxS7MaT7lSCUIRKckl1GejdV+qMhL3XFxPFeYzXwzFpdPG11zWf+qJlalqw== @@ -3358,7 +3391,7 @@ "@polkadot/util-crypto" "^10.4.2" rxjs "^7.8.0" -"@polkadot/api@9.14.2", "@polkadot/api@^7.2.1", "@polkadot/api@^9.11.1", "@polkadot/api@^9.14.2", "@polkadot/api@^9.4.2", "@polkadot/api@^9.7.1", "@polkadot/api@^9.8.1", "@polkadot/api@^9.9.1", "@polkadot/api@latest": +"@polkadot/api@9.10.3", "@polkadot/api@9.14.2", "@polkadot/api@^7.2.1", "@polkadot/api@^9.10.1", "@polkadot/api@^9.13.2", "@polkadot/api@^9.14.2", "@polkadot/api@^9.4.2", "@polkadot/api@^9.9.1", "@polkadot/api@latest": version "9.14.2" resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-9.14.2.tgz#d5cee02236654c6063d7c4b70c78c290db5aba8d" integrity sha512-R3eYFj2JgY1zRb+OCYQxNlJXCs2FA+AU4uIEiVcXnVLmR3M55tkRNEwYAZmiFxx0pQmegGgPMc33q7TWGdw24A== @@ -3381,48 +3414,49 @@ eventemitter3 "^5.0.0" rxjs "^7.8.0" -"@polkadot/apps-config@^0.122.2": - version "0.122.2" - resolved "https://registry.yarnpkg.com/@polkadot/apps-config/-/apps-config-0.122.2.tgz#b15d2dbfc43b0e8bc32fc14bd56b97de3abb83e3" - integrity sha512-EBINVhOe4w5gzjOJ/lIzYJDP1DiZY8SWBf8Jp25DOwdSvUsyV1AYyrGAgmz+kE+jtakEMKOZpXdRt3OwGYLPqw== +"@polkadot/apps-config@^0.124.1": + version "0.124.1" + resolved "https://registry.yarnpkg.com/@polkadot/apps-config/-/apps-config-0.124.1.tgz#4d993fcc198118dfe4aa9200ce6055b48cab96b3" + integrity sha512-SqDLf0ksU5WkU96L3nIiICwaBDLj4APYjKkwpSUAWk1NcvXDWZQQG56obgaLPHZ2If6GZrQge/fUmItuRBIZrg== dependencies: - "@acala-network/type-definitions" "^4.1.5" - "@babel/runtime" "^7.20.1" - "@bifrost-finance/type-definitions" "1.7.1" + "@acala-network/type-definitions" "^4.1.8-1" + "@babel/runtime" "^7.20.13" + "@bifrost-finance/type-definitions" "1.7.2" "@crustio/type-definitions" "1.3.0" "@darwinia/types" "2.8.10" "@darwinia/types-known" "2.8.10" "@digitalnative/type-definitions" "1.1.27" - "@docknetwork/node-types" "0.13.0" + "@docknetwork/node-types" "0.15.0" "@edgeware/node-types" "3.6.2-wako" - "@equilab/definitions" "1.4.14" - "@interlay/interbtc-types" "1.9.0" - "@kiltprotocol/type-definitions" "^0.2.1" + "@equilab/definitions" "1.4.18" + "@frequency-chain/api-augment" "^1.0.0" + "@interlay/interbtc-types" "1.11.0" + "@kiltprotocol/type-definitions" "^0.30.0" "@laminar/type-definitions" "0.3.1" - "@logion/node-api" "^0.7.0" - "@mangata-finance/types" "^0.9.0" + "@logion/node-api" "^0.9.0-3" + "@mangata-finance/types" "^0.17.0" "@metaverse-network-sdk/type-definitions" "^0.0.1-13" - "@parallel-finance/type-definitions" "1.7.13" - "@phala/typedefs" "0.2.32" - "@polkadot/api" "^9.7.1" - "@polkadot/api-derive" "^9.7.1" - "@polkadot/networks" "^10.1.11" - "@polkadot/types" "^9.7.1" - "@polkadot/util" "^10.1.11" - "@polkadot/x-fetch" "^10.1.11" + "@parallel-finance/type-definitions" "1.7.14" + "@phala/typedefs" "0.2.33" + "@polkadot/api" "^9.13.2" + "@polkadot/api-derive" "^9.13.2" + "@polkadot/networks" "^10.3.1" + "@polkadot/types" "^9.13.2" + "@polkadot/util" "^10.3.1" + "@polkadot/x-fetch" "^10.3.1" "@polymathnetwork/polymesh-types" "0.0.2" "@snowfork/snowbridge-types" "0.2.7" - "@sora-substrate/type-definitions" "1.10.21" - "@subsocial/definitions" "^0.7.8-dev.0" - "@unique-nft/opal-testnet-types" "930.31.0" - "@unique-nft/quartz-mainnet-types" "930.31.0" - "@unique-nft/unique-mainnet-types" "930.31.0" - "@zeitgeistpm/type-defs" "0.9.0" + "@sora-substrate/type-definitions" "1.12.4" + "@subsocial/definitions" "^0.7.9" + "@unique-nft/opal-testnet-types" "930.34.0" + "@unique-nft/quartz-mainnet-types" "930.34.0" + "@unique-nft/unique-mainnet-types" "930.33.0" + "@zeitgeistpm/type-defs" "0.10.0" "@zeroio/type-definitions" "0.0.14" lodash "^4.17.21" moonbeam-types-bundle "2.0.9" pontem-types-bundle "1.0.15" - rxjs "^7.5.7" + rxjs "^7.8.0" "@polkadot/extension-dapp@0.44.1": version "0.44.1" @@ -3446,7 +3480,7 @@ "@polkadot/util-crypto" "^9.4.1" "@polkadot/x-global" "^9.4.1" -"@polkadot/keyring@^10.1.13", "@polkadot/keyring@^10.1.6", "@polkadot/keyring@^10.4.2": +"@polkadot/keyring@^10.1.6", "@polkadot/keyring@^10.2.1", "@polkadot/keyring@^10.4.2": version "10.4.2" resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-10.4.2.tgz#793377fdb9076df0af771df11388faa6be03c70d" integrity sha512-7iHhJuXaHrRTG6cJDbZE9G+c1ts1dujp0qbO4RfAPmT7YUvphHvAtCKueN9UKPz5+TYDL+rP/jDEaSKU8jl/qQ== @@ -3482,7 +3516,7 @@ "@polkadot/util" "8.7.1" "@polkadot/util-crypto" "8.7.1" -"@polkadot/networks@10.4.2", "@polkadot/networks@^10.1.11", "@polkadot/networks@^10.1.6", "@polkadot/networks@^10.4.2": +"@polkadot/networks@10.4.2", "@polkadot/networks@^10.1.6", "@polkadot/networks@^10.3.1", "@polkadot/networks@^10.4.2": version "10.4.2" resolved "https://registry.yarnpkg.com/@polkadot/networks/-/networks-10.4.2.tgz#d7878c6aad8173c800a21140bfe5459261724456" integrity sha512-FAh/znrEvWBiA/LbcT5GXHsCFUl//y9KqxLghSr/CreAmAergiJNT0MVUezC7Y36nkATgmsr4ylFwIxhVtuuCw== @@ -3534,7 +3568,7 @@ optionalDependencies: "@substrate/connect" "0.7.19" -"@polkadot/types-augment@9.14.2", "@polkadot/types-augment@^9.11.1", "@polkadot/types-augment@^9.14.2": +"@polkadot/types-augment@9.14.2", "@polkadot/types-augment@^9.14.2": version "9.14.2" resolved "https://registry.yarnpkg.com/@polkadot/types-augment/-/types-augment-9.14.2.tgz#1a478e18e713b04038f3e171287ee5abe908f0aa" integrity sha512-WO9d7RJufUeY3iFgt2Wz762kOu1tjEiGBR5TT4AHtpEchVHUeosVTrN9eycC+BhleqYu52CocKz6u3qCT/jKLg== @@ -3582,7 +3616,7 @@ "@babel/runtime" "^7.20.13" "@polkadot/util" "^10.4.2" -"@polkadot/types@9.14.2", "@polkadot/types@^4.13.1", "@polkadot/types@^6.0.5", "@polkadot/types@^7.2.1", "@polkadot/types@^8.7.1", "@polkadot/types@^9.11.1", "@polkadot/types@^9.14.2", "@polkadot/types@^9.7.1", "@polkadot/types@^9.9.1": +"@polkadot/types@9.10.3", "@polkadot/types@9.14.2", "@polkadot/types@^4.13.1", "@polkadot/types@^6.0.5", "@polkadot/types@^7.2.1", "@polkadot/types@^8.7.1", "@polkadot/types@^9.13.2", "@polkadot/types@^9.14.2", "@polkadot/types@^9.9.1": version "9.14.2" resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-9.14.2.tgz#5105f41eb9e8ea29938188d21497cbf1753268b8" integrity sha512-hGLddTiJbvowhhUZJ3k+olmmBc1KAjWIQxujIUIYASih8FQ3/YJDKxaofGOzh0VygOKW3jxQBN2VZPofyDP9KQ== @@ -3621,7 +3655,7 @@ eventemitter3 "^4.0.7" store "^2.0.12" -"@polkadot/util-crypto@10.4.2", "@polkadot/util-crypto@6.11.1", "@polkadot/util-crypto@7.9.2", "@polkadot/util-crypto@8.7.1", "@polkadot/util-crypto@^10.1.12", "@polkadot/util-crypto@^10.1.13", "@polkadot/util-crypto@^10.1.6", "@polkadot/util-crypto@^10.2.4", "@polkadot/util-crypto@^10.4.2", "@polkadot/util-crypto@^9.0.1", "@polkadot/util-crypto@^9.4.1": +"@polkadot/util-crypto@10.4.2", "@polkadot/util-crypto@6.11.1", "@polkadot/util-crypto@7.9.2", "@polkadot/util-crypto@8.7.1", "@polkadot/util-crypto@^10.1.6", "@polkadot/util-crypto@^10.2.1", "@polkadot/util-crypto@^10.2.4", "@polkadot/util-crypto@^10.4.2", "@polkadot/util-crypto@^9.4.1": version "10.4.2" resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-10.4.2.tgz#871fb69c65768bd48c57bb5c1f76a85d979fb8b5" integrity sha512-RxZvF7C4+EF3fzQv8hZOLrYCBq5+wA+2LWv98nECkroChY3C2ZZvyWDqn8+aonNULt4dCVTWDZM0QIY6y4LUAQ== @@ -3638,7 +3672,7 @@ ed2curve "^0.3.0" tweetnacl "^1.0.3" -"@polkadot/util@10.4.2", "@polkadot/util@6.11.1", "@polkadot/util@7.9.2", "@polkadot/util@8.7.1", "@polkadot/util@^10.1.11", "@polkadot/util@^10.1.12", "@polkadot/util@^10.1.13", "@polkadot/util@^10.1.6", "@polkadot/util@^10.2.4", "@polkadot/util@^10.4.2", "@polkadot/util@^9.4.1": +"@polkadot/util@10.4.2", "@polkadot/util@6.11.1", "@polkadot/util@7.9.2", "@polkadot/util@8.7.1", "@polkadot/util@^10.1.6", "@polkadot/util@^10.2.1", "@polkadot/util@^10.2.4", "@polkadot/util@^10.3.1", "@polkadot/util@^10.4.2", "@polkadot/util@^9.4.1": version "10.4.2" resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-10.4.2.tgz#df41805cb27f46b2b4dad24c371fa2a68761baa1" integrity sha512-0r5MGICYiaCdWnx+7Axlpvzisy/bi1wZGXgCSw5+ZTyPTOqvsYRqM2X879yxvMsGfibxzWqNzaiVjToz1jvUaA== @@ -3710,7 +3744,7 @@ "@babel/runtime" "^7.20.13" "@polkadot/x-global" "10.4.2" -"@polkadot/x-fetch@^10.1.11", "@polkadot/x-fetch@^10.4.2": +"@polkadot/x-fetch@^10.3.1", "@polkadot/x-fetch@^10.4.2": version "10.4.2" resolved "https://registry.yarnpkg.com/@polkadot/x-fetch/-/x-fetch-10.4.2.tgz#bc6ba70de71a252472fbe36180511ed920e05f05" integrity sha512-Ubb64yaM4qwhogNP+4mZ3ibRghEg5UuCYRMNaCFoPgNAY8tQXuDKrHzeks3+frlmeH9YRd89o8wXLtWouwZIcw== @@ -4883,10 +4917,10 @@ "@polkadot/keyring" "^8.2.2" "@polkadot/types" "^7.2.1" -"@sora-substrate/type-definitions@1.10.21": - version "1.10.21" - resolved "https://registry.yarnpkg.com/@sora-substrate/type-definitions/-/type-definitions-1.10.21.tgz#1fb225cc8036729cdfb8fd2fcdc72bfa18251781" - integrity sha512-QPtJk6ZjPK9RwpMG+YdMI319dRbSr01C5D52TNOf9UAk6FA9fGTXtn6kH6pR185Ssu/Ww50LmU+NpDP45RPYVA== +"@sora-substrate/type-definitions@1.12.4": + version "1.12.4" + resolved "https://registry.yarnpkg.com/@sora-substrate/type-definitions/-/type-definitions-1.12.4.tgz#e4bfc1d5d58c20dd589cfcd73ab86f798684221f" + integrity sha512-G+s1DTKGfkncUXUPXQNNrbj/9ZnNxksEXBmqP/RQrmnfYE3C59P5Zkp+D98WsXobkWOnMxqBDlK+VbUQbvMoRA== dependencies: "@open-web3/orml-type-definitions" "0.9.4-26" @@ -5854,10 +5888,10 @@ regenerator-runtime "^0.13.7" resolve-from "^5.0.0" -"@subsocial/definitions@^0.7.8-dev.0": - version "0.7.9" - resolved "https://registry.yarnpkg.com/@subsocial/definitions/-/definitions-0.7.9.tgz#5bc0d94c9ad269d00d10f9b47fdf4abc447bb183" - integrity sha512-HBYvftT+ixPgPttCRUIpcpKJ9UlvFHWhhUgaLTxfFNQ4qaVMCPT7ZdoEkWYeErefnUVag1j5NzS9TfjTyx9gLg== +"@subsocial/definitions@^0.7.9": + version "0.7.14" + resolved "https://registry.yarnpkg.com/@subsocial/definitions/-/definitions-0.7.14.tgz#1397f1ec806d60d9deb112b9f36d530400b711fe" + integrity sha512-dor5S6/tbY09n40e/dh7qFcqF9slMihOMDTXWBM5hTe8nS/Pf5Zp4/r9WiZxxYLoY2v5MlSqyJxjiSCjTxxjUw== dependencies: "@polkadot/api" latest lodash.camelcase "^4.3.0" @@ -6771,20 +6805,20 @@ "@typescript-eslint/types" "4.33.0" eslint-visitor-keys "^2.0.0" -"@unique-nft/opal-testnet-types@930.31.0": - version "930.31.0" - resolved "https://registry.yarnpkg.com/@unique-nft/opal-testnet-types/-/opal-testnet-types-930.31.0.tgz#dc989976b5e91b4d8358a7af624d6e5e2ebf0b87" - integrity sha512-IY4AxUx3uqjMEXy6iXrfVmu4oDTXOXaPjg5sb3WqnXpA7czjfSWZsQ/OtJFAWO+cbXUt8DM9ifs9/2hY2+O4RA== +"@unique-nft/opal-testnet-types@930.34.0": + version "930.34.0" + resolved "https://registry.yarnpkg.com/@unique-nft/opal-testnet-types/-/opal-testnet-types-930.34.0.tgz#e4274976ebc9614dbec6c1a074674a3620eacb6f" + integrity sha512-6N5MQC5o4V5J0PZ/JmhRfYOtJTSpCjxxM1pdGysh6aIu/rSey8ELa/9BnGwLIZsOPxW77PKwnt7NIRc01Sze3g== -"@unique-nft/quartz-mainnet-types@930.31.0": - version "930.31.0" - resolved "https://registry.yarnpkg.com/@unique-nft/quartz-mainnet-types/-/quartz-mainnet-types-930.31.0.tgz#009a37ac2dad085cfe0ebdca98de06f345fa35d6" - integrity sha512-oZdHnX2TfglJ43PjKwAnUhx5VIcCDpeeQtRC8cXSvVKE2CqkW5ry/rgyavAs+HeUrwsD5JXHtebgH9P1dZ4vOw== +"@unique-nft/quartz-mainnet-types@930.34.0": + version "930.34.0" + resolved "https://registry.yarnpkg.com/@unique-nft/quartz-mainnet-types/-/quartz-mainnet-types-930.34.0.tgz#d99a744b10575533441a0ca13f855eeca45a9047" + integrity sha512-YwJ3h7Q0crnvGsYfBXjxtPIpQnB9T5JY1LLAapLGvOO3A0iA1PWbSiqAgOdjZTt4zivYm3IbdhxQhyyY6d5jLA== -"@unique-nft/unique-mainnet-types@930.31.0": - version "930.31.0" - resolved "https://registry.yarnpkg.com/@unique-nft/unique-mainnet-types/-/unique-mainnet-types-930.31.0.tgz#ea79a6fd3d9e8c115b13ef3048a87bf0a853c269" - integrity sha512-acAKLL2TNS7X886SiNjMHo0dVmCECFd9vUSJxBZ1yjVVOhf6P6Nn+gA8jjgLKSg89VAqNQ9Op7a/vBN0Xo8+nw== +"@unique-nft/unique-mainnet-types@930.33.0": + version "930.33.0" + resolved "https://registry.yarnpkg.com/@unique-nft/unique-mainnet-types/-/unique-mainnet-types-930.33.0.tgz#196bbe704882ad826b709c5ec9cbbb8067e456ee" + integrity sha512-KlliDzrwcyl1igi/rjltue/T6DZQP5yAijcFzWtCsKfLzkCPxcplzYgd5S+VKRoAFrndOMVXleXTUgpPSYiL9Q== "@uphold/request-logger@^2.0.0": version "2.0.0" @@ -7074,10 +7108,10 @@ resolved "https://registry.yarnpkg.com/@xtuc/long/-/long-4.2.2.tgz#d291c6a4e97989b5c61d9acf396ae4fe133a718d" integrity sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ== -"@zeitgeistpm/type-defs@0.9.0": - version "0.9.0" - resolved "https://registry.yarnpkg.com/@zeitgeistpm/type-defs/-/type-defs-0.9.0.tgz#95496d4c7984c87cf53eeed1b97283e5c4538362" - integrity sha512-H3EuEjrKtMlZBKEl08427Bda/c0t9BaUiwBNPn2T8ppM1RCEzfd1/3riHce6CyBCAQKR+w47Dylc+qK2VrBbNQ== +"@zeitgeistpm/type-defs@0.10.0": + version "0.10.0" + resolved "https://registry.yarnpkg.com/@zeitgeistpm/type-defs/-/type-defs-0.10.0.tgz#7f551f949b45b082541a254a9845ab15b2ff9148" + integrity sha512-nQBdyRbkIopPOVjRHk9c/RBWiQI6iYE8fs5rmtSNCXm6IxoXssk/1PtWE+UxXXq9mco7rPao9nJMeYXJ1Ro2kg== "@zeroio/type-definitions@0.0.14": version "0.0.14" @@ -18328,7 +18362,7 @@ regenerator-runtime@^0.11.0: resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg== -regenerator-runtime@^0.13.10, regenerator-runtime@^0.13.11: +regenerator-runtime@^0.13.11: version "0.13.11" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz#f6dca3e7ceec20590d07ada785636a90cdca17f9" integrity sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg== From 7dd557e0f5ba3857040cbe97b0d5c9e51f4147ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sim=C3=A3o?= Date: Tue, 4 Apr 2023 08:15:22 +0100 Subject: [PATCH 04/21] feat(Wallet): add page (#1001) * feat(Wallet): add page * feat: add WalletIcon * feat: copy address * wip * feat: staking table * feat: refactor and add lending * refactor: clean up code * wip * feat: add List card * continue * fix: continue * feat: continue * feat(CTALink): improve * feat: add responsiveness and swap handling * feat: final * feat: add responsive prop * fix: clean up List and Divider * feat: add tests * feat: add final tests * fix: code review * feat: add vesting and tests * fix: code review --- .env.dev | 6 +- .github/workflows/test.yml | 1 + package.json | 2 + src/App.tsx | 7 + src/assets/icons/ArrowTopRightOnSquare.tsx | 25 ++ src/assets/icons/DocumentDuplicate.tsx | 25 ++ src/assets/icons/PencilSquare.tsx | 25 ++ src/assets/icons/index.ts | 3 + src/assets/locales/en/translation.json | 23 +- src/common/actions/general.actions.ts | 7 + src/common/reducers/general.reducer.ts | 4 + src/common/types/actions.types.ts | 9 +- src/common/types/util.types.ts | 1 + src/component-library/CTA/CTA.style.tsx | 1 + src/component-library/CTA/CTALink.tsx | 46 +++- src/component-library/CTA/index.tsx | 2 + .../Divider/Divider.style.tsx | 12 +- src/component-library/Divider/Divider.tsx | 11 +- src/component-library/Flex/Flex.style.tsx | 4 +- src/component-library/Flex/Flex.tsx | 54 ++-- src/component-library/List/List.stories.tsx | 44 +-- src/component-library/List/List.style.tsx | 48 +++- src/component-library/List/List.tsx | 25 +- src/component-library/List/ListItem.tsx | 4 +- src/component-library/Switch/Switch.tsx | 11 +- src/component-library/Table/Table.stories.tsx | 5 +- src/component-library/TextLink/TextLink.tsx | 1 + .../WalletIcon/FallbackIcon.tsx | 17 ++ .../WalletIcon/WalletIcon.stories.tsx | 34 +++ .../WalletIcon/WalletIcon.style.tsx | 11 + .../WalletIcon/WalletIcon.tsx | 38 +++ .../WalletIcon/icons/PolkadotJS.tsx | 45 ++++ .../WalletIcon/icons/SubWallet.tsx | 101 +++++++ .../WalletIcon/icons/Talisman.tsx | 39 +++ .../WalletIcon/icons/index.ts | 3 + src/component-library/WalletIcon/index.tsx | 2 + src/component-library/css/margin.ts | 21 ++ src/component-library/css/responsive.ts | 26 ++ src/component-library/index.tsx | 5 +- src/component-library/theme/theme.ts | 55 +++- src/component-library/utils/breakpoints.ts | 17 ++ src/component-library/utils/prop-types.ts | 18 ++ .../utils/use-media-query.tsx | 44 +++ .../utils/use-style-props.tsx | 30 +++ src/components/DataGrid/AssetCell.tsx | 24 ++ src/components/DataGrid/BalanceCell.tsx | 20 ++ src/components/DataGrid/Cell.tsx | 33 +++ src/components/DataGrid/DataGrid.style.tsx | 21 ++ src/components/DataGrid/DataGrid.tsx | 35 +++ src/components/DataGrid/List.tsx | 44 +++ src/components/DataGrid/ListItem.tsx | 33 +++ src/components/DataGrid/Table.tsx | 38 +++ src/components/DataGrid/TableWrapper.tsx | 32 +++ src/components/DataGrid/index.tsx | 10 + .../LoanApyTooltip}/AssetGroup.tsx | 2 +- .../LoanApyTooltip}/BreakdownGroup.tsx | 4 +- .../LoanApyTooltip/LoanApyTooltip.style.tsx} | 0 .../LoanApyTooltip/LoanApyTooltip.tsx} | 12 +- .../LoanApyTooltip}/RewardsGroup.tsx | 2 +- src/components/LoanApyTooltip/index.tsx | 2 + .../LoanPositionsTable}/ApyCell.tsx | 15 +- .../LoanPositionsTable/LoanPositionsTable.tsx | 153 +++++++++++ .../LoanTablePlaceholder.tsx | 22 ++ src/components/LoanPositionsTable/index.tsx | 4 + .../PoolsTable}/PoolsTable.tsx | 52 ++-- src/components/PoolsTable/index.tsx | 2 + src/components/index.tsx | 6 + .../components/PoolsTables/PoolsTables.tsx | 2 +- src/pages/AMM/Swap/Swap.tsx | 42 ++- .../AMM/Swap/components/SwapForm/SwapForm.tsx | 21 +- .../components/ApyTooltip/index.tsx | 2 - .../BorrowAssetsTable.style.tsx | 9 +- .../BorrowAssetsTable/BorrowAssetsTable.tsx | 34 ++- .../BorrowPositionsTable.style.tsx | 9 - .../BorrowPositionsTable.tsx | 93 ------- .../components/BorrowPositionsTable/index.tsx | 2 - .../LendAssetsTable/LendAssetsTable.style.tsx | 9 - .../LendAssetsTable/LendAssetsTable.tsx | 34 ++- .../LendPositionsTable.style.tsx | 9 - .../LendPositionsTable/LendPositionsTable.tsx | 106 -------- .../components/LendPositionsTable/index.tsx | 2 - .../components/LoanActionInfo/LoanGroup.tsx | 2 +- .../LoanActionInfo/RewardsGroup.tsx | 4 +- .../components/LoansBaseTable/AssetCell.tsx | 18 -- .../components/LoansBaseTable/BalanceCell.tsx | 26 -- .../LoansBaseTable/LoanStatusTag.tsx | 22 -- .../LoansBaseTable/LoansBaseTable.style.tsx | 49 ---- .../LoansBaseTable/LoansBaseTable.tsx | 51 ---- .../LoansBaseTable/MonetaryCell.tsx | 30 --- .../components/LoansBaseTable/index.tsx | 8 - .../components/LoansTables/BorrowTables.tsx | 8 +- .../components/LoansTables/LendTables.tsx | 8 +- .../LoansTables/LoansTables.style.tsx | 28 +- .../DespositCollateralStep.tsx | 2 +- .../components/InfoBox/InfoBox.stories.tsx | 28 -- .../Wallet/WalletOverview/WalletOverview.tsx | 57 ++++ .../AvailableAssetsTable/ActionsCell.tsx | 131 +++++++++ .../AvailableAssetsTable.tsx | 130 +++++++++ .../components/AvailableAssetsTable/index.tsx | 2 + .../components/StakingTable/StakingTable.tsx | 94 +++++++ .../components/StakingTable/index.tsx | 2 + .../WalletInsights/WalletInsights.style.tsx | 14 + .../WalletInsights/WalletInsights.tsx | 85 ++++++ .../components/WalletInsights/WalletMeta.tsx | 85 ++++++ .../components/WalletInsights/index.tsx | 2 + .../components/WalletInsights/utils.ts | 24 ++ .../WalletOverview/components/index.tsx | 6 + src/pages/Wallet/WalletOverview/index.tsx | 3 + src/pages/Wallet/index.tsx | 3 + .../SidebarContent/Navigation/index.tsx | 12 +- .../Topbar/GetGovernanceTokenUI/index.tsx | 12 +- .../mocks/@interlay/interbtc-api/index.ts | 22 +- .../@interlay/interbtc-api/parachain/amm.ts | 5 +- .../interbtc-api/parachain/escrow.ts | 25 ++ .../@interlay/interbtc-api/parachain/loans.ts | 2 +- .../interbtc-api/parachain/system.ts | 6 + .../interbtc-api/parachain/vesting.ts | 9 + src/test/pages/Loans/index.test.tsx | 6 +- src/test/pages/Swap.test.tsx | 24 ++ src/test/pages/Wallet.test.tsx | 250 ++++++++++++++++++ src/test/pages/utils/common.ts | 6 + src/test/pages/utils/list.ts | 17 ++ src/test/pages/utils/table.ts | 9 +- src/test/test-utils.tsx | 7 +- src/utils/constants/links.ts | 9 +- src/utils/helpers/coin-icon.ts | 2 +- .../helpers/loans.ts} | 25 +- src/utils/helpers/pools.ts | 32 +++ .../escrow/use-get-account-staking-data.tsx | 71 +++++ .../escrow/use-get-account-voting-balance.tsx | 37 +++ .../use-get-account-lending-statistics.tsx | 2 +- src/utils/hooks/api/use-get-currencies.tsx | 12 - src/utils/hooks/api/use-get-vesting-data.tsx | 50 ++++ src/utils/hooks/use-copy-tooltip.tsx | 63 +++++ src/utils/hooks/use-feature-flag.ts | 6 +- yarn.lock | 75 ++++++ 136 files changed, 2853 insertions(+), 717 deletions(-) create mode 100644 src/assets/icons/ArrowTopRightOnSquare.tsx create mode 100644 src/assets/icons/DocumentDuplicate.tsx create mode 100644 src/assets/icons/PencilSquare.tsx create mode 100644 src/component-library/WalletIcon/FallbackIcon.tsx create mode 100644 src/component-library/WalletIcon/WalletIcon.stories.tsx create mode 100644 src/component-library/WalletIcon/WalletIcon.style.tsx create mode 100644 src/component-library/WalletIcon/WalletIcon.tsx create mode 100644 src/component-library/WalletIcon/icons/PolkadotJS.tsx create mode 100644 src/component-library/WalletIcon/icons/SubWallet.tsx create mode 100644 src/component-library/WalletIcon/icons/Talisman.tsx create mode 100644 src/component-library/WalletIcon/icons/index.ts create mode 100644 src/component-library/WalletIcon/index.tsx create mode 100644 src/component-library/css/margin.ts create mode 100644 src/component-library/css/responsive.ts create mode 100644 src/component-library/utils/breakpoints.ts create mode 100644 src/component-library/utils/use-media-query.tsx create mode 100644 src/component-library/utils/use-style-props.tsx create mode 100644 src/components/DataGrid/AssetCell.tsx create mode 100644 src/components/DataGrid/BalanceCell.tsx create mode 100644 src/components/DataGrid/Cell.tsx create mode 100644 src/components/DataGrid/DataGrid.style.tsx create mode 100644 src/components/DataGrid/DataGrid.tsx create mode 100644 src/components/DataGrid/List.tsx create mode 100644 src/components/DataGrid/ListItem.tsx create mode 100644 src/components/DataGrid/Table.tsx create mode 100644 src/components/DataGrid/TableWrapper.tsx create mode 100644 src/components/DataGrid/index.tsx rename src/{pages/Loans/LoansOverview/components/ApyTooltip => components/LoanApyTooltip}/AssetGroup.tsx (93%) rename src/{pages/Loans/LoansOverview/components/ApyTooltip => components/LoanApyTooltip}/BreakdownGroup.tsx (94%) rename src/{pages/Loans/LoansOverview/components/ApyTooltip/ApyTooltip.style.tsx => components/LoanApyTooltip/LoanApyTooltip.style.tsx} (100%) rename src/{pages/Loans/LoansOverview/components/ApyTooltip/ApyTooltip.tsx => components/LoanApyTooltip/LoanApyTooltip.tsx} (89%) rename src/{pages/Loans/LoansOverview/components/ApyTooltip => components/LoanApyTooltip}/RewardsGroup.tsx (94%) create mode 100644 src/components/LoanApyTooltip/index.tsx rename src/{pages/Loans/LoansOverview/components/LoansBaseTable => components/LoanPositionsTable}/ApyCell.tsx (79%) create mode 100644 src/components/LoanPositionsTable/LoanPositionsTable.tsx create mode 100644 src/components/LoanPositionsTable/LoanTablePlaceholder.tsx create mode 100644 src/components/LoanPositionsTable/index.tsx rename src/{pages/AMM/Pools/components/PoolsTables => components/PoolsTable}/PoolsTable.tsx (65%) create mode 100644 src/components/PoolsTable/index.tsx delete mode 100644 src/pages/Loans/LoansOverview/components/ApyTooltip/index.tsx delete mode 100644 src/pages/Loans/LoansOverview/components/BorrowPositionsTable/BorrowPositionsTable.style.tsx delete mode 100644 src/pages/Loans/LoansOverview/components/BorrowPositionsTable/BorrowPositionsTable.tsx delete mode 100644 src/pages/Loans/LoansOverview/components/BorrowPositionsTable/index.tsx delete mode 100644 src/pages/Loans/LoansOverview/components/LendAssetsTable/LendAssetsTable.style.tsx delete mode 100644 src/pages/Loans/LoansOverview/components/LendPositionsTable/LendPositionsTable.style.tsx delete mode 100644 src/pages/Loans/LoansOverview/components/LendPositionsTable/LendPositionsTable.tsx delete mode 100644 src/pages/Loans/LoansOverview/components/LendPositionsTable/index.tsx delete mode 100644 src/pages/Loans/LoansOverview/components/LoansBaseTable/AssetCell.tsx delete mode 100644 src/pages/Loans/LoansOverview/components/LoansBaseTable/BalanceCell.tsx delete mode 100644 src/pages/Loans/LoansOverview/components/LoansBaseTable/LoanStatusTag.tsx delete mode 100644 src/pages/Loans/LoansOverview/components/LoansBaseTable/LoansBaseTable.style.tsx delete mode 100644 src/pages/Loans/LoansOverview/components/LoansBaseTable/LoansBaseTable.tsx delete mode 100644 src/pages/Loans/LoansOverview/components/LoansBaseTable/MonetaryCell.tsx delete mode 100644 src/pages/Loans/LoansOverview/components/LoansBaseTable/index.tsx delete mode 100644 src/pages/Vaults/VaultsOverview/components/InfoBox/InfoBox.stories.tsx create mode 100644 src/pages/Wallet/WalletOverview/WalletOverview.tsx create mode 100644 src/pages/Wallet/WalletOverview/components/AvailableAssetsTable/ActionsCell.tsx create mode 100644 src/pages/Wallet/WalletOverview/components/AvailableAssetsTable/AvailableAssetsTable.tsx create mode 100644 src/pages/Wallet/WalletOverview/components/AvailableAssetsTable/index.tsx create mode 100644 src/pages/Wallet/WalletOverview/components/StakingTable/StakingTable.tsx create mode 100644 src/pages/Wallet/WalletOverview/components/StakingTable/index.tsx create mode 100644 src/pages/Wallet/WalletOverview/components/WalletInsights/WalletInsights.style.tsx create mode 100644 src/pages/Wallet/WalletOverview/components/WalletInsights/WalletInsights.tsx create mode 100644 src/pages/Wallet/WalletOverview/components/WalletInsights/WalletMeta.tsx create mode 100644 src/pages/Wallet/WalletOverview/components/WalletInsights/index.tsx create mode 100644 src/pages/Wallet/WalletOverview/components/WalletInsights/utils.ts create mode 100644 src/pages/Wallet/WalletOverview/components/index.tsx create mode 100644 src/pages/Wallet/WalletOverview/index.tsx create mode 100644 src/pages/Wallet/index.tsx create mode 100644 src/test/mocks/@interlay/interbtc-api/parachain/escrow.ts create mode 100644 src/test/mocks/@interlay/interbtc-api/parachain/vesting.ts create mode 100644 src/test/pages/Wallet.test.tsx create mode 100644 src/test/pages/utils/common.ts create mode 100644 src/test/pages/utils/list.ts rename src/{pages/Loans/LoansOverview/utils/get-subsidy-rewards-apy.ts => utils/helpers/loans.ts} (54%) create mode 100644 src/utils/helpers/pools.ts create mode 100644 src/utils/hooks/api/escrow/use-get-account-staking-data.tsx create mode 100644 src/utils/hooks/api/escrow/use-get-account-voting-balance.tsx create mode 100644 src/utils/hooks/api/use-get-vesting-data.tsx create mode 100644 src/utils/hooks/use-copy-tooltip.tsx diff --git a/.env.dev b/.env.dev index fd40ea1079..ac580353f8 100644 --- a/.env.dev +++ b/.env.dev @@ -1,8 +1,8 @@ /* FEATURE FLAGS */ -REACT_APP_FEATURE_FLAG_LENDING=disabled -REACT_APP_FEATURE_FLAG_AMM=disabled - +REACT_APP_FEATURE_FLAG_LENDING=enabled +REACT_APP_FEATURE_FLAG_AMM=enabled +REACT_APP_FEATURE_FLAG_WALLET=enabled /* DEVELOPMENT */ diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a0d5450023..03d6e5f643 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,6 +14,7 @@ env: DOCKER_RELAY_CHAIN_CURRENCY: DOT REACT_APP_FEATURE_FLAG_LENDING: enabled REACT_APP_FEATURE_FLAG_AMM: enabled + REACT_APP_FEATURE_FLAG_WALLET: enabled jobs: lint: diff --git a/package.json b/package.json index c8eab474d9..cc2874cfd2 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "@react-aria/gridlist": "^3.1.2", "@react-aria/interactions": "^3.11.0", "@react-aria/label": "^3.4.3", + "@react-aria/link": "^3.4.0", "@react-aria/meter": "^3.2.1", "@react-aria/overlays": "^3.12.0", "@react-aria/progress": "^3.3.0", @@ -113,6 +114,7 @@ "eslint-plugin-simple-import-sort": "^7.0.0", "husky": "^8.0.1", "identity-obj-proxy": "^3.0.0", + "jest-matchmedia-mock": "^1.1.0", "lint-staged": "^10.5.4", "postcss": "7", "prettier": "2.2.1", diff --git a/src/App.tsx b/src/App.tsx index de336e0a25..fc2f89f241 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -37,6 +37,7 @@ const Vault = React.lazy(() => import(/* webpackChunkName: 'vault' */ '@/pages/V const Loans = React.lazy(() => import(/* webpackChunkName: 'loans' */ '@/pages/Loans')); const Swap = React.lazy(() => import(/* webpackChunkName: 'loans' */ '@/pages/AMM')); const Pools = React.lazy(() => import(/* webpackChunkName: 'loans' */ '@/pages/AMM/Pools')); +const Wallet = React.lazy(() => import(/* webpackChunkName: 'loans' */ '@/pages/Wallet')); const Actions = React.lazy(() => import(/* webpackChunkName: 'actions' */ '@/pages/Actions')); const NoMatch = React.lazy(() => import(/* webpackChunkName: 'no-match' */ '@/pages/NoMatch')); @@ -48,6 +49,7 @@ const App = (): JSX.Element => { const dispatch = useDispatch(); const isLendingEnabled = useFeatureFlag(FeatureFlags.LENDING); const isAMMEnabled = useFeatureFlag(FeatureFlags.AMM); + const isWalletEnabled = useFeatureFlag(FeatureFlags.WALLET); // Loads the connection to the faucet - only for testnet purposes const loadFaucet = React.useCallback(async (): Promise => { @@ -205,6 +207,11 @@ const App = (): JSX.Element => { )} + {isWalletEnabled && ( + + + + )} diff --git a/src/assets/icons/ArrowTopRightOnSquare.tsx b/src/assets/icons/ArrowTopRightOnSquare.tsx new file mode 100644 index 0000000000..68afeaa95c --- /dev/null +++ b/src/assets/icons/ArrowTopRightOnSquare.tsx @@ -0,0 +1,25 @@ +import { forwardRef } from 'react'; + +import { Icon, IconProps } from '@/component-library/Icon'; + +const ArrowTopRightOnSquare = forwardRef((props, ref) => ( + + + +)); + +ArrowTopRightOnSquare.displayName = 'ArrowTopRightOnSquare'; + +export { ArrowTopRightOnSquare }; diff --git a/src/assets/icons/DocumentDuplicate.tsx b/src/assets/icons/DocumentDuplicate.tsx new file mode 100644 index 0000000000..9cb33fb1f1 --- /dev/null +++ b/src/assets/icons/DocumentDuplicate.tsx @@ -0,0 +1,25 @@ +import { forwardRef } from 'react'; + +import { Icon, IconProps } from '@/component-library/Icon'; + +const DocumentDuplicate = forwardRef((props, ref) => ( + + + +)); + +DocumentDuplicate.displayName = 'DocumentDuplicate'; + +export { DocumentDuplicate }; diff --git a/src/assets/icons/PencilSquare.tsx b/src/assets/icons/PencilSquare.tsx new file mode 100644 index 0000000000..67493d6fa0 --- /dev/null +++ b/src/assets/icons/PencilSquare.tsx @@ -0,0 +1,25 @@ +import { forwardRef } from 'react'; + +import { Icon, IconProps } from '@/component-library/Icon'; + +const PencilSquare = forwardRef((props, ref) => ( + + + +)); + +PencilSquare.displayName = 'PencilSquare'; + +export { PencilSquare }; diff --git a/src/assets/icons/index.ts b/src/assets/icons/index.ts index dd942553d2..7888df9310 100644 --- a/src/assets/icons/index.ts +++ b/src/assets/icons/index.ts @@ -1,7 +1,10 @@ export { ArrowsUpDown } from './ArrowsUpDown'; +export { ArrowTopRightOnSquare } from './ArrowTopRightOnSquare'; export { ChevronDown } from './ChevronDown'; export { Cog } from './Cog'; +export { DocumentDuplicate } from './DocumentDuplicate'; export { InformationCircle } from './InformationCircle'; +export { PencilSquare } from './PencilSquare'; export { PlusCircle } from './PlusCircle'; export { Warning } from './Warning'; export { XMark } from './XMark'; diff --git a/src/assets/locales/en/translation.json b/src/assets/locales/en/translation.json index 9e8dfcc585..6a49171400 100644 --- a/src/assets/locales/en/translation.json +++ b/src/assets/locales/en/translation.json @@ -89,6 +89,7 @@ "nav_terms_and_conditions": "Terms and Conditions", "nav_use_wrapped": "Use {{wrappedTokenSymbol}}", "nav_governance": "Governance", + "nav_wallet": "Wallet", "report_bug": "Report a bug:", "request_funds": "Faucet", "request_btc": "BTC Faucet", @@ -140,6 +141,17 @@ "insufficient_funds_fees": "Insufficient funds for fees", "successfully_claimed_rewards": "Successfully claimed rewards", "view_details": "View details", + "copied": "Copied", + "click_to_copy": "Click to copy", + "asset": "Asset", + "price": "Price", + "balance": "Balance", + "show_zero_balance": "Show Zero Balance", + "total_balance": "Total Balance", + "transferable_balance": "Transferable Balance", + "fund_wallet": "Fund Wallet", + "unlocks": "Unlocks", + "staked": "Staked", "redeem_page": { "maximum_in_single_request": "Max redeemable in single request", "redeem": "Redeem", @@ -555,7 +567,9 @@ "lend": "Lend", "my_lend_positions": "My Lend Positions", "my_borrow_positions": "My Borrow Positions", - "action_liquidation_risk": "{{action}} this amount will increase your LTV, thus also increasing the risk of liquidation." + "action_liquidation_risk": "{{action}} this amount will increase your LTV, thus also increasing the risk of liquidation.", + "no_loan_positions": "No {{loanType}} positions", + "your_loan_positions_will_show_here": "Your {{loanType}} positions will show here" }, "amm": { "pools": { @@ -593,5 +607,12 @@ "transfer_more_than_minimum": "Must transfer more than the minimum amount of {{ amount }}", "transfer_less_than_maximum": "Must transfer less than the maximum amount of {{ amount }}" } + }, + "wallet": { + "available_assets": "Available assets", + "no_assets_available": "No assets available", + "total_governance_locked": "Total {{token}} Locked", + "available_to_stake": "Available to stake", + "voting_power_governance": "Voting Power {{token}}" } } diff --git a/src/common/actions/general.actions.ts b/src/common/actions/general.actions.ts index c609d6b1cb..c6c464f6e1 100644 --- a/src/common/actions/general.actions.ts +++ b/src/common/actions/general.actions.ts @@ -13,7 +13,9 @@ import { IsFaucetLoaded, IsVaultClientLoaded, SHOW_ACCOUNT_MODAL, + SHOW_BUY_MODAL, ShowAccountModal, + ShowBuyModal, UPDATE_HEIGHTS, UPDATE_TOTALS, UpdateHeights, @@ -58,6 +60,11 @@ export const showAccountModalAction = (showAccountModal: boolean): ShowAccountMo showAccountModal }); +export const showBuyModal = (isBuyModalOpen: boolean): ShowBuyModal => ({ + type: SHOW_BUY_MODAL, + isBuyModalOpen +}); + export const updateHeightsAction = (btcRelayHeight: number, bitcoinHeight: number): UpdateHeights => ({ type: UPDATE_HEIGHTS, btcRelayHeight, diff --git a/src/common/reducers/general.reducer.ts b/src/common/reducers/general.reducer.ts index 6414b1e1bb..e4d93c5361 100644 --- a/src/common/reducers/general.reducer.ts +++ b/src/common/reducers/general.reducer.ts @@ -9,6 +9,7 @@ import { IS_BRIDGE_LOADED, IS_VAULT_CLIENT_LOADED, SHOW_ACCOUNT_MODAL, + SHOW_BUY_MODAL, UPDATE_HEIGHTS, UPDATE_TOTALS } from '../types/actions.types'; @@ -19,6 +20,7 @@ const initialState = { vaultClientLoaded: false, hasFeedbackModalBeenDisplayed: false, showAccountModal: false, + isBuyModalOpen: false, totalWrappedTokenAmount: BitcoinAmount.zero(), totalLockedCollateralTokenAmount: newMonetaryAmount(0, RELAY_CHAIN_NATIVE_TOKEN), btcRelayHeight: 0, @@ -57,6 +59,8 @@ export const generalReducer = (state: GeneralState = initialState, action: Gener return { ...state, vaultClientLoaded: action.isLoaded }; case SHOW_ACCOUNT_MODAL: return { ...state, showAccountModal: action.showAccountModal }; + case SHOW_BUY_MODAL: + return { ...state, isBuyModalOpen: action.isBuyModalOpen }; default: return state; } diff --git a/src/common/types/actions.types.ts b/src/common/types/actions.types.ts index c1ddaefba7..bfc8d94628 100644 --- a/src/common/types/actions.types.ts +++ b/src/common/types/actions.types.ts @@ -18,6 +18,7 @@ export const UPDATE_COLLATERAL_TOKEN_TRANSFERABLE_BALANCE = 'UPDATE_COLLATERAL_T export const SHOW_ACCOUNT_MODAL = 'SHOW_ACCOUNT_MODAL'; export const UPDATE_HEIGHTS = 'UPDATE_HEIGHTS'; export const UPDATE_TOTALS = 'UPDATE_TOTALS'; +export const SHOW_BUY_MODAL = 'SHOW_BUY_MODAL'; export interface UpdateTotals { type: typeof UPDATE_TOTALS; @@ -86,6 +87,11 @@ export interface ShowAccountModal { showAccountModal: boolean; } +export interface ShowBuyModal { + type: typeof SHOW_BUY_MODAL; + isBuyModalOpen: boolean; +} + export type GeneralActions = | IsBridgeLoaded | InitGeneralDataAction @@ -96,7 +102,8 @@ export type GeneralActions = | UpdateCollateralTokenTransferableBalance | ShowAccountModal | UpdateHeights - | UpdateTotals; + | UpdateTotals + | ShowBuyModal; // REDEEM export const ADD_VAULT_REDEEMS = 'ADD_VAULT_REDEEMS'; diff --git a/src/common/types/util.types.ts b/src/common/types/util.types.ts index f3cc043d6a..70f39523e6 100644 --- a/src/common/types/util.types.ts +++ b/src/common/types/util.types.ts @@ -49,6 +49,7 @@ export type GeneralState = { bridgeLoaded: boolean; vaultClientLoaded: boolean; showAccountModal: boolean; + isBuyModalOpen: boolean; totalWrappedTokenAmount: BitcoinAmount; totalLockedCollateralTokenAmount: MonetaryAmount; btcRelayHeight: number; diff --git a/src/component-library/CTA/CTA.style.tsx b/src/component-library/CTA/CTA.style.tsx index 3c1e833c6d..017da13651 100644 --- a/src/component-library/CTA/CTA.style.tsx +++ b/src/component-library/CTA/CTA.style.tsx @@ -23,6 +23,7 @@ const BaseCTA = styled.button` text-decoration: none; width: ${(props) => (props.$fullWidth ? '100%' : 'auto')}; background: none; + // TODO: enforce outline outline: ${({ $isFocusVisible }) => !$isFocusVisible && 'none'}; &[aria-disabled='true'], diff --git a/src/component-library/CTA/CTALink.tsx b/src/component-library/CTA/CTALink.tsx index f0e3a3eea5..bc6809d758 100644 --- a/src/component-library/CTA/CTALink.tsx +++ b/src/component-library/CTA/CTALink.tsx @@ -1,6 +1,10 @@ +import { useFocusRing } from '@react-aria/focus'; +import { useLink } from '@react-aria/link'; +import { mergeProps } from '@react-aria/utils'; import { forwardRef } from 'react'; import { Link, LinkProps } from 'react-router-dom'; +import { useDOMRef } from '../utils/dom'; import { BaseCTA, BaseCTAProps } from './BaseCTA'; type Props = { @@ -8,28 +12,44 @@ type Props = { disabled?: boolean; }; -type NativeAttrs = Omit; +type NativeAttrs = Omit; -type InheritAttrs = Omit; +type AriaAttrs = Omit; -type CTALinkProps = Props & NativeAttrs & InheritAttrs; +type InheritAttrs = Omit; + +type CTALinkProps = Props & NativeAttrs & AriaAttrs & InheritAttrs; // TODO: Does this need to be changed to a React Router link component? const CTALink = forwardRef( - ({ disabled, onClick, external, to, ...props }, ref): JSX.Element => { - const linkProps: LinkProps = external - ? { to: { pathname: to as string }, target: '_blank', rel: 'noreferrer' } - : { to }; + ({ disabled, external, to: toProp, children, ...props }, ref): JSX.Element => { + const linkRef = useDOMRef(ref); + + const ariaProps = { + ...props, + isDisabled: disabled, + href: toProp, + ...(external && { target: '_blank', rel: 'noreferrer' }) + }; + + const { linkProps } = useLink(ariaProps, linkRef); + const { focusProps, isFocusVisible } = useFocusRing(); + + const to = external && typeof toProp === 'string' ? { pathname: toProp as string } : toProp; return ( + isFocusVisible={isFocusVisible} + {...mergeProps(props, linkProps, focusProps, { + href: undefined, + to, + ...(external && { target: '_blank', rel: 'noreferrer' }) + })} + > + {children} + ); } ); diff --git a/src/component-library/CTA/index.tsx b/src/component-library/CTA/index.tsx index 8e53ab575c..01bda90ceb 100644 --- a/src/component-library/CTA/index.tsx +++ b/src/component-library/CTA/index.tsx @@ -1,3 +1,5 @@ +export type { BaseCTAProps } from './BaseCTA'; +export { BaseCTA } from './BaseCTA'; export type { CTAProps } from './CTA'; export { CTA } from './CTA'; export type { CTALinkProps } from './CTALink'; diff --git a/src/component-library/Divider/Divider.style.tsx b/src/component-library/Divider/Divider.style.tsx index 9e76398fe0..28d8b361bc 100644 --- a/src/component-library/Divider/Divider.style.tsx +++ b/src/component-library/Divider/Divider.style.tsx @@ -1,17 +1,19 @@ import styled from 'styled-components'; -import { Colors, Orientation } from '../utils/prop-types'; +import { theme } from '../theme'; +import { DividerVariants, Orientation, Sizes } from '../utils/prop-types'; import { resolveColor } from '../utils/theme'; type StyledDividerProps = { - $color: Colors; + $color: DividerVariants; $orientation: Orientation; + $size: Sizes; }; const StyledDivider = styled.hr` - background-color: ${({ $color }) => resolveColor($color)}; - height: ${({ $orientation }) => ($orientation === 'horizontal' ? '2px' : 'auto')}; - width: ${({ $orientation }) => ($orientation === 'horizontal' ? '' : '2px')}; + background-color: ${({ $color }) => ($color === 'default' ? 'var(--colors-border)' : resolveColor($color))}; + height: ${({ $orientation, $size }) => ($orientation === 'horizontal' ? theme.divider.size[$size] : 'auto')}; + width: ${({ $orientation, $size }) => ($orientation === 'horizontal' ? '' : theme.divider.size[$size])}; border: 0; margin: 0; align-self: stretch; diff --git a/src/component-library/Divider/Divider.tsx b/src/component-library/Divider/Divider.tsx index 3d00633b53..6d1e3cebfa 100644 --- a/src/component-library/Divider/Divider.tsx +++ b/src/component-library/Divider/Divider.tsx @@ -2,12 +2,13 @@ import { useSeparator } from '@react-aria/separator'; import { mergeProps } from '@react-aria/utils'; import { forwardRef, HTMLAttributes } from 'react'; -import { Colors, ElementTypeProp, Orientation } from '../utils/prop-types'; +import { DividerVariants, ElementTypeProp, Orientation, Sizes } from '../utils/prop-types'; import { StyledDivider } from './Divider.style'; type Props = { orientation?: Orientation; - color?: Colors; + color?: DividerVariants; + size?: Sizes; }; type NativeAttrs = Omit, keyof Props>; @@ -15,7 +16,10 @@ type NativeAttrs = Omit, keyof Props>; type DividerProps = Props & NativeAttrs & ElementTypeProp; const Divider = forwardRef( - ({ elementType: elementTypeProp, orientation = 'horizontal', color = 'primary', ...props }, ref): JSX.Element => { + ( + { elementType: elementTypeProp, orientation = 'horizontal', color = 'primary', size = 'small', ...props }, + ref + ): JSX.Element => { const elementType = elementTypeProp || orientation === 'vertical' ? 'div' : 'hr'; const { separatorProps } = useSeparator({ @@ -29,6 +33,7 @@ const Divider = forwardRef( as={elementType} $color={color} $orientation={orientation} + $size={size} {...mergeProps(separatorProps, props)} /> ); diff --git a/src/component-library/Flex/Flex.style.tsx b/src/component-library/Flex/Flex.style.tsx index d51fe623e5..a039d16252 100644 --- a/src/component-library/Flex/Flex.style.tsx +++ b/src/component-library/Flex/Flex.style.tsx @@ -1,5 +1,6 @@ import styled from 'styled-components'; +import { marginCSS, StyledMarginProps } from '../css/margin'; import { theme } from '../theme'; import { AlignItems, AlignSelf, Direction, JustifyContent, Spacing, Wrap } from '../utils/prop-types'; @@ -11,7 +12,7 @@ type StyledFlexProps = { $flex?: string | number; $wrap?: Wrap; $alignSelf?: AlignSelf; -}; +} & StyledMarginProps; const StyledFlex = styled.div` display: flex; @@ -22,6 +23,7 @@ const StyledFlex = styled.div` flex: ${(props) => props.$flex}; flex-wrap: ${(props) => (typeof props.$wrap === 'boolean' ? 'wrap' : props.$wrap)}; align-self: ${(props) => props.$alignSelf}; + ${(props) => marginCSS(props)}; `; export { StyledFlex }; diff --git a/src/component-library/Flex/Flex.tsx b/src/component-library/Flex/Flex.tsx index ecc9da416c..827db075dc 100644 --- a/src/component-library/Flex/Flex.tsx +++ b/src/component-library/Flex/Flex.tsx @@ -1,6 +1,16 @@ -import { ElementType, forwardRef, HTMLAttributes } from 'react'; +import { forwardRef, HTMLAttributes } from 'react'; -import { AlignItems, AlignSelf, Direction, ElementTypeProp, JustifyContent, Spacing, Wrap } from '../utils/prop-types'; +import { + AlignItems, + AlignSelf, + Direction, + ElementTypeProp, + JustifyContent, + MarginProps, + Spacing, + Wrap +} from '../utils/prop-types'; +import { useStyleProps } from '../utils/use-style-props'; import { StyledFlex } from './Flex.style'; type Props = { @@ -11,33 +21,37 @@ type Props = { flex?: string | number; wrap?: Wrap | boolean; alignSelf?: AlignSelf; - elementType?: ElementType; }; type NativeAttrs = Omit, keyof Props>; -type FlexProps = Props & NativeAttrs & ElementTypeProp; +type FlexProps = Props & NativeAttrs & ElementTypeProp & MarginProps; const Flex = forwardRef( ( { children, gap, justifyContent, alignItems, direction, flex, wrap, alignSelf, elementType, ...props }, ref - ): JSX.Element => ( - - {children} - - ) + ): JSX.Element => { + const { styleProps, componentProps } = useStyleProps(props); + + return ( + + {children} + + ); + } ); Flex.displayName = 'Flex'; diff --git a/src/component-library/List/List.stories.tsx b/src/component-library/List/List.stories.tsx index f03b0b8cbf..8ad79ac4a3 100644 --- a/src/component-library/List/List.stories.tsx +++ b/src/component-library/List/List.stories.tsx @@ -3,23 +3,25 @@ import { Meta, Story } from '@storybook/react'; import { List, ListItem, ListProps } from '.'; const Template: Story = (args) => ( - - - IBTC - - - KINT - - - INTR - - - KSM - - - DOT - - +
+ + + IBTC + + + KINT + + + INTR + + + KSM + + + DOT + + +
); const Default = Template.bind({}); @@ -27,7 +29,13 @@ Default.args = { selectionMode: 'single' }; -export { Default }; +const Cards = Template.bind({}); +Cards.args = { + selectionMode: 'single', + variant: 'card' +}; + +export { Cards, Default }; export default { title: 'Collections/List', diff --git a/src/component-library/List/List.style.tsx b/src/component-library/List/List.style.tsx index 6117eacd01..1e6d436bfd 100644 --- a/src/component-library/List/List.style.tsx +++ b/src/component-library/List/List.style.tsx @@ -1,10 +1,22 @@ -import styled from 'styled-components'; +import styled, { css } from 'styled-components'; +import { Flex } from '../Flex'; import { theme } from '../theme'; -import { Variants } from '../utils/prop-types'; +import { ListVariants, Variants } from '../utils/prop-types'; + +type StyledListProps = { + $variant: ListVariants; +}; + +const StyledList = styled(Flex)` + background-color: ${({ $variant }) => theme.list?.[$variant]?.bg}; + border-radius: ${({ $variant }) => theme.list[$variant].rounded}; + border: ${({ $variant }) => theme.list[$variant].border}; + overflow: hidden; +`; type StyledListItemProps = { - $variant: Variants; + $variant: Variants | 'card'; $isDisabled: boolean; $isHovered: boolean; $isInteractable: boolean; @@ -15,19 +27,31 @@ const StyledListItem = styled.li` flex: 1; align-self: stretch; padding: ${theme.spacing.spacing3}; - border-radius: ${theme.rounded.md}; + border-radius: ${({ $variant }) => theme.list.item[$variant].rounded}; background-color: ${({ $variant, $isHovered, $isFocusVisible }) => - $isHovered || $isFocusVisible ? theme.list[$variant].hover.bg : theme.list[$variant].bg}; - border: ${({ $variant }) => theme.list[$variant].border}; + $isHovered || $isFocusVisible ? theme.list.item[$variant].hover.bg : theme.list.item[$variant].bg}; + border: ${({ $variant }) => $variant !== 'card' && theme.list.item[$variant].border}; color: ${theme.colors.textPrimary}; cursor: ${({ $isInteractable }) => $isInteractable && 'pointer'}; outline: ${({ $isFocusVisible }) => !$isFocusVisible && 'none'}; - &[aria-selected='true'] { - background-color: ${theme.colors.textSecondary}; - color: ${theme.list.text}; - border-color: ${theme.colors.textSecondary}; - } + ${({ $variant }) => { + if ($variant === 'card') { + return css` + &:not(:first-of-type) { + border-top: ${theme.list.item.card.border}; + } + `; + } + + return css` + &[aria-selected='true'] { + background-color: ${theme.colors.textSecondary}; + color: ${theme.list.text}; + border-color: ${theme.colors.textSecondary}; + } + `; + }} `; -export { StyledListItem }; +export { StyledList, StyledListItem }; diff --git a/src/component-library/List/List.tsx b/src/component-library/List/List.tsx index 5901f9f6e2..34b5e81eea 100644 --- a/src/component-library/List/List.tsx +++ b/src/component-library/List/List.tsx @@ -1,18 +1,22 @@ -import { useGridList } from '@react-aria/gridlist'; +import { AriaGridListOptions, useGridList } from '@react-aria/gridlist'; import { mergeProps } from '@react-aria/utils'; import { ListProps as StatelyListProps, useListState } from '@react-stately/list'; import { forwardRef } from 'react'; -import { Flex, FlexProps } from '../Flex'; +import { FlexProps } from '../Flex'; import { useDOMRef } from '../utils/dom'; -import { Variants } from '../utils/prop-types'; +import { ListVariants } from '../utils/prop-types'; +import { StyledList } from './List.style'; import { ListItem } from './ListItem'; type Props = { - variant?: Variants; + variant?: ListVariants; }; -type InheritAttrs = Omit>, keyof Props>; +type InheritAttrs = Omit< + StatelyListProps> & AriaGridListOptions>, + keyof Props +>; type NativeAttrs = Omit; @@ -26,11 +30,18 @@ const List = forwardRef( const { gridProps } = useGridList(ariaProps, state, listRef); return ( - + {[...state.collection].map((item) => ( ))} - + ); } ); diff --git a/src/component-library/List/ListItem.tsx b/src/component-library/List/ListItem.tsx index 07f0c38bcf..d3c9540d43 100644 --- a/src/component-library/List/ListItem.tsx +++ b/src/component-library/List/ListItem.tsx @@ -8,11 +8,11 @@ import { Node } from '@react-types/shared'; import { useMemo, useRef } from 'react'; import { Flex, FlexProps } from '../Flex'; -import { Variants } from '../utils/prop-types'; +import { ListVariants } from '../utils/prop-types'; import { StyledListItem } from './List.style'; type Props = { - variant?: Variants; + variant?: ListVariants; }; type InheritAttrs = Omit; diff --git a/src/component-library/Switch/Switch.tsx b/src/component-library/Switch/Switch.tsx index e407011a51..b478e0ef52 100644 --- a/src/component-library/Switch/Switch.tsx +++ b/src/component-library/Switch/Switch.tsx @@ -4,13 +4,13 @@ import { AriaSwitchProps, useSwitch } from '@react-aria/switch'; import { mergeProps } from '@react-aria/utils'; import { useToggleState } from '@react-stately/toggle'; import { PressEvent } from '@react-types/shared'; -import React, { forwardRef, HTMLAttributes, useRef } from 'react'; +import { ChangeEvent, forwardRef, HTMLAttributes, useRef } from 'react'; import { useDOMRef } from '../utils/dom'; import { StyledInput, StyledLabel, StyledSwitch, StyledWrapper } from './Switch.style'; type Props = { - onChange?: (e: React.ChangeEvent) => void; + onChange?: (e: ChangeEvent) => void; onPress?: (e: PressEvent) => void; }; @@ -20,13 +20,16 @@ type InheritAttrs = Omit; type SwitchProps = Props & NativeAttrs & InheritAttrs; +// TODO: add size const Switch = forwardRef( ({ children, onChange, className, style, hidden, ...props }, ref): JSX.Element => { const labelRef = useDOMRef(ref); const inputRef = useRef(null); - const state = useToggleState(props); - const { inputProps } = useSwitch(props, state, inputRef); + const ariaProps: AriaSwitchProps = { children, ...props }; + + const state = useToggleState(ariaProps); + const { inputProps } = useSwitch(ariaProps, state, inputRef); const { focusProps, isFocusVisible } = useFocusRing({ autoFocus: inputProps.autoFocus diff --git a/src/component-library/Table/Table.stories.tsx b/src/component-library/Table/Table.stories.tsx index f24086cafb..5aff3651b7 100644 --- a/src/component-library/Table/Table.stories.tsx +++ b/src/component-library/Table/Table.stories.tsx @@ -21,10 +21,7 @@ const Template: Story = (args) => { const Default = Template.bind({}); Default.args = {}; -const RowAction = Template.bind({}); -RowAction.args = { onRowAction: (key) => console.log(key) }; - -export { Default, RowAction }; +export { Default }; export default { title: 'Components/Table', diff --git a/src/component-library/TextLink/TextLink.tsx b/src/component-library/TextLink/TextLink.tsx index a31f6b54dd..87c8241811 100644 --- a/src/component-library/TextLink/TextLink.tsx +++ b/src/component-library/TextLink/TextLink.tsx @@ -13,6 +13,7 @@ type NativeAttrs = Omit; type TextLinkProps = Props & NativeAttrs; +// TODO: merge this with CTALink const TextLink = forwardRef( ({ color = 'primary', external, to, ...props }, ref): JSX.Element => { const linkProps: TextLinkProps = external diff --git a/src/component-library/WalletIcon/FallbackIcon.tsx b/src/component-library/WalletIcon/FallbackIcon.tsx new file mode 100644 index 0000000000..5520635a0d --- /dev/null +++ b/src/component-library/WalletIcon/FallbackIcon.tsx @@ -0,0 +1,17 @@ +import { forwardRef } from 'react'; + +import { WalletIconProps } from './WalletIcon'; +import { StyledFallbackIcon } from './WalletIcon.style'; + +const FallbackIcon = forwardRef( + ({ name, ...props }, ref): JSX.Element => ( + + {name} + + + ) +); + +FallbackIcon.displayName = 'FallbackIcon'; + +export { FallbackIcon }; diff --git a/src/component-library/WalletIcon/WalletIcon.stories.tsx b/src/component-library/WalletIcon/WalletIcon.stories.tsx new file mode 100644 index 0000000000..fc65b0077b --- /dev/null +++ b/src/component-library/WalletIcon/WalletIcon.stories.tsx @@ -0,0 +1,34 @@ +import { Meta, Story } from '@storybook/react'; + +import { Flex } from '../Flex'; +import { Span } from '../Text'; +import { WalletIcon, WalletIconProps } from './WalletIcon'; + +const Template: Story = (args) => ( + + + + SubWallet + + + + Talisman + + + + Polkadot.js + + +); + +const Default = Template.bind({}); +Default.args = { + size: 'xl' +}; + +export { Default }; + +export default { + title: 'Elements/WalletIcon', + component: WalletIcon +} as Meta; diff --git a/src/component-library/WalletIcon/WalletIcon.style.tsx b/src/component-library/WalletIcon/WalletIcon.style.tsx new file mode 100644 index 0000000000..9c5cc225c7 --- /dev/null +++ b/src/component-library/WalletIcon/WalletIcon.style.tsx @@ -0,0 +1,11 @@ +import styled from 'styled-components'; + +import { Icon } from '../Icon'; +import { theme } from '../theme'; + +const StyledFallbackIcon = styled(Icon)` + stroke: ${theme.icon.fallback.stroke}; + color: ${theme.icon.fallback.color}; +`; + +export { StyledFallbackIcon }; diff --git a/src/component-library/WalletIcon/WalletIcon.tsx b/src/component-library/WalletIcon/WalletIcon.tsx new file mode 100644 index 0000000000..b6834d6b12 --- /dev/null +++ b/src/component-library/WalletIcon/WalletIcon.tsx @@ -0,0 +1,38 @@ +import { forwardRef, ForwardRefExoticComponent, RefAttributes } from 'react'; + +import { IconProps } from '../Icon'; +import { FallbackIcon } from './FallbackIcon'; +import { PolkadotJS, SubWallet, Talisman } from './icons'; + +type WalletComponent = ForwardRefExoticComponent>; + +const wallet: Record = { + 'polkadot-js': PolkadotJS, + 'subwallet-js': SubWallet, + talisman: Talisman +}; + +type Props = { + name: string; +}; + +type NativeAttrs = Omit; + +type WalletIconProps = Props & NativeAttrs; + +const WalletIcon = forwardRef( + ({ name, ...props }, ref): JSX.Element => { + const WalletIcon = wallet[name]; + + if (!WalletIcon) { + return ; + } + + return ; + } +); + +WalletIcon.displayName = 'WalletIcon'; + +export { WalletIcon }; +export type { WalletIconProps }; diff --git a/src/component-library/WalletIcon/icons/PolkadotJS.tsx b/src/component-library/WalletIcon/icons/PolkadotJS.tsx new file mode 100644 index 0000000000..eeb174462e --- /dev/null +++ b/src/component-library/WalletIcon/icons/PolkadotJS.tsx @@ -0,0 +1,45 @@ +import { forwardRef } from 'react'; + +import { Icon, IconProps } from '@/component-library/Icon'; + +const PolkadotJS = forwardRef((props, ref) => ( + + Polakdot.js + + + + + + + + +)); + +PolkadotJS.displayName = 'PolkadotJS'; + +export { PolkadotJS }; diff --git a/src/component-library/WalletIcon/icons/SubWallet.tsx b/src/component-library/WalletIcon/icons/SubWallet.tsx new file mode 100644 index 0000000000..6c760f802a --- /dev/null +++ b/src/component-library/WalletIcon/icons/SubWallet.tsx @@ -0,0 +1,101 @@ +import { forwardRef } from 'react'; + +import { Icon, IconProps } from '@/component-library/Icon'; + +const SubWallet = forwardRef((props, ref) => ( + + SubWallet + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +)); + +SubWallet.displayName = 'SubWallet'; + +export { SubWallet }; diff --git a/src/component-library/WalletIcon/icons/Talisman.tsx b/src/component-library/WalletIcon/icons/Talisman.tsx new file mode 100644 index 0000000000..03eb5c8501 --- /dev/null +++ b/src/component-library/WalletIcon/icons/Talisman.tsx @@ -0,0 +1,39 @@ +import { forwardRef } from 'react'; + +import { Icon, IconProps } from '@/component-library/Icon'; + +const Talisman = forwardRef((props, ref) => ( + + Talisman + + + + + + + + + + +)); + +Talisman.displayName = 'Talisman'; + +export { Talisman }; diff --git a/src/component-library/WalletIcon/icons/index.ts b/src/component-library/WalletIcon/icons/index.ts new file mode 100644 index 0000000000..b8e4fc140a --- /dev/null +++ b/src/component-library/WalletIcon/icons/index.ts @@ -0,0 +1,3 @@ +export { PolkadotJS } from './PolkadotJS'; +export { SubWallet } from './SubWallet'; +export { Talisman } from './Talisman'; diff --git a/src/component-library/WalletIcon/index.tsx b/src/component-library/WalletIcon/index.tsx new file mode 100644 index 0000000000..131f35ecae --- /dev/null +++ b/src/component-library/WalletIcon/index.tsx @@ -0,0 +1,2 @@ +export type { WalletIconProps } from './WalletIcon'; +export { WalletIcon } from './WalletIcon'; diff --git a/src/component-library/css/margin.ts b/src/component-library/css/margin.ts new file mode 100644 index 0000000000..7214ed4d91 --- /dev/null +++ b/src/component-library/css/margin.ts @@ -0,0 +1,21 @@ +import { css, DefaultTheme, FlattenInterpolation } from 'styled-components'; + +import { theme } from '../theme'; +import { MarginProps, Spacing } from '../utils/prop-types'; + +type StyledMarginProps = { + [K in keyof MarginProps as `$${string & K}`]: MarginProps[K]; +}; + +const getThemeSpacing = (spacing?: Spacing) => spacing && theme.spacing[spacing]; + +const marginCSS = (props: StyledMarginProps): FlattenInterpolation => css` + margin: ${getThemeSpacing(props.$margin)}; + margin-top: ${getThemeSpacing(props.$marginTop || props.$marginY)}; + margin-bottom: ${getThemeSpacing(props.$marginBottom || props.$marginY)}; + margin-left: ${getThemeSpacing(props.$marginLeft || props.$marginX)}; + margin-right: ${getThemeSpacing(props.$marginRight || props.$marginX)}; +`; + +export type { StyledMarginProps }; +export { marginCSS }; diff --git a/src/component-library/css/responsive.ts b/src/component-library/css/responsive.ts new file mode 100644 index 0000000000..f8b293b1a8 --- /dev/null +++ b/src/component-library/css/responsive.ts @@ -0,0 +1,26 @@ +import { theme } from '../theme'; +import { BreakPoints, ResponsiveProp } from '../utils/prop-types'; + +const getResponsiveCSS = (key: string, prop?: ResponsiveProp): string | undefined => { + if (!prop) return undefined; + + if (typeof prop === 'object') { + let finalQuery = ''; + + for (const breakpoint of Object.keys(prop)) { + const query = ` + @media (min-width: ${theme.breakpoints.values[breakpoint as BreakPoints]}px){ + ${key}: ${prop[breakpoint as BreakPoints]}; + } + `; + + finalQuery = finalQuery.concat(query); + } + + return finalQuery; + } + + return `${key}: ${prop};`; +}; + +export { getResponsiveCSS }; diff --git a/src/component-library/index.tsx b/src/component-library/index.tsx index 6f2c8457b8..809606ecc7 100644 --- a/src/component-library/index.tsx +++ b/src/component-library/index.tsx @@ -36,7 +36,7 @@ export type { StackProps } from './Stack'; export { Stack } from './Stack'; export type { SwitchProps } from './Switch'; export { Switch } from './Switch'; -export type { TableProps } from './Table'; +export type { ColumnProps, RowProps, TableProps } from './Table'; export { Table } from './Table'; export type { TabsItemProps, TabsProps } from './Tabs'; export { Tabs, TabsItem } from './Tabs'; @@ -54,3 +54,6 @@ export type { TooltipProps } from './Tooltip'; export { Tooltip } from './Tooltip'; export * from './types'; export * from './utils/prop-types'; +export { useMediaQuery } from './utils/use-media-query'; +export type { WalletIconProps } from './WalletIcon'; +export { WalletIcon } from './WalletIcon'; diff --git a/src/component-library/theme/theme.ts b/src/component-library/theme/theme.ts index 824e710b93..d4d69a1fff 100644 --- a/src/component-library/theme/theme.ts +++ b/src/component-library/theme/theme.ts @@ -1,3 +1,5 @@ +import { breakpoints } from '../utils/breakpoints'; + const theme = { // Layout layout: { @@ -7,6 +9,7 @@ const theme = { lg: '48em' } }, + breakpoints, // Generic colors: { textPrimary: 'var(--colors-text-primary)', @@ -425,7 +428,12 @@ const theme = { } }, divider: { - bg: 'var(--colors-border)' + bg: 'var(--colors-border)', + size: { + small: '1px', + medium: '2px', + large: '3px' + } }, icon: { sizes: { @@ -443,17 +451,44 @@ const theme = { list: { text: 'var(--color-list-selected-text)', primary: { - bg: 'var(--color-list-primary-bg)', - border: '1px solid var(--colors-border)', - hover: { - bg: 'var(--color-list-primary-hover-bg)' - } + bg: '', + border: '', + rounded: '' }, secondary: { - bg: 'var(--color-list-secondary-bg)', - border: 'none', - hover: { - bg: 'var(--color-list-secondary-hover-bg)' + bg: '', + border: '', + rounded: '' + }, + card: { + bg: 'var(--colors-table-odd-row-bg)', + border: '1px solid var(--colors-border)', + rounded: 'var(--rounded-md)' + }, + item: { + primary: { + bg: 'var(--color-list-primary-bg)', + border: '1px solid var(--colors-border)', + hover: { + bg: 'var(--color-list-primary-hover-bg)' + }, + rounded: 'var(--rounded-md)' + }, + secondary: { + bg: 'var(--color-list-secondary-bg)', + border: 'none', + hover: { + bg: 'var(--color-list-secondary-hover-bg)' + }, + rounded: 'var(--rounded-md)' + }, + card: { + bg: 'var(--colors-table-odd-row-bg)', + border: '1px solid var(--colors-border)', + hover: { + bg: 'var(--color-list-primary-hover-bg)' + }, + rounded: '' } } }, diff --git a/src/component-library/utils/breakpoints.ts b/src/component-library/utils/breakpoints.ts new file mode 100644 index 0000000000..ab6781e397 --- /dev/null +++ b/src/component-library/utils/breakpoints.ts @@ -0,0 +1,17 @@ +import { BreakPoints } from './prop-types'; + +const values: Record = { + xs: 0, // phone + sm: 600, // tablet + md: 900, // small laptop + lg: 1200, // desktop + xl: 1536 // large screen +}; + +const breakpoints = { + values, + up: (key: BreakPoints): string => `(min-width:${values[key]}px)`, + down: (key: BreakPoints): string => `(max-width:${values[key]}px)` +}; + +export { breakpoints }; diff --git a/src/component-library/utils/prop-types.ts b/src/component-library/utils/prop-types.ts index b0265ec68a..74e793a13b 100644 --- a/src/component-library/utils/prop-types.ts +++ b/src/component-library/utils/prop-types.ts @@ -48,6 +48,10 @@ export type Variants = typeof variant[number]; export type CTAVariants = typeof ctaVariant[number]; +export type ListVariants = Variants | 'card'; + +export type DividerVariants = Colors | 'default'; + export type CTASizes = 'x-small' | 'small' | 'medium' | 'large'; export type Status = typeof status[number]; @@ -78,6 +82,18 @@ export interface ElementTypeProp { elementType?: ElementType; } +export interface MarginProps { + margin?: Spacing; + marginTop?: Spacing; + marginBottom?: Spacing; + marginLeft?: Spacing; + marginRight?: Spacing; + marginX?: Spacing; + marginY?: Spacing; +} + +export type ResponsiveProp = T | Partial<{ [K in BreakPoints]: T }>; + export type FontWeight = keyof typeof theme.fontWeight; export type Orientation = 'horizontal' | 'vertical'; @@ -85,3 +101,5 @@ export type Orientation = 'horizontal' | 'vertical'; export type IconSize = keyof typeof theme.icon.sizes; export type Overflow = 'auto' | 'hidden' | 'scroll' | 'visible' | 'inherit'; + +export type BreakPoints = 'xs' | 'sm' | 'md' | 'lg' | 'xl'; diff --git a/src/component-library/utils/use-media-query.tsx b/src/component-library/utils/use-media-query.tsx new file mode 100644 index 0000000000..d689b1be9c --- /dev/null +++ b/src/component-library/utils/use-media-query.tsx @@ -0,0 +1,44 @@ +import { useEffect, useState } from 'react'; + +const useMediaQuery = (query: string): boolean => { + const getMatches = (query: string): boolean => { + // Prevents SSR issues + if (typeof window !== 'undefined') { + return window.matchMedia(query).matches; + } + return false; + }; + + const [matches, setMatches] = useState(getMatches(query)); + + function handleChange() { + setMatches(getMatches(query)); + } + + useEffect(() => { + const matchMedia = window.matchMedia(query); + + // Triggered at the first client-side load and if query changes + handleChange(); + + // Listen matchMedia + if (matchMedia.addListener) { + matchMedia.addListener(handleChange); + } else { + matchMedia.addEventListener('change', handleChange); + } + + return () => { + if (matchMedia.removeListener) { + matchMedia.removeListener(handleChange); + } else { + matchMedia.removeEventListener('change', handleChange); + } + }; + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [query]); + + return matches; +}; + +export { useMediaQuery }; diff --git a/src/component-library/utils/use-style-props.tsx b/src/component-library/utils/use-style-props.tsx new file mode 100644 index 0000000000..40aeb26e1f --- /dev/null +++ b/src/component-library/utils/use-style-props.tsx @@ -0,0 +1,30 @@ +import { StyledMarginProps } from '../css/margin'; +import { MarginProps } from './prop-types'; + +type StyleProps = StyledMarginProps; + +type ComponentProps> = Omit; + +type UseStylePropsResult> = { styleProps: StyleProps; componentProps: ComponentProps }; + +// Extracts props that are solely for styling so that they get mapped to styled props +// This approach is used for a set of styling props that could be reused across different component +const useStyleProps = >(props: T): UseStylePropsResult => { + const { margin, marginTop, marginBottom, marginLeft, marginRight, marginX, marginY, ...componentProps } = props; + + return { + styleProps: { + $margin: margin, + $marginTop: marginTop, + $marginBottom: marginBottom, + $marginLeft: marginLeft, + $marginRight: marginRight, + $marginX: marginX, + $marginY: marginY + }, + componentProps + }; +}; + +export type { StyleProps, UseStylePropsResult }; +export { useStyleProps }; diff --git a/src/components/DataGrid/AssetCell.tsx b/src/components/DataGrid/AssetCell.tsx new file mode 100644 index 0000000000..c708f5898f --- /dev/null +++ b/src/components/DataGrid/AssetCell.tsx @@ -0,0 +1,24 @@ +import { CoinIcon, Flex, FlexProps, FontSize, IconSize, Span } from '@/component-library'; + +type Props = { + ticker: string; + tickers?: string[]; + size?: IconSize; + textSize?: FontSize; +}; + +type InheritAttrs = Omit; + +type AssetCellProps = Props & InheritAttrs; + +const AssetCell = ({ ticker, tickers, size, textSize = 's', ...props }: AssetCellProps): JSX.Element => ( + + + + {ticker} + + +); + +export { AssetCell }; +export type { AssetCellProps }; diff --git a/src/components/DataGrid/BalanceCell.tsx b/src/components/DataGrid/BalanceCell.tsx new file mode 100644 index 0000000000..c7d14845bb --- /dev/null +++ b/src/components/DataGrid/BalanceCell.tsx @@ -0,0 +1,20 @@ +import { CurrencyExt } from '@interlay/interbtc-api'; +import { MonetaryAmount } from '@interlay/monetary-js'; + +import { formatUSD } from '@/common/utils/utils'; +import { AlignItems } from '@/component-library'; + +import { Cell } from './Cell'; + +type BalanceCellProps = { + amount: MonetaryAmount; + amountUSD: number; + alignItems?: AlignItems; +}; + +const BalanceCell = ({ amount, amountUSD, alignItems }: BalanceCellProps): JSX.Element => ( + +); + +export { BalanceCell }; +export type { BalanceCellProps }; diff --git a/src/components/DataGrid/Cell.tsx b/src/components/DataGrid/Cell.tsx new file mode 100644 index 0000000000..e1b8cef6ae --- /dev/null +++ b/src/components/DataGrid/Cell.tsx @@ -0,0 +1,33 @@ +import { forwardRef } from 'react'; + +import { Colors, Flex, FlexProps } from '@/component-library'; + +import { StyledCellLabel, StyledCellSubLabel } from './DataGrid.style'; + +type Props = { + label?: string; + sublabel?: string; + labelColor?: Colors; +}; + +type InheritAttrs = Omit; + +type CellProps = Props & InheritAttrs; + +const Cell = forwardRef( + ({ label, sublabel, labelColor: labelColorProp, alignItems, ...props }, ref): JSX.Element => { + const labelColor = labelColorProp || sublabel ? 'secondary' : undefined; + + return ( + + {label} + {sublabel && {sublabel}} + + ); + } +); + +Cell.displayName = 'Cell'; + +export { Cell }; +export type { CellProps }; diff --git a/src/components/DataGrid/DataGrid.style.tsx b/src/components/DataGrid/DataGrid.style.tsx new file mode 100644 index 0000000000..f66ce9de0b --- /dev/null +++ b/src/components/DataGrid/DataGrid.style.tsx @@ -0,0 +1,21 @@ +import styled from 'styled-components'; + +import { Span, theme } from '@/component-library'; + +const StyledCellLabel = styled(Span)` + font-weight: ${theme.fontWeight.bold}; + font-size: ${theme.text.s}; + display: inline-flex; + gap: ${theme.spacing.spacing1}; + align-items: baseline; +`; + +const StyledCellTickerLabel = styled(Span)` + font-size: ${theme.text.xs}; +`; + +const StyledCellSubLabel = styled(Span)` + font-size: ${theme.text.xs}; +`; + +export { StyledCellLabel, StyledCellSubLabel, StyledCellTickerLabel }; diff --git a/src/components/DataGrid/DataGrid.tsx b/src/components/DataGrid/DataGrid.tsx new file mode 100644 index 0000000000..54b9d08da4 --- /dev/null +++ b/src/components/DataGrid/DataGrid.tsx @@ -0,0 +1,35 @@ +import { useId } from '@react-aria/utils'; +import { ReactNode } from 'react'; + +import { BreakPoints, theme } from '@/component-library'; +import { useMediaQuery } from '@/component-library/utils/use-media-query'; + +import { List } from './List'; +import { Table, TableProps } from './Table'; + +type Props = { + title?: ReactNode; + className?: string; + actions?: ReactNode; + placeholder?: ReactNode; + responsive?: boolean; + breakpoint?: BreakPoints; +}; + +type InheritAttrs = Omit, keyof Props>; + +type DataGridProps = Props & InheritAttrs; + +const DataGrid = ({ responsive = true, breakpoint = 'md', ...props }: DataGridProps): JSX.Element => { + const titleId = useId(); + const isMobile = useMediaQuery(theme.breakpoints.down(breakpoint)); + + if (isMobile && responsive) { + return ; + } + + return ; +}; + +export { DataGrid }; +export type { DataGridProps }; diff --git a/src/components/DataGrid/List.tsx b/src/components/DataGrid/List.tsx new file mode 100644 index 0000000000..1985b1214a --- /dev/null +++ b/src/components/DataGrid/List.tsx @@ -0,0 +1,44 @@ +import { ReactNode } from 'react'; + +import { + Card, + List as LibList, + ListItem as LibListItem, + ListProps as LibListProps, + TableProps +} from '@/component-library'; + +import { ListItem } from './ListItem'; +import { TableWrapper } from './TableWrapper'; + +type Props = { + title?: ReactNode; + titleId?: string; + className?: string; + actions?: ReactNode; + placeholder?: ReactNode; +}; + +type TableAttrs = Omit, keyof Props>; + +type InheritAttrs = Omit; + +type ListProps = Props & TableAttrs & InheritAttrs; + +const List = ({ title, titleId, rows, columns, className, actions, placeholder, ...props }: ListProps): JSX.Element => ( + + {rows.length ? ( + + {rows.map((row) => ( + + + + ))} + + ) : ( + {placeholder} + )} + +); +export { List }; +export type { ListProps }; diff --git a/src/components/DataGrid/ListItem.tsx b/src/components/DataGrid/ListItem.tsx new file mode 100644 index 0000000000..14005810a9 --- /dev/null +++ b/src/components/DataGrid/ListItem.tsx @@ -0,0 +1,33 @@ +import { Fragment } from 'react'; + +import { Dd, Dl, DlGroup, DlProps, Dt, RowProps, TableProps } from '@/component-library'; + +type Props = { + row: RowProps; +}; + +type TableAttrs = Omit, keyof Props>; + +type InheritAttrs = Omit; + +type ListItemProps = Props & TableAttrs & InheritAttrs; + +const ListItem = ({ row, columns, ...props }: ListItemProps): JSX.Element => ( +
+ {columns.map((column) => { + const title = column.name; + const children = row[column.uid]; + + return title ? ( + +
{title}
+
{children}
+
+ ) : ( + {children} + ); + })} +
+); +export { ListItem }; +export type { ListItemProps }; diff --git a/src/components/DataGrid/Table.tsx b/src/components/DataGrid/Table.tsx new file mode 100644 index 0000000000..0b7cd8ab9d --- /dev/null +++ b/src/components/DataGrid/Table.tsx @@ -0,0 +1,38 @@ +import { ReactNode } from 'react'; + +import { Card, Table as LiTable, TableProps as LibTableProps } from '@/component-library'; + +import { TableWrapper } from './TableWrapper'; + +type Props = { + title?: ReactNode; + titleId?: string; + className?: string; + actions?: ReactNode; + placeholder?: ReactNode; +}; + +type InheritAttrs = Omit; + +type TableProps = Props & InheritAttrs; + +const Table = ({ + title, + titleId, + rows, + columns, + className, + actions, + placeholder, + ...props +}: TableProps): JSX.Element => ( + + + + {!rows.length && placeholder} + + +); + +export { Table }; +export type { TableProps }; diff --git a/src/components/DataGrid/TableWrapper.tsx b/src/components/DataGrid/TableWrapper.tsx new file mode 100644 index 0000000000..2cb273227b --- /dev/null +++ b/src/components/DataGrid/TableWrapper.tsx @@ -0,0 +1,32 @@ +import { ReactNode } from 'react'; + +import { Flex, FlexProps, H2 } from '@/component-library'; + +type Props = { + title?: ReactNode; + titleId?: string; + actions?: ReactNode; +}; + +type InheritAttrs = Omit; + +type TableWrapperProps = Props & InheritAttrs; + +const TableWrapper = ({ title, titleId, actions, children, ...props }: TableWrapperProps): JSX.Element => { + return ( + + + {title && ( +

+ {title} +

+ )} + {actions} +
+ {children} +
+ ); +}; + +export { TableWrapper }; +export type { TableWrapperProps }; diff --git a/src/components/DataGrid/index.tsx b/src/components/DataGrid/index.tsx new file mode 100644 index 0000000000..39b01973cd --- /dev/null +++ b/src/components/DataGrid/index.tsx @@ -0,0 +1,10 @@ +export type { AssetCellProps } from './AssetCell'; +export { AssetCell } from './AssetCell'; +export type { BalanceCellProps } from './BalanceCell'; +export { BalanceCell } from './BalanceCell'; +export type { CellProps } from './Cell'; +export { Cell } from './Cell'; +export type { DataGridProps } from './DataGrid'; +export { DataGrid } from './DataGrid'; +export type { TableProps } from './Table'; +export { Table } from './Table'; diff --git a/src/pages/Loans/LoansOverview/components/ApyTooltip/AssetGroup.tsx b/src/components/LoanApyTooltip/AssetGroup.tsx similarity index 93% rename from src/pages/Loans/LoansOverview/components/ApyTooltip/AssetGroup.tsx rename to src/components/LoanApyTooltip/AssetGroup.tsx index f637153f05..7c2a88ae38 100644 --- a/src/pages/Loans/LoansOverview/components/ApyTooltip/AssetGroup.tsx +++ b/src/components/LoanApyTooltip/AssetGroup.tsx @@ -6,7 +6,7 @@ import { Dd, Dt } from '@/component-library'; import { getTokenPrice } from '@/utils/helpers/prices'; import { Prices } from '@/utils/hooks/api/use-get-prices'; -import { StyledApyTooltipGroup } from './ApyTooltip.style'; +import { StyledApyTooltipGroup } from './LoanApyTooltip.style'; type AssetGroupProps = { amount: MonetaryAmount; diff --git a/src/pages/Loans/LoansOverview/components/ApyTooltip/BreakdownGroup.tsx b/src/components/LoanApyTooltip/BreakdownGroup.tsx similarity index 94% rename from src/pages/Loans/LoansOverview/components/ApyTooltip/BreakdownGroup.tsx rename to src/components/LoanApyTooltip/BreakdownGroup.tsx index eeba3c432d..2a11c2cb78 100644 --- a/src/pages/Loans/LoansOverview/components/ApyTooltip/BreakdownGroup.tsx +++ b/src/components/LoanApyTooltip/BreakdownGroup.tsx @@ -1,9 +1,9 @@ import Big from 'big.js'; import { Dd, Dl, DlGroup, Dt } from '@/component-library'; +import { getApyLabel } from '@/utils/helpers/loans'; -import { getApyLabel } from '../../utils/apy'; -import { StyledApyTooltipGroup, StyledApyTooltipTitle } from './ApyTooltip.style'; +import { StyledApyTooltipGroup, StyledApyTooltipTitle } from './LoanApyTooltip.style'; type BreakdownGroupProps = { apy: Big; diff --git a/src/pages/Loans/LoansOverview/components/ApyTooltip/ApyTooltip.style.tsx b/src/components/LoanApyTooltip/LoanApyTooltip.style.tsx similarity index 100% rename from src/pages/Loans/LoansOverview/components/ApyTooltip/ApyTooltip.style.tsx rename to src/components/LoanApyTooltip/LoanApyTooltip.style.tsx diff --git a/src/pages/Loans/LoansOverview/components/ApyTooltip/ApyTooltip.tsx b/src/components/LoanApyTooltip/LoanApyTooltip.tsx similarity index 89% rename from src/pages/Loans/LoansOverview/components/ApyTooltip/ApyTooltip.tsx rename to src/components/LoanApyTooltip/LoanApyTooltip.tsx index 5f811e27d1..37a2dbc5d2 100644 --- a/src/pages/Loans/LoansOverview/components/ApyTooltip/ApyTooltip.tsx +++ b/src/components/LoanApyTooltip/LoanApyTooltip.tsx @@ -6,9 +6,9 @@ import Big from 'big.js'; import { Dd, Dl, DlGroup } from '@/component-library'; import { Prices } from '@/utils/hooks/api/use-get-prices'; -import { StyledApyTooltipTitle, StyledTooltip } from './ApyTooltip.style'; import { AssetGroup } from './AssetGroup'; import { BreakdownGroup } from './BreakdownGroup'; +import { StyledApyTooltipTitle, StyledTooltip } from './LoanApyTooltip.style'; import { RewardsGroup } from './RewardsGroup'; type Props = { @@ -24,9 +24,9 @@ type Props = { type InheritAttrs = Omit; -type ApyTooltipProps = Props & InheritAttrs; +type LoanApyTooltipProps = Props & InheritAttrs; -const ApyTooltip = ({ +const LoanApyTooltip = ({ apy, currency, earnedInterest, @@ -36,7 +36,7 @@ const ApyTooltip = ({ prices, isBorrow, ...props -}: ApyTooltipProps): JSX.Element => { +}: LoanApyTooltipProps): JSX.Element => { const showEarnedRewards = !!rewards || !!earnedInterest; const label = ( @@ -75,5 +75,5 @@ const ApyTooltip = ({ return ; }; -export { ApyTooltip }; -export type { ApyTooltipProps }; +export { LoanApyTooltip }; +export type { LoanApyTooltipProps }; diff --git a/src/pages/Loans/LoansOverview/components/ApyTooltip/RewardsGroup.tsx b/src/components/LoanApyTooltip/RewardsGroup.tsx similarity index 94% rename from src/pages/Loans/LoansOverview/components/ApyTooltip/RewardsGroup.tsx rename to src/components/LoanApyTooltip/RewardsGroup.tsx index ef29a9ec59..dfeb949ccc 100644 --- a/src/pages/Loans/LoansOverview/components/ApyTooltip/RewardsGroup.tsx +++ b/src/components/LoanApyTooltip/RewardsGroup.tsx @@ -6,7 +6,7 @@ import { Dd, Dt } from '@/component-library'; import { getTokenPrice } from '@/utils/helpers/prices'; import { Prices } from '@/utils/hooks/api/use-get-prices'; -import { StyledApyTooltipGroup } from './ApyTooltip.style'; +import { StyledApyTooltipGroup } from './LoanApyTooltip.style'; type RewardsGroupProps = { rewards: MonetaryAmount; diff --git a/src/components/LoanApyTooltip/index.tsx b/src/components/LoanApyTooltip/index.tsx new file mode 100644 index 0000000000..062155f827 --- /dev/null +++ b/src/components/LoanApyTooltip/index.tsx @@ -0,0 +1,2 @@ +export type { LoanApyTooltipProps } from './LoanApyTooltip'; +export { LoanApyTooltip } from './LoanApyTooltip'; diff --git a/src/pages/Loans/LoansOverview/components/LoansBaseTable/ApyCell.tsx b/src/components/LoanPositionsTable/ApyCell.tsx similarity index 79% rename from src/pages/Loans/LoansOverview/components/LoansBaseTable/ApyCell.tsx rename to src/components/LoanPositionsTable/ApyCell.tsx index 7a4796dcec..7a0a7d0b4a 100644 --- a/src/pages/Loans/LoansOverview/components/LoansBaseTable/ApyCell.tsx +++ b/src/components/LoanPositionsTable/ApyCell.tsx @@ -3,12 +3,11 @@ import { MonetaryAmount } from '@interlay/monetary-js'; import Big from 'big.js'; import { Flex } from '@/component-library'; +import { getApyLabel, getSubsidyRewardApy } from '@/utils/helpers/loans'; import { Prices } from '@/utils/hooks/api/use-get-prices'; -import { getApyLabel } from '../../utils/apy'; -import { getSubsidyRewardApy } from '../../utils/get-subsidy-rewards-apy'; -import { ApyTooltip } from '../ApyTooltip'; -import { MonetaryCell } from './MonetaryCell'; +import { Cell } from '../DataGrid'; +import { LoanApyTooltip } from '../LoanApyTooltip'; type ApyCellProps = { apy: Big; @@ -40,9 +39,7 @@ const ApyCell = ({ const earnedAssetLabel = earnedAsset ? `${earnedAsset.toHuman(8)} ${earnedAsset.currency.ticker}` : undefined; - const children = ( - - ); + const children = ; if (!prices) { return children; @@ -51,7 +48,7 @@ const ApyCell = ({ // MEMO: wrapping around a Flex so tooltip is placed correctly return ( - {children} - + ); }; diff --git a/src/components/LoanPositionsTable/LoanPositionsTable.tsx b/src/components/LoanPositionsTable/LoanPositionsTable.tsx new file mode 100644 index 0000000000..5dd60b7919 --- /dev/null +++ b/src/components/LoanPositionsTable/LoanPositionsTable.tsx @@ -0,0 +1,153 @@ +import { BorrowPosition, CollateralPosition, LoanAsset, TickerToData } from '@interlay/interbtc-api'; +import { useId } from '@react-aria/utils'; +import { Key, ReactNode, useMemo } from 'react'; +import { useTranslation } from 'react-i18next'; + +import { convertMonetaryAmountToValueInUSD } from '@/common/utils/utils'; +import { Switch } from '@/component-library'; +import { LoanType } from '@/types/loans'; +import { getTokenPrice } from '@/utils/helpers/prices'; +import { useGetPrices } from '@/utils/hooks/api/use-get-prices'; + +import { AssetCell, BalanceCell, Table, TableProps } from '../DataGrid'; +import { ApyCell } from './ApyCell'; +import { LoanTablePlaceholder } from './LoanTablePlaceholder'; + +enum LoanPositionTableColumns { + ASSET = 'asset', + APY = 'apy', + AMOUNT = 'amount', + COLLATERAL = 'collateral' +} + +type LoanPositionTableRow = { + id: string; + [LoanPositionTableColumns.ASSET]: ReactNode; + [LoanPositionTableColumns.APY]: ReactNode; + [LoanPositionTableColumns.AMOUNT]: ReactNode; + [LoanPositionTableColumns.COLLATERAL]?: ReactNode; +}; + +type Props = { + variant?: LoanType; + title?: ReactNode; + assets: TickerToData; + positions: BorrowPosition[] | CollateralPosition[]; + onPressCollateralSwitch?: (ticker: string) => void; +}; + +type InheritAttrs = Omit; + +type LoanPositionsTableProps = Props & InheritAttrs; + +const LoanPositionsTable = ({ + variant = 'lend', + title, + assets, + positions, + onRowAction, + onPressCollateralSwitch, + ...props +}: LoanPositionsTableProps): JSX.Element | null => { + const titleId = useId(); + const { t } = useTranslation(); + const prices = useGetPrices(); + + const isLending = variant === 'lend'; + const showCollateral = !!onPressCollateralSwitch && isLending; + + const columns = useMemo(() => { + if (isLending) { + const lendingColumns = [ + { name: 'Asset', uid: LoanPositionTableColumns.ASSET }, + { name: 'APY / Earned', uid: LoanPositionTableColumns.APY }, + { name: 'Supplied', uid: LoanPositionTableColumns.AMOUNT } + ]; + + if (showCollateral) { + lendingColumns.push({ name: 'Collateral', uid: LoanPositionTableColumns.COLLATERAL }); + } + + return lendingColumns; + } + + return [ + { name: 'Asset', uid: LoanPositionTableColumns.ASSET }, + { name: 'APY / Accrued', uid: LoanPositionTableColumns.APY }, + { name: 'Borrowed', uid: LoanPositionTableColumns.AMOUNT } + ]; + }, [isLending, showCollateral]); + + const rows: LoanPositionTableRow[] = useMemo( + () => + positions.map(({ amount: amountProp, ...position }) => { + const { currency } = amountProp; + const asset = ; + + const { borrowApy, borrowReward, lendApy, lendReward } = assets[currency.ticker]; + + const apyCellProps = isLending + ? { apy: lendApy, rewards: lendReward } + : { + apy: borrowApy, + rewards: borrowReward, + accumulatedDebt: (position as BorrowPosition).accumulatedDebt, + isBorrow: true + }; + + const apy = ( + onRowAction?.(currency.ticker as Key)} + /> + ); + + const amountUSD = amountProp + ? convertMonetaryAmountToValueInUSD(amountProp, getTokenPrice(prices, currency.ticker)?.usd) + : 0; + + const amount = ( + + ); + + const collateral = showCollateral ? ( + onPressCollateralSwitch?.(currency.ticker)} + isSelected={(position as CollateralPosition).isCollateral} + aria-label={`toggle ${currency.ticker} collateral`} + /> + ) : undefined; + + return { + id: currency.ticker, + asset, + apy, + amount, + collateral + }; + }), + [assets, isLending, onPressCollateralSwitch, onRowAction, positions, prices, showCollateral] + ); + + return ( +
} + {...props} + /> + ); +}; + +export { LoanPositionsTable }; +export type { LoanPositionsTableProps }; diff --git a/src/components/LoanPositionsTable/LoanTablePlaceholder.tsx b/src/components/LoanPositionsTable/LoanTablePlaceholder.tsx new file mode 100644 index 0000000000..902a831b79 --- /dev/null +++ b/src/components/LoanPositionsTable/LoanTablePlaceholder.tsx @@ -0,0 +1,22 @@ +import { useTranslation } from 'react-i18next'; + +import { Flex, P, Strong } from '@/component-library'; +import { LoanType } from '@/types/loans'; + +type LoanTablePlaceholderProps = { + variant?: LoanType; +}; + +const LoanTablePlaceholder = ({ variant = 'lend' }: LoanTablePlaceholderProps): JSX.Element | null => { + const { t } = useTranslation(); + + return ( + + {t('loans.no_loan_positions', { loanType: variant })} +

{t('loans.your_loan_positions_will_show_here', { loanType: variant })}

+
+ ); +}; + +export { LoanTablePlaceholder }; +export type { LoanTablePlaceholderProps }; diff --git a/src/components/LoanPositionsTable/index.tsx b/src/components/LoanPositionsTable/index.tsx new file mode 100644 index 0000000000..32994089c7 --- /dev/null +++ b/src/components/LoanPositionsTable/index.tsx @@ -0,0 +1,4 @@ +export type { LoanPositionsTableProps } from './LoanPositionsTable'; +export { LoanPositionsTable } from './LoanPositionsTable'; +export type { LoanTablePlaceholderProps } from './LoanTablePlaceholder'; +export { LoanTablePlaceholder } from './LoanTablePlaceholder'; diff --git a/src/pages/AMM/Pools/components/PoolsTables/PoolsTable.tsx b/src/components/PoolsTable/PoolsTable.tsx similarity index 65% rename from src/pages/AMM/Pools/components/PoolsTables/PoolsTable.tsx rename to src/components/PoolsTable/PoolsTable.tsx index d7986e77ad..3285d3ca5c 100644 --- a/src/pages/AMM/Pools/components/PoolsTables/PoolsTable.tsx +++ b/src/components/PoolsTable/PoolsTable.tsx @@ -1,18 +1,18 @@ import { LiquidityPool, LpCurrency } from '@interlay/interbtc-api'; import { MonetaryAmount } from '@interlay/monetary-js'; +import { useId } from '@react-aria/utils'; import { ReactNode, useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { formatPercentage, formatUSD } from '@/common/utils/utils'; import { calculateAccountLiquidityUSD, calculateTotalLiquidityUSD } from '@/pages/AMM/shared/utils'; +import { getCoinIconProps } from '@/utils/helpers/coin-icon'; +import { getFarmingApr } from '@/utils/helpers/pools'; import { useGetPrices } from '@/utils/hooks/api/use-get-prices'; -import { PoolName } from '../PoolName'; -import { BalanceCell, PoolsBaseTable, PoolsBaseTableProps } from '../PoolsBaseTable'; -import { MonetaryCell } from '../PoolsBaseTable/MonetaryCell'; -import { getFarmingApr } from './utils'; +import { AssetCell, BalanceCell, Cell, Table, TableProps } from '../DataGrid'; -enum BorrowAssetsColumns { +enum PoolsTableColumns { POOL_NAME = 'poolName', APR = 'apr', TOTAL_LIQUIDITY = 'totalLiquidity', @@ -22,57 +22,54 @@ enum BorrowAssetsColumns { type PoolsTableRow = { id: string; - [BorrowAssetsColumns.POOL_NAME]: ReactNode; - [BorrowAssetsColumns.APR]: ReactNode; - [BorrowAssetsColumns.TOTAL_LIQUIDITY]: ReactNode; - // [BorrowAssetsColumns.SEVEN_DAY_VOLUME]: ReactNode; - [BorrowAssetsColumns.ACCOUNT_LIQUIDITY]?: ReactNode; + [PoolsTableColumns.POOL_NAME]: ReactNode; + [PoolsTableColumns.APR]: ReactNode; + [PoolsTableColumns.TOTAL_LIQUIDITY]: ReactNode; + // [PoolsTableColumns.SEVEN_DAY_VOLUME]: ReactNode; + [PoolsTableColumns.ACCOUNT_LIQUIDITY]?: ReactNode; }; type PoolsTableProps = { variant: 'available-pools' | 'account-pools'; pools: Array<{ data: LiquidityPool; amount?: MonetaryAmount }>; - onRowAction: PoolsBaseTableProps['onRowAction']; + onRowAction?: TableProps['onRowAction']; + title?: ReactNode; }; -const PoolsTable = ({ variant, pools, onRowAction }: PoolsTableProps): JSX.Element => { +const PoolsTable = ({ variant, pools, onRowAction, title }: PoolsTableProps): JSX.Element => { const { t } = useTranslation(); const prices = useGetPrices(); + const titleId = useId(); const isAccountPools = variant === 'account-pools'; const commonColumns = [ - { name: t('amm.pools.pool_name'), uid: BorrowAssetsColumns.POOL_NAME }, - { name: t('apr'), uid: BorrowAssetsColumns.APR }, - { name: t('total_liquidity'), uid: BorrowAssetsColumns.TOTAL_LIQUIDITY } - // { name: t('7_day_volume'), uid: BorrowAssetsColumns.SEVEN_DAY_VOLUME } + { name: t('amm.pools.pool_name'), uid: PoolsTableColumns.POOL_NAME }, + { name: t('apr'), uid: PoolsTableColumns.APR }, + { name: t('total_liquidity'), uid: PoolsTableColumns.TOTAL_LIQUIDITY } + // { name: t('7_day_volume'), uid: PoolsTableColumns.SEVEN_DAY_VOLUME } ]; const borrowAssetsColumns = isAccountPools - ? [...commonColumns, { name: t('my_liquidity'), uid: BorrowAssetsColumns.ACCOUNT_LIQUIDITY }] + ? [...commonColumns, { name: t('my_liquidity'), uid: PoolsTableColumns.ACCOUNT_LIQUIDITY }] : commonColumns; const rows: PoolsTableRow[] = useMemo( () => pools.map(({ data, amount: accountLPTokenAmount }) => { const { pooledCurrencies, lpToken, rewardAmountsYearly, totalSupply } = data; - const poolName = ( - pooledCurrencies.currency.ticker)} - /> - ); + const poolName = ; const totalLiquidityUSD = calculateTotalLiquidityUSD(pooledCurrencies, prices); const farmingApr = getFarmingApr(rewardAmountsYearly, totalSupply, totalLiquidityUSD, prices); // TODO: add also APR from trading volume based on squid data const aprAmount = farmingApr; - const apr = ; + const apr = ; // TODO: revert alignItems prop when `sevenDayVolume` is adressed const totalLiquidity = ( - @@ -103,8 +100,9 @@ const PoolsTable = ({ variant, pools, onRowAction }: PoolsTableProps): JSX.Eleme ); return ( - { + const query = useQueryParams(); + const { bridgeLoaded } = useSelector((state: StoreType) => state.general); + const { data: liquidityPools, refetch } = useGetLiquidityPools(); - const [pair, setPair] = useState({ input: RELAY_CHAIN_NATIVE_TOKEN }); + const { data, getCurrencyFromTicker } = useGetCurrencies(bridgeLoaded); + + const [pair, setPair] = useState(DEFAULT_PAIR); + + const pooledTickers = useMemo(() => liquidityPools && getPooledTickers(liquidityPools), [liquidityPools]); + + useEffect(() => { + if (!pooledTickers || !data) return; + + const inputQuery = query.get(QUERY_PARAMETERS.SWAP.FROM); + const outputQuery = query.get(QUERY_PARAMETERS.SWAP.TO); + + const fromCurrency = inputQuery ? getCurrencyFromTicker(inputQuery) : DEFAULT_PAIR.input; + const toCurrency = outputQuery ? getCurrencyFromTicker(outputQuery) : DEFAULT_PAIR.output; + + setPair({ input: fromCurrency, output: toCurrency }); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [pooledTickers, data]); - if (liquidityPools === undefined) { + if (liquidityPools === undefined || pooledTickers === undefined) { return ; } @@ -29,7 +57,13 @@ const Swap = (): JSX.Element => { return ( - + {pair.input && pair.output && liquidityPool && ( )} diff --git a/src/pages/AMM/Swap/components/SwapForm/SwapForm.tsx b/src/pages/AMM/Swap/components/SwapForm/SwapForm.tsx index ec5eaf9e11..06d2b17131 100644 --- a/src/pages/AMM/Swap/components/SwapForm/SwapForm.tsx +++ b/src/pages/AMM/Swap/components/SwapForm/SwapForm.tsx @@ -81,13 +81,6 @@ const getPoolPriceImpact = (trade: Trade | null | undefined, inputAmountUSD: num : new Big(0) }); -const getPooledTickers = (liquidityPools: LiquidityPool[]): Set => - liquidityPools.reduce((acc, pool) => { - pool.pooledCurrencies.forEach((curr) => acc.add(curr.currency.ticker)); - - return acc; - }, new Set()); - type SwapData = { trade: Trade; minimumAmountOut: MonetaryAmount; @@ -102,6 +95,7 @@ type Props = { pair: SwapPair; liquidityPools: LiquidityPool[]; onChangePair: (pair: SwapPair) => void; + pooledTickers: Set; onSwap: () => void; }; @@ -109,7 +103,14 @@ type InheritAttrs = CardProps & Props; type SwapFormProps = Props & InheritAttrs; -const SwapForm = ({ pair, liquidityPools, onChangePair, onSwap, ...props }: SwapFormProps): JSX.Element | null => { +const SwapForm = ({ + pair, + liquidityPools, + pooledTickers, + onChangePair, + onSwap, + ...props +}: SwapFormProps): JSX.Element | null => { const [slippage, setSlippage] = useState(0.1); const [inputAmount, setInputAmount] = useState(); const [trade, setTrade] = useState(); @@ -276,8 +277,6 @@ const SwapForm = ({ pair, liquidityPools, onChangePair, onSwap, ...props }: Swap form.values[SWAP_INPUT_AMOUNT_FIELD] ); - const pooledTickers = useMemo(() => getPooledTickers(liquidityPools), [liquidityPools]); - const tokens: TokenInputProps['tokens'] = useMemo( () => currencies @@ -306,7 +305,7 @@ const SwapForm = ({ pair, liquidityPools, onChangePair, onSwap, ...props }: Swap

Swap

- + setSlippage(slippage)} />
diff --git a/src/pages/Loans/LoansOverview/components/ApyTooltip/index.tsx b/src/pages/Loans/LoansOverview/components/ApyTooltip/index.tsx deleted file mode 100644 index 97b1e1d6b0..0000000000 --- a/src/pages/Loans/LoansOverview/components/ApyTooltip/index.tsx +++ /dev/null @@ -1,2 +0,0 @@ -export type { ApyTooltipProps } from './ApyTooltip'; -export { ApyTooltip } from './ApyTooltip'; diff --git a/src/pages/Loans/LoansOverview/components/BorrowAssetsTable/BorrowAssetsTable.style.tsx b/src/pages/Loans/LoansOverview/components/BorrowAssetsTable/BorrowAssetsTable.style.tsx index ae13b2a0f3..06638f5074 100644 --- a/src/pages/Loans/LoansOverview/components/BorrowAssetsTable/BorrowAssetsTable.style.tsx +++ b/src/pages/Loans/LoansOverview/components/BorrowAssetsTable/BorrowAssetsTable.style.tsx @@ -1,9 +1,10 @@ import styled from 'styled-components'; -import { LoansBaseTable } from '../LoansBaseTable'; +import { AssetCell } from '@/components'; -const StyledBorrowAssetsTable = styled(LoansBaseTable)` - grid-area: borrow-assets-table; +const StyledAssetCell = styled(AssetCell)` + // Needs a specific rem so that row size matches on both lending and borrow tables + padding: 0.5625rem 0; `; -export { StyledBorrowAssetsTable }; +export { StyledAssetCell }; diff --git a/src/pages/Loans/LoansOverview/components/BorrowAssetsTable/BorrowAssetsTable.tsx b/src/pages/Loans/LoansOverview/components/BorrowAssetsTable/BorrowAssetsTable.tsx index 4a2352f435..e81e132de8 100644 --- a/src/pages/Loans/LoansOverview/components/BorrowAssetsTable/BorrowAssetsTable.tsx +++ b/src/pages/Loans/LoansOverview/components/BorrowAssetsTable/BorrowAssetsTable.tsx @@ -1,13 +1,16 @@ import { LoanAsset, TickerToData } from '@interlay/interbtc-api'; +import { useId } from '@react-aria/utils'; import { Key, ReactNode, useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { convertMonetaryAmountToValueInUSD, formatUSD } from '@/common/utils/utils'; +import { Cell, Table, TableProps } from '@/components'; +import { ApyCell } from '@/components/LoanPositionsTable/ApyCell'; +import { LoanTablePlaceholder } from '@/components/LoanPositionsTable/LoanTablePlaceholder'; import { getTokenPrice } from '@/utils/helpers/prices'; import { useGetPrices } from '@/utils/hooks/api/use-get-prices'; -import { ApyCell, AssetCell, LoansBaseTable, LoansBaseTableProps } from '../LoansBaseTable'; -import { MonetaryCell } from '../LoansBaseTable/MonetaryCell'; +import { StyledAssetCell } from './BorrowAssetsTable.style'; enum BorrowAssetsColumns { ASSET = 'asset', @@ -32,20 +35,23 @@ const borrowAssetsColumns = [ { name: 'Total Borrowed', uid: BorrowAssetsColumns.TOTAL_BORROWED } ]; -type BorrowAssetsTableProps = { +type Props = { assets: TickerToData; - onRowAction: LoansBaseTableProps['onRowAction']; - disabledKeys: LoansBaseTableProps['disabledKeys']; }; -const BorrowAssetsTable = ({ assets, onRowAction, disabledKeys }: BorrowAssetsTableProps): JSX.Element => { +type InheritAttrs = Omit; + +type BorrowAssetsTableProps = Props & InheritAttrs; + +const BorrowAssetsTable = ({ assets, onRowAction, ...props }: BorrowAssetsTableProps): JSX.Element => { + const titleId = useId(); const { t } = useTranslation(); const prices = useGetPrices(); const rows: BorrowAssetsTableRow[] = useMemo( () => Object.values(assets).map(({ borrowApy, currency, availableCapacity, borrowReward, totalBorrows }) => { - const asset = ; + const asset = ; const apy = ( ; + const capacity = ; const totalBorrowsUSD = convertMonetaryAmountToValueInUSD( totalBorrows, getTokenPrice(prices, totalBorrows.currency.ticker)?.usd ); - const totalBorrowed = ( - - ); + const totalBorrowed = ; return { id: currency.ticker, @@ -85,12 +89,14 @@ const BorrowAssetsTable = ({ assets, onRowAction, disabledKeys }: BorrowAssetsTa ); return ( - } + onRowAction={onRowAction} /> ); }; diff --git a/src/pages/Loans/LoansOverview/components/BorrowPositionsTable/BorrowPositionsTable.style.tsx b/src/pages/Loans/LoansOverview/components/BorrowPositionsTable/BorrowPositionsTable.style.tsx deleted file mode 100644 index 12e1c04b7c..0000000000 --- a/src/pages/Loans/LoansOverview/components/BorrowPositionsTable/BorrowPositionsTable.style.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import styled from 'styled-components'; - -import { LoansBaseTable } from '../LoansBaseTable'; - -const StyledBorrowPositionsTable = styled(LoansBaseTable)` - grid-area: borrow-positions-table; -`; - -export { StyledBorrowPositionsTable }; diff --git a/src/pages/Loans/LoansOverview/components/BorrowPositionsTable/BorrowPositionsTable.tsx b/src/pages/Loans/LoansOverview/components/BorrowPositionsTable/BorrowPositionsTable.tsx deleted file mode 100644 index c5063b11a2..0000000000 --- a/src/pages/Loans/LoansOverview/components/BorrowPositionsTable/BorrowPositionsTable.tsx +++ /dev/null @@ -1,93 +0,0 @@ -import { BorrowPosition, LoanAsset, TickerToData } from '@interlay/interbtc-api'; -import { Key, ReactNode, useMemo } from 'react'; -import { useTranslation } from 'react-i18next'; - -import { useGetPrices } from '@/utils/hooks/api/use-get-prices'; - -import { ApyCell, AssetCell, BalanceCell, LoansBaseTableProps } from '../LoansBaseTable'; -import { StyledBorrowPositionsTable } from './BorrowPositionsTable.style'; - -enum BorrowPositionColumns { - ASSET = 'asset', - APY_ACCRUED = 'apy-accrued', - BORROWED = 'borrowed' -} - -type BorrowPositionTableRow = { - id: string; - [BorrowPositionColumns.ASSET]: ReactNode; - [BorrowPositionColumns.APY_ACCRUED]: ReactNode; - [BorrowPositionColumns.BORROWED]: ReactNode; -}; - -// TODO: translations -const borrowPositionColumns = [ - { name: 'Asset', uid: BorrowPositionColumns.ASSET }, - { name: 'APY / Accrued', uid: BorrowPositionColumns.APY_ACCRUED }, - { name: 'Borrowed', uid: BorrowPositionColumns.BORROWED } -]; - -type BorrowPositionsTableProps = { - assets: TickerToData; - positions: BorrowPosition[]; - onRowAction: LoansBaseTableProps['onRowAction']; - disabledKeys: LoansBaseTableProps['disabledKeys']; -}; - -const BorrowPositionsTable = ({ - assets, - positions, - onRowAction, - disabledKeys -}: BorrowPositionsTableProps): JSX.Element | null => { - const { t } = useTranslation(); - const prices = useGetPrices(); - - const rows: BorrowPositionTableRow[] = useMemo( - () => - positions.map(({ amount, accumulatedDebt }) => { - const { currency } = amount; - const asset = ; - - const { borrowApy, borrowReward } = assets[currency.ticker]; - - const apy = ( - onRowAction?.(currency.ticker as Key)} - /> - ); - - const borrowed = ; - - return { - id: currency.ticker, - asset, - 'apy-accrued': apy, - borrowed - }; - }), - [assets, onRowAction, positions, prices] - ); - - return ( - - ); -}; - -export { BorrowPositionsTable }; -export type { BorrowPositionsTableProps }; diff --git a/src/pages/Loans/LoansOverview/components/BorrowPositionsTable/index.tsx b/src/pages/Loans/LoansOverview/components/BorrowPositionsTable/index.tsx deleted file mode 100644 index eb933b0b23..0000000000 --- a/src/pages/Loans/LoansOverview/components/BorrowPositionsTable/index.tsx +++ /dev/null @@ -1,2 +0,0 @@ -export type { BorrowPositionsTableProps } from './BorrowPositionsTable'; -export { BorrowPositionsTable } from './BorrowPositionsTable'; diff --git a/src/pages/Loans/LoansOverview/components/LendAssetsTable/LendAssetsTable.style.tsx b/src/pages/Loans/LoansOverview/components/LendAssetsTable/LendAssetsTable.style.tsx deleted file mode 100644 index ddf6e1003f..0000000000 --- a/src/pages/Loans/LoansOverview/components/LendAssetsTable/LendAssetsTable.style.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import styled from 'styled-components'; - -import { LoansBaseTable } from '../LoansBaseTable'; - -const StyledLendAssetsTable = styled(LoansBaseTable)` - grid-area: lend-assets-table; -`; - -export { StyledLendAssetsTable }; diff --git a/src/pages/Loans/LoansOverview/components/LendAssetsTable/LendAssetsTable.tsx b/src/pages/Loans/LoansOverview/components/LendAssetsTable/LendAssetsTable.tsx index 8e0ab18413..c9223ba7f5 100644 --- a/src/pages/Loans/LoansOverview/components/LendAssetsTable/LendAssetsTable.tsx +++ b/src/pages/Loans/LoansOverview/components/LendAssetsTable/LendAssetsTable.tsx @@ -1,16 +1,16 @@ import { LoanAsset, newMonetaryAmount, TickerToData } from '@interlay/interbtc-api'; +import { useId } from '@react-aria/utils'; import { Key, ReactNode, useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { convertMonetaryAmountToValueInUSD, formatUSD } from '@/common/utils/utils'; +import { AssetCell, BalanceCell, Cell, Table, TableProps } from '@/components'; +import { ApyCell } from '@/components/LoanPositionsTable/ApyCell'; +import { LoanTablePlaceholder } from '@/components/LoanPositionsTable/LoanTablePlaceholder'; import { getTokenPrice } from '@/utils/helpers/prices'; import { useGetBalances } from '@/utils/hooks/api/tokens/use-get-balances'; import { useGetPrices } from '@/utils/hooks/api/use-get-prices'; -import { ApyCell, AssetCell, BalanceCell, LoansBaseTableProps } from '../LoansBaseTable'; -import { MonetaryCell } from '../LoansBaseTable/MonetaryCell'; -import { StyledLendAssetsTable } from './LendAssetsTable.style'; - enum LendAssetsColumns { ASSET = 'asset', APY = 'apy', @@ -34,13 +34,16 @@ const lendAssetsColumns = [ { name: 'Total Supplied', uid: LendAssetsColumns.TOTAL_SUPPLY } ]; -type LendAssetsTableProps = { +type Props = { assets: TickerToData; - onRowAction: LoansBaseTableProps['onRowAction']; - disabledKeys: LoansBaseTableProps['disabledKeys']; }; -const LendAssetsTable = ({ assets, onRowAction, disabledKeys }: LendAssetsTableProps): JSX.Element => { +type InheritAttrs = Omit; + +type LendAssetsTableProps = Props & InheritAttrs; + +const LendAssetsTable = ({ assets, onRowAction, ...props }: LendAssetsTableProps): JSX.Element => { + const titleId = useId(); const { t } = useTranslation(); const prices = useGetPrices(); const { data: balances } = useGetBalances(); @@ -48,7 +51,7 @@ const LendAssetsTable = ({ assets, onRowAction, disabledKeys }: LendAssetsTableP const rows: LendAssetsTableRow[] = useMemo( () => Object.values(assets).map(({ lendApy, lendReward, currency, totalLiquidity }) => { - const asset = ; + const asset = ; const apy = ( ; + const amountUSD = convertMonetaryAmountToValueInUSD(amount, getTokenPrice(prices, amount.currency.ticker)?.usd); + const wallet = ; const liquidityUSDValue = convertMonetaryAmountToValueInUSD( totalLiquidity, getTokenPrice(prices, totalLiquidity.currency.ticker)?.usd ); const liquidityLabel = liquidityUSDValue || 0; - const totalSupply = ; + const totalSupply = ; return { id: currency.ticker, @@ -83,12 +87,14 @@ const LendAssetsTable = ({ assets, onRowAction, disabledKeys }: LendAssetsTableP ); return ( - } + onRowAction={onRowAction} /> ); }; diff --git a/src/pages/Loans/LoansOverview/components/LendPositionsTable/LendPositionsTable.style.tsx b/src/pages/Loans/LoansOverview/components/LendPositionsTable/LendPositionsTable.style.tsx deleted file mode 100644 index 7e107da92a..0000000000 --- a/src/pages/Loans/LoansOverview/components/LendPositionsTable/LendPositionsTable.style.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import styled from 'styled-components'; - -import { LoansBaseTable } from '../LoansBaseTable'; - -const StyledLendPositionsTable = styled(LoansBaseTable)` - grid-area: lend-positions-table; -`; - -export { StyledLendPositionsTable }; diff --git a/src/pages/Loans/LoansOverview/components/LendPositionsTable/LendPositionsTable.tsx b/src/pages/Loans/LoansOverview/components/LendPositionsTable/LendPositionsTable.tsx deleted file mode 100644 index 84b1dadf26..0000000000 --- a/src/pages/Loans/LoansOverview/components/LendPositionsTable/LendPositionsTable.tsx +++ /dev/null @@ -1,106 +0,0 @@ -import { CollateralPosition, LoanAsset, TickerToData } from '@interlay/interbtc-api'; -import { Key, ReactNode, useMemo } from 'react'; -import { useTranslation } from 'react-i18next'; - -import { Switch } from '@/component-library'; -import { useGetPrices } from '@/utils/hooks/api/use-get-prices'; - -import { ApyCell, AssetCell, BalanceCell, LoansBaseTableProps } from '../LoansBaseTable'; -import { StyledLendPositionsTable } from './LendPositionsTable.style'; - -enum LendPositionColumns { - ASSET = 'asset', - APY_EARNED = 'apy-earned', - SUPPLIED = 'supplied', - COLLATERAL = 'collateral' -} - -type LendPositionTableRow = { - id: string; - [LendPositionColumns.ASSET]: ReactNode; - [LendPositionColumns.APY_EARNED]: ReactNode; - [LendPositionColumns.SUPPLIED]: ReactNode; - [LendPositionColumns.COLLATERAL]: ReactNode; -}; - -// TODO: translations -const lendPositionColumns = [ - { name: 'Asset', uid: LendPositionColumns.ASSET }, - { name: 'APY / Earned', uid: LendPositionColumns.APY_EARNED }, - { name: 'Supplied', uid: LendPositionColumns.SUPPLIED }, - { name: 'Collateral', uid: LendPositionColumns.COLLATERAL } -]; - -type LendPositionsTableProps = { - assets: TickerToData; - positions: CollateralPosition[]; - onRowAction: LoansBaseTableProps['onRowAction']; - onPressCollateralSwitch: (ticker: string) => void; - disabledKeys: LoansBaseTableProps['disabledKeys']; -}; - -const LendPositionsTable = ({ - assets, - positions, - onRowAction, - onPressCollateralSwitch, - disabledKeys -}: LendPositionsTableProps): JSX.Element | null => { - const { t } = useTranslation(); - const prices = useGetPrices(); - - const rows: LendPositionTableRow[] = useMemo( - () => - positions.map(({ amount, isCollateral }) => { - const { currency } = amount; - const asset = ; - - const { lendApy, lendReward } = assets[currency.ticker]; - - const apy = ( - onRowAction?.(currency.ticker as Key)} - /> - ); - - const supplied = ; - - const collateral = ( - onPressCollateralSwitch(currency.ticker)} - isSelected={isCollateral} - aria-label={`toggle ${currency.ticker} collateral`} - /> - ); - - return { - id: currency.ticker, - asset, - 'apy-earned': apy, - supplied, - collateral - }; - }), - [assets, onPressCollateralSwitch, onRowAction, positions, prices] - ); - - return ( - - ); -}; - -export { LendPositionsTable }; -export type { LendPositionsTableProps }; diff --git a/src/pages/Loans/LoansOverview/components/LendPositionsTable/index.tsx b/src/pages/Loans/LoansOverview/components/LendPositionsTable/index.tsx deleted file mode 100644 index 882ab0d004..0000000000 --- a/src/pages/Loans/LoansOverview/components/LendPositionsTable/index.tsx +++ /dev/null @@ -1,2 +0,0 @@ -export type { LendPositionsTableProps } from './LendPositionsTable'; -export { LendPositionsTable } from './LendPositionsTable'; diff --git a/src/pages/Loans/LoansOverview/components/LoanActionInfo/LoanGroup.tsx b/src/pages/Loans/LoansOverview/components/LoanActionInfo/LoanGroup.tsx index d60dd73ccd..dbd6c7db93 100644 --- a/src/pages/Loans/LoansOverview/components/LoanActionInfo/LoanGroup.tsx +++ b/src/pages/Loans/LoansOverview/components/LoanActionInfo/LoanGroup.tsx @@ -2,9 +2,9 @@ import { LoanAsset } from '@interlay/interbtc-api'; import { Dd, DlGroup, Dt } from '@/component-library'; import { LoanAction } from '@/types/loans'; +import { getApyLabel } from '@/utils/helpers/loans'; import { Prices } from '@/utils/hooks/api/use-get-prices'; -import { getApyLabel } from '../../utils/apy'; import { RewardsGroup } from './RewardsGroup'; type LoanGroupProps = { diff --git a/src/pages/Loans/LoansOverview/components/LoanActionInfo/RewardsGroup.tsx b/src/pages/Loans/LoansOverview/components/LoanActionInfo/RewardsGroup.tsx index ec6f3b4a89..29164ddbc2 100644 --- a/src/pages/Loans/LoansOverview/components/LoanActionInfo/RewardsGroup.tsx +++ b/src/pages/Loans/LoansOverview/components/LoanActionInfo/RewardsGroup.tsx @@ -3,11 +3,9 @@ import { MonetaryAmount } from '@interlay/monetary-js'; import Big from 'big.js'; import { Dd, DlGroup, Dt } from '@/component-library'; +import { getApyLabel, getSubsidyRewardApy } from '@/utils/helpers/loans'; import { Prices } from '@/utils/hooks/api/use-get-prices'; -import { getApyLabel } from '../../utils/apy'; -import { getSubsidyRewardApy } from '../../utils/get-subsidy-rewards-apy'; - type RewardsGroupProps = { apy: Big; rewards: MonetaryAmount; diff --git a/src/pages/Loans/LoansOverview/components/LoansBaseTable/AssetCell.tsx b/src/pages/Loans/LoansOverview/components/LoansBaseTable/AssetCell.tsx deleted file mode 100644 index 0a1c55424b..0000000000 --- a/src/pages/Loans/LoansOverview/components/LoansBaseTable/AssetCell.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { CoinIcon } from '@/component-library'; - -import { StyledAssetCellWrapper, StyledCellLabel } from './LoansBaseTable.style'; - -type AssetCellProps = { - currency: string; - hasPadding?: boolean; -}; - -const AssetCell = ({ currency, hasPadding }: AssetCellProps): JSX.Element => ( - - - {currency} - -); - -export { AssetCell }; -export type { AssetCellProps }; diff --git a/src/pages/Loans/LoansOverview/components/LoansBaseTable/BalanceCell.tsx b/src/pages/Loans/LoansOverview/components/LoansBaseTable/BalanceCell.tsx deleted file mode 100644 index b1294c4c11..0000000000 --- a/src/pages/Loans/LoansOverview/components/LoansBaseTable/BalanceCell.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { CurrencyExt } from '@interlay/interbtc-api'; -import { MonetaryAmount } from '@interlay/monetary-js'; - -import { displayMonetaryAmountInUSDFormat } from '@/common/utils/utils'; -import { AlignItems } from '@/component-library'; -import { getTokenPrice } from '@/utils/helpers/prices'; -import { Prices } from '@/utils/hooks/api/use-get-prices'; - -import { MonetaryCell } from './MonetaryCell'; - -type BalanceCellProps = { - amount: MonetaryAmount; - prices?: Prices; - alignItems?: AlignItems; -}; - -const BalanceCell = ({ amount, prices, alignItems }: BalanceCellProps): JSX.Element => { - const assetBalanceUSD = displayMonetaryAmountInUSDFormat(amount, getTokenPrice(prices, amount.currency.ticker)?.usd); - - return ( - - ); -}; - -export { BalanceCell }; -export type { BalanceCellProps }; diff --git a/src/pages/Loans/LoansOverview/components/LoansBaseTable/LoanStatusTag.tsx b/src/pages/Loans/LoansOverview/components/LoansBaseTable/LoanStatusTag.tsx deleted file mode 100644 index 5ca21af28d..0000000000 --- a/src/pages/Loans/LoansOverview/components/LoansBaseTable/LoanStatusTag.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { HTMLAttributes } from 'react'; - -import { Status } from '@/component-library'; - -import { StyledTag } from './LoansBaseTable.style'; - -type Props = { - status: Status; -}; - -type NativeAttrs = Omit, keyof Props>; - -type StatusTagProps = Props & NativeAttrs; - -const StatusTag = ({ status, children, ...props }: StatusTagProps): JSX.Element => ( - - {children} - -); - -export { StatusTag }; -export type { StatusTagProps }; diff --git a/src/pages/Loans/LoansOverview/components/LoansBaseTable/LoansBaseTable.style.tsx b/src/pages/Loans/LoansOverview/components/LoansBaseTable/LoansBaseTable.style.tsx deleted file mode 100644 index 74b78a964c..0000000000 --- a/src/pages/Loans/LoansOverview/components/LoansBaseTable/LoansBaseTable.style.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import styled from 'styled-components'; - -import { Flex, H2, Span, Status, theme } from '@/component-library'; - -type StyledAssetCellWrapperProps = { - $hasPadding?: boolean; -}; - -const StyledTitle = styled(H2)` - font-size: ${theme.text.xl}; - font-weight: ${theme.fontWeight.bold}; -`; - -const StyledCellLabel = styled(Span)` - font-weight: ${theme.fontWeight.bold}; - font-size: ${theme.text.s}; - display: inline-flex; - gap: ${theme.spacing.spacing1}; - align-items: baseline; -`; - -const StyledCellTickerLabel = styled(Span)` - font-size: ${theme.text.xs}; -`; - -const StyledCellSubLabel = styled(Span)` - font-size: ${theme.text.xs}; -`; - -type StyledChipProps = { - $variant: Status; -}; - -const StyledTag = styled.div` - display: inline-flex; - font-size: ${theme.text.xs}; - padding: ${theme.spacing.spacing1} ${theme.spacing.spacing2}; - border-radius: ${theme.rounded.full}; - border: ${theme.border.default}; - border-color: ${(props) => theme.transaction.status.color[props.$variant]}; - background-color: ${(props) => theme.transaction.status.bg[props.$variant]}; -`; - -const StyledAssetCellWrapper = styled(Flex)` - // Needs a specific rem so that row size matches on both lending and borrow tables - padding: ${({ $hasPadding }) => $hasPadding && `0.5625rem 0`}; -`; - -export { StyledAssetCellWrapper, StyledCellLabel, StyledCellSubLabel, StyledCellTickerLabel, StyledTag, StyledTitle }; diff --git a/src/pages/Loans/LoansOverview/components/LoansBaseTable/LoansBaseTable.tsx b/src/pages/Loans/LoansOverview/components/LoansBaseTable/LoansBaseTable.tsx deleted file mode 100644 index d660e48a60..0000000000 --- a/src/pages/Loans/LoansOverview/components/LoansBaseTable/LoansBaseTable.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import { useId } from '@react-aria/utils'; - -import { Card, Flex, P, Strong, Table, TableProps } from '@/component-library'; - -import { StyledTitle } from './LoansBaseTable.style'; - -type Props = { - title: string; - emptyTitle?: string; - emptyDescription?: string; - className?: string; -}; - -type InheritAttrs = Omit; - -type LoansBaseTableProps = Props & InheritAttrs; - -const LoansBaseTable = ({ - title, - rows, - columns, - emptyTitle, - emptyDescription, - className, - ...props -}: LoansBaseTableProps): JSX.Element => { - const titleId = useId(); - - const hasRows = !!rows.length; - - return ( - - {title} - {hasRows ? ( - -
- - ) : ( - - - {emptyTitle} -

{emptyDescription}

-
-
- )} - - ); -}; - -export { LoansBaseTable }; -export type { LoansBaseTableProps }; diff --git a/src/pages/Loans/LoansOverview/components/LoansBaseTable/MonetaryCell.tsx b/src/pages/Loans/LoansOverview/components/LoansBaseTable/MonetaryCell.tsx deleted file mode 100644 index b9b3f97d26..0000000000 --- a/src/pages/Loans/LoansOverview/components/LoansBaseTable/MonetaryCell.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import { forwardRef } from 'react'; - -import { AlignItems, Colors, Flex, FlexProps } from '@/component-library'; - -import { StyledCellLabel, StyledCellSubLabel } from './LoansBaseTable.style'; - -type Props = { - label?: string; - sublabel?: string; - labelColor?: Colors; - alignItems?: AlignItems; -}; - -type InheritAttrs = Omit; - -type MonetaryCellProps = Props & InheritAttrs; - -const MonetaryCell = forwardRef( - ({ label, sublabel, labelColor, alignItems, ...props }, ref): JSX.Element => ( - - {label} - {sublabel && {sublabel}} - - ) -); - -MonetaryCell.displayName = 'MonetaryCell'; - -export { MonetaryCell }; -export type { MonetaryCellProps }; diff --git a/src/pages/Loans/LoansOverview/components/LoansBaseTable/index.tsx b/src/pages/Loans/LoansOverview/components/LoansBaseTable/index.tsx deleted file mode 100644 index d331777994..0000000000 --- a/src/pages/Loans/LoansOverview/components/LoansBaseTable/index.tsx +++ /dev/null @@ -1,8 +0,0 @@ -export type { ApyCellProps } from './ApyCell'; -export { ApyCell } from './ApyCell'; -export type { AssetCellProps } from './AssetCell'; -export { AssetCell } from './AssetCell'; -export type { BalanceCellProps } from './BalanceCell'; -export { BalanceCell } from './BalanceCell'; -export type { LoansBaseTableProps } from './LoansBaseTable'; -export { LoansBaseTable } from './LoansBaseTable'; diff --git a/src/pages/Loans/LoansOverview/components/LoansTables/BorrowTables.tsx b/src/pages/Loans/LoansOverview/components/LoansTables/BorrowTables.tsx index 397514b3c3..19e5dd4b65 100644 --- a/src/pages/Loans/LoansOverview/components/LoansTables/BorrowTables.tsx +++ b/src/pages/Loans/LoansOverview/components/LoansTables/BorrowTables.tsx @@ -2,9 +2,8 @@ import { BorrowPosition, LoanAsset, TickerToData } from '@interlay/interbtc-api' import { Key, useState } from 'react'; import { getPosition } from '../../utils/get-position'; -import { BorrowAssetsTable } from '../BorrowAssetsTable'; -import { BorrowPositionsTable } from '../BorrowPositionsTable'; import { LoanModal } from '../LoanModal'; +import { StyledBorrowAssetsTable, StyledBorrowPositionsTable } from './LoansTables.style'; type UseAssetState = { data?: LoanAsset; @@ -35,14 +34,15 @@ const BorrowTables = ({ assets, positions, disabledAssets, hasPositions }: Borro return ( <> {hasPositions && ( - )} - + {hasPositions && ( - )} - + ` } `; -export { StyledTablesWrapper }; +export { + StyledBorrowAssetsTable, + StyledBorrowPositionsTable, + StyledLendAssetsTable, + StyledLendPositionsTable, + StyledTablesWrapper +}; diff --git a/src/pages/Vaults/VaultsOverview/components/CreateVaultWizard/DespositCollateralStep.tsx b/src/pages/Vaults/VaultsOverview/components/CreateVaultWizard/DespositCollateralStep.tsx index bbdd8c6914..b7df987d1c 100644 --- a/src/pages/Vaults/VaultsOverview/components/CreateVaultWizard/DespositCollateralStep.tsx +++ b/src/pages/Vaults/VaultsOverview/components/CreateVaultWizard/DespositCollateralStep.tsx @@ -71,7 +71,7 @@ const DepositCollateralStep = ({ return ( <> {t('vault.deposit_collateral')} - + diff --git a/src/pages/Vaults/VaultsOverview/components/InfoBox/InfoBox.stories.tsx b/src/pages/Vaults/VaultsOverview/components/InfoBox/InfoBox.stories.tsx deleted file mode 100644 index b33a6f17cc..0000000000 --- a/src/pages/Vaults/VaultsOverview/components/InfoBox/InfoBox.stories.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { Meta, Story } from '@storybook/react'; - -import { InfoBox, InfoBoxProps } from '.'; - -const Template: Story = (args) => ; - -const WithoutCTA = Template.bind({}); -WithoutCTA.args = { - title: 'My vaults at risk', - text: '0' -}; - -const WithCTA = Template.bind({}); -WithCTA.args = { - title: 'My vaults at risk', - text: '0', - ctaOnClick: () => { - alert('CTA action'); - }, - ctaText: 'Claim' -}; - -export { WithCTA, WithoutCTA }; - -export default { - title: 'Components/InfoBox', - component: InfoBox -} as Meta; diff --git a/src/pages/Wallet/WalletOverview/WalletOverview.tsx b/src/pages/Wallet/WalletOverview/WalletOverview.tsx new file mode 100644 index 0000000000..5506cf3f7e --- /dev/null +++ b/src/pages/Wallet/WalletOverview/WalletOverview.tsx @@ -0,0 +1,57 @@ +import { LoanPositionsTable, PoolsTable } from '@/components'; +import FullLoadingSpinner from '@/legacy-components/FullLoadingSpinner'; +import MainContainer from '@/parts/MainContainer'; +import { getPooledTickers } from '@/utils/helpers/pools'; +import { useGetAccountPools } from '@/utils/hooks/api/amm/use-get-account-pools'; +import { useGetLiquidityPools } from '@/utils/hooks/api/amm/use-get-liquidity-pools'; +import { useGetAccountStakingData } from '@/utils/hooks/api/escrow/use-get-account-staking-data'; +import { useGetAccountVotingBalance } from '@/utils/hooks/api/escrow/use-get-account-voting-balance'; +import { useGetAccountPositions } from '@/utils/hooks/api/loans/use-get-account-positions'; +import { useGetLoanAssets } from '@/utils/hooks/api/loans/use-get-loan-assets'; +import { useGetBalances } from '@/utils/hooks/api/tokens/use-get-balances'; +import useAccountId from '@/utils/hooks/use-account-id'; + +import { AvailableAssetsTable, StakingTable, WalletInsights } from './components'; + +const WalletOverview = (): JSX.Element => { + const accountId = useAccountId(); + const { data: balances } = useGetBalances(); + const { data: accountPoolsData } = useGetAccountPools(); + const { data: liquidityPools } = useGetLiquidityPools(); + const { data: accountStakingData } = useGetAccountStakingData(); + const { data: accountVotingBalance } = useGetAccountVotingBalance(); + const { + data: { borrowPositions, lendPositions } + } = useGetAccountPositions(); + const { data: assets } = useGetLoanAssets(); + + if (accountId !== undefined && !balances) { + return ; + } + + const hasStakingTable = + accountStakingData && + accountVotingBalance && + (!accountStakingData?.balance.isZero() || !accountVotingBalance?.isZero()); + + const pooledTickers = liquidityPools && getPooledTickers(liquidityPools); + + return ( + + + + {!!lendPositions?.length && assets && ( + + )} + {!!borrowPositions?.length && assets && ( + + )} + {!!accountPoolsData?.positions.length && ( + + )} + {hasStakingTable && } + + ); +}; + +export default WalletOverview; diff --git a/src/pages/Wallet/WalletOverview/components/AvailableAssetsTable/ActionsCell.tsx b/src/pages/Wallet/WalletOverview/components/AvailableAssetsTable/ActionsCell.tsx new file mode 100644 index 0000000000..ca103cb82d --- /dev/null +++ b/src/pages/Wallet/WalletOverview/components/AvailableAssetsTable/ActionsCell.tsx @@ -0,0 +1,131 @@ +import { CurrencyExt } from '@interlay/interbtc-api'; +import { useTranslation } from 'react-i18next'; +import { useMutation } from 'react-query'; +import { useDispatch } from 'react-redux'; +import { toast } from 'react-toastify'; + +import { showBuyModal } from '@/common/actions/general.actions'; +import { CTA, CTALink, CTAProps, Divider, Flex, theme } from '@/component-library'; +import { useMediaQuery } from '@/component-library/utils/use-media-query'; +import { WRAPPED_TOKEN } from '@/config/relay-chains'; +import { PAGES, QUERY_PARAMETERS } from '@/utils/constants/links'; + +const queryString = require('query-string'); + +const claimVesting = async () => { + await window.bridge.api.tx.vesting.claim(); +}; + +type ActionsCellProps = { + currency: CurrencyExt; + isWrappedToken: boolean; + isRedeemable: boolean; + isPooledAsset: boolean; + isGovernanceToken: boolean; + isVestingClaimable: boolean; +}; + +const ActionsCell = ({ + currency, + isGovernanceToken, + isPooledAsset, + isRedeemable, + isVestingClaimable, + isWrappedToken +}: ActionsCellProps): JSX.Element | null => { + const { t } = useTranslation(); + const dispatch = useDispatch(); + + const isMobile = useMediaQuery(theme.breakpoints.down('md')); + const isSmallMobile = useMediaQuery(theme.breakpoints.down('sm')); + + const handleClaimVestingSuccess = () => { + toast.success('Successfully claimed vesting'); + }; + + const handleClaimVestingError = (error: Error) => { + toast.success(error); + }; + + const claimVestingMutation = useMutation(claimVesting, { + onSuccess: handleClaimVestingSuccess, + onError: handleClaimVestingError + }); + + const handlePressClaimVesting = () => claimVestingMutation.mutate(); + + const handlePressBuyGovernance = () => dispatch(showBuyModal(true)); + + const commonCTAProps: CTAProps = { + fullWidth: isMobile, + variant: 'outlined', + size: isMobile && !isSmallMobile ? 'medium' : 'small' + }; + + return ( + + {isMobile && } + + {isWrappedToken && ( + + {t('issue')} + + )} + {isRedeemable && ( + + {t('redeem')} + + )} + {/* TODO: add when xcm re-vamp is added */} + {/* + {t('transfer')} + */} + {isPooledAsset && ( + + {t('amm.swap')} + + )} + {isGovernanceToken && ( + <> + + Buy + + {isVestingClaimable && ( + + Claim vesting + + )} + + )} + + + ); +}; + +export { ActionsCell }; +export type { ActionsCellProps }; diff --git a/src/pages/Wallet/WalletOverview/components/AvailableAssetsTable/AvailableAssetsTable.tsx b/src/pages/Wallet/WalletOverview/components/AvailableAssetsTable/AvailableAssetsTable.tsx new file mode 100644 index 0000000000..923a7eeec2 --- /dev/null +++ b/src/pages/Wallet/WalletOverview/components/AvailableAssetsTable/AvailableAssetsTable.tsx @@ -0,0 +1,130 @@ +import { isCurrencyEqual } from '@interlay/interbtc-api'; +import { ReactNode, useMemo, useState } from 'react'; +import { useTranslation } from 'react-i18next'; + +import { convertMonetaryAmountToValueInUSD, formatUSD } from '@/common/utils/utils'; +import { P, Switch, theme } from '@/component-library'; +import { useMediaQuery } from '@/component-library/utils/use-media-query'; +import { Cell } from '@/components'; +import { AssetCell, DataGrid } from '@/components/DataGrid'; +import { GOVERNANCE_TOKEN, WRAPPED_TOKEN } from '@/config/relay-chains'; +import { getCoinIconProps } from '@/utils/helpers/coin-icon'; +import { getTokenPrice } from '@/utils/helpers/prices'; +import { BalanceData } from '@/utils/hooks/api/tokens/use-get-balances'; +import { useGetPrices } from '@/utils/hooks/api/use-get-prices'; +import { useGetVestingData } from '@/utils/hooks/api/use-get-vesting-data'; + +import { ActionsCell } from './ActionsCell'; + +enum AvailableAssetsColumns { + ASSET = 'asset', + PRICE = 'price', + BALANCE = 'balance', + ACTIONS = 'actions' +} + +type AvailableAssetsRows = { + id: string; + [AvailableAssetsColumns.ASSET]: ReactNode; + [AvailableAssetsColumns.PRICE]: ReactNode; + [AvailableAssetsColumns.BALANCE]: ReactNode; + [AvailableAssetsColumns.ACTIONS]: ReactNode; +}; + +type AvailableAssetsTableProps = { + balances?: BalanceData; + pooledTickers?: Set; +}; + +const AvailableAssetsTable = ({ balances, pooledTickers }: AvailableAssetsTableProps): JSX.Element => { + const { t } = useTranslation(); + const prices = useGetPrices(); + const { data: vestingData } = useGetVestingData(); + const isMobile = useMediaQuery(theme.breakpoints.down('md')); + + const [showZeroBalances, setShowZeroBalances] = useState(false); + + const rows: AvailableAssetsRows[] = useMemo(() => { + const data = balances ? Object.values(balances) : []; + const filteredData = showZeroBalances ? data : data.filter((balance) => !balance.transferable.isZero()); + + return filteredData.map( + ({ currency, transferable }): AvailableAssetsRows => { + const asset = ( + + ); + + const tokenPrice = getTokenPrice(prices, currency.ticker)?.usd || 0; + + const assetPriceLabel = formatUSD(getTokenPrice(prices, currency.ticker)?.usd || 0, { compact: true }); + const price = ; + + const balanceLabel = transferable.toString(); + const balanceSublabel = formatUSD(convertMonetaryAmountToValueInUSD(transferable, tokenPrice) || 0, { + compact: true + }); + const balance = ( + + ); + + const isWrappedToken = isCurrencyEqual(currency, WRAPPED_TOKEN); + const isRedeemable = isWrappedToken && !transferable.isZero(); + const isPooledAsset = !!pooledTickers?.has(currency.ticker); + const isGovernanceToken = isCurrencyEqual(currency, GOVERNANCE_TOKEN); + const isVestingClaimable = isGovernanceToken && !!vestingData?.isClaimable; + + const hasActions = isRedeemable || isPooledAsset || isVestingClaimable; + + const actions = hasActions ? ( + + ) : null; + + return { + id: currency.ticker, + asset, + price, + balance, + actions + }; + } + ); + }, [balances, showZeroBalances, isMobile, prices, pooledTickers, vestingData?.isClaimable]); + + const actions = ( + setShowZeroBalances(e.target.checked)}> + {t('show_zero_balance')} + + ); + + const columns = [ + { name: isMobile ? '' : t('asset'), uid: AvailableAssetsColumns.ASSET }, + { name: t('price'), uid: AvailableAssetsColumns.PRICE }, + { name: t('balance'), uid: AvailableAssetsColumns.BALANCE }, + { name: '', uid: AvailableAssetsColumns.ACTIONS } + ]; + + return ( + {t('wallet.no_assets_available')}

} + /> + ); +}; + +export { AvailableAssetsTable }; +export type { AvailableAssetsTableProps }; diff --git a/src/pages/Wallet/WalletOverview/components/AvailableAssetsTable/index.tsx b/src/pages/Wallet/WalletOverview/components/AvailableAssetsTable/index.tsx new file mode 100644 index 0000000000..1b84d782aa --- /dev/null +++ b/src/pages/Wallet/WalletOverview/components/AvailableAssetsTable/index.tsx @@ -0,0 +1,2 @@ +export type { AvailableAssetsTableProps } from './AvailableAssetsTable'; +export { AvailableAssetsTable } from './AvailableAssetsTable'; diff --git a/src/pages/Wallet/WalletOverview/components/StakingTable/StakingTable.tsx b/src/pages/Wallet/WalletOverview/components/StakingTable/StakingTable.tsx new file mode 100644 index 0000000000..d5fc3e645c --- /dev/null +++ b/src/pages/Wallet/WalletOverview/components/StakingTable/StakingTable.tsx @@ -0,0 +1,94 @@ +import { CurrencyExt } from '@interlay/interbtc-api'; +import { MonetaryAmount } from '@interlay/monetary-js'; +import { useId } from '@react-aria/utils'; +import { differenceInDays, format, formatDistanceToNowStrict } from 'date-fns'; +import { ReactNode, useMemo } from 'react'; +import { useTranslation } from 'react-i18next'; + +import { convertMonetaryAmountToValueInUSD, formatUSD } from '@/common/utils/utils'; +import { CoinIcon, Flex } from '@/component-library'; +import { Cell, Table } from '@/components'; +import { GOVERNANCE_TOKEN, VOTE_GOVERNANCE_TOKEN } from '@/config/relay-chains'; +import { YEAR_MONTH_DAY_PATTERN } from '@/utils/constants/date-time'; +import { getTokenPrice } from '@/utils/helpers/prices'; +import { GetAccountStakingData } from '@/utils/hooks/api/escrow/use-get-account-staking-data'; +import { useGetBalances } from '@/utils/hooks/api/tokens/use-get-balances'; +import { useGetPrices } from '@/utils/hooks/api/use-get-prices'; + +enum StakingTableColumns { + ASSET = 'asset', + UNLOCKS = 'unlocks', + AVAILABLE = 'available', + VOTING_POWER = 'votingPower' +} + +type StakingTableRows = { + id: string; + [StakingTableColumns.ASSET]: ReactNode; + [StakingTableColumns.UNLOCKS]: ReactNode; + [StakingTableColumns.AVAILABLE]: ReactNode; + [StakingTableColumns.VOTING_POWER]: ReactNode; +}; + +type StakingTableProps = { + data: GetAccountStakingData; + votingBalance: MonetaryAmount; +}; + +const StakingTable = ({ data, votingBalance }: StakingTableProps): JSX.Element => { + const { t } = useTranslation(); + const titleId = useId(); + const prices = useGetPrices(); + const { getAvailableBalance } = useGetBalances(); + + const columns = [ + { name: t('wallet.total_governance_locked', { token: GOVERNANCE_TOKEN.ticker }), uid: StakingTableColumns.ASSET }, + { name: t('unlocks'), uid: StakingTableColumns.UNLOCKS }, + { name: t('wallet.available_to_stake'), uid: StakingTableColumns.AVAILABLE }, + { + name: t('wallet.voting_power_governance', { token: VOTE_GOVERNANCE_TOKEN.ticker }), + uid: StakingTableColumns.VOTING_POWER + } + ]; + + const rows = useMemo((): StakingTableRows[] => { + const { balance, unlock } = data; + const stakingBalancePrice = + convertMonetaryAmountToValueInUSD(balance, getTokenPrice(prices, balance.currency.ticker)?.usd) || 0; + + const asset = ( + + + + + ); + + const unlockDateLabel = format(unlock.date, YEAR_MONTH_DAY_PATTERN); + const difference = differenceInDays(unlock.date, new Date()); + const unlockDaysLabel = formatDistanceToNowStrict(unlock.date); + const unlockDaysIndicatorLabel = difference < 0 ? `-${unlockDaysLabel}` : unlockDaysLabel; + const unlocksLabel = `${unlockDateLabel} (${unlockDaysIndicatorLabel})`; + + const unlocks = ; + + const available = ; + + const votingPower = ; + + return [ + { + id: balance.currency.ticker, + asset, + unlocks, + available, + votingPower + } + ]; + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [prices, data, votingBalance]); + + return
; +}; + +export { StakingTable }; +export type { StakingTableProps }; diff --git a/src/pages/Wallet/WalletOverview/components/StakingTable/index.tsx b/src/pages/Wallet/WalletOverview/components/StakingTable/index.tsx new file mode 100644 index 0000000000..67b407a1ac --- /dev/null +++ b/src/pages/Wallet/WalletOverview/components/StakingTable/index.tsx @@ -0,0 +1,2 @@ +export type { StakingTableProps } from './StakingTable'; +export { StakingTable } from './StakingTable'; diff --git a/src/pages/Wallet/WalletOverview/components/WalletInsights/WalletInsights.style.tsx b/src/pages/Wallet/WalletOverview/components/WalletInsights/WalletInsights.style.tsx new file mode 100644 index 0000000000..700a6824d8 --- /dev/null +++ b/src/pages/Wallet/WalletOverview/components/WalletInsights/WalletInsights.style.tsx @@ -0,0 +1,14 @@ +import styled from 'styled-components'; + +import { Dd, Dt, theme } from '@/component-library'; + +const StyledDt = styled(Dt)` + font-weight: ${theme.fontWeight.semibold}; + white-space: nowrap; +`; + +const StyledDd = styled(Dd)` + font-weight: ${theme.fontWeight.bold}; +`; + +export { StyledDd, StyledDt }; diff --git a/src/pages/Wallet/WalletOverview/components/WalletInsights/WalletInsights.tsx b/src/pages/Wallet/WalletOverview/components/WalletInsights/WalletInsights.tsx new file mode 100644 index 0000000000..234b4368db --- /dev/null +++ b/src/pages/Wallet/WalletOverview/components/WalletInsights/WalletInsights.tsx @@ -0,0 +1,85 @@ +import Big from 'big.js'; +import { useTranslation } from 'react-i18next'; + +import { convertMonetaryAmountToValueInUSD, formatUSD } from '@/common/utils/utils'; +import { Card, Dd, Dl, DlGroup, Dt, theme } from '@/component-library'; +import { useMediaQuery } from '@/component-library/utils/use-media-query'; +import { getTokenPrice } from '@/utils/helpers/prices'; +import { BalanceData } from '@/utils/hooks/api/tokens/use-get-balances'; +import { useGetPrices } from '@/utils/hooks/api/use-get-prices'; + +import { WalletMeta } from './WalletMeta'; + +type WalletInsightsProps = { + balances?: BalanceData; +}; + +const WalletInsights = ({ balances }: WalletInsightsProps): JSX.Element => { + const { t } = useTranslation(); + + const prices = useGetPrices(); + const isMobile = useMediaQuery(theme.breakpoints.down('md')); + + const totalBalance = + balances && + Object.values(balances).reduce( + (total, balance) => + total.add( + convertMonetaryAmountToValueInUSD( + balance.free.add(balance.reserved), + getTokenPrice(prices, balance.currency.ticker)?.usd + ) || 0 + ), + new Big(0) + ); + + const totalBalanceLabel = totalBalance ? formatUSD(totalBalance.toNumber(), { compact: true }) : '-'; + + const transfarableBalance = + balances && + Object.values(balances).reduce( + (total, balance) => + total.add( + convertMonetaryAmountToValueInUSD( + balance.transferable, + getTokenPrice(prices, balance.currency.ticker)?.usd + ) || 0 + ), + new Big(0) + ); + + const transfarableBalanceLabel = transfarableBalance + ? formatUSD(transfarableBalance.toNumber(), { compact: true }) + : '-'; + + return ( +
+ + + + + +
+ {t('total_balance')} +
+
+ {totalBalanceLabel} +
+
+
+ + +
+ {t('transferable_balance')} +
+
+ {transfarableBalanceLabel} +
+
+
+
+ ); +}; + +export { WalletInsights }; +export type { WalletInsightsProps }; diff --git a/src/pages/Wallet/WalletOverview/components/WalletInsights/WalletMeta.tsx b/src/pages/Wallet/WalletOverview/components/WalletInsights/WalletMeta.tsx new file mode 100644 index 0000000000..3b79462324 --- /dev/null +++ b/src/pages/Wallet/WalletOverview/components/WalletInsights/WalletMeta.tsx @@ -0,0 +1,85 @@ +import { mergeProps } from '@react-aria/utils'; +import { useDispatch } from 'react-redux'; +import { useCopyToClipboard } from 'react-use'; + +import { ArrowTopRightOnSquare, DocumentDuplicate, PencilSquare } from '@/assets/icons'; +import { showAccountModalAction } from '@/common/actions/general.actions'; +import { shortAddress } from '@/common/utils/utils'; +import { CTA, CTALink, Dd, DlGroup, Dt, Flex, FlexProps, P, Tooltip, WalletIcon } from '@/component-library'; +import { AuthCTA } from '@/components'; +import { SUBSCAN_LINK } from '@/config/relay-chains'; +import { useSubstrateState } from '@/lib/substrate'; +import { useCopyTooltip } from '@/utils/hooks/use-copy-tooltip'; + +type WalletMetaProps = FlexProps; + +const WalletMeta = (props: WalletMetaProps): JSX.Element => { + const { selectedAccount } = useSubstrateState(); + const dispatch = useDispatch(); + + const [, copy] = useCopyToClipboard(); + const { buttonProps, tooltipProps } = useCopyTooltip(); + + if (!selectedAccount) { + return ( + +

No Account Connected

+ Connect Account +
+ ); + } + + const handleCopy = () => copy(selectedAccount.address); + + return ( + + + + + +
+ {selectedAccount.meta.name} +
+
{shortAddress(selectedAccount.address)}
+
+
+ + + + + + + dispatch(showAccountModalAction(true))} + variant='text' + size='x-small' + > + + + + + + +
+ {/* TODO: add back when banxa on-ramp is added */} + {/* + {t('fund_wallet')} + View History + */} +
+ ); +}; + +export { WalletMeta }; diff --git a/src/pages/Wallet/WalletOverview/components/WalletInsights/index.tsx b/src/pages/Wallet/WalletOverview/components/WalletInsights/index.tsx new file mode 100644 index 0000000000..ebc0b4243a --- /dev/null +++ b/src/pages/Wallet/WalletOverview/components/WalletInsights/index.tsx @@ -0,0 +1,2 @@ +export type { WalletInsightsProps } from './WalletInsights'; +export { WalletInsights } from './WalletInsights'; diff --git a/src/pages/Wallet/WalletOverview/components/WalletInsights/utils.ts b/src/pages/Wallet/WalletOverview/components/WalletInsights/utils.ts new file mode 100644 index 0000000000..f5d171d2a3 --- /dev/null +++ b/src/pages/Wallet/WalletOverview/components/WalletInsights/utils.ts @@ -0,0 +1,24 @@ +import { CurrencyExt, LpCurrency } from '@interlay/interbtc-api'; +import { MonetaryAmount } from '@interlay/monetary-js'; + +import { calculateTotalLiquidityUSD } from '@/pages/AMM/shared/utils'; +import { Prices } from '@/utils/hooks/api/use-get-prices'; + +const calculateClaimableFarmingRewardUSD = ( + claimableRewards: Map[]> | undefined, + prices: Prices | undefined +): number => { + if (claimableRewards === undefined) { + return 0; + } + const flattenedRewardAmounts: Array> = []; + for (const [, rewardAmounts] of claimableRewards.entries()) { + flattenedRewardAmounts.push(...rewardAmounts); + } + + const totalRewardUSD = calculateTotalLiquidityUSD(flattenedRewardAmounts, prices); + + return totalRewardUSD; +}; + +export { calculateClaimableFarmingRewardUSD }; diff --git a/src/pages/Wallet/WalletOverview/components/index.tsx b/src/pages/Wallet/WalletOverview/components/index.tsx new file mode 100644 index 0000000000..e4670e5c97 --- /dev/null +++ b/src/pages/Wallet/WalletOverview/components/index.tsx @@ -0,0 +1,6 @@ +import { AvailableAssetsTable, AvailableAssetsTableProps } from './AvailableAssetsTable'; +import { StakingTable, StakingTableProps } from './StakingTable'; +import { WalletInsights, WalletInsightsProps } from './WalletInsights'; + +export { AvailableAssetsTable, StakingTable, WalletInsights }; +export type { AvailableAssetsTableProps, StakingTableProps, WalletInsightsProps }; diff --git a/src/pages/Wallet/WalletOverview/index.tsx b/src/pages/Wallet/WalletOverview/index.tsx new file mode 100644 index 0000000000..ab4e95ed6f --- /dev/null +++ b/src/pages/Wallet/WalletOverview/index.tsx @@ -0,0 +1,3 @@ +import WalletOverview from './WalletOverview'; + +export default WalletOverview; diff --git a/src/pages/Wallet/index.tsx b/src/pages/Wallet/index.tsx new file mode 100644 index 0000000000..ab4e95ed6f --- /dev/null +++ b/src/pages/Wallet/index.tsx @@ -0,0 +1,3 @@ +import WalletOverview from './WalletOverview'; + +export default WalletOverview; diff --git a/src/parts/Sidebar/SidebarContent/Navigation/index.tsx b/src/parts/Sidebar/SidebarContent/Navigation/index.tsx index 29315fb7f9..83581e5880 100644 --- a/src/parts/Sidebar/SidebarContent/Navigation/index.tsx +++ b/src/parts/Sidebar/SidebarContent/Navigation/index.tsx @@ -12,7 +12,8 @@ import { HandRaisedIcon, PresentationChartBarIcon, ScaleIcon, - Square3Stack3DIcon + Square3Stack3DIcon, + UserIcon } from '@heroicons/react/24/outline'; import clsx from 'clsx'; import * as React from 'react'; @@ -68,9 +69,16 @@ const Navigation = ({ const { vaultClientLoaded } = useSelector((state: StoreType) => state.general); const isLendingEnabled = useFeatureFlag(FeatureFlags.LENDING); const isAMMEnabled = useFeatureFlag(FeatureFlags.AMM); + const isWalletEnabled = useFeatureFlag(FeatureFlags.WALLET); const NAVIGATION_ITEMS = React.useMemo( () => [ + { + name: 'nav_wallet', + link: PAGES.WALLET, + icon: UserIcon, + disabled: !isWalletEnabled + }, { name: 'nav_bridge', link: PAGES.BRIDGE, @@ -185,7 +193,7 @@ const Navigation = ({ } } ], - [isLendingEnabled, isAMMEnabled, selectedAccount?.address, vaultClientLoaded] + [isWalletEnabled, isLendingEnabled, isAMMEnabled, selectedAccount?.address, vaultClientLoaded] ); return ( diff --git a/src/parts/Topbar/GetGovernanceTokenUI/index.tsx b/src/parts/Topbar/GetGovernanceTokenUI/index.tsx index 6379e6d166..474238bc04 100644 --- a/src/parts/Topbar/GetGovernanceTokenUI/index.tsx +++ b/src/parts/Topbar/GetGovernanceTokenUI/index.tsx @@ -1,6 +1,7 @@ import clsx from 'clsx'; import * as React from 'react'; import { useTranslation } from 'react-i18next'; +import { useDispatch, useSelector } from 'react-redux'; import { ReactComponent as AcalaLogoIcon } from '@/assets/img/exchanges/acala-logo.svg'; import { ReactComponent as GateLogoIcon } from '@/assets/img/exchanges/gate-logo.svg'; @@ -10,6 +11,8 @@ import { ReactComponent as MexcLogoForInterlayIcon } from '@/assets/img/exchange import { ReactComponent as MexcLogoForKintsugiIcon } from '@/assets/img/exchanges/mexc-logo-for-kintsugi.svg'; import { ReactComponent as StellaSwapLogoIcon } from '@/assets/img/exchanges/stellaswap-logo.svg'; import { ReactComponent as ZenlinkLogoIcon } from '@/assets/img/exchanges/zenlink-logo.svg'; +import { showBuyModal } from '@/common/actions/general.actions'; +import { StoreType } from '@/common/types/util.types'; import { GOVERNANCE_TOKEN_SYMBOL } from '@/config/relay-chains'; import InterlayDefaultOutlinedButton, { Props as InterlayDefaultOutlinedButtonProps @@ -94,15 +97,16 @@ const ExchangeLink = ({ href, icon }: ExchangeLinkProps) => { }; const GetGovernanceTokenUI = (props: InterlayDefaultOutlinedButtonProps): JSX.Element => { - const [modalOpen, setModalOpen] = React.useState(false); + const { isBuyModalOpen } = useSelector((state: StoreType) => state.general); const focusRef = React.useRef(null); const { t } = useTranslation(); + const dispatch = useDispatch(); const handleModalOpen = () => { - setModalOpen(true); + dispatch(showBuyModal(true)); }; const handleModalClose = () => { - setModalOpen(false); + dispatch(showBuyModal(false)); }; const getGovernanceTokenLabel = t('get_governance_token', { @@ -118,7 +122,7 @@ const GetGovernanceTokenUI = (props: InterlayDefaultOutlinedButtonProps): JSX.El {getGovernanceTokenLabel} - +
diff --git a/src/test/mocks/@interlay/interbtc-api/index.ts b/src/test/mocks/@interlay/interbtc-api/index.ts index 88110a8ffb..592472d6ce 100644 --- a/src/test/mocks/@interlay/interbtc-api/index.ts +++ b/src/test/mocks/@interlay/interbtc-api/index.ts @@ -14,6 +14,7 @@ import { mockFeeGetIssueFee, mockFeeGetIssueGriefingCollateralRate, mockGetCurrentActiveBlockNumber, + mockGetCurrentBlockNumber, mockGetFutureBlockNumber, mockGetStableBitcoinConfirmations, mockGetStableParachainConfirmations, @@ -51,6 +52,7 @@ import { mockSwap } from './parachain/amm'; import { mockGetForeignAssets } from './parachain/assetRegistry'; +import { mockGetStakedBalance, mockVotingBalance } from './parachain/escrow'; import { mockBorrow, mockClaimAllSubsidyRewards, @@ -68,6 +70,7 @@ import { mockWithdraw, mockWithdrawAll } from './parachain/loans'; +import { mockClaimVesting, mockVestingSchedules } from './parachain/vesting'; const DEFAULT_ACCOUNT_ADDRESS = 'a3aTRC4zs1djutYS9QuZSB3XmfRgNzFfyRtbZKaoQyv67Yzcc'; @@ -91,7 +94,17 @@ const mockInterBtcApi: RecursivePartial = { chainType: mockChainType } }, - on: jest.fn() + on: jest.fn(), + query: { + vesting: { + vestingSchedules: mockVestingSchedules as any + } + }, + tx: { + vesting: { + claim: mockClaimVesting + } + } }, assetRegistry: { getForeignAssets: mockGetForeignAssets @@ -144,7 +157,8 @@ const mockInterBtcApi: RecursivePartial = { system: { getStatusCode: mockSystemGetStatusCode, getFutureBlockNumber: mockGetFutureBlockNumber, - getCurrentActiveBlockNumber: mockGetCurrentActiveBlockNumber + getCurrentActiveBlockNumber: mockGetCurrentActiveBlockNumber, + getCurrentBlockNumber: mockGetCurrentBlockNumber }, tokens: { balance: mockTokensBalance, @@ -167,6 +181,10 @@ const mockInterBtcApi: RecursivePartial = { getOptimalTrade: mockGetOptimalTrade, swap: mockSwap, claimFarmingRewards: mockClaimFarmingRewards + }, + escrow: { + getStakedBalance: mockGetStakedBalance, + votingBalance: mockVotingBalance } }; diff --git a/src/test/mocks/@interlay/interbtc-api/parachain/amm.ts b/src/test/mocks/@interlay/interbtc-api/parachain/amm.ts index 16a84846ba..8d08541ec5 100644 --- a/src/test/mocks/@interlay/interbtc-api/parachain/amm.ts +++ b/src/test/mocks/@interlay/interbtc-api/parachain/amm.ts @@ -92,7 +92,9 @@ const mockAddLiquidity = jest.fn(); const mockRemoveLiquidity = jest.fn(); -const mockGetLpTokens = jest.fn().mockResolvedValue([DEFAULT_LP_TOKEN_1, DEFAULT_LP_TOKEN_2]); +const DEFAULT_LP_TOKENS = [DEFAULT_LP_TOKEN_1, DEFAULT_LP_TOKEN_2]; + +const mockGetLpTokens = jest.fn().mockResolvedValue(DEFAULT_LP_TOKENS); const DEFAULT_TRADE_AMOUNT = { INPUT: newMonetaryAmount(1, RELAY_CHAIN_NATIVE_TOKEN, true), @@ -133,6 +135,7 @@ export { DEFAULT_LIQUIDITY_POOLS, DEFAULT_LP_TOKEN_1, DEFAULT_LP_TOKEN_2, + DEFAULT_LP_TOKENS, DEFAULT_MULTI_PATH_ELEMENT, DEFAULT_POOLED_CURRENCIES_1, DEFAULT_POOLED_CURRENCIES_2, diff --git a/src/test/mocks/@interlay/interbtc-api/parachain/escrow.ts b/src/test/mocks/@interlay/interbtc-api/parachain/escrow.ts new file mode 100644 index 0000000000..8d27cc7621 --- /dev/null +++ b/src/test/mocks/@interlay/interbtc-api/parachain/escrow.ts @@ -0,0 +1,25 @@ +import '@testing-library/jest-dom'; + +import { newMonetaryAmount } from '@interlay/interbtc-api'; + +import { GOVERNANCE_TOKEN } from '@/config/relay-chains'; + +const DEFAULT_STAKED_AMOUNT = newMonetaryAmount(10, GOVERNANCE_TOKEN, true); + +const DEFAULT_STAKED_BALANCE = { amount: DEFAULT_STAKED_AMOUNT, endBlock: 0 }; + +const EMPTY_STAKED_BALANCE = { amount: newMonetaryAmount(0, GOVERNANCE_TOKEN), endBlock: 0 }; + +const mockGetStakedBalance = jest.fn().mockResolvedValue(DEFAULT_STAKED_BALANCE); + +const DEFAULT_VOTING_BALANCE = newMonetaryAmount(10, GOVERNANCE_TOKEN, true); + +const mockVotingBalance = jest.fn().mockResolvedValue(DEFAULT_VOTING_BALANCE); + +export { + DEFAULT_STAKED_BALANCE, + DEFAULT_VOTING_BALANCE, + EMPTY_STAKED_BALANCE, + mockGetStakedBalance, + mockVotingBalance +}; diff --git a/src/test/mocks/@interlay/interbtc-api/parachain/loans.ts b/src/test/mocks/@interlay/interbtc-api/parachain/loans.ts index 27cfd19fa0..e29119298d 100644 --- a/src/test/mocks/@interlay/interbtc-api/parachain/loans.ts +++ b/src/test/mocks/@interlay/interbtc-api/parachain/loans.ts @@ -124,7 +124,7 @@ const DEFAULT_ASSETS: TickerToData = { }; const mockGetLendPositionsOfAccount = jest.fn().mockReturnValue(DEFAULT_LEND_POSITIONS); -const mockGetBorrowPositionsOfAccount = jest.fn().mockRejectedValue(DEFAULT_BORROW_POSITIONS); +const mockGetBorrowPositionsOfAccount = jest.fn().mockReturnValue(DEFAULT_BORROW_POSITIONS); const mockGetLoanAssets = jest.fn().mockReturnValue(DEFAULT_ASSETS); const mockGetAccountSubsidyRewards = jest.fn().mockReturnValue(DEFAULT_INTR.MONETARY.MEDIUM); diff --git a/src/test/mocks/@interlay/interbtc-api/parachain/system.ts b/src/test/mocks/@interlay/interbtc-api/parachain/system.ts index acbe20b37f..5c1622cbcb 100644 --- a/src/test/mocks/@interlay/interbtc-api/parachain/system.ts +++ b/src/test/mocks/@interlay/interbtc-api/parachain/system.ts @@ -11,10 +11,16 @@ const DEFAULT_CURRENT_ACTIVE_BLOCK_NUMBER = 1; const mockGetCurrentActiveBlockNumber = jest.fn().mockResolvedValue(DEFAULT_CURRENT_ACTIVE_BLOCK_NUMBER); +const DEFAULT_CURRENT_BLOCK_NUMBER = 0; + +const mockGetCurrentBlockNumber = jest.fn().mockReturnValue(DEFAULT_CURRENT_BLOCK_NUMBER); + export { DEFAULT_CURRENT_ACTIVE_BLOCK_NUMBER, + DEFAULT_CURRENT_BLOCK_NUMBER, DEFAULT_DEADLINE_BLOCK_NUMBER, mockGetCurrentActiveBlockNumber, + mockGetCurrentBlockNumber, mockGetFutureBlockNumber, mockSystemGetStatusCode }; diff --git a/src/test/mocks/@interlay/interbtc-api/parachain/vesting.ts b/src/test/mocks/@interlay/interbtc-api/parachain/vesting.ts new file mode 100644 index 0000000000..8725706d9d --- /dev/null +++ b/src/test/mocks/@interlay/interbtc-api/parachain/vesting.ts @@ -0,0 +1,9 @@ +const SOME_VESTING_SCHEDULES = [{ start: 0, period: 0, periodCount: 1, perPeriod: 1 }]; + +const EMPTY_VESTING_SCHEDULES: any[] = []; + +const mockVestingSchedules = jest.fn().mockReturnValue(EMPTY_VESTING_SCHEDULES); + +const mockClaimVesting = jest.fn(); + +export { EMPTY_VESTING_SCHEDULES, mockClaimVesting, mockVestingSchedules, SOME_VESTING_SCHEDULES }; diff --git a/src/test/pages/Loans/index.test.tsx b/src/test/pages/Loans/index.test.tsx index 0e67a76187..5d71f63017 100644 --- a/src/test/pages/Loans/index.test.tsx +++ b/src/test/pages/Loans/index.test.tsx @@ -20,7 +20,7 @@ import { } from '@/test/mocks/@interlay/interbtc-api/parachain/loans'; import { render, screen, userEvent, waitFor } from '../../test-utils'; -import { getTableRow } from '../utils/table'; +import { getTableRow, withinTable } from '../utils/table'; import { TABLES } from './constants'; const path = '/lending'; @@ -63,7 +63,9 @@ describe('Loans page', () => { await render(, { path }); - expect(screen.queryByRole('grid', { name: new RegExp(TABLES.BORROW.POSITION, 'i') })).not.toBeInTheDocument(); + const table = withinTable(TABLES.BORROW.POSITION); + + expect(table.queryAllByRole('row')).toHaveLength(0); expect(screen.getByText(/no borrow positions/i)).toBeInTheDocument(); }); }); diff --git a/src/test/pages/Swap.test.tsx b/src/test/pages/Swap.test.tsx index cd0367a2f7..80897a7014 100644 --- a/src/test/pages/Swap.test.tsx +++ b/src/test/pages/Swap.test.tsx @@ -258,4 +258,28 @@ describe('Swap Page', () => { expect(mockSwap).toHaveBeenCalledTimes(1); }); }); + + it('should setup input and output currencies from search query', async () => { + await render(, { path: `${path}?from=${WRAPPED_TOKEN.ticker}&to=${RELAY_CHAIN_NATIVE_TOKEN.ticker}` }); + + await waitFor(() => { + expect(screen.getByRole('textbox', { name: /choose token for from field/i })).toHaveValue(WRAPPED_TOKEN.ticker); + + expect(screen.getByRole('textbox', { name: /choose token for to field/i })).toHaveValue( + RELAY_CHAIN_NATIVE_TOKEN.ticker + ); + }); + }); + + it('should setup input and output currencies to default pair when query is invalid', async () => { + await render(, { path: `${path}?from=&to=` }); + + await waitFor(() => { + expect(screen.getByRole('textbox', { name: /choose token for from field/i })).toHaveValue( + RELAY_CHAIN_NATIVE_TOKEN.ticker + ); + + expect(screen.getByRole('textbox', { name: /choose token for to field/i })).not.toHaveValue(); + }); + }); }); diff --git a/src/test/pages/Wallet.test.tsx b/src/test/pages/Wallet.test.tsx new file mode 100644 index 0000000000..c2e1d5bcc0 --- /dev/null +++ b/src/test/pages/Wallet.test.tsx @@ -0,0 +1,250 @@ +import MatchMediaMock from 'jest-matchmedia-mock'; + +import App from '@/App'; +import { theme } from '@/component-library'; +import { GOVERNANCE_TOKEN, RELAY_CHAIN_NATIVE_TOKEN, WRAPPED_TOKEN } from '@/config/relay-chains'; +import { NATIVE_CURRENCIES } from '@/utils/constants/currency'; +import { PAGES, QUERY_PARAMETERS } from '@/utils/constants/links'; + +import { + DEFAULT_CURRENT_BLOCK_NUMBER, + DEFAULT_TOKENS_BALANCE_FN, + EMPTY_TOKENS_BALANCE_FN, + mockGetCurrentBlockNumber, + mockTokensBalance +} from '../mocks/@interlay/interbtc-api'; +import { + ACCOUNT_WITH_FULL_LIQUIDITY, + DEFAULT_ACCOUNT_LIQUIDITY, + mockGetLiquidityProvidedByAccount, + mockGetLpTokens +} from '../mocks/@interlay/interbtc-api/parachain/amm'; +import { + DEFAULT_STAKED_BALANCE, + EMPTY_STAKED_BALANCE, + mockGetStakedBalance +} from '../mocks/@interlay/interbtc-api/parachain/escrow'; +import { + DEFAULT_BORROW_POSITIONS, + DEFAULT_LEND_POSITIONS, + mockGetBorrowPositionsOfAccount, + mockGetLendPositionsOfAccount +} from '../mocks/@interlay/interbtc-api/parachain/loans'; +import { + EMPTY_VESTING_SCHEDULES, + mockClaimVesting, + mockVestingSchedules, + SOME_VESTING_SCHEDULES +} from '../mocks/@interlay/interbtc-api/parachain/vesting'; +import { render, screen, userEvent, waitFor } from '../test-utils'; +import { withinList } from './utils/list'; +import { queryTable, withinTable, withinTableRow } from './utils/table'; + +jest.mock('@/pages/AMM', () => ({ __esModule: true, default: () =>
Swap page
})); + +const path = '/wallet'; + +const TABLES = { + AVAILABLE_ASSETS: 'available assets', + LEND_POSITIONS: 'lend positions', + BORROW_POSITIONS: 'borrow positions', + LIQUIDITY_POOLS: 'liquidity pools', + STAKED: 'staked' +}; + +describe('Wallet Page', () => { + let matchMedia: MatchMediaMock; + + beforeEach(() => { + matchMedia = new MatchMediaMock(); + + // ignoring lp-tokens + mockGetLpTokens.mockResolvedValue([]); + mockTokensBalance.mockImplementation(DEFAULT_TOKENS_BALANCE_FN); + mockGetLendPositionsOfAccount.mockReturnValue(DEFAULT_LEND_POSITIONS); + mockGetBorrowPositionsOfAccount.mockReturnValue(DEFAULT_BORROW_POSITIONS); + mockGetLiquidityProvidedByAccount.mockReturnValue(DEFAULT_ACCOUNT_LIQUIDITY); + mockGetStakedBalance.mockReturnValue(DEFAULT_STAKED_BALANCE); + mockGetCurrentBlockNumber.mockReturnValue(DEFAULT_CURRENT_BLOCK_NUMBER); + mockVestingSchedules.mockReturnValue(EMPTY_VESTING_SCHEDULES); + }); + + afterEach(() => { + matchMedia.clear(); + }); + + // TODO: add tests for Buy and Transfer CTALinks + describe('Available Assets', () => { + it('should render table (desktop)', async () => { + await render(, { path }); + + const table = withinTable(TABLES.AVAILABLE_ASSETS); + + expect(table.getAllByRole('row')).toHaveLength(NATIVE_CURRENCIES.length); + }); + + it('should render list (mobile)', async () => { + matchMedia.useMediaQuery(theme.breakpoints.down('md')); + + await render(, { path }); + + const list = withinList(TABLES.AVAILABLE_ASSETS); + + expect(list.getAllByRole('row')).toHaveLength(NATIVE_CURRENCIES.length); + }); + + it('should be able to navigate to issue page', async () => { + const { history } = await render(, { path }); + + const row = withinTableRow(TABLES.AVAILABLE_ASSETS, WRAPPED_TOKEN.ticker); + + userEvent.click(row.getByRole('link', { name: /issue/i })); + + expect(history.location.pathname).toBe(PAGES.BRIDGE); + expect(history.location.search).toMatch(`${QUERY_PARAMETERS.TAB}=issue`); + }); + + // TODO: enable when banxa e merged + it.skip('should be able to open buy dialog', async () => { + await render(, { path }); + + const row = withinTableRow(TABLES.AVAILABLE_ASSETS, GOVERNANCE_TOKEN.ticker); + + userEvent.click(row.getByRole('button', { name: /buy/i })); + + await waitFor(() => { + expect(screen.getByRole('dialog')).toBeInTheDocument(); + }); + }); + + it('should be able to claim vesting', async () => { + mockGetCurrentBlockNumber.mockReturnValue(10); + mockVestingSchedules.mockReturnValue(SOME_VESTING_SCHEDULES); + + await render(, { path }); + + const row = withinTableRow(TABLES.AVAILABLE_ASSETS, GOVERNANCE_TOKEN.ticker); + + userEvent.click(row.getByRole('button', { name: /claim vesting/i })); + + await waitFor(() => { + expect(mockClaimVesting).toHaveBeenCalledTimes(1); + }); + }); + + it(`should be able to navigate to swap page using ${WRAPPED_TOKEN.ticker}`, async () => { + const { history } = await render(, { path }); + + const row = withinTableRow(TABLES.AVAILABLE_ASSETS, WRAPPED_TOKEN.ticker); + + userEvent.click(row.getByRole('link', { name: /swap/i })); + + expect(history.location.pathname).toBe(PAGES.SWAP); + expect(history.location.search).toMatch(`${QUERY_PARAMETERS.SWAP.FROM}=${WRAPPED_TOKEN.ticker}`); + }); + + it(`should be able to navigate to swap page using ${RELAY_CHAIN_NATIVE_TOKEN.ticker}`, async () => { + const { history } = await render(, { path }); + + const row = withinTableRow(TABLES.AVAILABLE_ASSETS, RELAY_CHAIN_NATIVE_TOKEN.ticker); + + userEvent.click(row.getByRole('link', { name: /swap/i })); + + expect(history.location.pathname).toBe(PAGES.SWAP); + expect(history.location.search).toMatch( + `${QUERY_PARAMETERS.SWAP.FROM}=${RELAY_CHAIN_NATIVE_TOKEN.ticker}&${QUERY_PARAMETERS.SWAP.TO}=${WRAPPED_TOKEN.ticker}` + ); + }); + + it('should display zero balance assets', async () => { + mockTokensBalance.mockImplementation(EMPTY_TOKENS_BALANCE_FN); + + await render(, { path }); + + const table = withinTable(TABLES.AVAILABLE_ASSETS); + + expect(table.queryAllByRole('row')).toHaveLength(0); + expect(screen.getByText(/no assets available/i)).toBeInTheDocument(); + + userEvent.click(screen.getByRole('switch', { name: /show zero balance/i })); + + await waitFor(() => { + expect(table.queryAllByRole('row')).toHaveLength(NATIVE_CURRENCIES.length); + }); + }); + }); + + describe('Lending Positions', () => { + it('should display table', async () => { + await render(, { path }); + + const table = withinTable(TABLES.LEND_POSITIONS); + + expect(table.getAllByRole('row')).toHaveLength(DEFAULT_LEND_POSITIONS.length); + }); + + it('should not display table', async () => { + mockGetLendPositionsOfAccount.mockReturnValue([]); + + await render(, { path }); + + expect(queryTable(TABLES.LEND_POSITIONS)).not.toBeInTheDocument(); + }); + }); + + describe('Borrow Positions', () => { + it('should display table', async () => { + await render(, { path }); + + const table = withinTable(TABLES.BORROW_POSITIONS); + + expect(table.getAllByRole('row')).toHaveLength(DEFAULT_BORROW_POSITIONS.length); + }); + + it('should not display table', async () => { + mockGetBorrowPositionsOfAccount.mockReturnValue([]); + + await render(, { path }); + + expect(queryTable(TABLES.BORROW_POSITIONS)).not.toBeInTheDocument(); + }); + }); + + describe('Liquidity Pools', () => { + it('should display table', async () => { + mockGetLiquidityProvidedByAccount.mockResolvedValue(ACCOUNT_WITH_FULL_LIQUIDITY); + + await render(, { path }); + + const table = withinTable(TABLES.LIQUIDITY_POOLS); + + expect(table.getAllByRole('row')).toHaveLength(ACCOUNT_WITH_FULL_LIQUIDITY.length); + }); + + it('should not display table', async () => { + mockGetLiquidityProvidedByAccount.mockReturnValue(DEFAULT_ACCOUNT_LIQUIDITY); + + await render(, { path }); + + expect(queryTable(TABLES.LIQUIDITY_POOLS)).not.toBeInTheDocument(); + }); + }); + + describe('Staking', () => { + it('should display table', async () => { + await render(, { path }); + + const table = withinTable(TABLES.STAKED); + + expect(table.getAllByRole('row')).toHaveLength(1); + }); + + it('should not display table', async () => { + mockGetStakedBalance.mockReturnValue(EMPTY_STAKED_BALANCE); + + await render(, { path }); + + expect(queryTable(TABLES.LIQUIDITY_POOLS)).not.toBeInTheDocument(); + }); + }); +}); diff --git a/src/test/pages/utils/common.ts b/src/test/pages/utils/common.ts new file mode 100644 index 0000000000..223d6c77f2 --- /dev/null +++ b/src/test/pages/utils/common.ts @@ -0,0 +1,6 @@ +type ElementName = string | RegExp; + +const composeName = (name: ElementName): RegExp => (typeof name === 'string' ? new RegExp(name, 'i') : name); + +export { composeName }; +export type { ElementName }; diff --git a/src/test/pages/utils/list.ts b/src/test/pages/utils/list.ts new file mode 100644 index 0000000000..2818e63523 --- /dev/null +++ b/src/test/pages/utils/list.ts @@ -0,0 +1,17 @@ +/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ +import { screen, within } from '../../test-utils'; +import { composeName, ElementName } from './common'; + +const getList = (name: ElementName) => screen.getByRole('grid', { name: composeName(name) }); + +const withinList = (name: ElementName) => within(getList(name)); + +const getListRow = (listName: ElementName, rowName: ElementName) => { + const table = withinList(listName); + + return table.getByRole('row', { name: composeName(rowName) }); +}; + +const withinListRow = (listName: string, asset: string) => within(getListRow(listName, asset)); + +export { getList, getListRow, withinList, withinListRow }; diff --git a/src/test/pages/utils/table.ts b/src/test/pages/utils/table.ts index 96037c9ea9..bad822e8a3 100644 --- a/src/test/pages/utils/table.ts +++ b/src/test/pages/utils/table.ts @@ -1,12 +1,11 @@ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ import { screen, userEvent, waitFor, waitForElementToBeRemoved, within } from '../../test-utils'; - -type ElementName = string | RegExp; - -const composeName = (name: ElementName) => (typeof name === 'string' ? new RegExp(name, 'i') : name); +import { composeName, ElementName } from './common'; const getTable = (name: ElementName) => screen.getByRole('grid', { name: composeName(name) }); +const queryTable = (name: ElementName) => screen.queryByRole('grid', { name: composeName(name) }); + const withinTable = (name: ElementName) => { const table = within(getTable(name)); return within(table.getAllByRole('rowgroup')[1]); @@ -68,4 +67,4 @@ const submitForm = async (tabPanel: ReturnType, butt await waitForElementToBeRemoved(screen.getByRole('dialog')); }; -export { getTable, getTableRow, submitForm, withinModalTabPanel, withinTable, withinTableRow }; +export { getTable, getTableRow, queryTable, submitForm, withinModalTabPanel, withinTable, withinTableRow }; diff --git a/src/test/test-utils.tsx b/src/test/test-utils.tsx index e0f8fd3c73..3dc04831db 100644 --- a/src/test/test-utils.tsx +++ b/src/test/test-utils.tsx @@ -40,7 +40,10 @@ const ProvidersWrapper: (history: MemoryHistory) => FC<{ children?: React.ReactN ); }; -const customRender = async (ui: ReactElement, options?: CustomRenderOptions): Promise> => { +const customRender = async ( + ui: ReactElement, + options?: CustomRenderOptions +): Promise & { history: MemoryHistory }> => { const history = createMemoryHistory(); if (options?.path) { history.push(options.path); @@ -53,7 +56,7 @@ const customRender = async (ui: ReactElement, options?: CustomRenderOptions): Pr _render = render(ui, { wrapper: ProvidersWrapper(history), ...options }); }); - return _render as any; + return { ...(_render as any), history }; }; export * from '@testing-library/react'; diff --git a/src/utils/constants/links.ts b/src/utils/constants/links.ts index 6eaf055a0d..852612b127 100644 --- a/src/utils/constants/links.ts +++ b/src/utils/constants/links.ts @@ -28,7 +28,8 @@ const PAGES = Object.freeze({ ACTIONS: '/actions', LOANS: '/lending', SWAP: '/swap', - POOLS: '/pools' + POOLS: '/pools', + WALLET: '/wallet' }); const QUERY_PARAMETERS = Object.freeze({ @@ -37,7 +38,11 @@ const QUERY_PARAMETERS = Object.freeze({ ISSUE_REQUESTS_PAGE: 'issueRequestPage', REDEEM_REQUESTS_PAGE: 'redeemRequestPage', ISSUE_REQUEST_ID: 'issueRequestId', - REDEEM_REQUEST_ID: 'redeemRequestId' + REDEEM_REQUEST_ID: 'redeemRequestId', + SWAP: { + FROM: 'from', + TO: 'to' + } }); export { PAGES, QUERY_PARAMETERS, URL_PARAMETERS }; diff --git a/src/utils/helpers/coin-icon.ts b/src/utils/helpers/coin-icon.ts index 66abef5069..766d60c95a 100644 --- a/src/utils/helpers/coin-icon.ts +++ b/src/utils/helpers/coin-icon.ts @@ -2,7 +2,7 @@ import { CurrencyExt, StandardLpToken } from '@interlay/interbtc-api'; import { CoinIconProps } from '@/component-library'; -const getCoinIconProps = (currency: CurrencyExt): CoinIconProps => { +const getCoinIconProps = (currency: CurrencyExt): Pick => { if ((currency as StandardLpToken)?.lpToken) { return { ticker: currency.ticker, diff --git a/src/pages/Loans/LoansOverview/utils/get-subsidy-rewards-apy.ts b/src/utils/helpers/loans.ts similarity index 54% rename from src/pages/Loans/LoansOverview/utils/get-subsidy-rewards-apy.ts rename to src/utils/helpers/loans.ts index 13061b9ef3..c7241abb5e 100644 --- a/src/pages/Loans/LoansOverview/utils/get-subsidy-rewards-apy.ts +++ b/src/utils/helpers/loans.ts @@ -2,8 +2,27 @@ import { CurrencyExt } from '@interlay/interbtc-api'; import { MonetaryAmount } from '@interlay/monetary-js'; import Big from 'big.js'; -import { getTokenPrice } from '../../../../utils/helpers/prices'; -import { Prices } from '../../../../utils/hooks/api/use-get-prices'; +import { formatPercentage } from '@/common/utils/utils'; + +import { Prices } from '../hooks/api/use-get-prices'; +import { getTokenPrice } from './prices'; + +const MIN_DECIMAL_NUMBER = 0.01; + +// MEMO: returns formatted apy or better representation of a very small apy +const getApyLabel = (apy: Big): string => { + const isPositive = apy.gt(0); + const isTinyApy = isPositive ? apy.lt(MIN_DECIMAL_NUMBER) : apy.gt(-MIN_DECIMAL_NUMBER); + + if (isTinyApy) { + const tinyIndicator = apy.gt(0) ? '<' : '>'; + const minDecimal = isPositive ? MIN_DECIMAL_NUMBER : -MIN_DECIMAL_NUMBER; + + return `${tinyIndicator}${minDecimal}%`; + } + + return formatPercentage(apy.toNumber()); +}; const getSubsidyRewardApy = ( positionCurrency: CurrencyExt | undefined, @@ -27,4 +46,4 @@ const getSubsidyRewardApy = ( return apy; }; -export { getSubsidyRewardApy }; +export { getApyLabel, getSubsidyRewardApy }; diff --git a/src/utils/helpers/pools.ts b/src/utils/helpers/pools.ts new file mode 100644 index 0000000000..e75c766884 --- /dev/null +++ b/src/utils/helpers/pools.ts @@ -0,0 +1,32 @@ +import { CurrencyExt, LiquidityPool, LpCurrency } from '@interlay/interbtc-api'; +import { MonetaryAmount } from '@interlay/monetary-js'; +import Big from 'big.js'; + +import { calculateTotalLiquidityUSD } from '@/pages/AMM/shared/utils'; + +import { Prices } from '../hooks/api/use-get-prices'; + +const getPooledTickers = (liquidityPools: LiquidityPool[]): Set => + liquidityPools.reduce((acc, pool) => { + pool.pooledCurrencies.forEach((curr) => acc.add(curr.currency.ticker)); + + return acc; + }, new Set()); + +const getFarmingApr = ( + rewardAmountsYearly: Array>, + lpTotalSupply: MonetaryAmount, + totalLiquidityUSD: number, + prices: Prices | undefined +): Big => { + if (prices === undefined || lpTotalSupply.toBig().eq(0) || totalLiquidityUSD === 0) { + return new Big(0); + } + const totalRewardsPerTokenUSD = calculateTotalLiquidityUSD(rewardAmountsYearly, prices); + + const farmingApr = new Big(totalRewardsPerTokenUSD).div(totalLiquidityUSD).mul(100); + + return farmingApr; +}; + +export { getFarmingApr, getPooledTickers }; diff --git a/src/utils/hooks/api/escrow/use-get-account-staking-data.tsx b/src/utils/hooks/api/escrow/use-get-account-staking-data.tsx new file mode 100644 index 0000000000..31aebac5d7 --- /dev/null +++ b/src/utils/hooks/api/escrow/use-get-account-staking-data.tsx @@ -0,0 +1,71 @@ +import { CurrencyExt } from '@interlay/interbtc-api'; +import { MonetaryAmount } from '@interlay/monetary-js'; +import { AccountId } from '@polkadot/types/interfaces'; +import { add } from 'date-fns'; +import { useErrorHandler } from 'react-error-boundary'; +import { useQuery } from 'react-query'; + +import { BLOCK_TIME } from '@/config/parachain'; +import { BLOCKTIME_REFETCH_INTERVAL } from '@/utils/constants/api'; + +import useAccountId from '../../use-account-id'; + +type AccountUnlockStakingData = { + date: Date; + block: number; +}; + +type GetAccountStakingData = { + unlock: AccountUnlockStakingData; + balance: MonetaryAmount; +}; + +const getUnlockData = (stakeEndBlock: number, currentBlockNumber: number): AccountUnlockStakingData => { + const blocksUntilUnlockDate = stakeEndBlock - currentBlockNumber; + + const unlockDate = add(new Date(), { seconds: blocksUntilUnlockDate * BLOCK_TIME }); + + return { + date: unlockDate, + block: stakeEndBlock + }; +}; + +const getAccountStakingData = async (accountId: AccountId): Promise => { + const stakedBalancePromise = window.bridge.escrow.getStakedBalance(accountId); + const currentBlockNumberPromise = window.bridge.system.getCurrentBlockNumber(); + + const [stakedBalance, currentBlockNumber] = await Promise.all([stakedBalancePromise, currentBlockNumberPromise]); + + const unlock = getUnlockData(stakedBalance.endBlock, currentBlockNumber); + + return { + unlock, + balance: stakedBalance.amount + }; +}; + +interface GetAccountStakingDataResult { + data: GetAccountStakingData | undefined; + refetch: () => void; +} + +const useGetAccountStakingData = (): GetAccountStakingDataResult => { + const accountId = useAccountId(); + + const queryKey = ['staking', accountId]; + + const { data, error, refetch } = useQuery({ + queryKey, + queryFn: () => accountId && getAccountStakingData(accountId), + refetchInterval: BLOCKTIME_REFETCH_INTERVAL, + enabled: !!accountId + }); + + useErrorHandler(error); + + return { data, refetch }; +}; + +export { useGetAccountStakingData }; +export type { AccountUnlockStakingData, GetAccountStakingData, GetAccountStakingDataResult }; diff --git a/src/utils/hooks/api/escrow/use-get-account-voting-balance.tsx b/src/utils/hooks/api/escrow/use-get-account-voting-balance.tsx new file mode 100644 index 0000000000..649e79e61c --- /dev/null +++ b/src/utils/hooks/api/escrow/use-get-account-voting-balance.tsx @@ -0,0 +1,37 @@ +import { CurrencyExt } from '@interlay/interbtc-api'; +import { MonetaryAmount } from '@interlay/monetary-js'; +import { AccountId } from '@polkadot/types/interfaces'; +import { useErrorHandler } from 'react-error-boundary'; +import { useQuery } from 'react-query'; + +import { BLOCKTIME_REFETCH_INTERVAL } from '@/utils/constants/api'; + +import useAccountId from '../../use-account-id'; + +const getAccountVotingBalance = async (accountId: AccountId): Promise> => + window.bridge.escrow.votingBalance(accountId); + +interface GetAccountVotingBalanceResult { + data: MonetaryAmount | undefined; + refetch: () => void; +} + +const useGetAccountVotingBalance = (): GetAccountVotingBalanceResult => { + const accountId = useAccountId(); + + const queryKey = ['voting', accountId]; + + const { data, error, refetch } = useQuery({ + queryKey, + queryFn: () => accountId && getAccountVotingBalance(accountId), + refetchInterval: BLOCKTIME_REFETCH_INTERVAL, + enabled: !!accountId + }); + + useErrorHandler(error); + + return { data, refetch }; +}; + +export { useGetAccountVotingBalance }; +export type { GetAccountVotingBalanceResult }; diff --git a/src/utils/hooks/api/loans/use-get-account-lending-statistics.tsx b/src/utils/hooks/api/loans/use-get-account-lending-statistics.tsx index fbb860faba..b9211bba93 100644 --- a/src/utils/hooks/api/loans/use-get-account-lending-statistics.tsx +++ b/src/utils/hooks/api/loans/use-get-account-lending-statistics.tsx @@ -11,7 +11,7 @@ import Big from 'big.js'; import { useMemo } from 'react'; import { convertMonetaryAmountToValueInUSD, convertMonetaryBtcToUSD } from '@/common/utils/utils'; -import { getSubsidyRewardApy } from '@/pages/Loans/LoansOverview/utils/get-subsidy-rewards-apy'; +import { getSubsidyRewardApy } from '@/utils/helpers/loans'; import { getTokenPrice } from '@/utils/helpers/prices'; import { useGetLoanAssets } from '@/utils/hooks/api/loans/use-get-loan-assets'; diff --git a/src/utils/hooks/api/use-get-currencies.tsx b/src/utils/hooks/api/use-get-currencies.tsx index f6833b3758..1442f6a14c 100644 --- a/src/utils/hooks/api/use-get-currencies.tsx +++ b/src/utils/hooks/api/use-get-currencies.tsx @@ -68,18 +68,6 @@ const useGetCurrencies = (bridgeLoaded: boolean): UseGetCurrenciesResult => { [queryResult] ); - // export declare type StandardLpToken = Currency & { - // lpToken: { - // token0: StandardLpUnderlyingToken; - // token1: StandardLpUnderlyingToken; - // }; - // }; - // export declare type StableLpToken = Currency & { - // stableLpToken: { - // poolId: number; - // }; - // }; - // Throws when passed parameter is not id of any foreign currency or currencies are not loaded yet. const getLendCurrencyFromId = useCallback( (id: number): CurrencyExt => { diff --git a/src/utils/hooks/api/use-get-vesting-data.tsx b/src/utils/hooks/api/use-get-vesting-data.tsx new file mode 100644 index 0000000000..48972a88f1 --- /dev/null +++ b/src/utils/hooks/api/use-get-vesting-data.tsx @@ -0,0 +1,50 @@ +import { AccountId } from '@polkadot/types/interfaces'; +import { Codec } from '@polkadot/types/types'; +import { useErrorHandler } from 'react-error-boundary'; +import { useQuery } from 'react-query'; + +import { BLOCKTIME_REFETCH_INTERVAL } from '@/utils/constants/api'; + +import useAccountId from '../use-account-id'; + +type VestingData = { + schedules: Codec; + isClaimable: boolean; +}; + +interface UseGetVestingResult { + data: VestingData | undefined; + refetch: () => void; +} + +const getVestingData = async (accountId: AccountId): Promise => { + const currentBlockNumber = await window.bridge.system.getCurrentBlockNumber(); + + const schedules = await window.bridge.api.query.vesting.vestingSchedules(accountId); + + const schedule = schedules[0]; + const isClaimable = !!schedule && currentBlockNumber > schedule.start + schedule.period; + + return { + schedules, + isClaimable + }; +}; + +const useGetVestingData = (): UseGetVestingResult => { + const accountId = useAccountId(); + + const queryKey = ['vesting-schedule', accountId]; + const { data, error, refetch } = useQuery({ + queryKey, + queryFn: () => accountId && getVestingData(accountId), + refetchInterval: BLOCKTIME_REFETCH_INTERVAL + }); + + useErrorHandler(error); + + return { data, refetch }; +}; + +export { useGetVestingData }; +export type { UseGetVestingResult }; diff --git a/src/utils/hooks/use-copy-tooltip.tsx b/src/utils/hooks/use-copy-tooltip.tsx new file mode 100644 index 0000000000..36ec13ccd4 --- /dev/null +++ b/src/utils/hooks/use-copy-tooltip.tsx @@ -0,0 +1,63 @@ +import { HoverProps, useHover } from '@react-aria/interactions'; +import { mergeProps } from '@react-aria/utils'; +import { DOMAttributes, FocusableElement } from '@react-types/shared'; +import { useMemo, useState } from 'react'; +import { useTranslation } from 'react-i18next'; +import { useTimeoutFn } from 'react-use'; + +type CopyTooltipProp = Pick; + +type CopyTooltipResult = { + buttonProps: DOMAttributes; + tooltipProps: { + isOpen: boolean; + label: string; + }; +}; + +const useCopyTooltip = (props?: CopyTooltipProp): CopyTooltipResult => { + const { t } = useTranslation(); + + const defaultTooltipProps = useMemo(() => ({ isOpen: false, label: t('click_to_copy') }), [t]); + + const [tooltipProps, setTooltipProps] = useState(defaultTooltipProps); + const [isReadyToDefaultLabel, cancelLabelReset, setToDefaultLabel] = useTimeoutFn( + () => setTooltipProps((s) => ({ ...s, label: t('click_to_copy') })), + 1000 + ); + + const [isReadyToExit, cancelExit, delayExit] = useTimeoutFn(() => { + setTooltipProps((s) => ({ ...s, isOpen: false })); + }, 500); + + const defaultHoverProps = { + onHoverStart: () => { + // Cancel exit if is still ongoing + if (!isReadyToExit()) { + cancelExit(); + } + + setTooltipProps({ label: t('click_to_copy'), isOpen: true }); + }, + onHoverEnd: delayExit + }; + + const { hoverProps } = useHover({ ...props, ...defaultHoverProps }); + + const handlePress = () => { + // Cancel setting label to default if is still ongoing + if (!isReadyToDefaultLabel()) { + cancelLabelReset(); + } + setTooltipProps({ isOpen: true, label: t('copied') }); + setToDefaultLabel(); + }; + + return { + buttonProps: mergeProps(hoverProps, { onPress: handlePress }), + tooltipProps + }; +}; + +export { useCopyTooltip }; +export type { CopyTooltipResult }; diff --git a/src/utils/hooks/use-feature-flag.ts b/src/utils/hooks/use-feature-flag.ts index 2a56a1d222..58ae2cb1f7 100644 --- a/src/utils/hooks/use-feature-flag.ts +++ b/src/utils/hooks/use-feature-flag.ts @@ -1,11 +1,13 @@ enum FeatureFlags { LENDING = 'lending', - AMM = 'amm' + AMM = 'amm', + WALLET = 'wallet' } const featureFlags: Record = { [FeatureFlags.LENDING]: process.env.REACT_APP_FEATURE_FLAG_LENDING, - [FeatureFlags.AMM]: process.env.REACT_APP_FEATURE_FLAG_AMM + [FeatureFlags.AMM]: process.env.REACT_APP_FEATURE_FLAG_AMM, + [FeatureFlags.WALLET]: process.env.REACT_APP_FEATURE_FLAG_WALLET }; const useFeatureFlag = (feature: FeatureFlags): boolean => featureFlags[feature] === 'enabled'; diff --git a/yarn.lock b/yarn.lock index d4e566a66b..c958b5f663 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3938,6 +3938,17 @@ "@swc/helpers" "^0.4.14" clsx "^1.1.1" +"@react-aria/focus@^3.11.0": + version "3.11.0" + resolved "https://registry.yarnpkg.com/@react-aria/focus/-/focus-3.11.0.tgz#8124b2341e8d43af72f3da85b08567bda45421b7" + integrity sha512-yPuWs9bAR9CMfIwyOPm2oXLPF19gNkUqW+ozSPhWbLMTEa8Ma09eHW1br4xbN+4ONOm/dCJsIkxTNPUkiLdQoA== + dependencies: + "@react-aria/interactions" "^3.14.0" + "@react-aria/utils" "^3.15.0" + "@react-types/shared" "^3.17.0" + "@swc/helpers" "^0.4.14" + clsx "^1.1.1" + "@react-aria/focus@^3.6.1": version "3.6.1" resolved "https://registry.yarnpkg.com/@react-aria/focus/-/focus-3.6.1.tgz#46478d0919bdc4fedfa1ea115b36f93c055ce8d8" @@ -4136,6 +4147,15 @@ "@react-types/shared" "^3.16.0" "@swc/helpers" "^0.4.14" +"@react-aria/interactions@^3.14.0": + version "3.14.0" + resolved "https://registry.yarnpkg.com/@react-aria/interactions/-/interactions-3.14.0.tgz#d6480985048c009d58b8572428010dc61093cfcc" + integrity sha512-e1Tkr0UTuYFpV21PJrXy7jEY542Vl+C2Fo70oukZ1fN+wtfQkzodsTIzyepXb7kVMGmC34wDisMJUrksVkfY2w== + dependencies: + "@react-aria/utils" "^3.15.0" + "@react-types/shared" "^3.17.0" + "@swc/helpers" "^0.4.14" + "@react-aria/interactions@^3.9.1": version "3.9.1" resolved "https://registry.yarnpkg.com/@react-aria/interactions/-/interactions-3.9.1.tgz#1860b905d9a0b17ed74dd7fe769370e017cb3015" @@ -4175,6 +4195,18 @@ "@react-types/label" "^3.7.1" "@react-types/shared" "^3.16.0" +"@react-aria/link@^3.4.0": + version "3.4.0" + resolved "https://registry.yarnpkg.com/@react-aria/link/-/link-3.4.0.tgz#f3f7c5277ab9fc0b8c55c76503e1fbe764e02ca6" + integrity sha512-d/h4y7SFO+KweMX5IRU99L1jz9AAwp6mNStkBjYGxCD29QYTVWClpZHjRlO1s6a9e2QTpk/LzsvjiytowzfHyA== + dependencies: + "@react-aria/focus" "^3.11.0" + "@react-aria/interactions" "^3.14.0" + "@react-aria/utils" "^3.15.0" + "@react-types/link" "^3.4.0" + "@react-types/shared" "^3.17.0" + "@swc/helpers" "^0.4.14" + "@react-aria/live-announcer@^3.1.1": version "3.1.1" resolved "https://registry.yarnpkg.com/@react-aria/live-announcer/-/live-announcer-3.1.1.tgz#40f340f6794fca42682fb308fe750ff56bf7c07f" @@ -4307,6 +4339,13 @@ dependencies: "@swc/helpers" "^0.4.14" +"@react-aria/ssr@^3.5.0": + version "3.5.0" + resolved "https://registry.yarnpkg.com/@react-aria/ssr/-/ssr-3.5.0.tgz#40c1270a75868185f72a88cafe37bd1392f690cb" + integrity sha512-h0MJdSWOd1qObLnJ8mprU31wI8tmKFJMuwT22MpWq6psisOOZaga6Ml4u6Ee6M6duWWISjXvqO4Sb/J0PBA+nQ== + dependencies: + "@swc/helpers" "^0.4.14" + "@react-aria/switch@^3.2.4": version "3.2.4" resolved "https://registry.yarnpkg.com/@react-aria/switch/-/switch-3.2.4.tgz#6a4f95d89347b77d215b5b6d3640baba0360880b" @@ -4458,6 +4497,17 @@ "@swc/helpers" "^0.4.14" clsx "^1.1.1" +"@react-aria/utils@^3.15.0": + version "3.15.0" + resolved "https://registry.yarnpkg.com/@react-aria/utils/-/utils-3.15.0.tgz#a836674dd40ec7f15e9f7a69b1a14f19b1ee42e6" + integrity sha512-aJZBG++iz1UwTW5gXFaHicKju4p0MPhAyBTcf2awHYWeTUUslDjJcEnNg7kjBYZBOrOSlA2rAt7/7C5CCURQPg== + dependencies: + "@react-aria/ssr" "^3.5.0" + "@react-stately/utils" "^3.6.0" + "@react-types/shared" "^3.17.0" + "@swc/helpers" "^0.4.14" + clsx "^1.1.1" + "@react-aria/visually-hidden@^3.6.0": version "3.6.0" resolved "https://registry.yarnpkg.com/@react-aria/visually-hidden/-/visually-hidden-3.6.0.tgz#cc4dd9e648a5c8b6d8dfbd1f70d8672b36d3f1bc" @@ -4670,6 +4720,13 @@ dependencies: "@swc/helpers" "^0.4.14" +"@react-stately/utils@^3.6.0": + version "3.6.0" + resolved "https://registry.yarnpkg.com/@react-stately/utils/-/utils-3.6.0.tgz#f273e7fcb348254347d2e88c8f0c45571060c207" + integrity sha512-rptF7iUWDrquaYvBAS4QQhOBQyLBncDeHF03WnHXAxnuPJXNcr9cXJtjJPGCs036ZB8Q2hc9BGG5wNyMkF5v+Q== + dependencies: + "@swc/helpers" "^0.4.14" + "@react-stately/virtualizer@^3.2.2": version "3.2.2" resolved "https://registry.yarnpkg.com/@react-stately/virtualizer/-/virtualizer-3.2.2.tgz#3fca1acc0622d24b1acd3df8efd7795f546f3d1c" @@ -4766,6 +4823,14 @@ dependencies: "@react-types/shared" "^3.16.0" +"@react-types/link@^3.4.0": + version "3.4.0" + resolved "https://registry.yarnpkg.com/@react-types/link/-/link-3.4.0.tgz#1c549ffbc594e49726a4c4e912bea36718feb4cf" + integrity sha512-eImWLzxwzSmjOLa0Ow3HJaguyDCz98191v2pb7nT/zPzGDnhHhDjxB023hrXVUoCbsWrCb5QLp91Ts+VjiCyTA== + dependencies: + "@react-aria/interactions" "^3.14.0" + "@react-types/shared" "^3.17.0" + "@react-types/meter@^3.2.1": version "3.2.2" resolved "https://registry.yarnpkg.com/@react-types/meter/-/meter-3.2.2.tgz#029f593e405cf3aebccd9c0f54c588c399689559" @@ -4813,6 +4878,11 @@ resolved "https://registry.yarnpkg.com/@react-types/shared/-/shared-3.16.0.tgz#cab7bf0376969d1773480ecb2d6da5aa91391db5" integrity sha512-IQgU4oAEvMwylEvaTsr2XB1G/mAoMe1JFYLD6G78v++oAR9l8o9MQxZ0YSeANDkqTamb2gKezGoT1RxvSKjVxw== +"@react-types/shared@^3.17.0": + version "3.17.0" + resolved "https://registry.yarnpkg.com/@react-types/shared/-/shared-3.17.0.tgz#b7c5e318664aadb315d305a27dd2a209d1837d95" + integrity sha512-1SNZ/RhVrrQ1e6yE0bPV7d5Sfp+Uv0dfUEhwF9MAu2v5msu7AMewnsiojKNA0QA6Ing1gpDLjHCxtayQfuxqcg== + "@react-types/switch@^3.2.4": version "3.2.4" resolved "https://registry.yarnpkg.com/@react-types/switch/-/switch-3.2.4.tgz#6853793032da50415be1abbac1374fca08ea5e44" @@ -13991,6 +14061,11 @@ jest-matcher-utils@^28.1.3: jest-get-type "^28.0.2" pretty-format "^28.1.3" +jest-matchmedia-mock@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/jest-matchmedia-mock/-/jest-matchmedia-mock-1.1.0.tgz#eaae8c5d1dee4e4f7c59f8cb1b38b5d7ea842552" + integrity sha512-REnJRsOSCMpGAlkxmvVTqEBpregyFVi9MPEH3N83W1yLKzDdNehtCkcdDZduXq74PLtfI+11NyM4zKCK5ynV9g== + jest-message-util@^26.6.0, jest-message-util@^26.6.2: version "26.6.2" resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-26.6.2.tgz#58173744ad6fc0506b5d21150b9be56ef001ca07" From 0cdaf102e645f71a5b57ba5975e03837f4add511 Mon Sep 17 00:00:00 2001 From: tomjeatt <40243778+tomjeatt@users.noreply.github.com> Date: Tue, 4 Apr 2023 13:35:19 +0100 Subject: [PATCH 05/21] Tom/bug/burn form collateral tokens (#1042) * refactor: loop collateral to get burnable tokens * refactor: revert previous change and simplify * refactor: add function to filter tokens * refactor: fetch collateral currencies and render token values * wip: form layout and translation * wip: set data and selected collateral * chore: remove console log * refactor: remove single collateral code * chore: comment * fix: incorrect USD value * chore: remove testing code * refactor: remove native token import * refactor: add BurnableCollateral type * refactor: add fullWidth prop and label to token selector * refactor: collateral icon * chore: add dictionary item * chore: remove unnecessary conditional operators * refactor: handle callback * refactor: fix failing test * chore: remove unused code * refactor: add success notification to burn form --- src/assets/locales/en/translation.json | 6 +- .../Tokens/TokenSelector/index.tsx | 12 +- src/legacy-components/Tokens/index.tsx | 33 +++- src/pages/Bridge/BurnForm/index.tsx | 159 +++++++++++++----- src/pages/Bridge/index.tsx | 19 ++- .../interbtc-api/parachain/redeem.ts | 1 + src/test/pages/Burn.test.tsx | 24 +-- 7 files changed, 184 insertions(+), 70 deletions(-) diff --git a/src/assets/locales/en/translation.json b/src/assets/locales/en/translation.json index 6a49171400..bb3258f7f3 100644 --- a/src/assets/locales/en/translation.json +++ b/src/assets/locales/en/translation.json @@ -248,8 +248,10 @@ } }, "burn_page": { - "burn_interbtc": "Burn {{wrappedTokenSymbol}} in exchange for {{collateralTokenSymbol}}", - "available": "{{wrappedTokenSymbol}} available to burn", + "burn_interbtc": "Burn {{wrappedTokenSymbol}}", + "available_total": "Total available {{wrappedTokenSymbol}} to burn", + "available_from_collateral": "{{wrappedTokenSymbol}} available to burn from {{collateralTokenSymbol}}", + "collateral_selector_label": "In exchange for", "burn": "Burn", "please_enter_the_amount": "Please enter the amount.", "successfully_burned": "Successfully burned.", diff --git a/src/legacy-components/Tokens/TokenSelector/index.tsx b/src/legacy-components/Tokens/TokenSelector/index.tsx index 31fe8cea7c..addb85673e 100644 --- a/src/legacy-components/Tokens/TokenSelector/index.tsx +++ b/src/legacy-components/Tokens/TokenSelector/index.tsx @@ -25,16 +25,24 @@ interface Props { showBalances: boolean; currentToken: TokenOption; onChange: (type: TokenType) => void; + fullWidth?: boolean; } -const TokenSelector = ({ variant, tokenOptions, currentToken, onChange, showBalances }: Props): JSX.Element => { +const TokenSelector = ({ + variant, + tokenOptions, + currentToken, + onChange, + showBalances, + fullWidth +}: Props): JSX.Element => { return ( <> {currentToken && (