common EOA we use the v4 signature and web3.eth.personal.ecRecover validate signature
when v4 signature is failed for any step, we will try personal_sign and web3.eth.personal.ecRecover validate signature
For Dapp
when loopring Dex is inside Dapp Webview & connect by window.ethereum, we remove the web3.eth.personal.ecRecover validate
Loopring smart wallet:
For Loopring smart wallet we send eth_signTypedData by walletConnect & validate ABI.Contracts.ContractWallet.encodeInputs isValidSignature(bytes32,bytes)
Loopring counterfactual wallet:
signature is same as Loopring smart wallet
But ecRecover is by walletOwner, const {walletOwner} = await LoopringAPI.exchangeAPI.getCounterFactualInfo({ accountId: LOOPRING_EXPORTED_ACCOUNT.accountIdCF, });
// test case is not allow brock by Mock providerconstresult=awaitsdk.getEcDSASig( web3, testTypedData,LOOPRING_EXPORTED_ACCOUNT.address,sdk.GetEcDSASigType.HasDataStruct,sdk.ChainId.GOERLI,LOOPRING_EXPORTED_ACCOUNT.accountId,"",sdk.ConnectorNames.Unknown);console.log("getEcDSASig:eth_signTypedData_v4", result,"ecdsaSig+sdk.SigSuffix.Suffix02",result.ecdsaSig +sdk.SigSuffix.Suffix02);
// test case is not allow brock by Mock providerconstresult=awaitsdk.getEcDSASig( web3, testTypedData,LOOPRING_EXPORTED_ACCOUNT.address,sdk.GetEcDSASigType.Contract,sdk.ChainId.GOERLI,LOOPRING_EXPORTED_ACCOUNT.accountId,"",sdk.ConnectorNames.Unknown);console.log("getEcDSASig:personalSign(Contract)", result);