Skip to content

Conversation

@zerts
Copy link
Collaborator

@zerts zerts commented Aug 15, 2025

In this PR new history endpoint is being introduced.

What was changed:

  • history requests in History and Asset pages -> ZPI
  • no more auto updates, refresh button and cmd+R were introduced
  • action details view moved from the dialog to the separate page, cause in the batched actions there will be nested views and page is a better approach. Action info is passed via the location state.
  • updated views for actions in history, asset page and action details page

In the nearest future transaction simulation will move to the new scheme, so all the places where we work with simulations were updated too

  • simulation view
  • action creation for analytics
  • updated logic for the edit approval form

Also with this update we are moving away from using asset implementations as much as possible.
For now we still need them for Send Form and Edit Approve Form, so there were added some extra logic to keep base quantity instead of common where it is needed.

Partially, simulations components were moved to networkConfig as a prop instead of fetching networks.

TODO

  • remove backend_env before release

Questions to discuss

  • Do we expect network to be non null during the transaction process? It looks like our UI will no allow to sign tx without the network configuration. Can we use this as invariant everywhere?

@github-actions
Copy link

github-actions bot commented Aug 15, 2025

📦 build.zip [updated at Oct 22, 10:48:00 AM UTC]

@zerts zerts force-pushed the task/extension-support-transaction-batching-WLT-7704 branch from e5207a1 to 12540c3 Compare August 20, 2025 17:22
action: AddressAction | null;
};

async function convertToNewInterpretation(
Copy link
Collaborator Author

@zerts zerts Aug 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Temporary function until backend support new data scheme in the new ZPI endpoint


invariant(testAddress, 'TEST_WALLET_ADDRESS Env var not found');

const cancelTxSample = {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to recreate this test with the new scheme?

@zerts zerts requested a review from everdimension August 26, 2025 14:13
@zerts zerts marked this pull request as ready for review August 26, 2025 14:13
@zerts zerts marked this pull request as draft September 5, 2025 13:34
@zerts zerts force-pushed the task/extension-support-transaction-batching-WLT-7704 branch from b7a7688 to 2e2a4f3 Compare September 11, 2025 13:26
@zerts zerts marked this pull request as ready for review September 15, 2025 13:35
@zerts
Copy link
Collaborator Author

zerts commented Sep 15, 2025

Do not forget to change backend_env back before release

@zerts zerts force-pushed the task/extension-support-transaction-batching-WLT-7704 branch from 3cb877f to d1d33e4 Compare September 30, 2025 14:38
try {
const typedData = JSON.parse(data);
const typedData = JSON.parse(data) as TypedData;
// Backend expect chainId to be a string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Backend expect chainId to be a string
// Backend expects chainId to be a string

Comment on lines 17 to 20
// TODO: remove when backend fixed
typedData.domain.chainId = typedData.domain.chainId
? String(typedData.domain.chainId)
: undefined;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. remove?
  2. this is safer:
Suggested change
// TODO: remove when backend fixed
typedData.domain.chainId = typedData.domain.chainId
? String(typedData.domain.chainId)
: undefined;
// TODO: remove when backend fixed
if (typedData.domain.chainId) {
typedData.domain.chainId = String(typedData.domain.chainId)
}

'actIndex should be a number or be empty'
);
const actIndex = act_index ? Number(act_index) : undefined;
const addressAction = state.addressAction as AddressAction | undefined;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

state is undefined on direct navigation, leading to crash

if (typeof data === 'string') {
try {
const typedData = JSON.parse(data);
const typedData = JSON.parse(data) as TypedData;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The next line does the same casting. Is this necessary?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rm?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's already in the main (🫠), so let's remove it at least here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rm?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rm?

Comment on lines 35 to 61
if (
allowanceQuantityCommon == null ||
addressAction?.acts?.length !== 1 ||
addressAction.acts[0].content?.approvals?.length !== 1
) {
return addressAction;
}
return produce(addressAction, (draft) => {
if (draft.acts?.[0].content?.approvals?.[0]) {
if (draft.acts[0].content.approvals[0].amount) {
draft.acts[0].content.approvals[0].amount.quantity =
allowanceQuantityCommon;
} else {
draft.acts[0].content.approvals[0].amount = {
quantity: allowanceQuantityCommon,
value: null,
usdValue: null,
currency: '',
};
}
if (customAllowanceQuantityBase != null) {
draft.acts[0].content.approvals[0].unlimited = isUnlimitedApproval(
customAllowanceQuantityBase
);
}
}
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this logic is better placed outside of UI?
Perhaps in /src/modules/ethereum/transactions/appovals.ts? Or nearby:)

Comment on lines 149 to 151
<VStack gap={0}>
<UIText kind="headline/h3">{collection.name}</UIText>
</VStack>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is VStack needed?

);

// Special request for analytics purposes.
const { data: inputFungibleUsdInfo } = useAssetFullInfo(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const { data: inputFungibleUsdInfo } = useAssetFullInfo(
const { data: inputFungibleUsdInfoForAnalytics } = useAssetFullInfo(

</VStack>
{actions.length && (isLoading || hasMore) ? (
<SurfaceList
style={{ paddingBlockStart: 6, paddingBlockEnd: 6 }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Suggested change
style={{ paddingBlockStart: 6, paddingBlockEnd: 6 }}
style={{ paddingBlock: 6 }}

const backendHashes = new Set(backend.map((tx) => tx.transaction.hash));
const backendHashes = new Set(
backend.map(
(tx) => tx.transaction?.hash || tx.acts?.at(0)?.transaction.hash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably needs a comment. For now we can generate locally only txs with one hash, so it should be enough to compare the hash of the first act. But may be it is actually more reliable to go through all acts there

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated!

/>
</Button>
<KeyboardShortcut
combination="cmd+r"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's maybe mention this shortcut in the refresh button's title?

};

// Special request for analytics purposes.
const { data: inputFungibleUsdInfo } = useAssetFullInfo(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const { data: inputFungibleUsdInfo } = useAssetFullInfo(
const { data: inputFungibleUsdInfoForAnalytics } = useAssetFullInfo(

Comment on lines 85 to 89
// const functionName = useMemo(
// () =>
// interpretation ? getInterpretationFunctionName(interpretation) : null,
// [interpretation]
// );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rm comments in this file? Is this the final version?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I will remove comments!

useEffect(() => setAllowanceBase(null), [inputAmount, inputFungibleId]);

// Special request for analytics purposes.
const { data: inputFungibleUsdInfo } = useAssetFullInfo(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const { data: inputFungibleUsdInfo } = useAssetFullInfo(
const { data: inputFungibleUsdInfoForAnaytics } = useAssetFullInfo(

{ source }: BackendSourceParams
): Promise<InterpretResponse | null> {
return Promise.race([
rejectAfterDelay(10000, 'interpret transaction'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need a reject here? Http request should get rejected on its own?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct! That is the legacy from the socket api. Will remove!

{ source }: BackendSourceParams
): Promise<SignatureInterpretResponse> {
return Promise.race([
rejectAfterDelay(10000, 'interpret signature'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@everdimension everdimension left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments

@zerts zerts merged commit b5a6296 into main Oct 22, 2025
2 of 3 checks passed
@zerts zerts deleted the task/extension-support-transaction-batching-WLT-7704 branch October 22, 2025 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants