Get coinbase transaction
$coinbase get transfer hash is a function used to retrieve the transaction hash once a transaction is posted on Coinbase.
This function will need a transfer id as an argument, which can be obtained from the transaction info object returned by the coinbase send tokens command.
Parameters
Transfer ID: The transfer ID that is provided by Coinbase when a transaction is made. This ID is used to track the status of the transaction.
Return Value
This function returns a string - the hash of the transfer once the transaction is posted to the blockchain.
Example
config coinbase("your api key", "your api secret", "your passphrase") coinbase send tokens("0.001", "BTC", "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa","#btcTransactionInfo") log("Transaction Info: {#btcTransactionInfo}") set(#transferId,JSON Extract(#btcTransactionInfo,"id"),"Global") #wait for the transaction to post wait(300) log("Transaction Hash: {$coinbase get transfer hash(#transferId)}")
In this script, replace "your api key", "your api secret", and "your passphrase" with your actual API key, API secret, and passphrase.
The script will send 0.001 of Bitcoin (BTC) to the address "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa". The transaction information will be stored in a variable named "#btcTransactionInfo". We then extract the transaction ID and store it in the variable "#transferId" using the JSON Extract command. We wait for 5 minutes (300 seconds) to ensure the transaction posts, and then fetch the transaction hash.
Please remember that your API key, API secret, passphrase, and addresses are sensitive information. If you need to show someone your script, ensure to remove these details first.
After running the command, you will see the transaction hash in the console. The exact hash will be different for each transaction.