Skip to content

Conversation

@dohaki
Copy link
Contributor

@dohaki dohaki commented Oct 11, 2022

Description

This proposes a cleaner separation for the work done in #295 and #306.

The class CoreSDK should have as less as possible business logic and should just be a wrapper around the different module handlers, subgraph helpers, etc. I, therefore, moved them out into the account module.

I also think it is cleaner to leave the getSellerByAddress as it is to match only the configured operator, treasury, etc. address. And add a new method getSellersByAddressOrAuthToken that is more distinct.

@albertfolch-redeemeum I guess these are some breaking changes for the interface.

Blocked by #292 but can be reviewed already.

@levalleux-ludo
Copy link
Member

levalleux-ludo commented Oct 11, 2022

@dohaki
Not sure I understand why "it is cleaner to leave the getSellerByAddress as it is to match only the configured operator, treasury, etc. address. And add a new method getSellersByAddressOrAuthToken that is more distinct."
IMHO the dApp needs a single service to find back the seller account from the address given by the wallet when he's connecting.
What I mean is: I think the dApp should always use getSellersByAddressOrAuthToken() and never use getSellerByAddress()
And, by extension, the other core-SDK clients too (but maybe I'm wrong).

The usecase I'm trying to explain (which is the usecase the dApp is facing to) is the one implemented in this test case:

xtest("getSellerByAddress() retrieve the seller using the auth token", async () => {

Note: this test has not been pushed yet because it requires a change at the contracts repo.

@levalleux-ludo
Copy link
Member

Description

This proposes a cleaner separation for the work done in #295 and #306.

The class CoreSDK should have as less as possible business logic and should just be a wrapper around the different module handlers, subgraph helpers, etc. I, therefore, moved them out into the account module.

I also think it is cleaner to leave the getSellerByAddress as it is to match only the configured operator, treasury, etc. address. And add a new method getSellersByAddressOrAuthToken that is more distinct.

@albertfolch-redeemeum I guess these are some breaking changes for the interface.

Blocked by #292 but can be reviewed already.

The class CoreSDK should have as less as possible business logic and should just be a wrapper around the different module handlers, subgraph helpers, etc. I, therefore, moved them out into the account module.

However, I agree with "The class CoreSDK should have as less as possible business logic and should just be a wrapper around the different module handlers, subgraph helpers, etc. I, therefore, moved them out into the account module."

@dohaki
Copy link
Contributor Author

dohaki commented Oct 11, 2022

@dohaki Not sure I understand why "it is cleaner to leave the getSellerByAddress as it is to match only the configured operator, treasury, etc. address. And add a new method getSellersByAddressOrAuthToken that is more distinct." IMHO the dApp needs a single service to find back the seller account from the address given by the wallet when he's connecting. What I mean is: I think the dApp should always use getSellersByAddressOrAuthToken() and never use getSellerByAddress() And, by extension, the other core-SDK clients too (but maybe I'm wrong).

The usecase I'm trying to explain (which is the usecase the dApp is facing to) is the one implemented in this test case:

xtest("getSellerByAddress() retrieve the seller using the auth token", async () => {

Note: this test has not been pushed yet because it requires a change at the contracts repo.

@levalleux-ludo I mean the dApp can always use getSellersByAddressOrAuthToken. But we can not assume that every other client would also have some kind of auth token configured no? I think it is just cleaner and more distinct to name the functions like this. Based on your argumentation the method getSellerByAuthToken would also not be needed then?

@levalleux-ludo
Copy link
Member

levalleux-ludo commented Oct 11, 2022

@dohaki Not sure I understand why "it is cleaner to leave the getSellerByAddress as it is to match only the configured operator, treasury, etc. address. And add a new method getSellersByAddressOrAuthToken that is more distinct." IMHO the dApp needs a single service to find back the seller account from the address given by the wallet when he's connecting. What I mean is: I think the dApp should always use getSellersByAddressOrAuthToken() and never use getSellerByAddress() And, by extension, the other core-SDK clients too (but maybe I'm wrong).
The usecase I'm trying to explain (which is the usecase the dApp is facing to) is the one implemented in this test case:

xtest("getSellerByAddress() retrieve the seller using the auth token", async () => {

Note: this test has not been pushed yet because it requires a change at the contracts repo.

@levalleux-ludo I mean the dApp can always use getSellersByAddressOrAuthToken. But we can not assume that every other client would also have some kind of auth token configured no? I think it is just cleaner and more distinct to name the functions like this. Based on your argumentation the method getSellerByAuthToken would also not be needed then?

OK, I agree to keep the 2 methods.
And also keeping getSellerByAuthToken() as there are getSellerByOperator/Clerk/Admin/Treasury()
Important to note that, after this merge, the dApp should always use getSellersByAddressOrAuthToken() instead of getSellerByAddress()
^^ @dennisfurrer @RobertoMSousa @albertfolch-redeemeum @bigerjot

Base automatically changed from meta-tx-sellers to main October 11, 2022 14:46
@RobertoMSousa RobertoMSousa marked this pull request as draft October 11, 2022 14:52
@RobertoMSousa
Copy link
Contributor

Converted to draft because this PR can't be merged at the moment because it will impact the dApp
https://boson-protocol.slack.com/archives/C01R75F5HFA/p1665499683633289?thread_ts=1665480156.174159&cid=C01R75F5HFA

@dohaki dohaki marked this pull request as ready for review October 14, 2022 08:07
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.

4 participants