diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index be189af..1bf6041 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,7 @@ on: branches: - develop - main + - hotfix\/v[0-9]+.[0-9]+.[0-9]+ jobs: release: diff --git a/package.json b/package.json index b8922fa..0109128 100644 --- a/package.json +++ b/package.json @@ -104,7 +104,7 @@ "zod": "^3.20.6" }, "peerDependencies": { - "starknet": "^5.24.3" + "starknet": "^6.2.0" }, "gitHead": "b16688a8638cc138938e74e1a39d004760165d75" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ebeffe8..4994fbe 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -28,13 +28,13 @@ dependencies: version: 3.3.0 get-starknet-core: specifier: ^3.1.0 - version: 3.1.0(starknet@5.24.3) + version: 3.1.0(starknet@6.2.0) lodash-es: specifier: ^4.17.21 version: 4.17.21 starknet: - specifier: ^5.24.3 - version: 5.24.3 + specifier: ^6.2.0 + version: 6.2.0 svelte-forms: specifier: ^2.3.1 version: 2.3.1 @@ -911,14 +911,14 @@ packages: glob: 7.1.7 dev: true - /@noble/curves@1.2.0: - resolution: {integrity: sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==} + /@noble/curves@1.3.0: + resolution: {integrity: sha512-t01iSXPuN+Eqzb4eBX0S5oubSqXbK/xXa1Ne18Hj8f9pStxztHCE2gfboSp/dZRLSqfuLpRK2nDXDK+W9puocA==} dependencies: - '@noble/hashes': 1.3.2 + '@noble/hashes': 1.3.3 dev: false - /@noble/hashes@1.3.2: - resolution: {integrity: sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==} + /@noble/hashes@1.3.3: + resolution: {integrity: sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==} engines: {node: '>= 16'} dev: false @@ -1124,11 +1124,11 @@ packages: resolution: {integrity: sha512-/+SgoRjLq7Xlf0CWuLHq2LUZeL/w65kfzAPG5NH9pcmBhs+nunQTn4gvdwgMTIXnt9b2C/1SeL2XiysZEyIC9Q==} dev: false - /@scure/starknet@0.3.0: - resolution: {integrity: sha512-Ma66yZlwa5z00qI5alSxdWtIpky5LBhy22acVFdoC5kwwbd9uDyMWEYzWHdNyKmQg9t5Y2UOXzINMeb3yez+Gw==} + /@scure/starknet@1.0.0: + resolution: {integrity: sha512-o5J57zY0f+2IL/mq8+AYJJ4Xpc1fOtDhr+mFQKbHnYFmm3WQrC+8zj2HEgxak1a+x86mhmBC1Kq305KUpVf0wg==} dependencies: - '@noble/curves': 1.2.0 - '@noble/hashes': 1.3.2 + '@noble/curves': 1.3.0 + '@noble/hashes': 1.3.3 dev: false /@semantic-release/commit-analyzer@10.0.4(semantic-release@21.1.1): @@ -2066,6 +2066,16 @@ packages: through: 2.3.8 dev: true + /abi-wan-kanabi@2.2.2: + resolution: {integrity: sha512-sTCv2HyNIj1x2WFUoc9oL8ZT9liosrL+GoqEGZJK1kDND096CfA7lwx06vLxLWMocQ41FQXO3oliwoh/UZHYdQ==} + hasBin: true + dependencies: + ansicolors: 0.3.2 + cardinal: 2.1.1 + fs-extra: 10.1.0 + yargs: 17.7.2 + dev: false + /acorn-jsx@5.3.2(acorn@8.10.0): resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} peerDependencies: @@ -2164,7 +2174,6 @@ packages: /ansi-regex@5.0.1: resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} engines: {node: '>=8'} - dev: true /ansi-regex@6.0.1: resolution: {integrity: sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==} @@ -2183,7 +2192,6 @@ packages: engines: {node: '>=8'} dependencies: color-convert: 2.0.1 - dev: true /ansi-styles@6.2.1: resolution: {integrity: sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==} @@ -2192,7 +2200,6 @@ packages: /ansicolors@0.3.2: resolution: {integrity: sha512-QXu7BPrP29VllRxH8GwB7x5iX5qWKAAMLqKQGWTeLWVlNHNOpVMJ91dsxQAIWXpjuW5wqvxu3Jd/nRjrJ+0pqg==} - dev: true /anymatch@3.1.3: resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} @@ -2490,7 +2497,6 @@ packages: dependencies: ansicolors: 0.3.2 redeyed: 2.1.1 - dev: true /chalk@2.4.2: resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==} @@ -2572,7 +2578,6 @@ packages: string-width: 4.2.3 strip-ansi: 6.0.1 wrap-ansi: 7.0.0 - dev: true /code-red@1.0.4: resolution: {integrity: sha512-7qJWqItLA8/VPVlKJlFXU+NBlo/qyfs39aJcuMT/2ere32ZqvF5OSxgdM5xOfJJ7O429gg2HM47y8v9P+9wrNw==} @@ -2595,7 +2600,6 @@ packages: engines: {node: '>=7.0.0'} dependencies: color-name: 1.1.4 - dev: true /color-name@1.1.3: resolution: {integrity: sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==} @@ -2603,7 +2607,6 @@ packages: /color-name@1.1.4: resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} - dev: true /colorette@2.0.20: resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==} @@ -2988,7 +2991,6 @@ packages: /emoji-regex@8.0.0: resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} - dev: true /emoji-regex@9.2.2: resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==} @@ -3146,7 +3148,6 @@ packages: /escalade@3.1.1: resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} engines: {node: '>=6'} - dev: true /escape-string-regexp@1.0.5: resolution: {integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==} @@ -3417,7 +3418,6 @@ packages: resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} engines: {node: '>=4'} hasBin: true - dev: true /esquery@1.5.0: resolution: {integrity: sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==} @@ -3538,6 +3538,13 @@ packages: reusify: 1.0.4 dev: true + /fetch-cookie@3.0.1: + resolution: {integrity: sha512-ZGXe8Y5Z/1FWqQ9q/CrJhkUD73DyBU9VF0hBQmEO/wPHe4A9PKTjplFDLeFX8aOsYypZUcX5Ji/eByn3VCVO3Q==} + dependencies: + set-cookie-parser: 2.6.0 + tough-cookie: 4.1.3 + dev: false + /figures@2.0.0: resolution: {integrity: sha512-Oa2M9atig69ZkfwiApY8F2Yy+tzMbazyvqv21R0NsSC8floSOC09BbT1ITWAdoMGQvJ/aZnR1KMwdx9tvHnTNA==} engines: {node: '>=4'} @@ -3657,6 +3664,15 @@ packages: readable-stream: 2.3.8 dev: true + /fs-extra@10.1.0: + resolution: {integrity: sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==} + engines: {node: '>=12'} + dependencies: + graceful-fs: 4.2.11 + jsonfile: 6.1.0 + universalify: 2.0.0 + dev: false + /fs-extra@11.1.1: resolution: {integrity: sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==} engines: {node: '>=14.14'} @@ -3713,7 +3729,6 @@ packages: /get-caller-file@2.0.5: resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} engines: {node: 6.* || 8.* || >= 10.*} - dev: true /get-intrinsic@1.2.1: resolution: {integrity: sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==} @@ -3724,12 +3739,12 @@ packages: has-symbols: 1.0.3 dev: true - /get-starknet-core@3.1.0(starknet@5.24.3): + /get-starknet-core@3.1.0(starknet@6.2.0): resolution: {integrity: sha512-SPeYnzqKRXuukNoEr5aobxBmvhUSt4uWs6kFhMXl+3fG2R43u2D2DreDkA1n6T5DF10x5zLogldiHqn/jGlxEA==} peerDependencies: starknet: ^5.14.1 dependencies: - starknet: 5.24.3 + starknet: 6.2.0 dev: false /get-stream@6.0.1: @@ -3881,7 +3896,6 @@ packages: /graceful-fs@4.2.11: resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} - dev: true /graphemer@1.4.0: resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} @@ -4224,7 +4238,6 @@ packages: /is-fullwidth-code-point@3.0.0: resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} engines: {node: '>=8'} - dev: true /is-fullwidth-code-point@4.0.0: resolution: {integrity: sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==} @@ -4514,7 +4527,6 @@ packages: universalify: 2.0.0 optionalDependencies: graceful-fs: 4.2.11 - dev: true /jsonparse@1.3.1: resolution: {integrity: sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==} @@ -4758,8 +4770,8 @@ packages: js-tokens: 4.0.0 dev: true - /lossless-json@2.0.11: - resolution: {integrity: sha512-BP0vn+NGYvzDielvBZaFain/wgeJ1hTvURCqtKvhr1SCPePdaaTanmmcplrHfEJSJOUql7hk4FHwToNJjWRY3g==} + /lossless-json@4.0.1: + resolution: {integrity: sha512-l0L+ppmgPDnb+JGxNLndPtJZGNf6+ZmVaQzoxQm3u6TXmhdnsA+YtdVR8DjzZd/em58686CQhOFDPewfJ4l7MA==} dev: false /lru-cache@10.0.1: @@ -5603,10 +5615,13 @@ packages: resolution: {integrity: sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA==} dev: true + /psl@1.9.0: + resolution: {integrity: sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==} + dev: false + /punycode@2.3.0: resolution: {integrity: sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==} engines: {node: '>=6'} - dev: true /query-string@7.1.3: resolution: {integrity: sha512-hh2WYhq4fi8+b+/2Kg9CEge4fDPvHS534aOOvOZeQ3+Vf2mCFsaFBYj0i+iXcAq6I9Vzp5fjMFBlONvayDC1qg==} @@ -5617,6 +5632,10 @@ packages: split-on-first: 1.1.0 strict-uri-encode: 2.0.0 + /querystringify@2.2.0: + resolution: {integrity: sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==} + dev: false + /queue-microtask@1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} dev: true @@ -5735,7 +5754,6 @@ packages: resolution: {integrity: sha512-FNpGGo1DycYAdnrKFxCMmKYgo/mILAqtRYbkdQD8Ep/Hk2PQ5+aEAEx+IU713RTDmuBaH0c8P5ZozurNu5ObRQ==} dependencies: esprima: 4.0.1 - dev: true /reflect.getprototypeof@1.0.4: resolution: {integrity: sha512-ECkTw8TmJwW60lOTR+ZkODISW6RQ8+2CL3COqtiJKLd6MmB45hN51HprHFziKLGkAuTGQhBb91V8cy+KHlaCjw==} @@ -5772,13 +5790,16 @@ packages: /require-directory@2.1.1: resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} engines: {node: '>=0.10.0'} - dev: true /require-from-string@2.0.2: resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==} engines: {node: '>=0.10.0'} dev: true + /requires-port@1.0.0: + resolution: {integrity: sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==} + dev: false + /resolve-from@3.0.0: resolution: {integrity: sha512-GnlH6vxLymXJNMBo7XP1fJIzBFbdYt49CuTwmB/6N53t+kMPRMFKz783LlQ4tv28XoQfMWinAJX6WCGf2IlaIw==} engines: {node: '>=4'} @@ -5991,6 +6012,10 @@ packages: lru-cache: 6.0.0 dev: true + /set-cookie-parser@2.6.0: + resolution: {integrity: sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ==} + dev: false + /shebang-command@2.0.0: resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} engines: {node: '>=8'} @@ -6128,15 +6153,18 @@ packages: resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} dev: true - /starknet@5.24.3: - resolution: {integrity: sha512-v0TuaNc9iNtHdbIRzX372jfQH1vgx2rwBHQDMqK4DqjJbwFEE5dog8Go6rGiZVW750NqRSWrZ7ahqyRNc3bscg==} + /starknet@6.2.0: + resolution: {integrity: sha512-uxmTewT676hkxrA48Ds8sZyBks2ZdANUSA7UNwsb+ccDybGUFYwXpqftB9F6HVEulTAdJMEdiJYRiPPbLEerrg==} dependencies: - '@noble/curves': 1.2.0 + '@noble/curves': 1.3.0 '@scure/base': 1.1.3 - '@scure/starknet': 0.3.0 + '@scure/starknet': 1.0.0 + abi-wan-kanabi: 2.2.2 + fetch-cookie: 3.0.1 isomorphic-fetch: 3.0.0 - lossless-json: 2.0.11 + lossless-json: 4.0.1 pako: 2.1.0 + ts-mixer: 6.0.4 url-join: 4.0.1 transitivePeerDependencies: - encoding @@ -6168,7 +6196,6 @@ packages: emoji-regex: 8.0.0 is-fullwidth-code-point: 3.0.0 strip-ansi: 6.0.1 - dev: true /string-width@5.1.2: resolution: {integrity: sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==} @@ -6233,7 +6260,6 @@ packages: engines: {node: '>=8'} dependencies: ansi-regex: 5.0.1 - dev: true /strip-ansi@7.1.0: resolution: {integrity: sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==} @@ -6513,6 +6539,16 @@ packages: is-number: 7.0.0 dev: true + /tough-cookie@4.1.3: + resolution: {integrity: sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==} + engines: {node: '>=6'} + dependencies: + psl: 1.9.0 + punycode: 2.3.0 + universalify: 0.2.0 + url-parse: 1.5.10 + dev: false + /tr46@0.0.3: resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} @@ -6544,6 +6580,10 @@ packages: typescript: 5.1.6 dev: true + /ts-mixer@6.0.4: + resolution: {integrity: sha512-ufKpbmrugz5Aou4wcr5Wc1UUFWOLhq+Fm6qa6P0w0K5Qw2yhaUoiWszhCVuNQyNwrlGiscHOmqYoAox1PtvgjA==} + dev: false + /ts-node@10.9.1(@types/node@20.5.7)(typescript@5.1.6): resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} hasBin: true @@ -6732,10 +6772,14 @@ packages: engines: {node: '>= 4.0.0'} dev: true + /universalify@0.2.0: + resolution: {integrity: sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==} + engines: {node: '>= 4.0.0'} + dev: false + /universalify@2.0.0: resolution: {integrity: sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==} engines: {node: '>= 10.0.0'} - dev: true /update-browserslist-db@1.0.11(browserslist@4.21.10): resolution: {integrity: sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA==} @@ -6763,6 +6807,13 @@ packages: engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} dev: true + /url-parse@1.5.10: + resolution: {integrity: sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==} + dependencies: + querystringify: 2.2.0 + requires-port: 1.0.0 + dev: false + /util-deprecate@1.0.2: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} @@ -6952,7 +7003,6 @@ packages: ansi-styles: 4.3.0 string-width: 4.2.3 strip-ansi: 6.0.1 - dev: true /wrap-ansi@8.1.0: resolution: {integrity: sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==} @@ -6999,7 +7049,6 @@ packages: /y18n@5.0.8: resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} engines: {node: '>=10'} - dev: true /yallist@3.1.1: resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==} @@ -7032,7 +7081,6 @@ packages: /yargs-parser@21.1.1: resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} engines: {node: '>=12'} - dev: true /yargs@17.7.2: resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==} @@ -7045,7 +7093,6 @@ packages: string-width: 4.2.3 y18n: 5.0.8 yargs-parser: 21.1.1 - dev: true /yn@3.1.1: resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==} diff --git a/src/connectors/argentMobile/modal/login.ts b/src/connectors/argentMobile/modal/login.ts index 1aefd7c..5482b80 100644 --- a/src/connectors/argentMobile/modal/login.ts +++ b/src/connectors/argentMobile/modal/login.ts @@ -124,8 +124,8 @@ const getBridgeUrl = (chainId: unknown) => { } const chainIdNumber = parseInt(`${chainId}`) if ( - String(chainId).startsWith(Network.SN_GOERLI) || - chainIdNumber === 5 // testnet numeric value + String(chainId).startsWith(Network.SN_SEPOLIA) || + chainIdNumber === 11155111 // sepolia numeric value ) { return "https://login.hydrogen.argent47.net" } @@ -146,8 +146,8 @@ const getMobileUrl = (chainId: unknown) => { } const chainIdNumber = parseInt(`${chainId}`) if ( - String(chainId).startsWith(Network.SN_GOERLI) || - chainIdNumber === 5 // testnet numeric value + String(chainId).startsWith(Network.SN_SEPOLIA) || + chainIdNumber === 11155111 // sepolia numeric value ) { return "argent-dev://" } diff --git a/src/connectors/argentMobile/modal/starknet/adapter.ts b/src/connectors/argentMobile/modal/starknet/adapter.ts index 66709de..92cdf0a 100644 --- a/src/connectors/argentMobile/modal/starknet/adapter.ts +++ b/src/connectors/argentMobile/modal/starknet/adapter.ts @@ -94,8 +94,8 @@ export class StarknetAdapter } getNetworkName(chainId: string): constants.NetworkName { - if (chainId === "SN_GOERLI") { - return constants.NetworkName.SN_GOERLI + if (chainId === "SN_SEPOLIA") { + return constants.NetworkName.SN_SEPOLIA } if (chainId === "SN_MAIN") { diff --git a/src/connectors/injected/index.ts b/src/connectors/injected/index.ts index 33af12a..4576080 100644 --- a/src/connectors/injected/index.ts +++ b/src/connectors/injected/index.ts @@ -89,9 +89,9 @@ export class InjectedConnector extends Connector { chainId: BigInt(constants.StarknetChainId.SN_MAIN), }) break - case "SN_GOERLI": + case "SN_SEPOLIA": this.emit("change", { - chainId: BigInt(constants.StarknetChainId.SN_GOERLI), + chainId: BigInt(constants.StarknetChainId.SN_SEPOLIA), }) break // Braavos @@ -100,9 +100,9 @@ export class InjectedConnector extends Connector { chainId: BigInt(constants.StarknetChainId.SN_MAIN), }) break - case "goerli-alpha": + case "sepolia-alpha": this.emit("change", { - chainId: BigInt(constants.StarknetChainId.SN_GOERLI), + chainId: BigInt(constants.StarknetChainId.SN_SEPOLIA), }) break default: diff --git a/src/connectors/webwallet/constants.ts b/src/connectors/webwallet/constants.ts index d209e53..6844631 100644 --- a/src/connectors/webwallet/constants.ts +++ b/src/connectors/webwallet/constants.ts @@ -14,3 +14,9 @@ export const DEFAULT_WEBWALLET_ICON = ` ` + +export const TESTNET_WHITELIST_URL = + "https://static.hydrogen.argent47.net/webwallet/iframe_whitelist_testnet.json" + +export const MAINNET_WHITELIST_URL = + "https://static.argent.xyz/webwallet/iframe_whitelist_mainnet.json" diff --git a/src/connectors/webwallet/helpers/fetchAllowedDapps.ts b/src/connectors/webwallet/helpers/fetchAllowedDapps.ts new file mode 100644 index 0000000..8d7a7c2 --- /dev/null +++ b/src/connectors/webwallet/helpers/fetchAllowedDapps.ts @@ -0,0 +1,59 @@ +import { constants } from "starknet" +import { MAINNET_WHITELIST_URL, TESTNET_WHITELIST_URL } from "../constants" + +const CACHE_NAME = "allowed-dapps" + +type AllowedDappsJsonResponse = { + allowedDapps: string[] +} + +export const fetchAllowedDapps = async ( + network: constants.NetworkName, +): Promise => { + const url = + network === constants.NetworkName.SN_MAIN + ? MAINNET_WHITELIST_URL + : TESTNET_WHITELIST_URL + try { + const cache = await caches.open(CACHE_NAME) + const cachedResponse = await cache.match(url) + + if (cachedResponse) { + const cachedTimestamp = parseInt( + cachedResponse.headers.get("X-Cache-Timestamp"), + 10, + ) + const currentTimestamp = new Date().getTime() + const timeDiff = currentTimestamp - cachedTimestamp + const hoursDiff = timeDiff / (1000 * 60 * 60) + + if (hoursDiff < 24) { + return cachedResponse.json() + } + } + + const response = await fetch(url) + const clonedHeaders = new Headers(response.headers) + + // Store the current timestamp in a custom header + clonedHeaders.set("X-Cache-Timestamp", new Date().getTime().toString()) + + // Read JSON data from the original response + const responseData = await response.json() + + // Create a new response with the cloned headers and original JSON data + const responseToCache = new Response(JSON.stringify(responseData), { + status: response.status, + statusText: response.statusText, + headers: clonedHeaders, + }) + + // Open the cache and add the response to it + const updatedCache = await caches.open(CACHE_NAME) + await updatedCache.put(url, responseToCache) + + return responseData + } catch (error) { + throw new Error(error) + } +} diff --git a/src/connectors/webwallet/helpers/openWebwallet.ts b/src/connectors/webwallet/helpers/openWebwallet.ts new file mode 100644 index 0000000..8ede2f5 --- /dev/null +++ b/src/connectors/webwallet/helpers/openWebwallet.ts @@ -0,0 +1,97 @@ +import { getWebWalletStarknetObject } from "../starknetWindowObject/getWebWalletStarknetObject" +import { trpcProxyClient } from "./trpc" +import type { StarknetWindowObject } from "get-starknet-core" +import { mapTargetUrlToNetworkId } from "../../../helpers/mapTargetUrlToNetworkId" +import { fetchAllowedDapps } from "./fetchAllowedDapps" +import { ProviderInterface } from "starknet" +import { createModal } from "../starknetWindowObject/wormhole" + +const checkIncognitoChrome = async (isChrome: boolean) => { + return new Promise((resolve) => { + if (!isChrome) { + return resolve(false) + } + try { + const webkitTemporaryStorage = (navigator as any).webkitTemporaryStorage + webkitTemporaryStorage.queryUsageAndQuota( + (_: unknown, quota: number) => { + resolve( + Math.round(quota / (1024 * 1024)) < + Math.round( + ((performance as any)?.memory?.jsHeapSizeLimit ?? 1073741824) / + (1024 * 1024), + ) * + 2, + ) + }, + () => resolve(false), + ) + } catch { + resolve(false) + } + }) +} + +export const openWebwallet = async ( + origin: string, + provider?: ProviderInterface, +): Promise => { + const { userAgent } = navigator + const isChrome = Boolean( + navigator.vendor && + navigator.vendor.indexOf("Google") === 0 && + (navigator as any).brave === undefined && + !userAgent.match(/Edg/) && + !userAgent.match(/OPR/), + ) + + const isChromeIncognito = await checkIncognitoChrome(isChrome) + + // if not chrome or is chrome incognito + // use the popup mode and avoid checking allowed dapps for iframes + if (!isChrome || isChromeIncognito) { + const windowProxyClient = trpcProxyClient({}) + return await getWebWalletStarknetObject( + origin, + windowProxyClient, + undefined, + ) + } + + const network = mapTargetUrlToNetworkId(origin) + const { allowedDapps } = await fetchAllowedDapps(network) + + if (allowedDapps.includes(window.location.hostname)) { + const modalId = "argent-webwallet-modal" + const iframeId = "argent-webwallet-iframe" + + const existingIframe = document.getElementById(modalId) + const existingModal = document.getElementById(iframeId) + + // avoid duplicate iframes + if (existingIframe && existingIframe && existingModal) { + existingIframe.remove() + existingModal.remove() + } + const { iframe, modal } = await createModal(origin, false) + + const iframeTrpcProxyClient = trpcProxyClient({ + iframe: iframe.contentWindow ?? undefined, + }) + await iframeTrpcProxyClient.authorize.mutate() + const starknetWindowObject = await getWebWalletStarknetObject( + origin, + iframeTrpcProxyClient, + provider, + { modal, iframe }, + ) + return starknetWindowObject + } else { + const windowProxyClient = trpcProxyClient({}) + return await getWebWalletStarknetObject( + origin, + windowProxyClient, + undefined, + ) + } +} diff --git a/src/connectors/webwallet/index.ts b/src/connectors/webwallet/index.ts index 2546bb7..9e41eba 100644 --- a/src/connectors/webwallet/index.ts +++ b/src/connectors/webwallet/index.ts @@ -19,6 +19,7 @@ import { import { DEFAULT_WEBWALLET_ICON, DEFAULT_WEBWALLET_URL } from "./constants" import { getWebWalletStarknetObject } from "./starknetWindowObject/getWebWalletStarknetObject" import { removeStarknetLastConnectedWallet } from "../../helpers/lastConnected" +import { openWebwallet } from "./helpers/openWebwallet" let _wallet: StarknetWindowObject | null = null @@ -91,7 +92,8 @@ export class WebWalletConnector extends Connector { try { await this._wallet.enable({ starknetVersion: "v4" }) - } catch { + } catch (e) { + console.log(e) // NOTE: Argent v3.0.0 swallows the `.enable` call on reject, so this won't get hit. throw new UserRejectedRequestError() } @@ -171,11 +173,7 @@ export class WebWalletConnector extends Connector { origin, location: "/interstitialLogin", }) - const wallet = await getWebWalletStarknetObject( - origin, - trpcProxyClient({}), - provider, - ) + const wallet = await openWebwallet(origin, provider) _wallet = wallet ?? null this._wallet = _wallet diff --git a/src/connectors/webwallet/starknetWindowObject/getWebWalletStarknetObject.ts b/src/connectors/webwallet/starknetWindowObject/getWebWalletStarknetObject.ts index 90dd22e..c2cca54 100644 --- a/src/connectors/webwallet/starknetWindowObject/getWebWalletStarknetObject.ts +++ b/src/connectors/webwallet/starknetWindowObject/getWebWalletStarknetObject.ts @@ -1,15 +1,28 @@ import type { CreateTRPCProxyClient } from "@trpc/client" -import { ProviderInterface, RpcProvider } from "starknet" - -import { mapTargetUrlToNodeUrl } from "../helpers/mapTargetUrlToNodeUrl" import type { AppRouter } from "../helpers/trpc" import type { WebWalletStarknetWindowObject } from "./argentStarknetWindowObject" import { getArgentStarknetWindowObject } from "./argentStarknetWindowObject" +import { hideModal, setIframeHeight, showModal } from "./wormhole" +import { mapTargetUrlToNodeUrl } from "../helpers/mapTargetUrlToNodeUrl" +import { ProviderInterface, RpcProvider } from "starknet" + +type IframeProps = { + modal: HTMLDivElement + iframe: HTMLIFrameElement +} + +type ModalEvents = + | { + action: "show" | "hide" + visible: boolean + } + | { action: "updateHeight"; height: number } export const getWebWalletStarknetObject = async ( target: string, proxyLink: CreateTRPCProxyClient, provider?: ProviderInterface, + iframeProps?: IframeProps, ): Promise => { const globalWindow = typeof window !== "undefined" ? window : undefined if (!globalWindow) { @@ -30,5 +43,23 @@ export const getWebWalletStarknetObject = async ( proxyLink, ) + if (iframeProps) { + const { iframe, modal } = iframeProps + proxyLink.updateModal.subscribe(undefined, { + onData(modalEvent: ModalEvents) { + switch (modalEvent.action) { + case "show": + showModal(modal) + break + case "hide": + hideModal(modal) + break + case "updateHeight": + setIframeHeight(iframe, modalEvent.height) + } + }, + }) + } + return starknetWindowObject } diff --git a/src/connectors/webwallet/starknetWindowObject/wormhole.ts b/src/connectors/webwallet/starknetWindowObject/wormhole.ts new file mode 100644 index 0000000..e70e27e --- /dev/null +++ b/src/connectors/webwallet/starknetWindowObject/wormhole.ts @@ -0,0 +1,84 @@ +const applyModalStyle = (iframe: HTMLIFrameElement) => { + // middle of the screen + iframe.style.position = "fixed" + iframe.style.top = "50%" + iframe.style.left = "50%" + iframe.style.transform = "translate(-50%, -50%)" + iframe.style.width = "380px" + iframe.style.height = "420px" + iframe.style.border = "none" + + // round corners + iframe.style.borderRadius = "40px" + // box shadow + iframe.style.boxShadow = "0px 4px 20px rgba(0, 0, 0, 0.5)" + + const background = document.createElement("div") + background.style.display = "none" + background.style.position = "fixed" + background.style.top = "0" + background.style.left = "0" + background.style.right = "0" + background.style.bottom = "0" + background.style.backgroundColor = "rgba(0, 0, 0, 0.5)" + background.style.zIndex = "99999" + ;(background.style as any).backdropFilter = "blur(4px)" + + background.appendChild(iframe) + + return background +} + +export const showModal = (modal: HTMLDivElement) => { + modal.style.display = "block" +} + +export const hideModal = (modal: HTMLDivElement) => { + modal.style.display = "none" +} + +export const setIframeHeight = (modal: HTMLIFrameElement, height: number) => { + modal.style.height = `min(${height || 420}px, 100%)` +} + +export const createModal = async (targetUrl: string, shouldShow: boolean) => { + // make sure target url has always /iframes/comms as the path + const url = new URL(targetUrl) + url.pathname = "/iframes/comms" + targetUrl = url.toString() + + const iframe = document.createElement("iframe") + iframe.src = targetUrl + ;(iframe as any).loading = "eager" + iframe.sandbox.add( + "allow-scripts", + "allow-same-origin", + "allow-forms", + "allow-top-navigation", + "allow-popups", + ) + iframe.allow = "clipboard-write" + iframe.id = "argent-webwallet-iframe" + + const modal = applyModalStyle(iframe) + modal.style.display = shouldShow ? "block" : "none" + modal.id = "argent-webwallet-modal" + + // append the modal to the body + window.document.body.appendChild(modal) + + // wait for the iframe to load + await new Promise((resolve, reject) => { + const pid = setTimeout( + () => reject(new Error("Timeout while loading an iframe")), + 20000, + ) + + iframe.addEventListener("load", async () => { + clearTimeout(pid) + resolve() + }) + }) + + return { iframe, modal } +} diff --git a/src/helpers/mapTargetUrlToNetworkId.ts b/src/helpers/mapTargetUrlToNetworkId.ts index 0f949df..580a52d 100644 --- a/src/helpers/mapTargetUrlToNetworkId.ts +++ b/src/helpers/mapTargetUrlToNetworkId.ts @@ -3,7 +3,7 @@ import { constants } from "starknet" // Using NetworkName as a value. const Network: typeof constants.NetworkName = constants.NetworkName -const DEVELOPMENT_NETWORK = Network.SN_GOERLI +const DEVELOPMENT_NETWORK = Network.SN_SEPOLIA export function mapTargetUrlToNetworkId(target: string): constants.NetworkName { try { @@ -12,13 +12,13 @@ export function mapTargetUrlToNetworkId(target: string): constants.NetworkName { return DEVELOPMENT_NETWORK } if (origin.includes("hydrogen")) { - return Network.SN_GOERLI + return Network.SN_SEPOLIA } if (origin.includes("staging")) { return Network.SN_MAIN } if (origin.includes("dev")) { - return Network.SN_GOERLI2 + return Network.SN_SEPOLIA } if (origin.includes("argent.xyz")) { return Network.SN_MAIN diff --git a/src/helpers/publicRcpNodes.ts b/src/helpers/publicRcpNodes.ts index 72e81df..22ca837 100644 --- a/src/helpers/publicRcpNodes.ts +++ b/src/helpers/publicRcpNodes.ts @@ -6,12 +6,12 @@ export type PublicRpcNode = { // Public RPC nodes export const BLAST_RPC_NODE: PublicRpcNode = { mainnet: "https://starknet-mainnet.public.blastapi.io", - testnet: "https://starknet-testnet.public.blastapi.io", + testnet: "https://starknet-sepolia.public.blastapi.io", } as const export const LAVA_RPC_NODE: PublicRpcNode = { mainnet: "https://rpc.starknet.lava.build", - testnet: "https://rpc.starknet-testnet.lava.build", + testnet: "https://rpc.starknet-sepolia.lava.build", } as const export const PUBLIC_RPC_NODES = [BLAST_RPC_NODE, LAVA_RPC_NODE] as const