@@ -35,7 +35,7 @@ const generateAccounts = async (
3535 provider : providers . StaticJsonRpcProvider
3636) : Promise < Account [ ] > => {
3737 const accounts = [ ]
38-
38+
3939 const addressList = await keyring . addAccounts ( )
4040 const derivationPath = DEFAULT_BASE_PATH
4141 const account = {
@@ -48,8 +48,7 @@ const generateAccounts = async (
4848 }
4949
5050 accounts . push ( account )
51-
52- // console.log('generateAccounts/accounts = ', accounts)
51+
5352 return accounts
5453}
5554
@@ -62,25 +61,26 @@ function dcent({
6261 return helpers => {
6362 const { device } = helpers
6463 const isMobile = device . type === 'mobile'
65- // console.log('device.type ', device.type)
6664 let accounts : Account [ ] | undefined
6765 return {
68- label : 'D\ 'CENT' ,
66+ label : "D 'CENT" ,
6967 getIcon,
7068 getInterface : async ( { EventEmitter, chains } ) => {
71-
7269 const eventEmitter = new EventEmitter ( )
7370
7471 if ( isMobile ) {
75- const provider = window . ethereum as EIP1193Provider
76- if ( isMobile && ( ! provider ) ) {
77- location . replace ( "https://link.dcentwallet.com/DAppBrowser/?url=" + document . location )
72+ const provider = window . ethereum as EIP1193Provider
73+ if ( isMobile && ! provider ) {
74+ location . replace (
75+ 'https://link.dcentwallet.com/DAppBrowser/?url=' +
76+ document . location
77+ )
7878 }
7979 provider . on = eventEmitter . on . bind ( eventEmitter )
8080 return {
8181 provider
8282 }
83- }
83+ }
8484
8585 const { StaticJsonRpcProvider } = await import (
8686 '@ethersproject/providers'
@@ -89,23 +89,20 @@ function dcent({
8989
9090 const { default : EthDcentKeyring } = await import ( 'eth-dcent-keyring' )
9191 const dcentKeyring = new EthDcentKeyring ( { } )
92-
93- // console.log('dcentKeyring ', dcentKeyring)
92+
9493 const { TransactionFactory : Transaction } = await import (
9594 '@ethereumjs/tx'
9695 )
97-
96+
9897 let currentChain : Chain = chains [ 0 ]
9998 const scanAccounts = async ( {
100- derivationPath,
101- chainId,
102- asset
99+ chainId
103100 } : ScanAccountsOptions ) : Promise < Account [ ] > => {
104101 currentChain =
105102 chains . find ( ( { id } : Chain ) => id === chainId ) || currentChain
106103
107104 const provider = new StaticJsonRpcProvider ( currentChain . rpcUrl )
108-
105+
109106 return generateAccounts ( dcentKeyring , provider )
110107 }
111108
@@ -218,23 +215,22 @@ function dcent({
218215 from ,
219216 transaction
220217 )
221-
222- // console.log(`0x${result.serialize().toString('hex')}`)
218+
223219 return `0x${ result . serialize ( ) . toString ( 'hex' ) } `
224220 } catch ( err ) {
225221 throw err
226222 }
227223 } ,
228224 eth_sendTransaction : async ( { baseRequest, params } ) => {
229- const signedTx = await provider . request ( {
225+ const signedTx = ( await provider . request ( {
230226 method : 'eth_signTransaction' ,
231227 params
232- } ) as string
228+ } ) ) as string
233229
234- const transactionHash = await baseRequest ( {
230+ const transactionHash = ( await baseRequest ( {
235231 method : 'eth_sendRawTransaction' ,
236232 params : [ signedTx ]
237- } ) as string
233+ } ) ) as string
238234
239235 return transactionHash
240236 } ,
@@ -273,7 +269,7 @@ function dcent({
273269 accounts [ 0 ]
274270
275271 const opt = {
276- version : "V4"
272+ version : 'V4'
277273 }
278274 return dcentKeyring . signTypedData ( account . address , typedData , opt )
279275 } ,
@@ -290,11 +286,10 @@ function dcent({
290286 } )
291287
292288 provider . on = eventEmitter . on . bind ( eventEmitter )
293-
289+
294290 return {
295291 provider
296292 }
297-
298293 }
299294 }
300295 }
0 commit comments