javascript - 类型错误 : Cannot read property 'name' of null when creating new wallet

标签 javascript node.js coinbase-api

我正在使用文档中给出的代码来创建一个新钱包,它说我收到了一个:TypeError: Cannot read property 'name' of null 错误。

我的代码如下:

var Client = require('coinbase').Client;

// blank intentionally, but completed actually
var client = new Client({
    'apiKey': '',
    'apiSecret': '',
});

client.createAccount({'name': 'New Wallet'}, function(err, acct) {
    console.log(acct.name + ': ' + acct.balance.amount + ' ' + acct.balance.currency);
});

我做错了什么?

最佳答案

acct 为空,可能是因为 createAccount 给你一个错误。尝试

if(err){
 //handle err
 console.log(err)
}

这应该提供有关正在发生的事情的更多信息

关于javascript - 类型错误 : Cannot read property 'name' of null when creating new wallet,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50683539/

相关文章:

javascript - 全日历 : trouble rendering events with ajax when pressing 'prev' or 'next'

javascript - 获取 HTMLTableObject 的每个值

javascript - 我可以只在我的 HTML 标签上添加属性吗?

node.js - Node : string manipulation

javascript - Flash -/路线未加载

php - Coinbase API 未触发通知 URL

java - 尝试调用 Coinbase API 端点时,我收到 "invalid signature"错误

Javascript代码用于计算对象内两个不同变量的元素组合的出现次数

node.js - mongodb更新和$set覆盖文档

javascript - Node JS 和 Coinbase