Commit graph

52 commits

Author SHA1 Message Date
Daniel Cousens
0468c4710c Transaction: rename (de)serialize to [to/from]Buffer 2014-05-17 00:09:13 +10:00
Daniel Cousens
6c0eebe94b tests: use filepaths directly
After a long IRC discussion, it was decided that the use of direct
filepaths instead of the module is a more pure form of testing ,
although it may provide less overall coverage than the mixed integration
style imports used previously.

This will need to be remedied by further integration testing in
/test/integration.
2014-05-13 18:05:56 +10:00
Daniel Cousens
7a740c2e7b tests: forces consistent import syntax 2014-05-13 16:46:08 +10:00
Daniel Cousens
708aa03390 Transaction/Script: bitcoin network no longer implied
A Transaction (and its subsequent scripts) do not carry any network
specific information in the Bitcoin protocol.
Therefore they can not (without further context) produce the network
specific constants for the generation of the base58 Addresses.

As TransactionOut.address is used heavily throughout Wallet and other
areas of the library, this could not be entirely removed without a large
number of changes.
For now, TransactionOut.address is only defined in the case of
Tx.addOutput being used directly:

      Transaction.addOutput(address, value)
2014-05-08 10:59:58 +10:00
Daniel Cousens
63231fb67d Extends test for custom Wallet change addresses 2014-05-06 15:40:40 +10:00
Daniel Cousens
a77846701f Fixes network support for TxOut 2014-05-06 15:40:40 +10:00
Daniel Cousens
eba08fa761 Fixes indentation for assertions 2014-05-06 15:40:40 +10:00
Daniel Cousens
d65a3c36e2 Merge pull request #159 from williamcotton/master
fixed issues with testnet and createTx
2014-05-06 08:04:02 +10:00
Daniel Cousens
a8cf2fdd9e Changes internal serialization to use Buffers instead 2014-05-04 17:31:22 +10:00
Daniel Cousens
d17f85f5a6 Changes fakeTxHash to actual hex 2014-05-04 15:37:25 +10:00
William Cotton
8f698d19f7 custom changeAddress has full integration test 2014-04-25 16:30:36 -07:00
William Cotton
dfbfdafc94 added tests for createTx testnet and createTx custom changeAddress 2014-04-25 13:43:26 -07:00
Daniel Cousens
f047afef2d Updates network.js constant names 2014-04-17 05:50:59 +10:00
Daniel Cousens
c99a576fbd Migrates all usage of crypto-js/sha256 to ./crypto 2014-04-08 23:07:46 +10:00
Wei Lu
364a24fd1e assert.throws matches error messages properly 2014-04-02 12:43:34 +08:00
lms
b79ccb2c0c 100% coverage of wallet.js 2014-04-01 21:05:46 +02:00
Daniel Cousens
04684b74f1 Some cosmetic fixes 2014-04-01 15:52:40 +11:00
Wei Lu
93fe1b4c78 cosmetic standardization
[closes #56]
2014-03-31 11:47:47 +08:00
Wei Lu
65fb593be2 remove unnecessary deepEqual 2014-03-26 20:44:07 +08:00
Wei Lu
39c181dce6 allow fee to be set to zero 2014-03-26 20:20:58 +08:00
Wei Lu
4d4388f6bf make wallet async functions truly async 2014-03-26 20:05:13 +08:00
Wei Lu
68b08b638a add async version of createTx 2014-03-26 08:43:33 +08:00
Wei Lu
f7d4895b74 add async version of setUnspentOutputs 2014-03-26 08:43:33 +08:00
Wei Lu
7bfa6ab9d2 remove scriptPubKey from wallet.outputs, set/get unspent outputs as it is unused 2014-03-26 08:43:33 +08:00
Wei Lu
58ab0b631e getBalance returns total unspent 2014-03-26 08:43:33 +08:00
Wei Lu
9fc5505730 getUnspentOutputs excludes spent outputs 2014-03-26 08:43:33 +08:00
Wei Lu
77b5d1ee21 getCandidateOuputs ignores spent outputs 2014-03-26 08:43:33 +08:00
Wei Lu
471bc7ed97 skip change if it is not above dust threshold 2014-03-26 08:43:32 +08:00
Wei Lu
90921798cf throws error on insufficient fund 2014-03-26 08:43:32 +08:00
Wei Lu
7c81bfef72 check for dust before creating transaction 2014-03-26 08:43:32 +08:00
Wei Lu
913b48e87f sign tx 2014-03-26 08:43:32 +08:00
Wei Lu
2dc0f69d00 createTX returns tx with expected inputs and outputs 2014-03-26 08:43:32 +08:00
Wei Lu
e574693594 wallet.outputs[0].output -> wallet.outputs[0].receive
output is overloaded. Considering we have output.spend, output.receive makes sense to me
2014-03-26 08:43:31 +08:00
Wei Lu
dbb5681366 add tests and refactor wallet.processTx 2014-03-26 08:43:31 +08:00
Wei Lu
01dc34d720 throw error when unspent output does not have required keys 2014-03-26 08:42:35 +08:00
Wei Lu
26afbccc98 wallet allows setting unspent outputs 2014-03-26 08:42:35 +08:00
Wei Lu
16dc68cbaa wallet exposes unspent outputs via a getter
also add reverseEndian method to convert
2014-03-26 08:42:35 +08:00
Wei Lu
31cfb11178 new master key resets accounts and addresses 2014-03-16 13:36:57 +08:00
Wei Lu
a7a7999e3f fix Wallet default constructor 2014-03-15 10:18:59 +08:00
Wei Lu
b2f010428f store accounts in closure instead of on object 2014-03-14 10:35:01 +08:00
Wei Lu
207163704b return private key rather than HD wallet node 2014-03-14 10:35:01 +08:00
Wei Lu
9200479159 getPrivateKey derives key on the fly
also added getPrivateKeyFromAddress
2014-03-14 10:35:01 +08:00
Wei Lu
ab9e782d14 private a method to generate change addresses 2014-03-14 10:35:00 +08:00
Wei Lu
1212099bfc Wallet address derivation follows bip32/bitcoinj keychain structure
Also wallet accepts bytes in constructor

[#60]
2014-03-14 10:34:37 +08:00
Wei Lu
2e97828379 throws exception if specified network is unknown
also move network type tests to hdwallet
2014-02-28 17:59:01 +08:00
Wei Lu
02b3a2b564 HDWallet prod -> mainnet 2014-02-28 17:28:03 +08:00
Wei Lu
eaf84c4283 move address versions into network
Also change address type name:
address_types -> addressVersion
p2sh_types -> p2shVersion
prod -> mainnet
2014-02-28 16:58:14 +08:00
Wei Lu
293c864f4f HD wallet versions: Bitcoin -> prod, BitcoinTest -> testnet 2014-02-28 14:27:31 +08:00
Wei Lu
cc0a042f2f squashed commits from #27 2014-02-28 12:05:48 +08:00
Wei Lu
09ee406106 Revert "Merge pull request #27 from xnova/master"
due to broken tests, moved the changes to branch hd-testnet-support

This reverts commit a4ba59e9ba, reversing
changes made to 36d3d6ebaa.
2014-02-28 11:52:19 +08:00