on master help sign in
Clean up lib/txn code.
commit483c410962df842c72f191ea2837abe643412715 authorJared Tobin <jared@jtobin.io> dateWed 30 Jan 2019, 05:31 (8 years ago) parent8689d11
1 file changed+1−73
src/lib/txn.js+1−73
src/lib/txn.js+1−73
@@ -12,7 +12,6 @@ import {
1212 addHexPrefix
1313 } from '../lib/wallet'
1414
15−
1615const TXN_PURPOSE = {
1716 SET_MANAGEMENT_PROXY: Symbol('SET_MANAGEMENT_PROXY'),
1817 SET_TRANSFER_PROXY: Symbol('SET_TRANSFER_PROXY'),
@@ -43,35 +42,6 @@ const renderTxnPurpose = (purpose) =>
4342 ? 'cancel this transfer'
4443 : 'perform this transaction'
4544
46−
47−
48−
49−
50−// const createUnsignedTxn = config => {
51−// const {
52−// contracts,
53−// galaxyName,
54−// add,
55−// setTxn
56−// } = config
57−//
58−// const ctrcs = contracts.matchWith({
59−// Just: (cs) => cs.value,
60−// Nothing: () => {
61−// throw BRIDGE_ERROR.MISSING_CONTRACTS
62−// }
63−// })
64−//
65−// const galaxy = parseInt(ob.patp2dec(galaxyName), 10)
66−//
67−// const txn = isValidGalaxy(galaxyName) && isValidAddress(galaxyOwner)
68−// ? Maybe.Just(azimuth.ecliptic.createGalaxy(ctrcs, galaxy, galaxyOwner))
69−// : Maybe.Nothing()
70−//
71−// setTxn(txn)
72−// }
73−
74−
7545const signTransaction = async config => {
7646
7747 let {
@@ -93,9 +63,7 @@ const signTransaction = async config => {
9363
9464 const wal = wallet.matchWith({
9565 Just: (w) => w.value,
96− Nothing: () => {
97− throw BRIDGE_ERROR.MISSING_WALLET
98− }
66+ Nothing: () => { throw BRIDGE_ERROR.MISSING_WALLET }
9967 })
10068
10169 const sec = wal.privateKey
@@ -121,8 +89,6 @@ const signTransaction = async config => {
12189 setStx(Maybe.Just(stx))
12290}
12391
124−
125−
12692const sendSignedTransaction = (web3, stx) => {
12793 const txn = stx.matchWith({
12894 Just: (tx) => tx.value,
@@ -170,28 +136,6 @@ const toHex = dummy.utils.toHex
170136const toWei = dummy.utils.toWei
171137const fromWei = dummy.utils.fromWei
172138
173−
174−// const confirmShipAvailability = (point, contracts) => {
175−//
176−// if (canDecodePatp(point) === true) {
177−//
178−// const pointDec = ob.patp2dec(point)
179−//
180−// contracts.matchWith({
181−// Nothing: () => {
182−// throw BRIDGE_ERROR.MISSING_CONTRACTS
183−// },
184−// Just: async (contracts) => {
185−// const owner = await azimuth.azimuth.getOwner(contracts.value, point)
186−// if (eqAddr(owner, ETH_ZERO_ADDR)) return true
187−// return false
188−// }
189−// })
190−// }
191−// return false
192−// }
193−
194−
195139const canDecodePatp = p => {
196140 try {
197141 ob.patp2dec(p)
@@ -201,21 +145,6 @@ const canDecodePatp = p => {
201145 }
202146}
203147
204−
205−
206−
207−
208−// const bridgeAPI = {
209−// shipAvailability: {
210−// planet: planet => {},
211−// star: star => {},
212−// galaxy: galaxy => {},
213−// },
214−// // dummyWeb3: {
215−// //
216−// // }
217−// }
218−
219148export {
220149 signTransaction,
221150 sendSignedTransaction,
@@ -228,5 +157,4 @@ export {
228157 toWei,
229158 fromWei,
230159 canDecodePatp,
231− // confirmShipAvailability,
232160}