-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Less strict parsing for loose providers.
- Loading branch information
Showing
4 changed files
with
114 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
'use strict'; | ||
|
||
// Temporary test case for TestRPC woes; this will go away in the future and | ||
// is meant to help test loosely compliant backends | ||
// | ||
// See: https://github.com/ethers-io/ethers.js/issues/45 | ||
// | ||
// Please run `npm install ethereumjs-testrpc` before using this testcase | ||
|
||
var TestRPC = require("ethereumjs-testrpc"); | ||
|
||
var providers = require('../providers'); | ||
var Wallet = require('../wallet/wallet'); | ||
|
||
var port = 18545; | ||
|
||
var privateKey = '0x0123456789012345678901234567890123456789012345678901234567890123'; | ||
|
||
var server = TestRPC.server({ | ||
accounts: [ { secretKey: privateKey } ] | ||
}); | ||
|
||
server.listen(port, function(err, blockchain) { | ||
|
||
var provider = new providers.JsonRpcProvider('http://localhost:' + port, 'unspecified'); | ||
|
||
var wallet = new Wallet(privateKey, provider); | ||
|
||
var sendPromise = wallet.sendTransaction({ | ||
to: wallet.address, | ||
value: 1, | ||
gasLimit: 21000, | ||
gasPrice: 100000000000 | ||
}); | ||
|
||
sendPromise.then(function(tx) { | ||
console.log('Send', tx); | ||
return provider.getTransaction(tx.hash).then(function(tx) { | ||
console.log('Get', tx); | ||
}); | ||
}).catch(function (error) { | ||
console.log(error); | ||
|
||
}).then(function() { | ||
server.close(); | ||
}); | ||
}); | ||
|
Oops, something went wrong.