-
Notifications
You must be signed in to change notification settings - Fork 89
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
Fix issue signing using WC for some wallets #528
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,10 +6,10 @@ import { | |
Order, | ||
OrderCancellation as OrderCancellationGp, | ||
Signature, | ||
TypedDataV3Signer, | ||
TypedDataVersionedSigner, | ||
IntChainIdTypedDataV4Signer, | ||
SigningScheme, | ||
} from '@gnosis.pm/gp-v2-contracts' | ||
} from '@cowprotocol/contracts' | ||
|
||
import { SupportedChainId as ChainId } from 'constants/chains' | ||
import { GP_SETTLEMENT_CONTRACT_ADDRESS } from 'constants/index' | ||
|
@@ -137,16 +137,19 @@ async function _signPayload( | |
payload: any, | ||
signFn: typeof _signOrder | typeof _signOrderCancellation, | ||
signer: Signer, | ||
signingMethod: 'v4' | 'int_v4' | 'v3' | 'eth_sign' = 'v4' | ||
signingMethod: 'default' | 'v4' | 'int_v4' | 'v3' | 'eth_sign' = 'v4' | ||
): Promise<SigningResult> { | ||
const signingScheme = signingMethod === 'eth_sign' ? SigningScheme.ETHSIGN : SigningScheme.EIP712 | ||
let signature: Signature | null = null | ||
|
||
let _signer | ||
try { | ||
switch (signingMethod) { | ||
case 'default': | ||
_signer = new TypedDataVersionedSigner(signer) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we use the default, we don't specify the version. Will use |
||
break | ||
case 'v3': | ||
_signer = new TypedDataV3Signer(signer) | ||
_signer = new TypedDataVersionedSigner(signer, 'v3') | ||
break | ||
case 'int_v4': | ||
_signer = new IntChainIdTypedDataV4Signer(signer) | ||
|
@@ -173,6 +176,8 @@ async function _signPayload( | |
// with other methods... | ||
switch (signingMethod) { | ||
case 'v4': | ||
return _signPayload(payload, signFn, signer, 'default') | ||
case 'default': | ||
return _signPayload(payload, signFn, signer, 'v3') | ||
case 'v3': | ||
return _signPayload(payload, signFn, signer, 'eth_sign') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1160,6 +1160,11 @@ | |
exec-sh "^0.3.2" | ||
minimist "^1.2.0" | ||
|
||
"@cowprotocol/contracts@^1.1.3-RC.0": | ||
version "1.1.3-RC.0" | ||
resolved "https://registry.yarnpkg.com/@cowprotocol/contracts/-/contracts-1.1.3-RC.0.tgz#23c400a7cbf50c1c2e7dca317a0b2940975b6867" | ||
integrity sha512-WwPvBKbBvRIj/W3I1/8yJPh0DLMx8EoDw/MTpF07rDq2W0QQ1r9GXq+GWIclt5Rcw7ZGwZMRlnM3XOYEWA+qpg== | ||
|
||
"@craco/craco@^5.7.0": | ||
version "5.9.0" | ||
resolved "https://registry.yarnpkg.com/@craco/craco/-/craco-5.9.0.tgz#dcd34330b558596a4841374743071b7fa041dce9" | ||
|
@@ -2142,11 +2147,6 @@ | |
"@gnosis.pm/dex-contracts" "^0.5.0" | ||
bignumber.js "^9.0.2" | ||
|
||
"@gnosis.pm/gp-v2-contracts@^1.1.2": | ||
version "1.1.2" | ||
resolved "https://registry.yarnpkg.com/@gnosis.pm/gp-v2-contracts/-/gp-v2-contracts-1.1.2.tgz#0453bb097377dc63cf46ee195f7e521d429f7e22" | ||
integrity sha512-BvZMNS+fwITb+qs+trs2fyvYksa6MPjjLze9AOXPnvcKVYFEGwG6cfsecBswEMo+xevLIQNDyF7HZRhN7ply8w== | ||
|
||
"@gnosis.pm/[email protected]": | ||
version "0.9.3" | ||
resolved "https://registry.yarnpkg.com/@gnosis.pm/safe-apps-provider/-/safe-apps-provider-0.9.3.tgz#d8913b0f8abc15fdca229571eefc5f9385c82ea7" | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 now allow to specify the "default" version. In this case, will be same as v4, at least now. In the future who knows :)
Setting to
default
is what makes us to send the RPC call witheth_signTypedData
instead ofeth_signTypedData_v4