关于@ waves / waves-transactions库

时间:2019-05-20 04:28:57

标签: wavesplatform

我正在测试https://www.npmjs.com/package/@waves/waves-transactions并安装了npm,并创建了一个简单的事务进行签名并试图在控制台中显示Tx对象,但是显示此错误。

node tx.js
module.js:529
throw err;
^

Error: Cannot find module '@waves/waves-transactions'
at Function.Module._resolveFilename (module.js:527:15)
at Function.Module._load (module.js:476:23)
at Module.require (module.js:568:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/SatoruBito 1/waves-transactions/tx.js:1:84)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module.js:500:3)

代码在tx.js中

const { transfer } = require('@waves/waves-transactions');
const nodeUrl = 'https://nodes.wavesplatform.com';

const seed = "a valid seed phrase";

const signedTranserTx = transfer({
amount: 0.01,
recipient: 'a valid Waves mainet address',
timestamp:Date.now()
}, seed)

console.log(signedTranserTx);

希望对Tx进行签名并显示带有签名的Tx对象

1 个答案:

答案 0 :(得分:1)

问题出在您的节点环境之内,因为您有导入错误。确保已安装软件包,并从项目中require对其进行