-
Notifications
You must be signed in to change notification settings - Fork 1
Safe integration for creating marketplace listings #35
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
base: main
Are you sure you want to change the base?
Safe integration for creating marketplace listings #35
Conversation
In our frontend we're using Hypercerts as name and version number 1, so we should do this in our SDK as well.
The TSDoc around bundleApprovalsForSafe() was missing a parameter and not very descriptive what it did.
997b366
to
eb41f3e
Compare
Without this patch users of this SDK have no way to create marketplace listings from a Safe. This new function signs a maker order and uploads it to the Safe transaction service. There it can be executed by the other signers.
The function doesn't need these fields to compute validity. This only complicates things at the call-site. We should apply the Law of Demeter here.
Without this patch there's only the option to send both approval transactions in a bundle. This can be a problem when the Safe has one of the approvals but not both. Surely this is an edge case, but it did happen during development. The problem, here, is that the approval of the transfer manager will reject if it's already done. This could lead to users being stuck.
This function builds the Safe-specific payload to the API that only contains the chain id and message hash.
eb41f3e
to
76fb5c3
Compare
return this.createMakerAsk({ | ||
// Defaults | ||
strategyId: StrategyType.standard, | ||
collectionType: 2, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could use the CollectionType
enum here
@@ -2,11 +2,11 @@ | |||
* EIP712 domain name. | |||
* @see {@link https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator EIP712 doc} | |||
*/ | |||
export const DOMAIN_NAME = "LooksRareProtocol"; | |||
export const DOMAIN_NAME = "Hypercerts"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was changed last time as well, and it broke signatures as the API needs to be updated too, so I rolled it back. if we want to change it, it needs to be rolled out at the same time for the API and the marketplace sdk
|
||
/** | ||
* EIP712 domain version. | ||
* @see {@link https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator EIP712 doc} | ||
*/ | ||
export const DOMAIN_VERSION = 2; | ||
export const DOMAIN_VERSION = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idem
const domain = { | ||
name: DOMAIN_NAME, | ||
version: DOMAIN_VERSION.toString(), | ||
chainId: Number(this.chainId), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parseInt
safeAddress: this.address, | ||
}); | ||
|
||
const domain = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is getTypedDataDomain()
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "@hypercerts-org/marketplace-sdk", | |||
"version": "0.5.3", | |||
"version": "0.5.4", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i just merged the other PR so this needs updating
This PR adds support to create marketplace listings using a Safe.
It introduces a new class
SafeMessages
that deals with constructing, signing and uploading Safe messages to the Safe Transaction Service.On the exchange client it introduces a new function
signMakerOrderSafe()
that's supposed to be called by the users of this SDK.