Skip to content

Commit d5bd4ab

Browse files
authored
[dcent - v1.0.0-alpha.1, injected v2.0.8-alpha.1] : Update - CI and cleanup (#1041)
* Remove unneeded code and logs, formatted file, incremented version for injected wallets for removal of dcent injected, added CI
1 parent a61433e commit d5bd4ab

File tree

3 files changed

+40
-27
lines changed

3 files changed

+40
-27
lines changed

.circleci/config.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,12 @@ jobs:
267267
working_directory: ~/web3-onboard-monorepo/packages/coinbase
268268
steps:
269269
- node-build-steps
270+
build-dcent:
271+
docker:
272+
- image: cimg/node:16.13.1
273+
working_directory: ~/web3-onboard-monorepo/packages/dcent
274+
steps:
275+
- node-build-steps
270276

271277
# Build staging/Alpha releases
272278
build-staging-core:
@@ -371,6 +377,12 @@ jobs:
371377
working_directory: ~/web3-onboard-monorepo/packages/coinbase
372378
steps:
373379
- node-staging-build-steps
380+
build-staging-dcent:
381+
docker:
382+
- image: cimg/node:16.13.1
383+
working_directory: ~/web3-onboard-monorepo/packages/dcent
384+
steps:
385+
- node-staging-build-steps
374386

375387
workflows:
376388
version: 2
@@ -477,3 +489,9 @@ workflows:
477489
<<: *deploy_production_filters
478490
- build-staging-coinbase:
479491
<<: *deploy_staging_filters
492+
dcent:
493+
jobs:
494+
- build-dcent:
495+
<<: *deploy_production_filters
496+
- build-staging-dcent:
497+
<<: *deploy_staging_filters

packages/dcent/src/index.ts

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

packages/injected/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3-onboard/injected-wallets",
3-
"version": "2.0.7",
3+
"version": "2.0.8-alpha.1",
44
"description": "Injected wallets module for web3-onboard",
55
"module": "dist/index.js",
66
"browser": "dist/index.js",

0 commit comments

Comments
 (0)