Search…
Algorand

ALGO Transfers

AlgoTransfers stream represents all possible native cryptocurrency (ALGO) transfers with positive (> 0) value.
{
fee: integer,
firstRound: integer,
from: address'algo',
genesisID: string,
genesishashb64: string,
lastRound: integer,
noteb64: string,
round: integer,
blockTimestamp: integer,
blockHash: string,
tx: string,
type: string,
payment: {
amount: integer,
to: address'algo',
close: address'algo',
closeamount: integer,
closerewards: integer,
torewards: integer
}
}

Code Samples

This simple code will help you monitor every ALGO transfer on one address (deposits and withdrawals). It will emit everything about the transfer.
stream _
from AlgoTransfers
where @payment.to == ALGO.address("ADDRESS")
|| @from == ALGO.address("ADDRESS")
process
emit {...}
end
If you want to get a notification when there is a transaction of more than 1000 ALGO, use this code
stream _
from AlgoTransfers
where @payment.to == ALGO.address("ADDRESS")
|| @from == ALGO.address("ADDRESS")
process
let value = @payment.amount
let receiver = @payment.to
if @payment.amount == 1000000000 then
emit {value, @from, receiver}
end
end

Algorand Asset Transfer

AlgoAssetTransfers stream represents all possible asset (ASA) transfers with positive (> 0) value.
{
fee: integer,
firstRound: integer,
from: address'algo',
genesisID: string,
genesishashb64: string,
lastRound: integer,
noteb64: string,
round: integer,
blockTimestamp: integer,
blockHash: string,
tx: string,
type: string,
payment: {
amt: integer,
id: integer,
rcv: address'algo',
snd: address'algo',
closeto: integer,
asset: {
assetname: string,
clawbackaddr: address'algo',
creator: address'algo',
defaultfrozen: boolean,
freezeaddr: address'algo',
managerkey: address'algo',
metadatahash: string,
reserveaddr: address'algo',
total: integer,
decimals: integer,
unitname: string,
url: string
}
}
}

Code Samples

This code will monitor every non-native asset transfer on an address, the emitted data is the asset amount, its decimals, symbol, sender and receiver
stream _
from AlgoAssetTransfers
where @curxfer.rcv == ALGO.address("ADDRESS")
|| @curxfer.snd == ALGO.address("ADDRESS")
process
let symbol = @curxfer.asset.unitname
let decimals = @curxfer.asset.decimals
let value = @curxfer.amt
let receiver = @curxfer.rcv
let sender = @curxfer.snd
emit {value, decimals, symbol, sender, receiver}
end
If you want to receive notifications when there is a deposit of TEST asset, this code will do the trick
stream _
from AlgoAssetTransfers
where @curxfer.rcv == ALGO.address("ADDRESS")
process
let symbol = @curxfer.asset.unitname
let decimals = @curxfer.asset.decimals
let value = @curxfer.amt
let receiver = @curxfer.rcv
let sender = @curxfer.snd
if symbol == "TEST" then
emit {value, decimals, symbol, sender, receiver}
end
end
Last modified 8mo ago