Skip to content

Commit

Permalink
Remove unused packages and wrap tx replacement in form (#1052)
Browse files Browse the repository at this point in the history
* Use form onSubmit

* Remove unused packages

* linter fix

* Update Send.test.tsx.snap

* update dev dependencies

* reinstall whatwg-fetch

* Remove @cloudflare/wrangler package
  • Loading branch information
navFooh authored Jun 16, 2022
1 parent df9ab10 commit d5f0467
Show file tree
Hide file tree
Showing 6 changed files with 1,041 additions and 1,578 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,9 @@ Version **x.y.z**:
A number of modules have been broken out into packages in this [modules repo](https://github.com/glifio/modules).

- [Filecoin wallet provider](https://github.com/glifio/modules/tree/primary/packages/filecoin-wallet-provider)
- [Filecoin jsonrpc client](https://github.com/glifio/modules/tree/primary/packages/filecoin-rpc-client)
- [Filecoin number type](https://github.com/glifio/modules/tree/primary/packages/filecoin-number)
- [Filecoin message type](https://github.com/glifio/modules/tree/primary/packages/filecoin-message)
- [Filecoin address type](https://github.com/glifio/modules/tree/primary/packages/filecoin-address)
- [Filecoin message confirmer](https://github.com/glifio/modules/tree/primary/packages/filecoin-message-confirmer)
- [Filecoin react-components](https://github.com/glifio/modules/tree/primary/packages/react-components)

#### Filecoin module package local development
Expand Down
24 changes: 0 additions & 24 deletions __mocks__/dayjs.js

This file was deleted.

92 changes: 48 additions & 44 deletions components/Wallet/Replace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,31 +125,36 @@ export const Replace = ({ strategy }: ReplaceProps) => {

return (
<Dialog>
<Transaction.Header
txState={txState}
title={
strategy === ReplaceStrategy.SPEED_UP
? 'Speed Up Message'
: 'Cancel Message'
}
description={'Please confirm the updated message details below'}
loginOption={loginOption as LoginOption}
errorMessage={
messageError?.message ||
gasParamsError?.message ||
minGasParamsError?.message ||
txError?.message ||
walletError() ||
''
}
/>
{txState !== TxState.LoadingMessage && (
<ShadowBox>
<Transaction.Balance
address={wallet.address}
balance={wallet.balance}
/>
<form>
<form
onSubmit={(e) => {
e.preventDefault()
onSend()
}}
>
<Transaction.Header
txState={txState}
title={
strategy === ReplaceStrategy.SPEED_UP
? 'Speed Up Message'
: 'Cancel Message'
}
description={'Please confirm the updated message details below'}
loginOption={loginOption as LoginOption}
errorMessage={
messageError?.message ||
gasParamsError?.message ||
minGasParamsError?.message ||
txError?.message ||
walletError() ||
''
}
/>
{txState !== TxState.LoadingMessage && (
<ShadowBox>
<Transaction.Balance
address={wallet.address}
balance={wallet.balance}
/>
<InputV2.Text label='Message CID' value={cid} disabled />
<InputV2.Number label='Nonce' value={message.nonce} disabled />
<InputV2.Filecoin
Expand Down Expand Up @@ -200,25 +205,24 @@ export const Replace = ({ strategy }: ReplaceProps) => {
onChange={setExpert}
disabled={txState !== TxState.FillingForm}
/>
</form>
{maxFee && (
<p>
You will not pay more than {maxFee.toFil()} FIL for this
transaction.{' '}
<SmartLink href='https://filfox.info/en/stats/gas'>
More information on average gas fee statistics.
</SmartLink>
</p>
)}
</ShadowBox>
)}
<Transaction.Buttons
backDisabled={txState !== TxState.FillingForm}
nextDisabled={txState !== TxState.FillingForm || !inputsValid}
backText='Cancel'
nextText='Send'
onClickNext={onSend}
/>
{maxFee && (
<p>
You will not pay more than {maxFee.toFil()} FIL for this
transaction.{' '}
<SmartLink href='https://filfox.info/en/stats/gas'>
More information on average gas fee statistics.
</SmartLink>
</p>
)}
</ShadowBox>
)}
<Transaction.Buttons
backDisabled={txState !== TxState.FillingForm}
nextDisabled={txState !== TxState.FillingForm || !inputsValid}
backText='Cancel'
nextText='Send'
/>
</form>
</Dialog>
)
}
Expand Down
Loading

0 comments on commit d5f0467

Please sign in to comment.