perun-network / erdstall-ts-sdk

TypeScript client SDK to interact with Erdstall.
Apache License 2.0
5 stars 2 forks source link

Make `TxReceipt` polymorphic #92

Open ndzik opened 3 years ago

ndzik commented 3 years ago

Currently this is required:

        const tx = await session.mint(nftAddress, nftId);
        const minttx = tx.tx as Mint;

I think it would be nice to have a polymorphic TxReceipt<T extends Transaction> helper, which types the internal transaction:

        const minttx: TxReceipt<Mint> = await session.mint(nftAddress, nftId);

This can then be set in the return values of our interfaces and should be straight forward to implement.

sebastianst commented 3 years ago

I like the idea of creating a templated type-safe TxReceipt type. But I think that it is still better to have two separate fields tx for the transaction and deltas for the modified deltas.