Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: transport generalization for recursive declaration #987

Merged
merged 5 commits into from
Nov 27, 2024

Conversation

petarjuki7
Copy link
Member

@petarjuki7 petarjuki7 commented Nov 26, 2024

The goal is to further generalize the external client to support recursive nesting of structures like:

type All = Either<Relayer, Both<Near, Both<Starknet, Both<InternetComputer, Both<Ethereum, Solana>>>>>

or even

type NearAndStarknet =
    Both<Near, Starknet>;

type EthereumAndSolana =
    Both<Ethereum, Solana>;

type PolkadotAndInternetComputer =
    Both<Polkadot, InternetComputer>;

type NearAndStarknetOrEthereumAndSolana =
    Either<NearAndStarknet, EthereumAndSolana>;

type NearAndStarknetOrEthereumAndSolanaAndPolkadotAndInternetComputer =
    Both<NearAndStarknetOrEthereumAndSolana, PolkadotAndInternetComputer>;

type RelayerOrNearAndStarknetOrEthereumAndSolanaAndPolkadotAndInternetComputer =
    Either<Relayer, NearAndStarknetOrEthereumAndSolanaAndPolkadotAndInternetComputer>;

Which means we don't have to expand Both to contain more than 2 transports, or add new structures for each new accommodation.

Copy link
Member

@miraclx miraclx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

had some thoughts, needed to experiment to be sure they'd work, compiled in #991

@petarjuki7 petarjuki7 marked this pull request as ready for review November 27, 2024 22:26
@miraclx
Copy link
Member

miraclx commented Nov 27, 2024

don't forget to fix the PR title

@petarjuki7 petarjuki7 changed the title Make transport generic over any amount of Networks feat: transport generalization for recursive declaration Nov 27, 2024
@petarjuki7 petarjuki7 force-pushed the petarjuki7/icp-transport branch from 22ca1eb to 29d64b1 Compare November 27, 2024 22:59
@petarjuki7 petarjuki7 enabled auto-merge (squash) November 27, 2024 23:02
@petarjuki7 petarjuki7 merged commit 79c9c00 into master Nov 27, 2024
20 checks passed
@petarjuki7 petarjuki7 deleted the petarjuki7/icp-transport branch November 27, 2024 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants