Skip to content

Commit 0b0c120

Browse files
authored
Merge pull request #2282 from AmbireTech/release/v2.91
Release / v2.91.0
2 parents 6f5e145 + c3f044e commit 0b0c120

File tree

36 files changed

+477
-274
lines changed

36 files changed

+477
-274
lines changed

jest.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ module.exports = {
33
preset: 'ts-jest',
44
testEnvironment: 'node',
55
testTimeout: 25000,
6+
moduleNameMapper: {
7+
'^@/(.*)$': '<rootDir>/src/$1',
8+
'^@test/(.*)$': '<rootDir>/test/$1'
9+
},
610
// For services/validate.ts https://stackoverflow.com/a/61785012/13840636
711
transform: {
812
'node_modules/validator/.+\\.(j|t)sx?$': 'ts-jest'

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "2.90.6",
2+
"version": "2.91.3",
33
"name": "ambire-common",
44
"description": "Common ground for the Ambire apps",
55
"scripts": {

src/consts/gasTankFeeTokens.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,13 @@ export default [
337337
icon: 'https://assets.coingecko.com/coins/images/17266/small/amWETH_2x.png',
338338
hiddenOnError: true
339339
},
340+
{
341+
address: '0x6440f144b7e50D6a8439336510312d2F54beB01D',
342+
symbol: 'BOLD',
343+
chainId: 1n,
344+
decimals: 18,
345+
icon: 'https://assets.coingecko.com/coins/images/56069/standard/BOLD_logo.png?1748265087'
346+
},
340347
{
341348
address: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270',
342349
symbol: 'wmatic',

src/consts/safe.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
2-
* A non-exclusive list of networks that safe accounts are supported on.
3-
* We will use this list to know where to search for safe accounts
2+
* A non-exclusive list of networks that Safe accounts are supported on.
3+
* We will use this list to know where to search for Safe accounts
44
* and in accordance with the enabled user networks
55
*/
66
export const SAFE_NETWORKS = [
@@ -9,7 +9,7 @@ export const SAFE_NETWORKS = [
99
]
1010

1111
/**
12-
* Information about safe contract addresses by their versions
12+
* Information about Safe contract addresses by their versions
1313
*/
1414
const vOneThree = {
1515
singleton: '0xd9Db270c1B5E3Bd161E8c8503c55cEABeE709552'
@@ -25,14 +25,14 @@ export const execTransactionAbi = [
2525
'function execTransaction(address to,uint256 value,bytes calldata data,uint8 operation,uint256 safeTxGas,uint256 baseGas,uint256 gasPrice,address gasToken,address payable refundReceiver,bytes memory signatures)'
2626
]
2727
/**
28-
* In order to do batching, safe needs an extra contract helper called multisend
29-
* This is the latest contract and it's safe to use across versions
28+
* In order to do batching, Safe needs an extra contract helper called multisend
29+
* This is the latest contract and it's Safe to use across versions
3030
*/
3131
export const multiSendAddr = '0x9641d764fc13c8B624c04430C7356C1C7C8102e2'
3232

3333
/**
34-
* In order to do batching, safe needs an extra contract helper called multisend
35-
* This is the latest contract and it's safe to use across versions
34+
* In order to do batching, Safe needs an extra contract helper called multisend
35+
* This is the latest contract and it's Safe to use across versions
3636
*/
3737
export const safeNullOwner = '0x0000000000000000000000000000000000000002'
3838

src/controllers/activity/activity.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ export class ActivityController extends EventEmitter implements IActivityControl
489489
const portfoliosToUpdate: PortfoliosToUpdate = {}
490490
const updatedAccountsOps: SubmittedAccountOp[] = []
491491

492-
// we should fetch safe txns again upon failure
492+
// we should fetch Safe txns again upon failure
493493
let shouldFetchSafeTxns = false
494494

495495
// Use this flag to make the auto-refresh slower with the passege of time.
@@ -632,7 +632,7 @@ export class ActivityController extends EventEmitter implements IActivityControl
632632
this.#portfolio.addTokensToBeLearned(foundTokens, accountOp.chainId)
633633
}
634634
} else {
635-
// if the txn resulted in a failure, unresolve all safe txns
635+
// if the txn resulted in a failure, unresolve all Safe txns
636636
// with the same nonce so that the user can retry
637637
const acc = this.#accounts.accounts.find(
638638
(a) => a.addr === accountOp.accountAddr

src/controllers/autoLogin/autoLogin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ export class AutoLoginController extends EventEmitter implements IAutoLoginContr
296296
accountKeys: Key[],
297297
account: Account
298298
): 'no-policy' | 'expired' | 'valid-policy' | 'unsupported' {
299-
// disable the auto login for safe accounts
299+
// disable the auto login for Safe accounts
300300
if (account.safeCreation) return 'unsupported'
301301

302302
const accountPolicies = this.getAccountPolicies(parsedSiwe.address)

src/controllers/continuousUpdates/continuousUpdates.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ export class ContinuousUpdatesController extends EventEmitter {
361361
if (!this.#main.selectedAccount.account || !this.#main.selectedAccount.account.safeCreation)
362362
return
363363

364-
// do not make safe requests if the extension is locked
364+
// do not make Safe requests if the extension is locked
365365
if (!this.#main.keystore.isUnlocked) return
366366

367367
const pendingSafeTxns = this.#main.requests.userRequests
@@ -383,7 +383,7 @@ export class ContinuousUpdatesController extends EventEmitter {
383383
if (!pendingSafeTxns.length) return
384384

385385
const confirmed = await this.#main.safe.fetchExecuted(pendingSafeTxns).catch((e) => {
386-
console.log('failed to retrieve executed safe txns')
386+
console.log('failed to retrieve executed Safe txns')
387387
return []
388388
})
389389
if (!confirmed.length) return
@@ -419,14 +419,14 @@ export class ContinuousUpdatesController extends EventEmitter {
419419
fromRequestId: userR.id
420420
})
421421
.catch((e: Error) => {
422-
console.log('could not resolve safe global request')
422+
console.log('could not resolve Safe Global request')
423423
console.log(e)
424424
return e
425425
})
426426
if (commonSuccessHandler instanceof Error) continue
427427

428428
await this.#main.resolveAccountOpRequest(submittedAccountOp, userR.id, false).catch((e) => {
429-
console.log('could not resolve safe global request')
429+
console.log('could not resolve Safe Global request')
430430
console.log(e)
431431
})
432432

src/controllers/eventEmitter/eventEmitter.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,10 @@ export default class EventEmitter {
165165
// simultaneous actions can lead to unintended side effects. The 'allowConcurrentActions' flag is provided to enable
166166
// concurrent execution at the main controller level. This is useful when multiple actions need to modify the state
167167
// of different sub-controllers simultaneously.
168-
if ((someStatusIsLoading && !allowConcurrentActions) || this.statuses[callName] !== 'INITIAL') {
168+
if (
169+
(someStatusIsLoading && !allowConcurrentActions) ||
170+
!['INITIAL', 'SUCCESS'].includes(this.statuses[callName] as any)
171+
) {
169172
this.emitError({
170173
level: errorLevel,
171174
message: `Please wait for the completion of the previous action before initiating another one.', ${callName}`,
@@ -177,6 +180,10 @@ export default class EventEmitter {
177180
return
178181
}
179182

183+
if (this.statuses[callName] === 'SUCCESS') {
184+
await wait(2) // to let the INITIAL status be fired from the prev session
185+
}
186+
180187
this.statuses[callName] = 'LOADING'
181188
await this.forceEmitUpdate()
182189

src/controllers/keystore/keystore.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,6 +1078,10 @@ export class KeystoreController extends EventEmitter implements IKeystoreControl
10781078
return this.#keystoreSecrets.some((x) => x.id === 'password')
10791079
}
10801080

1081+
get hasBiometricsSecret() {
1082+
return this.#keystoreSecrets.some((x) => x.id === 'biometrics')
1083+
}
1084+
10811085
get hasKeystoreTempSeed() {
10821086
return !!this.#tempSeed
10831087
}
@@ -1192,6 +1196,7 @@ export class KeystoreController extends EventEmitter implements IKeystoreControl
11921196
keys: this.keys,
11931197
seeds: this.seeds,
11941198
hasPasswordSecret: this.hasPasswordSecret,
1199+
hasBiometricsSecret: this.hasBiometricsSecret,
11951200
hasKeystoreTempSeed: this.hasKeystoreTempSeed,
11961201
hasTempSeed: this.hasTempSeed,
11971202
isReadyToStoreKeys: this.isReadyToStoreKeys

src/controllers/main/main.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
import { DEFAULT_ACCOUNT_LABEL } from '@/consts/account'
2+
import { BIP44_STANDARD_DERIVATION_TEMPLATE } from '@/consts/derivation'
3+
import { AccountOpStatus } from '@/libs/accountOp/types'
4+
import { KeyIterator } from '@/libs/keyIterator/keyIterator'
5+
import wait from '@/utils/wait'
16
import { describe, expect, jest, test } from '@jest/globals'
7+
import { makeMainController } from '@test/helpers/mainController'
28

3-
import { makeMainController } from '../../../test/helpers/mainController'
4-
import { DEFAULT_ACCOUNT_LABEL } from '../../consts/account'
5-
import { BIP44_STANDARD_DERIVATION_TEMPLATE } from '../../consts/derivation'
6-
import { AccountOpStatus } from '../../libs/accountOp/types'
7-
import { KeyIterator } from '../../libs/keyIterator/keyIterator'
8-
import wait from '../../utils/wait'
99
import { MainController } from './main'
1010

1111
describe('Main Controller ', () => {

0 commit comments

Comments
 (0)