Daniel Cousens
2df790e2ab
Wallet: remove use of hashLittleEndian
11 years ago
Daniel Cousens
bd3690bdc0
Wallet: remove async interface
11 years ago
Daniel Cousens
50e9a09a8c
Wallet: cleanup createTx control flow
Unknowingly this also revealed a subtle bug in the previous
implementation which allowed the creation of transactions even
when no UTXOs existed.
11 years ago
Daniel Cousens
4dd617d5ca
wallet: fix address description typo
11 years ago
Daniel Cousens
8514bbfabd
Address: remove Address.Error
By removing Address.Error, we remove a code smell.
This part of the code base was also not under any form of test.
Test data and tests have therefore been added verifying its behaviour in
both Wallet and Address tests.
11 years ago
Daniel Cousens
0468c4710c
Transaction: rename (de)serialize to [to/from]Buffer
11 years ago
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.
11 years ago
Daniel Cousens
7a740c2e7b
tests: forces consistent import syntax
11 years ago
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)
11 years ago
Daniel Cousens
63231fb67d
Extends test for custom Wallet change addresses
11 years ago
Daniel Cousens
a77846701f
Fixes network support for TxOut
11 years ago
Daniel Cousens
eba08fa761
Fixes indentation for assertions
11 years ago
Daniel Cousens
a8cf2fdd9e
Changes internal serialization to use Buffers instead
11 years ago
Daniel Cousens
d17f85f5a6
Changes fakeTxHash to actual hex
11 years ago
William Cotton
8f698d19f7
custom changeAddress has full integration test
11 years ago
William Cotton
dfbfdafc94
added tests for createTx testnet and createTx custom changeAddress
11 years ago
Daniel Cousens
f047afef2d
Updates network.js constant names
11 years ago
Daniel Cousens
c99a576fbd
Migrates all usage of crypto-js/sha256 to ./crypto
11 years ago
Wei Lu
364a24fd1e
assert.throws matches error messages properly
11 years ago
lms
b79ccb2c0c
100% coverage of wallet.js
11 years ago
Daniel Cousens
04684b74f1
Some cosmetic fixes
11 years ago
Wei Lu
93fe1b4c78
cosmetic standardization
[closes #56 ]
11 years ago
Wei Lu
65fb593be2
remove unnecessary deepEqual
11 years ago
Wei Lu
39c181dce6
allow fee to be set to zero
11 years ago
Wei Lu
4d4388f6bf
make wallet async functions truly async
11 years ago
Wei Lu
68b08b638a
add async version of createTx
11 years ago
Wei Lu
f7d4895b74
add async version of setUnspentOutputs
11 years ago
Wei Lu
7bfa6ab9d2
remove scriptPubKey from wallet.outputs, set/get unspent outputs as it is unused
11 years ago
Wei Lu
58ab0b631e
getBalance returns total unspent
11 years ago
Wei Lu
9fc5505730
getUnspentOutputs excludes spent outputs
11 years ago
Wei Lu
77b5d1ee21
getCandidateOuputs ignores spent outputs
11 years ago
Wei Lu
471bc7ed97
skip change if it is not above dust threshold
11 years ago
Wei Lu
90921798cf
throws error on insufficient fund
11 years ago
Wei Lu
7c81bfef72
check for dust before creating transaction
11 years ago
Wei Lu
913b48e87f
sign tx
11 years ago
Wei Lu
2dc0f69d00
createTX returns tx with expected inputs and outputs
11 years ago
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
11 years ago
Wei Lu
dbb5681366
add tests and refactor wallet.processTx
11 years ago
Wei Lu
01dc34d720
throw error when unspent output does not have required keys
11 years ago
Wei Lu
26afbccc98
wallet allows setting unspent outputs
11 years ago
Wei Lu
16dc68cbaa
wallet exposes unspent outputs via a getter
also add reverseEndian method to convert
11 years ago
Wei Lu
31cfb11178
new master key resets accounts and addresses
11 years ago
Wei Lu
a7a7999e3f
fix Wallet default constructor
11 years ago
Wei Lu
b2f010428f
store accounts in closure instead of on object
11 years ago
Wei Lu
207163704b
return private key rather than HD wallet node
11 years ago
Wei Lu
9200479159
getPrivateKey derives key on the fly
also added getPrivateKeyFromAddress
11 years ago
Wei Lu
ab9e782d14
private a method to generate change addresses
11 years ago
Wei Lu
1212099bfc
Wallet address derivation follows bip32/bitcoinj keychain structure
Also wallet accepts bytes in constructor
[#60 ]
11 years ago
Wei Lu
2e97828379
throws exception if specified network is unknown
also move network type tests to hdwallet
11 years ago
Wei Lu
02b3a2b564
HDWallet prod -> mainnet
11 years ago