From 4c40f15248dddd14c443be2aff6da4afcc22bd56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elio=20Brice=C3=B1o?= Date: Mon, 30 Sep 2024 11:23:47 -0400 Subject: [PATCH 01/14] feat(quest-details): extend QuestDetailsProps --- package.json | 2 +- src/components/QuestDetailsWrapper/index.tsx | 33 ++++++++++++++++---- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index a7784b2..e189bb8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hyperplay/quests-ui", - "version": "0.0.22", + "version": "0.0.23", "description": "", "main": "index.js", "scripts": { diff --git a/src/components/QuestDetailsWrapper/index.tsx b/src/components/QuestDetailsWrapper/index.tsx index ea98082..bd82b1e 100644 --- a/src/components/QuestDetailsWrapper/index.tsx +++ b/src/components/QuestDetailsWrapper/index.tsx @@ -45,7 +45,23 @@ class ClaimError extends Error { } } -export interface QuestDetailsWrapperProps { +export interface QuestDetailsWrapperProps + extends Omit< + QuestDetailsProps, + | 'i18n' + | 'eligibility' + | 'rewards' + | 'onClaimClick' + | 'title' + | 'description' + | 'claimPoints' + | 'completeExternalTask' + | 'onSignInClick' + | 'onConnectSteamAccountClick' + | 'collapseIsOpen' + | 'toggleCollapse' + | 'questType' + > { className?: string selectedQuestId: number | null projectId: string @@ -79,6 +95,7 @@ export interface QuestDetailsWrapperProps { sessionEmail?: string checkG7ConnectionStatus: () => Promise isQuestsPage?: boolean + i18n?: Partial } export function QuestDetailsWrapper({ @@ -107,7 +124,8 @@ export function QuestDetailsWrapper({ tOverride, sessionEmail, checkG7ConnectionStatus, - isQuestsPage + isQuestsPage, + ...questDetailsParamProps }: QuestDetailsWrapperProps) { const rewardTypeClaimEnabled = flags.rewardTypeClaimEnabled const { @@ -286,6 +304,7 @@ export function QuestDetailsWrapper({ ?.length const i18n: QuestDetailsTranslations = { + ...questDetailsParamProps.i18n, rewards: t('quest.reward', 'Rewards'), associatedGames: t('quest.associatedGames', 'Associated games'), linkSteamAccount: t( @@ -594,7 +613,6 @@ export function QuestDetailsWrapper({ ) }, rewards: questRewards ?? [], - i18n, onClaimClick: async () => { if (isRewardOnChain) { setShowWarning(true) @@ -616,7 +634,9 @@ export function QuestDetailsWrapper({ }, isSyncing: resyncMutation.isPending, chainTooltips: {}, - isQuestsPage + isQuestsPage, + ...questDetailsParamProps, + i18n, } questDetails = ( <> @@ -664,7 +684,6 @@ export function QuestDetailsWrapper({ lastPlaySessionCompletedDateTimeUTC: new Date().toISOString() } }, - i18n, rewards: [], onClaimClick: () => console.log('claim clicked for ', questMeta?.name), onSignInClick: () => console.log('sign in clicked for ', questMeta?.name), @@ -673,7 +692,9 @@ export function QuestDetailsWrapper({ collapseIsOpen, toggleCollapse: () => setCollapseIsOpen(!collapseIsOpen), isSignedIn, - isQuestsPage + isQuestsPage, + ...questDetailsParamProps, + i18n } questDetails = ( Date: Mon, 30 Sep 2024 11:26:12 -0400 Subject: [PATCH 02/14] chore: prettier --- src/components/QuestDetailsWrapper/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/QuestDetailsWrapper/index.tsx b/src/components/QuestDetailsWrapper/index.tsx index bd82b1e..bfc8a9c 100644 --- a/src/components/QuestDetailsWrapper/index.tsx +++ b/src/components/QuestDetailsWrapper/index.tsx @@ -636,7 +636,7 @@ export function QuestDetailsWrapper({ chainTooltips: {}, isQuestsPage, ...questDetailsParamProps, - i18n, + i18n } questDetails = ( <> From 3f69603eed01405cee510ef5912d150544f85dd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elio=20Brice=C3=B1o?= Date: Mon, 30 Sep 2024 15:33:33 -0400 Subject: [PATCH 03/14] tech(quest-details-wrapper): remove omits in the extend --- src/components/QuestDetailsWrapper/index.tsx | 21 +++----------------- 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/src/components/QuestDetailsWrapper/index.tsx b/src/components/QuestDetailsWrapper/index.tsx index bfc8a9c..62c3ff7 100644 --- a/src/components/QuestDetailsWrapper/index.tsx +++ b/src/components/QuestDetailsWrapper/index.tsx @@ -46,22 +46,7 @@ class ClaimError extends Error { } export interface QuestDetailsWrapperProps - extends Omit< - QuestDetailsProps, - | 'i18n' - | 'eligibility' - | 'rewards' - | 'onClaimClick' - | 'title' - | 'description' - | 'claimPoints' - | 'completeExternalTask' - | 'onSignInClick' - | 'onConnectSteamAccountClick' - | 'collapseIsOpen' - | 'toggleCollapse' - | 'questType' - > { + extends Omit { className?: string selectedQuestId: number | null projectId: string @@ -590,6 +575,7 @@ export function QuestDetailsWrapper({ ) const questDetailsProps: QuestDetailsProps = { + ...questDetailsParamProps, className, alertProps, questType: questMeta.type, @@ -635,7 +621,6 @@ export function QuestDetailsWrapper({ isSyncing: resyncMutation.isPending, chainTooltips: {}, isQuestsPage, - ...questDetailsParamProps, i18n } questDetails = ( @@ -665,6 +650,7 @@ export function QuestDetailsWrapper({ rewardsQuery?.data.isLoading ) { const emptyQuestDetailsProps: QuestDetailsProps = { + ...questDetailsParamProps, className, questType: 'PLAYSTREAK', title: '', @@ -693,7 +679,6 @@ export function QuestDetailsWrapper({ toggleCollapse: () => setCollapseIsOpen(!collapseIsOpen), isSignedIn, isQuestsPage, - ...questDetailsParamProps, i18n } questDetails = ( From 7004b2f37a207b169c275a4ade55474af5801a52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elio=20Brice=C3=B1o?= Date: Tue, 1 Oct 2024 15:58:24 -0400 Subject: [PATCH 04/14] feat(quest-details): add sync button --- package.json | 4 +- pnpm-lock.yaml | 403 +++++++++++++++++- src/components/QuestDetailsWrapper/index.tsx | 22 +- src/helpers/getPlaystreakArgsFromQuestData.ts | 2 +- src/hooks/useSyncPlayStreak.ts | 69 +++ src/index.ts | 1 + 6 files changed, 486 insertions(+), 15 deletions(-) create mode 100644 src/hooks/useSyncPlayStreak.ts diff --git a/package.json b/package.json index e189bb8..4dfad85 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hyperplay/quests-ui", - "version": "0.0.23", + "version": "0.0.24", "description": "", "main": "index.js", "scripts": { @@ -25,7 +25,7 @@ "types": "dist/index.d.ts", "devDependencies": { "@hyperplay/chains": "^0.3.0", - "@hyperplay/ui": "^1.7.17", + "@hyperplay/ui": "^1.7.26", "@hyperplay/utils": "^0.2.3", "@tanstack/react-query": "^5.51.23", "@types/react": "^18.3.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fa0b705..4433eb8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -16,8 +16,8 @@ importers: specifier: ^0.3.0 version: 0.3.0(bufferutil@4.0.8)(typescript@5.5.4)(utf-8-validate@5.0.10) '@hyperplay/ui': - specifier: ^1.7.17 - version: 1.7.17(@emotion/react@11.13.0(@types/react@18.3.3)(react@18.3.1))(@mantine/carousel@7.12.1(@mantine/core@7.12.1(@mantine/hooks@7.12.1(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/hooks@7.12.1(react@18.3.1))(embla-carousel-react@8.1.8(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/core@7.12.1(@mantine/hooks@7.12.1(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/dropzone@7.12.1(@mantine/core@7.12.1(@mantine/hooks@7.12.1(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/hooks@7.12.1(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/hooks@7.12.1(react@18.3.1))(embla-carousel-autoplay@8.1.8(embla-carousel@8.1.8))(embla-carousel-react@8.1.8(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react-markdown@9.0.1(@types/react@18.3.3)(react@18.3.1))(react@18.3.1) + specifier: ^1.7.26 + version: 1.7.26(@emotion/react@11.13.0(@types/react@18.3.3)(react@18.3.1))(@mantine/carousel@7.12.1(@mantine/core@7.12.1(@mantine/hooks@7.12.1(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/hooks@7.12.1(react@18.3.1))(embla-carousel-react@8.1.8(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/core@7.12.1(@mantine/hooks@7.12.1(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/dropzone@7.12.1(@mantine/core@7.12.1(@mantine/hooks@7.12.1(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/hooks@7.12.1(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/hooks@7.12.1(react@18.3.1))(bufferutil@4.0.8)(embla-carousel-autoplay@8.1.8(embla-carousel@8.1.8))(embla-carousel-react@8.1.8(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react-markdown@9.0.1(@types/react@18.3.3)(react@18.3.1))(react@18.3.1)(utf-8-validate@5.0.10) '@hyperplay/utils': specifier: ^0.2.3 version: 0.2.3 @@ -84,6 +84,9 @@ packages: '@adraffy/ens-normalize@1.10.0': resolution: {integrity: sha512-nA9XHtlAkYfJxY7bce8DcN7eKxWWCWkU+1GR9d+U6MbNpfwQp8TI7vqOsBsMcHoT4mBu2kypKoSKnghEzOOq5Q==} + '@adraffy/ens-normalize@1.10.1': + resolution: {integrity: sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw==} + '@ampproject/remapping@2.3.0': resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==} engines: {node: '>=6.0.0'} @@ -1032,6 +1035,63 @@ packages: resolution: {integrity: sha512-zQ0IqbdX8FZ9aw11vP+dZkKDkS+kgIvQPHnSAXzP9pLu+Rfu3D3XEeLbicvoXJTYnhZiPmsZUxgdzXwNKxRPbA==} engines: {node: '>=14'} + '@ethersproject/abi@5.7.0': + resolution: {integrity: sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA==} + + '@ethersproject/abstract-provider@5.7.0': + resolution: {integrity: sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw==} + + '@ethersproject/abstract-signer@5.7.0': + resolution: {integrity: sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ==} + + '@ethersproject/address@5.7.0': + resolution: {integrity: sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA==} + + '@ethersproject/base64@5.7.0': + resolution: {integrity: sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ==} + + '@ethersproject/bignumber@5.7.0': + resolution: {integrity: sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw==} + + '@ethersproject/bytes@5.7.0': + resolution: {integrity: sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A==} + + '@ethersproject/constants@5.7.0': + resolution: {integrity: sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA==} + + '@ethersproject/contracts@5.7.0': + resolution: {integrity: sha512-5GJbzEU3X+d33CdfPhcyS+z8MzsTrBGk/sc+G+59+tPa9yFkl6HQ9D6L0QMgNTA9q8dT0XKxxkyp883XsQvbbg==} + + '@ethersproject/hash@5.7.0': + resolution: {integrity: sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g==} + + '@ethersproject/keccak256@5.7.0': + resolution: {integrity: sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg==} + + '@ethersproject/logger@5.7.0': + resolution: {integrity: sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig==} + + '@ethersproject/networks@5.7.1': + resolution: {integrity: sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ==} + + '@ethersproject/properties@5.7.0': + resolution: {integrity: sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw==} + + '@ethersproject/rlp@5.7.0': + resolution: {integrity: sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w==} + + '@ethersproject/signing-key@5.7.0': + resolution: {integrity: sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q==} + + '@ethersproject/strings@5.7.0': + resolution: {integrity: sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg==} + + '@ethersproject/transactions@5.7.0': + resolution: {integrity: sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ==} + + '@ethersproject/web@5.7.1': + resolution: {integrity: sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w==} + '@floating-ui/core@1.6.7': resolution: {integrity: sha512-yDzVT/Lm101nQ5TCVeK65LtdN7Tj4Qpr9RTXJ2vPFLqtLxwOrpoxAHAJI8J3yYWUc40J0BDBheaitK5SJmno2g==} @@ -1053,6 +1113,28 @@ packages: '@floating-ui/utils@0.2.7': resolution: {integrity: sha512-X8R8Oj771YRl/w+c1HqAC1szL8zWQRwFvgDwT129k9ACdBoud/+/rX9V0qiMl6LWUdP9voC2nDVZYPMQQsb6eA==} + '@fortawesome/fontawesome-common-types@6.6.0': + resolution: {integrity: sha512-xyX0X9mc0kyz9plIyryrRbl7ngsA9jz77mCZJsUkLl+ZKs0KWObgaEBoSgQiYWAsSmjz/yjl0F++Got0Mdp4Rw==} + engines: {node: '>=6'} + + '@fortawesome/fontawesome-svg-core@6.6.0': + resolution: {integrity: sha512-KHwPkCk6oRT4HADE7smhfsKudt9N/9lm6EJ5BVg0tD1yPA5hht837fB87F8pn15D8JfTqQOjhKTktwmLMiD7Kg==} + engines: {node: '>=6'} + + '@fortawesome/free-regular-svg-icons@6.6.0': + resolution: {integrity: sha512-Yv9hDzL4aI73BEwSEh20clrY8q/uLxawaQ98lekBx6t9dQKDHcDzzV1p2YtBGTtolYtNqcWdniOnhzB+JPnQEQ==} + engines: {node: '>=6'} + + '@fortawesome/free-solid-svg-icons@6.6.0': + resolution: {integrity: sha512-IYv/2skhEDFc2WGUcqvFJkeK39Q+HyPf5GHUrT/l2pKbtgEIv1al1TKd6qStR5OIwQdN1GZP54ci3y4mroJWjA==} + engines: {node: '>=6'} + + '@fortawesome/react-fontawesome@0.2.2': + resolution: {integrity: sha512-EnkrprPNqI6SXJl//m29hpaNzOp1bruISWaOiRtkMi/xSvHJlzc2j2JAYS7egxt/EbjSNV/k6Xy0AQI6vB2+1g==} + peerDependencies: + '@fortawesome/fontawesome-svg-core': ~1 || ~6 + react: '>=16.3' + '@hapi/hoek@9.3.0': resolution: {integrity: sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ==} @@ -1072,11 +1154,14 @@ packages: resolution: {integrity: sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==} deprecated: Use @eslint/object-schema instead + '@hyperplay/chains@0.2.10': + resolution: {integrity: sha512-TUe9vJo9jXx23pb5QlGuW6xo6JmXYjqXKJSma//aUPZ99HU8I/lATlyqdXwozPfQ2qGsAYn58FCTo2kbF+J+8w==} + '@hyperplay/chains@0.3.0': resolution: {integrity: sha512-7FcQSR6bIZnfJXpwDHEX4tcjMJQw/oW97h6qT+Q0eDsMdipa9m6ZJm3hybqq9asLpxlX0BV5cn01S8nRHOg9Pg==} - '@hyperplay/ui@1.7.17': - resolution: {integrity: sha512-NUNDJNBVxjij5dwIJ+kvOtiIZMWz/cvzAyQwjmXfOH/zeGc24MXkZQE6RKrHDcD06zKrEYWlcd6S+8ghQ6jM3w==} + '@hyperplay/ui@1.7.26': + resolution: {integrity: sha512-/jCDu78eRZlLB6CdKlWl5mRqkHFFignF5f8FQ5JuEqgDPr2F8LB2NudgfqGxfc6CIQdUWtaODGby5mEQwu+0nQ==} peerDependencies: '@emotion/react': ^11.11.0 '@mantine/carousel': ^7.5.1 @@ -1089,6 +1174,9 @@ packages: react-dom: ^17.0.0 || ^18.0.0 react-markdown: 9.0.1 + '@hyperplay/utils@0.1.4': + resolution: {integrity: sha512-brHHvhSl5fOLIX2hCp2ZP0dfdMHb8uGME3o3NjK0imVdYlspUVe1YXp5x9P5O2iJn+7C3oPlbLARsC/KTDWSJw==} + '@hyperplay/utils@0.2.3': resolution: {integrity: sha512-KxSFUA/3SOjU+LfteLQZ60u7x8F6okZ3lATHKkopDWg6DET6OLjZ5OMaxolyimqYe3yndnAwo6qTzEAjsHGyww==} @@ -1303,12 +1391,19 @@ packages: resolution: {integrity: sha512-z10PF9JV6SbjFq+/rYabM+8CVlMokgl8RFGvieSGNTmrkQanfHn+15XBrhG3BgUfvmTeSeyShfOHpG0i9zEdcg==} deprecated: Motion One for Vue is deprecated. Use Oku Motion instead https://oku-ui.com/motion + '@noble/curves@1.2.0': + resolution: {integrity: sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==} + '@noble/curves@1.4.0': resolution: {integrity: sha512-p+4cb332SFCrReJkCYe8Xzm0OWi4Jji5jVdIZRL/PmacmDkFNw6MrrV+gGpiPxLHbV+zKFRywUWbaseT+tZRXg==} '@noble/curves@1.4.2': resolution: {integrity: sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw==} + '@noble/hashes@1.3.2': + resolution: {integrity: sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==} + engines: {node: '>= 16'} + '@noble/hashes@1.4.0': resolution: {integrity: sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==} engines: {node: '>= 16'} @@ -1793,6 +1888,14 @@ packages: '@swc/types@0.1.12': resolution: {integrity: sha512-wBJA+SdtkbFhHjTMYH+dEH1y4VpfGdAc2Kw/LK09i9bXd/K6j6PkDcFCEzb6iVfZMkPRrl/q0e3toqTAJdkIVA==} + '@tabler/icons-react@2.47.0': + resolution: {integrity: sha512-iqly2FvCF/qUbgmvS8E40rVeYY7laltc5GUjRxQj59DuX0x/6CpKHTXt86YlI2whg4czvd/c8Ce8YR08uEku0g==} + peerDependencies: + react: ^16.5.1 || ^17.0.0 || ^18.0.0 + + '@tabler/icons@2.47.0': + resolution: {integrity: sha512-4w5evLh+7FUUiA1GucvGj2ReX2TvOjEr4ejXdwL/bsjoSkof6r1gQmzqI+VHrE2CpJpB3al7bCTulOkFa/RcyA==} + '@tanstack/query-core@5.51.21': resolution: {integrity: sha512-POQxm42IUp6n89kKWF4IZi18v3fxQWFRolvBA6phNVmA8psdfB1MvDnGacCJdS+EOX12w/CyHM62z//rHmYmvw==} @@ -1840,6 +1943,9 @@ packages: '@types/node-forge@1.3.11': resolution: {integrity: sha512-FQx220y22OKNTqaByeBGqHWYz4cl94tpcxeFdvBo3wjG6XPBuZ0BNgNZRV5J5TFmmcsJ4IzsLkmGRiQbnYsBEQ==} + '@types/node@18.15.13': + resolution: {integrity: sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q==} + '@types/node@18.19.44': resolution: {integrity: sha512-ZsbGerYg72WMXUIE9fYxtvfzLEuq6q8mKERdWFnqTmOvudMxnz+CBNRoOwJ2kNpFOncrKjT1hZwxjlFgQ9qvQA==} @@ -1942,6 +2048,9 @@ packages: '@ungap/structured-clone@1.2.0': resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} + '@valist/sdk@2.10.5': + resolution: {integrity: sha512-2m95VJfljJQXaSUfqfVwfHsaVcgynY4yy6wKjIsACYgiKkzck2XqjyAOtLhRESyzvuNvBA/ypj0mP+JxdmCtOw==} + '@vitejs/plugin-react-swc@3.7.0': resolution: {integrity: sha512-yrknSb3Dci6svCd/qhHqhFPDSw0QtjumcqdKMoNNzmOl5lMXTTiqzjWtG4Qask2HdvvzaNgSunbQGet8/GrKdA==} peerDependencies: @@ -2116,6 +2225,9 @@ packages: engines: {node: '>=0.4.0'} hasBin: true + aes-js@4.0.0-beta.5: + resolution: {integrity: sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==} + ajv-draft-04@1.0.0: resolution: {integrity: sha512-mv00Te6nmYbRp5DCwclxtt7yV/joXJPGS7nM+97GdxvuttCOfgI3K4U25zboyeX0O+myI8ERluxQe5wljMmVIw==} peerDependencies: @@ -2244,6 +2356,11 @@ packages: resolution: {integrity: sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==} engines: {node: '>= 0.4'} + axios-retry@4.5.0: + resolution: {integrity: sha512-aR99oXhpEDGo0UuAlYcn2iGRds30k366Zfa05XWScR9QaQD4JYiP3/1Qt1u7YlefUOK+cn0CcwoL1oefavQUlQ==} + peerDependencies: + axios: 0.x || 1.x + axios@1.7.4: resolution: {integrity: sha512-DukmaFRnY6AzAALSH4J2M3k6PkaC+MfaAGdEERRWcC9q3/TWQwLpHR8ZRLKTdQ3aBDL64EdluRDjJqKw+BPZEw==} @@ -2713,6 +2830,9 @@ packages: electron-to-chromium@1.5.7: resolution: {integrity: sha512-6FTNWIWMxMy/ZY6799nBlPtF1DFDQ6VQJ7yyDP27SJNt5lwtQ5ufqVvHylb3fdQefvRcgA3fKcFMJi9OLwBRNw==} + elliptic@6.5.4: + resolution: {integrity: sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==} + elliptic@6.5.7: resolution: {integrity: sha512-ESVCtTwiA+XhY3wyh24QqRGBoP3rEdDUl3EDUUo9tft074fi19IrdpH7hLCMMP3CIj7jb3W96rn8lt/BqIlt5Q==} @@ -2950,9 +3070,16 @@ packages: eth-rpc-errors@4.0.3: resolution: {integrity: sha512-Z3ymjopaoft7JDoxZcEb3pwdGh7yiYMhOwm2doUt6ASXlMavpNlK6Cre0+IMl2VSGyEU9rkiperQhp5iRxn5Pg==} + ethereum-blockies-base64@1.0.2: + resolution: {integrity: sha512-Vg2HTm7slcWNKaRhCUl/L3b4KrB8ohQXdd5Pu3OI897EcR6tVRvUqdTwAyx+dnmoDzj8e2bwBLDQ50ByFmcz6w==} + ethereum-cryptography@2.2.1: resolution: {integrity: sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg==} + ethers@6.13.3: + resolution: {integrity: sha512-/DzbZOLVtoO4fKvvQwpEucHAQgIwBGWuRvBdwE/lMXgXvvHHTSkn7XqAQ2b+gjJzZDJjWA9OD05bVceVOsBHbg==} + engines: {node: '>=14.0.0'} + event-target-shim@5.0.1: resolution: {integrity: sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==} engines: {node: '>=6'} @@ -3473,6 +3600,10 @@ packages: resolution: {integrity: sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==} engines: {node: '>= 0.4'} + is-retry-allowed@2.2.0: + resolution: {integrity: sha512-XVm7LOeLpTW4jV19QSH38vkswxoLud8sQ57YwJVTPWdiaI9I8keEhGFpBlslyVsgdQy4Opg8QOLb8YRgsyZiQg==} + engines: {node: '>=10'} + is-set@2.0.3: resolution: {integrity: sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg==} engines: {node: '>= 0.4'} @@ -3594,6 +3725,9 @@ packages: joi@17.13.3: resolution: {integrity: sha512-otDA4ldcIx+ZXsKHWmp0YizCweVRZG96J10b0FevjfuncLO1oX59THoAmHkNubYJ+9gWsYsp5k8v4ib6oDv1fA==} + js-sha3@0.8.0: + resolution: {integrity: sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==} + js-tokens@4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} @@ -4333,6 +4467,9 @@ packages: resolution: {integrity: sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw==} engines: {node: '>=10.13.0'} + pnglib@0.0.1: + resolution: {integrity: sha512-95ChzOoYLOPIyVmL+Y6X+abKGXUJlvOVLkB1QQkyXl7Uczc6FElUy/x01NS7r2GX6GRezloO/ecCX9h4U9KadA==} + pony-cause@2.1.11: resolution: {integrity: sha512-M7LhCsdNbNgiLYiP4WjsfLUuFmCfnjdF6jKe2R9NKl4WFN+HZPGHJZ9lnLP7f9ZnKe3U9nuWD0szirmj+migUg==} engines: {node: '>=12.0.0'} @@ -5153,6 +5290,9 @@ packages: tslib@1.14.1: resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} + tslib@2.4.0: + resolution: {integrity: sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==} + tslib@2.6.3: resolution: {integrity: sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==} @@ -5674,6 +5814,8 @@ snapshots: '@adraffy/ens-normalize@1.10.0': {} + '@adraffy/ens-normalize@1.10.1': {} + '@ampproject/remapping@2.3.0': dependencies: '@jridgewell/gen-mapping': 0.3.5 @@ -6813,6 +6955,142 @@ snapshots: ethereum-cryptography: 2.2.1 micro-ftch: 0.3.1 + '@ethersproject/abi@5.7.0': + dependencies: + '@ethersproject/address': 5.7.0 + '@ethersproject/bignumber': 5.7.0 + '@ethersproject/bytes': 5.7.0 + '@ethersproject/constants': 5.7.0 + '@ethersproject/hash': 5.7.0 + '@ethersproject/keccak256': 5.7.0 + '@ethersproject/logger': 5.7.0 + '@ethersproject/properties': 5.7.0 + '@ethersproject/strings': 5.7.0 + + '@ethersproject/abstract-provider@5.7.0': + dependencies: + '@ethersproject/bignumber': 5.7.0 + '@ethersproject/bytes': 5.7.0 + '@ethersproject/logger': 5.7.0 + '@ethersproject/networks': 5.7.1 + '@ethersproject/properties': 5.7.0 + '@ethersproject/transactions': 5.7.0 + '@ethersproject/web': 5.7.1 + + '@ethersproject/abstract-signer@5.7.0': + dependencies: + '@ethersproject/abstract-provider': 5.7.0 + '@ethersproject/bignumber': 5.7.0 + '@ethersproject/bytes': 5.7.0 + '@ethersproject/logger': 5.7.0 + '@ethersproject/properties': 5.7.0 + + '@ethersproject/address@5.7.0': + dependencies: + '@ethersproject/bignumber': 5.7.0 + '@ethersproject/bytes': 5.7.0 + '@ethersproject/keccak256': 5.7.0 + '@ethersproject/logger': 5.7.0 + '@ethersproject/rlp': 5.7.0 + + '@ethersproject/base64@5.7.0': + dependencies: + '@ethersproject/bytes': 5.7.0 + + '@ethersproject/bignumber@5.7.0': + dependencies: + '@ethersproject/bytes': 5.7.0 + '@ethersproject/logger': 5.7.0 + bn.js: 5.2.1 + + '@ethersproject/bytes@5.7.0': + dependencies: + '@ethersproject/logger': 5.7.0 + + '@ethersproject/constants@5.7.0': + dependencies: + '@ethersproject/bignumber': 5.7.0 + + '@ethersproject/contracts@5.7.0': + dependencies: + '@ethersproject/abi': 5.7.0 + '@ethersproject/abstract-provider': 5.7.0 + '@ethersproject/abstract-signer': 5.7.0 + '@ethersproject/address': 5.7.0 + '@ethersproject/bignumber': 5.7.0 + '@ethersproject/bytes': 5.7.0 + '@ethersproject/constants': 5.7.0 + '@ethersproject/logger': 5.7.0 + '@ethersproject/properties': 5.7.0 + '@ethersproject/transactions': 5.7.0 + + '@ethersproject/hash@5.7.0': + dependencies: + '@ethersproject/abstract-signer': 5.7.0 + '@ethersproject/address': 5.7.0 + '@ethersproject/base64': 5.7.0 + '@ethersproject/bignumber': 5.7.0 + '@ethersproject/bytes': 5.7.0 + '@ethersproject/keccak256': 5.7.0 + '@ethersproject/logger': 5.7.0 + '@ethersproject/properties': 5.7.0 + '@ethersproject/strings': 5.7.0 + + '@ethersproject/keccak256@5.7.0': + dependencies: + '@ethersproject/bytes': 5.7.0 + js-sha3: 0.8.0 + + '@ethersproject/logger@5.7.0': {} + + '@ethersproject/networks@5.7.1': + dependencies: + '@ethersproject/logger': 5.7.0 + + '@ethersproject/properties@5.7.0': + dependencies: + '@ethersproject/logger': 5.7.0 + + '@ethersproject/rlp@5.7.0': + dependencies: + '@ethersproject/bytes': 5.7.0 + '@ethersproject/logger': 5.7.0 + + '@ethersproject/signing-key@5.7.0': + dependencies: + '@ethersproject/bytes': 5.7.0 + '@ethersproject/logger': 5.7.0 + '@ethersproject/properties': 5.7.0 + bn.js: 5.2.1 + elliptic: 6.5.4 + hash.js: 1.1.7 + + '@ethersproject/strings@5.7.0': + dependencies: + '@ethersproject/bytes': 5.7.0 + '@ethersproject/constants': 5.7.0 + '@ethersproject/logger': 5.7.0 + + '@ethersproject/transactions@5.7.0': + dependencies: + '@ethersproject/address': 5.7.0 + '@ethersproject/bignumber': 5.7.0 + '@ethersproject/bytes': 5.7.0 + '@ethersproject/constants': 5.7.0 + '@ethersproject/keccak256': 5.7.0 + '@ethersproject/logger': 5.7.0 + '@ethersproject/properties': 5.7.0 + '@ethersproject/rlp': 5.7.0 + '@ethersproject/signing-key': 5.7.0 + + '@ethersproject/web@5.7.1': + dependencies: + '@ethersproject/base64': 5.7.0 + '@ethersproject/bytes': 5.7.0 + '@ethersproject/logger': 5.7.0 + '@ethersproject/properties': 5.7.0 + '@ethersproject/strings': 5.7.0 + '@floating-ui/core@1.6.7': dependencies: '@floating-ui/utils': 0.2.7 @@ -6838,6 +7116,26 @@ snapshots: '@floating-ui/utils@0.2.7': {} + '@fortawesome/fontawesome-common-types@6.6.0': {} + + '@fortawesome/fontawesome-svg-core@6.6.0': + dependencies: + '@fortawesome/fontawesome-common-types': 6.6.0 + + '@fortawesome/free-regular-svg-icons@6.6.0': + dependencies: + '@fortawesome/fontawesome-common-types': 6.6.0 + + '@fortawesome/free-solid-svg-icons@6.6.0': + dependencies: + '@fortawesome/fontawesome-common-types': 6.6.0 + + '@fortawesome/react-fontawesome@0.2.2(@fortawesome/fontawesome-svg-core@6.6.0)(react@18.3.1)': + dependencies: + '@fortawesome/fontawesome-svg-core': 6.6.0 + prop-types: 15.8.1 + react: 18.3.1 + '@hapi/hoek@9.3.0': {} '@hapi/topo@5.1.0': @@ -6856,6 +7154,12 @@ snapshots: '@humanwhocodes/object-schema@2.0.3': {} + '@hyperplay/chains@0.2.10': + dependencies: + axios: 1.7.4 + transitivePeerDependencies: + - debug + '@hyperplay/chains@0.3.0(bufferutil@4.0.8)(typescript@5.5.4)(utf-8-validate@5.0.10)': dependencies: axios: 1.7.4 @@ -6867,18 +7171,36 @@ snapshots: - utf-8-validate - zod - '@hyperplay/ui@1.7.17(@emotion/react@11.13.0(@types/react@18.3.3)(react@18.3.1))(@mantine/carousel@7.12.1(@mantine/core@7.12.1(@mantine/hooks@7.12.1(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/hooks@7.12.1(react@18.3.1))(embla-carousel-react@8.1.8(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/core@7.12.1(@mantine/hooks@7.12.1(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/dropzone@7.12.1(@mantine/core@7.12.1(@mantine/hooks@7.12.1(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/hooks@7.12.1(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/hooks@7.12.1(react@18.3.1))(embla-carousel-autoplay@8.1.8(embla-carousel@8.1.8))(embla-carousel-react@8.1.8(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react-markdown@9.0.1(@types/react@18.3.3)(react@18.3.1))(react@18.3.1)': + '@hyperplay/ui@1.7.26(@emotion/react@11.13.0(@types/react@18.3.3)(react@18.3.1))(@mantine/carousel@7.12.1(@mantine/core@7.12.1(@mantine/hooks@7.12.1(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/hooks@7.12.1(react@18.3.1))(embla-carousel-react@8.1.8(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/core@7.12.1(@mantine/hooks@7.12.1(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/dropzone@7.12.1(@mantine/core@7.12.1(@mantine/hooks@7.12.1(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/hooks@7.12.1(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/hooks@7.12.1(react@18.3.1))(bufferutil@4.0.8)(embla-carousel-autoplay@8.1.8(embla-carousel@8.1.8))(embla-carousel-react@8.1.8(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react-markdown@9.0.1(@types/react@18.3.3)(react@18.3.1))(react@18.3.1)(utf-8-validate@5.0.10)': dependencies: '@emotion/react': 11.13.0(@types/react@18.3.3)(react@18.3.1) + '@fortawesome/fontawesome-svg-core': 6.6.0 + '@fortawesome/free-regular-svg-icons': 6.6.0 + '@fortawesome/free-solid-svg-icons': 6.6.0 + '@fortawesome/react-fontawesome': 0.2.2(@fortawesome/fontawesome-svg-core@6.6.0)(react@18.3.1) + '@hyperplay/chains': 0.2.10 + '@hyperplay/utils': 0.1.4 '@mantine/carousel': 7.12.1(@mantine/core@7.12.1(@mantine/hooks@7.12.1(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/hooks@7.12.1(react@18.3.1))(embla-carousel-react@8.1.8(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@mantine/core': 7.12.1(@mantine/hooks@7.12.1(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@mantine/dropzone': 7.12.1(@mantine/core@7.12.1(@mantine/hooks@7.12.1(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/hooks@7.12.1(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@mantine/hooks': 7.12.1(react@18.3.1) + '@tabler/icons-react': 2.47.0(react@18.3.1) + '@valist/sdk': 2.10.5(bufferutil@4.0.8)(utf-8-validate@5.0.10) embla-carousel-autoplay: 8.1.8(embla-carousel@8.1.8) embla-carousel-react: 8.1.8(react@18.3.1) + ethereum-blockies-base64: 1.0.2 react: 18.3.1 react-dom: 18.3.1(react@18.3.1) react-markdown: 9.0.1(@types/react@18.3.3)(react@18.3.1) + transitivePeerDependencies: + - bufferutil + - debug + - encoding + - utf-8-validate + + '@hyperplay/utils@0.1.4': + dependencies: + bignumber.js: 9.1.2 '@hyperplay/utils@0.2.3': dependencies: @@ -7238,6 +7560,10 @@ snapshots: '@motionone/dom': 10.18.0 tslib: 2.6.3 + '@noble/curves@1.2.0': + dependencies: + '@noble/hashes': 1.3.2 + '@noble/curves@1.4.0': dependencies: '@noble/hashes': 1.4.0 @@ -7246,6 +7572,8 @@ snapshots: dependencies: '@noble/hashes': 1.4.0 + '@noble/hashes@1.3.2': {} + '@noble/hashes@1.4.0': {} '@nodelib/fs.scandir@2.1.5': @@ -7899,6 +8227,14 @@ snapshots: dependencies: '@swc/counter': 0.1.3 + '@tabler/icons-react@2.47.0(react@18.3.1)': + dependencies: + '@tabler/icons': 2.47.0 + prop-types: 15.8.1 + react: 18.3.1 + + '@tabler/icons@2.47.0': {} + '@tanstack/query-core@5.51.21': {} '@tanstack/react-query@5.51.23(react@18.3.1)': @@ -7946,6 +8282,8 @@ snapshots: dependencies: '@types/node': 22.3.0 + '@types/node@18.15.13': {} + '@types/node@18.19.44': dependencies: undici-types: 5.26.5 @@ -8072,6 +8410,19 @@ snapshots: '@ungap/structured-clone@1.2.0': {} + '@valist/sdk@2.10.5(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + dependencies: + '@ethersproject/contracts': 5.7.0 + axios: 1.7.4 + axios-retry: 4.5.0(axios@1.7.4) + ethers: 6.13.3(bufferutil@4.0.8)(utf-8-validate@5.0.10) + node-fetch: 2.7.0 + transitivePeerDependencies: + - bufferutil + - debug + - encoding + - utf-8-validate + '@vitejs/plugin-react-swc@3.7.0(vite@5.4.0(@types/node@22.3.0)(sass-embedded@1.77.8)(terser@5.31.6))': dependencies: '@swc/core': 1.7.10 @@ -8526,6 +8877,8 @@ snapshots: acorn@8.12.1: {} + aes-js@4.0.0-beta.5: {} + ajv-draft-04@1.0.0(ajv@8.13.0): optionalDependencies: ajv: 8.13.0 @@ -8679,6 +9032,11 @@ snapshots: dependencies: possible-typed-array-names: 1.0.0 + axios-retry@4.5.0(axios@1.7.4): + dependencies: + axios: 1.7.4 + is-retry-allowed: 2.2.0 + axios@1.7.4: dependencies: follow-redirects: 1.15.6 @@ -9146,6 +9504,16 @@ snapshots: electron-to-chromium@1.5.7: {} + elliptic@6.5.4: + dependencies: + bn.js: 4.12.0 + brorand: 1.1.0 + hash.js: 1.1.7 + hmac-drbg: 1.0.1 + inherits: 2.0.4 + minimalistic-assert: 1.0.1 + minimalistic-crypto-utils: 1.0.1 + elliptic@6.5.7: dependencies: bn.js: 4.12.0 @@ -9524,6 +9892,10 @@ snapshots: dependencies: fast-safe-stringify: 2.1.1 + ethereum-blockies-base64@1.0.2: + dependencies: + pnglib: 0.0.1 + ethereum-cryptography@2.2.1: dependencies: '@noble/curves': 1.4.2 @@ -9531,6 +9903,19 @@ snapshots: '@scure/bip32': 1.4.0 '@scure/bip39': 1.3.0 + ethers@6.13.3(bufferutil@4.0.8)(utf-8-validate@5.0.10): + dependencies: + '@adraffy/ens-normalize': 1.10.1 + '@noble/curves': 1.2.0 + '@noble/hashes': 1.3.2 + '@types/node': 18.15.13 + aes-js: 4.0.0-beta.5 + tslib: 2.4.0 + ws: 8.17.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) + transitivePeerDependencies: + - bufferutil + - utf-8-validate + event-target-shim@5.0.1: {} eventemitter2@6.4.9: {} @@ -10057,6 +10442,8 @@ snapshots: call-bind: 1.0.7 has-tostringtag: 1.0.2 + is-retry-allowed@2.2.0: {} + is-set@2.0.3: {} is-shared-array-buffer@1.0.3: @@ -10199,6 +10586,8 @@ snapshots: '@sideway/formula': 3.0.1 '@sideway/pinpoint': 2.0.0 + js-sha3@0.8.0: {} + js-tokens@4.0.0: {} js-yaml@3.14.1: @@ -11193,6 +11582,8 @@ snapshots: pngjs@5.0.0: {} + pnglib@0.0.1: {} + pony-cause@2.1.11: {} possible-typed-array-names@1.0.0: {} @@ -12068,6 +12459,8 @@ snapshots: tslib@1.14.1: {} + tslib@2.4.0: {} + tslib@2.6.3: {} type-check@0.4.0: diff --git a/src/components/QuestDetailsWrapper/index.tsx b/src/components/QuestDetailsWrapper/index.tsx index 62c3ff7..f87c8ad 100644 --- a/src/components/QuestDetailsWrapper/index.tsx +++ b/src/components/QuestDetailsWrapper/index.tsx @@ -45,8 +45,7 @@ class ClaimError extends Error { } } -export interface QuestDetailsWrapperProps - extends Omit { +export interface QuestDetailsWrapperProps { className?: string selectedQuestId: number | null projectId: string @@ -70,6 +69,7 @@ export interface QuestDetailsWrapperProps tokenId?: number ) => Promise confirmRewardClaim: (params: ConfirmClaimParams) => Promise + syncPlayStreak: (questId: number) => Promise resyncExternalTask: (rewardId: string) => Promise getExternalTaskCredits: (rewardId: string) => Promise syncPlaySession: (appName: string, runner: Runner) => Promise @@ -110,6 +110,7 @@ export function QuestDetailsWrapper({ sessionEmail, checkG7ConnectionStatus, isQuestsPage, + syncPlayStreak, ...questDetailsParamProps }: QuestDetailsWrapperProps) { const rewardTypeClaimEnabled = flags.rewardTypeClaimEnabled @@ -313,6 +314,7 @@ export function QuestDetailsWrapper({ }, sync: t('quest.sync', 'Sync'), streakProgressI18n: { + sync: t('quest.playstreak.sync', 'Sync Progress'), streakProgress: t('quest.playstreak.streakProgress', 'Streak Progress'), days: t('quest.playstreak.days', 'days'), playToStart: t( @@ -592,11 +594,16 @@ export function QuestDetailsWrapper({ eligible: false, steamAccountLinked: true }, - playStreak: getPlaystreakArgsFromQuestData( - questMeta, - questPlayStreakData, - isSignedIn - ) + playStreak: { + ...getPlaystreakArgsFromQuestData( + questMeta, + questPlayStreakData, + isSignedIn + ), + onSync: () => { + syncPlayStreak(questMeta.id) + } + } }, rewards: questRewards ?? [], onClaimClick: async () => { @@ -663,6 +670,7 @@ export function QuestDetailsWrapper({ steamAccountLinked: false }, playStreak: { + onSync: () => console.log('loading...'), currentStreakInDays: 0, requiredStreakInDays: 1, minimumSessionTimeInSeconds: 100, diff --git a/src/helpers/getPlaystreakArgsFromQuestData.ts b/src/helpers/getPlaystreakArgsFromQuestData.ts index aabf704..2055f3c 100644 --- a/src/helpers/getPlaystreakArgsFromQuestData.ts +++ b/src/helpers/getPlaystreakArgsFromQuestData.ts @@ -8,7 +8,7 @@ export function getPlaystreakArgsFromQuestData( questMeta: Quest, questPlayStreakData: UserPlayStreak | undefined | null, useModuleInitTimeForSessionStartTime?: boolean -): PlayStreakEligibility { +): Omit { let sessionStartedTime = undefined if (useModuleInitTimeForSessionStartTime) { sessionStartedTime = dateTimeCurrentSessionStartedInMsSinceEpoch diff --git a/src/hooks/useSyncPlayStreak.ts b/src/hooks/useSyncPlayStreak.ts new file mode 100644 index 0000000..6b37419 --- /dev/null +++ b/src/hooks/useSyncPlayStreak.ts @@ -0,0 +1,69 @@ +import { useMutation } from '@tanstack/react-query' + +interface UseSyncPlayStreakProps { + refreshPlayStreak: () => void + getCSRFToken: () => Promise + syncPlayStreakWithExternalSource: (params: { + quest_id: number + signature: string + }) => Promise + checkPendingSync: (params: { + wallet: string + questId: number + }) => Promise + signMessage: (message: string) => Promise + logInfo?: (message: string) => void + logError?: (message: string) => void +} + +export const useSyncPlayStreak = ({ + refreshPlayStreak, + getCSRFToken, + syncPlayStreakWithExternalSource, + logInfo, + logError, + checkPendingSync, + signMessage +}: UseSyncPlayStreakProps) => { + return useMutation({ + mutationFn: async ({ + questId, + address, + questsWithExternalSync + }: { + questId: number + address: string + questsWithExternalSync: number[] + }) => { + let hasPendingSync = false + + try { + hasPendingSync = await checkPendingSync({ wallet: address, questId }) + } catch (error) { + console.error('Error checking pending sync', error) + } + + if (questsWithExternalSync.includes(questId) && hasPendingSync) { + const csrfToken = await getCSRFToken() + const message = `Sync play-streak of quest with ID: ${questId} \n\nNonce: ${csrfToken}` + const signature = await signMessage(message) + + await syncPlayStreakWithExternalSource({ + quest_id: questId, + signature + }) + } + }, + onSuccess: async () => { + refreshPlayStreak() + console.log('Playstreak synced with external source') + logInfo?.('Playstreak synced with external source') + }, + onError: (error) => { + console.error(`Error syncing playstreak with external source`, error) + logError?.( + `Error syncing playstreak with external source: ${error.message}` + ) + } + }) +} diff --git a/src/index.ts b/src/index.ts index 2ea2df3..b40f6d8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,4 @@ export { QuestDetailsWrapper } from './components/QuestDetailsWrapper' export type { TrackEventFn } from './types/analytics' export * from './hooks/useCheckG7ConnectionStatus' +export * from './hooks/useSyncPlayStreak' \ No newline at end of file From 1fbf4b6ae1b5a00a048cb8ad143b32c0b4d37046 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elio=20Brice=C3=B1o?= Date: Wed, 2 Oct 2024 18:09:13 -0400 Subject: [PATCH 05/14] feat(quest): remove non generic logic --- src/hooks/useSyncPlayStreak.ts | 62 ++++++++++++++-------------------- src/index.ts | 2 +- 2 files changed, 26 insertions(+), 38 deletions(-) diff --git a/src/hooks/useSyncPlayStreak.ts b/src/hooks/useSyncPlayStreak.ts index 6b37419..73f26cb 100644 --- a/src/hooks/useSyncPlayStreak.ts +++ b/src/hooks/useSyncPlayStreak.ts @@ -1,7 +1,11 @@ -import { useMutation } from '@tanstack/react-query' +import { useMutation, UseMutationOptions } from '@tanstack/react-query' + +type MutationParams = { + questId: number + address: string +} interface UseSyncPlayStreakProps { - refreshPlayStreak: () => void getCSRFToken: () => Promise syncPlayStreakWithExternalSource: (params: { quest_id: number @@ -12,29 +16,21 @@ interface UseSyncPlayStreakProps { questId: number }) => Promise signMessage: (message: string) => Promise - logInfo?: (message: string) => void - logError?: (message: string) => void + mutationOptions?: Omit< + UseMutationOptions, + 'mutationFn' + > } export const useSyncPlayStreak = ({ - refreshPlayStreak, getCSRFToken, syncPlayStreakWithExternalSource, - logInfo, - logError, checkPendingSync, - signMessage + signMessage, + mutationOptions = {} }: UseSyncPlayStreakProps) => { return useMutation({ - mutationFn: async ({ - questId, - address, - questsWithExternalSync - }: { - questId: number - address: string - questsWithExternalSync: number[] - }) => { + mutationFn: async ({ questId, address }: MutationParams) => { let hasPendingSync = false try { @@ -43,27 +39,19 @@ export const useSyncPlayStreak = ({ console.error('Error checking pending sync', error) } - if (questsWithExternalSync.includes(questId) && hasPendingSync) { - const csrfToken = await getCSRFToken() - const message = `Sync play-streak of quest with ID: ${questId} \n\nNonce: ${csrfToken}` - const signature = await signMessage(message) - - await syncPlayStreakWithExternalSource({ - quest_id: questId, - signature - }) + if (!hasPendingSync) { + return } + + const csrfToken = await getCSRFToken() + const message = `Sync play-streak of quest with ID: ${questId} \n\nNonce: ${csrfToken}` + const signature = await signMessage(message) + + await syncPlayStreakWithExternalSource({ + quest_id: questId, + signature + }) }, - onSuccess: async () => { - refreshPlayStreak() - console.log('Playstreak synced with external source') - logInfo?.('Playstreak synced with external source') - }, - onError: (error) => { - console.error(`Error syncing playstreak with external source`, error) - logError?.( - `Error syncing playstreak with external source: ${error.message}` - ) - } + ...mutationOptions }) } diff --git a/src/index.ts b/src/index.ts index b40f6d8..68ab1b9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ export { QuestDetailsWrapper } from './components/QuestDetailsWrapper' export type { TrackEventFn } from './types/analytics' export * from './hooks/useCheckG7ConnectionStatus' -export * from './hooks/useSyncPlayStreak' \ No newline at end of file +export * from './hooks/useSyncPlayStreak' From 43f9da5532cd3ab914296490057388d4800a44a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elio=20Brice=C3=B1o?= Date: Wed, 2 Oct 2024 18:12:08 -0400 Subject: [PATCH 06/14] chore: add log --- src/hooks/useSyncPlayStreak.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/hooks/useSyncPlayStreak.ts b/src/hooks/useSyncPlayStreak.ts index 73f26cb..34edc80 100644 --- a/src/hooks/useSyncPlayStreak.ts +++ b/src/hooks/useSyncPlayStreak.ts @@ -40,6 +40,7 @@ export const useSyncPlayStreak = ({ } if (!hasPendingSync) { + console.log('No pending sync found, skipping external sync') return } From 75467838fe4b949aec538dd648c63dd9408f856a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elio=20Brice=C3=B1o?= Date: Wed, 2 Oct 2024 18:35:16 -0400 Subject: [PATCH 07/14] chore: debump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4dfad85..4b19dcf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hyperplay/quests-ui", - "version": "0.0.24", + "version": "0.0.23", "description": "", "main": "index.js", "scripts": { From 1aadc18092481ab1c731553d98afd24e30505fe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elio=20Brice=C3=B1o?= Date: Thu, 3 Oct 2024 14:40:12 -0400 Subject: [PATCH 08/14] tech: export request syncPlayStreakWithExternalSource from props --- package.json | 2 +- pnpm-lock.yaml | 10 +++--- src/components/QuestDetailsWrapper/index.tsx | 32 +++++++++---------- src/helpers/getPlaystreakArgsFromQuestData.ts | 17 +++++++--- ...=> useSyncPlayStreakWithExternalSource.ts} | 2 +- src/index.ts | 3 +- 6 files changed, 38 insertions(+), 28 deletions(-) rename src/hooks/{useSyncPlayStreak.ts => useSyncPlayStreakWithExternalSource.ts} (97%) diff --git a/package.json b/package.json index 4b19dcf..2ceb42d 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "types": "dist/index.d.ts", "devDependencies": { "@hyperplay/chains": "^0.3.0", - "@hyperplay/ui": "^1.7.26", + "@hyperplay/ui": "^1.8.0", "@hyperplay/utils": "^0.2.3", "@tanstack/react-query": "^5.51.23", "@types/react": "^18.3.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4433eb8..4537114 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -16,8 +16,8 @@ importers: specifier: ^0.3.0 version: 0.3.0(bufferutil@4.0.8)(typescript@5.5.4)(utf-8-validate@5.0.10) '@hyperplay/ui': - specifier: ^1.7.26 - version: 1.7.26(@emotion/react@11.13.0(@types/react@18.3.3)(react@18.3.1))(@mantine/carousel@7.12.1(@mantine/core@7.12.1(@mantine/hooks@7.12.1(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/hooks@7.12.1(react@18.3.1))(embla-carousel-react@8.1.8(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/core@7.12.1(@mantine/hooks@7.12.1(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/dropzone@7.12.1(@mantine/core@7.12.1(@mantine/hooks@7.12.1(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/hooks@7.12.1(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/hooks@7.12.1(react@18.3.1))(bufferutil@4.0.8)(embla-carousel-autoplay@8.1.8(embla-carousel@8.1.8))(embla-carousel-react@8.1.8(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react-markdown@9.0.1(@types/react@18.3.3)(react@18.3.1))(react@18.3.1)(utf-8-validate@5.0.10) + specifier: ^1.8.0 + version: 1.8.1(@emotion/react@11.13.0(@types/react@18.3.3)(react@18.3.1))(@mantine/carousel@7.12.1(@mantine/core@7.12.1(@mantine/hooks@7.12.1(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/hooks@7.12.1(react@18.3.1))(embla-carousel-react@8.1.8(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/core@7.12.1(@mantine/hooks@7.12.1(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/dropzone@7.12.1(@mantine/core@7.12.1(@mantine/hooks@7.12.1(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/hooks@7.12.1(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/hooks@7.12.1(react@18.3.1))(bufferutil@4.0.8)(embla-carousel-autoplay@8.1.8(embla-carousel@8.1.8))(embla-carousel-react@8.1.8(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react-markdown@9.0.1(@types/react@18.3.3)(react@18.3.1))(react@18.3.1)(utf-8-validate@5.0.10) '@hyperplay/utils': specifier: ^0.2.3 version: 0.2.3 @@ -1160,8 +1160,8 @@ packages: '@hyperplay/chains@0.3.0': resolution: {integrity: sha512-7FcQSR6bIZnfJXpwDHEX4tcjMJQw/oW97h6qT+Q0eDsMdipa9m6ZJm3hybqq9asLpxlX0BV5cn01S8nRHOg9Pg==} - '@hyperplay/ui@1.7.26': - resolution: {integrity: sha512-/jCDu78eRZlLB6CdKlWl5mRqkHFFignF5f8FQ5JuEqgDPr2F8LB2NudgfqGxfc6CIQdUWtaODGby5mEQwu+0nQ==} + '@hyperplay/ui@1.8.1': + resolution: {integrity: sha512-EH8ZqbZLRqHcILZPEiai8XSt2BlSf42PWQntQwlkLDnCdhYv8yY1UrXNWPQL8zY1FZnws/MBrAV4NmtyN3TcFA==} peerDependencies: '@emotion/react': ^11.11.0 '@mantine/carousel': ^7.5.1 @@ -7171,7 +7171,7 @@ snapshots: - utf-8-validate - zod - '@hyperplay/ui@1.7.26(@emotion/react@11.13.0(@types/react@18.3.3)(react@18.3.1))(@mantine/carousel@7.12.1(@mantine/core@7.12.1(@mantine/hooks@7.12.1(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/hooks@7.12.1(react@18.3.1))(embla-carousel-react@8.1.8(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/core@7.12.1(@mantine/hooks@7.12.1(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/dropzone@7.12.1(@mantine/core@7.12.1(@mantine/hooks@7.12.1(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/hooks@7.12.1(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/hooks@7.12.1(react@18.3.1))(bufferutil@4.0.8)(embla-carousel-autoplay@8.1.8(embla-carousel@8.1.8))(embla-carousel-react@8.1.8(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react-markdown@9.0.1(@types/react@18.3.3)(react@18.3.1))(react@18.3.1)(utf-8-validate@5.0.10)': + '@hyperplay/ui@1.8.1(@emotion/react@11.13.0(@types/react@18.3.3)(react@18.3.1))(@mantine/carousel@7.12.1(@mantine/core@7.12.1(@mantine/hooks@7.12.1(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/hooks@7.12.1(react@18.3.1))(embla-carousel-react@8.1.8(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/core@7.12.1(@mantine/hooks@7.12.1(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/dropzone@7.12.1(@mantine/core@7.12.1(@mantine/hooks@7.12.1(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/hooks@7.12.1(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@mantine/hooks@7.12.1(react@18.3.1))(bufferutil@4.0.8)(embla-carousel-autoplay@8.1.8(embla-carousel@8.1.8))(embla-carousel-react@8.1.8(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react-markdown@9.0.1(@types/react@18.3.3)(react@18.3.1))(react@18.3.1)(utf-8-validate@5.0.10)': dependencies: '@emotion/react': 11.13.0(@types/react@18.3.3)(react@18.3.1) '@fortawesome/fontawesome-svg-core': 6.6.0 diff --git a/src/components/QuestDetailsWrapper/index.tsx b/src/components/QuestDetailsWrapper/index.tsx index f87c8ad..57e6400 100644 --- a/src/components/QuestDetailsWrapper/index.tsx +++ b/src/components/QuestDetailsWrapper/index.tsx @@ -69,7 +69,8 @@ export interface QuestDetailsWrapperProps { tokenId?: number ) => Promise confirmRewardClaim: (params: ConfirmClaimParams) => Promise - syncPlayStreak: (questId: number) => Promise + questsWithExternalPlayStreakSync: number[] + syncPlayStreakWithExternalSource: (questId: number) => Promise resyncExternalTask: (rewardId: string) => Promise getExternalTaskCredits: (rewardId: string) => Promise syncPlaySession: (appName: string, runner: Runner) => Promise @@ -80,7 +81,6 @@ export interface QuestDetailsWrapperProps { sessionEmail?: string checkG7ConnectionStatus: () => Promise isQuestsPage?: boolean - i18n?: Partial } export function QuestDetailsWrapper({ @@ -110,8 +110,8 @@ export function QuestDetailsWrapper({ sessionEmail, checkG7ConnectionStatus, isQuestsPage, - syncPlayStreak, - ...questDetailsParamProps + syncPlayStreakWithExternalSource, + questsWithExternalPlayStreakSync }: QuestDetailsWrapperProps) { const rewardTypeClaimEnabled = flags.rewardTypeClaimEnabled const { @@ -290,7 +290,6 @@ export function QuestDetailsWrapper({ ?.length const i18n: QuestDetailsTranslations = { - ...questDetailsParamProps.i18n, rewards: t('quest.reward', 'Rewards'), associatedGames: t('quest.associatedGames', 'Associated games'), linkSteamAccount: t( @@ -577,7 +576,6 @@ export function QuestDetailsWrapper({ ) const questDetailsProps: QuestDetailsProps = { - ...questDetailsParamProps, className, alertProps, questType: questMeta.type, @@ -594,16 +592,19 @@ export function QuestDetailsWrapper({ eligible: false, steamAccountLinked: true }, - playStreak: { - ...getPlaystreakArgsFromQuestData( - questMeta, - questPlayStreakData, - isSignedIn - ), - onSync: () => { - syncPlayStreak(questMeta.id) + playStreak: getPlaystreakArgsFromQuestData({ + questMeta, + questPlayStreakData, + useModuleInitTimeForSessionStartTime: isSignedIn, + onSync: async() => { + if (questsWithExternalPlayStreakSync.includes(questMeta.id)) { + syncPlayStreakWithExternalSource(questMeta.id) + } else { + await syncPlaySession(projectId, 'hyperplay') + questPlayStreakResult.invalidateQuery() + } } - } + }) }, rewards: questRewards ?? [], onClaimClick: async () => { @@ -657,7 +658,6 @@ export function QuestDetailsWrapper({ rewardsQuery?.data.isLoading ) { const emptyQuestDetailsProps: QuestDetailsProps = { - ...questDetailsParamProps, className, questType: 'PLAYSTREAK', title: '', diff --git a/src/helpers/getPlaystreakArgsFromQuestData.ts b/src/helpers/getPlaystreakArgsFromQuestData.ts index 2055f3c..08ac66a 100644 --- a/src/helpers/getPlaystreakArgsFromQuestData.ts +++ b/src/helpers/getPlaystreakArgsFromQuestData.ts @@ -5,15 +5,24 @@ import { Quest, UserPlayStreak } from '@hyperplay/utils' let dateTimeCurrentSessionStartedInMsSinceEpoch = Date.now() export function getPlaystreakArgsFromQuestData( - questMeta: Quest, - questPlayStreakData: UserPlayStreak | undefined | null, - useModuleInitTimeForSessionStartTime?: boolean -): Omit { + { + questMeta, + questPlayStreakData, + useModuleInitTimeForSessionStartTime, + onSync + }: { + questMeta: Quest; + questPlayStreakData: UserPlayStreak | undefined | null; + useModuleInitTimeForSessionStartTime?: boolean; + onSync: () => void; + } +): PlayStreakEligibility { let sessionStartedTime = undefined if (useModuleInitTimeForSessionStartTime) { sessionStartedTime = dateTimeCurrentSessionStartedInMsSinceEpoch } return { + onSync, requiredStreakInDays: questMeta?.eligibility?.play_streak.required_playstreak_in_days ?? 0, currentStreakInDays: questPlayStreakData?.current_playstreak_in_days ?? 0, diff --git a/src/hooks/useSyncPlayStreak.ts b/src/hooks/useSyncPlayStreakWithExternalSource.ts similarity index 97% rename from src/hooks/useSyncPlayStreak.ts rename to src/hooks/useSyncPlayStreakWithExternalSource.ts index 34edc80..6b2710d 100644 --- a/src/hooks/useSyncPlayStreak.ts +++ b/src/hooks/useSyncPlayStreakWithExternalSource.ts @@ -5,7 +5,7 @@ type MutationParams = { address: string } -interface UseSyncPlayStreakProps { +export interface UseSyncPlayStreakProps { getCSRFToken: () => Promise syncPlayStreakWithExternalSource: (params: { quest_id: number diff --git a/src/index.ts b/src/index.ts index 68ab1b9..7c6a0cc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,5 @@ export { QuestDetailsWrapper } from './components/QuestDetailsWrapper' export type { TrackEventFn } from './types/analytics' export * from './hooks/useCheckG7ConnectionStatus' -export * from './hooks/useSyncPlayStreak' +export * from './hooks/useSyncPlayStreakWithExternalSource' +export * from './helpers/getPlaystreakArgsFromQuestData' From 038731e425bff62afe6f20aa0ef6f1869f8af73f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elio=20Brice=C3=B1o?= Date: Thu, 3 Oct 2024 14:51:43 -0400 Subject: [PATCH 09/14] tech: rename external sync function --- src/components/QuestDetailsWrapper/index.tsx | 2 +- src/helpers/getPlaystreakArgsFromQuestData.ts | 24 +++++++++---------- .../useSyncPlayStreakWithExternalSource.ts | 2 +- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/components/QuestDetailsWrapper/index.tsx b/src/components/QuestDetailsWrapper/index.tsx index 57e6400..6072299 100644 --- a/src/components/QuestDetailsWrapper/index.tsx +++ b/src/components/QuestDetailsWrapper/index.tsx @@ -596,7 +596,7 @@ export function QuestDetailsWrapper({ questMeta, questPlayStreakData, useModuleInitTimeForSessionStartTime: isSignedIn, - onSync: async() => { + onSync: async () => { if (questsWithExternalPlayStreakSync.includes(questMeta.id)) { syncPlayStreakWithExternalSource(questMeta.id) } else { diff --git a/src/helpers/getPlaystreakArgsFromQuestData.ts b/src/helpers/getPlaystreakArgsFromQuestData.ts index 08ac66a..2f3f7ef 100644 --- a/src/helpers/getPlaystreakArgsFromQuestData.ts +++ b/src/helpers/getPlaystreakArgsFromQuestData.ts @@ -4,19 +4,17 @@ import { Quest, UserPlayStreak } from '@hyperplay/utils' // this is initialized when the overlay is started for this game let dateTimeCurrentSessionStartedInMsSinceEpoch = Date.now() -export function getPlaystreakArgsFromQuestData( - { - questMeta, - questPlayStreakData, - useModuleInitTimeForSessionStartTime, - onSync - }: { - questMeta: Quest; - questPlayStreakData: UserPlayStreak | undefined | null; - useModuleInitTimeForSessionStartTime?: boolean; - onSync: () => void; - } -): PlayStreakEligibility { +export function getPlaystreakArgsFromQuestData({ + questMeta, + questPlayStreakData, + useModuleInitTimeForSessionStartTime, + onSync +}: { + questMeta: Quest + questPlayStreakData: UserPlayStreak | undefined | null + useModuleInitTimeForSessionStartTime?: boolean + onSync: () => void +}): PlayStreakEligibility { let sessionStartedTime = undefined if (useModuleInitTimeForSessionStartTime) { sessionStartedTime = dateTimeCurrentSessionStartedInMsSinceEpoch diff --git a/src/hooks/useSyncPlayStreakWithExternalSource.ts b/src/hooks/useSyncPlayStreakWithExternalSource.ts index 6b2710d..ae13e28 100644 --- a/src/hooks/useSyncPlayStreakWithExternalSource.ts +++ b/src/hooks/useSyncPlayStreakWithExternalSource.ts @@ -22,7 +22,7 @@ export interface UseSyncPlayStreakProps { > } -export const useSyncPlayStreak = ({ +export const useSyncPlayStreakWithExternalSource = ({ getCSRFToken, syncPlayStreakWithExternalSource, checkPendingSync, From 335fe61434f919fa6b5808d8bca8cb8e41ae7325 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elio=20Brice=C3=B1o?= Date: Fri, 4 Oct 2024 16:35:18 -0400 Subject: [PATCH 10/14] chore: add logs --- src/components/QuestDetailsWrapper/index.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/QuestDetailsWrapper/index.tsx b/src/components/QuestDetailsWrapper/index.tsx index 6072299..23ed2da 100644 --- a/src/components/QuestDetailsWrapper/index.tsx +++ b/src/components/QuestDetailsWrapper/index.tsx @@ -602,6 +602,8 @@ export function QuestDetailsWrapper({ } else { await syncPlaySession(projectId, 'hyperplay') questPlayStreakResult.invalidateQuery() + logInfo(`Synced play session for quest ${questMeta.id}`) + console.log(`Synced play session for quest ${questMeta.id}`) } } }) From 3a50d1bebc2118b3886286f9cdedf348a233b020 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elio=20Brice=C3=B1o?= Date: Mon, 7 Oct 2024 14:18:11 -0400 Subject: [PATCH 11/14] tech(quest): invalidate query after sync --- src/components/QuestDetailsWrapper/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/QuestDetailsWrapper/index.tsx b/src/components/QuestDetailsWrapper/index.tsx index 23ed2da..ce6583f 100644 --- a/src/components/QuestDetailsWrapper/index.tsx +++ b/src/components/QuestDetailsWrapper/index.tsx @@ -601,10 +601,10 @@ export function QuestDetailsWrapper({ syncPlayStreakWithExternalSource(questMeta.id) } else { await syncPlaySession(projectId, 'hyperplay') - questPlayStreakResult.invalidateQuery() logInfo(`Synced play session for quest ${questMeta.id}`) console.log(`Synced play session for quest ${questMeta.id}`) } + questPlayStreakResult.invalidateQuery() } }) }, From f10a76184ee32760042c240470ec6864c6168c36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elio=20Brice=C3=B1o?= Date: Mon, 7 Oct 2024 14:20:40 -0400 Subject: [PATCH 12/14] tech(quest): await sync request --- src/components/QuestDetailsWrapper/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/QuestDetailsWrapper/index.tsx b/src/components/QuestDetailsWrapper/index.tsx index ce6583f..fa83d37 100644 --- a/src/components/QuestDetailsWrapper/index.tsx +++ b/src/components/QuestDetailsWrapper/index.tsx @@ -598,7 +598,7 @@ export function QuestDetailsWrapper({ useModuleInitTimeForSessionStartTime: isSignedIn, onSync: async () => { if (questsWithExternalPlayStreakSync.includes(questMeta.id)) { - syncPlayStreakWithExternalSource(questMeta.id) + await syncPlayStreakWithExternalSource(questMeta.id) } else { await syncPlaySession(projectId, 'hyperplay') logInfo(`Synced play session for quest ${questMeta.id}`) From 698615b2d45b7053f7cea05dfba39f564e8224de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elio=20Brice=C3=B1o?= Date: Mon, 7 Oct 2024 18:21:19 -0400 Subject: [PATCH 13/14] tech(quest): add resetSessionStartedTime --- src/components/QuestDetailsWrapper/index.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/QuestDetailsWrapper/index.tsx b/src/components/QuestDetailsWrapper/index.tsx index fa83d37..47c4ac7 100644 --- a/src/components/QuestDetailsWrapper/index.tsx +++ b/src/components/QuestDetailsWrapper/index.tsx @@ -16,13 +16,17 @@ import { RewardClaimSignature, ConfirmClaimParams, Runner, - DepositContract + DepositContract, + wait } from '@hyperplay/utils' import { mintReward } from '../../helpers/mintReward' import { resyncExternalTasks as resyncExternalTasksHelper } from '../../helpers/resyncExternalTask' import useGetUserPlayStreak from '../../hooks/useGetUserPlayStreak' import { useMutation, useQueryClient } from '@tanstack/react-query' -import { getPlaystreakArgsFromQuestData } from '../../helpers/getPlaystreakArgsFromQuestData' +import { + getPlaystreakArgsFromQuestData, + resetSessionStartedTime +} from '../../helpers/getPlaystreakArgsFromQuestData' import { useGetRewards } from '../../hooks/useGetRewards' import { chainMap, parseChainMetadataToViemChain } from '@hyperplay/chains' import { InfoAlertProps } from '@hyperplay/ui/dist/components/AlertCard' @@ -601,6 +605,7 @@ export function QuestDetailsWrapper({ await syncPlayStreakWithExternalSource(questMeta.id) } else { await syncPlaySession(projectId, 'hyperplay') + resetSessionStartedTime() logInfo(`Synced play session for quest ${questMeta.id}`) console.log(`Synced play session for quest ${questMeta.id}`) } From f8f121248fd01a1e5e25051125b18b58bb348272 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elio=20Brice=C3=B1o?= Date: Mon, 7 Oct 2024 18:22:21 -0400 Subject: [PATCH 14/14] chore: remove unused import --- src/components/QuestDetailsWrapper/index.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/QuestDetailsWrapper/index.tsx b/src/components/QuestDetailsWrapper/index.tsx index 47c4ac7..deac446 100644 --- a/src/components/QuestDetailsWrapper/index.tsx +++ b/src/components/QuestDetailsWrapper/index.tsx @@ -16,8 +16,7 @@ import { RewardClaimSignature, ConfirmClaimParams, Runner, - DepositContract, - wait + DepositContract } from '@hyperplay/utils' import { mintReward } from '../../helpers/mintReward' import { resyncExternalTasks as resyncExternalTasksHelper } from '../../helpers/resyncExternalTask'