小编sam*_*m k的帖子

未处理的拒绝错误:无效的JSON RPC响应:""

我试图在我的ERC20令牌合同上调用一个方法.我正在连接到" https://rinkeby.infura.io/"httpProvider.我可以调用()常量方法,但是当我想通过调用send()函数来改变契约的状态时,我得到了这个提到的错误.如果您认为发布ABI JSON或Solidity合同有帮助,我也可以提供.我认为我的问题纯粹与web3有关.我想我需要签署交易(逻辑上),但web3文档没有提到任何内容.http://web3js.readthedocs.io/en/1.0/web3-eth-contract.html#methods-mymethod-send

这是我得到的错误:

Unhandled rejection Error: Invalid JSON RPC response: ""
at Object.InvalidResponse (/opt/backend/node_modules/web3-core-helpers/src/errors.js:42:16)
at XMLHttpRequest.request.onreadystatechange (/opt/backend/node_modules/web3-providers-http/src/index.js:60:32)
at XMLHttpRequestEventTarget.dispatchEvent (/opt/backend/node_modules/xhr2/lib/xhr2.js:64:18)
at XMLHttpRequest._setReadyState (/opt/backend/node_modules/xhr2/lib/xhr2.js:354:12)
at XMLHttpRequest._onHttpResponseEnd (/opt/backend/node_modules/xhr2/lib/xhr2.js:509:12)
at IncomingMessage.<anonymous> (/opt/backend/node_modules/xhr2/lib/xhr2.js:469:24)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1055:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
From previous event:
at PromiEvent (/opt/backend/node_modules/web3-core-promievent/src/index.js:35:24)
at send (/opt/backend/node_modules/web3-core-method/src/index.js:446:21)
at Object._executeMethod (/opt/backend/node_modules/web3-eth-contract/src/index.js:890:24)
at Object.currencyToken.sendSignUpBonousTokens (/opt/backend/server/common/token/currency-token.js:86:56)
at <anonymous>
Run Code Online (Sandbox Code Playgroud)

从调用此方法:

const Web3 = require('web3');
const Tx = require('ethereumjs-tx');
const …
Run Code Online (Sandbox Code Playgroud)

javascript ethereum solidity web3js web3-donotuse

9
推荐指数
1
解决办法
2438
查看次数

如何在Nuxt(或Vue)中以字符串形式从文本文件中读取内容?

我想阅读我在.vue文件中导入的文本文件的内容,例如import ToS from '~/static/terms-of-service.txt';

我想以字符串形式访问内容。

我该怎么做?

vue-component vuejs2 nuxt.js

2
推荐指数
3
解决办法
4740
查看次数

如何更改UIDatePicker backgroundColor?在Swift 3.0中

我在文本字段中为键盘添加了datePicker.我能够更改datePicker文本颜色甚至它的alpha但我无法更改其backgroundColor,即使该选项是给我的.

我知道UIDatePicker不是很可定制,但由于有一个backgroundColor选项正在给我​​,我很惊讶为什么它不会改变.

有什么想法吗?

这是我的代码:

    datePickerView.backgroundColor = .clear
    datePickerView.setValue(backgroundTint, forKeyPath: "textColor")
    datePickerView.datePickerMode = UIDatePickerMode.date
    inputView.addSubview(datePickerView)
Run Code Online (Sandbox Code Playgroud)

编辑

我在UITableViewCell --->的子类中编写我的代码

导入UIKit

class AgeTableViewCell:UITableViewCell,UITextFieldDelegate {

let maxLength: Int = 10
let ageTextField = ProfileNameUITextField()

override func awakeFromNib() {
    super.awakeFromNib()
    // Initialization code
}

override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
    super.init(style: style, reuseIdentifier: reuseIdentifier)

    self.contentView.addSubview(ageTextField)

    self.contentView.backgroundColor = .clear

    if self.responds(to: #selector(setter: UITableViewCell.separatorInset)) {
        self.separatorInset = UIEdgeInsets.zero
    }
    if self.responds(to:#selector(setter: UIView.layoutMargins)) {
        self.layoutMargins = UIEdgeInsets.zero
    }
    if self.responds(to: #selector(setter: UIView.preservesSuperviewLayoutMargins)) {
        self.preservesSuperviewLayoutMargins = false
    }
} …
Run Code Online (Sandbox Code Playgroud)

uidatepicker ios swift

1
推荐指数
1
解决办法
4393
查看次数