As shown [here](https://developer.algorand.org/docs/archive/build-apps/hello_world/#construct-the-transaction)
, we need to construct an AlgodClient just to create a transaction, which is a useless and annoying dependency.
I explain : I have a UI in Javascript which is talking to a Python backend.
I create and sign the transaction on UI side and send the signed transaction to the backend (in base64) which sends the transaction to the network.
Only my Python backend is reponsible for sending the signed transaction to the network and thus only the backend should need a AlgodClient object.
The issue is that with the current SDK API I also need a AlgodClient on UI side just to get the suggested parameters which is a useless dependency.
So for now I use something like that on UI (JS) side :
async function createTransaction(from, to, amount) {
const algodClient = new algosdk.Algodv2('', 'https://api.algoexplorer.io/', '');
const params = await algodClient.getTransactionParams().do();
const tx = algosdk.makePaymentTxnWithSuggestedParams(from, to, amount, undefined, undefined, params);
return tx;
}
This could be made a lot simpler by only needing the algosdk to create the transaction (including getting the suggested parameters).
We could even update makePaymentTxnWithSuggestedParams
so that it uses the suggested parameters by default.
With a new simplified API my code would look like this :
async function createTransaction(from, to, amount) {
const tx = algosdk.makePaymentTxnWithSuggestedParams(from, to, amount);
return tx;
}