提问人:Tiny 提问时间:4/1/2022 最后编辑:herrtimTiny 更新时间:5/26/2022 访问量:362
如何在 react native 钱包中使用 github 的 kadena-io/cardano-crypto.js 助记词
How to use github's kadena-io/cardano-crypto.js mnemonic in react native wallet
问:
我想使用 github 的 kadena-io/cardano-crypto.js.This is the cardano-crypto.js 链接: https://github.com/kadena-io/cardano-crypto.js.但是使用时是错误的。我已经尝试了很多方法来修复错误,但它不起作用。要在 cardano-crypto.js 中获取 lib.js 文件,首先我必须安装 npm。我做到了。然后是 lib.js 文件。然后我尝试将 cardano-crypto.js 的 mnemonicToRootKeyPair 函数导入我的 react-native 钱包。但是有一个错误。为了解决错误,首先我尝试使用节点模块导入 cardano-crypto.js。然后我尝试在没有node_module的情况下导入。我以多种方式导入。
从“path”导入 {}
,
_importDefault (require ('path'))
.但不知何故,Cardano-crypto.js的助记词ToRootKeyPair无法运行/导入。错误提示 lib.js:找不到路径。但是 lib.js 文件就在那里。现在我该如何解决这个问题:如何在我们的 react 原生钱包中使用 cardano-crypto.js 的 mnemonicToRootKeyPair?
这是我想使用的 cardano-crypto.js 助记符ToRootKeyPair函数代码:
async function mnemonicToRootKeypair(mnemonic, derivationScheme) {
validateDerivationScheme(derivationScheme)
if (derivationScheme === 1) {
return mnemonicToRootKeypairV1(mnemonic)
} else if (derivationScheme === 2) {
return mnemonicToRootKeypairV2(mnemonic, '')
} else {
throw Error(`Derivation scheme ${derivationScheme} not implemented`)
}
}
这是我在react原生钱包中使用该函数时的错误: 构建 JavaScript 包失败。 无法从 C:\Users\DCL\Desktop\app\cardanoCrypto\lib.js 解析模块路径:在项目中找不到路径。
答: 暂无答案
上一个:尝试使用递归解决数字到助记符问题
下一个:gcc -E 选项代表什么?
评论