Algorand

ALGO Transfers

AlgoTransfers stream represents all possible native cryptocurrency (ALGO) transfers with positive (> 0) value.
1
{
2
fee: integer,
3
firstRound: integer,
4
from: address'algo',
5
genesisID: string,
6
genesishashb64: string,
7
lastRound: integer,
8
noteb64: string,
9
round: integer,
10
blockTimestamp: integer,
11
blockHash: string,
12
tx: string,
13
type: string,
14
payment: {
15
amount: integer,
16
to: address'algo',
17
close: address'algo',
18
closeamount: integer,
19
closerewards: integer,
20
torewards: integer
21
}
22
}
Copied!

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.
1
stream _
2
from AlgoTransfers
3
where @payment.to == ALGO.address("ADDRESS")
4
|| @from == ALGO.address("ADDRESS")
5
​
6
process
7
emit {...}
8
end
Copied!
​
If you want to get a notification when there is a transaction of more than 1000 ALGO, use this code
1
stream _
2
from AlgoTransfers
3
where @payment.to == ALGO.address("ADDRESS")
4
|| @from == ALGO.address("ADDRESS")
5
​
6
process
7
8
let value = @payment.amount
9
let receiver = @payment.to
10
​
11
if @payment.amount == 1000000000 then
12
emit {value, @from, receiver}
13
end
14
15
end
Copied!

Algorand Asset Transfer

AlgoAssetTransfers stream represents all possible asset (ASA) transfers with positive (> 0) value.
1
{
2
fee: integer,
3
firstRound: integer,
4
from: address'algo',
5
genesisID: string,
6
genesishashb64: string,
7
lastRound: integer,
8
noteb64: string,
9
round: integer,
10
blockTimestamp: integer,
11
blockHash: string,
12
tx: string,
13
type: string,
14
payment: {
15
amt: integer,
16
id: integer,
17
rcv: address'algo',
18
snd: address'algo',
19
closeto: integer,
20
asset: {
21
assetname: string,
22
clawbackaddr: address'algo',
23
creator: address'algo',
24
defaultfrozen: boolean,
25
freezeaddr: address'algo',
26
managerkey: address'algo',
27
metadatahash: string,
28
reserveaddr: address'algo',
29
total: integer,
30
decimals: integer,
31
unitname: string,
32
url: string
33
}
34
}
35
}
Copied!

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
1
stream _
2
from AlgoAssetTransfers
3
where @curxfer.rcv == ALGO.address("ADDRESS")
4
|| @curxfer.snd == ALGO.address("ADDRESS")
5
​
6
process
7
​
8
let symbol = @curxfer.asset.unitname
9
let decimals = @curxfer.asset.decimals
10
let value = @curxfer.amt
11
let receiver = @curxfer.rcv
12
let sender = @curxfer.snd
13
14
emit {value, decimals, symbol, sender, receiver}
15
end
Copied!
​
If you want to receive notifications when there is a deposit of TEST asset, this code will do the trick
1
stream _
2
from AlgoAssetTransfers
3
where @curxfer.rcv == ALGO.address("ADDRESS")
4
​
5
process
6
​
7
let symbol = @curxfer.asset.unitname
8
let decimals = @curxfer.asset.decimals
9
let value = @curxfer.amt
10
let receiver = @curxfer.rcv
11
let sender = @curxfer.snd
12
13
if symbol == "TEST" then
14
emit {value, decimals, symbol, sender, receiver}
15
end
16
17
end
Copied!
Last modified 7d ago