Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C-991] Add entity-manager to native-libs #3842

Merged
merged 1 commit into from
Sep 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions libs/src/NativeAudiusLibs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import { File } from './api/File'
import { ServiceProvider } from './api/ServiceProvider'
import type { BaseConstructorArgs } from './api/base'
import type { MonitoringCallbacks } from './services/types'
import { EntityManager } from './api/entityManager'

type LibsIdentityServiceConfig = {
url: string
Expand Down Expand Up @@ -132,9 +133,10 @@ export class AudiusLibs {
web3Provider: string,
// network chain id
networkId: string,

// wallet address to force use instead of the first wallet on the provided web3
walletOverride: Nullable<string> = null
walletOverride: Nullable<string> = null,
// entity manager address
entityManagerAddress: Nullable<string> = null
) {
const web3Instance = await Utils.configureWeb3(web3Provider, networkId)
if (!web3Instance) {
Expand All @@ -143,6 +145,7 @@ export class AudiusLibs {
const wallets = await web3Instance.eth.getAccounts()
return {
registryAddress,
entityManagerAddress,
useExternalWeb3: true,
externalWeb3Config: {
web3: web3Instance,
Expand Down Expand Up @@ -324,6 +327,7 @@ export class AudiusLibs {
File: Nullable<File>
Rewards: Nullable<Rewards>
Reactions: Nullable<Reactions>
EntityManager: Nullable<EntityManager>

preferHigherPatchForPrimary: boolean
preferHigherPatchForSecondaries: boolean
Expand Down Expand Up @@ -396,6 +400,7 @@ export class AudiusLibs {
this.File = null
this.Rewards = null
this.Reactions = null
this.EntityManager = null

this.preferHigherPatchForPrimary = preferHigherPatchForPrimary
this.preferHigherPatchForSecondaries = preferHigherPatchForSecondaries
Expand Down Expand Up @@ -494,6 +499,7 @@ export class AudiusLibs {
this.contracts = new AudiusContracts(
this.web3Manager,
this.web3Config.registryAddress,
this.web3Config.entityManagerAddress,
this.isServer,
this.logger
)
Expand Down Expand Up @@ -574,10 +580,12 @@ export class AudiusLibs {
this.File = new File(this.User, ...services)
this.Rewards = new Rewards(this.ServiceProvider, ...services)
this.Reactions = new Reactions(...services)
this.EntityManager = new EntityManager(...services)
}
}

export { SolanaUtils }

export { Utils } from './utils'
export { SanityChecks } from './sanityChecks'
export { RewardsAttester } from './services/solana'