on master help sign in
point-ux: update Passport based on selected point
3196385tomholford
src/components/Passport.js+8−6
@@ -48,13 +48,15 @@ function Passport({
48
48
49 const patp = ob.patp(point.value);
49 const patp = ob.patp(point.value);
50
50
51− const makeMatrix = addr => {
51+ const makeMatrix = azimuthPoint => {
52− // remove the 0x
52+ // convert point to hex
53− const onlyTheNumberPart = addr.substring(2);
53+ const azimuthPointHex = azimuthPoint.toString(16);
54+
54 // make bigNum from hex
55 // make bigNum from hex
55− const int = new BN(onlyTheNumberPart, 16);
56+ const int = new BN(azimuthPointHex, 16);
57+
56 // make a bigger number
58 // make a bigger number
57− const big = int.pow(new BN(10));
59+ const big = int.pow(new BN(100));
58 // parse that to a string and pad
60 // parse that to a string and pad
59 const b10 = big.toString(10).padStart(32, '0');
61 const b10 = big.toString(10).padStart(32, '0');
60 // split the big number into parts
62 // split the big number into parts
@@ -71,7 +73,7 @@ function Passport({
71 return matrix;
73 return matrix;
72 };
74 };
73
75
74− const matrix = address.matchWith({
76+ const matrix = point.matchWith({
75 Just: ({ value }) => makeMatrix(value),
77 Just: ({ value }) => makeMatrix(value),
76 Nothing: defaultMatrix,
78 Nothing: defaultMatrix,
77 });
79 });