Skip to content

Commit

Permalink
Return on-chain memos from algorand
Browse files Browse the repository at this point in the history
  • Loading branch information
swansontec committed Sep 12, 2023
1 parent a7d8561 commit d70e460
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions src/algorand/AlgorandEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
EdgeEngineActivationOptions,
EdgeEngineGetActivationAssetsOptions,
EdgeGetActivationAssetsResults,
EdgeMemo,
EdgeSpendInfo,
EdgeToken,
EdgeTransaction,
Expand Down Expand Up @@ -243,12 +244,13 @@ export class AlgorandEngine extends CurrencyEngine<

processAlgorandTransaction(tx: BaseTransaction): void {
const {
fee,
'confirmed-round': confirmedRound,
id,
'round-time': roundTime,
sender,
'tx-type': txType
'tx-type': txType,
fee,
id,
note,
sender
} = tx

let currencyCode: string
Expand Down Expand Up @@ -332,12 +334,30 @@ export class AlgorandEngine extends CurrencyEngine<
}
}

const memos: EdgeMemo[] = []
if (note != null) {
const data = base64.parse(note)
try {
memos.push({
memoName: 'note',
type: 'text',
value: utf8.stringify(data)
})
} catch (e) {
memos.push({
memoName: 'note',
type: 'hex',
value: base16.stringify(data).toLowerCase()
})
}
}

const edgeTransaction: EdgeTransaction = {
blockHeight: confirmedRound,
currencyCode,
date: roundTime,
isSend,
memos: [],
memos,
nativeAmount,
networkFee,
ourReceiveAddresses,
Expand Down

0 comments on commit d70e460

Please sign in to comment.