From 0736835c3a1952a81bc7f9d84f6a56b3fbeaad17 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Thu, 12 Sep 2024 12:20:15 +0200 Subject: [PATCH 01/11] Bump api-solang to latest version --- package.json | 2 +- yarn.lock | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index d5049a15..2e166748 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "@hookform/resolvers": "^2.9.11", "@netlify/functions": "^2.8.1", "@pendulum-chain/api": "^0.3.8", - "@pendulum-chain/api-solang": "^0.4.0", + "@pendulum-chain/api-solang": "^0.6.1", "@polkadot/api": "^10.9.1", "@polkadot/api-base": "^10.9.1", "@polkadot/api-contract": "^10.9.1", diff --git a/yarn.lock b/yarn.lock index 3436d92b..bd5cbfe8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3342,9 +3342,9 @@ __metadata: languageName: node linkType: hard -"@pendulum-chain/api-solang@npm:^0.4.0": - version: 0.4.0 - resolution: "@pendulum-chain/api-solang@npm:0.4.0" +"@pendulum-chain/api-solang@npm:^0.6.1": + version: 0.6.1 + resolution: "@pendulum-chain/api-solang@npm:0.6.1" peerDependencies: "@polkadot/api": ^10.0 "@polkadot/api-contract": ^10.12.1 @@ -3353,7 +3353,7 @@ __metadata: "@polkadot/types-codec": ^10.0 "@polkadot/util": "*" "@polkadot/util-crypto": "*" - checksum: 10c0/37f0b225b1529dd46b38e050a4fac89acb706bc62b10855db83f4e8658423aeb921f8ad16fadcd21e9aef68aa5ac66274dbdd829247005a3e207a94411ab1cd0 + checksum: 10c0/9db47f45bad07c33820b73bd0ef0c4573102a6fa11a135f4e31f9381c8a9d76804c5b217433ac63c25ebd17f2126457c50e41cb4867641aeffa027b247811905 languageName: node linkType: hard @@ -13453,7 +13453,7 @@ __metadata: "@hookform/resolvers": "npm:^2.9.11" "@netlify/functions": "npm:^2.8.1" "@pendulum-chain/api": "npm:^0.3.8" - "@pendulum-chain/api-solang": "npm:^0.4.0" + "@pendulum-chain/api-solang": "npm:^0.6.1" "@pendulum-chain/types": "npm:^0.3.8" "@polkadot/api": "npm:^10.9.1" "@polkadot/api-base": "npm:^10.9.1" From b3d108bb55c970405c8356f3a374ba6a92e22244 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Thu, 12 Sep 2024 12:21:31 +0200 Subject: [PATCH 02/11] Show button to view nabla transaction on explorer --- .../nabla/common/TransactionProgress.tsx | 41 +++++++++++++++---- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/src/components/nabla/common/TransactionProgress.tsx b/src/components/nabla/common/TransactionProgress.tsx index 4a74e95f..90b6e7c0 100644 --- a/src/components/nabla/common/TransactionProgress.tsx +++ b/src/components/nabla/common/TransactionProgress.tsx @@ -5,6 +5,8 @@ import { ExecuteMessageResult } from '@pendulum-chain/api-solang'; import Spinner from '../../../assets/spinner'; import { UseContractWriteResponse } from '../../../hooks/nabla/useContractWrite'; +import { TenantName } from '../../../models/Tenant'; +import { useGlobalState } from '../../../GlobalStateProvider'; export interface TransactionProgressProps { mutation: UseContractWriteResponse; @@ -26,43 +28,64 @@ const getErrorMessage = (data?: ExecuteMessageResult['result']) => { } }; +function getExplorerUrl(tenant: TenantName, data?: ExecuteMessageResult['execution']) { + if (tenant === TenantName.Pendulum && data?.type === 'extrinsic') { + return `https://pendulum.subscan.io/extrinsic/${data.txHash.toHex()}`; + } + + return undefined; +} + export function TransactionProgress({ mutation, children, onClose }: TransactionProgressProps): JSX.Element | null { - if (mutation.isIdle) return null; + const { tenantName } = useGlobalState(); const errorMsg = getErrorMessage(mutation.data?.result); + + const explorerUrl = getExplorerUrl(tenantName, mutation.data?.execution); + + if (mutation.isIdle) return null; + if (mutation.isLoading) { const isPending = false; // TODO: currently there is not status for this (waiting confirmation in wallet) return ( <> -
+
-

+

{isPending ? 'Waiting for confirmation' : 'Executing transaction'}

{children} -

+

{isPending ? 'Confirm this transaction in your wallet' : 'Proceed in your wallet'}

); } + return ( <>
{mutation.isSuccess ? ( - + ) : ( - + )}
-
+

{mutation.isSuccess ? 'Transaction successful' : 'Transaction failed'}

- {!mutation.isSuccess && !!errorMsg &&

{errorMsg}

} + {!mutation.isSuccess && !!errorMsg &&

{errorMsg}

} + {!!explorerUrl && ( + + + + )} {!!onClose && ( - )} From 572e5a1edecf3a9a252f005c78c90acce6a04215 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Thu, 12 Sep 2024 12:31:23 +0200 Subject: [PATCH 03/11] Change margin of buttons --- src/components/nabla/common/TransactionProgress.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/nabla/common/TransactionProgress.tsx b/src/components/nabla/common/TransactionProgress.tsx index 90b6e7c0..e6bd86b8 100644 --- a/src/components/nabla/common/TransactionProgress.tsx +++ b/src/components/nabla/common/TransactionProgress.tsx @@ -77,6 +77,7 @@ export function TransactionProgress({ mutation, children, onClose }: Transaction
{!mutation.isSuccess && !!errorMsg &&

{errorMsg}

} +
{!!explorerUrl && ( )} From ee87ac02b42ce049f6cc02044c62456ae4155434 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Thu, 12 Sep 2024 12:31:38 +0200 Subject: [PATCH 04/11] Enable Nabla on Pendulum (only for testing, to be removed) --- src/config/apps/nabla.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/config/apps/nabla.ts b/src/config/apps/nabla.ts index d6d70af7..41011c58 100644 --- a/src/config/apps/nabla.ts +++ b/src/config/apps/nabla.ts @@ -1,5 +1,6 @@ import { TenantName } from '../../models/Tenant'; import { AppConfigBase } from './types'; + export type NablaConfig = AppConfigBase & Partial< Record< @@ -13,11 +14,16 @@ export type NablaConfig = AppConfigBase & >; export const nablaConfig: NablaConfig = { - tenants: [TenantName.Foucoco], - environment: ['staging', 'development'], + tenants: [TenantName.Foucoco, TenantName.Pendulum], + environment: ['staging', 'development', 'production'], foucoco: { indexerUrl: 'https://pendulum.squids.live/foucoco-squid/graphql', router: '6mYwT4yRrrMK978NszqBvxkvXjYnsmKfs2BkYGJGiR4XY9Sc', oracle: '6kqj1tnYUGY3L93YFArXKF2E4tpQ2tUJ4DARwkAjZEyDoof6', }, + pendulum: { + indexerUrl: 'https://pendulum.squids.live/pendulum-squid/graphql', + router: '6buMJsFCbXpHRyacKTjBn3Jss241b2aA7CZf9tKzKHMJWpcJ', + oracle: '6f9uHwN2r5w82Bjrywc4wmZYb6TN64bZH5Ev87qmJ675uFvq', + }, }; From 947235122027b715fb9594f3a71670b56d0169ab Mon Sep 17 00:00:00 2001 From: Kacper Szarkiewicz Date: Wed, 25 Sep 2024 13:26:42 +0100 Subject: [PATCH 05/11] remove unnecessary code --- src/components/nabla/common/TransactionProgress.tsx | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/components/nabla/common/TransactionProgress.tsx b/src/components/nabla/common/TransactionProgress.tsx index e6bd86b8..24441b34 100644 --- a/src/components/nabla/common/TransactionProgress.tsx +++ b/src/components/nabla/common/TransactionProgress.tsx @@ -32,11 +32,9 @@ function getExplorerUrl(tenant: TenantName, data?: ExecuteMessageResult['executi if (tenant === TenantName.Pendulum && data?.type === 'extrinsic') { return `https://pendulum.subscan.io/extrinsic/${data.txHash.toHex()}`; } - - return undefined; } -export function TransactionProgress({ mutation, children, onClose }: TransactionProgressProps): JSX.Element | null { +export function TransactionProgress({ mutation, children, onClose }: TransactionProgressProps) { const { tenantName } = useGlobalState(); const errorMsg = getErrorMessage(mutation.data?.result); @@ -79,10 +77,8 @@ export function TransactionProgress({ mutation, children, onClose }: Transaction {!mutation.isSuccess && !!errorMsg &&

{errorMsg}

}
{!!explorerUrl && ( - - + + View on Explorer )} {!!onClose && ( From 3241f1d84c5fcdbc63883fb9859f6875c6750d02 Mon Sep 17 00:00:00 2001 From: Kacper Szarkiewicz Date: Wed, 25 Sep 2024 15:41:02 +0100 Subject: [PATCH 06/11] improve nav responsiveness when multiple collapse groups appear --- src/components/Layout/Nav.tsx | 14 +++++++------- src/components/Layout/index.tsx | 16 ++++++++-------- src/index.css | 4 ++++ 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/components/Layout/Nav.tsx b/src/components/Layout/Nav.tsx index 5d13e166..cb1cd04b 100644 --- a/src/components/Layout/Nav.tsx +++ b/src/components/Layout/Nav.tsx @@ -1,8 +1,7 @@ -import { memo, useEffect, useMemo, useState } from 'preact/compat'; +import { memo, useEffect, useMemo, useState, useRef } from 'preact/compat'; import { NavLink, useLocation } from 'react-router-dom'; import { useGlobalState } from '../../GlobalStateProvider'; -import useBoolean from '../../hooks/useBoolean'; import { createLinks, LinkItem } from './links'; import { NavCollapseButtonContent } from './NavCollapseButtonContent'; @@ -25,17 +24,18 @@ const CollapseMenu = ({ const paths = path.split('/').filter(Boolean); return paths[1] && paths[1].startsWith(link.replace('/', '')) ? true : false; }, [link, pathname]); - const [isOpen, { toggle }] = useBoolean(isActive); + + const inputRef = useRef(null); return ( -
+
+ @@ -109,7 +109,7 @@ const Nav = memo(({ onClick }: NavProps) => { ariaControls="submenu" button={} > -
-
+
-
- -
    +
    • @@ -104,7 +104,7 @@ export default function Layout(): JSX.Element | null {
{ if (visible && isMobile) { setVisible(false); diff --git a/src/index.css b/src/index.css index 0bfa7bc6..2c75097b 100644 --- a/src/index.css +++ b/src/index.css @@ -353,6 +353,10 @@ w3m-modal { scrollbar-width: none; } +.scroll-thin { + scrollbar-width: thin; +} + :root:has(:is(.modal-open, .modal:target, .modal-toggle:checked + .modal, .modal[open])) { scrollbar-gutter: unset; } From fe379f0650105e75d3f8c9e7f20b26127458b461 Mon Sep 17 00:00:00 2001 From: Kacper Szarkiewicz Date: Wed, 25 Sep 2024 15:42:29 +0100 Subject: [PATCH 07/11] fix button class --- src/components/nabla/common/TransactionProgress.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/nabla/common/TransactionProgress.tsx b/src/components/nabla/common/TransactionProgress.tsx index 24441b34..20403b71 100644 --- a/src/components/nabla/common/TransactionProgress.tsx +++ b/src/components/nabla/common/TransactionProgress.tsx @@ -77,7 +77,7 @@ export function TransactionProgress({ mutation, children, onClose }: Transaction {!mutation.isSuccess && !!errorMsg &&

{errorMsg}

}
{!!explorerUrl && ( - + View on Explorer )} From 293f97b352bb109f300f6dcd77c7af143fc4eafd Mon Sep 17 00:00:00 2001 From: Kacper Szarkiewicz Date: Wed, 25 Sep 2024 15:50:50 +0100 Subject: [PATCH 08/11] change swap footer text --- src/components/Layout/Nav.tsx | 2 +- src/components/nabla/common/NablaFootnote.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/Layout/Nav.tsx b/src/components/Layout/Nav.tsx index cb1cd04b..5b00d200 100644 --- a/src/components/Layout/Nav.tsx +++ b/src/components/Layout/Nav.tsx @@ -28,7 +28,7 @@ const CollapseMenu = ({ const inputRef = useRef(null); return ( -
+