send Asset
Sends an asset (token) to a specified recipient on a given blockchain.
This function supports sending assets on different blockchain networks like EVM-compatible chains (EIP-155) and Solana. It first validates the input parameters, then builds a transaction based on the chain namespace (e.g., "eip155" or "solana"). Finally, it sends the transaction using the appropriate blockchain-specific method.
Return
A Result containing either: - SendAssetResponse: If the transaction is successful, it contains the transaction hash in the SendAssetResponseData. - SendAssetArgumentError: If there are any validation errors in the input parameters or the chainId is invalid, or an unsupported chain is requested. - Exception: If there is an error during the transaction sending process or an invalid response is received from the blockchain.
Parameters
The ID of the blockchain network (e.g., "eip155:1" for Ethereum Mainnet, "solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ"). It should be in the format "{namespace}:{reference}", where the namespace is lowercase.
The parameters for sending the asset, including the recipient's address, token address, and amount.
Throws
if: - Any of the required parameters in SendAssetParams (to, token, amount) are empty. - The chainId format is invalid (not in "{namespace}:{reference}" format). - The chain namespace is not supported (currently, only "eip155" and "solana" are supported).