Skip to content

Commit

Permalink
Merge pull request #5087 from mnaamani/nara-polkadot-js-api-update
Browse files Browse the repository at this point in the history
[Nara] polkadot-js/api update
  • Loading branch information
mnaamani authored Mar 10, 2024
2 parents 04af90e + 15e0dc8 commit 9549942
Show file tree
Hide file tree
Showing 53 changed files with 2,528 additions and 7,560 deletions.
20 changes: 10 additions & 10 deletions cli/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@joystream/cli",
"description": "Command Line Interface for Joystream community and governance activities",
"version": "1.4.0",
"version": "1.5.0",
"author": "Leszek Wiesner",
"bin": {
"joystream-cli": "./bin/run"
Expand All @@ -17,13 +17,13 @@
"@oclif/plugin-help": "^3.2.2",
"@oclif/plugin-not-found": "^1.2.4",
"@oclif/plugin-warn-if-update-available": "^1.7.0",
"@polkadot/api": "8.9.1",
"@polkadot/keyring": "9.5.1",
"@polkadot/util": "9.5.1",
"@polkadot/util-crypto": "9.5.1",
"@substrate/txwrapper-core": "3.1.3",
"@substrate/txwrapper-substrate": "3.1.3",
"@substrate/txwrapper-polkadot": "3.1.3",
"@polkadot/api": "10.1.4",
"@polkadot/keyring": "11.1.1",
"@polkadot/util": "11.1.1",
"@polkadot/util-crypto": "11.1.1",
"@substrate/txwrapper-core": "6.0.1",
"@substrate/txwrapper-substrate": "6.0.1",
"@substrate/txwrapper-polkadot": "6.0.1",
"@types/cli-progress": "^3.9.1",
"@types/fluent-ffmpeg": "^2.1.16",
"@types/inquirer": "^6.5.0",
Expand Down Expand Up @@ -56,7 +56,7 @@
"proper-lockfile": "^4.1.1",
"slug": "^2.1.1",
"tslib": "^1.11.1",
"@joystream/js": "^1.8.0"
"@joystream/js": "^1.10.0"
},
"devDependencies": {
"@graphql-codegen/cli": "^1.21.4",
Expand All @@ -78,7 +78,7 @@
"mocha": "^5.2.0",
"nyc": "^14.1.1",
"ts-node": "^10.2.1",
"typescript": "^4.4.3"
"typescript": "^5.0.2"
},
"engines": {
"node": ">=14.18.0",
Expand Down
25 changes: 18 additions & 7 deletions cli/src/base/AdvancedTransactionsCommandBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ import { createKeyMulti, encodeAddress, sortAddresses } from '@polkadot/util-cry
import ExitCodes from '../ExitCodes'
import fs from 'fs'

export type Weight = {
refTime: number | string
proofSize: number | string
}

export default abstract class AdvancedTransactionsCommandBase extends AccountsCommandBase {
async getApproveAsMultiInputFromFile(filePath: string): Promise<MultiSigApproveAsMulti> {
return getInputJson<MultiSigApproveAsMulti>(filePath)
Expand Down Expand Up @@ -58,7 +63,7 @@ export default abstract class AdvancedTransactionsCommandBase extends AccountsCo
threshold: number | undefined,
others: string | undefined,
callHash: string,
maxWeight: number
maxWeight: Weight
): Promise<MultiSigApproveAsMulti> {
let argsInput: MultiSigApproveAsMulti
let otherSignatories: string[] = []
Expand Down Expand Up @@ -104,7 +109,7 @@ export default abstract class AdvancedTransactionsCommandBase extends AccountsCo
timepointIndex: number | undefined,
others: string | undefined,
callHash: string,
maxWeight: number
maxWeight: Weight
): Promise<MultiSigApproveAsMulti> {
let argsInput: MultiSigApproveAsMulti
let otherSignatories: string[] = []
Expand Down Expand Up @@ -154,14 +159,14 @@ export default abstract class AdvancedTransactionsCommandBase extends AccountsCo
timepointIndex: number | undefined,
others: string | undefined,
call: string,
maxWeight: number
maxWeight: Weight
): Promise<MultisigAsMulti> {
if (input) {
const args = await this.getAsMultiInputFromFile(input)
const otherSignatories = args.otherSignatories as string[]
const otherSignatoriesSorted = sortAddresses(otherSignatories, JOYSTREAM_ADDRESS_PREFIX)
args.otherSignatories = otherSignatoriesSorted
const maxWeightChanged = maxWeight !== (args.maxWeight as number)
const maxWeightChanged = maxWeight !== args.maxWeight
if (maxWeightChanged) {
this.warn(`"maxWeight" changed from ${args.maxWeight} to ${maxWeight}.`)
}
Expand Down Expand Up @@ -266,10 +271,16 @@ export default abstract class AdvancedTransactionsCommandBase extends AccountsCo
return unsigned
}

async getWeight(call: Call): Promise<number> {
async getWeight(call: Call): Promise<Weight> {
const callData = this.getOriginalApi().tx(call)
const paymentWeight = await this.getOriginalApi().rpc.payment.queryInfo(callData.toHex())
return paymentWeight.weight.toNumber()
const dispatchInfo = await this.getOriginalApi().call.transactionPaymentApi.queryInfo(
callData.toHex(),
callData.length
)
return {
refTime: dispatchInfo.weight.refTime.toNumber(),
proofSize: dispatchInfo.weight.proofSize.toNumber(),
}
}

createTransactionReadyForSigning(
Expand Down
4 changes: 2 additions & 2 deletions cli/src/base/FeeProfileCommandBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ export default abstract class FeeProfileCommandBase extends ApiCommandBase {
txLength,
txWeight: {
base: this.formatBN(baseExtrinsicWeight.refTime.toBn()),
extra: this.formatBN(weight),
total: this.formatBN(baseExtrinsicWeight.refTime.toBn().add(weight)),
extra: this.formatBN(weight.refTime.toBn()),
total: this.formatBN(baseExtrinsicWeight.refTime.toBn().add(weight.refTime.toBn())),
},
costs: costsProfile,
returns: returnsProfile,
Expand Down
3 changes: 2 additions & 1 deletion cli/src/commands/working-groups/createOpening.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import Long from 'long'
import moment from 'moment'
import { UpcomingWorkingGroupOpeningDetailsFragment } from '../../graphql/generated/queries'
import { DEFAULT_DATE_FORMAT } from '../../Consts'
import { JSONSchema4 } from 'json-schema'

export default class WorkingGroupsCreateOpening extends WorkingGroupsCommandBase {
static description = 'Create working group opening / upcoming opening (requires lead access)'
Expand Down Expand Up @@ -93,7 +94,7 @@ export default class WorkingGroupsCreateOpening extends WorkingGroupsCommandBase
const api = this.getOriginalApi()
const openingDefaults = rememberedInput
const openingPrompt = new JsonSchemaPrompter<WorkingGroupOpeningInputParameters>(
WorkingGroupOpeningInputSchema(api),
WorkingGroupOpeningInputSchema(api) as JSONSchema4, // Update the type of the argument
openingDefaults
)
const openingParamsJson = await openingPrompt.promptAll()
Expand Down
2 changes: 1 addition & 1 deletion distributor-node/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"axios": "^0.21.1"
},
"devDependencies": {
"typescript": "^4.4.3"
"typescript": "^5.0.2"
},
"engines": {
"node": ">=14.18.0"
Expand Down
4 changes: 2 additions & 2 deletions distributor-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"dependencies": {
"@apollo/client": "^3.2.5",
"@elastic/ecs-winston-format": "^1.1.0",
"@joystream/metadata-protobuf": "^2.8.0",
"@joystream/metadata-protobuf": "^2.15.0",
"@joystream/opentelemetry": "1.0.0",
"@joystream/storage-node-client": "^4.0.0",
"@joystream/types": "^4.0.0",
Expand Down Expand Up @@ -82,7 +82,7 @@
"nyc": "^14",
"openapi-typescript": "^4.0.2",
"ts-node": "^10.9.1",
"typescript": "^3.3",
"typescript": "^5.0.2",
"widdershins": "^4.0.1"
},
"engines": {
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ services:
"
indexer:
image: joystream/hydra-indexer:v5.0.0-alpha.7
image: joystream/hydra-indexer:v5.0.0-alpha.8
container_name: indexer
restart: unless-stopped
env_file:
Expand All @@ -262,7 +262,7 @@ services:
sh -c "yarn db:bootstrap && yarn start:prod"
hydra-indexer-gateway:
image: joystream/hydra-indexer-gateway:5.0.0-alpha.7
image: joystream/hydra-indexer-gateway:5.0.0-alpha.8
container_name: hydra-indexer-gateway
restart: unless-stopped
env_file:
Expand Down
8 changes: 4 additions & 4 deletions joystreamjs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@joystream/js",
"version": "1.9.0",
"version": "1.10.0",
"license": "GPL-3.0-only",
"description": "Joystream JS package provides utilities required to work with Joystream network.",
"main": "lib/index.js",
Expand Down Expand Up @@ -41,9 +41,9 @@
"generate:all": "yarn generate:schema-typings"
},
"dependencies": {
"@joystream/metadata-protobuf": "^2.13.0",
"@joystream/metadata-protobuf": "^2.15.0",
"@joystream/types": "^4.0.0",
"@polkadot/util-crypto": "9.5.1",
"@polkadot/util-crypto": "11.1.1",
"axios": "^1.2.1",
"buffer": "^6.0.3",
"lodash": "^4.17.21",
Expand All @@ -57,7 +57,7 @@
"eslint": "^7.25.0",
"json-schema-to-typescript": "^10.1.4",
"prettier": "^2.2.1",
"typescript": "^4.4.3"
"typescript": "^5.0.2"
},
"husky": {
"hooks": {
Expand Down
Loading

0 comments on commit 9549942

Please sign in to comment.