Instead of building the payload manually like you do. You would use the typed methods that erdjs provides, like the call method on the smart contract or the transaction payload builder.
If you have the abi file you can even use interactions.
Examples:
https://docs.elrond.com/sdk-and-tools/erdjs/erdjs-cookbook/#when-the-abi-is-not-available-1
https://docs.elrond.com/sdk-and-tools/erdjs/erdjs-cookbook/#using-interaction-when-the-abi-is-available-1
https://github.com/ElrondNetwork/elrond-sdk-erdjs/blob/main/src/smartcontracts/transactionPayloadBuilders.spec.ts#L35
Instead of building the payload manually like you do. You would use the typed methods that erdjs provides, like the call method on the smart contract or the transaction payload builder. If you have the abi file you can even use interactions. Examples: https://docs.elrond.com/sdk-and-tools/erdjs/erdjs-cookbook/#when-the-abi-is-not-available-1 https://docs.elrond.com/sdk-and-tools/erdjs/erdjs-cookbook/#using-interaction-when-the-abi-is-available-1 https://github.com/ElrondNetwork/elrond-sdk-erdjs/blob/main/src/smartcontracts/transactionPayloadBuilders.spec.ts#L35