Skip to content

Commit

Permalink
Add memo handling to zcash/piratechain processTransaction
Browse files Browse the repository at this point in the history
  • Loading branch information
peachbits committed Sep 12, 2023
1 parent 5bf4685 commit c44756c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/piratechain/PiratechainEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
EdgeCurrencyEngine,
EdgeCurrencyEngineOptions,
EdgeEnginePrivateKeyOptions,
EdgeMemo,
EdgeSpendInfo,
EdgeTransaction,
EdgeWalletInfo,
Expand Down Expand Up @@ -255,14 +256,22 @@ export class PiratechainEngine extends CurrencyEngine<
ourReceiveAddresses.push(this.walletInfo.keys.publicKey)
}

const memos: EdgeMemo[] = []
if (tx.memo != null) {
memos.push({
type: 'text',
value: tx.memo
})
}

const edgeTransaction: EdgeTransaction = {
txid: tx.rawTransactionId,
date: tx.blockTimeInSeconds,
currencyCode: this.currencyInfo.currencyCode,
blockHeight: tx.minedHeight,
nativeAmount: netNativeAmount,
isSend: netNativeAmount.startsWith('-'),
memos: [],
memos,
networkFee: this.networkInfo.defaultNetworkFee,
ourReceiveAddresses, // blank if you sent money otherwise array of addresses that are yours in this transaction
signedTx: '',
Expand Down
11 changes: 10 additions & 1 deletion src/zcash/ZcashEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
EdgeCurrencyEngineOptions,
EdgeEnginePrivateKeyOptions,
EdgeFreshAddress,
EdgeMemo,
EdgeSpendInfo,
EdgeTransaction,
EdgeWalletInfo,
Expand Down Expand Up @@ -260,12 +261,20 @@ export class ZcashEngine extends CurrencyEngine<
ourReceiveAddresses.push(this.walletInfo.keys.publicKey)
}

const memos: EdgeMemo[] = []
if (tx.memo != null) {
memos.push({
type: 'text',
value: tx.memo
})
}

const edgeTransaction: EdgeTransaction = {
blockHeight: tx.minedHeight,
currencyCode: this.currencyInfo.currencyCode,
date: tx.blockTimeInSeconds,
isSend: netNativeAmount.startsWith('-'),
memos: [],
memos,
nativeAmount: netNativeAmount,
networkFee: this.networkInfo.defaultNetworkFee,
otherParams: {},
Expand Down

0 comments on commit c44756c

Please sign in to comment.