transferBalance

Call this function to execute an fungible token transfer transaction.

Example Usage

// Transfer an ERC20 to a different user, with gas sponsored by the paymaster.
const balanceTransferTxInfo = await hallidayClient.transferBalance({
  from_in_game_player_id: userInGameId,										// your user's id in your application
  to_in_game_player_id: "other_player_id",								// other user's id in your application
  token_address: "0x0799ea468f812e40dbabe77b381cac105da500cd",
  value: "100000000000000000", //value in wei
  sponsor_gas: true,
}); 

// Transfer a native token to a different user, with gas sponsored by the paymaster.
const balanceTransferTxInfo = await hallidayClient.transferBalance({
  from_in_game_player_id: userInGameId,										// your user's id in your applicatio
  to_in_game_player_id: "other_player_id",								// other user's id in your application
  value: "0.75", //value in ether
  sponsor_gas: true,
}); 

Inputs

TransferBalanceRequest Object

NameTypeDescription
from_in_game_player_idstringThe user id of the sending user
to_in_game_player_idstringThe user id of the receiving user
token_address (optional)stringContract address of ERC20 asset to transfer. Leave empty to transfer the native token
valuestringAmount of this token to transfer (enter value in wei for ERC20 token and ether for native token)
sponsor_gasbooleanWhether to pay for user's gas on their behalf
on_rate_limit (optional)FunctionCallback to run if user is rate-limited (i.e small message on screen for a few seconds)
gas_fee_overrides (optional)max_fee_per_gas: string;
max_priority_fee_per_gas:
string;
Hardcoded gas fee values in Wei to use for transaction instead of dynamic query values

Outputs

Promise to a GetTransactionReponse Object

NameTypeDescription
blockchain_typestringThe blockchain on which this transaction occurred (e.g. ETHEREUM, IMMUTABLE_PROD)
tx_idstringThe ID of the transaction
statusstringThe status of the transaction (e.g. PENDING, COMPLETE, FAILED)
retry_countnumberThe number of times we've retried sending this transaction
on_chain_id (optional)stringThe blockchain transaction id if the transaction succeeded
error_message (optional)stringThe error message if the transaction failed
user_op_receipt (optional)stringJSON Object of the user operation receipt (if the operation went through on chain)
gas_fee_overrides (optional)max_fee_per_gas: string;
max_priority_fee_per_gas:
string;
Hardcoded gas fee values to use for transaction instead of dynamic query values