cita-sdk-js icon indicating copy to clipboard operation
cita-sdk-js copied to clipboard

How to use cita-sdk-js in wechat-mini-program?

Open clearloop opened this issue 6 years ago • 3 comments

Tried two ways to import cita-sdk into wechat-mini-program:

bundle.js

require('../miniprogram_npm/@cryptape/cita-sdk/lib/bundle.js');
...
VM12449:1 thirdScriptError 
 sdk uncaught third Error 
 module "miniprogram_npm/@cryptape/cita-sdk/lib/bundle.js" is not defined 
 Error: module "miniprogram_npm/@cryptape/cita-sdk/lib/bundle.js" is not defined
...

miniprogram_npm

const CITASDK = require('@cryptape/cita-sdk');
...
 sdk uncaught third Error 
 module "miniprogram_npm/@cryptape/cita-sdk/web3" is not defined 
 Error: module "miniprogram_npm/@cryptape/cita-sdk/web3" is not defined
  • My Debug base library's version is 2.6.6
  • Both cita-sdk-js and wechat-developer-tools are the lastest

note

I saw node-gyp compiled while installing web3 and wechat-mini-program doesn't support c++ addon, if we can't use web3 in wechat-mini-program?

clearloop avatar Apr 21 '19 13:04 clearloop

https://github.com/NervJS/taro/issues/2851

juzhiyuan avatar Apr 22 '19 15:04 juzhiyuan

I've not tried yet, but the bundle.js attach the SDK to window, which doesn't exist in mini-program.

I'll work on it in several days.

Keith-CY avatar Apr 23 '19 03:04 Keith-CY

@Keith-CY Tks :)

cc @tiannian

juzhiyuan avatar Apr 23 '19 07:04 juzhiyuan