Skip to content
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

generateKeyPair fails & hangs #80

Open
willsmillie opened this issue Dec 20, 2023 · 2 comments
Open

generateKeyPair fails & hangs #80

willsmillie opened this issue Dec 20, 2023 · 2 comments

Comments

@willsmillie
Copy link

Hi,

I've seen an increase in reports in the discord regarding issues with the generateKeyPair with newer releases of the sdk and NodeJS

I tried going back thru previous releases:

3.8.0 & prior give me ERR_REQUIRE_ESM errors.

3.4.0 works but still hangs.

here is the error for the most recent release (3.8.13):


personalSign -> counterFactualInfo undefined keySeed Sign this message to access Loopring Exchange: 0x12b7cccF30ba360e5041C6Ce239C9a188B709b2B with key nonce: 0 walletType Unknown publicKey from sever side  undefined
IsMobile any navigator is undefined
ecRecover before msg Sign this message to access Loopring Exchange: 0x12b7cccF30ba360e5041C6Ce239C9a188B709b2B with key nonce: 0 result 0x85bcef87ba0f75ed55ce80e91557baedc3ec04d42341c5c234f18bab993207217545b8f068598f1927d4bdbdb6dfed3f90d4b602d05d01ba6a014e667a9a12ab1c undefined
Valid: 3. contractWallet before
web3.eth.personal.sign Valid, valid 5 ways, all failed!
generateKeyPair personalSign error web3.eth.personal.sign Valid, valid 5 ways, all failed!
Error: Error: web3.eth.personal.sign Valid, valid 5 ways, all failed!
    at Object.gr [as generateKeyPair] (/Users/willsmillie/Downloads/test_project/node_modules/@loopring-web/loopring-sdk/dist/index.cjs:1:62250)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async signatureKeyPairMock (/Users/willsmillie/Downloads/test_project/test.js:32:20)
    at async authenticate (/Users/willsmillie/Downloads/test_project/test.js:64:22)

my implementation:


const signatureKeyPairMock = async (accInfo, exchangeAddress) => {
  // initialize provider
  const provider = new PrivateKeyProvider(
    ETH_ACCOUNT_PRIVATE_KEY,
    `https://goerli.infura.io/v3/${INFURA_PROJECT_ID}`
  );
  
  const web3 = new Web3(provider);
  const keySeed =
    accInfo.keySeed ||
    sdk.GlobalAPI.KEY_MESSAGE.replace(
      "${exchangeAddress}",
      exchangeAddress
    ).replace("${nonce}", (accInfo.nonce - 1).toString());

  const eddsaKey = await sdk.generateKeyPair({
    web3,
    address: accInfo.owner,
    keySeed,
    walletType: sdk.ConnectorNames.Unknown,
    chainId: parseInt(CHAIN_ID, 10),
  });

  return eddsaKey;
};

@Alan-Cn
Copy link

Alan-Cn commented Dec 25, 2023

Is error at here
image
I have the same error, and I need a new version to fix the error.
and please delete the type: 'module' at package.json

@Alan-Cn
Copy link

Alan-Cn commented Dec 29, 2023

I published a new version, you can try it.
It`s loopring-fix-web-sdk.
pls use require
const {
ChainId,
UserAPI,
ExchangeAPI,
GlobalAPI,
generateKeyPair,
ConnectorNames,
RESULT_INFO,
} = require("loopring-fix-web-sdk");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants