-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update screens for deposit and withdrawal flows #821
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for acre-dapp ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for acre-dapp-testnet ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
eec8832
to
3952c51
Compare
The status will tell us when the wallet window opens and when the transaction is completed.
The "Skeleton" loading screen from both Deposit and Withdraw flows is no longer needed. The new flow adds two steps: - "Opening your wallet for signature" Screen - "Awaiting Transaction" Screen
d7b5be7
to
9e6fbe6
Compare
We want to know when the transaction data are built. We add callback that is triggered after building data.
730ce12
to
51a3965
Compare
@@ -24,6 +25,7 @@ export function useDepositBTCTransaction( | |||
const [transactionHash, setTransactionHash] = useState<string | undefined>( | |||
undefined, | |||
) | |||
const [inProgress, setInProgress] = useState<boolean>(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's a good opportunity to refactor this hook and use useMutation
hook from @tanstack/react-query
?
onDepositBTCSuccess, | ||
onDepositBTCError, | ||
) | ||
const { sendBitcoinTransaction, transactionHash, inProgress } = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rename inProgress
to isInProgress
to keep consistency with other boolean values. Or if you agree to refactor the useDepositBTCTransaction
hook as I mentioned above, we can use status
.
}: { | ||
step: WalletInteractionStep | ||
}) { | ||
const type = useActionFlowType() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const type = useActionFlowType() | |
const action = useActionFlowType() |
or
const type = useActionFlowType() | |
const actionType = useActionFlowType() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sdk/src/lib/redeemer-proxy.ts
Outdated
@@ -25,6 +26,8 @@ export default class OrangeKitTbtcRedeemerProxy implements TbtcRedeemerProxy { | |||
|
|||
#sharesAmount: bigint | |||
|
|||
#builtDataStepCallback?: BuiltDataStepCallback |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we use onSignMessageStepCallback
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, no. Withdrawal flow is the following three steps:
- Preparing transaction
- Opening wallet for signature
- Awaiting signature confirmation
So we need to know when the data for the transaction is ready to display step 2. The status change in onSignMessageStepCallback
matches the change from step 2 to step 3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we need to know when the data for the transaction is ready to display step 2. The status change in onSignMessageStepCallback matches the change from step 2 to step 3.
Isn't the data ready when we ask for a signature? Can't we display the preparing transaction
step just after invoking the withdrawal function, then change the status in onSignMessageStepCallback
to Opening wallet for signature
and in messageSignedStepCallback
display Awaiting signature confirmation
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the data ready when we ask for a signature?
Yeah the data is ready at that time.
Can't we display the preparing transaction step just after invoking the withdrawal function, then change the status in onSignMessageStepCallback to Opening wallet for signature and in messageSignedStepCallback display Awaiting signature confirmation?
TheOpening wallet for signature
step should change to Awaiting signature confirmation
when the wallet window opens. Therefore, we need the additional state of dataBuiltStepCallback
. The status change in onSignMessageStepCallback
indicates that the wallet should be open.
sdk/src/lib/redeemer-proxy.ts
Outdated
@@ -25,6 +26,8 @@ export default class OrangeKitTbtcRedeemerProxy implements TbtcRedeemerProxy { | |||
|
|||
#sharesAmount: bigint | |||
|
|||
#builtDataStepCallback?: BuiltDataStepCallback |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should rename to 🤔 :
#builtDataStepCallback?: BuiltDataStepCallback | |
#buildDataStepCallback?: BuiltDataStepCallback |
or
#builtDataStepCallback?: BuiltDataStepCallback | |
#dataBuiltStepCallback?: BuiltDataStepCallback |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sdk/src/lib/redeemer-proxy.ts
Outdated
@@ -7,6 +7,7 @@ import { OrangeKitSdk } from "@orangekit/sdk" | |||
import { AcreContracts } from "./contracts" | |||
import { BitcoinProvider } from "./bitcoin" | |||
|
|||
export type BuiltDataStepCallback = (safeTxData: Hex) => Promise<void> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isIndeterminate | ||
{...progressProps} | ||
/> | ||
<Image src={connector?.icon} p={2} bg="black" {...ICON_STYLES} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add alt="Connector icon
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ref #811
Closes #814
Closes #813
This PR updates screens for deposit and withdrawal flows. The "Skeleton" loading screen from both Deposit and Withdraw flows is no longer needed. The new flow adds two steps:
Flow:
Screen.Recording.2024-10-31.at.13.12.28.mov