Skip to content

Commit

Permalink
Update operators.ts with contract factory
Browse files Browse the repository at this point in the history
  • Loading branch information
ccali11 committed Oct 19, 2023
1 parent 5ce68b2 commit edefde2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
15 changes: 13 additions & 2 deletions apps/web/src/composables/operators.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
import { readonly, ref } from 'vue'
import { Operator, Scanner } from '@casimir/ssv'
import { Account, Pool, RegisteredOperator, RegisterOperatorWithCasimirParams, UserWithAccountsAndOperators } from '@casimir/types'
import { Account, RegisteredOperator, RegisterOperatorWithCasimirParams, UserWithAccountsAndOperators } from '@casimir/types'
import { ethers } from 'ethers'
import useEnvironment from '@/composables/environment'
import useEthers from '@/composables/ethers'
import useLedger from '@/composables/ledger'
import useTrezor from '@/composables/trezor'
import ICasimirManagerAbi from '@casimir/ethereum/build/abi/ICasimirManager.json'
import ICasimirRegistryAbi from '@casimir/ethereum/build/abi/ICasimirRegistry.json'
import ICasimirViewsAbi from '@casimir/ethereum/build/abi/ICasimirViews.json'
import { CasimirManager, CasimirRegistry, CasimirViews } from '@casimir/ethereum/build/@types'

const { ethereumUrl, manager, registry, ssvNetworkAddress, ssvViewsAddress, usersUrl, views } = useEnvironment()
const { ethereumUrl, provider, factory, ssvNetworkAddress, ssvViewsAddress, usersUrl } = useEnvironment()
const { ethersProviderList, getEthersBrowserSigner } = useEthers()
const { getEthersLedgerSigner } = useLedger()
const { getEthersTrezorSigner } = useTrezor()
const loadingInitializeOperators = ref(false)
const loadingInitializeOperatorsError = ref(false)

const managerConfigs = await Promise.all((await factory.getManagerIds()).map(async (id: number) => {
return await factory.getManagerConfig(id)
}))
const manager = new ethers.Contract(managerConfigs[0].managerAddress, ICasimirManagerAbi, provider) as CasimirManager
const registry = new ethers.Contract(managerConfigs[0].registryAddress, ICasimirRegistryAbi, provider) as CasimirRegistry
const views = new ethers.Contract(managerConfigs[0].viewsAddress, ICasimirViewsAbi, provider) as CasimirViews

export default function useOperators() {
const loadingAddOperator = ref(false)
const loadingAddOperatorError = ref(false)
Expand Down
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit edefde2

Please sign in to comment.