@ledgerhq/coin-stellar 6.26.0 → 6.26.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.oxlintrc.json +7 -0
- package/CHANGELOG.md +12 -0
- package/LICENSE +194 -0
- package/knip.json +12 -0
- package/lib/api/index.d.ts +5 -5
- package/lib/api/index.d.ts.map +1 -1
- package/lib/api/index.js +12 -10
- package/lib/api/index.js.map +1 -1
- package/lib/config.d.ts +1 -1
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +2 -0
- package/lib/config.js.map +1 -1
- package/lib/constants.d.ts.map +1 -1
- package/lib/constants.js +3 -1
- package/lib/constants.js.map +1 -1
- package/lib/logic/broadcast.d.ts.map +1 -1
- package/lib/logic/broadcast.js +2 -0
- package/lib/logic/broadcast.js.map +1 -1
- package/lib/logic/combine.d.ts +1 -1
- package/lib/logic/combine.d.ts.map +1 -1
- package/lib/logic/combine.js +2 -0
- package/lib/logic/combine.js.map +1 -1
- package/lib/logic/common.d.ts +1 -1
- package/lib/logic/common.d.ts.map +1 -1
- package/lib/logic/common.js +4 -2
- package/lib/logic/common.js.map +1 -1
- package/lib/logic/craftTransaction.d.ts +1 -1
- package/lib/logic/craftTransaction.d.ts.map +1 -1
- package/lib/logic/craftTransaction.js +10 -8
- package/lib/logic/craftTransaction.js.map +1 -1
- package/lib/logic/estimateFees.d.ts.map +1 -1
- package/lib/logic/estimateFees.js +2 -0
- package/lib/logic/estimateFees.js.map +1 -1
- package/lib/logic/getBalance.d.ts +1 -1
- package/lib/logic/getBalance.d.ts.map +1 -1
- package/lib/logic/getBalance.js +4 -2
- package/lib/logic/getBalance.js.map +1 -1
- package/lib/logic/getBlock.d.ts +1 -1
- package/lib/logic/getBlock.d.ts.map +1 -1
- package/lib/logic/getBlock.js +39 -34
- package/lib/logic/getBlock.js.map +1 -1
- package/lib/logic/getBlockInfo.d.ts +1 -1
- package/lib/logic/getBlockInfo.d.ts.map +1 -1
- package/lib/logic/getBlockInfo.js +2 -0
- package/lib/logic/getBlockInfo.js.map +1 -1
- package/lib/logic/index.d.ts +12 -12
- package/lib/logic/index.d.ts.map +1 -1
- package/lib/logic/index.js +2 -0
- package/lib/logic/index.js.map +1 -1
- package/lib/logic/lastBlock.d.ts +1 -1
- package/lib/logic/lastBlock.d.ts.map +1 -1
- package/lib/logic/lastBlock.js +2 -0
- package/lib/logic/lastBlock.js.map +1 -1
- package/lib/logic/listOperations.d.ts +1 -1
- package/lib/logic/listOperations.d.ts.map +1 -1
- package/lib/logic/listOperations.js +6 -4
- package/lib/logic/listOperations.js.map +1 -1
- package/lib/logic/sdkWrapper.d.ts +1 -1
- package/lib/logic/sdkWrapper.d.ts.map +1 -1
- package/lib/logic/sdkWrapper.js +2 -0
- package/lib/logic/sdkWrapper.js.map +1 -1
- package/lib/logic/utils.d.ts.map +1 -1
- package/lib/logic/utils.js +4 -2
- package/lib/logic/utils.js.map +1 -1
- package/lib/logic/validateAddress.d.ts +1 -1
- package/lib/logic/validateAddress.d.ts.map +1 -1
- package/lib/logic/validateAddress.js +2 -0
- package/lib/logic/validateAddress.js.map +1 -1
- package/lib/logic/validateIntent.d.ts +2 -2
- package/lib/logic/validateIntent.d.ts.map +1 -1
- package/lib/logic/validateIntent.js +21 -19
- package/lib/logic/validateIntent.js.map +1 -1
- package/lib/logic/validateMemo.d.ts +1 -1
- package/lib/logic/validateMemo.d.ts.map +1 -1
- package/lib/logic/validateMemo.js +7 -5
- package/lib/logic/validateMemo.js.map +1 -1
- package/lib/network/horizon.d.ts +6 -7
- package/lib/network/horizon.d.ts.map +1 -1
- package/lib/network/horizon.js +48 -95
- package/lib/network/horizon.js.map +1 -1
- package/lib/network/horizonErrorBody.d.ts +29 -0
- package/lib/network/horizonErrorBody.d.ts.map +1 -0
- package/lib/network/horizonErrorBody.js +139 -0
- package/lib/network/horizonErrorBody.js.map +1 -0
- package/lib/network/horizonLedgerErrors.d.ts.map +1 -1
- package/lib/network/horizonLedgerErrors.js +28 -4
- package/lib/network/horizonLedgerErrors.js.map +1 -1
- package/lib/network/index.d.ts +1 -1
- package/lib/network/index.d.ts.map +1 -1
- package/lib/network/index.js +2 -0
- package/lib/network/index.js.map +1 -1
- package/lib/network/serialization.d.ts +6 -4
- package/lib/network/serialization.d.ts.map +1 -1
- package/lib/network/serialization.js +95 -91
- package/lib/network/serialization.js.map +1 -1
- package/lib/polyfill.d.ts.map +1 -1
- package/lib/polyfill.js +6 -4
- package/lib/polyfill.js.map +1 -1
- package/lib/supportedFeatures.d.ts +1 -1
- package/lib/supportedFeatures.d.ts.map +1 -1
- package/lib/supportedFeatures.js +3 -1
- package/lib/supportedFeatures.js.map +1 -1
- package/lib/types/errors.d.ts.map +1 -1
- package/lib/types/errors.js +14 -12
- package/lib/types/errors.js.map +1 -1
- package/lib/types/index.d.ts +2 -2
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.js +2 -0
- package/lib/types/index.js.map +1 -1
- package/lib/types/model.d.ts +6 -6
- package/lib/types/model.d.ts.map +1 -1
- package/lib/types/model.js +7 -5
- package/lib/types/model.js.map +1 -1
- package/lib-es/api/index.d.ts +5 -5
- package/lib-es/api/index.d.ts.map +1 -1
- package/lib-es/api/index.js +20 -18
- package/lib-es/api/index.js.map +1 -1
- package/lib-es/config.d.ts +1 -1
- package/lib-es/config.d.ts.map +1 -1
- package/lib-es/config.js +3 -1
- package/lib-es/config.js.map +1 -1
- package/lib-es/constants.d.ts.map +1 -1
- package/lib-es/constants.js +3 -1
- package/lib-es/constants.js.map +1 -1
- package/lib-es/logic/broadcast.d.ts.map +1 -1
- package/lib-es/logic/broadcast.js +3 -1
- package/lib-es/logic/broadcast.js.map +1 -1
- package/lib-es/logic/combine.d.ts +1 -1
- package/lib-es/logic/combine.d.ts.map +1 -1
- package/lib-es/logic/combine.js +3 -1
- package/lib-es/logic/combine.js.map +1 -1
- package/lib-es/logic/common.d.ts +1 -1
- package/lib-es/logic/common.d.ts.map +1 -1
- package/lib-es/logic/common.js +5 -3
- package/lib-es/logic/common.js.map +1 -1
- package/lib-es/logic/craftTransaction.d.ts +1 -1
- package/lib-es/logic/craftTransaction.d.ts.map +1 -1
- package/lib-es/logic/craftTransaction.js +15 -13
- package/lib-es/logic/craftTransaction.js.map +1 -1
- package/lib-es/logic/estimateFees.d.ts.map +1 -1
- package/lib-es/logic/estimateFees.js +3 -1
- package/lib-es/logic/estimateFees.js.map +1 -1
- package/lib-es/logic/getBalance.d.ts +1 -1
- package/lib-es/logic/getBalance.d.ts.map +1 -1
- package/lib-es/logic/getBalance.js +5 -3
- package/lib-es/logic/getBalance.js.map +1 -1
- package/lib-es/logic/getBlock.d.ts +1 -1
- package/lib-es/logic/getBlock.d.ts.map +1 -1
- package/lib-es/logic/getBlock.js +42 -37
- package/lib-es/logic/getBlock.js.map +1 -1
- package/lib-es/logic/getBlockInfo.d.ts +1 -1
- package/lib-es/logic/getBlockInfo.d.ts.map +1 -1
- package/lib-es/logic/getBlockInfo.js +3 -1
- package/lib-es/logic/getBlockInfo.js.map +1 -1
- package/lib-es/logic/index.d.ts +12 -12
- package/lib-es/logic/index.d.ts.map +1 -1
- package/lib-es/logic/index.js +14 -12
- package/lib-es/logic/index.js.map +1 -1
- package/lib-es/logic/lastBlock.d.ts +1 -1
- package/lib-es/logic/lastBlock.d.ts.map +1 -1
- package/lib-es/logic/lastBlock.js +3 -1
- package/lib-es/logic/lastBlock.js.map +1 -1
- package/lib-es/logic/listOperations.d.ts +1 -1
- package/lib-es/logic/listOperations.d.ts.map +1 -1
- package/lib-es/logic/listOperations.js +7 -5
- package/lib-es/logic/listOperations.js.map +1 -1
- package/lib-es/logic/sdkWrapper.d.ts +1 -1
- package/lib-es/logic/sdkWrapper.d.ts.map +1 -1
- package/lib-es/logic/sdkWrapper.js +4 -2
- package/lib-es/logic/sdkWrapper.js.map +1 -1
- package/lib-es/logic/utils.d.ts.map +1 -1
- package/lib-es/logic/utils.js +6 -4
- package/lib-es/logic/utils.js.map +1 -1
- package/lib-es/logic/validateAddress.d.ts +1 -1
- package/lib-es/logic/validateAddress.d.ts.map +1 -1
- package/lib-es/logic/validateAddress.js +3 -1
- package/lib-es/logic/validateAddress.js.map +1 -1
- package/lib-es/logic/validateIntent.d.ts +2 -2
- package/lib-es/logic/validateIntent.d.ts.map +1 -1
- package/lib-es/logic/validateIntent.js +30 -28
- package/lib-es/logic/validateIntent.js.map +1 -1
- package/lib-es/logic/validateMemo.d.ts +1 -1
- package/lib-es/logic/validateMemo.d.ts.map +1 -1
- package/lib-es/logic/validateMemo.js +8 -6
- package/lib-es/logic/validateMemo.js.map +1 -1
- package/lib-es/network/horizon.d.ts +6 -7
- package/lib-es/network/horizon.d.ts.map +1 -1
- package/lib-es/network/horizon.js +57 -104
- package/lib-es/network/horizon.js.map +1 -1
- package/lib-es/network/horizonErrorBody.d.ts +29 -0
- package/lib-es/network/horizonErrorBody.d.ts.map +1 -0
- package/lib-es/network/horizonErrorBody.js +134 -0
- package/lib-es/network/horizonErrorBody.js.map +1 -0
- package/lib-es/network/horizonLedgerErrors.d.ts.map +1 -1
- package/lib-es/network/horizonLedgerErrors.js +30 -6
- package/lib-es/network/horizonLedgerErrors.js.map +1 -1
- package/lib-es/network/index.d.ts +1 -1
- package/lib-es/network/index.d.ts.map +1 -1
- package/lib-es/network/index.js +3 -1
- package/lib-es/network/index.js.map +1 -1
- package/lib-es/network/serialization.d.ts +6 -4
- package/lib-es/network/serialization.d.ts.map +1 -1
- package/lib-es/network/serialization.js +97 -95
- package/lib-es/network/serialization.js.map +1 -1
- package/lib-es/polyfill.d.ts.map +1 -1
- package/lib-es/polyfill.js +7 -5
- package/lib-es/polyfill.js.map +1 -1
- package/lib-es/supportedFeatures.d.ts +1 -1
- package/lib-es/supportedFeatures.d.ts.map +1 -1
- package/lib-es/supportedFeatures.js +3 -1
- package/lib-es/supportedFeatures.js.map +1 -1
- package/lib-es/types/errors.d.ts.map +1 -1
- package/lib-es/types/errors.js +15 -13
- package/lib-es/types/errors.js.map +1 -1
- package/lib-es/types/index.d.ts +2 -2
- package/lib-es/types/index.d.ts.map +1 -1
- package/lib-es/types/index.js +4 -2
- package/lib-es/types/index.js.map +1 -1
- package/lib-es/types/model.d.ts +6 -6
- package/lib-es/types/model.d.ts.map +1 -1
- package/lib-es/types/model.js +7 -5
- package/lib-es/types/model.js.map +1 -1
- package/package.json +13 -16
- package/src/api/index.integ.test.ts +168 -163
- package/src/api/index.test.ts +106 -103
- package/src/api/index.ts +49 -46
- package/src/api/index_error.test.ts +48 -25
- package/src/config.ts +15 -12
- package/src/constants.ts +4 -1
- package/src/globals.d.ts +7 -5
- package/src/logic/broadcast.integ.test.ts +22 -19
- package/src/logic/broadcast.ts +5 -2
- package/src/logic/combine.test.ts +18 -15
- package/src/logic/combine.ts +8 -5
- package/src/logic/common.ts +9 -6
- package/src/logic/craftTransaction.test.ts +76 -75
- package/src/logic/craftTransaction.ts +46 -43
- package/src/logic/estimateFees.ts +6 -3
- package/src/logic/getBalance.test.ts +31 -28
- package/src/logic/getBalance.ts +13 -10
- package/src/logic/getBlock.integ.test.ts +40 -39
- package/src/logic/getBlock.test.ts +462 -415
- package/src/logic/getBlock.ts +142 -127
- package/src/logic/getBlockInfo.test.ts +72 -69
- package/src/logic/getBlockInfo.ts +15 -12
- package/src/logic/index.ts +15 -12
- package/src/logic/lastBlock.ts +6 -3
- package/src/logic/listOperations.ts +14 -11
- package/src/logic/listOperations.unit.test.ts +212 -209
- package/src/logic/networkWrappers.test.ts +32 -29
- package/src/logic/sdkWrapper.ts +19 -16
- package/src/logic/utils.ts +13 -10
- package/src/logic/validateAddress.test.ts +21 -18
- package/src/logic/validateAddress.ts +7 -4
- package/src/logic/validateIntent.test.ts +62 -59
- package/src/logic/validateIntent.ts +87 -84
- package/src/logic/validateMemo.test.ts +50 -47
- package/src/logic/validateMemo.ts +16 -13
- package/src/network/broadcastTransaction.test.ts +83 -63
- package/src/network/fetchLedgerOperations.unit.test.ts +155 -0
- package/src/network/horizon.integ.test.ts +45 -42
- package/src/network/horizon.test.ts +17 -14
- package/src/network/horizon.ts +244 -314
- package/src/network/horizon.unit.test.ts +238 -237
- package/src/network/horizonErrorBody.test.ts +133 -0
- package/src/network/horizonErrorBody.ts +178 -0
- package/src/network/horizonLedgerErrors.test.ts +150 -78
- package/src/network/horizonLedgerErrors.ts +47 -20
- package/src/network/index.ts +4 -1
- package/src/network/registerHorizonInterceptors.test.ts +163 -160
- package/src/network/serialization.ts +232 -227
- package/src/network/serialization.unit.test.ts +801 -798
- package/src/polyfill.ts +18 -15
- package/src/supportedFeatures.ts +6 -3
- package/src/types/errors.ts +33 -32
- package/src/types/index.ts +5 -2
- package/src/types/model.ts +55 -52
- package/tsconfig.json +1 -1
- package/.unimportedrc.json +0 -17
- package/LICENSE.txt +0 -21
- package/src/network/fetchLedgerOperations.nock.unit.test.ts +0 -156
|
@@ -1,653 +1,700 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import type { RawOperation } from
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { RawOperation } from '../types'
|
|
5
|
+
import type { Horizon } from '@stellar/stellar-sdk'
|
|
6
|
+
import BigNumber from 'bignumber.js'
|
|
7
|
+
import * as network from '../network'
|
|
8
|
+
import { parseAPIValue } from './common'
|
|
9
|
+
import { getBlock } from './getBlock'
|
|
10
|
+
|
|
11
|
+
jest.mock('../network', () => ({
|
|
12
|
+
...jest.requireActual<typeof import('../network')>('../network'),
|
|
10
13
|
fetchLedgerRecord: jest.fn(),
|
|
11
14
|
fetchAllLedgerOperations: jest.fn(),
|
|
12
|
-
}))
|
|
15
|
+
}))
|
|
13
16
|
|
|
14
17
|
const fetchLedgerRecordMock = network.fetchLedgerRecord as jest.MockedFunction<
|
|
15
18
|
typeof network.fetchLedgerRecord
|
|
16
|
-
|
|
19
|
+
>
|
|
17
20
|
const fetchAllLedgerOperationsMock = network.fetchAllLedgerOperations as jest.MockedFunction<
|
|
18
21
|
typeof network.fetchAllLedgerOperations
|
|
19
|
-
|
|
22
|
+
>
|
|
20
23
|
|
|
21
24
|
function txRecord(
|
|
22
|
-
overrides: Partial<Horizon.ServerApi.TransactionRecord> = {}
|
|
25
|
+
overrides: Partial<Horizon.ServerApi.TransactionRecord> = {}
|
|
23
26
|
): Horizon.ServerApi.TransactionRecord {
|
|
24
27
|
return {
|
|
25
|
-
fee_charged:
|
|
26
|
-
source_account:
|
|
28
|
+
fee_charged: '100',
|
|
29
|
+
source_account: 'GSOURCEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
27
30
|
fee_account: undefined,
|
|
28
31
|
ledger_attr: 42,
|
|
29
|
-
memo_type:
|
|
32
|
+
memo_type: 'none',
|
|
30
33
|
...overrides,
|
|
31
|
-
} as Horizon.ServerApi.TransactionRecord
|
|
34
|
+
} as Horizon.ServerApi.TransactionRecord
|
|
32
35
|
}
|
|
33
36
|
|
|
34
37
|
function rawOp(
|
|
35
38
|
base: Record<string, unknown> & {
|
|
36
|
-
type: string
|
|
37
|
-
transaction_hash: string
|
|
38
|
-
transactionRecord?: Horizon.ServerApi.TransactionRecord
|
|
39
|
-
}
|
|
39
|
+
type: string
|
|
40
|
+
transaction_hash: string
|
|
41
|
+
transactionRecord?: Horizon.ServerApi.TransactionRecord
|
|
42
|
+
}
|
|
40
43
|
): RawOperation {
|
|
41
|
-
const tr = base.transactionRecord ?? txRecord()
|
|
42
|
-
const { transactionRecord: _t, ...rest } = base
|
|
44
|
+
const tr = base.transactionRecord ?? txRecord()
|
|
45
|
+
const { transactionRecord: _t, ...rest } = base
|
|
43
46
|
return {
|
|
44
|
-
id:
|
|
45
|
-
paging_token:
|
|
46
|
-
source_account:
|
|
47
|
+
id: '1',
|
|
48
|
+
paging_token: 'pt',
|
|
49
|
+
source_account: 'GSOURCEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
47
50
|
transaction_successful: true,
|
|
48
|
-
created_at:
|
|
51
|
+
created_at: '2020-01-01T00:00:00Z',
|
|
49
52
|
...rest,
|
|
50
53
|
transaction: () => Promise.resolve(tr),
|
|
51
|
-
} as RawOperation
|
|
54
|
+
} as RawOperation
|
|
52
55
|
}
|
|
53
56
|
|
|
54
|
-
describe(
|
|
57
|
+
describe('getBlock', () => {
|
|
55
58
|
beforeEach(() => {
|
|
56
|
-
jest.clearAllMocks()
|
|
59
|
+
jest.clearAllMocks()
|
|
57
60
|
fetchLedgerRecordMock.mockImplementation(
|
|
58
61
|
async (seq: number) =>
|
|
59
62
|
({
|
|
60
63
|
sequence: seq,
|
|
61
64
|
hash: `LEDGER-HASH-${seq}`,
|
|
62
|
-
closed_at:
|
|
65
|
+
closed_at: '2018-09-15T15:40:05Z',
|
|
63
66
|
...(seq > 1 && { prev_hash: `LEDGER-HASH-${seq - 1}` }),
|
|
64
|
-
}) as Awaited<ReturnType<typeof network.fetchLedgerRecord
|
|
65
|
-
)
|
|
66
|
-
})
|
|
67
|
+
}) as Awaited<ReturnType<typeof network.fetchLedgerRecord>>
|
|
68
|
+
)
|
|
69
|
+
})
|
|
67
70
|
|
|
68
|
-
describe(
|
|
69
|
-
it(
|
|
71
|
+
describe('height validation', () => {
|
|
72
|
+
it('rejects height 0', async () => {
|
|
70
73
|
await expect(getBlock(0)).rejects.toThrow(
|
|
71
|
-
|
|
72
|
-
)
|
|
73
|
-
})
|
|
74
|
+
'getBlock: height must be a positive integer, got 0'
|
|
75
|
+
)
|
|
76
|
+
})
|
|
74
77
|
|
|
75
|
-
it(
|
|
78
|
+
it('rejects negative height', async () => {
|
|
76
79
|
await expect(getBlock(-1)).rejects.toThrow(
|
|
77
|
-
|
|
78
|
-
)
|
|
79
|
-
})
|
|
80
|
+
'getBlock: height must be a positive integer, got -1'
|
|
81
|
+
)
|
|
82
|
+
})
|
|
80
83
|
|
|
81
|
-
it(
|
|
84
|
+
it('rejects non-integer height', async () => {
|
|
82
85
|
await expect(getBlock(2.5)).rejects.toThrow(
|
|
83
|
-
|
|
84
|
-
)
|
|
85
|
-
})
|
|
86
|
+
'getBlock: height must be a positive integer, got 2.5'
|
|
87
|
+
)
|
|
88
|
+
})
|
|
86
89
|
|
|
87
|
-
it(
|
|
90
|
+
it('rejects NaN', async () => {
|
|
88
91
|
await expect(getBlock(Number.NaN)).rejects.toThrow(
|
|
89
|
-
|
|
90
|
-
)
|
|
91
|
-
})
|
|
92
|
+
'getBlock: height must be a positive integer, got NaN'
|
|
93
|
+
)
|
|
94
|
+
})
|
|
92
95
|
|
|
93
|
-
it(
|
|
96
|
+
it('rejects Infinity', async () => {
|
|
94
97
|
await expect(getBlock(Number.POSITIVE_INFINITY)).rejects.toThrow(
|
|
95
|
-
|
|
96
|
-
)
|
|
97
|
-
})
|
|
98
|
-
})
|
|
98
|
+
'getBlock: height must be a positive integer, got Infinity'
|
|
99
|
+
)
|
|
100
|
+
})
|
|
101
|
+
})
|
|
99
102
|
|
|
100
|
-
it(
|
|
103
|
+
it('maps a native payment with two transfer operations', async () => {
|
|
101
104
|
fetchAllLedgerOperationsMock.mockResolvedValue([
|
|
102
105
|
rawOp({
|
|
103
|
-
type:
|
|
104
|
-
transaction_hash:
|
|
105
|
-
from:
|
|
106
|
-
to:
|
|
107
|
-
amount:
|
|
108
|
-
asset_type:
|
|
109
|
-
transactionRecord: txRecord({ fee_charged:
|
|
106
|
+
type: 'payment',
|
|
107
|
+
transaction_hash: 'txpay1',
|
|
108
|
+
from: 'GFROMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
109
|
+
to: 'GTOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
110
|
+
amount: '1.0000000',
|
|
111
|
+
asset_type: 'native',
|
|
112
|
+
transactionRecord: txRecord({ fee_charged: '200' }),
|
|
110
113
|
}),
|
|
111
|
-
])
|
|
114
|
+
])
|
|
112
115
|
|
|
113
|
-
const block = await getBlock(20000000)
|
|
116
|
+
const block = await getBlock(20000000)
|
|
114
117
|
|
|
115
|
-
expect(block.info.height).toBe(20000000)
|
|
116
|
-
expect(block.info.hash).toBe(
|
|
118
|
+
expect(block.info.height).toBe(20000000)
|
|
119
|
+
expect(block.info.hash).toBe('LEDGER-HASH-20000000')
|
|
117
120
|
expect(block.info.parent).toEqual({
|
|
118
121
|
height: 19999999,
|
|
119
|
-
hash:
|
|
120
|
-
})
|
|
121
|
-
|
|
122
|
-
expect(block.transactions).toHaveLength(1)
|
|
123
|
-
const tx0 = block.transactions[0]
|
|
124
|
-
expect(tx0.hash).toBe(
|
|
125
|
-
expect(tx0.failed).toBe(false)
|
|
126
|
-
expect(tx0.fees).toBe(200n)
|
|
127
|
-
expect(tx0.feesPayer).toBe(
|
|
122
|
+
hash: 'LEDGER-HASH-19999999',
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
expect(block.transactions).toHaveLength(1)
|
|
126
|
+
const tx0 = block.transactions[0]
|
|
127
|
+
expect(tx0.hash).toBe('txpay1')
|
|
128
|
+
expect(tx0.failed).toBe(false)
|
|
129
|
+
expect(tx0.fees).toBe(200n)
|
|
130
|
+
expect(tx0.feesPayer).toBe('GSOURCEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA')
|
|
128
131
|
expect(tx0.operations).toEqual(
|
|
129
132
|
expect.arrayContaining([
|
|
130
133
|
expect.objectContaining({
|
|
131
|
-
type:
|
|
132
|
-
address:
|
|
134
|
+
type: 'transfer',
|
|
135
|
+
address: 'GFROMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
133
136
|
amount: -10000000n,
|
|
134
137
|
}),
|
|
135
138
|
expect.objectContaining({
|
|
136
|
-
type:
|
|
137
|
-
address:
|
|
139
|
+
type: 'transfer',
|
|
140
|
+
address: 'GTOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
138
141
|
amount: 10000000n,
|
|
139
142
|
}),
|
|
140
|
-
])
|
|
141
|
-
)
|
|
142
|
-
})
|
|
143
|
+
])
|
|
144
|
+
)
|
|
145
|
+
})
|
|
143
146
|
|
|
144
|
-
it(
|
|
147
|
+
it('uses fee_account as feesPayer when present (fee bump)', async () => {
|
|
145
148
|
fetchAllLedgerOperationsMock.mockResolvedValue([
|
|
146
149
|
rawOp({
|
|
147
|
-
type:
|
|
148
|
-
transaction_hash:
|
|
149
|
-
from:
|
|
150
|
-
to:
|
|
151
|
-
amount:
|
|
152
|
-
asset_type:
|
|
150
|
+
type: 'payment',
|
|
151
|
+
transaction_hash: 'txfeebump',
|
|
152
|
+
from: 'GFROMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
153
|
+
to: 'GTOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
154
|
+
amount: '2.0000000',
|
|
155
|
+
asset_type: 'native',
|
|
153
156
|
transactionRecord: txRecord({
|
|
154
|
-
fee_charged:
|
|
155
|
-
source_account:
|
|
156
|
-
fee_account:
|
|
157
|
+
fee_charged: '500',
|
|
158
|
+
source_account: 'GINNERAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
159
|
+
fee_account: 'GFEEPAYERAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
157
160
|
}),
|
|
158
161
|
}),
|
|
159
|
-
])
|
|
162
|
+
])
|
|
160
163
|
|
|
161
|
-
const block = await getBlock(10)
|
|
162
|
-
expect(block.transactions[0].feesPayer).toBe(
|
|
163
|
-
|
|
164
|
-
);
|
|
165
|
-
});
|
|
164
|
+
const block = await getBlock(10)
|
|
165
|
+
expect(block.transactions[0].feesPayer).toBe('GFEEPAYERAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA')
|
|
166
|
+
})
|
|
166
167
|
|
|
167
|
-
it(
|
|
168
|
+
it('marks failed transactions with empty operations but keeps fees', async () => {
|
|
168
169
|
fetchAllLedgerOperationsMock.mockResolvedValue([
|
|
169
170
|
rawOp({
|
|
170
|
-
type:
|
|
171
|
-
transaction_hash:
|
|
172
|
-
from:
|
|
173
|
-
to:
|
|
174
|
-
amount:
|
|
175
|
-
asset_type:
|
|
171
|
+
type: 'payment',
|
|
172
|
+
transaction_hash: 'txfail',
|
|
173
|
+
from: 'GFROMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
174
|
+
to: 'GTOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
175
|
+
amount: '1.0000000',
|
|
176
|
+
asset_type: 'native',
|
|
176
177
|
transaction_successful: false,
|
|
177
|
-
transactionRecord: txRecord({ fee_charged:
|
|
178
|
+
transactionRecord: txRecord({ fee_charged: '400' }),
|
|
178
179
|
}),
|
|
179
|
-
])
|
|
180
|
+
])
|
|
180
181
|
|
|
181
|
-
const block = await getBlock(10)
|
|
182
|
+
const block = await getBlock(10)
|
|
182
183
|
expect(block.transactions[0]).toMatchObject({
|
|
183
|
-
hash:
|
|
184
|
+
hash: 'txfail',
|
|
184
185
|
failed: true,
|
|
185
186
|
fees: 400n,
|
|
186
187
|
operations: [],
|
|
187
|
-
})
|
|
188
|
-
})
|
|
188
|
+
})
|
|
189
|
+
})
|
|
189
190
|
|
|
190
|
-
it(
|
|
191
|
-
const sharedTx = txRecord({ fee_charged:
|
|
191
|
+
it('groups multiple allowlisted operations under the same transaction hash', async () => {
|
|
192
|
+
const sharedTx = txRecord({ fee_charged: '300' })
|
|
192
193
|
fetchAllLedgerOperationsMock.mockResolvedValue([
|
|
193
194
|
rawOp({
|
|
194
|
-
id:
|
|
195
|
-
type:
|
|
196
|
-
transaction_hash:
|
|
197
|
-
from:
|
|
198
|
-
to:
|
|
199
|
-
amount:
|
|
200
|
-
asset_type:
|
|
195
|
+
id: '1',
|
|
196
|
+
type: 'payment',
|
|
197
|
+
transaction_hash: 'txmulti',
|
|
198
|
+
from: 'GA',
|
|
199
|
+
to: 'GB',
|
|
200
|
+
amount: '1.0000000',
|
|
201
|
+
asset_type: 'native',
|
|
201
202
|
transactionRecord: sharedTx,
|
|
202
203
|
}),
|
|
203
204
|
rawOp({
|
|
204
|
-
id:
|
|
205
|
-
type:
|
|
206
|
-
transaction_hash:
|
|
207
|
-
from:
|
|
208
|
-
to:
|
|
209
|
-
amount:
|
|
210
|
-
asset_type:
|
|
205
|
+
id: '2',
|
|
206
|
+
type: 'payment',
|
|
207
|
+
transaction_hash: 'txmulti',
|
|
208
|
+
from: 'GB',
|
|
209
|
+
to: 'GC',
|
|
210
|
+
amount: '0.5000000',
|
|
211
|
+
asset_type: 'native',
|
|
211
212
|
transactionRecord: sharedTx,
|
|
212
213
|
}),
|
|
213
|
-
])
|
|
214
|
+
])
|
|
214
215
|
|
|
215
|
-
const block = await getBlock(10)
|
|
216
|
-
expect(block.transactions).toHaveLength(1)
|
|
217
|
-
expect(block.transactions[0].operations.length).toBeGreaterThanOrEqual(2)
|
|
218
|
-
})
|
|
216
|
+
const block = await getBlock(10)
|
|
217
|
+
expect(block.transactions).toHaveLength(1)
|
|
218
|
+
expect(block.transactions[0].operations.length).toBeGreaterThanOrEqual(2)
|
|
219
|
+
})
|
|
219
220
|
|
|
220
|
-
it(
|
|
221
|
+
it('maps token payments using assetReference and assetOwner', async () => {
|
|
221
222
|
fetchAllLedgerOperationsMock.mockResolvedValue([
|
|
222
223
|
rawOp({
|
|
223
|
-
type:
|
|
224
|
-
transaction_hash:
|
|
225
|
-
from:
|
|
226
|
-
to:
|
|
227
|
-
amount:
|
|
228
|
-
asset_type:
|
|
229
|
-
asset_code:
|
|
230
|
-
asset_issuer:
|
|
224
|
+
type: 'payment',
|
|
225
|
+
transaction_hash: 'txtok',
|
|
226
|
+
from: 'GFROMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
227
|
+
to: 'GTOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
228
|
+
amount: '10.0000000',
|
|
229
|
+
asset_type: 'credit_alphanum4',
|
|
230
|
+
asset_code: 'USD',
|
|
231
|
+
asset_issuer: 'GISSUERAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
231
232
|
transactionRecord: txRecord(),
|
|
232
233
|
}),
|
|
233
|
-
])
|
|
234
|
+
])
|
|
234
235
|
|
|
235
|
-
const block = await getBlock(10)
|
|
236
|
-
const transfers = block.transactions[0].operations.filter(o => o.type ===
|
|
236
|
+
const block = await getBlock(10)
|
|
237
|
+
const transfers = block.transactions[0].operations.filter((o) => o.type === 'transfer')
|
|
237
238
|
expect(transfers[0]).toMatchObject({
|
|
238
239
|
asset: {
|
|
239
|
-
type:
|
|
240
|
-
assetReference:
|
|
241
|
-
assetOwner:
|
|
240
|
+
type: 'token',
|
|
241
|
+
assetReference: 'USD',
|
|
242
|
+
assetOwner: 'GISSUERAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
242
243
|
},
|
|
243
|
-
})
|
|
244
|
-
})
|
|
244
|
+
})
|
|
245
|
+
})
|
|
245
246
|
|
|
246
|
-
it(
|
|
247
|
+
it('maps create_account to two native transfers', async () => {
|
|
247
248
|
fetchAllLedgerOperationsMock.mockResolvedValue([
|
|
248
249
|
rawOp({
|
|
249
|
-
type:
|
|
250
|
-
transaction_hash:
|
|
251
|
-
funder:
|
|
252
|
-
account:
|
|
253
|
-
starting_balance:
|
|
254
|
-
transactionRecord: txRecord({ fee_charged:
|
|
250
|
+
type: 'create_account',
|
|
251
|
+
transaction_hash: 'txcreate',
|
|
252
|
+
funder: 'GFUNDERAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
253
|
+
account: 'GNEWACCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
254
|
+
starting_balance: '2.0000000',
|
|
255
|
+
transactionRecord: txRecord({ fee_charged: '100' }),
|
|
255
256
|
}),
|
|
256
|
-
])
|
|
257
|
+
])
|
|
257
258
|
|
|
258
|
-
const block = await getBlock(10)
|
|
259
|
+
const block = await getBlock(10)
|
|
259
260
|
expect(block.transactions[0].operations).toEqual(
|
|
260
261
|
expect.arrayContaining([
|
|
261
262
|
expect.objectContaining({
|
|
262
|
-
type:
|
|
263
|
-
address:
|
|
263
|
+
type: 'transfer',
|
|
264
|
+
address: 'GFUNDERAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
264
265
|
amount: -20000000n,
|
|
265
266
|
}),
|
|
266
267
|
expect.objectContaining({
|
|
267
|
-
type:
|
|
268
|
-
address:
|
|
268
|
+
type: 'transfer',
|
|
269
|
+
address: 'GNEWACCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
269
270
|
amount: 20000000n,
|
|
270
271
|
}),
|
|
271
|
-
])
|
|
272
|
-
)
|
|
273
|
-
})
|
|
272
|
+
])
|
|
273
|
+
)
|
|
274
|
+
})
|
|
274
275
|
|
|
275
|
-
it(
|
|
276
|
+
it('maps change_trust to other operations', async () => {
|
|
276
277
|
fetchAllLedgerOperationsMock.mockResolvedValue([
|
|
277
278
|
rawOp({
|
|
278
|
-
type:
|
|
279
|
-
transaction_hash:
|
|
280
|
-
trustor:
|
|
281
|
-
asset_code:
|
|
282
|
-
asset_issuer:
|
|
283
|
-
limit:
|
|
284
|
-
transactionRecord: txRecord(),
|
|
279
|
+
type: 'change_trust',
|
|
280
|
+
transaction_hash: 'txtrust',
|
|
281
|
+
trustor: 'GTRUSTORAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
282
|
+
asset_code: 'ABC',
|
|
283
|
+
asset_issuer: 'GISSUERAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
284
|
+
limit: '1000.0000000',
|
|
285
|
+
transactionRecord: txRecord({ source_account_sequence: '12345' }),
|
|
285
286
|
}),
|
|
286
|
-
])
|
|
287
|
+
])
|
|
287
288
|
|
|
288
|
-
const block = await getBlock(10)
|
|
289
|
+
const block = await getBlock(10)
|
|
289
290
|
expect(block.transactions[0].operations[0]).toMatchObject({
|
|
290
|
-
type:
|
|
291
|
-
ledgerOpType:
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
291
|
+
type: 'other',
|
|
292
|
+
ledgerOpType: 'OPT_IN',
|
|
293
|
+
assetAmount: '100',
|
|
294
|
+
memo: { type: 'NO_MEMO' },
|
|
295
|
+
sequence: '12345',
|
|
296
|
+
})
|
|
297
|
+
})
|
|
298
|
+
|
|
299
|
+
it('decodes MEMO_HASH from base64 to hex in change_trust details', async () => {
|
|
300
|
+
const base64Hash = Buffer.from('abcdef1234567890', 'hex').toString('base64')
|
|
301
|
+
fetchAllLedgerOperationsMock.mockResolvedValue([
|
|
302
|
+
rawOp({
|
|
303
|
+
type: 'change_trust',
|
|
304
|
+
transaction_hash: 'txhash',
|
|
305
|
+
asset_code: 'USD',
|
|
306
|
+
asset_issuer: 'GISSUERAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
307
|
+
limit: '500.0000000',
|
|
308
|
+
transactionRecord: txRecord({ memo_type: 'hash', memo: base64Hash }),
|
|
309
|
+
}),
|
|
310
|
+
])
|
|
295
311
|
|
|
296
|
-
|
|
312
|
+
const block = await getBlock(10)
|
|
313
|
+
expect(block.transactions[0].operations[0]).toMatchObject({
|
|
314
|
+
memo: { type: 'MEMO_HASH', value: 'abcdef1234567890' },
|
|
315
|
+
})
|
|
316
|
+
})
|
|
317
|
+
|
|
318
|
+
it('decodes MEMO_RETURN from base64 to hex in change_trust details', async () => {
|
|
319
|
+
const base64Hash = Buffer.from('deadbeef', 'hex').toString('base64')
|
|
297
320
|
fetchAllLedgerOperationsMock.mockResolvedValue([
|
|
298
321
|
rawOp({
|
|
299
|
-
type:
|
|
300
|
-
transaction_hash:
|
|
322
|
+
type: 'change_trust',
|
|
323
|
+
transaction_hash: 'txreturn',
|
|
324
|
+
asset_code: 'EUR',
|
|
325
|
+
asset_issuer: 'GISSUERAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
326
|
+
limit: '100.0000000',
|
|
327
|
+
transactionRecord: txRecord({ memo_type: 'return', memo: base64Hash }),
|
|
328
|
+
}),
|
|
329
|
+
])
|
|
330
|
+
|
|
331
|
+
const block = await getBlock(10)
|
|
332
|
+
expect(block.transactions[0].operations[0]).toMatchObject({
|
|
333
|
+
memo: { type: 'MEMO_RETURN', value: 'deadbeef' },
|
|
334
|
+
})
|
|
335
|
+
})
|
|
336
|
+
|
|
337
|
+
it('keeps successful transactions with only unsupported operation types for fee tracking', async () => {
|
|
338
|
+
fetchAllLedgerOperationsMock.mockResolvedValue([
|
|
339
|
+
rawOp({
|
|
340
|
+
type: 'manage_sell_offer',
|
|
341
|
+
transaction_hash: 'txoffer',
|
|
301
342
|
transactionRecord: txRecord(),
|
|
302
343
|
}),
|
|
303
|
-
])
|
|
344
|
+
])
|
|
304
345
|
|
|
305
|
-
const block = await getBlock(10)
|
|
306
|
-
expect(block.transactions).toHaveLength(
|
|
307
|
-
|
|
346
|
+
const block = await getBlock(10)
|
|
347
|
+
expect(block.transactions).toHaveLength(1)
|
|
348
|
+
expect(block.transactions[0].operations).toHaveLength(0)
|
|
349
|
+
expect(block.transactions[0].fees).toBe(100n)
|
|
350
|
+
})
|
|
308
351
|
|
|
309
|
-
it(
|
|
352
|
+
it('maps path_payment_strict_send with distinct source and destination assets', async () => {
|
|
310
353
|
fetchAllLedgerOperationsMock.mockResolvedValue([
|
|
311
354
|
rawOp({
|
|
312
|
-
type:
|
|
313
|
-
transaction_hash:
|
|
314
|
-
from:
|
|
315
|
-
to:
|
|
316
|
-
amount:
|
|
317
|
-
asset_type:
|
|
318
|
-
asset_code:
|
|
319
|
-
asset_issuer:
|
|
320
|
-
source_amount:
|
|
321
|
-
source_asset_type:
|
|
355
|
+
type: 'path_payment_strict_send',
|
|
356
|
+
transaction_hash: 'txpathsend',
|
|
357
|
+
from: 'GFROMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
358
|
+
to: 'GTOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
359
|
+
amount: '0.0033586',
|
|
360
|
+
asset_type: 'credit_alphanum12',
|
|
361
|
+
asset_code: 'Shitcoinz',
|
|
362
|
+
asset_issuer: 'GBVYKIM4QGW7NK3Q5S76GWMZMLAWYB6FB43JQ4J7ZOXHAA3LEZZGYHSD',
|
|
363
|
+
source_amount: '0.0130225',
|
|
364
|
+
source_asset_type: 'native',
|
|
322
365
|
transactionRecord: txRecord(),
|
|
323
366
|
}),
|
|
324
|
-
])
|
|
367
|
+
])
|
|
325
368
|
|
|
326
|
-
const block = await getBlock(10)
|
|
327
|
-
const ops = block.transactions[0].operations
|
|
328
|
-
expect(ops).toHaveLength(2)
|
|
329
|
-
expect(ops[0]).toMatchObject({ type:
|
|
330
|
-
expect(typeof ops[0].amount).toBe(
|
|
369
|
+
const block = await getBlock(10)
|
|
370
|
+
const ops = block.transactions[0].operations
|
|
371
|
+
expect(ops).toHaveLength(2)
|
|
372
|
+
expect(ops[0]).toMatchObject({ type: 'transfer', asset: { type: 'native' } })
|
|
373
|
+
expect(typeof ops[0].amount).toBe('bigint')
|
|
331
374
|
expect(ops[1]).toMatchObject({
|
|
332
|
-
type:
|
|
333
|
-
asset: { type:
|
|
334
|
-
})
|
|
335
|
-
expect(typeof ops[1].amount).toBe(
|
|
336
|
-
})
|
|
337
|
-
|
|
338
|
-
it(
|
|
339
|
-
const sourceAmountStr =
|
|
340
|
-
const sendMaxStr =
|
|
375
|
+
type: 'transfer',
|
|
376
|
+
asset: { type: 'token', assetReference: 'Shitcoinz' },
|
|
377
|
+
})
|
|
378
|
+
expect(typeof ops[1].amount).toBe('bigint')
|
|
379
|
+
})
|
|
380
|
+
|
|
381
|
+
it('path_payment_strict_receive debits source_amount when both send_max and source_amount are present', async () => {
|
|
382
|
+
const sourceAmountStr = '0.0100000'
|
|
383
|
+
const sendMaxStr = '5.0000000'
|
|
341
384
|
const expectedDebit = BigInt(
|
|
342
|
-
parseAPIValue(sourceAmountStr).integerValue(BigNumber.ROUND_FLOOR).toFixed(0)
|
|
343
|
-
)
|
|
385
|
+
parseAPIValue(sourceAmountStr).integerValue(BigNumber.ROUND_FLOOR).toFixed(0)
|
|
386
|
+
)
|
|
344
387
|
|
|
345
388
|
fetchAllLedgerOperationsMock.mockResolvedValue([
|
|
346
389
|
rawOp({
|
|
347
|
-
type:
|
|
348
|
-
transaction_hash:
|
|
349
|
-
from:
|
|
350
|
-
to:
|
|
351
|
-
amount:
|
|
352
|
-
asset_type:
|
|
353
|
-
asset_code:
|
|
354
|
-
asset_issuer:
|
|
390
|
+
type: 'path_payment_strict_receive',
|
|
391
|
+
transaction_hash: 'txpathrecv',
|
|
392
|
+
from: 'GFROMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
393
|
+
to: 'GTOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
394
|
+
amount: '0.0033586',
|
|
395
|
+
asset_type: 'credit_alphanum12',
|
|
396
|
+
asset_code: 'Shitcoinz',
|
|
397
|
+
asset_issuer: 'GBVYKIM4QGW7NK3Q5S76GWMZMLAWYB6FB43JQ4J7ZOXHAA3LEZZGYHSD',
|
|
355
398
|
send_max: sendMaxStr,
|
|
356
399
|
source_amount: sourceAmountStr,
|
|
357
|
-
source_asset_type:
|
|
400
|
+
source_asset_type: 'native',
|
|
358
401
|
transactionRecord: txRecord(),
|
|
359
402
|
}),
|
|
360
|
-
])
|
|
403
|
+
])
|
|
361
404
|
|
|
362
|
-
const block = await getBlock(10)
|
|
363
|
-
const ops = block.transactions[0].operations
|
|
364
|
-
expect(ops).toHaveLength(2)
|
|
405
|
+
const block = await getBlock(10)
|
|
406
|
+
const ops = block.transactions[0].operations
|
|
407
|
+
expect(ops).toHaveLength(2)
|
|
365
408
|
expect(ops[0]).toMatchObject({
|
|
366
|
-
type:
|
|
367
|
-
address:
|
|
368
|
-
asset: { type:
|
|
409
|
+
type: 'transfer',
|
|
410
|
+
address: 'GFROMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
411
|
+
asset: { type: 'native' },
|
|
369
412
|
amount: -expectedDebit,
|
|
370
|
-
})
|
|
413
|
+
})
|
|
371
414
|
const wrongDebit = BigInt(
|
|
372
|
-
parseAPIValue(sendMaxStr).integerValue(BigNumber.ROUND_FLOOR).toFixed(0)
|
|
373
|
-
)
|
|
374
|
-
expect(ops[0].amount).not.toBe(-wrongDebit)
|
|
375
|
-
})
|
|
415
|
+
parseAPIValue(sendMaxStr).integerValue(BigNumber.ROUND_FLOOR).toFixed(0)
|
|
416
|
+
)
|
|
417
|
+
expect(ops[0].amount).not.toBe(-wrongDebit)
|
|
418
|
+
})
|
|
376
419
|
|
|
377
|
-
it(
|
|
420
|
+
it('omits parent in block info for ledger height 1', async () => {
|
|
378
421
|
fetchLedgerRecordMock.mockImplementation(
|
|
379
422
|
async (seq: number) =>
|
|
380
423
|
({
|
|
381
424
|
sequence: seq,
|
|
382
425
|
hash: `LEDGER-HASH-${seq}`,
|
|
383
|
-
closed_at:
|
|
384
|
-
}) as Awaited<ReturnType<typeof network.fetchLedgerRecord
|
|
385
|
-
)
|
|
386
|
-
fetchAllLedgerOperationsMock.mockResolvedValue([])
|
|
426
|
+
closed_at: '2018-09-15T15:40:05Z',
|
|
427
|
+
}) as Awaited<ReturnType<typeof network.fetchLedgerRecord>>
|
|
428
|
+
)
|
|
429
|
+
fetchAllLedgerOperationsMock.mockResolvedValue([])
|
|
387
430
|
|
|
388
|
-
const block = await getBlock(1)
|
|
389
|
-
expect(block.info.height).toBe(1)
|
|
390
|
-
expect(block.info.parent).toBeUndefined()
|
|
391
|
-
})
|
|
431
|
+
const block = await getBlock(1)
|
|
432
|
+
expect(block.info.height).toBe(1)
|
|
433
|
+
expect(block.info.parent).toBeUndefined()
|
|
434
|
+
})
|
|
392
435
|
|
|
393
|
-
it(
|
|
436
|
+
it('omits feesPayer when fee_account and source_account are absent', async () => {
|
|
394
437
|
fetchAllLedgerOperationsMock.mockResolvedValue([
|
|
395
438
|
rawOp({
|
|
396
|
-
type:
|
|
397
|
-
transaction_hash:
|
|
398
|
-
from:
|
|
399
|
-
to:
|
|
400
|
-
amount:
|
|
401
|
-
asset_type:
|
|
439
|
+
type: 'payment',
|
|
440
|
+
transaction_hash: 'txnopayer',
|
|
441
|
+
from: 'GFROMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
442
|
+
to: 'GTOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
443
|
+
amount: '1.0000000',
|
|
444
|
+
asset_type: 'native',
|
|
402
445
|
transactionRecord: txRecord({
|
|
403
|
-
fee_charged:
|
|
404
|
-
source_account:
|
|
405
|
-
}
|
|
446
|
+
fee_charged: '100',
|
|
447
|
+
source_account: '',
|
|
448
|
+
}),
|
|
406
449
|
}),
|
|
407
|
-
])
|
|
450
|
+
])
|
|
408
451
|
|
|
409
|
-
const block = await getBlock(10)
|
|
410
|
-
expect(block.transactions[0]).not.toHaveProperty(
|
|
411
|
-
})
|
|
452
|
+
const block = await getBlock(10)
|
|
453
|
+
expect(block.transactions[0]).not.toHaveProperty('feesPayer')
|
|
454
|
+
})
|
|
412
455
|
|
|
413
|
-
it(
|
|
456
|
+
it('maps create_account with zero starting balance to empty operations but keeps tx for fees', async () => {
|
|
414
457
|
fetchAllLedgerOperationsMock.mockResolvedValue([
|
|
415
458
|
rawOp({
|
|
416
|
-
type:
|
|
417
|
-
transaction_hash:
|
|
418
|
-
funder:
|
|
419
|
-
account:
|
|
420
|
-
starting_balance:
|
|
459
|
+
type: 'create_account',
|
|
460
|
+
transaction_hash: 'txcreatezero',
|
|
461
|
+
funder: 'GFUNDERAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
462
|
+
account: 'GNEWAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
463
|
+
starting_balance: '0.0000000',
|
|
421
464
|
transactionRecord: txRecord(),
|
|
422
465
|
}),
|
|
423
|
-
])
|
|
466
|
+
])
|
|
424
467
|
|
|
425
|
-
const block = await getBlock(10)
|
|
426
|
-
expect(block.transactions).toHaveLength(
|
|
427
|
-
|
|
468
|
+
const block = await getBlock(10)
|
|
469
|
+
expect(block.transactions).toHaveLength(1)
|
|
470
|
+
expect(block.transactions[0].operations).toHaveLength(0)
|
|
471
|
+
expect(block.transactions[0].fees).toBe(100n)
|
|
472
|
+
})
|
|
428
473
|
|
|
429
|
-
it(
|
|
474
|
+
it('maps payment using to_muxed when to is absent', async () => {
|
|
430
475
|
fetchAllLedgerOperationsMock.mockResolvedValue([
|
|
431
476
|
rawOp({
|
|
432
|
-
type:
|
|
433
|
-
transaction_hash:
|
|
434
|
-
from:
|
|
477
|
+
type: 'payment',
|
|
478
|
+
transaction_hash: 'txmuxed',
|
|
479
|
+
from: 'GFROMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
435
480
|
to: undefined,
|
|
436
|
-
to_muxed:
|
|
437
|
-
amount:
|
|
438
|
-
asset_type:
|
|
481
|
+
to_muxed: 'GTO_MUXEDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
482
|
+
amount: '0.5000000',
|
|
483
|
+
asset_type: 'native',
|
|
439
484
|
transactionRecord: txRecord(),
|
|
440
485
|
}),
|
|
441
|
-
])
|
|
486
|
+
])
|
|
442
487
|
|
|
443
|
-
const block = await getBlock(10)
|
|
444
|
-
const transfers = block.transactions[0].operations.filter(o => o.type ===
|
|
488
|
+
const block = await getBlock(10)
|
|
489
|
+
const transfers = block.transactions[0].operations.filter((o) => o.type === 'transfer')
|
|
445
490
|
expect(
|
|
446
491
|
transfers.some(
|
|
447
|
-
o =>
|
|
448
|
-
)
|
|
449
|
-
).toBe(true)
|
|
450
|
-
})
|
|
492
|
+
(o) => 'peer' in o && o.peer === 'GTO_MUXEDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
|
|
493
|
+
)
|
|
494
|
+
).toBe(true)
|
|
495
|
+
})
|
|
451
496
|
|
|
452
|
-
it(
|
|
497
|
+
it('maps change_trust with zero limit as OPT_OUT', async () => {
|
|
453
498
|
fetchAllLedgerOperationsMock.mockResolvedValue([
|
|
454
499
|
rawOp({
|
|
455
|
-
type:
|
|
456
|
-
transaction_hash:
|
|
457
|
-
trustor:
|
|
458
|
-
asset_code:
|
|
459
|
-
asset_issuer:
|
|
460
|
-
limit:
|
|
500
|
+
type: 'change_trust',
|
|
501
|
+
transaction_hash: 'txoptout',
|
|
502
|
+
trustor: 'GTRUSTORAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
503
|
+
asset_code: 'ABC',
|
|
504
|
+
asset_issuer: 'GISSUERAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
505
|
+
limit: '0.0000000',
|
|
461
506
|
transactionRecord: txRecord(),
|
|
462
507
|
}),
|
|
463
|
-
])
|
|
508
|
+
])
|
|
464
509
|
|
|
465
|
-
const block = await getBlock(10)
|
|
510
|
+
const block = await getBlock(10)
|
|
466
511
|
expect(block.transactions[0].operations[0]).toMatchObject({
|
|
467
|
-
type:
|
|
468
|
-
ledgerOpType:
|
|
469
|
-
})
|
|
470
|
-
})
|
|
512
|
+
type: 'other',
|
|
513
|
+
ledgerOpType: 'OPT_OUT',
|
|
514
|
+
})
|
|
515
|
+
})
|
|
471
516
|
|
|
472
|
-
it(
|
|
517
|
+
it('path_payment_strict_send with zero amounts keeps tx for fees', async () => {
|
|
473
518
|
fetchAllLedgerOperationsMock.mockResolvedValue([
|
|
474
519
|
rawOp({
|
|
475
|
-
type:
|
|
476
|
-
transaction_hash:
|
|
477
|
-
from:
|
|
478
|
-
to:
|
|
479
|
-
amount:
|
|
480
|
-
asset_type:
|
|
481
|
-
source_amount:
|
|
482
|
-
source_asset_type:
|
|
520
|
+
type: 'path_payment_strict_send',
|
|
521
|
+
transaction_hash: 'txpathzero',
|
|
522
|
+
from: 'GFROMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
523
|
+
to: 'GTOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
524
|
+
amount: '0.0000000',
|
|
525
|
+
asset_type: 'native',
|
|
526
|
+
source_amount: '0.0000000',
|
|
527
|
+
source_asset_type: 'native',
|
|
483
528
|
transactionRecord: txRecord(),
|
|
484
529
|
}),
|
|
485
|
-
])
|
|
530
|
+
])
|
|
486
531
|
|
|
487
|
-
const block = await getBlock(10)
|
|
488
|
-
expect(block.transactions).toHaveLength(
|
|
489
|
-
|
|
532
|
+
const block = await getBlock(10)
|
|
533
|
+
expect(block.transactions).toHaveLength(1)
|
|
534
|
+
expect(block.transactions[0].operations).toHaveLength(0)
|
|
535
|
+
expect(block.transactions[0].fees).toBe(100n)
|
|
536
|
+
})
|
|
490
537
|
|
|
491
|
-
it(
|
|
492
|
-
const sendMaxStr =
|
|
538
|
+
it('path_payment_strict_receive uses send_max when source_amount is absent', async () => {
|
|
539
|
+
const sendMaxStr = '0.0200000'
|
|
493
540
|
const expected = BigInt(
|
|
494
|
-
parseAPIValue(sendMaxStr).integerValue(BigNumber.ROUND_FLOOR).toFixed(0)
|
|
495
|
-
)
|
|
541
|
+
parseAPIValue(sendMaxStr).integerValue(BigNumber.ROUND_FLOOR).toFixed(0)
|
|
542
|
+
)
|
|
496
543
|
fetchAllLedgerOperationsMock.mockResolvedValue([
|
|
497
544
|
rawOp({
|
|
498
|
-
type:
|
|
499
|
-
transaction_hash:
|
|
500
|
-
from:
|
|
501
|
-
to:
|
|
502
|
-
amount:
|
|
503
|
-
asset_type:
|
|
545
|
+
type: 'path_payment_strict_receive',
|
|
546
|
+
transaction_hash: 'txrecvmax',
|
|
547
|
+
from: 'GFROMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
548
|
+
to: 'GTOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
549
|
+
amount: '0.0010000',
|
|
550
|
+
asset_type: 'native',
|
|
504
551
|
send_max: sendMaxStr,
|
|
505
|
-
source_asset_type:
|
|
552
|
+
source_asset_type: 'native',
|
|
506
553
|
transactionRecord: txRecord(),
|
|
507
554
|
}),
|
|
508
|
-
])
|
|
555
|
+
])
|
|
509
556
|
|
|
510
|
-
const block = await getBlock(10)
|
|
557
|
+
const block = await getBlock(10)
|
|
511
558
|
const sender = block.transactions[0].operations.find(
|
|
512
|
-
o =>
|
|
513
|
-
o.type ===
|
|
514
|
-
)
|
|
515
|
-
expect(sender?.amount).toBe(-expected)
|
|
516
|
-
})
|
|
559
|
+
(o) =>
|
|
560
|
+
o.type === 'transfer' && o.address === 'GFROMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
|
|
561
|
+
)
|
|
562
|
+
expect(sender?.amount).toBe(-expected)
|
|
563
|
+
})
|
|
517
564
|
|
|
518
|
-
it(
|
|
565
|
+
it('path_payment_strict_receive with no source_amount nor send_max only maps destination leg', async () => {
|
|
519
566
|
fetchAllLedgerOperationsMock.mockResolvedValue([
|
|
520
567
|
rawOp({
|
|
521
|
-
type:
|
|
522
|
-
transaction_hash:
|
|
523
|
-
from:
|
|
524
|
-
to:
|
|
525
|
-
amount:
|
|
526
|
-
asset_type:
|
|
527
|
-
source_asset_type:
|
|
568
|
+
type: 'path_payment_strict_receive',
|
|
569
|
+
transaction_hash: 'txrecvnodebit',
|
|
570
|
+
from: 'GFROMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
571
|
+
to: 'GTOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
572
|
+
amount: '0.5000000',
|
|
573
|
+
asset_type: 'native',
|
|
574
|
+
source_asset_type: 'native',
|
|
528
575
|
transactionRecord: txRecord(),
|
|
529
576
|
}),
|
|
530
|
-
])
|
|
577
|
+
])
|
|
531
578
|
|
|
532
|
-
const block = await getBlock(10)
|
|
533
|
-
expect(block.transactions[0].operations).toHaveLength(1)
|
|
579
|
+
const block = await getBlock(10)
|
|
580
|
+
expect(block.transactions[0].operations).toHaveLength(1)
|
|
534
581
|
expect(block.transactions[0].operations[0]).toMatchObject({
|
|
535
|
-
type:
|
|
536
|
-
address:
|
|
537
|
-
asset: { type:
|
|
582
|
+
type: 'transfer',
|
|
583
|
+
address: 'GTOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
584
|
+
asset: { type: 'native' },
|
|
538
585
|
amount: 5000000n,
|
|
539
|
-
})
|
|
540
|
-
})
|
|
586
|
+
})
|
|
587
|
+
})
|
|
541
588
|
|
|
542
|
-
it(
|
|
589
|
+
it('path_payment_strict_send with zero source_amount maps only destination leg', async () => {
|
|
543
590
|
fetchAllLedgerOperationsMock.mockResolvedValue([
|
|
544
591
|
rawOp({
|
|
545
|
-
type:
|
|
546
|
-
transaction_hash:
|
|
547
|
-
from:
|
|
548
|
-
to:
|
|
549
|
-
amount:
|
|
550
|
-
asset_type:
|
|
551
|
-
source_amount:
|
|
552
|
-
source_asset_type:
|
|
592
|
+
type: 'path_payment_strict_send',
|
|
593
|
+
transaction_hash: 'txpathsenddestonly',
|
|
594
|
+
from: 'GFROMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
595
|
+
to: 'GTOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
596
|
+
amount: '0.2500000',
|
|
597
|
+
asset_type: 'native',
|
|
598
|
+
source_amount: '0.0000000',
|
|
599
|
+
source_asset_type: 'native',
|
|
553
600
|
transactionRecord: txRecord(),
|
|
554
601
|
}),
|
|
555
|
-
])
|
|
602
|
+
])
|
|
556
603
|
|
|
557
|
-
const block = await getBlock(10)
|
|
558
|
-
expect(block.transactions[0].operations).toHaveLength(1)
|
|
604
|
+
const block = await getBlock(10)
|
|
605
|
+
expect(block.transactions[0].operations).toHaveLength(1)
|
|
559
606
|
expect(block.transactions[0].operations[0]).toMatchObject({
|
|
560
|
-
type:
|
|
561
|
-
address:
|
|
607
|
+
type: 'transfer',
|
|
608
|
+
address: 'GTOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
562
609
|
amount: 2500000n,
|
|
563
|
-
})
|
|
564
|
-
})
|
|
610
|
+
})
|
|
611
|
+
})
|
|
565
612
|
|
|
566
|
-
it(
|
|
613
|
+
it('path_payment_strict_send with zero amount maps only source leg', async () => {
|
|
567
614
|
fetchAllLedgerOperationsMock.mockResolvedValue([
|
|
568
615
|
rawOp({
|
|
569
|
-
type:
|
|
570
|
-
transaction_hash:
|
|
571
|
-
from:
|
|
572
|
-
to:
|
|
573
|
-
amount:
|
|
574
|
-
asset_type:
|
|
575
|
-
source_amount:
|
|
576
|
-
source_asset_type:
|
|
616
|
+
type: 'path_payment_strict_send',
|
|
617
|
+
transaction_hash: 'txpathsendsourceonly',
|
|
618
|
+
from: 'GFROMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
619
|
+
to: 'GTOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
620
|
+
amount: '0.0000000',
|
|
621
|
+
asset_type: 'native',
|
|
622
|
+
source_amount: '1.0000000',
|
|
623
|
+
source_asset_type: 'native',
|
|
577
624
|
transactionRecord: txRecord(),
|
|
578
625
|
}),
|
|
579
|
-
])
|
|
626
|
+
])
|
|
580
627
|
|
|
581
|
-
const block = await getBlock(10)
|
|
582
|
-
expect(block.transactions[0].operations).toHaveLength(1)
|
|
628
|
+
const block = await getBlock(10)
|
|
629
|
+
expect(block.transactions[0].operations).toHaveLength(1)
|
|
583
630
|
expect(block.transactions[0].operations[0]).toMatchObject({
|
|
584
|
-
type:
|
|
585
|
-
address:
|
|
631
|
+
type: 'transfer',
|
|
632
|
+
address: 'GFROMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
586
633
|
amount: -10000000n,
|
|
587
|
-
})
|
|
588
|
-
})
|
|
634
|
+
})
|
|
635
|
+
})
|
|
589
636
|
|
|
590
|
-
it(
|
|
637
|
+
it('maps payment with only to address as single incoming transfer', async () => {
|
|
591
638
|
fetchAllLedgerOperationsMock.mockResolvedValue([
|
|
592
639
|
rawOp({
|
|
593
|
-
type:
|
|
594
|
-
transaction_hash:
|
|
595
|
-
to:
|
|
596
|
-
amount:
|
|
597
|
-
asset_type:
|
|
640
|
+
type: 'payment',
|
|
641
|
+
transaction_hash: 'txtoonly',
|
|
642
|
+
to: 'GTOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
643
|
+
amount: '3.0000000',
|
|
644
|
+
asset_type: 'native',
|
|
598
645
|
transactionRecord: txRecord(),
|
|
599
646
|
}),
|
|
600
|
-
])
|
|
647
|
+
])
|
|
601
648
|
|
|
602
|
-
const block = await getBlock(10)
|
|
649
|
+
const block = await getBlock(10)
|
|
603
650
|
expect(block.transactions[0].operations).toEqual([
|
|
604
651
|
expect.objectContaining({
|
|
605
|
-
type:
|
|
606
|
-
address:
|
|
652
|
+
type: 'transfer',
|
|
653
|
+
address: 'GTOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
607
654
|
amount: 30000000n,
|
|
608
655
|
}),
|
|
609
|
-
])
|
|
610
|
-
})
|
|
656
|
+
])
|
|
657
|
+
})
|
|
611
658
|
|
|
612
|
-
it(
|
|
659
|
+
it('maps payment with only from address as single outgoing transfer', async () => {
|
|
613
660
|
fetchAllLedgerOperationsMock.mockResolvedValue([
|
|
614
661
|
rawOp({
|
|
615
|
-
type:
|
|
616
|
-
transaction_hash:
|
|
617
|
-
from:
|
|
618
|
-
amount:
|
|
619
|
-
asset_type:
|
|
662
|
+
type: 'payment',
|
|
663
|
+
transaction_hash: 'txfromonly',
|
|
664
|
+
from: 'GFROMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
665
|
+
amount: '0.2500000',
|
|
666
|
+
asset_type: 'native',
|
|
620
667
|
transactionRecord: txRecord(),
|
|
621
668
|
}),
|
|
622
|
-
])
|
|
669
|
+
])
|
|
623
670
|
|
|
624
|
-
const block = await getBlock(10)
|
|
671
|
+
const block = await getBlock(10)
|
|
625
672
|
expect(block.transactions[0].operations).toEqual([
|
|
626
673
|
expect.objectContaining({
|
|
627
|
-
type:
|
|
628
|
-
address:
|
|
674
|
+
type: 'transfer',
|
|
675
|
+
address: 'GFROMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
629
676
|
amount: -2500000n,
|
|
630
677
|
}),
|
|
631
|
-
])
|
|
632
|
-
})
|
|
678
|
+
])
|
|
679
|
+
})
|
|
633
680
|
|
|
634
|
-
it(
|
|
681
|
+
it('treats payment with missing asset_type as native when mapping asset', async () => {
|
|
635
682
|
fetchAllLedgerOperationsMock.mockResolvedValue([
|
|
636
683
|
rawOp({
|
|
637
|
-
type:
|
|
638
|
-
transaction_hash:
|
|
639
|
-
from:
|
|
640
|
-
to:
|
|
641
|
-
amount:
|
|
684
|
+
type: 'payment',
|
|
685
|
+
transaction_hash: 'txnoassettype',
|
|
686
|
+
from: 'GFROMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
687
|
+
to: 'GTOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
688
|
+
amount: '1.0000000',
|
|
642
689
|
asset_type: undefined,
|
|
643
|
-
asset_code:
|
|
644
|
-
asset_issuer:
|
|
690
|
+
asset_code: 'USD',
|
|
691
|
+
asset_issuer: 'GISSUERAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
645
692
|
transactionRecord: txRecord(),
|
|
646
693
|
}),
|
|
647
|
-
])
|
|
694
|
+
])
|
|
648
695
|
|
|
649
|
-
const block = await getBlock(10)
|
|
650
|
-
const transfers = block.transactions[0].operations.filter(o => o.type ===
|
|
651
|
-
expect(transfers.every(t => t.type ===
|
|
652
|
-
})
|
|
653
|
-
})
|
|
696
|
+
const block = await getBlock(10)
|
|
697
|
+
const transfers = block.transactions[0].operations.filter((o) => o.type === 'transfer')
|
|
698
|
+
expect(transfers.every((t) => t.type === 'transfer' && t.asset.type === 'native')).toBe(true)
|
|
699
|
+
})
|
|
700
|
+
})
|