i want send asset to user wallet with automatically generated by @algorandfoundation/algokit-client-generator. file `const signer = async (transactions: algosdk.Transaction) => {
const signed = await signTransactions(transactions);
console.log(‘signed’, signed);
return signed;
};
const shoshaClient = new ShoshaMarketplaceClient(
{
resolveBy: ‘id’,
id: MARKETPLACE_APP_ID,
sender: { addr: wallet!, signer },
},
algodClient
);
const algorand = AlgorandClient.fromConfig({
algodConfig: { server: NODE_URL, port: ‘’, token: ‘’ },
});
algorand.setDefaultSigner(signer);
const onBuy = async () => {
try {
const sp = await algodClient.getTransactionParams().do();
sp.flatFee = true;
sp.fee = sp.minFee;
const group = shoshaClient.compose();
const optin_txn = makeAssetTransferTxnWithSuggestedParamsFromObject({
from: wallet.trim(),
to: wallet.trim(),
amount: 0,
assetIndex: listingData?.asset_id,
suggestedParams: sp,
note: new TextEncoder().encode('Hello'),
});
const send_txn = makeAssetTransferTxnWithSuggestedParamsFromObject({
from: listingData?.lister,
to: wallet,
assetIndex: listingData?.asset_id,
amount: 1,
closeRemainderTo: undefined,
suggestedParams: sp,
});
const payTxn = makePaymentTxnWithSuggestedParamsFromObject({
from: wallet,
to: listingData?.lister,
amount: listingData.price,
suggestedParams: sp,
});
group.addTransaction(send_txn);
group.addTransaction(optin_txn);
group.addTransaction(payTxn);
const result = await group.execute();
console.log('buy res =>', result);
} catch (error) {
console.error('Error during purchase:', error);
}
};`