Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Crown
bitcore-lib-crown
Commits
dcd53086
Commit
dcd53086
authored
Oct 19, 2018
by
Zhenzhen Zhan
Browse files
Address conversion
parent
ea379135
Changes
1
Hide whitespace changes
Inline
Side-by-side
test/transaction/transaction.js
View file @
dcd53086
...
...
@@ -45,7 +45,7 @@ describe('Transaction', function() {
'
script
'
:
testScript
,
'
satoshis
'
:
testAmount
})
.
to
(
'
mrU9pEmAx26HcbKVrABvgL7AwA5fjNFoDc
'
,
testAmount
-
10000
);
.
to
(
'
tCRWPwado1JJSzcUT4Fdyt46oURu9JM7bBMxj
'
,
testAmount
-
10000
);
it
(
'
can serialize to a plain javascript object
'
,
function
()
{
var
object
=
testTransaction
.
toObject
();
...
...
@@ -58,7 +58,7 @@ describe('Transaction', function() {
it
(
'
will not accept NaN as an amount
'
,
function
()
{
(
function
()
{
var
stringTx
=
new
Transaction
().
to
(
'
mrU9pEmAx26HcbKVrABvgL7AwA5fjNFoDc
'
,
NaN
);
var
stringTx
=
new
Transaction
().
to
(
'
tCRWPwado1JJSzcUT4Fdyt46oURu9JM7bBMxj
'
,
NaN
);
}).
should
.
throw
(
'
Amount is expected to be a positive integer
'
);
});
...
...
@@ -192,7 +192,7 @@ describe('Transaction', function() {
// TODO: Migrate this into a test for inputs
var
fromAddress
=
'
mszYqVnqKoQx4jcTdJXxwKAissE3Jbrrc1
'
;
var
fromAddress
=
'
tCRWRTyf42xgEKGvbMDR8E6MnXyqrSigmmGhF
'
;
var
simpleUtxoWith100000Satoshis
=
{
address
:
fromAddress
,
txId
:
'
a477af6b2667c29670467e4e0728b685ee07b240235771862318e29ddbe58458
'
,
...
...
@@ -202,9 +202,9 @@ describe('Transaction', function() {
};
var
anyoneCanSpendUTXO
=
JSON
.
parse
(
JSON
.
stringify
(
simpleUtxoWith100000Satoshis
));
anyoneCanSpendUTXO
.
script
=
new
Script
().
add
(
'
OP_TRUE
'
);
var
toAddress
=
'
mrU9pEmAx26HcbKVrABvgL7AwA5fjNFoDc
'
;
var
changeAddress
=
'
mgBCJAsvzgT2qNNeXsoECg2uPKrUsZ76up
'
;
var
changeAddressP2SH
=
'
2N7T3TAetJrSCruQ39aNrJvYLhG1LJosujf
'
;
var
toAddress
=
'
tCRWPwado1JJSzcUT4Fdyt46oURu9JM7bBMxj
'
;
var
changeAddress
=
'
tCRWDed7j84M7MMhE7QKhVMd9QAMK5AGitPEd
'
;
var
changeAddressP2SH
=
'
tCRMbkvv71BgyknDPDXKWRsqynRKGf5d6Bjrr
'
;
var
privateKey
=
'
cSBnVM4xvxarwGQuAfQFwqDg9k5tErHUHzgWsEfD4zdwUasvqRVY
'
;
var
private1
=
'
6ce7e97e317d2af16c33db0b9270ec047a91bff3eff8558afb5014afb2bb5976
'
;
var
private2
=
'
c9b26b0f771a0d2dad88a44de90f05f416b3b385ff1d989343005546a0032890
'
;
...
...
@@ -594,7 +594,7 @@ describe('Transaction', function() {
'
script
'
:
testScript
,
'
satoshis
'
:
testAmount
})
.
to
(
'
mrU9pEmAx26HcbKVrABvgL7AwA5fjNFoDc
'
,
testAmount
-
10000
);
.
to
(
'
tCRWPwado1JJSzcUT4Fdyt46oURu9JM7bBMxj
'
,
testAmount
-
10000
);
tx
.
outputs
[
0
].
_satoshis
=
100
;
tx
.
outputs
[
0
].
_satoshisBN
=
new
BN
(
'
fffffffffffffff
'
,
16
);
...
...
@@ -610,7 +610,7 @@ describe('Transaction', function() {
'
script
'
:
testScript
,
'
satoshis
'
:
testAmount
})
.
to
(
'
mrU9pEmAx26HcbKVrABvgL7AwA5fjNFoDc
'
,
testAmount
-
10000
);
.
to
(
'
tCRWPwado1JJSzcUT4Fdyt46oURu9JM7bBMxj
'
,
testAmount
-
10000
);
tx
.
outputs
[
0
].
_satoshis
=
-
100
;
tx
.
outputs
[
0
].
_satoshisBN
=
new
BN
(
-
100
,
10
);
...
...
@@ -627,7 +627,7 @@ describe('Transaction', function() {
'
script
'
:
testScript
,
'
satoshis
'
:
testAmount
})
.
to
(
'
mrU9pEmAx26HcbKVrABvgL7AwA5fjNFoDc
'
,
testAmount
-
10000
);
.
to
(
'
tCRWPwado1JJSzcUT4Fdyt46oURu9JM7bBMxj
'
,
testAmount
-
10000
);
tx
.
toBuffer
=
sinon
.
stub
().
returns
({
length
:
10000000
...
...
@@ -647,7 +647,7 @@ describe('Transaction', function() {
'
script
'
:
testScript
,
'
satoshis
'
:
testAmount
})
.
to
(
'
mrU9pEmAx26HcbKVrABvgL7AwA5fjNFoDc
'
,
testAmount
-
10000
);
.
to
(
'
tCRWPwado1JJSzcUT4Fdyt46oURu9JM7bBMxj
'
,
testAmount
-
10000
);
tx
.
isCoinbase
=
sinon
.
stub
().
returns
(
false
);
tx
.
inputs
[
0
].
isNull
=
sinon
.
stub
().
returns
(
true
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment