Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Dojo
bip47-js
Commits
b6335772
Commit
b6335772
authored
Jan 16, 2021
by
kenshin-samourai
Browse files
fix derivation of payment code fom a seed for testnet
parent
bbd7fe54
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
+5
-2
src/payment-code.js
src/payment-code.js
+4
-2
test/index.js
test/index.js
+1
-0
No files found.
src/payment-code.js
View file @
b6335772
...
...
@@ -26,9 +26,11 @@ class PaymentCode {
}
static
fromSeed
(
bSeed
,
id
,
network
)
{
var
reserved
=
Buffer
.
alloc
(
13
,
0
);
network
=
network
||
networks
.
bitcoin
;
const
reserved
=
Buffer
.
alloc
(
13
,
0
);
const
root
=
fromSeed
(
bSeed
);
const
root_bip47
=
root
.
derivePath
(
`m/47'/0'/
${
id
}
'`
);
const
coinType
=
(
network
.
pubKeyHash
==
networks
.
bitcoin
.
pubKeyHash
)
?
'
0
'
:
'
1
'
;
const
root_bip47
=
root
.
derivePath
(
`m/47'/
${
coinType
}
'/
${
id
}
'`
);
let
pc
=
Buffer
.
from
(
'
0100
'
,
'
hex
'
);
// version + options
pc
=
Buffer
.
concat
([
pc
,
root_bip47
.
publicKey
]);
...
...
test/index.js
View file @
b6335772
...
...
@@ -83,6 +83,7 @@ describe('payment-code', function() {
const
pc_b58
=
pc
.
toBase58
();
assert
(
pc_b58
==
PC_2
.
pcBase58
);
}
catch
(
e
)
{
console
.
log
(
e
)
assert
(
false
);
}
});
...
...
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