Fix #1353: add memos support for multiple transaction types in getTransactions (#1397)

* fix(#1353): adds memos support for the following transaction types in `getTransactions`:

- AccountDelete
- OfferCreate
- OfferCancel
- CheckCancel
- CheckCash
- CheckCreate
- DepositPreauth
- SetFee
- PaymentChannelFund
- PaymentChannelClaim
- PaymentChannelCreate
- TicketCreate
This commit is contained in:
elmurci
2021-04-08 11:46:54 +02:00
committed by GitHub
parent ef1f8752d9
commit 650d722609
58 changed files with 2451 additions and 17 deletions

View File

@@ -69,6 +69,13 @@ export default <TestSuite>{
assertResultMatch(response, RESPONSE_FIXTURES.order, 'getTransaction')
},
'order with memo': async (api, address) => {
const hash = hashes.WITH_MEMOS_OFFER_CREATE_TRANSACTION_HASH
closeLedger(api.connection)
const response = await api.getTransaction(hash)
assertResultMatch(response, RESPONSE_FIXTURES.orderWithMemo, 'getTransaction')
},
'sell order': async (api, address) => {
const hash =
'458101D51051230B1D56E9ACAFAA34451BF65FA000F95DF6F0FF5B3A62D83FC2'
@@ -100,6 +107,17 @@ export default <TestSuite>{
)
},
'order cancellation with memo': async (api, address) => {
const hash = hashes.WITH_MEMOS_ORDER_CANCELLATION_TRANSACTION_HASH
closeLedger(api.connection)
const response = await api.getTransaction(hash)
assertResultMatch(
response,
RESPONSE_FIXTURES.orderCancellationWithMemo,
'getTransaction'
)
},
'trustline set': async (api, address) => {
const hash =
'635A0769BD94710A1F6A76CDE65A3BC661B20B798807D1BBBDADCEA26420538D'
@@ -258,6 +276,12 @@ export default <TestSuite>{
assertResultMatch(response, RESPONSE_FIXTURES.checkCreate, 'getTransaction')
},
'CheckCreate with memo': async (api, address) => {
const hash = hashes.WITH_MEMOS_CHECK_CREATE_TRANSACTION_HASH
const response = await api.getTransaction(hash)
assertResultMatch(response, RESPONSE_FIXTURES.checkCreateWithMemo, 'getTransaction')
},
'CheckCancel': async (api, address) => {
const hash =
'B4105D1B2D83819647E4692B7C5843D674283F669524BD50C9614182E3A12CD4'
@@ -265,6 +289,12 @@ export default <TestSuite>{
assertResultMatch(response, RESPONSE_FIXTURES.checkCancel, 'getTransaction')
},
'CheckCancel with memo': async (api, address) => {
const hash = hashes.WITH_MEMOS_CHECK_CANCEL_TRANSACTION_HASH
const response = await api.getTransaction(hash)
assertResultMatch(response, RESPONSE_FIXTURES.checkCancelWithMemo, 'getTransaction')
},
'CheckCash': async (api, address) => {
const hash =
'8321208465F70BA52C28BCC4F646BAF3B012BA13B57576C0336F42D77E3E0749'
@@ -272,6 +302,12 @@ export default <TestSuite>{
assertResultMatch(response, RESPONSE_FIXTURES.checkCash, 'getTransaction')
},
'CheckCash with memo': async (api, address) => {
const hash = hashes.WITH_MEMOS_CHECK_CASH_TRANSACTION_HASH
const response = await api.getTransaction(hash)
assertResultMatch(response, RESPONSE_FIXTURES.checkCashWithMemo, 'getTransaction')
},
// Escrows
'EscrowCreation': async (api, address) => {
const hash =
@@ -332,6 +368,16 @@ export default <TestSuite>{
)
},
'PaymentChannelCreate with memo': async (api, address) => {
const hash = hashes.WITH_MEMOS_PAYMENT_CHANNEL_CREATE_TRANSACTION_HASH
const response = await api.getTransaction(hash)
assertResultMatch(
response,
RESPONSE_FIXTURES.paymentChannelCreateWithMemo,
'getTransaction'
)
},
'PaymentChannelFund': async (api, address) => {
const hash =
'CD053D8867007A6A4ACB7A432605FE476D088DCB515AFFC886CF2B4EB6D2AE8B'
@@ -343,6 +389,16 @@ export default <TestSuite>{
)
},
'PaymentChannelFund with memo': async (api, address) => {
const hash = hashes.WITH_MEMOS_PAYMENT_CHANNEL_FUND_TRANSACTION_HASH
const response = await api.getTransaction(hash)
assertResultMatch(
response,
RESPONSE_FIXTURES.paymentChannelFundWithMemo,
'getTransaction'
)
},
'PaymentChannelClaim': async (api, address) => {
const hash =
'81B9ECAE7195EB6E8034AEDF44D8415A7A803E14513FDBB34FA984AB37D59563'
@@ -354,6 +410,16 @@ export default <TestSuite>{
)
},
'PaymentChannelClaim with memo': async (api, address) => {
const hash = hashes.WITH_MEMOS_PAYMENT_CHANNEL_CLAIM_TRANSACTION_HASH
const response = await api.getTransaction(hash)
assertResultMatch(
response,
RESPONSE_FIXTURES.paymentChannelClaimWithMemo,
'getTransaction'
)
},
'AccountDelete': async (api, address) => {
const hash =
'EC2AB14028DC84DE525470AB4DAAA46358B50A8662C63804BFF38244731C0CB9'
@@ -365,6 +431,16 @@ export default <TestSuite>{
)
},
'AccountDelete with memo': async (api, address) => {
const hash = hashes.WITH_MEMOS_ACCOUNT_DELETE_TRANSACTION_HASH
const response = await api.getTransaction(hash)
assertResultMatch(
response,
RESPONSE_FIXTURES.accountDeleteWithMemo,
'getTransaction'
)
},
'no Meta': async (api, address) => {
const hash =
'AFB3ADF22F3C605E23FAEFAA185F3BD763C4692CAC490D9819D117CD33BFAA1B'
@@ -396,5 +472,37 @@ export default <TestSuite>{
'C6A40F56127436DCD830B1B35FF939FD05B5747D30D6542572B7A835239817AF'
const response = await api.getTransaction(hash)
assertResultMatch(response, RESPONSE_FIXTURES.feeUpdate)
},
'feeUpdate with memo': async (api, address) => {
const hash = hashes.WITH_MEMOS_FEE_UPDATE_TRANSACTION_HASH
const response = await api.getTransaction(hash)
assertResultMatch(response, RESPONSE_FIXTURES.feeUpdateWithMemo)
},
'order with one memo': async (api, address) => {
const hash =
'995570FE1E40F42DF56BFC80503BA9E3C1229619C61A1C279A76BC0805036D74'
const response = await api.getTransaction(hash)
assertResultMatch(response, RESPONSE_FIXTURES.withMemo)
},
'order with more than one memo': async (api, address) => {
const hash =
'995570FE1E40F42DF56BFC80503BA9E3C1229619C61A1C279A76BC0805036D73'
const response = await api.getTransaction(hash)
assertResultMatch(response, RESPONSE_FIXTURES.withMemos)
},
'ticketCreate with memo': async (api, address) => {
const hash = hashes.WITH_MEMOS_TICKET_CREATE_TRANSACTION_HASH
const response = await api.getTransaction(hash)
assertResultMatch(response, RESPONSE_FIXTURES.ticketCreateWithMemo)
},
'depositPreauth with memo': async (api, address) => {
const hash = hashes.WITH_MEMOS_DEPOSIT_PREAUTH_TRANSACTION_HASH
const response = await api.getTransaction(hash)
assertResultMatch(response, RESPONSE_FIXTURES.depositPreauthWithMemo)
}
}

View File

@@ -155,6 +155,7 @@ export default <TestSuite>{
const response = await api.getTransactions(addresses.OTHER_ACCOUNT)
assertResultMatch(response, RESPONSE_FIXTURES.one, 'getTransactions')
}
}
// This test relies on the binary (hex string) format, but computed fields like `date`