Open pointtoken opened 5 years ago
what is the web3 object in this context?
Trust Wallet injects it:
this.web3 = this.windowRef.nativeWindow.web3.currentProvider;
Are there any websites or dexes that one can navigate to from Trust Wallet and create a valid signed order?
I'd suggest the 0x codesandbox but it appears that Trust Wallet has disabled testnet support?
@pointtoken are you able to fill the order? Wondering if the issue is with Trust Wallet or validateOrderFillableOrThrowAsync
.
@fabioberger no the order is not able to be filled.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@pointtoken if this is still an issue, mind sending as a repro? Or repo where we can see the code? I'd need to put in some debug logs to see what's going on.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I'm also having an issue with signing typed data in Trust wallet. It seems to immediately fail.
e.toLowerCase is not a function. (In 'e.toLowerCase()', 'e.toLowerCase' is undefined)
I know that isn't much help but it's what I have. It's difficult to debug because we're in an embedded browser within Trust.
Also, this seems to be specific to signing typed data. I am able to sign a message successfully and send it to the exchange contract, but it doesn't pass signature validation. It returns "SIGNATURE_UNSUPPORTED"
Here is some sample code.
async signTransactionAsync(transaction) {
return await signatureUtils.ecSignTypedDataTransactionAsync(
this.provider,
transaction,
transaction.signerAddress,
);
},
async submitOrders(afterConfirmation) {
const data = await this.getEncodedTransactionData();
const transaction = { // ZeroExTransaction Object
salt: new Date().getTime(),
signerAddress: this.account,
verifyingContractAddress: this.contractWrappers.exchange.address,
data,
};
const signature = await this.signTransactionAsync(transaction);
const signedTransaction = {
...transaction,
signature,
};
const { gas, gasPrice } = await this.getGas();
const txHash = await this.ourContract.ourFunction.sendTransactionAsync(
signedTransaction,
signature,
{
from: transaction.signerAddress,
gas,
gasPrice,
},
);
return this.web3Wrapper.awaitTransactionMinedAsync(txHash);
},
When attempting to sign a typed order from Trust Wallet, the signature fails validation.
Here is the code to create the signature
This will successfully fire off the 712 signing UI from Trust Wallet and return a signature. But when the signed order is then passed to validateOrderFillableOrThrowAsync it returns