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

docs: warn about incompatibility with strictFunctionTypes #1794

Merged
merged 2 commits into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ This may be done in `tsconfig.json`:
```
SDK uses modern features available since [email protected]. Though SDK is still compatible with [email protected] and above using types generated separately, but these types are less accurate.

Ensure that you have `strictFunctionTypes` option not enabled (as it is in VS code and `ts-node` by default), otherwise some of SDK types won't work correctly (see [#1793](https://github.com/aeternity/aepp-sdk-js/issues/1793)).

### Vue CLI@4
SDK checks are not working correctly because CLI picks both ESM and CJS versions of `autorest`
dependencies. To fix this, you need to specify aliases in `vue.config.js`.
Expand Down
8 changes: 7 additions & 1 deletion test/integration/accounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {
AeSdk, MemoryAccount,
generateKeyPair, AE_AMOUNT_FORMATS,
UnavailableAccountError, TypeError, ArgumentError, UnexpectedTsError,
encode, Encoding, Encoded,
} from '../../src';
import { Encoded } from '../../src/utils/encoder';

describe('Accounts', () => {
let aeSdk: AeSdk;
Expand Down Expand Up @@ -121,6 +121,12 @@ describe('Accounts', () => {
ret.tx.should.include({ amount: bigAmount, recipientId: publicKey });
});

it('spends with a payload', async () => {
const payload = encode(Buffer.from([1, 2, 3, 4]), Encoding.Bytearray);
const { tx } = await aeSdk.spend(1, receiver.address, { payload });
expect(tx?.payload).to.be.equal('ba_AQIDBI3kcuI=');
});

it('Get Account by block height/hash', async () => {
await aeSdk.awaitHeight(await aeSdk.getHeight() + 3);
const spend = await aeSdk.spend(123, 'ak_DMNCzsVoZnpV5fe8FTQnNsTfQ48YM5C3WbHPsJyHjAuTXebFi');
Expand Down