catapult-rest icon indicating copy to clipboard operation
catapult-rest copied to clipboard

transactions/confirmed embedded option does not seem to do anything

Open Jaguar0625 opened this issue 3 years ago • 6 comments

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

Jaguar0625 avatar Jul 23 '21 20:07 Jaguar0625

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));
    });
});

fboucquez avatar Jul 27 '21 10:07 fboucquez

You can try this one: http://explorer.symbolblockchain.io/accounts/NDA5UHKI2TQNN52JTZ2EUKWFPH7UFZPURXGWFRA

Jaguar0625 avatar Jul 27 '21 12:07 Jaguar0625

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

fboucquez avatar Jul 27 '21 22:07 fboucquez

shouldn't the query fail in this case?

gimre-xymcity avatar Jul 28 '21 06:07 gimre-xymcity

shouldn't the query fail in this case?

Could you clarify?

fboucquez avatar Jul 28 '21 11:07 fboucquez

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)

gimre-xymcity avatar Aug 05 '21 12:08 gimre-xymcity