Skip to content

Commit

Permalink
Update Polkadot types
Browse files Browse the repository at this point in the history
  • Loading branch information
thesan committed Mar 13, 2024
1 parent 577afc9 commit 5b79aed
Show file tree
Hide file tree
Showing 7 changed files with 548 additions and 613 deletions.
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@
"@babel/parser": "~7.21.0",
"@babel/traverse": "~7.21.0",
"@babel/types": "~7.21.0",
"@polkadot/api": "8.9.1",
"@polkadot/api-contract": "8.9.1",
"@polkadot/api-derive": "8.9.1",
"@polkadot/hw-ledger": "9.5.1",
"@polkadot/keyring": "9.5.1",
"@polkadot/networks": "9.5.1",
"@polkadot/rpc-core": "8.9.1",
"@polkadot/rpc-provider": "8.9.1",
"@polkadot/types": "8.9.1",
"@polkadot/types-known": "8.9.1",
"@polkadot/util": "9.5.1",
"@polkadot/util-crypto": "9.5.1",
"@polkadot/api": "10.1.4",
"@polkadot/api-contract": "10.1.4",
"@polkadot/api-derive": "10.1.4",
"@polkadot/hw-ledger": "11.1.1",
"@polkadot/keyring": "11.1.1",
"@polkadot/networks": "11.1.1",
"@polkadot/rpc-core": "10.1.4",
"@polkadot/rpc-provider": "10.1.4",
"@polkadot/types": "10.1.4",
"@polkadot/types-known": "10.1.4",
"@polkadot/util": "11.1.1",
"@polkadot/util-crypto": "11.1.1",
"bn.js": "^4.11.9",
"@joystream/js@1.2.0": "patch:@joystream/js@npm%3A1.2.0#./.yarn/patches/@joystream-js-npm-1.2.0-a8795e7496.patch"
},
Expand Down
20 changes: 10 additions & 10 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@
"@joystream/js": "1.2.0",
"@joystream/markdown-editor": "^0.1.0",
"@joystream/metadata-protobuf": "^2.10.0",
"@joystream/types": "4.2.0",
"@joystream/types": "4.3.0",
"@nivo/bar": "^0.79.1",
"@nivo/core": "^0.79.0",
"@noble/hashes": "^1.1.5",
"@oneidentity/zstd-js": "^1.0.3",
"@polkadot/api": "8.9.1",
"@polkadot/extension-dapp": "0.44.2-4",
"@polkadot/keyring": "9.5.1",
"@polkadot/react-identicon": "2.5.1",
"@polkadot/types": "8.9.1",
"@polkadot/ui-keyring": "2.5.1",
"@polkadot/util": "9.5.1",
"@polkadot/util-crypto": "9.5.1",
"@polkadot/api": "10.1.4",
"@polkadot/extension-dapp": "0.45.3",
"@polkadot/keyring": "11.1.1",
"@polkadot/react-identicon": "3.1.1",
"@polkadot/types": "10.1.4",
"@polkadot/ui-keyring": "3.1.1",
"@polkadot/util": "11.1.1",
"@polkadot/util-crypto": "11.1.1",
"@popperjs/core": "^2.10.2",
"@types/jest": "^27.0.2",
"@types/react": "^17.0.27",
Expand Down Expand Up @@ -84,7 +84,7 @@
"react-router-dom": "^5.3.0",
"react-transition-group": "^4.4.2",
"remark-gfm": "^3.0.1",
"rxjs": "^7.5.5",
"rxjs": "7.8.1",
"stream-browserify": "^3.0.0",
"styled-components": "^5.3.1",
"subscriptions-transport-ws": "^0.11.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/mocks/helpers/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const fromTxMock = (
const event = failure ? createErrorEvents(failure) : createSuccessEvents(eventData, moduleName, eventName)
const txResult = stubTransactionResult(event)

const paymentInfo = () => of({ partialFee: createType('BalanceOf', joy(fee)) })
const paymentInfo = () => of({ partialFee: createType('BalanceOf', new BN(joy(fee))) })

return (...args: any[]) => {
onCall?.(...args)
Expand Down
9 changes: 5 additions & 4 deletions packages/ui/src/validators/providers/useValidatorsQueries.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { Vec } from '@polkadot/types'
import { AccountId } from '@polkadot/types/interfaces'
import { PalletStakingExposure } from '@polkadot/types/lookup'
import BN from 'bn.js'
import { useMemo } from 'react'
Expand All @@ -11,7 +9,7 @@ import { keepFirst } from './utils'

type ActiveEra = { index: number; startedOn: number }

type ActiveValidators = Vec<AccountId>
type ActiveValidators = string[]

type Stakers = Map<string, Observable<PalletStakingExposure>>

Expand All @@ -35,7 +33,10 @@ export const useValidatorsQueries = (): CommonValidatorsQueries | undefined => {
return useMemo<CommonValidatorsQueries | undefined>(() => {
if (!api) return

const activeValidators$ = api.query.session.validators().pipe(keepFirst())
const activeValidators$ = api.query.session.validators().pipe(
map((activeAccounts) => activeAccounts.map((account) => account.toString())),
keepFirst()
)

const activeEra$ = api.query.staking.activeEra().pipe(
map((activeEra) => ({
Expand Down
7 changes: 0 additions & 7 deletions packages/ui/src/validators/providers/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { Vec } from '@polkadot/types'
import { AccountId } from '@polkadot/types/interfaces'
import { map, Observable, of, OperatorFunction, ReplaySubject, share, switchMap } from 'rxjs'

import { Api } from '@/api'
Expand Down Expand Up @@ -32,11 +30,6 @@ export const getValidatorsFilters = ({
]
}

export const filterValidatorsByIsActive = (validators: ValidatorWithDetails[], isActive: boolean) =>
map((activeValidators: Vec<AccountId>) =>
validators.filter(({ stashAccount }) => activeValidators.includes(stashAccount) === isActive)
)

export const getValidatorSortingFns = (
key: ValidatorDetailsOrder['key']
): [
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/test/accounts/modal/TransferModal.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ describe('UI: TransferModal', () => {
stubTransactionSuccess(transfer, 'balances', 'Transfer', [
createType('AccountId', alice.address),
createType('AccountId', bob.address),
createType('Balance', 50),
createType('u128', 50),
])
})

Expand Down
Loading

0 comments on commit 5b79aed

Please sign in to comment.