catapult-rest
catapult-rest copied to clipboard
transactions/confirmed embedded option does not seem to do anything
consider this query, which returns some aggregate transactions:
http://ngl-dual-001.symbolblockchain.io:3000/transactions/confirmed?address=NBHPVUIRDVMANSA2WQHTGAXEK6VJ73LOGTMQHLQ&order=asc&embedded=true
http://ngl-dual-001.symbolblockchain.io:3000/transactions/confirmed?address=NBHPVUIRDVMANSA2WQHTGAXEK6VJ73LOGTMQHLQ&order=asc&embedded=false
there is no difference what is returned when the embedded flag is true or false
Hi @Jaguar0625, I am checking the address and it seems it doesn't have any aggregate.
http://explorer.symbolblockchain.io/accounts/NBHPVUIRDVMANSA2WQHTGAXEK6VJ73LOGTMQHLQ
Reference script:
import { toArray } from 'rxjs/operators';
import { RepositoryFactoryHttp, TransactionGroup } from '../../src/infrastructure';
import { Address } from '../../src/model/account';
import { TransactionType } from '../../src/model/transaction';
describe('Script Test', () => {
const repositoryFactory = new RepositoryFactoryHttp('http://ngl-dual-001.symbolblockchain.io:3000');
const repository = repositoryFactory.createTransactionRepository();
const address = Address.createFromRawAddress('NBHPVUIRDVMANSA2WQHTGAXEK6VJ73LOGTMQHLQ');
it('Return top level transactions', async () => {
const data = await repository
.streamer()
.search({
group: TransactionGroup.Confirmed,
address: address,
})
.pipe(toArray())
.toPromise();
console.log(data.length); // Returns 41
console.log(JSON.stringify(data, null, 2));
});
it('Return top level and embedded transactions', async () => {
const data = await repository
.streamer()
.search({
embedded: true,
group: TransactionGroup.Confirmed,
address: address,
})
.pipe(toArray())
.toPromise();
console.log(data.length); // Returns 41
console.log(JSON.stringify(data, null, 2));
});
it('Return top level aggregate', async () => {
const data = await repository
.streamer()
.search({
group: TransactionGroup.Confirmed,
type: [TransactionType.AGGREGATE_COMPLETE, TransactionType.AGGREGATE_BONDED],
address: address,
})
.pipe(toArray())
.toPromise();
console.log(data.length); // Returns 0
console.log(JSON.stringify(data, null, 2));
});
});
You can try this one: http://explorer.symbolblockchain.io/accounts/NDA5UHKI2TQNN52JTZ2EUKWFPH7UFZPURXGWFRA
Currently, the address filter uses the (http response ignored) meta.addresses data from the transaction collection. It seems as the data stored there is incomplete or not enough for embedded.
https://github.com/symbol/catapult-rest/blob/main/rest/src/db/CatapultDb.js#L324
The "best" way now to get all the transactions is using the signerPublicKey. Unfortunately, I cannot convert the address to a public key so I can OR the conditions together when the address is provided.
http://ngl-dual-001.symbolblockchain.io:3000/transactions/confirmed?signerPublicKey=5A8D64291779822FD983FA88A7A82CDA73BAA302229EBCDF53B92D5B3926FEAF&order=asc&embedded=true&pageSize=100
http://ngl-dual-001.symbolblockchain.io:3000/transactions/confirmed?signerPublicKey=5A8D64291779822FD983FA88A7A82CDA73BAA302229EBCDF53B92D5B3926FEAF&order=asc&embedded=false&pageSize=100
Duplicated of https://github.com/symbol/catapult-rest/issues/433
shouldn't the query fail in this case?
shouldn't the query fail in this case?
Could you clarify?
I mean,
- you're requesting by address
- and specifying embedded = true
you can't get those txes, so wouldn't it be natural for query to fail in this case (InvalidArguments)