From a7e95839614a75eb019552bab1a986d207d2fcfd Mon Sep 17 00:00:00 2001 From: Denis Davidyuk Date: Fri, 21 Apr 2023 19:13:43 +0700 Subject: [PATCH 1/2] docs: warn about incompatibility with `strictFunctionTypes` --- docs/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/README.md b/docs/README.md index b602f20822..2c6bb44994 100644 --- a/docs/README.md +++ b/docs/README.md @@ -82,6 +82,8 @@ This may be done in `tsconfig.json`: ``` SDK uses modern features available since typescript@4.7. Though SDK is still compatible with typescript@4.1 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`. From 68ccbae82822a3c627f24f11951e357e669a4210 Mon Sep 17 00:00:00 2001 From: Denis Davidyuk Date: Fri, 21 Apr 2023 19:43:35 +0700 Subject: [PATCH 2/2] test(account): `spend` with `payload` --- test/integration/accounts.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/integration/accounts.ts b/test/integration/accounts.ts index fa10a48d7f..899d365b9f 100644 --- a/test/integration/accounts.ts +++ b/test/integration/accounts.ts @@ -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; @@ -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');