From 423ee18e6a63585a3945930558f96b2e796c3638 Mon Sep 17 00:00:00 2001 From: muzam1l Date: Thu, 2 Mar 2023 15:11:44 +0530 Subject: [PATCH 01/31] Add Invoke HookOn option. --- utils/hookOnCalculator.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/hookOnCalculator.ts b/utils/hookOnCalculator.ts index 7baad7c..4856fbf 100644 --- a/utils/hookOnCalculator.ts +++ b/utils/hookOnCalculator.ts @@ -23,7 +23,8 @@ export const tts = { ttNFTOKEN_BURN: 26, ttNFTOKEN_CREATE_OFFER: 27, ttNFTOKEN_CANCEL_OFFER: 28, - ttNFTOKEN_ACCEPT_OFFER: 29 + ttNFTOKEN_ACCEPT_OFFER: 29, + ttINVOKE: 99, } export type TTS = typeof tts From b50b3003071e0c974f3f8a8a3094a67e05b718ff Mon Sep 17 00:00:00 2001 From: muzam1l Date: Fri, 3 Mar 2023 16:00:43 +0530 Subject: [PATCH 02/31] Refactor tx. --- components/Select.tsx | 3 +- components/Transaction/ui.tsx | 250 ++++++++++++++-------------------- state/transactions.ts | 8 +- 3 files changed, 112 insertions(+), 149 deletions(-) diff --git a/components/Select.tsx b/components/Select.tsx index 8c5e975..3822e18 100644 --- a/components/Select.tsx +++ b/components/Select.tsx @@ -38,7 +38,8 @@ const Select = forwardRef((props, ref) => { container: provided => { return { ...provided, - position: 'relative' + position: 'relative', + width: '100%' } }, singleValue: provided => ({ diff --git a/components/Transaction/ui.tsx b/components/Transaction/ui.tsx index 59e2d64..f4e1321 100644 --- a/components/Transaction/ui.tsx +++ b/components/Transaction/ui.tsx @@ -1,4 +1,4 @@ -import { FC, useCallback, useEffect, useMemo, useState } from 'react' +import { FC, ReactNode, useCallback, useEffect, useMemo, useState } from 'react' import Container from '../Container' import Flex from '../Flex' import Input from '../Input' @@ -18,6 +18,7 @@ import { streamState } from '../DebugStream' import { Button } from '..' import Textarea from '../Textarea' import { getFlags } from '../../state/constants/flags' +import { Plus, Trash } from 'phosphor-react' interface UIProps { setState: (pTx?: Partial | undefined) => TransactionState | undefined @@ -120,6 +121,7 @@ export const TxUI: FC = ({ state: txState, setState, resetState, estima } const otherFields = Object.keys(txFields).filter(k => !richFields.includes(k)) as [keyof TxFields] + const hookParams = [{ id: 1 }] return ( = ({ state: txState, setState, resetState, estima }} > - - - Transaction type:{' '} - + handleSetAccount(acc)} // TODO make react-select have correct types for acc /> - + {richFields.includes('Destination') && ( - - - Destination account:{' '} - + = ({ state: txState, setState, resetState, estima selectedFlags ? selectedFlags.length >= flagsOptions.length - 1 : false } /> - + )} {otherFields.map(field => { let _value = txFields[field] @@ -251,93 +200,104 @@ export const TxUI: FC = ({ state: txState, setState, resetState, estima let rows = isJson ? (value?.match(/\n/gm)?.length || 0) + 1 : undefined if (rows && rows > 5) rows = 5 return ( - - - - {field + (isXrp ? ' (XRP)' : '')}:{' '} - - {isJson ? ( -