on master help sign in
Always use lib/patp2dec in place of ob.patp2dec
5580cb6Fang
src/lib/lib.js+2−1
@@ -1,4 +1,5 @@
1import * as ob from 'urbit-ob';
1import * as ob from 'urbit-ob';
2+import patp2dec from './patp2dec';
2
3
3const compose = (...fs) =>
4const compose = (...fs) =>
4 fs.reduceRight((pF, nF) => (...args) => nF(pF(...args)), v => v);
5 fs.reduceRight((pF, nF) => (...args) => nF(pF(...args)), v => v);
@@ -18,7 +19,7 @@ const fill = (n, v) => Array.from(Array(n), () => v);
18const isValidGalaxy = name => {
19const isValidGalaxy = name => {
19 let point;
20 let point;
20 try {
21 try {
21− point = parseInt(ob.patp2dec(name), 10);
22+ point = patp2dec(name);
22 } catch (err) {
23 } catch (err) {
23 return false;
24 return false;
24 }
25 }
src/lib/txn.js+2−2
@@ -1,4 +1,3 @@
1−import * as ob from 'urbit-ob';
2import Tx from 'ethereumjs-tx';
1import Tx from 'ethereumjs-tx';
3import { toWei, fromWei, toHex } from 'web3-utils';
2import { toWei, fromWei, toHex } from 'web3-utils';
4import retry from 'async-retry';
3import retry from 'async-retry';
@@ -8,6 +7,7 @@ import { ledgerSignTransaction } from './ledger';
8import { trezorSignTransaction } from './trezor';
7import { trezorSignTransaction } from './trezor';
9import { WALLET_TYPES, addHexPrefix } from './wallet';
8import { WALLET_TYPES, addHexPrefix } from './wallet';
10import { CHECK_BLOCK_EVERY_MS } from './constants';
9import { CHECK_BLOCK_EVERY_MS } from './constants';
10+import patp2dec from './patp2dec';
11
11
12const RETRY_OPTIONS = {
12const RETRY_OPTIONS = {
13 retries: 99999,
13 retries: 99999,
@@ -177,7 +177,7 @@ const getTxnInfo = async (web3, addr) => {
177// TODO(shrugs): deprecate, unifiy with other callsites
177// TODO(shrugs): deprecate, unifiy with other callsites
178const canDecodePatp = p => {
178const canDecodePatp = p => {
179 try {
179 try {
180− ob.patp2dec(p);
180+ patp2dec(p);
181 return true;
181 return true;
182 } catch (_) {
182 } catch (_) {
183 return false;
183 return false;
src/views/Login/Ticket.js+4−3
@@ -20,6 +20,7 @@ import * as need from 'lib/need';
20import { WALLET_TYPES, urbitWalletFromTicket } from 'lib/wallet';
20import { WALLET_TYPES, urbitWalletFromTicket } from 'lib/wallet';
21import useImpliedPoint from 'lib/useImpliedPoint';
21import useImpliedPoint from 'lib/useImpliedPoint';
22import useLoginView from 'lib/useLoginView';
22import useLoginView from 'lib/useLoginView';
23+import patp2dec from 'lib/patp2dec';
23
24
24export default function Ticket({ className }) {
25export default function Ticket({ className }) {
25 useLoginView(WALLET_TYPES.TICKET);
26 useLoginView(WALLET_TYPES.TICKET);
@@ -100,7 +101,7 @@ export default function Ticket({ className }) {
100 }
101 }
101
102
102 const _contracts = need.contracts(contracts);
103 const _contracts = need.contracts(contracts);
103− const point = ob.patp2dec(pointName);
104+ const point = patp2dec(pointName);
104 const urbitWallet = await urbitWalletFromTicket(ticket, point, passphrase);
105 const urbitWallet = await urbitWalletFromTicket(ticket, point, passphrase);
105 const [isOwner, isTransferProxy] = await Promise.all([
106 const [isOwner, isTransferProxy] = await Promise.all([
106 azimuth.azimuth.isOwner(
107 azimuth.azimuth.isOwner(
@@ -123,7 +124,7 @@ export default function Ticket({ className }) {
123 }
124 }
124
125
125 setUrbitWallet(Just(urbitWallet));
126 setUrbitWallet(Just(urbitWallet));
126− setPointCursor(Just(ob.patp2dec(pointName)));
127+ setPointCursor(Just(point));
127 setDeriving(false);
128 setDeriving(false);
128 }, [
129 }, [
129 pointName,
130 pointName,
@@ -142,7 +143,7 @@ export default function Ticket({ className }) {
142
143
143 try {
144 try {
144 const ticket = kg.combine([s1, s2, s3]);
145 const ticket = kg.combine([s1, s2, s3]);
145− const point = ob.patp2dec(pointName);
146+ const point = patp2dec(pointName);
146 const uhdw = await urbitWalletFromTicket(ticket, point, passphrase);
147 const uhdw = await urbitWalletFromTicket(ticket, point, passphrase);
147 setUrbitWallet(Just(uhdw));
148 setUrbitWallet(Just(uhdw));
148 } catch (_) {
149 } catch (_) {