on master help sign in
point-ux: update Passport based on selected point
commit3196385a0cdccc2cb172d8c3a11bfac342b05db6 authortomholford <tomholford@users.noreply.github.com> dateMon 8 Nov 2021, 20:03 (5 years ago) parentbe52b33
1 file changed+8−6
src/components/Passport.js+8−6
src/components/Passport.js+8−6
@@ -48,13 +48,15 @@ function Passport({
4848
4949 const patp = ob.patp(point.value);
5050
51− const makeMatrix = addr => {
52− // remove the 0x
53− const onlyTheNumberPart = addr.substring(2);
51+ const makeMatrix = azimuthPoint => {
52+ // convert point to hex
53+ const azimuthPointHex = azimuthPoint.toString(16);
54+
5455 // make bigNum from hex
55− const int = new BN(onlyTheNumberPart, 16);
56+ const int = new BN(azimuthPointHex, 16);
57+
5658 // make a bigger number
57− const big = int.pow(new BN(10));
59+ const big = int.pow(new BN(100));
5860 // parse that to a string and pad
5961 const b10 = big.toString(10).padStart(32, '0');
6062 // split the big number into parts
@@ -71,7 +73,7 @@ function Passport({
7173 return matrix;
7274 };
7375
74− const matrix = address.matchWith({
76+ const matrix = point.matchWith({
7577 Just: ({ value }) => makeMatrix(value),
7678 Nothing: defaultMatrix,
7779 });