transferAsset
Call this function to execute an NFT transfer transaction. The user must be logged in for this call to succeed. You can confirm a user has been logged in by calling hallidayClient.getUserInfo()
. Note that the from_in_game_player_id
parameter must the id of the user currently logged in.
Example Usage
import {Halliday} from "halliday-sdk";
/**
* Transfer an NFT to another user within your app that has a Halliday account.
*
*/
const transferAssetTxInfo = await hallidayClient.transferAsset({
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
collection_address: "0xeeaf9e39057002eae4bea8bb4e65b01a9cfd59be",
token_id: "3988",
sponsor_gas: true,
});
Inputs
TransferAssetRequest Object
Name | Type | Description |
---|---|---|
from_in_game_player_id | string | The user id of sending user |
to_in_game_player_id | string | The user id of receiving user |
collection_address | string | Contract address of target NFT |
token_id | string | Token id of target NFT |
sponsor_gas | boolean | Whether to pay for user's gas on their behalf |
on_rate_limit (optional) | Function | Callback to run if user is rate-limited (i.e small message on screen for a few seconds) |
Outputs
Promise to a GetTransactionReponse Object
Name | Type | Description |
---|---|---|
blockchain_type | string | The blockchain on which this transaction occurred (e.g. ETHEREUM, IMMUTABLE_PROD) |
tx_id | string | The ID of the transaction |
status | string | The status of the transaction (e.g. PENDING, COMPLETE, FAILED) |
retry_count | number | The number of times we've retried sending this transaction |
on_chain_id (optional) | string | The blockchain transaction id if the transaction succeeded |
error_message (optional) | string | The error message if the transaction failed |
user_op_receipt (optional) | string | JSON Object of the user operation receipt (if the operation went through on chain) |
Updated about 14 hours ago
What’s Next