Compare commits

..
53 Commits
Author SHA1 Message Date
github-actions[bot] 0a9158befc [CI Skip] release/stable 8.10.1
skip-checks: true
2022-06-26 06:56:57 +00:00
Jaco 9c4e984f7b 8.10.1 (#4986) 2022-06-26 09:49:34 +03:00
github-actions[bot] c1187f4c7a [CI Skip] bump/beta 8.9.2-24-x
skip-checks: true
2022-06-25 09:30:24 +00:00
Jaco e279d50224 Metadata bump (#4985) 2022-06-25 12:22:09 +03:00
github-actions[bot] f28908d28e [CI Skip] release/beta 8.9.2-23
skip-checks: true
2022-06-25 06:50:38 +00:00
Jaco 570cf5fea4 Bump dev (#4984) 2022-06-25 09:43:05 +03:00
github-actions[bot] 7bf5bb7a3b [CI Skip] bump/beta 8.9.2-22-x
skip-checks: true
2022-06-25 05:52:37 +00:00
Jaco 756502771e Bump util to 9.6.2 (#4983) 2022-06-25 08:42:41 +03:00
github-actions[bot] 977eb3f9ec [CI Skip] bump/beta 8.9.2-21-x
skip-checks: true
2022-06-24 04:30:32 +00:00
Jaco 909b3429f2 Update CHANGELOG (#4980)
* Update CHANGELOG

* Additional
2022-06-24 07:21:37 +03:00
github-actions[bot] 116b817696 [CI Skip] bump/beta 8.9.2-20-x
skip-checks: true
2022-06-23 17:31:39 +00:00
Alan Sapede c295d699e7 Adds Eth feeHistory & maxPriorityFeePerGas rpc (#4956)
* Adds Eth feeHistory & maxPriorityFeePerGas

* linted

* Fixes rpc method ordering
2022-06-23 20:22:05 +03:00
github-actions[bot] c8ab0e6959 [CI Skip] bump/beta 8.9.2-19-x
skip-checks: true
2022-06-23 17:11:08 +00:00
Jaco cf52676025 Bump dev (w/ deno build fix) (#4979) 2022-06-23 20:02:51 +03:00
github-actions[bot] 935b176740 [CI Skip] bump/beta 8.9.2-18-x
skip-checks: true
2022-06-23 11:23:19 +00:00
Jaco af9c4e0e4b Bump dev 2022-06-23 14:15:35 +03:00
github-actions[bot] 17eccc0b7b [CI Skip] release/beta 8.9.2-17
skip-checks: true
2022-06-23 09:05:32 +00:00
Jaco 1ba2413c86 Bump deps (#4978) 2022-06-23 11:57:28 +03:00
github-actions[bot] ff69198b1a [CI Skip] release/beta 8.9.2-16
skip-checks: true
2022-06-23 07:10:22 +00:00
Jaco 7b368a3f2d Dev bump (w/ publish) (#4977) 2022-06-23 10:01:03 +03:00
github-actions[bot] 58020291ea [CI Skip] release/beta 8.9.2-15
skip-checks: true
2022-06-23 06:35:43 +00:00
Jaco fb1e428615 Westend 9250 upgrade block (#4976) 2022-06-23 09:25:18 +03:00
github-actions[bot] 2164f80a3c [CI Skip] release/beta 8.9.2-14
skip-checks: true
2022-06-23 06:18:45 +00:00
Jaco 59903dfba3 Bump dev (Only publish betas with explicit indicator) (#4975) 2022-06-23 09:08:57 +03:00
github-actions[bot] 97ded7d284 [CI Skip] release/beta 8.9.2-13
skip-checks: true
2022-06-23 04:02:23 +00:00
Jaco 772ab6e7d1 Bump dev (w/ deno augmentation) (#4974)
* Bump dev (w/ deno augmentation)

* Build deno
2022-06-23 06:54:02 +03:00
github-actions[bot] f7a3907519 [CI Skip] release/beta 8.9.2-12
skip-checks: true
2022-06-23 03:46:07 +00:00
Jaco 891790b2b6 Fix f32/f64 primtive typegen (#4973) 2022-06-23 06:37:02 +03:00
github-actions[bot] fac008f453 [CI Skip] release/beta 8.9.2-11
skip-checks: true
2022-06-22 12:09:06 +00:00
Jaco 32fd91a221 Bump dependencies (#4972) 2022-06-22 15:01:15 +03:00
github-actions[bot] 472ab9acac [CI Skip] release/beta 8.9.2-10
skip-checks: true
2022-06-22 10:12:36 +00:00
Jaco 393f528e89 Support for F32 & F64 (#4958)
* Support for F32 & F64

* Additional

* Adjust

* Expand

* Empty creation

* Empty creation #2 (no params)

* Comment around toJSON()

* createdAtHash

* Float tests

* Comments

* typo

* Expand class description

* Add floats to InterfaceTypes

* Jiggle names

* CHANGELOG
2022-06-22 13:02:41 +03:00
github-actions[bot] 4a9d5fd3c1 [CI Skip] release/beta 8.9.2-9
skip-checks: true
2022-06-22 09:16:52 +00:00
Jaco 8e8bcd5f68 Trigger bundles 2022-06-22 12:07:50 +03:00
Jaco bd300791b5 Bump deps (w/ CI performance skips) (#4971)
* Bump deps (w/ CI performance skips)

* Bump common
2022-06-22 12:05:14 +03:00
github-actions[bot] cd2b3be962 [CI Skip] release/beta 8.9.2-8
skip-checks: true
2022-06-22 07:08:24 +00:00
Jaco 87df83a2b9 Bump deps (#4970) 2022-06-22 09:59:50 +03:00
github-actions[bot] 697688eea5 [CI Skip] release/beta 8.9.2-7
skip-checks: true
2022-06-21 13:09:11 +00:00
Jaco 9bbe095a5d Bump dev (w/ stable deno publish) (#4968)
* Bump dev (w/ stable deno publish)

* Bump dev
2022-06-21 16:01:18 +03:00
github-actions[bot] 51a6e50b09 [CI Skip] release/beta 8.9.2-6
skip-checks: true
2022-06-21 04:56:01 +00:00
Jaco d496ab2d1e Bump TS to 4.7.4 (#4967) 2022-06-21 07:47:59 +03:00
github-actions[bot] 3acca845f7 [CI Skip] release/beta 8.9.2-5
skip-checks: true
2022-06-20 17:45:34 +00:00
Jaco 3a8b1c5683 Adjust assert usage (#4966)
* Adjust assert usage

* Adjust assert

* Apply suggestions from code review
2022-06-20 20:37:17 +03:00
github-actions[bot] 94c5c025a9 [CI Skip] release/beta 8.9.2-4
skip-checks: true
2022-06-20 11:26:54 +00:00
Jaco a7c54d704b AbstractBigInt extensible (also via wrapper) (#4965)
* AbstractBigInt extensible (also via wrapper)

* Add missing package
2022-06-20 14:17:24 +03:00
github-actions[bot] 4640939908 [CI Skip] release/beta 8.9.2-3
skip-checks: true
2022-06-20 10:43:37 +00:00
Jaco 6d07803003 Use static get [Symbol.species] () for Array & Uint8Array types (#4964) 2022-06-20 13:33:24 +03:00
github-actions[bot] 13f7e853e8 [CI Skip] release/beta 8.9.2-2
skip-checks: true
2022-06-20 08:45:34 +00:00
Jaco fbd0e4212f Change Date.now to performance.now (#4963)
* Change Date.now to performance.now

* Additional logs
2022-06-20 11:35:50 +03:00
github-actions[bot] ebb9f5c63b [CI Skip] release/beta 8.9.2-1
skip-checks: true
2022-06-20 07:55:16 +00:00
Nikos Kontakis bffb72f29f Bump substrate connect to 0.7.7 (#4962) 2022-06-20 10:45:02 +03:00
github-actions[bot] 68272615e7 [CI Skip] release/beta 8.9.2-0
skip-checks: true
2022-06-20 05:32:32 +00:00
Jaco 190959dbd4 Beefy payload adjustment (#4961) 2022-06-20 08:24:50 +03:00
118 changed files with 10045 additions and 8845 deletions
+1
View File
@@ -0,0 +1 @@
8.10.1
+1
View File
@@ -2,6 +2,7 @@ _book/
build/
build-cjs/
build-esm/
build-deno/
build-docs/
coverage/
docs/.vuepress/dist/
+19 -1
View File
@@ -1,10 +1,28 @@
# CHANGELOG
## 8.10.1 Jun 26, 2022
Contributed:
- Bump `@substrate/connect` to 0.7.7 (Thanks to https://github.com/wirednkod)
- Support `feeHistory` & `maxPriorityFeePerGas` eth RPCs (Thanks to https://github.com/crystalin)
Changes:
- Align `BeefyPayload` with Substrate master
- Use `static get [Symbol.species] ()` for `Array` & `Uint8Array` types
- Add support for (optional, non-runtime recommended) `f32` & `f64` types
- Add future-use `AbstrateBigInt` wrapper extension
- Update Codec-internal performance tests
- Add Westend 9250 upgrade block
- Update to latest Substrate, Polkadot & Kusama metadata
## 8.9.1 Jun 19, 2022
Contributed:
- Update `@substrate/connect` to latest (Thanks to https://github.com/tomaka)
- Update `@substrate/connect` to 0.7.6 (Thanks to https://github.com/tomaka)
Changes:
+3 -2
View File
@@ -1,4 +1,4 @@
3038 Jaco 8.9.1 (#4957)
3063 Jaco 8.10.1 (#4986)
83 Amaury Martiny StatementKind: Regular and Saft (#2303)
37 Keith Ingram Update contract types and rpc (#4541)
35 Stefanie Doll Updated child storage parameters (#1709)
@@ -9,12 +9,12 @@
10 Axel Chalon Make Enum/Tuple constructor use value directly if instance (#1954)
5 Chevdor Fix metadata package link (#3458)
5 Jake Naviasky Fixing approvalFlagsToBools. (#1250)
5 Nikos Kontakis Bump substrate connect to 0.7.7 (#4962)
4 Alex D Use derive customAccount and customLocks for balance overrides (#3248)
4 Alex Wang fix issue that creates duplicate providers (#983)
4 Alexander Popiak Add asset id in signing (#4009)
4 Joshy Orndorff spelling; efect -> effect (#2295)
4 Nantian fix bigint type (#3869)
4 Nikos Kontakis Update substrate connect to 0.7.5 (#4835)
4 Scott Twiname Add support for historical BlockNumber rpc methods (#4574)
4 Thibaut Sardan no subscription for http (#3127)
3 André Silva add support for ValidationCodeHash (#3640)
@@ -43,6 +43,7 @@
2 Wei Tang Use /usr/bin/env bash instead of /bin/bash (#2053)
2 Zannis Kalampoukis fix: Typegen handles structs and vectors of structs without erroring (#4743)
2 扩散性百万甜面包 Typo, deocrateMethod -> decorateMethod (#1594)
1 Alan Sapede Adds Eth feeHistory & maxPriorityFeePerGas rpc (#4956)
1 Andreea Eftene Add storage deposit support (#4304)
1 Brad Larson [NEW] Support for custom headers with providers (#2423)
1 chriswmercer little readme tweak (#279)
+4 -4
View File
@@ -11,7 +11,7 @@
},
"sideEffects": false,
"type": "commonjs",
"version": "8.9.1",
"version": "8.10.1",
"workspaces": [
"packages/*"
],
@@ -34,12 +34,12 @@
"@babel/core": "^7.18.5",
"@babel/register": "^7.17.7",
"@babel/runtime": "^7.18.3",
"@polkadot/dev": "^0.67.4",
"@polkadot/dev": "^0.67.43",
"@polkadot/typegen": "workspace:packages/typegen",
"@types/jest": "^28.1.1",
"@types/jest": "^28.1.3",
"copyfiles": "^2.4.1"
},
"resolutions": {
"typescript": "^4.7.3"
"typescript": "^4.7.4"
}
}
+8 -8
View File
@@ -20,18 +20,18 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "8.9.1",
"version": "8.10.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.18.3",
"@polkadot/api-base": "8.9.1",
"@polkadot/rpc-augment": "8.9.1",
"@polkadot/types": "8.9.1",
"@polkadot/types-augment": "8.9.1",
"@polkadot/types-codec": "8.9.1",
"@polkadot/util": "^9.5.1"
"@polkadot/api-base": "8.10.1",
"@polkadot/rpc-augment": "8.10.1",
"@polkadot/types": "8.10.1",
"@polkadot/types-augment": "8.10.1",
"@polkadot/types-codec": "8.10.1",
"@polkadot/util": "^9.6.2"
},
"devDependencies": {
"@polkadot/types-support": "8.9.1"
"@polkadot/types-support": "8.10.1"
}
}
+10 -9
View File
@@ -895,10 +895,6 @@ declare module '@polkadot/api-base/types/errors' {
* pool at a time.
**/
AccountBelongsToOtherPool: AugmentedError<ApiType>;
/**
* The member is already unbonding in this era.
**/
AlreadyUnbonding: AugmentedError<ApiType>;
/**
* The pools state cannot be changed.
**/
@@ -911,7 +907,7 @@ declare module '@polkadot/api-base/types/errors' {
* Some error occurred that should never happen. This should be reported to the
* maintainers.
**/
DefensiveError: AugmentedError<ApiType>;
Defensive: AugmentedError<ApiType>;
/**
* The caller does not have adequate permissions.
**/
@@ -921,10 +917,6 @@ declare module '@polkadot/api-base/types/errors' {
* anymore to, for example, collect rewards).
**/
FullyUnbonding: AugmentedError<ApiType>;
/**
* The pool has insufficient balance to bond as a nominator.
**/
InsufficientBond: AugmentedError<ApiType>;
/**
* Too many members in the pool or system.
**/
@@ -1855,6 +1847,10 @@ declare module '@polkadot/api-base/types/errors' {
* Not a member.
**/
NotMember: AugmentedError<ApiType>;
/**
* Too many members.
**/
TooManyMembers: AugmentedError<ApiType>;
/**
* Generic error
**/
@@ -1891,6 +1887,11 @@ declare module '@polkadot/api-base/types/errors' {
[key: string]: AugmentedError<ApiType>;
};
treasury: {
/**
* The spend origin is valid but the amount it is allowed to spend is lower than the
* amount to be spent.
**/
InsufficientPermission: AugmentedError<ApiType>;
/**
* Proposer's balance is too low.
**/
+44 -2
View File
@@ -293,6 +293,10 @@ declare module '@polkadot/api-base/types/events' {
* A proposal preimage was removed and used (the deposit was returned).
**/
PreimageUsed: AugmentedEvent<ApiType, [proposalHash: H256, provider: AccountId32, deposit: u128], { proposalHash: H256, provider: AccountId32, deposit: u128 }>;
/**
* A proposal got canceled.
**/
ProposalCanceled: AugmentedEvent<ApiType, [propIndex: u32], { propIndex: u32 }>;
/**
* A motion has been proposed by a public account.
**/
@@ -554,6 +558,10 @@ declare module '@polkadot/api-base/types/events' {
* A payout has been made to a member.
**/
PaidOut: AugmentedEvent<ApiType, [member: AccountId32, poolId: u32, payout: u128], { member: AccountId32, poolId: u32, payout: u128 }>;
/**
* The active balance of pool `pool_id` has been slashed to `balance`.
**/
PoolSlashed: AugmentedEvent<ApiType, [poolId: u32, balance: u128], { poolId: u32, balance: u128 }>;
/**
* The roles of a pool have been updated to the given new roles. Note that the depositor
* can never change.
@@ -565,12 +573,31 @@ declare module '@polkadot/api-base/types/events' {
StateChanged: AugmentedEvent<ApiType, [poolId: u32, newState: PalletNominationPoolsPoolState], { poolId: u32, newState: PalletNominationPoolsPoolState }>;
/**
* A member has unbonded from their pool.
*
* - `balance` is the corresponding balance of the number of points that has been
* requested to be unbonded (the argument of the `unbond` transaction) from the bonded
* pool.
* - `points` is the number of points that are issued as a result of `balance` being
* dissolved into the corresponding unbonding pool.
*
* In the absence of slashing, these values will match. In the presence of slashing, the
* number of points that are issued in the unbonding pool will be less than the amount
* requested to be unbonded.
**/
Unbonded: AugmentedEvent<ApiType, [member: AccountId32, poolId: u32, amount: u128], { member: AccountId32, poolId: u32, amount: u128 }>;
Unbonded: AugmentedEvent<ApiType, [member: AccountId32, poolId: u32, balance: u128, points: u128], { member: AccountId32, poolId: u32, balance: u128, points: u128 }>;
/**
* The unbond pool at `era` of pool `pool_id` has been slashed to `balance`.
**/
UnbondingPoolSlashed: AugmentedEvent<ApiType, [poolId: u32, era: u32, balance: u128], { poolId: u32, era: u32, balance: u128 }>;
/**
* A member has withdrawn from their pool.
*
* The given number of `points` have been dissolved in return of `balance`.
*
* Similar to `Unbonded` event, in the absence of slashing, the ratio of point to balance
* will be 1.
**/
Withdrawn: AugmentedEvent<ApiType, [member: AccountId32, poolId: u32, amount: u128], { member: AccountId32, poolId: u32, amount: u128 }>;
Withdrawn: AugmentedEvent<ApiType, [member: AccountId32, poolId: u32, balance: u128, points: u128], { member: AccountId32, poolId: u32, balance: u128, points: u128 }>;
/**
* Generic event
**/
@@ -1112,6 +1139,17 @@ declare module '@polkadot/api-base/types/events' {
**/
[key: string]: AugmentedEvent<ApiType>;
};
transactionPayment: {
/**
* A transaction fee `actual_fee`, of which `tip` was added to the minimum inclusion fee,
* has been paid by `who`.
**/
TransactionFeePaid: AugmentedEvent<ApiType, [who: AccountId32, actualFee: u128, tip: u128], { who: AccountId32, actualFee: u128, tip: u128 }>;
/**
* Generic event
**/
[key: string]: AugmentedEvent<ApiType>;
};
treasury: {
/**
* Some funds have been allocated.
@@ -1137,6 +1175,10 @@ declare module '@polkadot/api-base/types/events' {
* Spending has finished; this is the amount that rolls over until next spend.
**/
Rollover: AugmentedEvent<ApiType, [rolloverBalance: u128], { rolloverBalance: u128 }>;
/**
* A new spend proposal has been approved.
**/
SpendApproved: AugmentedEvent<ApiType, [proposalIndex: u32, amount: u128, beneficiary: AccountId32], { proposalIndex: u32, amount: u128, beneficiary: AccountId32 }>;
/**
* We have ended a spend period and will now allocate funds.
**/
+3
View File
@@ -849,6 +849,9 @@ declare module '@polkadot/api-base/types/storage' {
*
* This is the amount that the depositor must put as their initial stake in the pool, as an
* indication of "skin in the game".
*
* This is the value that will always exist in the staking ledger of the pool bonded account
* while all other accounts leave.
**/
minCreateBond: AugmentedQuery<ApiType, () => Observable<u128>, []> & QueryableStorageEntry<ApiType, []>;
/**
+54 -7
View File
@@ -1452,12 +1452,17 @@ declare module '@polkadot/api-base/types/submittable' {
};
grandpa: {
/**
* Note that the current authority set of the GRANDPA finality gadget has
* stalled. This will trigger a forced authority set change at the beginning
* of the next session, to be enacted `delay` blocks after that. The delay
* should be high enough to safely assume that the block signalling the
* forced change will not be re-orged (e.g. 1000 blocks). The GRANDPA voters
* will start the new authority set using the given finalized block as base.
* Note that the current authority set of the GRANDPA finality gadget has stalled.
*
* This will trigger a forced authority set change at the beginning of the next session, to
* be enacted `delay` blocks after that. The `delay` should be high enough to safely assume
* that the block signalling the forced change will not be re-orged e.g. 1000 blocks.
* The block production rate (which may be slowed down because of finality lagging) should
* be taken into account when choosing the `delay`. The GRANDPA voters based on the new
* authority will start voting on top of `best_finalized_block_number` for new finalized
* blocks. `best_finalized_block_number` should be the highest of the latest finalized
* block of all validators of the new authority set.
*
* Only callable by root.
**/
noteStalled: AugmentedSubmittable<(delay: u32 | AnyNumber | Uint8Array, bestFinalizedBlockNumber: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32]>;
@@ -2117,6 +2122,16 @@ declare module '@polkadot/api-base/types/submittable' {
* accumulated rewards, see [`BondExtra`].
**/
bondExtra: AugmentedSubmittable<(extra: PalletNominationPoolsBondExtra | { FreeBalance: any } | { Rewards: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [PalletNominationPoolsBondExtra]>;
/**
* Chill on behalf of the pool.
*
* The dispatch origin of this call must be signed by the pool nominator or the pool
* root role, same as [`Pallet::nominate`].
*
* This directly forward the call to the staking pallet, on behalf of the pool bonded
* account.
**/
chill: AugmentedSubmittable<(poolId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;
/**
* A bonded member can use this to claim their payout based on the rewards that the pool
* has accumulated since their last claimed payout (OR since joining if this is there first
@@ -2159,6 +2174,15 @@ declare module '@polkadot/api-base/types/submittable' {
* * Only a pool with [`PoolState::Open`] can be joined
**/
join: AugmentedSubmittable<(amount: Compact<u128> | AnyNumber | Uint8Array, poolId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u128>, u32]>;
/**
* Nominate on behalf of the pool.
*
* The dispatch origin of this call must be signed by the pool nominator or the pool
* root role.
*
* This directly forward the call to the staking pallet, on behalf of the pool bonded
* account.
**/
nominate: AugmentedSubmittable<(poolId: u32 | AnyNumber | Uint8Array, validators: Vec<AccountId32> | (AccountId32 | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [u32, Vec<AccountId32>]>;
/**
* Call `withdraw_unbonded` for the pools account. This call can be made by any account.
@@ -2182,12 +2206,24 @@ declare module '@polkadot/api-base/types/submittable' {
* * `max_members_per_pool` - Set [`MaxPoolMembersPerPool`].
**/
setConfigs: AugmentedSubmittable<(minJoinBond: PalletNominationPoolsConfigOpU128 | { Noop: any } | { Set: any } | { Remove: any } | string | Uint8Array, minCreateBond: PalletNominationPoolsConfigOpU128 | { Noop: any } | { Set: any } | { Remove: any } | string | Uint8Array, maxPools: PalletNominationPoolsConfigOpU32 | { Noop: any } | { Set: any } | { Remove: any } | string | Uint8Array, maxMembers: PalletNominationPoolsConfigOpU32 | { Noop: any } | { Set: any } | { Remove: any } | string | Uint8Array, maxMembersPerPool: PalletNominationPoolsConfigOpU32 | { Noop: any } | { Set: any } | { Remove: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [PalletNominationPoolsConfigOpU128, PalletNominationPoolsConfigOpU128, PalletNominationPoolsConfigOpU32, PalletNominationPoolsConfigOpU32, PalletNominationPoolsConfigOpU32]>;
/**
* Set a new metadata for the pool.
*
* The dispatch origin of this call must be signed by the state toggler, or the root role
* of the pool.
**/
setMetadata: AugmentedSubmittable<(poolId: u32 | AnyNumber | Uint8Array, metadata: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, Bytes]>;
/**
* Set a new state for the pool.
*
* The dispatch origin of this call must be signed by the state toggler, or the root role
* of the pool.
**/
setState: AugmentedSubmittable<(poolId: u32 | AnyNumber | Uint8Array, state: PalletNominationPoolsPoolState | 'Open' | 'Blocked' | 'Destroying' | number | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletNominationPoolsPoolState]>;
/**
* Unbond up to `unbonding_points` of the `member_account`'s funds from the pool. It
* implicitly collects the rewards one last time, since not doing so would mean some
* rewards would go forfeited.
* rewards would be forfeited.
*
* Under certain conditions, this call can be dispatched permissionlessly (i.e. by any
* account).
@@ -4209,6 +4245,17 @@ declare module '@polkadot/api-base/types/submittable' {
* exist altogether, thus there is no way it would have been approved in the first place.
**/
removeApproval: AugmentedSubmittable<(proposalId: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>]>;
/**
* Propose and approve a spend of treasury funds.
*
* - `origin`: Must be `SpendOrigin` with the `Success` value being at least `amount`.
* - `amount`: The amount to be transferred from the treasury to the `beneficiary`.
* - `beneficiary`: The destination account for the transfer.
*
* NOTE: For record-keeping purposes, the proposer is deemed to be equivalent to the
* beneficiary.
**/
spend: AugmentedSubmittable<(amount: Compact<u128> | AnyNumber | Uint8Array, beneficiary: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u128>, MultiAddress]>;
/**
* Generic tx
**/
+4
View File
@@ -0,0 +1,4 @@
// Copyright 2017-2022 @polkadot/api-augment authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './index';
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/api-augment', path: 'auto', type: 'auto', version: '8.9.1' };
export const packageInfo = { name: '@polkadot/api-augment', path: 'auto', type: 'auto', version: '8.10.1' };
@@ -1557,6 +1557,10 @@ declare module '@polkadot/api-base/types/errors' {
* Not a member.
**/
NotMember: AugmentedError<ApiType>;
/**
* Too many members.
**/
TooManyMembers: AugmentedError<ApiType>;
/**
* Generic error
**/
@@ -1593,6 +1597,11 @@ declare module '@polkadot/api-base/types/errors' {
[key: string]: AugmentedError<ApiType>;
};
treasury: {
/**
* The spend origin is valid but the amount it is allowed to spend is lower than the
* amount to be spent.
**/
InsufficientPermission: AugmentedError<ApiType>;
/**
* Proposer's balance is too low.
**/
@@ -293,6 +293,10 @@ declare module '@polkadot/api-base/types/events' {
* A proposal preimage was removed and used (the deposit was returned).
**/
PreimageUsed: AugmentedEvent<ApiType, [proposalHash: H256, provider: AccountId32, deposit: u128], { proposalHash: H256, provider: AccountId32, deposit: u128 }>;
/**
* A proposal got canceled.
**/
ProposalCanceled: AugmentedEvent<ApiType, [propIndex: u32], { propIndex: u32 }>;
/**
* A motion has been proposed by a public account.
**/
@@ -942,6 +946,17 @@ declare module '@polkadot/api-base/types/events' {
**/
[key: string]: AugmentedEvent<ApiType>;
};
transactionPayment: {
/**
* A transaction fee `actual_fee`, of which `tip` was added to the minimum inclusion fee,
* has been paid by `who`.
**/
TransactionFeePaid: AugmentedEvent<ApiType, [who: AccountId32, actualFee: u128, tip: u128], { who: AccountId32, actualFee: u128, tip: u128 }>;
/**
* Generic event
**/
[key: string]: AugmentedEvent<ApiType>;
};
treasury: {
/**
* Some funds have been allocated.
@@ -967,6 +982,10 @@ declare module '@polkadot/api-base/types/events' {
* Spending has finished; this is the amount that rolls over until next spend.
**/
Rollover: AugmentedEvent<ApiType, [rolloverBalance: u128], { rolloverBalance: u128 }>;
/**
* A new spend proposal has been approved.
**/
SpendApproved: AugmentedEvent<ApiType, [proposalIndex: u32, amount: u128, beneficiary: AccountId32], { proposalIndex: u32, amount: u128, beneficiary: AccountId32 }>;
/**
* We have ended a spend period and will now allocate funds.
**/
+22 -6
View File
@@ -1401,12 +1401,17 @@ declare module '@polkadot/api-base/types/submittable' {
};
grandpa: {
/**
* Note that the current authority set of the GRANDPA finality gadget has
* stalled. This will trigger a forced authority set change at the beginning
* of the next session, to be enacted `delay` blocks after that. The delay
* should be high enough to safely assume that the block signalling the
* forced change will not be re-orged (e.g. 1000 blocks). The GRANDPA voters
* will start the new authority set using the given finalized block as base.
* Note that the current authority set of the GRANDPA finality gadget has stalled.
*
* This will trigger a forced authority set change at the beginning of the next session, to
* be enacted `delay` blocks after that. The `delay` should be high enough to safely assume
* that the block signalling the forced change will not be re-orged e.g. 1000 blocks.
* The block production rate (which may be slowed down because of finality lagging) should
* be taken into account when choosing the `delay`. The GRANDPA voters based on the new
* authority will start voting on top of `best_finalized_block_number` for new finalized
* blocks. `best_finalized_block_number` should be the highest of the latest finalized
* block of all validators of the new authority set.
*
* Only callable by root.
**/
noteStalled: AugmentedSubmittable<(delay: u32 | AnyNumber | Uint8Array, bestFinalizedBlockNumber: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32]>;
@@ -3562,6 +3567,17 @@ declare module '@polkadot/api-base/types/submittable' {
* exist altogether, thus there is no way it would have been approved in the first place.
**/
removeApproval: AugmentedSubmittable<(proposalId: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>]>;
/**
* Propose and approve a spend of treasury funds.
*
* - `origin`: Must be `SpendOrigin` with the `Success` value being at least `amount`.
* - `amount`: The amount to be transferred from the treasury to the `beneficiary`.
* - `beneficiary`: The destination account for the transfer.
*
* NOTE: For record-keeping purposes, the proposer is deemed to be equivalent to the
* beneficiary.
**/
spend: AugmentedSubmittable<(amount: Compact<u128> | AnyNumber | Uint8Array, beneficiary: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u128>, MultiAddress]>;
/**
* Generic tx
**/
+4 -4
View File
@@ -20,13 +20,13 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "8.9.1",
"version": "8.10.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.18.3",
"@polkadot/rpc-core": "8.9.1",
"@polkadot/types": "8.9.1",
"@polkadot/util": "^9.5.1",
"@polkadot/rpc-core": "8.10.1",
"@polkadot/types": "8.10.1",
"@polkadot/util": "^9.6.2",
"rxjs": "^7.5.5"
}
}
+4
View File
@@ -0,0 +1,4 @@
// Copyright 2017-2022 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './index';
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/api-base', path: 'auto', type: 'auto', version: '8.9.1' };
export const packageInfo = { name: '@polkadot/api-base', path: 'auto', type: 'auto', version: '8.10.1' };
+9 -9
View File
@@ -20,20 +20,20 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "8.9.1",
"version": "8.10.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.18.3",
"@polkadot/api": "8.9.1",
"@polkadot/types": "8.9.1",
"@polkadot/types-codec": "8.9.1",
"@polkadot/types-create": "8.9.1",
"@polkadot/util": "^9.5.1",
"@polkadot/util-crypto": "^9.5.1",
"@polkadot/api": "8.10.1",
"@polkadot/types": "8.10.1",
"@polkadot/types-codec": "8.10.1",
"@polkadot/types-create": "8.10.1",
"@polkadot/util": "^9.6.2",
"@polkadot/util-crypto": "^9.6.2",
"rxjs": "^7.5.5"
},
"devDependencies": {
"@polkadot/api-augment": "8.9.1",
"@polkadot/keyring": "^9.5.1"
"@polkadot/api-augment": "8.10.1",
"@polkadot/keyring": "^9.6.2"
}
}
+4
View File
@@ -0,0 +1,4 @@
// Copyright 2017-2022 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './index';
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/api-contract', path: 'auto', type: 'auto', version: '8.9.1' };
export const packageInfo = { name: '@polkadot/api-contract', path: 'auto', type: 'auto', version: '8.10.1' };
+14 -14
View File
@@ -20,25 +20,25 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "8.9.1",
"version": "8.10.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.18.3",
"@polkadot/api": "8.9.1",
"@polkadot/api-augment": "8.9.1",
"@polkadot/api-base": "8.9.1",
"@polkadot/rpc-core": "8.9.1",
"@polkadot/types": "8.9.1",
"@polkadot/types-codec": "8.9.1",
"@polkadot/util": "^9.5.1",
"@polkadot/util-crypto": "^9.5.1",
"@polkadot/api": "8.10.1",
"@polkadot/api-augment": "8.10.1",
"@polkadot/api-base": "8.10.1",
"@polkadot/rpc-core": "8.10.1",
"@polkadot/types": "8.10.1",
"@polkadot/types-codec": "8.10.1",
"@polkadot/util": "^9.6.2",
"@polkadot/util-crypto": "^9.6.2",
"rxjs": "^7.5.5"
},
"devDependencies": {
"@polkadot/api": "8.9.1",
"@polkadot/api-augment": "8.9.1",
"@polkadot/rpc-augment": "8.9.1",
"@polkadot/rpc-provider": "8.9.1",
"@polkadot/types-support": "8.9.1"
"@polkadot/api": "8.10.1",
"@polkadot/api-augment": "8.10.1",
"@polkadot/rpc-augment": "8.10.1",
"@polkadot/rpc-provider": "8.10.1",
"@polkadot/types-support": "8.10.1"
}
}
+4
View File
@@ -0,0 +1,4 @@
// Copyright 2017-2022 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './index';
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/api-derive', path: 'auto', type: 'auto', version: '8.9.1' };
export const packageInfo = { name: '@polkadot/api-derive', path: 'auto', type: 'auto', version: '8.10.1' };
+17 -17
View File
@@ -20,29 +20,29 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "8.9.1",
"version": "8.10.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.18.3",
"@polkadot/api-augment": "8.9.1",
"@polkadot/api-base": "8.9.1",
"@polkadot/api-derive": "8.9.1",
"@polkadot/keyring": "^9.5.1",
"@polkadot/rpc-augment": "8.9.1",
"@polkadot/rpc-core": "8.9.1",
"@polkadot/rpc-provider": "8.9.1",
"@polkadot/types": "8.9.1",
"@polkadot/types-augment": "8.9.1",
"@polkadot/types-codec": "8.9.1",
"@polkadot/types-create": "8.9.1",
"@polkadot/types-known": "8.9.1",
"@polkadot/util": "^9.5.1",
"@polkadot/util-crypto": "^9.5.1",
"@polkadot/api-augment": "8.10.1",
"@polkadot/api-base": "8.10.1",
"@polkadot/api-derive": "8.10.1",
"@polkadot/keyring": "^9.6.2",
"@polkadot/rpc-augment": "8.10.1",
"@polkadot/rpc-core": "8.10.1",
"@polkadot/rpc-provider": "8.10.1",
"@polkadot/types": "8.10.1",
"@polkadot/types-augment": "8.10.1",
"@polkadot/types-codec": "8.10.1",
"@polkadot/types-create": "8.10.1",
"@polkadot/types-known": "8.10.1",
"@polkadot/util": "^9.6.2",
"@polkadot/util-crypto": "^9.6.2",
"eventemitter3": "^4.0.7",
"rxjs": "^7.5.5"
},
"devDependencies": {
"@polkadot/api-augment": "8.9.1",
"@polkadot/types-support": "8.9.1"
"@polkadot/api-augment": "8.10.1",
"@polkadot/types-support": "8.10.1"
}
}
+3 -1
View File
@@ -213,12 +213,14 @@ function types (api: ApiPromise): void {
const balance = registry.createType('Balance', 2);
const gas = registry.createType('Gas', 2);
const compact = registry.createType('Compact<u32>', 2);
const f32 = registry.createType('f32');
const u32 = registry.createType('u32');
// const random = registry.createType('RandomType', 2); // This one should deliberately show a TS error
const gasUnsafe = createTypeUnsafe(registry, 'Gas', [2]);
const overriddenUnsafe = createTypeUnsafe<Header>(registry, 'Gas', [2]);
console.log(balance, gas, compact, gasUnsafe, overriddenUnsafe, api.createType('AccountData'));
console.log(balance, gas, compact, gasUnsafe, overriddenUnsafe, u32.toNumber(), f32.toNumber(), api.createType('AccountData'));
}
async function tx (api: ApiPromise, pairs: TestKeyringMap): Promise<void> {
+4
View File
@@ -0,0 +1,4 @@
// Copyright 2017-2022 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './index';
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/api', path: 'auto', type: 'auto', version: '8.9.1' };
export const packageInfo = { name: '@polkadot/api', path: 'auto', type: 'auto', version: '8.10.1' };
+5 -5
View File
@@ -20,13 +20,13 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "8.9.1",
"version": "8.10.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.18.3",
"@polkadot/rpc-core": "8.9.1",
"@polkadot/types": "8.9.1",
"@polkadot/types-codec": "8.9.1",
"@polkadot/util": "^9.5.1"
"@polkadot/rpc-core": "8.10.1",
"@polkadot/types": "8.10.1",
"@polkadot/types-codec": "8.10.1",
"@polkadot/util": "^9.6.2"
}
}
+10 -2
View File
@@ -3,7 +3,7 @@
import type { AugmentedRpc } from '@polkadot/rpc-core/types';
import type { Metadata, StorageKey } from '@polkadot/types';
import type { Bytes, HashMap, Json, Null, Option, Text, U256, U64, Vec, bool, u32, u64 } from '@polkadot/types-codec';
import type { Bytes, HashMap, Json, Null, Option, Text, U256, U64, Vec, bool, f64, u32, u64 } from '@polkadot/types-codec';
import type { AnyNumber, Codec } from '@polkadot/types-codec/types';
import type { ExtrinsicOrHash, ExtrinsicStatus } from '@polkadot/types/interfaces/author';
import type { EpochAuthorship } from '@polkadot/types/interfaces/babe';
@@ -14,7 +14,7 @@ import type { AuthorityId } from '@polkadot/types/interfaces/consensus';
import type { CodeUploadRequest, CodeUploadResult, ContractCallRequest, ContractExecResult, ContractInstantiateResult, InstantiateRequest } from '@polkadot/types/interfaces/contracts';
import type { BlockStats } from '@polkadot/types/interfaces/dev';
import type { CreatedBlock } from '@polkadot/types/interfaces/engine';
import type { EthAccount, EthCallRequest, EthFilter, EthFilterChanges, EthLog, EthReceipt, EthRichBlock, EthSubKind, EthSubParams, EthSyncStatus, EthTransaction, EthTransactionRequest, EthWork } from '@polkadot/types/interfaces/eth';
import type { EthAccount, EthCallRequest, EthFeeHistory, EthFilter, EthFilterChanges, EthLog, EthReceipt, EthRichBlock, EthSubKind, EthSubParams, EthSyncStatus, EthTransaction, EthTransactionRequest, EthWork } from '@polkadot/types/interfaces/eth';
import type { Extrinsic } from '@polkadot/types/interfaces/extrinsics';
import type { EncodedFinalityProofs, JustificationNotification, ReportedRoundStates } from '@polkadot/types/interfaces/grandpa';
import type { MmrLeafBatchProof, MmrLeafProof } from '@polkadot/types/interfaces/mmr';
@@ -197,6 +197,10 @@ declare module '@polkadot/rpc-core/types/jsonrpc' {
* Estimate gas needed for execution of given contract.
**/
estimateGas: AugmentedRpc<(request: EthCallRequest | { from?: any; to?: any; gasPrice?: any; gas?: any; value?: any; data?: any; nonce?: any } | string | Uint8Array, number?: BlockNumber | AnyNumber | Uint8Array) => Observable<U256>>;
/**
* Returns fee history for given block count & reward percentiles
**/
feeHistory: AugmentedRpc<(blockCount: U256 | AnyNumber | Uint8Array, newestBlock: BlockNumber | AnyNumber | Uint8Array, rewardPercentiles: Option<Vec<f64>> | null | object | string | Uint8Array) => Observable<EthFeeHistory>>;
/**
* Returns current gas price.
**/
@@ -289,6 +293,10 @@ declare module '@polkadot/rpc-core/types/jsonrpc' {
* Returns the number of hashes per second that the node is mining with.
**/
hashrate: AugmentedRpc<() => Observable<U256>>;
/**
* Returns max priority fee per gas
**/
maxPriorityFeePerGas: AugmentedRpc<() => Observable<U256>>;
/**
* Returns true if client is actively mining new blocks.
**/
+4
View File
@@ -0,0 +1,4 @@
// Copyright 2017-2022 @polkadot/rpc-augment authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './index';
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/rpc-augment', path: 'auto', type: 'auto', version: '8.9.1' };
export const packageInfo = { name: '@polkadot/rpc-augment', path: 'auto', type: 'auto', version: '8.10.1' };
+7 -7
View File
@@ -20,18 +20,18 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "8.9.1",
"version": "8.10.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.18.3",
"@polkadot/rpc-augment": "8.9.1",
"@polkadot/rpc-provider": "8.9.1",
"@polkadot/types": "8.9.1",
"@polkadot/util": "^9.5.1",
"@polkadot/rpc-augment": "8.10.1",
"@polkadot/rpc-provider": "8.10.1",
"@polkadot/types": "8.10.1",
"@polkadot/util": "^9.6.2",
"rxjs": "^7.5.5"
},
"devDependencies": {
"@polkadot/keyring": "^9.5.1",
"@polkadot/rpc-augment": "8.9.1"
"@polkadot/keyring": "^9.6.2",
"@polkadot/rpc-augment": "8.10.1"
}
}
+7 -3
View File
@@ -12,7 +12,7 @@ import type { RpcInterfaceMethod } from './types';
import { Observable, publishReplay, refCount } from 'rxjs';
import { rpcDefinitions } from '@polkadot/types';
import { assert, hexToU8a, isFunction, isNull, isUndefined, lazyMethod, logger, memoize, objectSpread, u8aConcat, u8aToU8a } from '@polkadot/util';
import { hexToU8a, isFunction, isNull, isUndefined, lazyMethod, logger, memoize, objectSpread, u8aConcat, u8aToU8a } from '@polkadot/util';
import { drr, refCountDelay } from './util';
@@ -106,7 +106,9 @@ export class RpcCore {
*/
constructor (instanceId: string, registry: Registry, provider: ProviderInterface, userRpc: Record<string, Record<string, DefinitionRpc | DefinitionRpcSub>> = {}) {
// eslint-disable-next-line @typescript-eslint/unbound-method
assert(provider && isFunction(provider.send), 'Expected Provider to API create');
if (!provider || !isFunction(provider.send)) {
throw new Error('Expected Provider to API create');
}
this.#instanceId = instanceId;
this.#registryDefault = registry;
@@ -360,7 +362,9 @@ export class RpcCore {
? ''
: ` (${def.params.length - reqArgCount} optional)`;
assert(inputs.length >= reqArgCount && inputs.length <= def.params.length, () => `Expected ${def.params.length} parameters${optText}, ${inputs.length} found instead`);
if (inputs.length < reqArgCount || inputs.length > def.params.length) {
throw new Error(`Expected ${def.params.length} parameters${optText}, ${inputs.length} found instead`);
}
return inputs.map((input, index): Codec =>
registry.createTypeUnsafe(def.params[index].type, [input], { blockHash })
+4
View File
@@ -0,0 +1,4 @@
// Copyright 2017-2022 @polkadot/rpc-core authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './index';
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/rpc-core', path: 'auto', type: 'auto', version: '8.9.1' };
export const packageInfo = { name: '@polkadot/rpc-core', path: 'auto', type: 'auto', version: '8.10.1' };
+11 -11
View File
@@ -20,21 +20,21 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "8.9.1",
"version": "8.10.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.18.3",
"@polkadot/keyring": "^9.5.1",
"@polkadot/types": "8.9.1",
"@polkadot/types-support": "8.9.1",
"@polkadot/util": "^9.5.1",
"@polkadot/util-crypto": "^9.5.1",
"@polkadot/x-fetch": "^9.5.1",
"@polkadot/x-global": "^9.5.1",
"@polkadot/x-ws": "^9.5.1",
"@substrate/connect": "0.7.6",
"@polkadot/keyring": "^9.6.2",
"@polkadot/types": "8.10.1",
"@polkadot/types-support": "8.10.1",
"@polkadot/util": "^9.6.2",
"@polkadot/util-crypto": "^9.6.2",
"@polkadot/x-fetch": "^9.6.2",
"@polkadot/x-global": "^9.6.2",
"@polkadot/x-ws": "^9.6.2",
"@substrate/connect": "0.7.7",
"eventemitter3": "^4.0.7",
"mock-socket": "^9.1.5",
"nock": "^13.2.6"
"nock": "^13.2.7"
}
}
+18 -4
View File
@@ -3,7 +3,7 @@
import type { JsonRpcRequest, JsonRpcResponse, JsonRpcResponseBaseError } from '../types';
import { assert, isNumber, isString, isUndefined, stringify } from '@polkadot/util';
import { isNumber, isString, isUndefined, stringify } from '@polkadot/util';
import RpcError from './error';
@@ -36,15 +36,29 @@ export class RpcCoder {
#id = 0;
public decodeResponse (response?: JsonRpcResponse): unknown {
assert(response && response.jsonrpc === '2.0', 'Invalid jsonrpc field in decoded object');
if (!response || response.jsonrpc !== '2.0') {
throw new Error('Invalid jsonrpc field in decoded object');
}
const isSubscription = !isUndefined(response.params) && !isUndefined(response.method);
assert(isNumber(response.id) || (isSubscription && (isNumber(response.params.subscription) || isString(response.params.subscription))), 'Invalid id field in decoded object');
if (
!isNumber(response.id) &&
(
!isSubscription || (
!isNumber(response.params.subscription) &&
!isString(response.params.subscription)
)
)
) {
throw new Error('Invalid id field in decoded object');
}
checkError(response.error);
assert(!isUndefined(response.result) || isSubscription, 'No result found in jsonrpc response');
if (response.result === undefined && !isSubscription) {
throw new Error('No result found in jsonrpc response');
}
if (isSubscription) {
checkError(response.params.error);
+7 -3
View File
@@ -3,7 +3,7 @@
import type { JsonRpcResponse, ProviderInterface, ProviderInterfaceCallback, ProviderInterfaceEmitCb, ProviderInterfaceEmitted, ProviderStats } from '../types';
import { assert, logger } from '@polkadot/util';
import { logger } from '@polkadot/util';
import { fetch } from '@polkadot/x-fetch';
import { RpcCoder } from '../coder';
@@ -49,7 +49,9 @@ export class HttpProvider implements ProviderInterface {
* @param {string} endpoint The endpoint url starting with http://
*/
constructor (endpoint: string = defaults.HTTP_URL, headers: Record<string, string> = {}) {
assert(/^(https|http):\/\//.test(endpoint), () => `Endpoint should start with 'http://', received '${endpoint}'`);
if (!/^(https|http):\/\//.test(endpoint)) {
throw new Error(`Endpoint should start with 'http://' or 'https://', received '${endpoint}'`);
}
this.#coder = new RpcCoder();
this.#endpoint = endpoint;
@@ -156,7 +158,9 @@ export class HttpProvider implements ProviderInterface {
method: 'POST'
});
assert(response.ok, () => `[${response.status}]: ${response.statusText}`);
if (!response.ok) {
throw new Error(`[${response.status}]: ${response.statusText}`);
}
const result = await response.text();
+10 -4
View File
@@ -16,7 +16,7 @@ import jsonrpc from '@polkadot/types/interfaces/jsonrpc';
import rpcHeader from '@polkadot/types-support/json/Header.004.json';
import rpcSignedBlock from '@polkadot/types-support/json/SignedBlock.004.immortal.json';
import rpcMetadata from '@polkadot/types-support/metadata/static-substrate';
import { assert, BN, bnToU8a, logger, u8aToHex } from '@polkadot/util';
import { BN, bnToU8a, logger, u8aToHex } from '@polkadot/util';
import { randomAsU8a } from '@polkadot/util-crypto';
const INTERVAL = 1000;
@@ -130,7 +130,9 @@ export class MockProvider implements ProviderInterface {
public async send <T = any> (method: string, params: unknown[]): Promise<T> {
l.debug(() => ['send', method, params]);
assert(this.requests[method], () => `provider.send: Invalid method '${method}'`);
if (!this.requests[method]) {
throw new Error(`provider.send: Invalid method '${method}'`);
}
return this.requests[method](this.db, params) as T;
}
@@ -139,7 +141,9 @@ export class MockProvider implements ProviderInterface {
public async subscribe (type: string, method: string, ...params: unknown[]): Promise<number> {
l.debug(() => ['subscribe', method, params]);
assert(this.subscriptions[method], () => `provider.subscribe: Invalid method '${method}'`);
if (!this.subscriptions[method]) {
throw new Error(`provider.subscribe: Invalid method '${method}'`);
}
const callback = params.pop() as MockStateSubscriptionCallback;
const id = ++this.subscriptionId;
@@ -160,7 +164,9 @@ export class MockProvider implements ProviderInterface {
l.debug(() => ['unsubscribe', id, sub]);
assert(sub, () => `Unable to find subscription for ${id}`);
if (!sub) {
throw new Error(`Unable to find subscription for ${id}`);
}
delete this.subscriptionMap[id];
delete this.subscriptions[sub].callbacks[id];
+4
View File
@@ -0,0 +1,4 @@
// Copyright 2017-2022 @polkadot/rpc-provider authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './index';
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/rpc-provider', path: 'auto', type: 'auto', version: '8.9.1' };
export const packageInfo = { name: '@polkadot/rpc-provider', path: 'auto', type: 'auto', version: '8.10.1' };
@@ -1,8 +1,6 @@
// Copyright 2017-2022 @polkadot/rpc-provider authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { assert } from '@polkadot/util';
export interface SmoldotHealth {
isSyncing: boolean
peers: number
@@ -63,10 +61,9 @@ export function healthChecker (): HealthChecker {
return checker.responsePassThrough(jsonRpcResponse);
},
sendJsonRpc: (request) => {
assert(
sendJsonRpc,
'setSendJsonRpc must be called before sending requests'
);
if (!sendJsonRpc) {
throw new Error('setSendJsonRpc must be called before sending requests');
}
if (checker === null) {
sendJsonRpc(request);
@@ -78,14 +75,12 @@ export function healthChecker (): HealthChecker {
sendJsonRpc = cb;
},
start: (healthCallback) => {
assert(
checker === null,
"Can't start the health checker multiple times in parallel"
);
assert(
sendJsonRpc,
'setSendJsonRpc must be called before starting the health checks'
);
if (checker !== null) {
throw new Error("Can't start the health checker multiple times in parallel");
} else if (!sendJsonRpc) {
throw new Error('setSendJsonRpc must be called before starting the health checks');
}
checker = new InnerChecker(healthCallback, sendJsonRpc);
checker.update(true);
},
@@ -216,7 +211,9 @@ class InnerChecker {
const id: string = parsedResponse.id;
// Need to remove the `extern:` prefix.
assert(id.startsWith('extern:'), 'State inconsistency in health checker');
if (!id.startsWith('extern:')) {
throw new Error('State inconsistency in health checker');
}
const newId = JSON.parse(id.slice('extern:'.length)) as string;
@@ -283,10 +280,9 @@ class InnerChecker {
};
startSubscription = (): void => {
assert(
!this.#currentSubunsubRequestId && !this.#currentSubscriptionId,
'Internal error in health checker'
);
if (this.#currentSubunsubRequestId || this.#currentSubscriptionId) {
throw new Error('Internal error in health checker');
}
this.#currentSubunsubRequestId = 'health-checker:'.concat(
this.#nextRequestId.toString()
@@ -303,10 +299,9 @@ class InnerChecker {
};
endSubscription = (): void => {
assert(
!this.#currentSubunsubRequestId && this.#currentSubscriptionId,
'Internal error in health checker'
);
if (this.#currentSubunsubRequestId || !this.#currentSubscriptionId) {
throw new Error('Internal error in health checker');
}
this.#currentSubunsubRequestId = 'health-checker:'.concat(
this.#nextRequestId.toString()
@@ -7,7 +7,7 @@ import type { JsonRpcResponse, ProviderInterface, ProviderInterfaceCallback, Pro
import { Chain, createScClient, ScClient, WellKnownChain } from '@substrate/connect';
import EventEmitter from 'eventemitter3';
import { assert, isError } from '@polkadot/util';
import { isError } from '@polkadot/util';
import { RpcCoder } from '../coder';
import { healthChecker } from './Health';
@@ -71,7 +71,9 @@ export class ScProvider implements ProviderInterface {
// Config details can be found in @substrate/connect repo following the link:
// https://github.com/paritytech/substrate-connect/blob/main/packages/connect/src/connector/index.ts
async connect (config?: ScConfig): Promise<void> {
assert(!this.isConnected, 'Already connected!');
if (this.isConnected) {
throw new Error('Already connected!');
}
// it could happen that after emitting `disconnected` due to the fact taht
// smoldot is syncing, the consumer tries to reconnect after a certain amount
@@ -91,7 +93,10 @@ export class ScProvider implements ProviderInterface {
? scClients.get(this.#sharedSandbox)
: createScClient(config);
assert(client, 'Unkown ScProvider!');
if (!client) {
throw new Error('Unkown ScProvider!');
}
scClients.set(this, client);
const hc = healthChecker();
@@ -156,7 +161,9 @@ export class ScProvider implements ProviderInterface {
const stale = staleSubscriptions.pop();
assert(stale, 'Unable to get stale subscription');
if (!stale) {
throw new Error('Unable to get stale subscription');
}
const { id, unsubscribeMethod } = stale;
@@ -264,7 +271,9 @@ export class ScProvider implements ProviderInterface {
}
public async send<T = any> (method: string, params: unknown[]): Promise<T> {
assert(this.isConnected && this.#chain, 'Provider is not connected');
if (!this.isConnected || !this.#chain) {
throw new Error('Provider is not connected');
}
const chain = await this.#chain;
const [id, json] = this.#coder.encodeJson(method, params);
@@ -302,10 +311,9 @@ export class ScProvider implements ProviderInterface {
params: any[],
callback: ProviderInterfaceCallback
): Promise<number | string> {
assert(
subscriptionUnsubscriptionMethods.has(method),
`Unsupported subscribe method: ${method}`
);
if (!subscriptionUnsubscriptionMethods.has(method)) {
throw new Error(`Unsupported subscribe method: ${method}`);
}
const id = await this.send<number | string>(method, params);
const subscriptionId = `${type}::${id}`;
@@ -320,7 +328,9 @@ export class ScProvider implements ProviderInterface {
const unsubscribeMethod = subscriptionUnsubscriptionMethods.get(method);
assert(unsubscribeMethod, 'Invalid unsubscribe method found');
if (!unsubscribeMethod) {
throw new Error('Invalid unsubscribe method found');
}
this.#subscriptions.set(subscriptionId, [cb, { id, unsubscribeMethod }]);
@@ -332,10 +342,9 @@ export class ScProvider implements ProviderInterface {
method: string,
id: number | string
): Promise<boolean> {
assert(
this.isConnected,
'Provider is not connected'
);
if (!this.isConnected) {
throw new Error('Provider is not connected');
}
const subscriptionId = `${type}::${id}`;
+13 -5
View File
@@ -7,7 +7,7 @@ import type { JsonRpcResponse, ProviderInterface, ProviderInterfaceCallback, Pro
import EventEmitter from 'eventemitter3';
import { assert, isChildClass, isNull, isUndefined, logger, objectSpread } from '@polkadot/util';
import { isChildClass, isNull, isUndefined, logger, objectSpread } from '@polkadot/util';
import { xglobal } from '@polkadot/x-global';
import { WebSocket } from '@polkadot/x-ws';
@@ -122,10 +122,14 @@ export class WsProvider implements ProviderInterface {
? endpoint
: [endpoint];
assert(endpoints.length !== 0, 'WsProvider requires at least one Endpoint');
if (endpoints.length === 0) {
throw new Error('WsProvider requires at least one Endpoint');
}
endpoints.forEach((endpoint) => {
assert(/^(wss|ws):\/\//.test(endpoint), () => `Endpoint should start with 'ws://', received '${endpoint}'`);
if (!/^(wss|ws):\/\//.test(endpoint)) {
throw new Error(`Endpoint should start with 'ws://', received '${endpoint}'`);
}
});
this.#eventemitter = new EventEmitter();
@@ -319,7 +323,9 @@ export class WsProvider implements ProviderInterface {
async #send <T> (id: number, body: string, method: string, params: unknown[], subscription?: SubscriptionHandler): Promise<T> {
return new Promise<T>((resolve, reject): void => {
try {
assert(this.isConnected && !isNull(this.#websocket), 'WebSocket is not connected');
if (!this.isConnected || this.#websocket === null) {
throw new Error('WebSocket is not connected');
}
const callback = (error?: Error | null, result?: T): void => {
error
@@ -531,7 +537,9 @@ export class WsProvider implements ProviderInterface {
};
#onSocketOpen = (): boolean => {
assert(!isNull(this.#websocket), 'WebSocket cannot be null in onOpen');
if (this.#websocket === null) {
throw new Error('WebSocket cannot be null in onOpen');
}
l.debug(() => ['connected to', this.#endpoints[this.#endpointIndex]]);
+12 -12
View File
@@ -20,7 +20,7 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "8.9.1",
"version": "8.10.1",
"main": "index.js",
"bin": {
"polkadot-types-chain-info": "./scripts/polkadot-types-chain-info.cjs",
@@ -33,17 +33,17 @@
"@babel/core": "^7.18.5",
"@babel/register": "^7.17.7",
"@babel/runtime": "^7.18.3",
"@polkadot/api": "8.9.1",
"@polkadot/api-augment": "8.9.1",
"@polkadot/rpc-augment": "8.9.1",
"@polkadot/rpc-provider": "8.9.1",
"@polkadot/types": "8.9.1",
"@polkadot/types-augment": "8.9.1",
"@polkadot/types-codec": "8.9.1",
"@polkadot/types-create": "8.9.1",
"@polkadot/types-support": "8.9.1",
"@polkadot/util": "^9.5.1",
"@polkadot/x-ws": "^9.5.1",
"@polkadot/api": "8.10.1",
"@polkadot/api-augment": "8.10.1",
"@polkadot/rpc-augment": "8.10.1",
"@polkadot/rpc-provider": "8.10.1",
"@polkadot/types": "8.10.1",
"@polkadot/types-augment": "8.10.1",
"@polkadot/types-codec": "8.10.1",
"@polkadot/types-create": "8.10.1",
"@polkadot/types-support": "8.10.1",
"@polkadot/util": "^9.6.2",
"@polkadot/x-ws": "^9.6.2",
"handlebars": "^4.7.7",
"websocket": "^1.0.34",
"yargs": "^17.5.1"
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/typegen', path: 'auto', type: 'auto', version: '8.9.1' };
export const packageInfo = { name: '@polkadot/typegen', path: 'auto', type: 'auto', version: '8.10.1' };
+3 -3
View File
@@ -4,8 +4,6 @@
import fs from 'fs';
import path from 'path';
import { assert } from '@polkadot/util';
import { packageInfo } from '../packageInfo';
export function writeFile (dest: string, generator: () => string, noLog?: boolean): void {
@@ -35,7 +33,9 @@ export function readTemplate (template: string): string {
.map((p) => path.join(rootDir, p, `${template}.hbs`))
.find((p) => fs.existsSync(p));
assert(file, `Unable to locate ${template}.hbs from ${rootDir}`);
if (!file) {
throw new Error(`Unable to locate ${template}.hbs from ${rootDir}`);
}
return fs.readFileSync(file).toString();
}
+4 -4
View File
@@ -20,12 +20,12 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "8.9.1",
"version": "8.10.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.18.3",
"@polkadot/types": "8.9.1",
"@polkadot/types-codec": "8.9.1",
"@polkadot/util": "^9.5.1"
"@polkadot/types": "8.10.1",
"@polkadot/types-codec": "8.10.1",
"@polkadot/util": "^9.6.2"
}
}
+5 -5
View File
@@ -5,13 +5,13 @@
export default {
/**
* Lookup79: kusama_runtime::ProxyType
* Lookup80: kusama_runtime::ProxyType
**/
KusamaRuntimeProxyType: {
_enum: ['Any', 'NonTransfer', 'Governance', 'Staking', 'IdentityJudgement', 'CancelProxy', 'Auction', 'Society']
},
/**
* Lookup258: kusama_runtime::SessionKeys
* Lookup261: kusama_runtime::SessionKeys
**/
KusamaRuntimeSessionKeys: {
grandpa: 'SpFinalityGrandpaAppPublic',
@@ -22,7 +22,7 @@ export default {
authorityDiscovery: 'SpAuthorityDiscoveryAppPublic'
},
/**
* Lookup332: kusama_runtime::OriginCaller
* Lookup335: kusama_runtime::OriginCaller
**/
KusamaRuntimeOriginCaller: {
_enum: {
@@ -129,7 +129,7 @@ export default {
}
},
/**
* Lookup398: kusama_runtime::NposCompactSolution24
* Lookup401: kusama_runtime::NposCompactSolution24
**/
KusamaRuntimeNposCompactSolution24: {
votes1: 'Vec<(Compact<u32>,Compact<u16>)>',
@@ -158,7 +158,7 @@ export default {
votes24: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);23],Compact<u16>)>'
},
/**
* Lookup774: kusama_runtime::Runtime
* Lookup779: kusama_runtime::Runtime
**/
KusamaRuntimeRuntime: 'Null'
};
File diff suppressed because it is too large Load Diff
@@ -945,7 +945,7 @@ export default {
index: 'u32'
},
/**
* Lookup88: pallet_bounties::pallet::Event<T>
* Lookup88: pallet_bounties::pallet::Event<T, I>
**/
PalletBountiesEvent: {
_enum: {
@@ -977,7 +977,7 @@ export default {
}
},
/**
* Lookup89: pallet_tips::pallet::Event<T>
* Lookup89: pallet_tips::pallet::Event<T, I>
**/
PalletTipsEvent: {
_enum: {
@@ -2968,7 +2968,7 @@ export default {
}
},
/**
* Lookup328: pallet_bounties::pallet::Call<T>
* Lookup328: pallet_bounties::pallet::Call<T, I>
**/
PalletBountiesCall: {
_enum: {
@@ -3007,7 +3007,7 @@ export default {
}
},
/**
* Lookup329: pallet_tips::pallet::Call<T>
* Lookup329: pallet_tips::pallet::Call<T, I>
**/
PalletTipsCall: {
_enum: {
@@ -4715,7 +4715,7 @@ export default {
}
},
/**
* Lookup560: pallet_bounties::pallet::Error<T>
* Lookup560: pallet_bounties::pallet::Error<T, I>
**/
PalletBountiesError: {
_enum: ['InsufficientProposersBalance', 'InvalidIndex', 'ReasonTooBig', 'UnexpectedStatus', 'RequireCurator', 'InvalidValue', 'InvalidFee', 'PendingPayout', 'Premature', 'HasActiveChildBounty', 'TooManyQueued']
@@ -4733,7 +4733,7 @@ export default {
findersFee: 'bool'
},
/**
* Lookup562: pallet_tips::pallet::Error<T>
* Lookup562: pallet_tips::pallet::Error<T, I>
**/
PalletTipsError: {
_enum: ['ReasonTooBig', 'AlreadyKnown', 'UnknownTip', 'NotFinder', 'StillOpen', 'Premature']
@@ -6,7 +6,7 @@ declare module '@polkadot/types/lookup' {
import type { ITuple } from '@polkadot/types-codec/types';
import type { PerU16 } from '@polkadot/types/interfaces/runtime';
/** @name KusamaRuntimeProxyType (79) */
/** @name KusamaRuntimeProxyType (80) */
export interface KusamaRuntimeProxyType extends Enum {
readonly isAny: boolean;
readonly isNonTransfer: boolean;
@@ -19,7 +19,7 @@ declare module '@polkadot/types/lookup' {
readonly type: 'Any' | 'NonTransfer' | 'Governance' | 'Staking' | 'IdentityJudgement' | 'CancelProxy' | 'Auction' | 'Society';
}
/** @name KusamaRuntimeSessionKeys (258) */
/** @name KusamaRuntimeSessionKeys (261) */
export interface KusamaRuntimeSessionKeys extends Struct {
readonly grandpa: SpFinalityGrandpaAppPublic;
readonly babe: SpConsensusBabeAppPublic;
@@ -29,7 +29,7 @@ declare module '@polkadot/types/lookup' {
readonly authorityDiscovery: SpAuthorityDiscoveryAppPublic;
}
/** @name KusamaRuntimeOriginCaller (332) */
/** @name KusamaRuntimeOriginCaller (335) */
export interface KusamaRuntimeOriginCaller extends Enum {
readonly isSystem: boolean;
readonly asSystem: FrameSupportDispatchRawOrigin;
@@ -45,7 +45,7 @@ declare module '@polkadot/types/lookup' {
readonly type: 'System' | 'Void' | 'Council' | 'TechnicalCommittee' | 'ParachainsOrigin' | 'XcmPallet';
}
/** @name KusamaRuntimeNposCompactSolution24 (398) */
/** @name KusamaRuntimeNposCompactSolution24 (401) */
export interface KusamaRuntimeNposCompactSolution24 extends Struct {
readonly votes1: Vec<ITuple<[Compact<u32>, Compact<u16>]>>;
readonly votes2: Vec<ITuple<[Compact<u32>, ITuple<[Compact<u16>, Compact<PerU16>]>, Compact<u16>]>>;
@@ -73,7 +73,7 @@ declare module '@polkadot/types/lookup' {
readonly votes24: Vec<ITuple<[Compact<u32>, Vec<ITuple<[Compact<u16>, Compact<PerU16>]>>, Compact<u16>]>>;
}
/** @name KusamaRuntimeRuntime (774) */
/** @name KusamaRuntimeRuntime (779) */
export type KusamaRuntimeRuntime = Null;
} // declare module
File diff suppressed because it is too large Load Diff
+4
View File
@@ -0,0 +1,4 @@
// Copyright 2017-2022 @polkadot/types-augment authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './index';
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/types-augment', path: 'auto', type: 'auto', version: '8.9.1' };
export const packageInfo = { name: '@polkadot/types-augment', path: 'auto', type: 'auto', version: '8.10.1' };
@@ -2,7 +2,7 @@
/* eslint-disable */
import type { Data, StorageKey } from '@polkadot/types';
import type { BitVec, Bool, Bytes, I128, I16, I256, I32, I64, I8, Json, Null, OptionBool, Raw, Text, Type, U128, U16, U256, U32, U64, U8, USize, bool, i128, i16, i256, i32, i64, i8, u128, u16, u256, u32, u64, u8, usize } from '@polkadot/types-codec';
import type { BitVec, Bool, Bytes, F32, F64, I128, I16, I256, I32, I64, I8, Json, Null, OptionBool, Raw, Text, Type, U128, U16, U256, U32, U64, U8, USize, bool, f32, f64, i128, i16, i256, i32, i64, i8, u128, u16, u256, u32, u64, u8, usize } from '@polkadot/types-codec';
import type { AssetApproval, AssetApprovalKey, AssetBalance, AssetDestroyWitness, AssetDetails, AssetMetadata, TAssetBalance, TAssetDepositBalance } from '@polkadot/types/interfaces/assets';
import type { BlockAttestations, IncludedBlocks, MoreAttestations } from '@polkadot/types/interfaces/attestations';
import type { RawAuraPreDigest } from '@polkadot/types/interfaces/aura';
@@ -10,7 +10,7 @@ import type { ExtrinsicOrHash, ExtrinsicStatus } from '@polkadot/types/interface
import type { UncleEntryItem } from '@polkadot/types/interfaces/authorship';
import type { AllowedSlots, BabeAuthorityWeight, BabeBlockWeight, BabeEpochConfiguration, BabeEquivocationProof, BabeWeight, EpochAuthorship, MaybeRandomness, MaybeVrf, NextConfigDescriptor, NextConfigDescriptorV1, Randomness, RawBabePreDigest, RawBabePreDigestCompat, RawBabePreDigestPrimary, RawBabePreDigestPrimaryTo159, RawBabePreDigestSecondaryPlain, RawBabePreDigestSecondaryTo159, RawBabePreDigestSecondaryVRF, RawBabePreDigestTo159, SlotNumber, VrfData, VrfOutput, VrfProof } from '@polkadot/types/interfaces/babe';
import type { AccountData, BalanceLock, BalanceLockTo212, BalanceStatus, Reasons, ReserveData, ReserveIdentifier, VestingSchedule, WithdrawReasons } from '@polkadot/types/interfaces/balances';
import type { BeefyCommitment, BeefyId, BeefyNextAuthoritySet, BeefyPayload, BeefySignedCommitment, MmrRootHash, ValidatorSetId } from '@polkadot/types/interfaces/beefy';
import type { BeefyCommitment, BeefyId, BeefyNextAuthoritySet, BeefyPayload, BeefyPayloadId, BeefySignedCommitment, MmrRootHash, ValidatorSetId } from '@polkadot/types/interfaces/beefy';
import type { BridgeMessageId, BridgedBlockHash, BridgedBlockNumber, BridgedHeader, CallOrigin, ChainId, DeliveredMessages, DispatchFeePayment, InboundLaneData, InboundRelayer, InitializationData, LaneId, MessageData, MessageKey, MessageNonce, MessagesDeliveryProofOf, MessagesProofOf, OperatingMode, OutboundLaneData, OutboundMessageFee, OutboundPayload, Parameter, RelayerId, UnrewardedRelayer, UnrewardedRelayersState } from '@polkadot/types/interfaces/bridges';
import type { BlockHash } from '@polkadot/types/interfaces/chain';
import type { PrefixedStorageKey } from '@polkadot/types/interfaces/childstate';
@@ -25,7 +25,7 @@ import type { AccountVote, AccountVoteSplit, AccountVoteStandard, Conviction, De
import type { BlockStats } from '@polkadot/types/interfaces/dev';
import type { ApprovalFlag, DefunctVoter, Renouncing, SetIndex, Vote, VoteIndex, VoteThreshold, VoterInfo } from '@polkadot/types/interfaces/elections';
import type { CreatedBlock, ImportedAux } from '@polkadot/types/interfaces/engine';
import type { BlockV0, BlockV1, BlockV2, EIP1559Transaction, EIP2930Transaction, EthAccessList, EthAccessListItem, EthAccount, EthAddress, EthBlock, EthBloom, EthCallRequest, EthFilter, EthFilterAddress, EthFilterChanges, EthFilterTopic, EthFilterTopicEntry, EthFilterTopicInner, EthHeader, EthLog, EthReceipt, EthRichBlock, EthRichHeader, EthStorageProof, EthSubKind, EthSubParams, EthSubResult, EthSyncInfo, EthSyncStatus, EthTransaction, EthTransactionAction, EthTransactionCondition, EthTransactionRequest, EthTransactionSignature, EthTransactionStatus, EthWork, EthereumAccountId, EthereumAddress, EthereumLookupSource, EthereumSignature, LegacyTransaction, TransactionV0, TransactionV1, TransactionV2 } from '@polkadot/types/interfaces/eth';
import type { BlockV0, BlockV1, BlockV2, EIP1559Transaction, EIP2930Transaction, EthAccessList, EthAccessListItem, EthAccount, EthAddress, EthBlock, EthBloom, EthCallRequest, EthFeeHistory, EthFilter, EthFilterAddress, EthFilterChanges, EthFilterTopic, EthFilterTopicEntry, EthFilterTopicInner, EthHeader, EthLog, EthReceipt, EthRichBlock, EthRichHeader, EthStorageProof, EthSubKind, EthSubParams, EthSubResult, EthSyncInfo, EthSyncStatus, EthTransaction, EthTransactionAction, EthTransactionCondition, EthTransactionRequest, EthTransactionSignature, EthTransactionStatus, EthWork, EthereumAccountId, EthereumAddress, EthereumLookupSource, EthereumSignature, LegacyTransaction, TransactionV0, TransactionV1, TransactionV2 } from '@polkadot/types/interfaces/eth';
import type { EvmAccount, EvmLog, EvmVicinity, ExitError, ExitFatal, ExitReason, ExitRevert, ExitSucceed } from '@polkadot/types/interfaces/evm';
import type { AnySignature, EcdsaSignature, Ed25519Signature, Era, Extrinsic, ExtrinsicEra, ExtrinsicPayload, ExtrinsicPayloadUnknown, ExtrinsicPayloadV4, ExtrinsicSignature, ExtrinsicSignatureV4, ExtrinsicUnknown, ExtrinsicV4, ImmortalEra, MortalEra, MultiSignature, Signature, SignerPayload, Sr25519Signature } from '@polkadot/types/interfaces/extrinsics';
import type { AssetOptions, Owner, PermissionLatest, PermissionVersions, PermissionsV1 } from '@polkadot/types/interfaces/genericAsset';
@@ -141,6 +141,7 @@ declare module '@polkadot/types/types/registry' {
BeefyKey: BeefyKey;
BeefyNextAuthoritySet: BeefyNextAuthoritySet;
BeefyPayload: BeefyPayload;
BeefyPayloadId: BeefyPayloadId;
BeefySignedCommitment: BeefySignedCommitment;
Bid: Bid;
Bidder: Bidder;
@@ -360,6 +361,7 @@ declare module '@polkadot/types/types/registry' {
EthereumAddress: EthereumAddress;
EthereumLookupSource: EthereumLookupSource;
EthereumSignature: EthereumSignature;
EthFeeHistory: EthFeeHistory;
EthFilter: EthFilter;
EthFilterAddress: EthFilterAddress;
EthFilterChanges: EthFilterChanges;
@@ -424,6 +426,10 @@ declare module '@polkadot/types/types/registry' {
ExtrinsicsWeight: ExtrinsicsWeight;
ExtrinsicUnknown: ExtrinsicUnknown;
ExtrinsicV4: ExtrinsicV4;
f32: f32;
F32: F32;
f64: f64;
F64: F64;
FeeDetails: FeeDetails;
Fixed128: Fixed128;
Fixed64: Fixed64;
+7 -6
View File
@@ -20,16 +20,17 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "8.9.1",
"version": "8.10.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.18.3",
"@polkadot/util": "^9.5.1"
"@polkadot/util": "^9.6.2",
"@polkadot/x-bigint": "^9.6.2"
},
"devDependencies": {
"@polkadot/types": "8.9.1",
"@polkadot/types-augment": "8.9.1",
"@polkadot/types-support": "8.9.1",
"@polkadot/util-crypto": "^9.5.1"
"@polkadot/types": "8.10.1",
"@polkadot/types-augment": "8.10.1",
"@polkadot/types-support": "8.10.1",
"@polkadot/util-crypto": "^9.6.2"
}
}
+8 -39
View File
@@ -20,6 +20,14 @@ export abstract class AbstractArray<T extends Codec> extends Array<T> implements
public createdAtHash?: IU8a;
/**
* @description This ensures that operators such as clice, filter, map, etc. return
* new Array instances (without this we need to apply overrides)
*/
static get [Symbol.species] (): typeof Array {
return Array;
}
protected constructor (registry: Registry, length: number) {
super(length);
@@ -169,43 +177,4 @@ export abstract class AbstractArray<T extends Codec> extends Array<T> implements
return encoded;
}
// Below are methods that we override. When we do a `new Vec(...).map()`,
// we want it to return an Array. We only override the methods that return a
// new instance.
/**
* @description Concatenates two arrays
*/
public override concat (other: T[]): T[] {
return this.toArray().concat(other instanceof AbstractArray ? other.toArray() : other);
}
/**
* @description Filters the array with the callback
*/
public override filter (callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: unknown): T[] {
return this.toArray().filter(callbackfn, thisArg);
}
/**
* @description Maps the array with the callback
*/
public override map<U> (callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: unknown): U[] {
return this.toArray().map(callbackfn, thisArg);
}
/**
* @description Checks if the array includes a specific value
*/
public override includes (check: unknown): boolean {
return this.some((value: T) => value.eq(check));
}
/**
* @description Returns a slice of an array
*/
public override slice (start?: number, end?: number): T[] {
return this.toArray().slice(start, end);
}
}
@@ -0,0 +1,16 @@
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { BigInt } from '@polkadot/x-bigint';
// @ts-expect-error not extensible, we make it extensible here
export abstract class AbstractBigInt extends BigInt {
// @ts-expect-error super() not required, the self magic does that
constructor (value: string | number | bigint | boolean) {
const self = Object(BigInt(value)) as typeof AbstractBigInt;
Object.setPrototypeOf(self, AbstractBigInt.prototype);
return self;
}
}
@@ -5,7 +5,7 @@ import { TypeRegistry } from '@polkadot/types';
import { CodecDate, Compact, U32 } from '@polkadot/types-codec';
import { BN } from '@polkadot/util';
import { performance } from '../test/performance';
import { perf } from '../test/performance';
const CompactU32 = Compact.with(U32);
@@ -93,5 +93,5 @@ describe('Compact', (): void => {
});
});
performance('Compact', 75_000, [[new Uint8Array([63 << 2])]], (v: Uint8Array) => new CompactU32(registry, v));
perf('Compact', 75_000, [[new Uint8Array([63 << 2])]], (v: Uint8Array) => new CompactU32(registry, v));
});
+2 -2
View File
@@ -7,7 +7,7 @@ import { TypeRegistry } from '@polkadot/types';
import { Enum, Null, Text, U32 } from '@polkadot/types-codec';
import { u8aToHex } from '@polkadot/util';
import { performance } from '../test/performance';
import { perf } from '../test/performance';
const PEnum = Enum.with({ a: U32, b: U32 });
@@ -454,5 +454,5 @@ describe('Enum', (): void => {
});
});
performance('Enum', 20_000, [[new Uint8Array([0, 31, 32, 33, 34])]], (v: Uint8Array) => new PEnum(registry, v));
perf('Enum', 20_000, [[new Uint8Array([0, 31, 32, 33, 34])]], (v: Uint8Array) => new PEnum(registry, v));
});
+2 -2
View File
@@ -5,7 +5,7 @@ import { TypeRegistry } from '@polkadot/types';
import { UInt } from '@polkadot/types-codec';
import { BN, BN_TWO, isBn } from '@polkadot/util';
import { performance } from '../test/performance';
import { perf } from '../test/performance';
describe('UInt', (): void => {
const registry = new TypeRegistry();
@@ -183,5 +183,5 @@ describe('UInt', (): void => {
});
});
performance('UInt', 75_000, [[new Uint8Array([31, 32, 33, 34])]], (v: Uint8Array) => new UInt(registry, v));
perf('UInt', 75_000, [[new Uint8Array([31, 32, 33, 34])]], (v: Uint8Array) => new UInt(registry, v));
});
+2 -2
View File
@@ -9,7 +9,7 @@ import { Text, u32, Vec } from '@polkadot/types-codec';
import rpcMetadata from '@polkadot/types-support/metadata/static-substrate';
import { decodeAddress, randomAsU8a } from '@polkadot/util-crypto';
import { performance } from '../test/performance';
import { perf } from '../test/performance';
const registry = new TypeRegistry();
const metadata = new Metadata(registry, rpcMetadata);
@@ -194,5 +194,5 @@ describe('Vec', (): void => {
});
});
performance('Vec<U32>', 40_000, [[new Uint8Array([3 << 2, 11, 12, 13, 14, 21, 22, 23, 24, 31, 32, 33, 34])]], (v: Uint8Array) => new VecU32(registry, v));
perf('Vec<U32>', 40_000, [[new Uint8Array([3 << 2, 11, 12, 13, 14, 21, 22, 23, 24, 31, 32, 33, 34])]], (v: Uint8Array) => new VecU32(registry, v));
});
+4
View File
@@ -0,0 +1,4 @@
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './index';
@@ -0,0 +1,49 @@
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { TypeRegistry } from '@polkadot/types';
import { F32, F64 } from '@polkadot/types-codec';
describe('Float', (): void => {
const registry = new TypeRegistry();
describe('F32', (): void => {
it('has a sane toRawType()', (): void => {
expect(
new F32(registry).toRawType()
).toEqual('f32');
});
it('constructs from Uint8Array', (): void => {
expect(
new F32(registry, new Uint8Array([0, 0, 0, 128])).toNumber()
).toEqual(-0.0);
});
it('triggers isEmpty on 0', (): void => {
expect(
new F32(registry, 0).isEmpty
).toEqual(true);
});
it('constructs from a float value', (): void => {
expect(
new F32(registry, 123.456).toString()
).toEqual('123.456');
});
});
describe('F64', (): void => {
it('has a sane toRawType()', (): void => {
expect(
new F64(registry).toRawType()
).toEqual('f64');
});
it('constructs from hex', (): void => {
expect(
new F64(registry, '0x0000000000000080').toNumber()
).toEqual(-0.0);
});
});
});
+128
View File
@@ -0,0 +1,128 @@
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { AnyFloat, CodecClass, IFloat, Inspect, IU8a, Registry } from '../types';
import { floatToU8a, isHex, isU8a, u8aToFloat, u8aToHex, u8aToU8a } from '@polkadot/util';
interface Options {
bitLength?: 32 | 64;
}
/**
* @name Float
* @description
* A Codec wrapper for F32 & F64 values. You generally don't want to be using
* f32/f64 in your runtime, operations on fixed points numbers are preferable. This class
* was explicitly added since scale-codec has a flag that enables this and it is available
* in some eth_* RPCs
*/
export class Float extends Number implements IFloat {
readonly #bitLength: 32 | 64;
public createdAtHash?: IU8a;
readonly encodedLength: number;
readonly initialU8aLength?: number;
readonly registry: Registry;
constructor (registry: Registry, value?: AnyFloat, { bitLength = 32 }: Options = {}) {
super(
isU8a(value) || isHex(value)
? value.length === 0
? 0
: u8aToFloat(u8aToU8a(value), { bitLength })
: (value || 0)
);
this.#bitLength = bitLength;
this.encodedLength = bitLength / 8;
this.initialU8aLength = this.encodedLength;
this.registry = registry;
}
public static with (bitLength: 32 | 64): CodecClass<Float> {
return class extends Float {
constructor (registry: Registry, value?: AnyFloat) {
super(registry, value, { bitLength });
}
};
}
/**
* @description returns a hash of the contents
*/
public get hash (): IU8a {
return this.registry.hash(this.toU8a());
}
/**
* @description Returns true if the type wraps an empty/default all-0 value
*/
get isEmpty (): boolean {
return this.valueOf() === 0;
}
/**
* @description Compares the value of the input to see if there is a match
*/
public eq (other?: unknown): boolean {
return this.valueOf() === Number(other);
}
/**
* @description Returns a breakdown of the hex encoding for this Codec
*/
public inspect (): Inspect {
return {
outer: [this.toU8a()]
};
}
/**
* @description Returns a hex string representation of the value
*/
public toHex (): HexString {
return u8aToHex(this.toU8a());
}
/**
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
*/
public toHuman (): string {
return this.toString();
}
/**
* @description Converts the Object to JSON, typically used for RPC transfers
*/
public toJSON (): string {
// Not sure if this is actually a hex or a string value
// (would need to check against RPCs to see the result here)
return this.toHex();
}
/**
* @description Returns the number representation (Same as valueOf)
*/
public toNumber (): number {
return this.valueOf();
}
/**
* @description Returns the base runtime type name for this instance
*/
public toRawType (): string {
return `f${this.#bitLength}`;
}
/**
* @description Encodes the value as a Uint8Array as per the SCALE specifications
*/
public toU8a (): Uint8Array {
return floatToU8a(this, { bitLength: this.#bitLength });
}
}
+3
View File
@@ -64,6 +64,9 @@ export class Json extends Map<string, any> implements Codec {
return compareMap(this, other);
}
/**
* @description Returns a typed value from the internal map
*/
public getT <T> (key: string): T {
return this.get(key) as unknown as T;
}
+8 -28
View File
@@ -22,6 +22,14 @@ export class Raw extends Uint8Array implements IU8a {
public readonly registry: Registry;
/**
* @description This ensures that operators such as clice, filter, map, etc. return
* new Array instances (without this we need to apply overrides)
*/
static get [Symbol.species] (): typeof Uint8Array {
return Uint8Array;
}
constructor (registry: Registry, value?: AnyU8a, initialU8aLength?: number) {
super(u8aToU8a(value));
@@ -64,14 +72,6 @@ export class Raw extends Uint8Array implements IU8a {
return isUtf8(this);
}
/**
* @description The length of the value
*/
public override get length (): number {
// only included here since we ignore inherited docs
return super.length;
}
/**
* @description Returns the number of bits in the value
*/
@@ -100,26 +100,6 @@ export class Raw extends Uint8Array implements IU8a {
};
}
/**
* @description Create a new slice from the actual buffer. (compat)
* @param start The position to start at
* @param end The position to end at
*/
public override slice (start?: number, end?: number): Uint8Array {
// Like subarray below, we have to follow this approach since we are extending the TypeArray.
// This happens especially when it comes to further extensions, the length may be an override
return Uint8Array.from(this).slice(start, end);
}
/**
* @description Create a new subarray from the actual buffer. (compat)
* @param begin The position to start at
* @param end The position to end at
*/
public override subarray (begin?: number, end?: number): Uint8Array {
return Uint8Array.from(this).subarray(begin, end);
}
/**
* @description Returns a hex string representation of the value
*/
+2 -2
View File
@@ -7,7 +7,7 @@ import { TypeRegistry } from '@polkadot/types';
import { Bytes, Raw, Text } from '@polkadot/types-codec';
import { stringToU8a } from '@polkadot/util';
import { performance } from '../test/performance';
import { perf } from '../test/performance';
describe('Text', (): void => {
const registry = new TypeRegistry();
@@ -79,5 +79,5 @@ describe('Text', (): void => {
});
});
performance('Text', 100_000, [[new Uint8Array([6 << 2, 102, 111, 111, 102, 111, 111])]], (v: Uint8Array) => new Text(registry, v));
perf('Text', 100_000, [[new Uint8Array([6 << 2, 102, 111, 111, 102, 111, 111])]], (v: Uint8Array) => new Text(registry, v));
});
+1
View File
@@ -3,6 +3,7 @@
export { bool, bool as Bool } from './Bool';
export { CodecDate, CodecDate as Date } from './Date';
export { Float } from './Float';
export { Json } from './Json';
export { Raw } from './Raw';
export { CodecSet, CodecSet as Set } from './Set';
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/types-codec', path: 'auto', type: 'auto', version: '8.9.1' };
export const packageInfo = { name: '@polkadot/types-codec', path: 'auto', type: 'auto', version: '8.10.1' };
+14
View File
@@ -0,0 +1,14 @@
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Float } from '../native/Float';
/**
* @name f32
* @description
* A 32-bit float
*/
export class f32 extends Float.with(32) {
// NOTE without this, we cannot properly determine extensions
public readonly __FloatType = 'f32';
}
+14
View File
@@ -0,0 +1,14 @@
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Float } from '../native/Float';
/**
* @name f64
* @description
* A 64-bit float
*/
export class f64 extends Float.with(64) {
// NOTE without this, we cannot properly determine extensions
public readonly __FloatType = 'f64';
}
@@ -1,6 +1,8 @@
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
export { f32, f32 as F32 } from './F32';
export { f64, f64 as F64 } from './F64';
export { i8, i8 as I8 } from './I8';
export { i16, i16 as I16 } from './I16';
export { i32, i32 as I32 } from './I32';
+8 -27
View File
@@ -12,7 +12,7 @@ const NUM_PAD = 16;
const PRE_PAD = 32;
function loop (count: number, inputs: unknown[][], exec: ExecFn): [number, unknown[]] {
const start = Date.now();
const start = performance.now();
const results = new Array<unknown>(inputs.length);
for (let i = 0; i < count; i++) {
@@ -23,7 +23,7 @@ function loop (count: number, inputs: unknown[][], exec: ExecFn): [number, unkno
}
}
return [Date.now() - start, results];
return [performance.now() - start, results];
}
export function formatFixed (value: number): string {
@@ -41,37 +41,18 @@ ${formatFixed(ops).padStart(NUM_PAD + PRE_PAD + 1)} ops/s
${formatFixed(micro).padStart(NUM_PAD + PRE_PAD + 1)} μs/op`;
}
export function performance (name: string, count: number, inputs: unknown[][], exec: ExecFn): void {
export function perf (name: string, count: number, inputs: unknown[][], exec: ExecFn): void {
if (process.env.GITHUB_REPOSITORY) {
return;
}
it(`performance: ${name}`, (): void => {
const [time] = loop(count, inputs, exec);
console.log(`
performance run for ${name} completed with ${formatNumber(count)} iterations.
${`${name}:`.padStart(PRE_PAD)} ${time.toString().padStart(NUM_PAD)} ms${formatOps(count, time)}
${`${name}:`.padStart(PRE_PAD)} ${time.toFixed(2).padStart(NUM_PAD)} ms${formatOps(count, time)}
`);
});
}
export function performanceCmp (name: string, [first, second]: [string, string], count: number, inputs: unknown[][], exec: ExecFn): void {
it(`performance: ${name}`, (): void => {
const pa = inputs.map((values) => [...values, false]);
const pb = inputs.map((values) => [...values, true]);
const [ta, ra] = loop(count, pa, exec);
const [tb, rb] = loop(count, pb, exec);
console.log(`
performance run for ${name} completed with ${formatNumber(count)} iterations.
${`${first}:`.padStart(PRE_PAD)} ${ta.toString().padStart(NUM_PAD)} ms ${ta < tb ? '(fastest)' : `(slowest, ${(ta / tb).toFixed(2)}x)`}${formatOps(count, ta)}
${`${second}:`.padStart(PRE_PAD)} ${tb.toString().padStart(NUM_PAD)} ms ${ta > tb ? '(fastest)' : `(slowest, ${(tb / ta).toFixed(2)}x)`}${formatOps(count, tb)}
`);
const unmatched = ra.filter((r, i) =>
JSON.stringify(r) !== JSON.stringify(rb[i])
);
expect(unmatched.length).toEqual(0);
});
}
@@ -10,6 +10,9 @@ export type AnyFunction = (...args: any[]) => any;
export type AnyNumber = BN | bigint | Uint8Array | number | string;
// eslint-disable-next-line @typescript-eslint/ban-types
export type AnyFloat = Number | number | Uint8Array | string;
// eslint-disable-next-line @typescript-eslint/ban-types
export type AnyString = String | string;
@@ -33,6 +33,10 @@ export interface INumber extends Codec {
toNumber (): number;
}
export interface IFloat extends Codec {
toNumber (): number;
}
export interface IOption<T extends Codec = Codec> extends Codec {
readonly isNone: boolean;
readonly isSome: boolean;
+4 -4
View File
@@ -20,14 +20,14 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "8.9.1",
"version": "8.10.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.18.3",
"@polkadot/types-codec": "8.9.1",
"@polkadot/util": "^9.5.1"
"@polkadot/types-codec": "8.10.1",
"@polkadot/util": "^9.6.2"
},
"devDependencies": {
"@polkadot/types": "8.9.1"
"@polkadot/types": "8.10.1"
}
}
+4
View File
@@ -0,0 +1,4 @@
// Copyright 2017-2022 @polkadot/types-create authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './index';
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/types-create', path: 'auto', type: 'auto', version: '8.9.1' };
export const packageInfo = { name: '@polkadot/types-create', path: 'auto', type: 'auto', version: '8.10.1' };
+6 -6
View File
@@ -20,14 +20,14 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "8.9.1",
"version": "8.10.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.18.3",
"@polkadot/networks": "^9.5.1",
"@polkadot/types": "8.9.1",
"@polkadot/types-codec": "8.9.1",
"@polkadot/types-create": "8.9.1",
"@polkadot/util": "^9.5.1"
"@polkadot/networks": "^9.6.2",
"@polkadot/types": "8.10.1",
"@polkadot/types-codec": "8.10.1",
"@polkadot/types-create": "8.10.1",
"@polkadot/util": "^9.6.2"
}
}
+4
View File
@@ -0,0 +1,4 @@
// Copyright 2017-2022 @polkadot/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './index';
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/types-known', path: 'auto', type: 'auto', version: '8.9.1' };
export const packageInfo = { name: '@polkadot/types-known', path: 'auto', type: 'auto', version: '8.10.1' };
@@ -1,7 +1,7 @@
// Copyright 2017-2022 @polkadot/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { assert, u8aEq } from '@polkadot/util';
import { u8aEq } from '@polkadot/util';
import all from '.';
@@ -43,7 +43,9 @@ describe('upgrades', (): void => {
describe(network, (): void => {
const chain = all.find((n) => n.network === network);
assert(chain, `Unable to find the entry for ${network}`);
if (!chain) {
throw new Error(`Unable to find the entry for ${network}`);
}
it('has a valid genesisHash', (): void => {
expect(u8aEq(chain.genesisHash, genesisHash)).toBe(true);
+7 -3
View File
@@ -5,7 +5,7 @@ import type { ChainUpgrades } from '@polkadot/types/types';
import type { ChainUpgradesRaw } from './types';
import { selectableNetworks } from '@polkadot/networks';
import { assert, BN, hexToU8a, stringify } from '@polkadot/util';
import { BN, hexToU8a, stringify } from '@polkadot/util';
import kusama from './kusama';
import polkadot from './polkadot';
@@ -30,7 +30,9 @@ function checkOrder (network: string, versions: ChainUpgradesRaw): [number, numb
: curr[0] <= prev[0] || curr[1] <= prev[1];
});
assert(!ooo.length, () => `${network}: Mismatched upgrade ordering: ${stringify(ooo)}`);
if (ooo.length) {
throw new Error(`${network}: Mismatched upgrade ordering: ${stringify(ooo)}`);
}
return versions;
}
@@ -39,7 +41,9 @@ function checkOrder (network: string, versions: ChainUpgradesRaw): [number, numb
function mapRaw ([network, versions]: [string, ChainUpgradesRaw]): ChainUpgrades {
const chain = selectableNetworks.find((n) => n.network === network) || NET_EXTRA[network];
assert(chain, () => `Unable to find info for chain ${network}`);
if (!chain) {
throw new Error(`Unable to find info for chain ${network}`);
}
return {
genesisHash: hexToU8a(chain.genesisHash[0]),
+1 -1
View File
@@ -14,7 +14,7 @@ const upgrades: ChainUpgradesRaw = [
[6379314, 9080], [6979141, 9090], [7568453, 9100], [7766394, 9111], [7911691, 9120],
[7968866, 9121], [7982889, 9122], [8514322, 9130], [9091726, 9140], [9091774, 9150],
[9406726, 9160], [9921066, 9170], [10007115, 9180], [10480973, 9190], [10578091, 9200],
[10678509, 9210], [10811001, 9220], [11096116, 9230]
[10678509, 9210], [10811001, 9220], [11096116, 9230], [11409279, 9250]
];
export default upgrades;
+2 -2
View File
@@ -20,10 +20,10 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "8.9.1",
"version": "8.10.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.18.3",
"@polkadot/util": "^9.5.1"
"@polkadot/util": "^9.6.2"
}
}
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
@@ -3121,7 +3121,7 @@
{
"name": "Schedule",
"type": 488,
"value": "0x0400000000000100008000000010000000001000000001000020000000200000000040000002000000bd0b0000e41b0000be1e00001c1600003b290000ee0c0000411400004f1a0000320000002af80000ab3a0100c7060000c10c0000fb0e00001c0c000079220000c7290000470e00003725ac00180b0000400b0000860b0000900b00003c0a0000500a00000e0b0000b7110000991100008f110000b7110000cb110000df11000085110000f3110000b91400005d110000db100000171100006d1000004d2b0000a72b0000f32a0000552d00009f1000009f1000009f10000099110000ad110000991100009911000071110000dec4070000000000f048b80100000000e453c30100000000957b080000000000932f03000000000089b70700000000004fae070000000000fdec1500000000004eaa070000000000d2ad07000000000001a2070000000000389d0700000000002c5913000000000034a7030000000000ba7f07000000000074000000000000008847210000000000b300000000000000b025fe260000000060031a0000000000e71f2d0000000000f8aea107000000002e03000000000000ef16060000000000ec18b2070000000001010000000000006a000000000000003b5fec07000000003470ae070000000062000000000000003ab2aa01000000005e00000000000000f722b201000000005f020000000000005ee1b307000000006f02000000000000cffb8808000000001eac5c1200000000fefd5d0c0000000019d989080000000087d3010000000000b1c4392d000000004024000000000000dc05000000000000937c0b00000000003c0f0000000000007dc10e00000000009c0b000000000000faab0900000000007d04000000000000c7a90900000000007e04000000000000c6a24402000000003dcb820100000000",
"value": "0x0400000000000100008000000010000000001000000001000020000000200000000040000002000000f40b0000d01b0000d61f00007215000064280000da0c00005a140000c21a00002800000028ff0000404101005e0600006c0c0000ec0e00009a0b00009c22000036290000de0d00006c27b200a00a0000fa0a0000e60a00004a0b0000ec090000000a0000640a0000e0100000441100001211000044110000d6100000fe100000e010000094110000cc100000fe1000000410000022100000dc0f0000302a00001e2d0000522b0000c42c0000fa0f000018100000be0f0000c21000003a11000030110000301100004411000051d10700000000002026b80100000000fed4c301000000002a7a0800000000002845030000000000a6c70700000000006cbe070000000000a34816000000000067c307000000000083b8070000000000aba707000000000061ad0700000000001dd2120000000000ccaf03000000000024b107000000000075000000000000000000000000000000b200000000000000684b4d270000000087731900000000005bc42d00000000006bd5a507000000003903000000000000823d0600000000003a38c40700000000de210000000000005b210000000000004235ef07000000005e95c007000000006d21000000000000d9cdb8010000000048090000000000008ef8bd01000000005b0d00000000000022e5c50700000000aa25000000000000329091080000000092d785120000000026087f0c00000000a44fa1080000000083da010000000000e843992d000000005428000000000000ed05000000000000b3b10b00000000004a0f00000000000000100e0000000000b70b000000000000aed9090000000000880400000000000020c70900000000008704000000000000258c490200000000d7a0880100000000",
"docs": [
" Cost schedule and limits."
]
@@ -3129,7 +3129,7 @@
{
"name": "DeletionQueueDepth",
"type": 4,
"value": "0x19690200",
"value": "0x80000000",
"docs": [
" The maximum number of contracts that can be pending for deletion.",
"",
@@ -6331,6 +6331,10 @@
{
"name": "T",
"type": null
},
{
"name": "I",
"type": null
}
],
"def": {
@@ -6363,7 +6367,7 @@
{
"name": "bond",
"type": 6,
"typeName": "BalanceOf<T>",
"typeName": "BalanceOf<T, I>",
"docs": []
}
],
@@ -6420,7 +6424,7 @@
{
"name": "payout",
"type": 6,
"typeName": "BalanceOf<T>",
"typeName": "BalanceOf<T, I>",
"docs": []
},
{
@@ -6485,6 +6489,10 @@
{
"name": "T",
"type": null
},
{
"name": "I",
"type": null
}
],
"def": {
@@ -6538,7 +6546,7 @@
{
"name": "payout",
"type": 6,
"typeName": "BalanceOf<T>",
"typeName": "BalanceOf<T, I>",
"docs": []
}
],
@@ -6580,7 +6588,7 @@
{
"name": "deposit",
"type": 6,
"typeName": "BalanceOf<T>",
"typeName": "BalanceOf<T, I>",
"docs": []
}
],
@@ -22959,6 +22967,10 @@
{
"name": "T",
"type": null
},
{
"name": "I",
"type": null
}
],
"def": {
@@ -22970,7 +22982,7 @@
{
"name": "value",
"type": 69,
"typeName": "BalanceOf<T>",
"typeName": "BalanceOf<T, I>",
"docs": []
},
{
@@ -23036,7 +23048,7 @@
{
"name": "fee",
"type": 69,
"typeName": "BalanceOf<T>",
"typeName": "BalanceOf<T, I>",
"docs": []
}
],
@@ -23233,6 +23245,10 @@
{
"name": "T",
"type": null
},
{
"name": "I",
"type": null
}
],
"def": {
@@ -23328,7 +23344,7 @@
{
"name": "tip_value",
"type": 69,
"typeName": "BalanceOf<T>",
"typeName": "BalanceOf<T, I>",
"docs": []
}
],
@@ -23370,7 +23386,7 @@
{
"name": "tip_value",
"type": 69,
"typeName": "BalanceOf<T>",
"typeName": "BalanceOf<T, I>",
"docs": []
}
],
@@ -38113,6 +38129,10 @@
{
"name": "T",
"type": null
},
{
"name": "I",
"type": null
}
],
"def": {
@@ -38303,6 +38323,10 @@
{
"name": "T",
"type": null
},
{
"name": "I",
"type": null
}
],
"def": {
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/types-support', path: 'auto', type: 'auto', version: '8.9.1' };
export const packageInfo = { name: '@polkadot/types-support', path: 'auto', type: 'auto', version: '8.10.1' };
+9 -9
View File
@@ -20,20 +20,20 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "8.9.1",
"version": "8.10.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.18.3",
"@polkadot/keyring": "^9.5.1",
"@polkadot/types-augment": "8.9.1",
"@polkadot/types-codec": "8.9.1",
"@polkadot/types-create": "8.9.1",
"@polkadot/util": "^9.5.1",
"@polkadot/util-crypto": "^9.5.1",
"@polkadot/keyring": "^9.6.2",
"@polkadot/types-augment": "8.10.1",
"@polkadot/types-codec": "8.10.1",
"@polkadot/types-create": "8.10.1",
"@polkadot/util": "^9.6.2",
"@polkadot/util-crypto": "^9.6.2",
"rxjs": "^7.5.5"
},
"devDependencies": {
"@polkadot/keyring": "^9.5.1",
"@polkadot/types-support": "8.9.1"
"@polkadot/keyring": "^9.6.2",
"@polkadot/types-support": "8.10.1"
}
}
+4 -2
View File
@@ -11,7 +11,7 @@ import type { GenericExtrinsicEra } from './ExtrinsicEra';
import type { ExtrinsicValueV4 } from './v4/Extrinsic';
import { AbstractBase } from '@polkadot/types-codec';
import { assert, compactAddLength, compactFromU8a, compactToU8a, isHex, isU8a, objectProperty, objectSpread, u8aConcat, u8aToHex, u8aToU8a } from '@polkadot/util';
import { compactAddLength, compactFromU8a, compactToU8a, isHex, isU8a, objectProperty, objectSpread, u8aConcat, u8aToHex, u8aToU8a } from '@polkadot/util';
import { BIT_SIGNED, BIT_UNSIGNED, DEFAULT_VERSION, UNMASK_VERSION } from './constants';
@@ -69,7 +69,9 @@ function decodeU8a (registry: Registry, value: Uint8Array, version: number): Ext
const [offset, length] = compactFromU8a(value);
const total = offset + length.toNumber();
assert(total <= value.length, () => `Extrinsic: length less than remainder, expected at least ${total}, found ${value.length}`);
if (total > value.length) {
throw new Error(`Extrinsic: length less than remainder, expected at least ${total}, found ${value.length}`);
}
const data = value.subarray(offset, total);

Some files were not shown because too many files have changed in this diff Show More