mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-16 02:25:47 +00:00
Merge pull request #432 from darkdarkdragon/develop-RLJS-370-3
testing - add memo field into payment transaction so parsePaymentMemo…
This commit is contained in:
@@ -17,7 +17,13 @@ function parsePaymentMemos(tx) {
|
|||||||
if (!Array.isArray(tx.Memos) || tx.Memos.length === 0) {
|
if (!Array.isArray(tx.Memos) || tx.Memos.length === 0) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
return tx.Memos.map((m) => m.Memo);
|
return tx.Memos.map((m) => {
|
||||||
|
return utils.removeUndefined({
|
||||||
|
type: m.Memo.parsed_memo_type,
|
||||||
|
format: m.Memo.parsed_memo_format,
|
||||||
|
data: m.Memo.parsed_memo_data
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function parsePayment(tx: Object): Object {
|
function parsePayment(tx: Object): Object {
|
||||||
|
|||||||
@@ -3,8 +3,14 @@
|
|||||||
"type": "payment",
|
"type": "payment",
|
||||||
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||||
"sequence": 4,
|
"sequence": 4,
|
||||||
"id": "4C37C92576DEB000D13B07F4D3F99F968BD86B6B83A840BEFFB2BFC8A042A81B",
|
"id": "99404A34E8170319521223A6C604AF48B9F1E3000C377E6141F9A1BF60B0B865",
|
||||||
"specification": {
|
"specification": {
|
||||||
|
"memos": [
|
||||||
|
{
|
||||||
|
"type": "client",
|
||||||
|
"format": "rt1.5.2"
|
||||||
|
}
|
||||||
|
],
|
||||||
"source": {
|
"source": {
|
||||||
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||||
"amount": {
|
"amount": {
|
||||||
@@ -87,9 +93,15 @@
|
|||||||
{
|
{
|
||||||
"type": "payment",
|
"type": "payment",
|
||||||
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||||
"id": "4C37C92576DEB000D13B07F4D3F99F968BD86B6B83A840BEFFB2BFC8A042A81B",
|
"id": "99404A34E8170319521223A6C604AF48B9F1E3000C377E6141F9A1BF60B0B865",
|
||||||
"sequence": 4,
|
"sequence": 4,
|
||||||
"specification": {
|
"specification": {
|
||||||
|
"memos": [
|
||||||
|
{
|
||||||
|
"type": "client",
|
||||||
|
"format": "rt1.5.2"
|
||||||
|
}
|
||||||
|
],
|
||||||
"source": {
|
"source": {
|
||||||
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||||
"amount": {
|
"amount": {
|
||||||
|
|||||||
@@ -134,7 +134,15 @@ module.exports = function(port) {
|
|||||||
|
|
||||||
mock.on('request_account_tx', function(request, conn) {
|
mock.on('request_account_tx', function(request, conn) {
|
||||||
if (request.account === addresses.ACCOUNT) {
|
if (request.account === addresses.ACCOUNT) {
|
||||||
conn.send(fixtures.misc.accountTransactionsResponse(request));
|
const options = {
|
||||||
|
memos: [{
|
||||||
|
Memo: {
|
||||||
|
MemoFormat: '7274312E352E32',
|
||||||
|
MemoType: '636C69656E74'
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
conn.send(fixtures.misc.accountTransactionsResponse(request, options));
|
||||||
} else {
|
} else {
|
||||||
assert(false, 'Unrecognized account address: ' + request.account);
|
assert(false, 'Unrecognized account address: ' + request.account);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user