Replies: 2 comments
-
A quicker solution to the compilation feasibility issue would be to have the dApp generate and compile the move script in advance and have the fun transaction_manifest<X, Y>(user: &signer, x_amount: u64, y_min_amount: u64) {
// ... basically the same function definition with the constants renamed to use the x_amount and y_min_amount parameters
} However, the wallet would then have to decompile the script bytecode if the user wants to see the script code, which wouldn't be as readable as the variable names aren't preserved in the bytecode. |
Beta Was this translation helpful? Give feedback.
-
Aptos Intents enable this in a much cleaner way(and is more or less the same as Sui PTBs). |
Beta Was this translation helpful? Give feedback.
-
I am reaching out to propose an enhancement to the user experience on Aptos that I believe could significantly improve the way users interact with dApps, particularly in terms of understanding and signing transactions.
Proposal Overview
The core of this proposal is to develop a standardized process for programmatically generating Move scripts that encapsulate dApp-specific transaction logic. This would be accompanied by a standardized function, possibly named
transaction_manifest
, which would be called by the user's connected wallet to sign transactions.Technical Components
Manifest Instruction List:
CALL_FUNCTION(package_address, module_name, module_function, type_parameters, parameters, return_val_vars)
: Directive to call the specified module's function. If it's a function call to a trusted package (e.g., 0x1) such asaptos_framework::coin::withdraw
, wallets in their visual representation can make this function call standout.return_val_vars
are the local Move variable names assigned to the return values of the function call and can be referenced in other instructions that accept those variables of the same type.ASSERT_CONTAINS_COIN(coin_var, amount)
: Asserts that the specifiedcoin_var
contains at least the specified amount.Move Script Generator:
@aptos-labs/ts-sdk
) that dApps can use to generate transaction manifest move scripts from transaction manifest instruction lists. This library would output Move script source code that implements the requested transaction logic. Error handling can be discussed and refined by the community, with considerations similar to other in-wallet errors such as an invalid balance to execute the requested transaction.Wallet Integration:
Example Use Case
Imagine a user wants to perform a token swap on a decentralized exchange (DEX) using a dApp. The dApp would submit a standardized request to the user's wallet, detailing the instructions to be taken (e.g., step 1. withdraw X amount of Coin A, step 2. swap coin A for Coin B, step 3. ensure a minimum amount received, step 4. deposit Coin B back into the user's account). The wallet would then generate the Move script, compile it, and present it to the user. If the dApp did not include the minimum amount out guarantee in step 3, then the wallet will autopopulate that guarantee into the list of instructions. The wallet may give the user the option to customize those guarantees (e.g., to effectively increase/decrease slippage).
Example Transaction Manifest List:
Example Generated Move Script:
Wallet UI Visualization:
For the average user who may not be familiar with Move script syntax, wallets can provide a clean and intuitive UI that visualizes the transaction manifest's instruction list. Here are some ways wallets could approach this:
some_dex_address::pool::swap_x_for_y
and then "Deposit at least 56,789 Coin Y to User".By providing both the raw Move script for technical users and a friendly UI for non-technical users, wallets can cater to the entire user base, ensuring transparency, security, and ease of use.
Benefits
Enhanced Security & User Trust:
Simplified User Experience:
Standardization:
I look forward to the community’s feedback and discussions on how we can refine and implement this proposal.
Beta Was this translation helpful? Give feedback.
All reactions