parseTransfer static method
Returns a NftTransfer? from the parsed transaction tx
Implementation
static NftTransfer? parseTransfer(Transaction tx) {
try {
final body = tx.inMessage?.body.beginParse();
if (body == null) {
return null;
}
final op = body.loadUint(32);
if (op != 0x5fcc3d14) {
return null;
}
// Eligibility check
if ((tx.inMessage?.info is CmiInternal) == false) {
return null;
}
if ((tx.description is TdGeneric) == false) {
return null;
}
if (((tx.description as TdGeneric).computePhase is TcpVm) == false) {
return null;
}
if (((tx.description as TdGeneric).computePhase as TcpVm).exitCode != 0) {
return null;
}
// NftTransfer instance
var queryId = body.loadUint(64);
var from = (tx.inMessage!.info as CmiInternal).src;
var to = body.loadInternalAddress();
var responseTo = body.loadInternalAddressOrNull();
var customPayload = body.loadRef();
var forwardAmount = body.loadCoins();
var forwardPayload = body.loadRef();
return NftTransfer(
queryId: queryId,
from: from,
to: to,
responseTo: responseTo,
customPayload: customPayload,
forwardAmount: forwardAmount,
forwardPayload: forwardPayload,
);
} catch (e) {
return null;
}
}