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

Add Etherum Signature Support @ CLI #219

Open
notlesh opened this issue Mar 5, 2021 · 9 comments
Open

Add Etherum Signature Support @ CLI #219

notlesh opened this issue Mar 5, 2021 · 9 comments
Milestone

Comments

@notlesh
Copy link

notlesh commented Mar 5, 2021

While the api supports ethereum signatures (e.g. polkadot-js/api#2499), the CLI does not accept anything other than sr25519 or ed25519.

@notlesh notlesh changed the title Add Etherum Signature Support Add Etherum Signature Support @ CLI Mar 5, 2021
@joelamouche
Copy link
Contributor

@jacogr Just to clarify: we want to be able to sign transaction from our dev address, which is generated from a private key or from mnemonic+derivepath, how do we do that from the cli (which only accepts seeds as of now)?

@jacogr
Copy link
Member

jacogr commented Mar 8, 2021

See https://github.com/polkadot-js/tools/blob/master/packages/api-cli/src/api.ts#L208

It should "just work" if this is adjusted and a hex privateKey is passed - https://github.com/polkadot-js/tools/blob/master/packages/api-cli/src/api.ts#L75 (theoretically, types would need to be passed alongside as well)

@joelamouche
Copy link
Contributor

@notlesh Do you mind cloning this branch: https://github.com/PureStake/tools/tree/jlm-add-eth-derivation-to-cli
and then cd api-cli and try using the api with yarn run:api (as explained here https://github.com/PureStake/tools/tree/master/packages/api-cli)
Gerald should be created with either
seed sock milk update focus rotate barely fade car face mechanic mercy/m/44\'/60\'/0\'/0/0
OR '0x070dc3117300011918e26b02176945cc15c3d548cf49fd8418d97f93af699e46
as seed input

@joelamouche
Copy link
Contributor

@notlesh Actually nvm the mnemonic and private key I mentioned above, those aren't for Gerald and I don't know the mnemonic for Gerald

@joelamouche
Copy link
Contributor

@jacogr When trying to test #220 I try to run yarn run:api —ws 30544 query.system.account 0x6Be02d1d3665660d22FF9624b7BE0551ee1Ac91b and I get

internal/modules/cjs/loader.js:1080
      throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
      ^

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /Users/antoineestienne/GitHubRepo/tools/node_modules/@polkadot/x-rxjs/index.js
require() of ES modules is not supported.
require() of /Users/antoineestienne/GitHubRepo/tools/node_modules/@polkadot/x-rxjs/index.js from /Users/antoineestienne/GitHubRepo/tools/node_modules/@polkadot/api/promise/index.cjs is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/antoineestienne/GitHubRepo/tools/node_modules/@polkadot/x-rxjs/package.json.

    at Module._extensions..js (internal/modules/cjs/loader.js:1080:13)
    at Object.newLoader [as .js] (/Users/antoineestienne/GitHubRepo/tools/node_modules/pirates/lib/index.js:104:7)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/Users/antoineestienne/GitHubRepo/tools/node_modules/@polkadot/api/promise/index.cjs:19:14)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32) {
  code: 'ERR_REQUIRE_ESM'
}

@jacogr
Copy link
Member

jacogr commented Apr 12, 2021

The above is hopeful fixed in master. Took me ages to take a look, it has not worked since the update to the 4.x api

(Attempted a fix as part of an unrelated issue where docker was also problematic)

@joelamouche
Copy link
Contributor

joelamouche commented May 18, 2021

The above is hopeful fixed in master

Are you refering to ES module error or Ethereum singing itself? @jacogr

@jacogr
Copy link
Member

jacogr commented Jun 1, 2021

ES module error as described.

@joelamouche
Copy link
Contributor

joelamouche commented Jun 2, 2021

Unfortunately this #239 is still a thing

@jacogr jacogr added this to the todo milestone Mar 14, 2023
@jacogr jacogr removed the -size-xs label Mar 14, 2023
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

3 participants