Skip to content
New issue

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

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

Already on GitHub? # to your account

Use rpc struct instead of global variable #5

Merged
merged 4 commits into from
Sep 27, 2019

Conversation

majecty
Copy link
Contributor

@majecty majecty commented Sep 16, 2019

Also use the idGenerator function.

@majecty majecty requested a review from cubismic September 16, 2019 09:46
Copy link
Member

@cubismic cubismic left a comment

Choose a reason for hiding this comment

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

I think this commits should merge first and #8 later.

@cubismic cubismic mentioned this pull request Sep 23, 2019
@majecty majecty force-pushed the f/instance branch 2 times, most recently from 39ddefe to b091d6d Compare September 24, 2019 07:54
@cubismic
Copy link
Member

cubismic commented Sep 25, 2019

According to this, we have to make multiple rpc objects if we use multiple functions.
Is this intentional usage?

rpc1 := rpc.NewRPC("https://corgi-rpc.codechain.io/")
fmt.Println(rpc1.Version())
rpc2 := rpc.NewChain("https://corgi-rpc.codechain.io/")
fmt.Println(rpc2.GetBlockByNumber(1))
rpc3 := rpc.NewAccount("https://corgi-rpc.codechain.io/")
fmt.Println(rpc3.GetList())

@majecty
Copy link
Contributor Author

majecty commented Sep 25, 2019

How about adding chain and account in RPC object?

@cubismic
Copy link
Member

cubismic commented Sep 25, 2019

@majecty
That would work if Account, Chain is initialized when RPC object is created.
Or use single rpcClient

@majecty majecty merged commit f71572d into CodeChain-io:master Sep 27, 2019
@majecty majecty deleted the f/instance branch September 27, 2019 04:48
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants