wharfkit / cli

Wharf command line tool to provide code generation and other utilities
1 stars 0 forks source link

generate option does not work properly #15

Closed mchosc closed 12 months ago

mchosc commented 1 year ago

We have a smart contract deployed on Telos testnet (acc: boid) that has actions with . it seems that after running for example:
npx @wharfkit/cli generate boid -u https://telos.testnet.boid.animus.is -f boid-contract.ts

it throws an error regarding typescript parsers and

Detected alien instance of name, this usually means more than one version of @wharfkit/antelope has been included in your bundle.
Detected alien instance of blob, this usually means more than one version of @wharfkit/antelope has been included in your bundle.
Detected alien instance of abi, this usually means more than one version of @wharfkit/antelope has been included in your bundle.
An error occurred while generating the contract code: SyntaxError: Property or signature expected. (23:5)
  21 | }
  22 | export interface ActionNameParams {
> 23 |     account.add: ActionParams.Account.add;
     |     ^
  24 |     account.buy: ActionParams.Account.buy;
  25 |     account.edit: ActionParams.Account.edit;
  26 |     account.free: ActionParams.Account.free;

    loc: { start: { line: 23, column: 5 } },
  codeFrame: '\x1B[0m \x1B[90m 21 |\x1B[39m }\x1B[0m\n' +
    '\x1B[0m \x1B[90m 22 |\x1B[39m \x1B[36mexport\x1B[39m \x1B[36minterface\x1B[39m \x1B[33mActionNameParams\x1B[39m {\x1B[0m\n' +
    '\x1B[0m\x1B[31m\x1B[1m>\x1B[22m\x1B[39m\x1B[90m 23 |\x1B[39m     account\x1B[33m.\x1B[39madd\x1B[33m:\x1B[39m \x1B[33mActionParams\x1B[39m\x1B[33m.\x1B[39m\x1B[33mAccount\x1B[39m\x1B[33m.\x1B[39madd\x1B[33m;\x1B[39m\x1B[0m\n' +
    '\x1B[0m \x1B[90m    |\x1B[39m     \x1B[31m\x1B[1m^\x1B[22m\x1B[39m\x1B[0m\n' +
    '\x1B[0m \x1B[90m 24 |\x1B[39m     account\x1B[33m.\x1B[39mbuy\x1B[33m:\x1B[39m \x1B[33mActionParams\x1B[39m\x1B[33m.\x1B[39m\x1B[33mAccount\x1B[39m\x1B[33m.\x1B[39mbuy\x1B[33m;\x1B[39m\x1B[0m\n' +
    '\x1B[0m \x1B[90m 25 |\x1B[39m     account\x1B[33m.\x1B[39medit\x1B[33m:\x1B[39m \x1B[33mActionParams\x1B[39m\x1B[33m.\x1B[39m\x1B[33mAccount\x1B[39m\x1B[33m.\x1B[39medit\x1B[33m;\x1B[39m\x1B[0m\n' +
    '\x1B[0m \x1B[90m 26 |\x1B[39m     account\x1B[33m.\x1B[39mfree\x1B[33m:\x1B[39m \x1B[33mActionParams\x1B[39m\x1B[33m.\x1B[39m\x1B[33mAccount\x1B[39m\x1B[33m.\x1B[39mfree\x1B[33m;\x1B[39m\x1B[0m'
}
aaroncox commented 1 year ago

We believe this is now resolved as of 1.9.1, if you want to give it a try and let us know.

If you're using npx, just make sure it's actually updated to the latest version. It can be a bit wacky with how it updates, and we're still figuring out best practices, but you can determine the version its running with npx @wharfkit/cli -V.

If it's an old version and refuses to update, this often seems to clear it.

npx clear-npx-cache
mchosc commented 1 year ago

it looks like it has generated the file. I did have some warnings though

"Detected alien instance of name, this usually means more than one version of @wharfkit/antelope has been included in your bundle."

and earlier: warning "@wharfkit/cli > @wharfkit/common@1.1.0" has incorrect peer dependency "@wharfkit/antelope@^0.7.3"

aaroncox commented 12 months ago

I think those should be fixed now too!