Skip to content
This repository has been archived by the owner on Jun 10, 2022. It is now read-only.

transactions/confirmed embedded option does not seem to do anything #638

Open
Jaguar0625 opened this issue Jul 23, 2021 · 6 comments
Open

Comments

@Jaguar0625
Copy link
Contributor

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

@fboucquez
Copy link
Collaborator

fboucquez commented Jul 27, 2021

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

@Jaguar0625
Copy link
Contributor Author

@fboucquez
Copy link
Collaborator

fboucquez commented Jul 27, 2021

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 #433

@gimre-xymcity
Copy link
Member

shouldn't the query fail in this case?

@fboucquez
Copy link
Collaborator

shouldn't the query fail in this case?

Could you clarify?

@gimre-xymcity
Copy link
Member

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)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants