Issues with SDK8.0.0

WeTrue UI found a problem when upgrading JS SDK8.0.

It only supports upgrades from 7.7.0 to 8.0.0

Installing 8.0.0 directly will cause an error.

After the 8.0.0 upgrade, it was indicated that the Swagger dependency was missing and that it existed on the native machine.

2 Likes

Hey! What exact error do you have when installing new sdk directly? Maybe you can share console output?

After the 8.0.0 upgrade, it was indicated that the Swagger dependency was missing and that it existed on the native machine.

Use genSwaggerClient instead, it is exported at the root path (import { genSwaggerClient } from '@aeternity/aepp-sdk'). Here it’s arguments: https://github.com/aeternity/aepp-sdk-js/blob/218d50eec30e0d6f8b12d749b78b931018e97bde/src/utils/swagger.js#L29-L43

2 Likes

I upgraded 8.1.0 and tried everything I could find. The problem remained unsolved.
It now has the following error.

[tsl] ERROR in E:\team\vue\wetrue\h5\[email protected]\aepp-sdk\src\utils\crypto-ts.ts(19,13)
TS1005: ‘=’ expected.
[tsl] ERROR in E:\team\vue\wetrue\h5\[email protected]\aepp-sdk\src\utils\crypto-ts.ts(19,27)
TS1005: ‘;’ expected.

At present, the browser is reporting the following error. What is the reason for this?

Uncaught ReferenceError: require is not defined
at Module.E:\team\vue\wetrue\h5\node_modules\fast-json-patch\index.mjs (chunk-vendors.js:123172)
at webpack_require (index.js:854)
at fn (index.js:151)
at Object.E:\team\vue\wetrue\h5\node_modules\swagger-client\es\specmap\lib\index.js (chunk-vendors.js:165170)
at webpack_require (index.js:854)
at fn (index.js:151)
at Object.E:\team\vue\wetrue\h5\node_modules\swagger-client\es\specmap\index.js (chunk-vendors.js:164280)
at webpack_require (index.js:854)
at fn (index.js:151)
at Object.E:\team\vue\wetrue\h5\node_modules\swagger-client\es\resolver.js (chunk-vendors.js:164052)

[tsl] ERROR in E:\team\vue\wetrue\h5\[email protected]\aepp-sdk\src\utils\crypto-ts.ts(19,13)
TS1005: ‘=’ expected.

Are you sure you need to import SDK from src folder? I’ve left it for advanced use cases because I’m not sure that the package is transpiled and polyfilled the best way (in es folder).

In general, you should es version or the one in dist folder. es is enabled automatically if it is supported by your build environment, so sdk should be imported just as import { ... } from '@aeternity/aepp-sdk'; (except for es/utills/aepp-wallet-communication/..., will fix it later). Also please disable transpilation/building of sdk on your side because we are doing it by ourselves now.

Uncaught ReferenceError: require is not defined
at Module.E:\team\vue\wetrue\h5\node_modules\fast-json-patch\index.mjs (chunk-vendors.js:123172)

fast-json-patch is required by swagger-client, can’t say a lot about it. Probably the issue is related to your build system. We weren’t able to reproduce anything like this, can you create a reproduction with your build configuration?

1 Like

I don’t know how to operate it…
How can I disable translation/build of the SDK

Vue.js development framework for my project uni-app.
Use HBuilderX to package the app.
Below I will list the relevant addresses, as well as the project Github address, can you help me check it out if you are free?

https://www.dcloud.io/hbuilderx.html

1 Like

I can import it normally
import * as Keystore from '@aeternity/aepp-sdk/es/utils/keystore';
It can generate mnemonic words and create ak_ address normally.
But these 3 I import immediately report error.

 import Node from '@aeternity/aepp-sdk/es/node';
 import MemoryAccount from '@aeternity/aepp-sdk/es/account/memory';
 import Universal from '@aeternity/aepp-sdk/es/ae/universal';

I’m trying to import aepp-sdk.browser-script.js under dist.
I sent a transfer and it reported an error:
TypeError: (0 , t.encode) is not a function

await client.spend(1, "ak_dMyzpooJ4oGnBVX35SCvHspJrq55HAAupCwPQTDZmRDT5SSSW")

I have found the cause, it is caused by the Uni-App framework, but there is no solution. Unless I abandon the project and rewrite the code.

Well, I have checked all of it.

TypeError: (0 , t.encode) is not a function

I’m confirming this one. The aepp-sdk.browser-script.js is broken now, I have made a PR with a fix: Fix and make smaller browser script by davidyuk · Pull Request #1209 · aeternity/aepp-sdk-js · GitHub We will release it probably at the beginning of next week. This should be an acceptable way to use sdk in your project (wihtout changing the build system).

can you help me check it out if you are free?

I have installed HBuilderX, and almost runned your project there, but as I got I have to create an accaunt to install SASS plugin :woman_shrugging: Anyway I can’t help with it because I wasn’t able to switch its UI to english and find docs that I can understand.

Unless I abandon the project and rewrite the code.

As I got, Uni-App uses vue cli under the hood, I would propose to switch to it.

3 Likes

HX has compilation issues, I have completed the UNI-CLI migration and it is now running fine.

3 Likes

@LiuShao this is fixed now with the latest release v8.2.0

2 Likes