LIT-Protocol / js-serverless-function-test

12 stars 5 forks source link

`yarn run sign` seemed to work fine, somehow txn can't be found on the explorer by txn hash #3

Open j-labs-xyz opened 1 year ago

j-labs-xyz commented 1 year ago

@glitch003

yarn run sign seemed to work fine, somehow txn can't be found on the explorer by txn hash

https://mumbai.polygonscan.com/search?f=0&q=0xf86880852e90edd0008275309450e2dac5e78b5905cb09495547452cee64426db282

Not sure if the tx has been broadcasted successfully or not, as I saw an error "[Lit-JS-SDK] Error parsing response as json. Swallowing and returning as string.".

[Lit-JS-SDK] Error parsing response as json.  Swallowing and returning as string. 
signatures:  {
  sig1: {
    r: '9aecaef6725e8b4ed649bd98a0227927b032916c196d4958efe612a119ca19b6',
    s: '7d8f1bd025016d5e44792db8cde090371813504ec738a9f81a2c960e6b9596a1',
    recid: 1,
    signature: '0x9aecaef6725e8b4ed649bd98a0227927b032916c196d4958efe612a119ca19b67d8f1bd025016d5e44792db8cde090371813504ec738a9f81a2c960e6b9596a11c',
    publicKey: '0x0404e12210c57f81617918a5b783e51b6133790eb28a79f141df22519fb97977d2a681cc047f9f1a9b533df480eb2d816fb36606bd7c716e71a179efd53d2a55d1',
    dataSigned: '0xbd3a3bf43892abb796046063daff65a228d0da94417020625a7469c77013c451'
  }
}
encodedSig 0x9aecaef6725e8b4ed649bd98a0227927b032916c196d4958efe612a119ca19b67d8f1bd025016d5e44792db8cde090371813504ec738a9f81a2c960e6b9596a11c
sig length in bytes:  65
dataSigned 0xbd3a3bf43892abb796046063daff65a228d0da94417020625a7469c77013c451
splitSig {
  r: '0x9aecaef6725e8b4ed649bd98a0227927b032916c196d4958efe612a119ca19b6',
  s: '0x7d8f1bd025016d5e44792db8cde090371813504ec738a9f81a2c960e6b9596a1',
  _vs: '0xfd8f1bd025016d5e44792db8cde090371813504ec738a9f81a2c960e6b9596a1',
  recoveryParam: 1,
  v: 28,
  yParityAndS: '0xfd8f1bd025016d5e44792db8cde090371813504ec738a9f81a2c960e6b9596a1',
  compact: '0x9aecaef6725e8b4ed649bd98a0227927b032916c196d4958efe612a119ca19b6fd8f1bd025016d5e44792db8cde090371813504ec738a9f81a2c960e6b9596a1'
}
uncompressed recoveredPubkey 0x0471446b0a0eecec5609b457e63efee553690ea64ef83ef072d891fc0c0d4261288817c57b26da2db14de88138945bc4da06a51d78f3310a9eca97cd1958ab86e2
compressed recoveredPubkey 0x0271446b0a0eecec5609b457e63efee553690ea64ef83ef072d891fc0c0d426128
recoveredAddress 0x83389DEE667ec64132231DB8d9Ad62ecA3Faa14E
txn 0xf86880852e90edd0008275309450e2dac5e78b5905cb09495547452cee64426db282
glitch003 commented 1 year ago

You have to broadcast the final txn yourself.

Also the ETH wallet probably won't have any gas so the txn won't go through. I recommend getting your own PKP at https://explorer.litprotocol.com/ and then using the resulting Public Key for your publicKey param in the code here: https://github.com/LIT-Protocol/js-serverless-function-test/blob/main/signTxnTest.js#L7

Note that this test is hardcoded to run on the Polygon chain so make sure you fund it with gas on Polygon if you're gonna fund it with gas. You can easily change that by changing the chainId and "chain" param in the getLatestNonce function here https://github.com/LIT-Protocol/js-serverless-function-test/blob/main/signTxnTest.js#L24 and here https://github.com/LIT-Protocol/js-serverless-function-test/blob/main/signTxnTest.js#L15

You should also do a "git pull" on this repo as I just pushed a few fixes to this test. Also I'm not sure why, but this test is taking a really long time to complete right now. Like a full minute. It should take a lot less.

j-labs-xyz commented 1 year ago

Thanks @glitch003 for your help, will follow your advice and let you know how I go.

j-labs-xyz commented 1 year ago

@glitch003

broadcasting txn worked, below is a PR for reference only, no need to merge https://github.com/LIT-Protocol/js-serverless-function-test/pull/4

transactions can be viewed in the explorer https://mumbai.polygonscan.com/address/0x535b0dABaF59c90EeeBEf272b5F778C5369a1445