POST
/sendStarknetTokenAsSmartContract
Sends ERC20-compatible tokens on Starknet by interacting with token smart contracts. This function provides a convenient interface for transferring tokens that follow the ERC20 standard on Starknet, automatically handling the smart contract interaction by calling the token contract's transfer function.
Internally, this function calls sendTransactionToStarknetContractWithContractInfo with the transfer function and properly formatted parameters, simplifying token transfers for developers. The transaction undergoes Starknet's standard validation and execution phases, with the added benefit of smart contract interaction validation when enabled.
Starknet token contracts are implemented in Cairo and follow similar patterns to Ethereum ERC20 tokens but with Starknet-specific optimizations and features. The function handles the conversion of parameters to the appropriate Cairo types automatically.
Read more about Starknet ERC20 tokens at https://docs.starknet.io/documentation/developing/smart-contracts/erc20/
NOTE: This function is a convenience wrapper around sendTransactionToStarknetContractWithContractInfo.
It automatically formats the parameters for the standard ERC20 transfer function call
- Function name - "transfer"
- Parameters - [["ContractAddress", destination], ["u256", amount]]
Success or failure in this API call does not necessarily mean success or failure in the transaction itself. For example, the transaction may succeed, but the "success" response to the client can be lost
if the client's internet connection is down. To verify the status of the transaction
- Call
getCurrentToken and store the returned token.
- Send your transaction. The transaction will use the token from step 1.
- Call
getTransactionByToken using the stored token to track the status of the transaction.
This function is part of the transaction flow detailed at https://docs.gk8.io/api-v19/sending-transactions-from-the-api.
Return: Transaction submission result with approval status and contract interaction details.
Input Example: sendStarknetTokenAsSmartContract(
1,
"0x0471...938d",
"0x0225...a7b9",
"5000000000000000000",
10000000000,
15000,
True,
"Token transfer to partner wallet"
)
Response Example:
{
"FunctionData": {
"ApprovalRequestStatus": 3,
"CoinType": "STRK",
"Transactions": [
{
"AmountToTransfer": "0",
"DestinationAddress": "0x0471...938d"
}
]
},
"Meta": {
"AccessToken": "a640...5477",
"Destination": "0421...e936",
"Source": "99bf...c264",
"Time": "2025-05-21 17:53:55.827"
}
}
account_idintegerThe account ID to use for this token transfer transaction.
token_contract_addressstring<p>The Starknet contract address of the ERC20-compatible token. Must be a valid Starknet contract address in hex format.</p>
destinationstringThe destination address to receive the tokens. Must be a valid Starknet address.
amountstring<p>The amount of tokens to transfer in the token's base unit (accounting for decimals). For example, to send 1.5 tokens with 18 decimals, use "1500000000000000000".</p>
gas_priceintegerThe amount to pay per unit of gas in wei.
gas_limitintegerThe maximum units of gas to spend for this smart contract transaction.
validate_transactionboolean<p>When true, performs pre-execution validation to check if the transaction is likely to succeed, preventing failed transactions.</p>
descriptionstringInternal description for transaction records. Not sent to the blockchain.
specific_from_addressarrayThe specific deposit address to send from. Cannot be used if the account is defined as an Omnibus account.
acceptstringGenerated from available response content types
200success
curl --request POST \
--url '/sendStarknetTokenAsSmartContract?account_id=1&token_contract_address=string&destination=string&amount=100&gas_price=1&gas_limit=100&validate_transaction=true&description=string' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"FunctionData": {
"AccountId": 1
},
"Meta": {
"FunctionName": "getEthValidatorsSummary",
"RandomData": "288cd49d4b8bf00e7d6114b78d5668d5581d6b953fafef779133caa844cd4229",
"Destination": "b9cb8afe52f1d52521cf2b62dfe12146156ad5328f83c62c20c7da81b263356a61340de745c858998544c041798b01c2f4fac31bebe52a19280a32cd57d6d374ea",
"Time": "2021-02-07T18:37:46.948Z",
"Source": "048b99461a70a49abe63fd585cb224177a22a92d2e9e4ddfbc0027887bee9d1843388f42a3eb2e740565e115ad8b7981abf59e3b03b771f4b063b53c517d7a9d99",
"AccessToken": "51311c84d2c8fd2fafbe56ceb1fb30a99d3417abfc55769577338ab286798087"
}
}'