Open notlesh opened 3 years ago
@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)?
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)
@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
@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
@jacogr When trying to test https://github.com/polkadot-js/tools/pull/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'
}
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)
The above is hopeful fixed in master
Are you refering to ES module error or Ethereum singing itself? @jacogr
ES module error as described.
Unfortunately this https://github.com/polkadot-js/tools/issues/239 is still a thing
While the api supports ethereum signatures (e.g. https://github.com/polkadot-js/api/issues/2499), the CLI does not accept anything other than
sr25519
ored25519
.