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

Add transform argument for Web3RpcRequest #34

Closed
y9san9 opened this issue Aug 24, 2021 · 2 comments
Closed

Add transform argument for Web3RpcRequest #34

y9san9 opened this issue Aug 24, 2021 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@y9san9
Copy link
Member

y9san9 commented Aug 24, 2021

Web3RpcRequest(
    method = "eth_sendRawTransaction",
    params = listOf(signedTransaction),
    paramsSerializer = String.serializer(),
    resultSerializer = String.serializer(),
    transform = ::TransactionHash
)

@Alex009, what do you think about such a thing?

It's useful for cases when we want to wrap request result in typed stuff like on screenshot below:
image

Now that works fine and I can add a request to the separate entity, but when I try to use it with a batch request, it becomes kinda verbose because I have a String output, but not a TokenCryptoCurrency? one.

@y9san9 y9san9 self-assigned this Aug 24, 2021
@y9san9 y9san9 added the enhancement New feature or request label Aug 24, 2021
@Alex009
Copy link
Member

Alex009 commented Aug 24, 2021

@y9san9 yes, good idea.

or can be better - do serializer for TokenCryptoCurrency and just pass into resultSerializer = TokenCryptoCurrency.serializer()

@y9san9
Copy link
Member Author

y9san9 commented Aug 24, 2021

For example, the network cannot be extracted from the string and I will make custom serializer like TokenCryptoCurrencySerializer(network)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants