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

type for field payload missing from spend method options #1791

Closed
subhod-i opened this issue Apr 18, 2023 · 3 comments
Closed

type for field payload missing from spend method options #1791

subhod-i opened this issue Apr 18, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@subhod-i
Copy link
Collaborator

The third parameter to the spend method doesn't accept the payload field. Typescript complains.
In JS, spend does accept payload and I can see the payload string in the explorer.

  • SDK Version: v13.0.0
@subhod-i subhod-i added the bug Something isn't working label Apr 18, 2023
@davidyuk davidyuk added this to the v13.0.1 milestone Apr 21, 2023
@davidyuk
Copy link
Member

Probably it is because you have strictFunctionTypes options enabled, sdk is not compatible with it right now #1793

I've created a new project to reproduce this error using plain typescript

./src/main.ts

import { Node, AeSdk, MemoryAccount } from '@aeternity/aepp-sdk';
  
const node = new Node('https://testnet.aeternity.io');
const aeSdk = new AeSdk({
  nodes: [{ name: 'testnet', instance: node }],
  accounts: [
    new MemoryAccount('9ebd7beda0c79af72a42ece3821a56eff16359b6df376cf049aee995565f022f840c974b97164776454ba119d84edc4d6058a8dec92b6edc578ab2d30b4c4200'),
  ],
});

(async () => {
  await aeSdk.spend(1, aeSdk.address, { payload: 'ba_test' });
})();
$ npm init
$ npm i typescript@4 
$ npx tsc ./src/main.ts --target es2015 --moduleResolution node --allowSyntheticDefaultImports true

And it works, but VS code was showing the payload error you have. I've created jsconfig.json as suggested by VS code and it still was not working until I commented out "strictFunctionTypes": true.

@subhod-i
Copy link
Collaborator Author

Probably it is because you have strictFunctionTypes options enabled, sdk is not compatible with it right now #1793

Instead of the warning in the docs, it would be nice to have strict types for the options as we know in real life what are options expected for each method. Anyway, It's nice to have them in the docs, but #1794 wouldn't close this issue. Let's keep this open till the SDK is compatible.

@davidyuk
Copy link
Member

It is relatively big effort to do, I've opened #1793 to track this issue.

@davidyuk davidyuk removed this from the v13.0.1 milestone Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants