Signature
Definition: Loopring SDK support EOA (EOA hardware wallet) & Loopring smart wallet signature.
Environment type
For Browser extension, Dapp, and hardware wallet, we only support EOA
For Loopring smart wallet (App), the provider gateway is WalletConnect
The following are the provider gateways we inject & test:
MetaMask (Ledger, Trezor)
WalletConnect (Authereum, Loopring smart wallet )
Coinbase
For signature:
Understand what is
eth_sign signing types(eth_sign, personal_sign, v1, v3, v4)❗ when add
SigSuffix02|03(please follow:EIP712&signTypedData_v4+02,personal_sign+03)
for
v4ecdsaSignature the result signature should +SigSuffix.Suffix02;for
personal_signecdsaSignature the result signature should +SigSuffix.Suffix03;
EOA:
For Browser extension (More information: signing-data)
common EOA we use the
v4signature andweb3.eth.personal.ecRecovervalidate signaturewhen
v4signature is failed for any step, we will trypersonal_signandweb3.eth.personal.ecRecovervalidate signature
For Dapp
when loopring Dex is inside Dapp Webview & connect by
window.ethereum, we remove theweb3.eth.personal.ecRecovervalidate
Loopring smart wallet:
For Loopring smart wallet we send
eth_signTypedDataby walletConnect & validate ABI.Contracts.ContractWallet.encodeInputsisValidSignature(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, });
Demo Signature
generateKeyPair
getEcDSASig: eth_signTypedData_v4
getEcDSASig: personalSign(WithoutDataStruct--Hardware wallet)
getEcDSASig: personalSign(Contract)
Validate signature
Last updated
Was this helpful?