1

我正在尝试创建一个钱包来在 wave 平台上保存新创建的硬币。

Metro Bundler 遇到内部错误,请检查您的终端错误输出以获取更多详细信息在尝试crypto从文件解析模块时,已成功找到C:\Users\El\.expo\bandzWallet\node_modules\@waves\waves-crypto\random.js该包。C:\Users\El\.expo\bandzWallet\node_modules\crypto\package.json但是,这个包本身指定了一个main无法解析的模块字段(C:\Users\El\.expo\bandzWallet\node_modules\crypto\index.js。事实上,这些文件都不存在:

  • C:\Users\El\.expo\bandzWallet\node_modules\crypto\index.js(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)
  • C:\Users\El\.expo\bandzWallet\node_modules\crypto\index.js\index(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx) 构建 JavaScript 包失败。无法读取未定义的属性“状态”

    “使用严格”;Object.defineProperty(exports, "__esModule", { value: true }); const random = (count) => { if (isBrowser) { const arr = new Uint8Array(count); const crypto = (global.crypto || global.msCrypto); crypto.getRandomValues(arr); 返回 arr;} const crypto = 要求('crypto'); 返回 Uint8Array.from(crypto.randomBytes(count)); }; const ensureBuffer = () => { try { const b = new Buffer(1); } catch (e) { throw new Error('此环境不支持缓冲区。使用 Node.js 或 Browserify 来支持浏览器。'); } }; const isBrowser = typeof window !== 'undefined' && ({}).toString.call(window) === '[object Window]'; export.secureRandom = (count, type) => { switch (type) { case ' Array8':返回 Array.from(random(count)); case 'Array16': return Array.from(exports.secureRandom(count, 'Uint16Array')); case 'Array32': return Array.from(exports.secureRandom(count, 'Uint32Array')); 案例“缓冲区”:确保缓冲区();return Buffer.from(random(count)); 案例“Uint8Array”:返回随机数(计数);case 'Uint16Array': return new Uint16Array(count) .map(_ => random(2).reduce((a, b, i) => a | b << 8 * (1 - i), 0)); case 'Uint32Array': return new Uint32Array(count) .map(_ => random(4).reduce((a, b, i) => a | b << 8 * (1 - i), 0)); 默认:throw new Error(type + ' is unsupported.'); } }; //# sourceMappingURL=random.js.map

我正在尝试使用 @waves/waves-crypto 在测试网上创建一个钱包 adderss 和种子。

我正在使用 React Native 和 Expo cli

4

0 回答 0