Skip to content

Commit

Permalink
chore: move ledgers to di (openwallet-foundation#1141)
Browse files Browse the repository at this point in the history
Signed-off-by: Jason C. Leach <jason.leach@fullboar.ca>
  • Loading branch information
jleach authored May 14, 2024
1 parent cbb8465 commit b809b6a
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 29 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"@react-navigation/native": "6.0.6",
"@react-navigation/stack": "6.0.11",
"@types/node": "16.9.6",
"@hyperledger/anoncreds-react-native": "0.2.2",
"@credo-ts/react-hooks": "patch:@credo-ts/react-hooks@npm%3A0.6.0#./.yarn/patches/@credo-ts-react-hooks-npm-0.6.0-3c59ce13d2.patch",
"@credo-ts/anoncreds@0.5.2": "patch:@credo-ts/anoncreds@npm%3A0.5.2#./.yarn/patches/@credo-ts-anoncreds-npm-0.5.2-aeab4e2513.patch",
"@sphereon/pex": "patch:@sphereon/pex@npm%3A3.3.3#./.yarn/patches/@sphereon-pex-npm-3.3.3-144d9252ec.patch"
Expand Down
3 changes: 3 additions & 0 deletions packages/legacy/core/App/container-api.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { BaseLogger } from '@credo-ts/core'
import { IndyVdrPoolConfig } from '@credo-ts/indy-vdr'
import { OCABundleResolverType } from '@hyperledger/aries-oca/build/legacy'
import { StackNavigationProp } from '@react-navigation/stack'
import React, { createContext, useContext } from 'react'
Expand Down Expand Up @@ -47,6 +48,7 @@ export enum OBJECT_TOKENS {
export enum UTILITY_TOKENS {
UTIL_LOGGER = 'utility.logger',
UTIL_OCA_RESOLVER = 'utility.oca-resolver',
UTIL_LEDGERS = 'utility.ledgers',
}

export const TOKENS = {
Expand Down Expand Up @@ -81,6 +83,7 @@ export interface TokenMapping {
[TOKENS.OBJECT_ONBOARDINGCONFIG]: ScreenOptionsType
[TOKENS.UTIL_LOGGER]: BaseLogger
[TOKENS.UTIL_OCA_RESOLVER]: OCABundleResolverType
[TOKENS.UTIL_LEDGERS]: IndyVdrPoolConfig[]
}

export interface Container {
Expand Down
2 changes: 2 additions & 0 deletions packages/legacy/core/App/container-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { DependencyContainer } from 'tsyringe'

import * as bundle from './assets/oca-bundles.json'
import Button from './components/buttons/Button'
import defaultIndyLedgers from './configs/ledgers/indy'
import { LocalStorageKeys } from './constants'
import { TOKENS, Container, TokenMapping } from './container-api'
import { DispatchAction, ReducerAction } from './contexts/reducers/store'
Expand Down Expand Up @@ -46,6 +47,7 @@ export class MainContainer implements Container {
this.container.registerInstance(TOKENS.OBJECT_ONBOARDINGCONFIG, DefaultScreenOptionsDictionary)
this.container.registerInstance(TOKENS.UTIL_LOGGER, new ConsoleLogger())
this.container.registerInstance(TOKENS.UTIL_OCA_RESOLVER, new DefaultOCABundleResolver(bundle))
this.container.registerInstance(TOKENS.UTIL_LEDGERS, defaultIndyLedgers)
this.container.registerInstance(
TOKENS.FN_ONBOARDING_DONE,
(dispatch: React.Dispatch<ReducerAction<unknown>>, navigation: StackNavigationProp<AuthenticateStackParams>) => {
Expand Down
2 changes: 0 additions & 2 deletions packages/legacy/core/App/contexts/configuration.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Agent } from '@credo-ts/core'
import { IndyVdrPoolConfig } from '@credo-ts/indy-vdr'
import { ProofRequestTemplate } from '@hyperledger/aries-bifold-verifier'
import { StackNavigationOptions, StackScreenProps } from '@react-navigation/stack'
import { ReducerAction, createContext, useContext } from 'react'
Expand Down Expand Up @@ -46,7 +45,6 @@ export interface ConfigurationContext {
scan: React.FC<StackScreenProps<ConnectStackParams>>
record: React.FC<RecordProps>
PINSecurity: PINSecurityParams
indyLedgers: IndyVdrPoolConfig[]
settings: SettingSection[]
customNotification: NotificationConfiguration
supportedLanguages: Locales[]
Expand Down
2 changes: 0 additions & 2 deletions packages/legacy/core/App/defaultConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import EmptyList from './components/misc/EmptyList'
import Record from './components/record/Record'
import HomeFooterView from './components/views/HomeFooterView'
import HomeHeaderView from './components/views/HomeHeaderView'
import defaultIndyLedgers from './configs/ledgers/indy'
import { PINRules } from './constants'
import { ConfigurationContext } from './contexts/configuration'
import { useNotifications } from './hooks/notifications'
Expand All @@ -31,7 +30,6 @@ export const defaultConfiguration: ConfigurationContext = {
scan: Scan,
record: Record,
PINSecurity: { rules: PINRules, displayHelper: false },
indyLedgers: defaultIndyLedgers,
settings: [],
customNotification: {
component: () => null,
Expand Down
2 changes: 0 additions & 2 deletions packages/legacy/core/App/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import { homeTourSteps } from './components/tour/HomeTourSteps'
import { proofRequestTourSteps } from './components/tour/ProofRequestTourSteps'
import { TourBox } from './components/tour/TourBox'
import HomeFooterView from './components/views/HomeFooterView'
import indyLedgers from './configs/ledgers/indy'
import * as contexts from './contexts'
import { AuthProvider } from './contexts/auth'
import { NetworkProvider } from './contexts/network'
Expand Down Expand Up @@ -104,7 +103,6 @@ export { MainContainer } from './container-impl'

export {
App,
indyLedgers,
Agent,
AgentProvider,
AuthProvider,
Expand Down
3 changes: 2 additions & 1 deletion packages/legacy/core/App/screens/Splash.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const resumeOnboardingAt = (
* of this view.
*/
const Splash: React.FC = () => {
const { indyLedgers, showPreface, enablePushNotifications } = useConfiguration()
const { showPreface, enablePushNotifications } = useConfiguration()
const { setAgent } = useAgent()
const { t } = useTranslation()
const [store, dispatch] = useStore()
Expand All @@ -97,6 +97,7 @@ const Splash: React.FC = () => {
const [mounted, setMounted] = useState(false)
const { version: TermsVersion } = container.resolve(TOKENS.SCREEN_TERMS)
const logger = container.resolve(TOKENS.UTIL_LOGGER)
const indyLedgers = container.resolve(TOKENS.UTIL_LEDGERS)
const styles = StyleSheet.create({
container: {
flex: 1,
Expand Down
1 change: 0 additions & 1 deletion packages/legacy/core/__tests__/contexts/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const configurationContext: ConfigurationContext = {
settings: [],
developer: () => null,
scan: () => null,
indyLedgers: [],
PINSecurity: {
rules: {
only_numbers: true,
Expand Down
22 changes: 1 addition & 21 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4397,20 +4397,7 @@ __metadata:
languageName: node
linkType: hard

"@hyperledger/anoncreds-react-native@npm:^0.1.0":
version: 0.1.0
resolution: "@hyperledger/anoncreds-react-native@npm:0.1.0"
dependencies:
"@hyperledger/anoncreds-shared": 0.1.0
"@mapbox/node-pre-gyp": ^1.0.10
peerDependencies:
react: ">= 16"
react-native: ">= 0.66.0"
checksum: 33fa1625c0cb97edd21b29b3793159575f32712f9566b3eff016ffa6ee65352b97b0a0771d9b6f096547d8aae03c8a55e0b460aa5ae030e7426a0ba7ccafbf8a
languageName: node
linkType: hard

"@hyperledger/anoncreds-react-native@npm:^0.2.1":
"@hyperledger/anoncreds-react-native@npm:0.2.2":
version: 0.2.2
resolution: "@hyperledger/anoncreds-react-native@npm:0.2.2"
dependencies:
Expand All @@ -4423,13 +4410,6 @@ __metadata:
languageName: node
linkType: hard

"@hyperledger/anoncreds-shared@npm:0.1.0":
version: 0.1.0
resolution: "@hyperledger/anoncreds-shared@npm:0.1.0"
checksum: 1a9a46c80719640ef424f5802e527663167e49eb6dba8a7259eccdb7b6086e6e7a217e03e19a4b29559c51951938d6786aaa738b80c85dd3360f7ae9a4da70a6
languageName: node
linkType: hard

"@hyperledger/anoncreds-shared@npm:0.2.2, @hyperledger/anoncreds-shared@npm:^0.2.1":
version: 0.2.2
resolution: "@hyperledger/anoncreds-shared@npm:0.2.2"
Expand Down

0 comments on commit b809b6a

Please sign in to comment.