Compare commits

...
117 Commits
Author SHA1 Message Date
Github Actions 3cdf3065d7 [CI Skip] release/stable 5.8.3
skip-checks: true
2021-09-06 12:43:42 +00:00
Jaco 973b1fcffb 5.8.3 (#3935) 2021-09-06 14:32:02 +02:00
Github Actions 4195833d6f [CI Skip] release/stable 5.8.2
skip-checks: true
2021-09-06 09:21:36 +00:00
Jaco 8f4e62c278 5.8.2 (#3934) 2021-09-06 11:10:32 +02:00
Jaco 2c294af116 Kusama MultiLocation to v0 (#3933) 2021-09-06 10:57:53 +02:00
Github Actions 0f1f3b88b2 [CI Skip] release/beta 5.8.2-0
skip-checks: true
2021-09-06 08:52:15 +00:00
Alexander Popiak 56b7697dda Version Junction and MultiLocation Types (#3932)
* version Junction and MultiLocation types

* single quotes
2021-09-06 10:39:47 +02:00
Github Actions 86d7471c76 [CI Skip] release/stable 5.8.1
skip-checks: true
2021-09-06 08:09:49 +00:00
Jaco cb7400710b 5.8.1 (#3931) 2021-09-06 09:59:33 +02:00
Github Actions 59796067e2 [CI Skip] release/beta 5.7.2-8
skip-checks: true
2021-09-05 09:10:53 +00:00
Jaco 7920565b97 Bump deps (#3929)
* Bump deps

* linting
2021-09-05 10:59:03 +02:00
Github Actions 4f0069cac8 [CI Skip] release/beta 5.7.2-7
skip-checks: true
2021-09-04 14:57:50 +00:00
Jaco 835070c44f Cleanup Xcm versioned types (with xcm v2) (#3916)
* Cleanup Xcm versioned types

* Rebuild
2021-09-04 16:49:16 +02:00
Github Actions 5368733353 [CI Skip] release/beta 5.7.2-6
skip-checks: true
2021-09-04 14:08:33 +00:00
Jaco efda09f279 Add Auction to Kusama proxies (#3928) 2021-09-04 15:58:57 +02:00
Github Actions af48f19dfa [CI Skip] release/beta 5.7.2-5
skip-checks: true
2021-09-04 13:48:04 +00:00
Jaco a0dd50b3ba Bump all static metadata (#3927)
* Bump all static metadata

* Build defs
2021-09-04 15:38:36 +02:00
Github Actions 3e159891c0 [CI Skip] release/beta 5.7.2-4
skip-checks: true
2021-09-04 09:27:34 +00:00
Jaco 4b36fa68a5 Doc for extraction chains (#3926)
* Doc for extraction chains

* Update packages/types-support/src/metadata/README.md
2021-09-04 11:16:04 +02:00
Github Actions 70c9cfa0f0 [CI Skip] release/beta 5.7.2-3
skip-checks: true
2021-09-01 16:48:31 +00:00
Jaco 3ce67375e3 Jest config cleanup (#3921) 2021-09-01 18:36:07 +02:00
Github Actions 10d611ba17 [CI Skip] release/beta 5.7.2-2
skip-checks: true
2021-09-01 15:53:20 +00:00
Jaco 00acff5956 Support for new Range mapping (#3920) 2021-09-01 17:42:22 +02:00
Github Actions 9857abd061 [CI Skip] release/beta 5.7.2-1
skip-checks: true
2021-08-30 15:52:36 +00:00
Jaco e87c830990 Re-organize xcm types (#3914) 2021-08-30 17:39:50 +02:00
Github Actions 71063c93d1 [CI Skip] release/beta 5.7.2-0
skip-checks: true
2021-08-30 13:43:35 +00:00
Jaco e037df89e3 Bump static metadata (#3913) 2021-08-30 15:32:25 +02:00
Github Actions 564d63ce28 [CI Skip] release/stable 5.7.1
skip-checks: true
2021-08-29 17:31:35 +00:00
Jaco 69db63b6f9 5.7.1 (#3912) 2021-08-29 19:21:47 +02:00
Github Actions 2bd81e9d05 [CI Skip] release/beta 5.6.2-10
skip-checks: true
2021-08-28 06:57:45 +00:00
Jaco d267895dd5 Bump common (#3911)
* Bump common

* Bump other deps
2021-08-28 08:45:30 +02:00
Github Actions 190e0fcdb1 [CI Skip] release/beta 5.6.2-9
skip-checks: true
2021-08-28 06:23:35 +00:00
Jaco 5e83837c5b Remove unneeded Vec copy operations (#3909)
* Remove unneeded Vec copy operations

* a-e

* Tuple adjust
2021-08-28 08:12:17 +02:00
Github Actions 7f949874e6 [CI Skip] release/beta 5.6.2-8
skip-checks: true
2021-08-28 06:09:31 +00:00
Jaco b024d7f63c Don't fail when specified balances instances are non-existent (#3910) 2021-08-28 08:00:29 +02:00
Github Actions 4bc76bb3e5 [CI Skip] release/beta 5.6.2-7
skip-checks: true
2021-08-26 06:05:29 +00:00
Jaco 212b43dda2 Add Kusama 9090 ugrade block (#3905) 2021-08-26 07:54:11 +02:00
Github Actions 0ba1b318a7 [CI Skip] release/beta 5.6.2-6
skip-checks: true
2021-08-25 09:42:37 +00:00
Jaco 2e8e5a93ca Rang now correctly specified (#3902) 2021-08-25 11:32:54 +02:00
Github Actions 6101f82000 [CI Skip] release/beta 5.6.2-5
skip-checks: true
2021-08-24 15:09:48 +00:00
Jaco 662aef2033 Handle scale-info Range (#3899)
* Handle scale-info Range

* Handle Range in PortableRegistry

* Cleanups

* Rebuild, fix tests (Range to be moved)
2021-08-24 16:57:30 +02:00
Github Actions 0859c470be [CI Skip] release/beta 5.6.2-4
skip-checks: true
2021-08-24 10:21:28 +00:00
Jaco 29fe22da43 Tie statemint to v0 xcm (#3897) 2021-08-24 12:10:35 +02:00
Github Actions 7eef825b38 [CI Skip] release/beta 5.6.2-3
skip-checks: true
2021-08-24 09:32:20 +00:00
Jaco 24808fb55d Adjust enum toHuman output (#3896) 2021-08-24 12:20:22 +03:00
Github Actions 9c06ed7a1c [CI Skip] release/beta 5.6.2-2
skip-checks: true
2021-08-24 07:50:11 +00:00
Jaco 9560259f55 Versioned Xcm (#3892) 2021-08-24 09:37:53 +02:00
Github Actions 6236838fc8 [CI Skip] release/beta 5.6.2-1
skip-checks: true
2021-08-24 07:27:16 +00:00
Jaco e14eddfee3 Bump deps (#3895) 2021-08-24 09:14:56 +02:00
Github Actions 0927f9ba8c [CI Skip] release/beta 5.6.2-0
skip-checks: true
2021-08-23 20:20:11 +00:00
Jaco a8775fd69d Allow aliasses for para (#3894)
* Allow aliasses for para

* Adjust indexes
2021-08-23 22:08:53 +02:00
Github Actions 363c502ae8 [CI Skip] release/stable 5.6.1
skip-checks: true
2021-08-23 08:06:34 +00:00
Jaco d6cc0c30b4 5.6.1 (#3889) 2021-08-23 09:51:19 +02:00
Github Actions 5e312973f3 [CI Skip] release/beta 5.5.3-1
skip-checks: true
2021-08-23 07:35:02 +00:00
Jaco 17c6262a5e Update Xcm types to latest (#3888)
* Update Xcm types to latest

* Updated hex & json
2021-08-23 09:22:52 +02:00
Github Actions 0932a9aa7b [CI Skip] release/beta 5.5.3-0
skip-checks: true
2021-08-21 05:41:53 +00:00
hamidra 88b44befdf add support for n key entries for NMaps (#3886) 2021-08-21 07:31:52 +02:00
Github Actions e4fb971bec [CI Skip] release/stable 5.5.2
skip-checks: true
2021-08-19 09:01:31 +00:00
Jaco 5c7c406676 Adjust ValidDisputeStatementKind enum (#3884) 2021-08-19 10:49:32 +02:00
Github Actions 709e89b801 [CI Skip] release/beta 5.5.2-1
skip-checks: true
2021-08-17 07:49:30 +00:00
Jaco fd96255d05 Bump dev (#3880) 2021-08-17 09:38:16 +02:00
Github Actions c212db26b6 [CI Skip] release/beta 5.5.2-0
skip-checks: true
2021-08-16 08:52:32 +00:00
Jaco 817aaccbb1 API health only with providers with subscriptions (#3879) 2021-08-16 10:40:10 +02:00
Github Actions bfd5642d64 [CI Skip] release/stable 5.5.1
skip-checks: true
2021-08-15 10:04:17 +00:00
Jaco 126871bd46 5.5.1 (#3877)
* 5.5.1

* CHANGELOG
2021-08-15 11:54:51 +02:00
Jaco 714234b7af TypeDefInfo alphabetical (adjust ABI compares) (#3878) 2021-08-15 11:34:27 +02:00
Jaco a7a0965d73 9080 Upgrade block (#3876)
* 9080 Upgrade block

* Update CHANGELOG.md
2021-08-15 10:54:25 +02:00
Github Actions 9b1f9c214b [CI Skip] release/beta 5.4.2-8
skip-checks: true
2021-08-14 07:23:58 +00:00
Jaco ca17955d83 Range as primitive (#3874)
* Range as primitive

* Result/Range

* INumber as Range inner

* Update

* .with on Range

* Basic range decoding

* With

* RangeName

* TypeDefInfo for Range
2021-08-14 09:14:53 +02:00
Github Actions 9b0d260b33 [CI Skip] release/beta 5.4.2-7
skip-checks: true
2021-08-13 12:01:16 +00:00
Jaco Greeff fed2913684 bump berry 2021-08-13 14:48:57 +03:00
Github Actions fc777377ef [CI Skip] release/beta 5.4.2-6
skip-checks: true
2021-08-13 11:25:41 +00:00
Jaco ce7968f870 Loosen pedantic check for fully-empty compares (#3873)
* Loosen pedantic check for fully-empty compares

* Bump dev

* Update CHANGELOG

* Bump common
2021-08-13 13:16:17 +02:00
Jaco 07594a33b5 Extends createType decoration with missing (#3872)
* Extends createType decoration with missing

* Simplify

* Correct __IntType

* Uint mismatch
2021-08-13 12:58:17 +02:00
Github Actions 48620ea7a3 [CI Skip] release/beta 5.4.2-5
skip-checks: true
2021-08-13 06:23:57 +00:00
Caio f86ace2680 Add Range and RangeInclusive types (#3791)
* Add Range and RangeInclusive types

* Lint

* Typo
2021-08-13 08:13:14 +02:00
Github Actions 0e22308954 [CI Skip] release/beta 5.4.2-4
skip-checks: true
2021-08-12 15:41:53 +00:00
Jaco ae21d13b23 Use base interfaces for base Codec (#3870) 2021-08-12 17:32:25 +02:00
Github Actions b594158275 [CI Skip] release/beta 5.4.2-3
skip-checks: true
2021-08-12 12:16:10 +00:00
Jaco 76da6a6af5 Adjust createType with inference parser (#3866)
* Adjust createType with inference parser

* Santize fixed vecs

* __Tokenize

* Shortcut ending sequences

* Update tests & checks

* greedy matching

* Additional linting

* s/extends Codec/extends Codec | undefined/

* Adjust

* Shortcut interfacetypes

* Cleanups

* set & enum

* Adjust getTypeClass fallback set

* CC

* Adjust

* Adjust createTypeUnsafe
2021-08-12 14:07:09 +02:00
Github Actions e1f510f5e9 [CI Skip] release/beta 5.4.2-2
skip-checks: true
2021-08-12 08:11:31 +00:00
Nantian db6c44615f fix bigint type (#3869) 2021-08-12 10:02:15 +02:00
Github Actions 4ce01fe16f [CI Skip] release/beta 5.4.2-1
skip-checks: true
2021-08-10 09:42:35 +00:00
Jaco c52576149a Bump deps (#3861) 2021-08-10 11:32:00 +02:00
Github Actions 0b5e4fe1cc [CI Skip] release/beta 5.4.2-0
skip-checks: true
2021-08-10 08:40:26 +00:00
Jaco 8404170240 createType with single trim (#3859)
* createType with single trim

* Adjust

* Template struct extraction

* Adjust

* Additional

* Additional checks
2021-08-10 10:28:43 +02:00
Github Actions 2b6e66b906 [CI Skip] release/stable 5.4.1
skip-checks: true
2021-08-09 08:54:48 +00:00
Jaco b165c0fe8d 5.4.1 (#3857)
* 5.4.1

* CHANGELOG

* CHANGELOG
2021-08-09 10:44:27 +02:00
hamidra c0751f1a67 enable keys(), entries() for NMaps (#3858) 2021-08-09 08:44:56 +02:00
Github Actions 2a95046fb2 [CI Skip] release/beta 5.3.3-9
skip-checks: true
2021-08-07 11:21:27 +00:00
Jaco e1828af4c4 createType TS tuple definitions (#3854) 2021-08-07 13:12:02 +02:00
Github Actions a133fec533 [CI Skip] release/beta 5.3.3-8
skip-checks: true
2021-08-06 12:08:30 +00:00
Jaco Greeff c51f3d5d2a Remove extra params to type detection 2021-08-06 14:56:03 +03:00
Jaco 54bb965537 Cater for higher-order tuples (#3851)
* Cater for higher-order tuples

* IEnum
2021-08-06 13:42:50 +02:00
Github Actions 9ab662881f [CI Skip] release/beta 5.3.3-7
skip-checks: true
2021-08-06 11:01:01 +00:00
Jaco 697781fb52 Type detection with trimming (#3850)
* Type detection with trimming

* Additional interface check
2021-08-06 12:48:45 +02:00
Github Actions a60d80953b [CI Skip] release/beta 5.3.3-6
skip-checks: true
2021-08-06 09:37:29 +00:00
Jaco a7edf81279 Detect resulting types from createType (#3849)
* Detect resulting types from createType

* Additional detect overrides

* additional

* Empy (), never for invalids
2021-08-06 11:28:32 +02:00
Github Actions 3423fb1717 [CI Skip] release/beta 5.3.3-5
skip-checks: true
2021-08-05 15:02:48 +00:00
Jaco 4ae4e4298c Ensure flags are set before connect/disconnect events (#3846) 2021-08-05 16:46:33 +02:00
Github Actions 90a84baa52 [CI Skip] release/beta 5.3.3-4
skip-checks: true
2021-08-05 10:41:02 +00:00
Jaco a80df7d846 Swap CodecArg usage to unknown (#3845)
* Swap CodecArg usage to unknown

* Adjust Constructor defintion
2021-08-05 12:27:51 +02:00
Github Actions 9961595634 [CI Skip] release/beta 5.3.3-3
skip-checks: true
2021-08-05 07:24:40 +00:00
Jaco e0ecaccb09 Adjust Registry createType return detection (#3844)
* Adjust Registry createType return detection

* type as 'OtherType' cast removal

* Use createClass via registry
2021-08-05 09:15:06 +02:00
Github Actions fd7c80bd8a [CI Skip] release/beta 5.3.3-2
skip-checks: true
2021-08-04 14:43:15 +00:00
Jaco 44a81bc00c Metadata v14 only has combined Map (#3843)
* Metadata v14 only has combined Map

* v14 Map conversion de-duped

* Substrate Map conversion

* v13 tests

* Apply suggestions from code review

* Housekeeping

* v14 bump
2021-08-04 16:31:16 +02:00
Github Actions 7d71726024 [CI Skip] release/beta 5.3.3-1
skip-checks: true
2021-08-04 08:52:18 +00:00
Jaco f603100b8b Add @polkadot/types-support (#3842)
* Add @polkadot/types-support

* jest config fix

* typegen lookups

* Build fixes

* Explicit kusama naming

* testMeta for v14 (local)

* CI test failure

* CI test failure v14

* Update with corrected data after test

* types-support json imports
2021-08-04 10:39:21 +02:00
Github Actions 70ac38cfd2 [CI Skip] release/beta 5.3.3-0
skip-checks: true
2021-08-03 11:40:44 +00:00
Jaco 0bf0d27a39 Handle BitSequence in PortableRegistry (#3838)
* Handle BitSequence in PortableRegistry

* Use Kusama-dev v14 metadata
2021-08-03 13:27:52 +02:00
Github Actions b51988193a [CI Skip] release/stable 5.3.2
skip-checks: true
2021-08-03 08:36:43 +00:00
Jaco fd31e5a6e5 5.3.2 (#3837) 2021-08-03 10:26:46 +02:00
Github Actions 074663cdb7 [CI Skip] release/beta 5.3.2-1
skip-checks: true
2021-08-03 08:07:30 +00:00
Jaco 5f5be13c08 Add missing bridges ChainId (#3836)
* Add missing bridges ChainId

* CHANGELOG
2021-08-03 09:56:35 +02:00
Jaco d60b1818d0 Update bridges types (#3835)
* Update bridges types

* BitVec

* BitVec
2021-08-03 09:39:32 +02:00
Github Actions 9c611e9414 [CI Skip] release/beta 5.3.2-0
skip-checks: true
2021-08-03 05:44:26 +00:00
Jaco da14679b65 v14 metadata bump (#3834) 2021-08-03 07:32:47 +02:00
259 changed files with 72480 additions and 8741 deletions
+5
View File
@@ -24,3 +24,8 @@
4.9.2
4.11.2
4.16.2
5.3.2
5.5.2
5.8.2
5.8.3
File diff suppressed because one or more lines are too long
+631
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -10,4 +10,4 @@ plugins:
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: "@yarnpkg/plugin-version"
yarnPath: .yarn/releases/yarn-3.0.0-rc.2.cjs
yarnPath: .yarn/releases/yarn-3.0.1.cjs
+126
View File
@@ -1,5 +1,131 @@
# CHANGELOG
## 5.8.3 Sep 6, 2021
Upgrade priority: Low.
Changes:
- Adjust Statemint, Rococo and Westend Xcm overrides
## 5.8.2 Sep 6, 2021
Upgrade priority: Low.
Contributed:
- Correct Xcm V1 `MultiLocation` definitions (Thanks to https://github.com/apopiak)
Changes:
- Adjust Kusama Xcm overrides
## 5.8.1 Sep 6, 2021
Upgrade priority: Low.
Changes:
- Add `Auction` to Kusama `ProxyType` definition
- Adjust Xcm definitions with latest v1 & v2 types
- Support for `scale-info` 1.0 `Range` mapping
- Bump static metadata for latest Substrate, Polkadot & Kusama
## 5.7.1 Aug 29, 2021
Upgrade priority: Low.
Changes:
- Optimize `Vec` construction (no re-create on new arrays)
- Adjust output for enums in `toHuman`
- Adjust aliases for new parachain module locations
- Support for versioned xcm types (Polkadot master)
- Add support for `Range` in `PortableRegistry` (used in Metadata 14)
- Adjust balances derive for non-existent instances
- Ensure Statemint (current) defaults to xcm v0
- Add Kusama 9090 upgrade block
## 5.6.1 Aug 23, 2021
Upgrade priority: Low. Recommended for users of Xcm, preparing for Kusama/Westend 9100
Contributed:
- Support 0...N-1 args on `keys/entries` (Thanks to https://github.com/hamidra)
Changes:
- Updated XCM types, `AssetId`, `MultiAssets`, `MultiAssetV1`, `AssetInstanceV1`, `XcmOrderV1`
- Rename `Null` entry in `MultiLocation` to `Here` (Xcm V1)
- Westend 9090 upgrade block
- Bump static Substrate, Kusama & Polkadot metadata
## 5.5.2 Aug 19, 2021
Upgrade priority: Medium. Contains fixes for parachain types, affecting historic block retrieval on Kusama.
Changes:
- Adjust `ValidDisputeStatementKind` enum to latest version
- Only enable API health keepalive on connections supporting subscriptions
## 5.5.1 Aug 15, 2021
Upgrade priority: Low. Recommended for users of TS (`createType` and `bigint` adjustments)
Contributed:
- Add `Range` & `RangeInclusive` types (Thanks to https://github.com/c410-f3r)
- Always use TS `bigint` type (Thanks to https://github.com/ntduan)
Changes:
- Loosen pedantic check not to fail on all-empty values
- Extend `createType` auto-TS decoration for `BreeMap`, `BTreeSet`, `HashMap`, `Range`
- Add Polkadot 9080 upgrade block
## 5.4.1 Aug 9, 2021
Upgrade priority: Low. Recommended for potential users of NMap.
- **Important** The `ClassOf` alias for `createClass` has been removed, use `createClass` (with new generics) directly
Contributed:
- Enable `.keys()/.entries()` on NMap (Thanks to https://github.com/hamidra)
Changes:
- `createType<T = Codec>('...': K)` now returns `Codec` when `K` is not known
- `createType` does basic TypeScript type matching on the input type
- Handle `BitSequence` in `PortableRegistry`
- Ensure API `isConnected` is set before connect/disconnect events are fired
- Move all static test support files into `@polkadot/types-support`
- Align static Metadata with latest Substrate, Polkadot & Kusama
- Adjust v14 Metadata definitions to latest version
## 5.3.2 Aug 3, 2021
Upgrade priority: Low. Recommended for users of bridges.
Contributed:
- Add missing bridges types (Thanks to https://github.com/tomusdrw)
Changes:
- Align static metadata with latest Substrate
## 5.3.1 Aug 2, 2021
Upgrade priority: Low. Recommended for users of `api.at(...)` interfaces
+2 -14
View File
@@ -12,21 +12,9 @@ module.exports = {
'@polkadot/metadata(.*)$': '<rootDir>/packages/metadata/src/$1',
'@polkadot/rpc-(core|provider)(.*)$': '<rootDir>/packages/rpc-$1/src/$2',
'@polkadot/typegen(.*)$': '<rootDir>/packages/typegen/src/$1',
'@polkadot/types-known(.*)$': '<rootDir>/packages/types-known/src/$1',
'@polkadot/types-(known|support)(.*)$': '<rootDir>/packages/types-$1/src/$2',
// eslint-disable-next-line sort-keys
'@polkadot/types(.*)$': '<rootDir>/packages/types/src/$1'
},
modulePathIgnorePatterns: [
'<rootDir>/packages/api/build',
'<rootDir>/packages/api-contract/build',
'<rootDir>/packages/api-derive/build',
'<rootDir>/packages/metadata/build',
'<rootDir>/packages/rpc-core/build',
'<rootDir>/packages/rpc-provider/build',
'<rootDir>/packages/typegen/build',
'<rootDir>/packages/types/build',
'<rootDir>/packages/types-known/build'
],
testTimeout: 30000,
transformIgnorePatterns: ['/node_modules/(?!@polkadot|@babel/runtime/helpers/esm/)']
testTimeout: 30000
};
+9 -8
View File
@@ -8,7 +8,7 @@
"packages/*"
],
"resolutions": {
"typescript": "^4.3.5"
"typescript": "^4.4.2"
},
"scripts": {
"build": "yarn build:interfaces && polkadot-dev-build-ts",
@@ -26,14 +26,15 @@
"test:watch": "polkadot-dev-run-test --watch"
},
"devDependencies": {
"@babel/core": "^7.14.8",
"@babel/register": "^7.14.5",
"@babel/runtime": "^7.14.8",
"@polkadot/dev": "^0.62.57",
"@polkadot/ts": "^0.4.4",
"@babel/core": "^7.15.5",
"@babel/register": "^7.15.3",
"@babel/runtime": "^7.15.4",
"@polkadot/dev": "^0.62.66",
"@polkadot/ts": "^0.4.7",
"@polkadot/typegen": "workspace:packages/typegen",
"@types/jest": "^26.0.24",
"@types/jest": "^27.0.1",
"copyfiles": "^2.4.1"
},
"version": "5.3.1"
"version": "5.8.3",
"packageManager": "yarn@3.0.1"
}
+6 -6
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-contract",
"version": "5.3.1",
"version": "5.8.3",
"type": "module",
"description": "Interfaces for interacting with contracts and contract ABIs",
"main": "index.js",
@@ -19,10 +19,10 @@
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
"dependencies": {
"@babel/runtime": "^7.14.8",
"@polkadot/api": "5.3.1",
"@polkadot/types": "5.3.1",
"@polkadot/util": "^7.1.1",
"rxjs": "^7.2.0"
"@babel/runtime": "^7.15.4",
"@polkadot/api": "5.8.3",
"@polkadot/types": "5.8.3",
"@polkadot/util": "^7.3.1",
"rxjs": "^7.3.0"
}
}
+3 -3
View File
@@ -3,7 +3,7 @@
import type { Bytes } from '@polkadot/types';
import type { ChainProperties, ContractConstructorSpec, ContractEventSpec, ContractMessageParamSpec, ContractMessageSpec, ContractProject } from '@polkadot/types/interfaces';
import type { AnyJson, Codec, CodecArg } from '@polkadot/types/types';
import type { AnyJson, Codec } from '@polkadot/types/types';
import type { AbiConstructor, AbiEvent, AbiMessage, AbiParam, DecodedEvent, DecodedMessage } from './types';
import { assert, assertReturn, compactAddLength, compactStripLength, isNumber, isObject, isString, logger, stringCamelCase, stringify, u8aConcat, u8aToHex } from '@polkadot/util';
@@ -154,7 +154,7 @@ export class Abi {
index,
method: stringCamelCase(identifier),
selector: spec.selector,
toU8a: (params: CodecArg[]) =>
toU8a: (params: unknown[]) =>
this.#encodeArgs(spec, args, params)
};
@@ -185,7 +185,7 @@ export class Abi {
return message.fromU8a(trimmed.subarray(4));
}
#encodeArgs = ({ name, selector }: ContractMessageSpec | ContractConstructorSpec, args: AbiParam[], data: CodecArg[]): Uint8Array => {
#encodeArgs = ({ name, selector }: ContractMessageSpec | ContractConstructorSpec, args: AbiParam[], data: unknown[]): Uint8Array => {
assert(data.length === args.length, () => `Expected ${args.length} arguments to contract message '${name.toString()}', found ${data.length}`);
return compactAddLength(
+17 -9
View File
@@ -4,27 +4,35 @@
import fs from 'fs';
import path from 'path';
import { TypeDefInfo } from '@polkadot/types/types';
import abis from '../test/contracts';
import { Abi } from '.';
function stringifyInfo (key: string, value: unknown): unknown {
return key === 'info'
? TypeDefInfo[value as number]
: value;
}
describe('MetaRegistry', (): void => {
Object.keys(abis).forEach((abiName) => {
it(`initializes from a contract ABI (${abiName})`, (): void => {
const abi = new Abi(abis[abiName]);
const json = JSON.stringify(abi.registry.metaTypeDefs, stringifyInfo, 2);
const cmpPath = path.join(__dirname, `../test/compare/${abiName}.test.json`);
try {
const cmpPath = path.join(__dirname, `../test/compare/${abiName}.test.json`);
// eslint-disable-next-line @typescript-eslint/no-var-requires
expect(JSON.parse(json)).toEqual(require(cmpPath));
} catch (error) {
if (process.env.GITHUB_REPOSITORY) {
console.error(JSON.stringify(abi.registry.metaTypeDefs, stringifyInfo));
if (!fs.existsSync(cmpPath)) {
fs.writeFileSync(cmpPath, JSON.stringify(abi.registry.metaTypeDefs, null, 2), { flag: 'w' });
throw error;
}
// eslint-disable-next-line @typescript-eslint/no-var-requires
expect(abi.registry.metaTypeDefs).toEqual(require(cmpPath));
} catch (error) {
console.error(JSON.stringify(abi.registry.metaTypeDefs));
throw error;
fs.writeFileSync(cmpPath, json, { flag: 'w' });
}
});
});
+2 -2
View File
@@ -4,7 +4,7 @@
import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
import type { ApiTypes, DecorateMethod } from '@polkadot/api/types';
import type { AccountId, EventRecord, Hash } from '@polkadot/types/interfaces';
import type { AnyJson, CodecArg, ISubmittableResult } from '@polkadot/types/types';
import type { AnyJson, ISubmittableResult } from '@polkadot/types/types';
import type { AbiConstructor, BlueprintOptions } from '../types';
import type { MapConstructorExec } from './types';
@@ -52,7 +52,7 @@ export class Blueprint<ApiType extends ApiTypes> extends Base<ApiType> {
return this.#tx;
}
#deploy = (constructorOrId: AbiConstructor | string | number, { gasLimit = BN_ZERO, salt, value = BN_ZERO }: BlueprintOptions, params: CodecArg[]): SubmittableExtrinsic<ApiType, BlueprintSubmittableResult<ApiType>> => {
#deploy = (constructorOrId: AbiConstructor | string | number, { gasLimit = BN_ZERO, salt, value = BN_ZERO }: BlueprintOptions, params: unknown[]): SubmittableExtrinsic<ApiType, BlueprintSubmittableResult<ApiType>> => {
return this.api.tx.contracts
.instantiate(
value,
+2 -2
View File
@@ -4,7 +4,7 @@
import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
import type { ApiTypes, DecorateMethod } from '@polkadot/api/types';
import type { EventRecord } from '@polkadot/types/interfaces';
import type { AnyJson, CodecArg, ISubmittableResult } from '@polkadot/types/types';
import type { AnyJson, ISubmittableResult } from '@polkadot/types/types';
import type { AbiConstructor, BlueprintOptions } from '../types';
import type { MapConstructorExec } from './types';
@@ -56,7 +56,7 @@ export class Code<ApiType extends ApiTypes> extends Base<ApiType> {
return this.#tx;
}
#instantiate = (constructorOrId: AbiConstructor | string | number, { gasLimit = BN_ZERO, salt, value = BN_ZERO }: BlueprintOptions, params: CodecArg[]): SubmittableExtrinsic<ApiType, CodeSubmittableResult<ApiType>> => {
#instantiate = (constructorOrId: AbiConstructor | string | number, { gasLimit = BN_ZERO, salt, value = BN_ZERO }: BlueprintOptions, params: unknown[]): SubmittableExtrinsic<ApiType, CodeSubmittableResult<ApiType>> => {
return this.api.tx.contracts
.instantiateWithCode(
value,
+8 -8
View File
@@ -5,7 +5,7 @@ import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
import type { ApiTypes, DecorateMethod } from '@polkadot/api/types';
import type { Bytes } from '@polkadot/types';
import type { AccountId, EventRecord, Weight } from '@polkadot/types/interfaces';
import type { AnyJson, CodecArg, ISubmittableResult } from '@polkadot/types/types';
import type { AnyJson, ISubmittableResult } from '@polkadot/types/types';
import type { AbiMessage, ContractCallOutcome, ContractOptions, DecodedEvent } from '../types';
import type { ContractCallResult, ContractCallSend, ContractQuery, ContractTx, MapMessageQuery, MapMessageTx } from './types';
@@ -26,15 +26,15 @@ const ERROR_NO_CALL = 'Your node does not expose the contracts.call RPC. This is
const l = logger('Contract');
function createQuery <ApiType extends ApiTypes> (fn: (origin: string | AccountId | Uint8Array, options: ContractOptions, params: CodecArg[]) => ContractCallResult<ApiType, ContractCallOutcome>): ContractQuery<ApiType> {
return (origin: string | AccountId | Uint8Array, options: BigInt | string | number | BN | ContractOptions, ...params: CodecArg[]): ContractCallResult<ApiType, ContractCallOutcome> =>
function createQuery <ApiType extends ApiTypes> (fn: (origin: string | AccountId | Uint8Array, options: ContractOptions, params: unknown[]) => ContractCallResult<ApiType, ContractCallOutcome>): ContractQuery<ApiType> {
return (origin: string | AccountId | Uint8Array, options: bigint | string | number | BN | ContractOptions, ...params: unknown[]): ContractCallResult<ApiType, ContractCallOutcome> =>
isOptions(options)
? fn(origin, options, params)
: fn(origin, ...extractOptions(options, params));
}
function createTx <ApiType extends ApiTypes> (fn: (options: ContractOptions, params: CodecArg[]) => SubmittableExtrinsic<ApiType>): ContractTx<ApiType> {
return (options: BigInt | string | number | BN | ContractOptions, ...params: CodecArg[]): SubmittableExtrinsic<ApiType> =>
function createTx <ApiType extends ApiTypes> (fn: (options: ContractOptions, params: unknown[]) => SubmittableExtrinsic<ApiType>): ContractTx<ApiType> {
return (options: bigint | string | number | BN | ContractOptions, ...params: unknown[]): SubmittableExtrinsic<ApiType> =>
isOptions(options)
? fn(options, params)
: fn(...extractOptions(options, params));
@@ -90,7 +90,7 @@ export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
return this.#tx;
}
#getGas = (_gasLimit: BigInt | BN | string | number, isCall = false): BN => {
#getGas = (_gasLimit: bigint | BN | string | number, isCall = false): BN => {
const gasLimit = bnToBn(_gasLimit);
return gasLimit.lte(BN_ZERO)
@@ -103,7 +103,7 @@ export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
: gasLimit;
}
#exec = (messageOrId: AbiMessage | string | number, { gasLimit = BN_ZERO, value = BN_ZERO }: ContractOptions, params: CodecArg[]): SubmittableExtrinsic<ApiType> => {
#exec = (messageOrId: AbiMessage | string | number, { gasLimit = BN_ZERO, value = BN_ZERO }: ContractOptions, params: unknown[]): SubmittableExtrinsic<ApiType> => {
return this.api.tx.contracts
.call(
this.address,
@@ -129,7 +129,7 @@ export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
);
}
#read = (messageOrId: AbiMessage | string | number, { gasLimit = BN_ZERO, value = BN_ZERO }: ContractOptions, params: CodecArg[]): ContractCallSend<ApiType> => {
#read = (messageOrId: AbiMessage | string | number, { gasLimit = BN_ZERO, value = BN_ZERO }: ContractOptions, params: unknown[]): ContractCallSend<ApiType> => {
assert(this.hasRpcContractsCall, ERROR_NO_CALL);
const message = this.abi.findMessage(messageOrId);
+8 -9
View File
@@ -5,28 +5,27 @@ import type { Observable } from 'rxjs';
import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
import type { ApiTypes, ObsInnerType } from '@polkadot/api/types';
import type { AccountId } from '@polkadot/types/interfaces';
import type { CodecArg } from '@polkadot/types/types';
import type { BN } from '@polkadot/util';
import type { AbiMessage, BlueprintOptions, ContractCallOutcome, ContractOptions } from '../types';
export interface BlueprintDeploy<ApiType extends ApiTypes> {
(options: BlueprintOptions, ...params: CodecArg[]): SubmittableExtrinsic<ApiType>;
(value: BigInt | string | number | BN, gasLimit: BigInt | string | number | BN, ...params: CodecArg[]): SubmittableExtrinsic<ApiType>;
(options: BlueprintOptions, ...params: unknown[]): SubmittableExtrinsic<ApiType>;
(value: bigint | string | number | BN, gasLimit: bigint | string | number | BN, ...params: unknown[]): SubmittableExtrinsic<ApiType>;
}
export interface ContractQuery<ApiType extends ApiTypes> {
(origin: AccountId | string | Uint8Array, options: ContractOptions, ...params: CodecArg[]): ContractCallResult<ApiType, ContractCallOutcome>;
(origin: AccountId | string | Uint8Array, value: BigInt | BN | string | number, gasLimit: BigInt | BN | string | number, ...params: CodecArg[]): ContractCallResult<ApiType, ContractCallOutcome>;
(origin: AccountId | string | Uint8Array, options: ContractOptions, ...params: unknown[]): ContractCallResult<ApiType, ContractCallOutcome>;
(origin: AccountId | string | Uint8Array, value: bigint | BN | string | number, gasLimit: bigint | BN | string | number, ...params: unknown[]): ContractCallResult<ApiType, ContractCallOutcome>;
}
export interface ContractTx<ApiType extends ApiTypes> {
(options: ContractOptions, ...params: CodecArg[]): SubmittableExtrinsic<ApiType>;
(value: BigInt | BN | string | number, gasLimit: BigInt | BN | string | number, ...params: CodecArg[]): SubmittableExtrinsic<ApiType>;
(options: ContractOptions, ...params: unknown[]): SubmittableExtrinsic<ApiType>;
(value: bigint | BN | string | number, gasLimit: bigint | BN | string | number, ...params: unknown[]): SubmittableExtrinsic<ApiType>;
}
export interface ContractGeneric<O, T> {
(messageOrId: AbiMessage | string | number, options: O, ...params: CodecArg[]): T;
(messageOrId: AbiMessage | string | number, value: BigInt | BN | string | number, gasLimit: BigInt | BN | string | number, ...params: CodecArg[]): T;
(messageOrId: AbiMessage | string | number, options: O, ...params: unknown[]): T;
(messageOrId: AbiMessage | string | number, value: bigint | BN | string | number, gasLimit: bigint | BN | string | number, ...params: unknown[]): T;
}
export type ContractCallResult<ApiType extends ApiTypes, T> = ApiType extends 'rxjs'
+4 -5
View File
@@ -4,7 +4,6 @@
import type { SubmittableResult } from '@polkadot/api';
import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
import type { ApiTypes } from '@polkadot/api/types';
import type { CodecArg } from '@polkadot/types/types';
import type { BN } from '@polkadot/util';
import type { AbiConstructor, BlueprintOptions } from '../types';
import type { BlueprintDeploy, ContractGeneric } from './types';
@@ -17,15 +16,15 @@ import { extractOptions, isOptions } from '../util';
export const EMPTY_SALT = new Uint8Array();
export function createBluePrintTx <ApiType extends ApiTypes, R extends SubmittableResult> (fn: (options: BlueprintOptions, params: CodecArg[]) => SubmittableExtrinsic<ApiType, R>): BlueprintDeploy<ApiType> {
return (options: BigInt | string | number | BN | BlueprintOptions, ...params: CodecArg[]): SubmittableExtrinsic<ApiType, R> =>
export function createBluePrintTx <ApiType extends ApiTypes, R extends SubmittableResult> (fn: (options: BlueprintOptions, params: unknown[]) => SubmittableExtrinsic<ApiType, R>): BlueprintDeploy<ApiType> {
return (options: bigint | string | number | BN | BlueprintOptions, ...params: unknown[]): SubmittableExtrinsic<ApiType, R> =>
isOptions(options)
? fn(options, params)
: fn(...extractOptions(options, params));
}
export function createBluePrintWithId <T> (fn: (constructorOrId: AbiConstructor | string | number, options: BlueprintOptions, params: CodecArg[]) => T): ContractGeneric<BlueprintOptions, T> {
return (constructorOrId: AbiConstructor | string | number, options: BigInt | string | number | BN | BlueprintOptions, ...params: CodecArg[]): T =>
export function createBluePrintWithId <T> (fn: (constructorOrId: AbiConstructor | string | number, options: BlueprintOptions, params: unknown[]) => T): ContractGeneric<BlueprintOptions, T> {
return (constructorOrId: AbiConstructor | string | number, options: bigint | string | number | BN | BlueprintOptions, ...params: unknown[]): T =>
isOptions(options)
? fn(constructorOrId, options, params)
: fn(constructorOrId, ...extractOptions(options, params));
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/api-contract', version: '5.3.1' };
export const packageInfo = { name: '@polkadot/api-contract', version: '5.8.3' };
+6 -6
View File
@@ -5,7 +5,7 @@ import type { ApiBase } from '@polkadot/api/base';
import type { ApiTypes } from '@polkadot/api/types';
import type { Text, u64 } from '@polkadot/types';
import type { ContractExecResultResult, ContractSelector } from '@polkadot/types/interfaces';
import type { Codec, CodecArg, TypeDef } from '@polkadot/types/types';
import type { Codec, TypeDef } from '@polkadot/types/types';
import type { BN } from '@polkadot/util';
import type { Abi } from '.';
@@ -42,7 +42,7 @@ export interface AbiMessage {
method: string;
returnType?: TypeDef | null;
selector: ContractSelector;
toU8a: (params: CodecArg[]) => Uint8Array;
toU8a: (params: unknown[]) => Uint8Array;
}
export type AbiConstructor = AbiMessage;
@@ -71,12 +71,12 @@ export interface DecodedMessage {
}
export interface BlueprintOptions {
gasLimit?: BigInt | string | number | BN;
gasLimit?: bigint | string | number | BN;
salt?: Uint8Array | string | null;
value?: BigInt | string | number | BN;
value?: bigint | string | number | BN;
}
export interface ContractOptions {
gasLimit?: BigInt | BN | string | number;
value?: BigInt | BN | string | number;
gasLimit?: bigint | BN | string | number;
value?: bigint | BN | string | number;
}
+2 -3
View File
@@ -3,7 +3,6 @@
import type { SubmittableResult } from '@polkadot/api';
import type { EventRecord } from '@polkadot/types/interfaces';
import type { CodecArg } from '@polkadot/types/types';
import type { BN } from '@polkadot/util';
import type { BlueprintOptions, ContractOptions } from './types';
@@ -25,11 +24,11 @@ export function applyOnEvent <T> (result: SubmittableResult, types: ContractEven
return undefined;
}
export function isOptions <T> (options: BigInt | string | number | BN | T): options is T {
export function isOptions <T> (options: bigint | string | number | BN | T): options is T {
return !(isBn(options) || isBigInt(options) || isNumber(options) || isString(options));
}
export function extractOptions <T extends TOptions> (value: BigInt | string | number | BN, params: CodecArg[]): [T, CodecArg[]] {
export function extractOptions <T extends TOptions> (value: bigint | string | number | BN, params: unknown[]): [T, unknown[]] {
const gasLimit = params.shift() as BN;
return [{ gasLimit, value } as T, params];
@@ -2,30 +2,30 @@
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"info": "Plain",
"type": "AccountId"
},
{
"info": 12,
"info": "VecFixed",
"length": 32,
"sub": {
"info": 6,
"info": "Plain",
"type": "u8"
},
"type": "[u8;32]"
},
{
"info": 6,
"info": "Plain",
"type": "u8"
},
{
"info": 6,
"info": "Plain",
"type": "i32"
},
{
"displayName": "Hash",
"namespace": "ink_env::types",
"info": 6,
"info": "Plain",
"type": "Hash"
}
]
@@ -2,20 +2,20 @@
{
"displayName": "Header",
"namespace": "ink_storage::collections::stash",
"info": 9,
"info": "Struct",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "last_vacant"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "len"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "len_entries"
}
@@ -23,7 +23,7 @@
"type": "{\"last_vacant\":\"u32\",\"len\":\"u32\",\"len_entries\":\"u32\"}"
},
{
"info": 6,
"info": "Plain",
"type": "u32"
},
{
@@ -33,15 +33,15 @@
{
"displayName": "VacantEntry",
"namespace": "ink_storage::collections::stash",
"info": 9,
"info": "Struct",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "next"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "prev"
}
@@ -52,45 +52,45 @@
{
"displayName": "Hash",
"namespace": "ink_env::types",
"info": 6,
"info": "Plain",
"type": "Hash",
"name": "Occupied"
}
],
"info": 3,
"info": "Enum",
"type": "{\"_enum\":{\"Vacant\":\"VacantEntry\",\"Occupied\":\"Hash\"}}"
},
{
"displayName": "Hash",
"namespace": "ink_env::types",
"info": 6,
"info": "Plain",
"type": "Hash"
},
{
"info": 12,
"info": "VecFixed",
"length": 32,
"sub": {
"info": 6,
"info": "Plain",
"type": "u8"
},
"type": "[u8;32]"
},
{
"info": 6,
"info": "Plain",
"type": "u8"
},
{
"displayName": "VacantEntry",
"namespace": "ink_storage::collections::stash",
"info": 9,
"info": "Struct",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "next"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "prev"
}
@@ -104,23 +104,23 @@
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"info": "Plain",
"type": "AccountId",
"name": "value"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "key_index"
}
],
"info": 9,
"info": "Struct",
"type": "{\"value\":\"AccountId\",\"key_index\":\"u32\"}"
},
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"info": "Plain",
"type": "AccountId"
},
{
@@ -128,7 +128,7 @@
"sub": [
{
"name": "Ok",
"info": 10,
"info": "Tuple",
"sub": [],
"type": "()"
},
@@ -136,13 +136,13 @@
"name": "Error",
"displayName": "Error",
"namespace": "dns::dns",
"info": 3,
"info": "Enum",
"sub": [
{
"ext": {
"discriminant": 0
},
"info": 6,
"info": "Plain",
"name": "NameAlreadyExists",
"type": "Null"
},
@@ -150,7 +150,7 @@
"ext": {
"discriminant": 1
},
"info": 6,
"info": "Plain",
"name": "CallerIsNotOwner",
"type": "Null"
}
@@ -158,24 +158,24 @@
"type": "{\"_enum\":[\"NameAlreadyExists\",\"CallerIsNotOwner\"]}"
}
],
"info": 7,
"info": "Result",
"type": "Result<(), Error>"
},
{
"info": 10,
"info": "Tuple",
"sub": [],
"type": "()"
},
{
"displayName": "Error",
"namespace": "dns::dns",
"info": 3,
"info": "Enum",
"sub": [
{
"ext": {
"discriminant": 0
},
"info": 6,
"info": "Plain",
"name": "NameAlreadyExists",
"type": "Null"
},
@@ -183,7 +183,7 @@
"ext": {
"discriminant": 1
},
"info": 6,
"info": "Plain",
"name": "CallerIsNotOwner",
"type": "Null"
}
@@ -195,10 +195,10 @@
"sub": {
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"info": "Plain",
"type": "AccountId"
},
"info": 5,
"info": "Option",
"type": "Option<AccountId>"
}
]
@@ -1,25 +1,25 @@
[
{
"info": 6,
"info": "Plain",
"type": "u128"
},
{
"displayName": "Header",
"namespace": "ink_storage::collections::stash",
"info": 9,
"info": "Struct",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "last_vacant"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "len"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "len_entries"
}
@@ -27,7 +27,7 @@
"type": "{\"last_vacant\":\"u32\",\"len\":\"u32\",\"len_entries\":\"u32\"}"
},
{
"info": 6,
"info": "Plain",
"type": "u32"
},
{
@@ -37,15 +37,15 @@
{
"displayName": "VacantEntry",
"namespace": "ink_storage::collections::stash",
"info": 9,
"info": "Struct",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "next"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "prev"
}
@@ -56,45 +56,45 @@
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"info": "Plain",
"type": "AccountId",
"name": "Occupied"
}
],
"info": 3,
"info": "Enum",
"type": "{\"_enum\":{\"Vacant\":\"VacantEntry\",\"Occupied\":\"AccountId\"}}"
},
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"info": "Plain",
"type": "AccountId"
},
{
"info": 12,
"info": "VecFixed",
"length": 32,
"sub": {
"info": 6,
"info": "Plain",
"type": "u8"
},
"type": "[u8;32]"
},
{
"info": 6,
"info": "Plain",
"type": "u8"
},
{
"displayName": "VacantEntry",
"namespace": "ink_storage::collections::stash",
"info": 9,
"info": "Struct",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "next"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "prev"
}
@@ -106,17 +106,17 @@
"namespace": "ink_storage::collections::hashmap",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "u128",
"name": "value"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "key_index"
}
],
"info": 9,
"info": "Struct",
"type": "{\"value\":\"u128\",\"key_index\":\"u32\"}"
},
{
@@ -126,15 +126,15 @@
{
"displayName": "VacantEntry",
"namespace": "ink_storage::collections::stash",
"info": 9,
"info": "Struct",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "next"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "prev"
}
@@ -143,18 +143,18 @@
"name": "Vacant"
},
{
"info": 10,
"info": "Tuple",
"sub": [
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"info": "Plain",
"type": "AccountId"
},
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"info": "Plain",
"type": "AccountId"
}
],
@@ -162,29 +162,29 @@
"name": "Occupied"
}
],
"info": 3,
"info": "Enum",
"type": "{\"_enum\":{\"Vacant\":\"VacantEntry\",\"Occupied\":\"(AccountId,AccountId)\"}}"
},
{
"info": 10,
"info": "Tuple",
"sub": [
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"info": "Plain",
"type": "AccountId"
},
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"info": "Plain",
"type": "AccountId"
}
],
"type": "(AccountId,AccountId)"
},
{
"info": 6,
"info": "Plain",
"type": "bool"
},
{
@@ -192,10 +192,10 @@
"sub": {
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"info": "Plain",
"type": "AccountId"
},
"info": 5,
"info": "Option",
"type": "Option<AccountId>"
}
]
]
@@ -2,20 +2,20 @@
{
"displayName": "Header",
"namespace": "ink_storage::collections::stash",
"info": 9,
"info": "Struct",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "last_vacant"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "len"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "len_entries"
}
@@ -23,7 +23,7 @@
"type": "{\"last_vacant\":\"u32\",\"len\":\"u32\",\"len_entries\":\"u32\"}"
},
{
"info": 6,
"info": "Plain",
"type": "u32"
},
{
@@ -33,15 +33,15 @@
{
"displayName": "VacantEntry",
"namespace": "ink_storage::collections::stash",
"info": 9,
"info": "Struct",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "next"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "prev"
}
@@ -50,26 +50,26 @@
"name": "Vacant"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "Occupied"
}
],
"info": 3,
"info": "Enum",
"type": "{\"_enum\":{\"Vacant\":\"VacantEntry\",\"Occupied\":\"u32\"}}"
},
{
"displayName": "VacantEntry",
"namespace": "ink_storage::collections::stash",
"info": 9,
"info": "Struct",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "next"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "prev"
}
@@ -83,36 +83,36 @@
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"info": "Plain",
"type": "AccountId",
"name": "value"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "key_index"
}
],
"info": 9,
"info": "Struct",
"type": "{\"value\":\"AccountId\",\"key_index\":\"u32\"}"
},
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"info": "Plain",
"type": "AccountId"
},
{
"info": 12,
"info": "VecFixed",
"length": 32,
"sub": {
"info": 6,
"info": "Plain",
"type": "u8"
},
"type": "[u8;32]"
},
{
"info": 6,
"info": "Plain",
"type": "u8"
},
{
@@ -122,15 +122,15 @@
{
"displayName": "VacantEntry",
"namespace": "ink_storage::collections::stash",
"info": 9,
"info": "Struct",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "next"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "prev"
}
@@ -141,12 +141,12 @@
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"info": "Plain",
"type": "AccountId",
"name": "Occupied"
}
],
"info": 3,
"info": "Enum",
"type": "{\"_enum\":{\"Vacant\":\"VacantEntry\",\"Occupied\":\"AccountId\"}}"
},
{
@@ -154,17 +154,17 @@
"namespace": "ink_storage::collections::hashmap",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "value"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "key_index"
}
],
"info": 9,
"info": "Struct",
"type": "{\"value\":\"u32\",\"key_index\":\"u32\"}"
},
{
@@ -174,15 +174,15 @@
{
"displayName": "VacantEntry",
"namespace": "ink_storage::collections::stash",
"info": 9,
"info": "Struct",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "next"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "prev"
}
@@ -191,18 +191,18 @@
"name": "Vacant"
},
{
"info": 10,
"info": "Tuple",
"sub": [
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"info": "Plain",
"type": "AccountId"
},
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"info": "Plain",
"type": "AccountId"
}
],
@@ -210,22 +210,22 @@
"name": "Occupied"
}
],
"info": 3,
"info": "Enum",
"type": "{\"_enum\":{\"Vacant\":\"VacantEntry\",\"Occupied\":\"(AccountId,AccountId)\"}}"
},
{
"info": 10,
"info": "Tuple",
"sub": [
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"info": "Plain",
"type": "AccountId"
},
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"info": "Plain",
"type": "AccountId"
}
],
@@ -236,21 +236,21 @@
"namespace": "ink_storage::collections::hashmap",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "bool",
"name": "value"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "key_index"
}
],
"info": 9,
"info": "Struct",
"type": "{\"value\":\"bool\",\"key_index\":\"u32\"}"
},
{
"info": 6,
"info": "Plain",
"type": "bool"
},
{
@@ -258,10 +258,10 @@
"sub": {
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"info": "Plain",
"type": "AccountId"
},
"info": 5,
"info": "Option",
"type": "Option<AccountId>"
},
{
@@ -269,7 +269,7 @@
"sub": [
{
"name": "Ok",
"info": 10,
"info": "Tuple",
"sub": [],
"type": "()"
},
@@ -277,13 +277,13 @@
"name": "Error",
"displayName": "Error",
"namespace": "erc721::erc721",
"info": 3,
"info": "Enum",
"sub": [
{
"ext": {
"discriminant": 0
},
"info": 6,
"info": "Plain",
"name": "NotOwner",
"type": "Null"
},
@@ -291,7 +291,7 @@
"ext": {
"discriminant": 1
},
"info": 6,
"info": "Plain",
"name": "NotApproved",
"type": "Null"
},
@@ -299,7 +299,7 @@
"ext": {
"discriminant": 2
},
"info": 6,
"info": "Plain",
"name": "TokenExists",
"type": "Null"
},
@@ -307,7 +307,7 @@
"ext": {
"discriminant": 3
},
"info": 6,
"info": "Plain",
"name": "TokenNotFound",
"type": "Null"
},
@@ -315,7 +315,7 @@
"ext": {
"discriminant": 4
},
"info": 6,
"info": "Plain",
"name": "CannotInsert",
"type": "Null"
},
@@ -323,7 +323,7 @@
"ext": {
"discriminant": 5
},
"info": 6,
"info": "Plain",
"name": "CannotRemove",
"type": "Null"
},
@@ -331,7 +331,7 @@
"ext": {
"discriminant": 6
},
"info": 6,
"info": "Plain",
"name": "CannotFetchValue",
"type": "Null"
},
@@ -339,7 +339,7 @@
"ext": {
"discriminant": 7
},
"info": 6,
"info": "Plain",
"name": "NotAllowed",
"type": "Null"
}
@@ -347,24 +347,24 @@
"type": "{\"_enum\":[\"NotOwner\",\"NotApproved\",\"TokenExists\",\"TokenNotFound\",\"CannotInsert\",\"CannotRemove\",\"CannotFetchValue\",\"NotAllowed\"]}"
}
],
"info": 7,
"info": "Result",
"type": "Result<(), Error>"
},
{
"info": 10,
"info": "Tuple",
"sub": [],
"type": "()"
},
{
"displayName": "Error",
"namespace": "erc721::erc721",
"info": 3,
"info": "Enum",
"sub": [
{
"ext": {
"discriminant": 0
},
"info": 6,
"info": "Plain",
"name": "NotOwner",
"type": "Null"
},
@@ -372,7 +372,7 @@
"ext": {
"discriminant": 1
},
"info": 6,
"info": "Plain",
"name": "NotApproved",
"type": "Null"
},
@@ -380,7 +380,7 @@
"ext": {
"discriminant": 2
},
"info": 6,
"info": "Plain",
"name": "TokenExists",
"type": "Null"
},
@@ -388,7 +388,7 @@
"ext": {
"discriminant": 3
},
"info": 6,
"info": "Plain",
"name": "TokenNotFound",
"type": "Null"
},
@@ -396,7 +396,7 @@
"ext": {
"discriminant": 4
},
"info": 6,
"info": "Plain",
"name": "CannotInsert",
"type": "Null"
},
@@ -404,7 +404,7 @@
"ext": {
"discriminant": 5
},
"info": 6,
"info": "Plain",
"name": "CannotRemove",
"type": "Null"
},
@@ -412,7 +412,7 @@
"ext": {
"discriminant": 6
},
"info": 6,
"info": "Plain",
"name": "CannotFetchValue",
"type": "Null"
},
@@ -420,11 +420,11 @@
"ext": {
"discriminant": 7
},
"info": 6,
"info": "Plain",
"name": "NotAllowed",
"type": "Null"
}
],
"type": "{\"_enum\":[\"NotOwner\",\"NotApproved\",\"TokenExists\",\"TokenNotFound\",\"CannotInsert\",\"CannotRemove\",\"CannotFetchValue\",\"NotAllowed\"]}"
}
]
]
@@ -1,6 +1,6 @@
[
{
"info": 6,
"info": "Plain",
"type": "bool"
}
]
@@ -1,6 +1,6 @@
[
{
"info": 6,
"info": "Plain",
"type": "bool"
}
]
@@ -1,6 +1,6 @@
[
{
"info": 6,
"info": "Plain",
"type": "i32"
}
]
@@ -2,20 +2,20 @@
{
"displayName": "Header",
"namespace": "ink_storage::collections::stash",
"info": 9,
"info": "Struct",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "last_vacant"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "len"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "len_entries"
}
@@ -23,7 +23,7 @@
"type": "{\"last_vacant\":\"u32\",\"len\":\"u32\",\"len_entries\":\"u32\"}"
},
{
"info": 6,
"info": "Plain",
"type": "u32"
},
{
@@ -33,15 +33,15 @@
{
"displayName": "VacantEntry",
"namespace": "ink_storage::collections::stash",
"info": 9,
"info": "Struct",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "next"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "prev"
}
@@ -50,16 +50,16 @@
"name": "Vacant"
},
{
"info": 10,
"info": "Tuple",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "u32"
},
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"info": "Plain",
"type": "AccountId"
}
],
@@ -67,20 +67,20 @@
"name": "Occupied"
}
],
"info": 3,
"info": "Enum",
"type": "{\"_enum\":{\"Vacant\":\"VacantEntry\",\"Occupied\":\"(u32,AccountId)\"}}"
},
{
"info": 10,
"info": "Tuple",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "u32"
},
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"info": "Plain",
"type": "AccountId"
}
],
@@ -89,34 +89,34 @@
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"info": "Plain",
"type": "AccountId"
},
{
"info": 12,
"info": "VecFixed",
"length": 32,
"sub": {
"info": 6,
"info": "Plain",
"type": "u8"
},
"type": "[u8;32]"
},
{
"info": 6,
"info": "Plain",
"type": "u8"
},
{
"displayName": "VacantEntry",
"namespace": "ink_storage::collections::stash",
"info": 9,
"info": "Struct",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "next"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "prev"
}
@@ -128,22 +128,22 @@
"namespace": "ink_storage::collections::hashmap",
"sub": [
{
"info": 10,
"info": "Tuple",
"sub": [],
"type": "()",
"name": "value"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "key_index"
}
],
"info": 9,
"info": "Struct",
"type": "{\"value\":\"()\",\"key_index\":\"u32\"}"
},
{
"info": 10,
"info": "Tuple",
"sub": [],
"type": "()"
},
@@ -154,15 +154,15 @@
{
"displayName": "VacantEntry",
"namespace": "ink_storage::collections::stash",
"info": 9,
"info": "Struct",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "next"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "prev"
}
@@ -171,12 +171,12 @@
"name": "Vacant"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "Occupied"
}
],
"info": 3,
"info": "Enum",
"type": "{\"_enum\":{\"Vacant\":\"VacantEntry\",\"Occupied\":\"u32\"}}"
},
{
@@ -184,17 +184,17 @@
"namespace": "ink_storage::collections::hashmap",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "value"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "key_index"
}
],
"info": 9,
"info": "Struct",
"type": "{\"value\":\"u32\",\"key_index\":\"u32\"}"
},
{
@@ -204,15 +204,15 @@
{
"displayName": "VacantEntry",
"namespace": "ink_storage::collections::stash",
"info": 9,
"info": "Struct",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "next"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "prev"
}
@@ -223,41 +223,41 @@
{
"displayName": "Transaction",
"namespace": "multisig_plain::multisig_plain",
"info": 9,
"info": "Struct",
"sub": [
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"info": "Plain",
"type": "AccountId",
"name": "callee"
},
{
"info": 12,
"info": "VecFixed",
"length": 4,
"sub": {
"info": 6,
"info": "Plain",
"type": "u8"
},
"type": "[u8;4]",
"name": "selector"
},
{
"info": 11,
"info": "Vec",
"sub": {
"info": 6,
"info": "Plain",
"type": "u8"
},
"type": "Vec<u8>",
"name": "input"
},
{
"info": 6,
"info": "Plain",
"type": "u128",
"name": "transferred_value"
},
{
"info": 6,
"info": "Plain",
"type": "u64",
"name": "gas_limit"
}
@@ -266,47 +266,47 @@
"name": "Occupied"
}
],
"info": 3,
"info": "Enum",
"type": "{\"_enum\":{\"Vacant\":\"VacantEntry\",\"Occupied\":\"Transaction\"}}"
},
{
"displayName": "Transaction",
"namespace": "multisig_plain::multisig_plain",
"info": 9,
"info": "Struct",
"sub": [
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"info": "Plain",
"type": "AccountId",
"name": "callee"
},
{
"info": 12,
"info": "VecFixed",
"length": 4,
"sub": {
"info": 6,
"info": "Plain",
"type": "u8"
},
"type": "[u8;4]",
"name": "selector"
},
{
"info": 11,
"info": "Vec",
"sub": {
"info": 6,
"info": "Plain",
"type": "u8"
},
"type": "Vec<u8>",
"name": "input"
},
{
"info": 6,
"info": "Plain",
"type": "u128",
"name": "transferred_value"
},
{
"info": 6,
"info": "Plain",
"type": "u64",
"name": "gas_limit"
}
@@ -314,28 +314,28 @@
"type": "{\"callee\":\"AccountId\",\"selector\":\"[u8;4]\",\"input\":\"Vec<u8>\",\"transferred_value\":\"u128\",\"gas_limit\":\"u64\"}"
},
{
"info": 12,
"info": "VecFixed",
"length": 4,
"sub": {
"info": 6,
"info": "Plain",
"type": "u8"
},
"type": "[u8;4]"
},
{
"info": 11,
"info": "Vec",
"sub": {
"info": 6,
"info": "Plain",
"type": "u8"
},
"type": "Vec<u8>"
},
{
"info": 6,
"info": "Plain",
"type": "u128"
},
{
"info": 6,
"info": "Plain",
"type": "u64"
},
{
@@ -345,15 +345,15 @@
{
"displayName": "VacantEntry",
"namespace": "ink_storage::collections::stash",
"info": 9,
"info": "Struct",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "next"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "prev"
}
@@ -364,44 +364,44 @@
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"info": "Plain",
"type": "AccountId",
"name": "Occupied"
}
],
"info": 3,
"info": "Enum",
"type": "{\"_enum\":{\"Vacant\":\"VacantEntry\",\"Occupied\":\"AccountId\"}}"
},
{
"info": 11,
"info": "Vec",
"sub": {
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"info": "Plain",
"type": "AccountId"
},
"type": "Vec<AccountId>"
},
{
"info": 10,
"info": "Tuple",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "u32"
},
{
"displayName": "ConfirmationStatus",
"namespace": "multisig_plain::multisig_plain",
"info": 3,
"info": "Enum",
"sub": [
{
"info": 10,
"info": "Tuple",
"sub": [],
"name": "Confirmed",
"type": "()"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "ConfirmationsNeeded"
}
@@ -414,16 +414,16 @@
{
"displayName": "ConfirmationStatus",
"namespace": "multisig_plain::multisig_plain",
"info": 3,
"info": "Enum",
"sub": [
{
"info": 10,
"info": "Tuple",
"sub": [],
"name": "Confirmed",
"type": "()"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "ConfirmationsNeeded"
}
@@ -435,18 +435,18 @@
"sub": [
{
"name": "Ok",
"info": 10,
"info": "Tuple",
"sub": [],
"type": "()"
},
{
"name": "Error",
"info": 10,
"info": "Tuple",
"sub": [],
"type": "()"
}
],
"info": 7,
"info": "Result",
"type": "Result<(), ()>"
},
{
@@ -454,21 +454,21 @@
"sub": [
{
"name": "Ok",
"info": 11,
"info": "Vec",
"sub": {
"info": 6,
"info": "Plain",
"type": "u8"
},
"type": "Vec<u8>"
},
{
"name": "Error",
"info": 10,
"info": "Tuple",
"sub": [],
"type": "()"
}
],
"info": 7,
"info": "Result",
"type": "Result<Vec<u8>, ()>"
},
{
@@ -478,37 +478,37 @@
"name": "Ok",
"displayName": "Option",
"sub": {
"info": 11,
"info": "Vec",
"sub": {
"info": 6,
"info": "Plain",
"type": "u8"
},
"type": "Vec<u8>"
},
"info": 5,
"info": "Option",
"type": "Option<Vec<u8>>"
},
{
"name": "Error",
"info": 10,
"info": "Tuple",
"sub": [],
"type": "()"
}
],
"info": 7,
"info": "Result",
"type": "Result<Option<Vec<u8>>, ()>"
},
{
"displayName": "Option",
"sub": {
"info": 11,
"info": "Vec",
"sub": {
"info": 6,
"info": "Plain",
"type": "u8"
},
"type": "Vec<u8>"
},
"info": 5,
"info": "Option",
"type": "Option<Vec<u8>>"
}
]
]
@@ -1,6 +1,6 @@
[
{
"info": 6,
"info": "Plain",
"type": "u256"
}
]
@@ -1,28 +1,28 @@
[
{
"info": 6,
"info": "Plain",
"type": "u256"
},
{
"info": 6,
"info": "Plain",
"type": "u8"
},
{
"info": 12,
"info": "VecFixed",
"length": 32,
"sub": {
"info": 6,
"info": "Plain",
"type": "u8"
},
"type": "[u8;32]"
},
{
"displayName": "AccountId",
"info": 6,
"info": "Plain",
"type": "AccountId"
},
{
"info": 6,
"info": "Plain",
"type": "Text"
}
]
@@ -1,23 +1,23 @@
[
{
"info": 6,
"info": "Plain",
"type": "i32"
},
{
"info": 6,
"info": "Plain",
"type": "u32"
},
{
"info": 6,
"info": "Plain",
"type": "u8"
},
{
"displayName": "Variant",
"namespace": "enum_example::enum_example",
"info": 3,
"info": "Enum",
"sub": [
{
"info": 10,
"info": "Tuple",
"sub": [],
"name": "None",
"type": "()"
@@ -25,13 +25,13 @@
{
"displayName": "Weekday",
"namespace": "enum_example::enum_example",
"info": 3,
"info": "Enum",
"sub": [
{
"ext": {
"discriminant": 0
},
"info": 6,
"info": "Plain",
"name": "Monday",
"type": "Null"
},
@@ -39,7 +39,7 @@
"ext": {
"discriminant": 1
},
"info": 6,
"info": "Plain",
"name": "Tuesday",
"type": "Null"
},
@@ -47,7 +47,7 @@
"ext": {
"discriminant": 2
},
"info": 6,
"info": "Plain",
"name": "Wednesday",
"type": "Null"
},
@@ -55,7 +55,7 @@
"ext": {
"discriminant": 3
},
"info": 6,
"info": "Plain",
"name": "Thursday",
"type": "Null"
},
@@ -63,7 +63,7 @@
"ext": {
"discriminant": 4
},
"info": 6,
"info": "Plain",
"name": "Friday",
"type": "Null"
},
@@ -71,7 +71,7 @@
"ext": {
"discriminant": 5
},
"info": 6,
"info": "Plain",
"name": "Saturday",
"type": "Null"
},
@@ -79,7 +79,7 @@
"ext": {
"discriminant": 6
},
"info": 6,
"info": "Plain",
"name": "Sunday",
"type": "Null"
}
@@ -90,15 +90,15 @@
{
"displayName": "TupleMaybeSigned",
"namespace": "enum_example::enum_example",
"info": 3,
"info": "Enum",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "i32",
"name": "Signed"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "Unsigned"
}
@@ -109,13 +109,13 @@
{
"displayName": "NamedMaybeSigned",
"namespace": "enum_example::enum_example",
"info": 3,
"info": "Enum",
"sub": [
{
"info": 9,
"info": "Struct",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "i32",
"name": "value"
}
@@ -124,10 +124,10 @@
"type": "{\"value\":\"i32\"}"
},
{
"info": 9,
"info": "Struct",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "value"
}
@@ -142,47 +142,47 @@
{
"displayName": "Color",
"namespace": "enum_example::enum_example",
"info": 3,
"info": "Enum",
"sub": [
{
"info": 10,
"info": "Tuple",
"sub": [],
"name": "Red",
"type": "()"
},
{
"info": 10,
"info": "Tuple",
"sub": [],
"name": "Blue",
"type": "()"
},
{
"info": 10,
"info": "Tuple",
"sub": [],
"name": "Green",
"type": "()"
},
{
"info": 10,
"info": "Tuple",
"sub": [],
"name": "Yellow",
"type": "()"
},
{
"info": 9,
"info": "Struct",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "u8",
"name": "r"
},
{
"info": 6,
"info": "Plain",
"type": "u8",
"name": "g"
},
{
"info": 6,
"info": "Plain",
"type": "u8",
"name": "b"
}
@@ -191,25 +191,25 @@
"type": "{\"r\":\"u8\",\"g\":\"u8\",\"b\":\"u8\"}"
},
{
"info": 9,
"info": "Struct",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "u8",
"name": "r"
},
{
"info": 6,
"info": "Plain",
"type": "u8",
"name": "g"
},
{
"info": 6,
"info": "Plain",
"type": "u8",
"name": "b"
},
{
"info": 6,
"info": "Plain",
"type": "u8",
"name": "a"
}
@@ -227,13 +227,13 @@
{
"displayName": "Weekday",
"namespace": "enum_example::enum_example",
"info": 3,
"info": "Enum",
"sub": [
{
"ext": {
"discriminant": 0
},
"info": 6,
"info": "Plain",
"name": "Monday",
"type": "Null"
},
@@ -241,7 +241,7 @@
"ext": {
"discriminant": 1
},
"info": 6,
"info": "Plain",
"name": "Tuesday",
"type": "Null"
},
@@ -249,7 +249,7 @@
"ext": {
"discriminant": 2
},
"info": 6,
"info": "Plain",
"name": "Wednesday",
"type": "Null"
},
@@ -257,7 +257,7 @@
"ext": {
"discriminant": 3
},
"info": 6,
"info": "Plain",
"name": "Thursday",
"type": "Null"
},
@@ -265,7 +265,7 @@
"ext": {
"discriminant": 4
},
"info": 6,
"info": "Plain",
"name": "Friday",
"type": "Null"
},
@@ -273,7 +273,7 @@
"ext": {
"discriminant": 5
},
"info": 6,
"info": "Plain",
"name": "Saturday",
"type": "Null"
},
@@ -281,7 +281,7 @@
"ext": {
"discriminant": 6
},
"info": 6,
"info": "Plain",
"name": "Sunday",
"type": "Null"
}
@@ -291,15 +291,15 @@
{
"displayName": "TupleMaybeSigned",
"namespace": "enum_example::enum_example",
"info": 3,
"info": "Enum",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "i32",
"name": "Signed"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "Unsigned"
}
@@ -309,13 +309,13 @@
{
"displayName": "NamedMaybeSigned",
"namespace": "enum_example::enum_example",
"info": 3,
"info": "Enum",
"sub": [
{
"info": 9,
"info": "Struct",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "i32",
"name": "value"
}
@@ -324,10 +324,10 @@
"type": "{\"value\":\"i32\"}"
},
{
"info": 9,
"info": "Struct",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "value"
}
@@ -341,47 +341,47 @@
{
"displayName": "Color",
"namespace": "enum_example::enum_example",
"info": 3,
"info": "Enum",
"sub": [
{
"info": 10,
"info": "Tuple",
"sub": [],
"name": "Red",
"type": "()"
},
{
"info": 10,
"info": "Tuple",
"sub": [],
"name": "Blue",
"type": "()"
},
{
"info": 10,
"info": "Tuple",
"sub": [],
"name": "Green",
"type": "()"
},
{
"info": 10,
"info": "Tuple",
"sub": [],
"name": "Yellow",
"type": "()"
},
{
"info": 9,
"info": "Struct",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "u8",
"name": "r"
},
{
"info": 6,
"info": "Plain",
"type": "u8",
"name": "g"
},
{
"info": 6,
"info": "Plain",
"type": "u8",
"name": "b"
}
@@ -390,25 +390,25 @@
"type": "{\"r\":\"u8\",\"g\":\"u8\",\"b\":\"u8\"}"
},
{
"info": 9,
"info": "Struct",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "u8",
"name": "r"
},
{
"info": 6,
"info": "Plain",
"type": "u8",
"name": "g"
},
{
"info": 6,
"info": "Plain",
"type": "u8",
"name": "b"
},
{
"info": 6,
"info": "Plain",
"type": "u8",
"name": "a"
}
@@ -1,25 +1,25 @@
[
{
"info": 6,
"info": "Plain",
"type": "u128"
},
{
"displayName": "Header",
"namespace": "ink_storage::collections::stash",
"info": 9,
"info": "Struct",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "last_vacant"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "len"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "len_entries"
}
@@ -27,7 +27,7 @@
"type": "{\"last_vacant\":\"u32\",\"len\":\"u32\",\"len_entries\":\"u32\"}"
},
{
"info": 6,
"info": "Plain",
"type": "u32"
},
{
@@ -37,15 +37,15 @@
{
"displayName": "VacantEntry",
"namespace": "ink_storage::collections::stash",
"info": 9,
"info": "Struct",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "next"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "prev"
}
@@ -56,45 +56,45 @@
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"info": "Plain",
"type": "AccountId",
"name": "Occupied"
}
],
"info": 3,
"info": "Enum",
"type": "{\"_enum\":{\"Vacant\":\"VacantEntry\",\"Occupied\":\"AccountId\"}}"
},
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"info": "Plain",
"type": "AccountId"
},
{
"info": 12,
"info": "VecFixed",
"length": 32,
"sub": {
"info": 6,
"info": "Plain",
"type": "u8"
},
"type": "[u8;32]"
},
{
"info": 6,
"info": "Plain",
"type": "u8"
},
{
"displayName": "VacantEntry",
"namespace": "ink_storage::collections::stash",
"info": 9,
"info": "Struct",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "next"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "prev"
}
@@ -106,17 +106,17 @@
"namespace": "ink_storage::collections::hashmap",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "u128",
"name": "value"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "key_index"
}
],
"info": 9,
"info": "Struct",
"type": "{\"value\":\"u128\",\"key_index\":\"u32\"}"
},
{
@@ -126,15 +126,15 @@
{
"displayName": "VacantEntry",
"namespace": "ink_storage::collections::stash",
"info": 9,
"info": "Struct",
"sub": [
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "next"
},
{
"info": 6,
"info": "Plain",
"type": "u32",
"name": "prev"
}
@@ -143,18 +143,18 @@
"name": "Vacant"
},
{
"info": 10,
"info": "Tuple",
"sub": [
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"info": "Plain",
"type": "AccountId"
},
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"info": "Plain",
"type": "AccountId"
}
],
@@ -162,33 +162,33 @@
"name": "Occupied"
}
],
"info": 3,
"info": "Enum",
"type": "{\"_enum\":{\"Vacant\":\"VacantEntry\",\"Occupied\":\"(AccountId,AccountId)\"}}"
},
{
"info": 10,
"info": "Tuple",
"sub": [
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"info": "Plain",
"type": "AccountId"
},
{
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"info": "Plain",
"type": "AccountId"
}
],
"type": "(AccountId,AccountId)"
},
{
"info": 6,
"info": "Plain",
"type": "Text"
},
{
"info": 6,
"info": "Plain",
"type": "bool"
},
{
@@ -196,10 +196,10 @@
"sub": {
"displayName": "AccountId",
"namespace": "ink_env::types",
"info": 6,
"info": "Plain",
"type": "AccountId"
},
"info": 5,
"info": "Option",
"type": "Option<AccountId>"
}
]
]
+10 -10
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-derive",
"version": "5.3.1",
"version": "5.8.3",
"type": "module",
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
"main": "index.js",
@@ -19,16 +19,16 @@
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
"dependencies": {
"@babel/runtime": "^7.14.8",
"@polkadot/api": "5.3.1",
"@polkadot/rpc-core": "5.3.1",
"@polkadot/types": "5.3.1",
"@polkadot/util": "^7.1.1",
"@polkadot/util-crypto": "^7.1.1",
"rxjs": "^7.2.0"
"@babel/runtime": "^7.15.4",
"@polkadot/api": "5.8.3",
"@polkadot/rpc-core": "5.8.3",
"@polkadot/types": "5.8.3",
"@polkadot/util": "^7.3.1",
"@polkadot/util-crypto": "^7.3.1",
"rxjs": "^7.3.0"
},
"devDependencies": {
"@polkadot/keyring": "^7.1.1",
"@polkadot/rpc-provider": "5.3.1"
"@polkadot/keyring": "^7.3.1",
"@polkadot/rpc-provider": "5.8.3"
}
}
+41 -38
View File
@@ -2,14 +2,14 @@
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx, QueryableStorageMultiArg } from '@polkadot/api/types';
import type { ApiInterfaceRx, QueryableStorageEntry } from '@polkadot/api/types';
import type { AccountData, AccountId, AccountIndex, AccountInfo, Address, Balance, Index } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { DeriveBalancesAccount, DeriveBalancesAccountData } from '../types';
import { combineLatest, map, of, switchMap } from 'rxjs';
import { assert, isFunction } from '@polkadot/util';
import { isFunction } from '@polkadot/util';
import { memo } from '../util';
@@ -39,15 +39,11 @@ function getBalance (api: ApiInterfaceRx, [freeBalance, reservedBalance, frozenF
};
}
function calcBalances (api: ApiInterfaceRx, [accountId, [accountNonce, balances]]: [AccountId, Result]): DeriveBalancesAccount {
const primary = balances[0];
assert(primary, 'No balances retrieved for account');
function calcBalances (api: ApiInterfaceRx, [accountId, [accountNonce, [primary, ...additional]]]: [AccountId, Result]): DeriveBalancesAccount {
return {
accountId,
accountNonce,
additional: balances.filter((_, index) => index !== 0).map((b) => getBalance(api, b)),
additional: additional.map((b) => getBalance(api, b)),
...getBalance(api, primary)
};
}
@@ -66,34 +62,44 @@ function queryBalancesFree (api: ApiInterfaceRx, accountId: AccountId): Observab
);
}
function querySystemNonce (api: ApiInterfaceRx, accountId: AccountId): Observable<Result> {
return api.query.system.accountNonce<Index>(accountId).pipe(
map((accountNonce): Result => [
accountNonce,
[[zeroBalance(api), zeroBalance(api), zeroBalance(api), zeroBalance(api)]]
])
);
function queryNonceOnly (api: ApiInterfaceRx, accountId: AccountId): Observable<Result> {
const fill = (nonce: Index): Result => [
nonce,
[[zeroBalance(api), zeroBalance(api), zeroBalance(api), zeroBalance(api)]]
];
return isFunction(api.query.system.account)
? api.query.system.account(accountId).pipe(
map(({ nonce }) => fill(nonce))
)
: isFunction(api.query.system.accountNonce)
? api.query.system.accountNonce<Index>(accountId).pipe(
map((nonce) => fill(nonce))
)
: of(fill(api.registry.createType('Index')));
}
function queryBalancesAccount (api: ApiInterfaceRx, accountId: AccountId, modules: string[] = ['balances']): Observable<Result> {
const balances = modules.map(
(m): QueryableStorageMultiArg<'rxjs'> => [
(api.derive as DeriveCustomAccount)[m]?.customAccount || api.query[m].account,
accountId
]
);
const balances = modules
.map((m): QueryableStorageEntry<'rxjs'> => (api.derive as DeriveCustomAccount)[m]?.customAccount || api.query[m]?.account)
.filter((q) => isFunction(q))
.map((q): [QueryableStorageEntry<'rxjs'>, AccountId] => [q, accountId]);
const extract = (data: AccountData[]) =>
data.map(({ feeFrozen, free, miscFrozen, reserved }): BalanceResult => [free, reserved, feeFrozen, miscFrozen]);
const extract = (nonce: Index, data: AccountData[]): Result => [
nonce,
data.map(({ feeFrozen, free, miscFrozen, reserved }): BalanceResult => [free, reserved, feeFrozen, miscFrozen])
];
// NOTE this is for the first case where we do have instances specified
return isFunction(api.query.system.account)
? api.queryMulti<[AccountInfo, ...(AccountData[])]>([[api.query.system.account, accountId], ...balances]).pipe(
map(([{ nonce }, ...balances]): Result => [nonce, extract(balances)])
)
: api.queryMulti<[Index, ...(AccountData[])]>([[api.query.system.accountNonce, accountId], ...balances]).pipe(
map(([nonce, ...balances]): Result => [nonce, extract(balances)])
);
return balances.length
? isFunction(api.query.system.account)
? api.queryMulti<[AccountInfo, ...(AccountData[])]>([[api.query.system.account, accountId], ...balances]).pipe(
map(([{ nonce }, ...balances]) => extract(nonce, balances))
)
: api.queryMulti<[Index, ...(AccountData[])]>([[api.query.system.accountNonce, accountId], ...balances]).pipe(
map(([nonce, ...balances]) => extract(nonce, balances))
)
: queryNonceOnly(api, accountId);
}
function querySystemAccount (api: ApiInterfaceRx, accountId: AccountId): Observable<Result> {
@@ -140,10 +146,6 @@ function querySystemAccount (api: ApiInterfaceRx, accountId: AccountId): Observa
*/
export function account (instanceId: string, api: ApiInterfaceRx): (address: AccountIndex | AccountId | Address | string) => Observable<DeriveBalancesAccount> {
const balanceInstances = api.registry.getModuleInstances(api.runtimeVersion.specName.toString(), 'balances');
const empty: Result = [
api.registry.createType('Index'),
[[zeroBalance(api), zeroBalance(api), zeroBalance(api), zeroBalance(api)]]
];
return memo(instanceId, (address: AccountIndex | AccountId | Address | string): Observable<DeriveBalancesAccount> =>
api.derive.accounts.accountId(address).pipe(
@@ -159,11 +161,12 @@ export function account (instanceId: string, api: ApiInterfaceRx): (address: Acc
? queryBalancesAccount(api, accountId)
: isFunction(api.query.balances?.freeBalance)
? queryBalancesFree(api, accountId)
: isFunction(api.query.system?.accountNonce)
? querySystemNonce(api, accountId)
: of(empty)
: queryNonceOnly(api, accountId)
])
: of([api.registry.createType('AccountId'), empty])
: of([api.registry.createType('AccountId'), [
api.registry.createType('Index'),
[[zeroBalance(api), zeroBalance(api), zeroBalance(api), zeroBalance(api)]]
]])
)
),
map((result): DeriveBalancesAccount => calcBalances(api, result))
+15 -18
View File
@@ -73,7 +73,8 @@ function calcBalances (api: ApiInterfaceRx, [data, bestNumber, [vesting, allLock
// Calculate the vesting balances,
// - offset = balance locked at startingBlock
// - perBlock is the unlock amount
const { locked: vestingTotal, perBlock, startingBlock } = vesting || api.registry.createType('VestingInfo');
const emptyVest = api.registry.createType('VestingInfo');
const { locked: vestingTotal, perBlock, startingBlock } = vesting || emptyVest;
const isStarted = bestNumber.gt(startingBlock);
const vestedNow = isStarted ? perBlock.mul(bestNumber.sub(startingBlock)) : new BN(0);
const vestedBalance = vestedNow.gt(vestingTotal) ? vestingTotal : api.registry.createType('Balance', vestedNow);
@@ -117,33 +118,29 @@ const isNonNullable = <T>(nullable: T): nullable is NonNullable<T> => !!nullable
// current (balances, vesting)
function queryCurrent (api: ApiInterfaceRx, accountId: AccountId, balanceInstances: string[] = ['balances']): Observable<ResultBalance> {
const lockCalls = balanceInstances.map(
(m): ApiInterfaceRx['query']['balances']['locks'] | undefined =>
(api.derive as DeriveCustomLocks)[m]?.customLocks || api.query[m as 'balances']?.locks
const calls = balanceInstances.map((m): ApiInterfaceRx['query']['balances']['locks'] | undefined =>
(api.derive as DeriveCustomLocks)[m]?.customLocks || api.query[m as 'balances']?.locks
);
const lockEmpty = lockCalls.map((c) => !c);
const lockQueries = lockCalls.filter(isNonNullable).map((c): QueryableStorageMultiArg<'rxjs'> => [c, accountId]);
const lockEmpty = calls.map((c) => !c);
const queries = calls.filter(isNonNullable).map((c): QueryableStorageMultiArg<'rxjs'> => [c, accountId]);
return (
api.query.vesting?.vesting
? api.queryMulti<[Option<VestingInfo>, ...BalanceLocks]>([
[api.query.vesting.vesting, accountId],
...lockQueries
])
? api.queryMulti<[Option<VestingInfo>, ...BalanceLocks]>([[api.query.vesting.vesting, accountId], ...queries])
// TODO We need to check module instances here as well, not only the balances module
: lockQueries.length
? api.queryMulti<[...(Vec<BalanceLock>)[]]>(lockQueries).pipe(
map((locks): [Option<VestingInfo>, ...BalanceLocks] =>
[api.registry.createType('Option<VestingInfo>'), ...locks]
)
: queries.length
? api.queryMulti<[...(Vec<BalanceLock>)[]]>(queries).pipe(
map((r): [Option<VestingInfo>, ...BalanceLocks] => [api.registry.createType('Option<VestingInfo>'), ...r])
)
: of([api.registry.createType('Option<VestingInfo>')] as [Option<VestingInfo>])
).pipe(
map(([optVesting, ...locks]): ResultBalance => {
map(([opt, ...locks]): ResultBalance => {
let offset = -1;
return [optVesting.unwrapOr(null), lockEmpty.map((e) => e ? api.registry.createType('Vec<BalanceLock>') : locks[++offset])];
return [
opt.unwrapOr(null),
lockEmpty.map((e) => e ? api.registry.createType('Vec<BalanceLock>') : locks[++offset])
];
})
);
}
@@ -86,7 +86,7 @@ function queryScheduler (api: ApiInterfaceRx): Observable<DeriveDispatch[]> {
const id = scheduled.maybeId.unwrap().toHex();
if (id.startsWith(DEMOCRACY_ID)) {
const [, index] = api.registry.createType('(u64, ReferendumIndex)' as any, id) as ITuple<[u64, ReferendumIndex]>;
const [, index] = api.registry.createType<ITuple<[u64, ReferendumIndex]>>('(u64, ReferendumIndex)', id);
const imageHash = scheduled.call.args[0] as Hash;
result.push({ at, imageHash, index });
+2 -5
View File
@@ -14,10 +14,7 @@ import { TypeRegistry } from '@polkadot/types/create';
import { ExactDerive } from '.';
const testFunction = (api: ApiRx): any => {
return <
Section extends keyof ExactDerive,
Method extends keyof (typeof api.derive[Section])
>(section: Section, method: Method, inputs: any[]): void => {
return <S extends keyof ExactDerive, M extends keyof (typeof api.derive[S])>(section: S, method: M, inputs: any[]): void => {
describe(`derive.${section}.${method}`, (): void => {
it('should be a function', (): void => {
expect(typeof api.derive[section][method]).toBe('function');
@@ -96,7 +93,7 @@ describe('derive', (): void => {
testFunction(api)('balances', 'fees', ['a', 'b']);
// new
testFunction(api)('custom' as any, 'test', [1, 2, 3]);
testFunction(api)('custom', 'test', [1, 2, 3]);
// existing
testFunction(api)('chain', 'bestNumber', []);
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/api-derive', version: '5.3.1' };
export const packageInfo = { name: '@polkadot/api-derive', version: '5.8.3' };
+2 -2
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Option, u32 } from '@polkadot/types';
import type { Option, u32, u64 } from '@polkadot/types';
import type { BlockNumber, EraIndex, Moment, SessionIndex } from '@polkadot/types/interfaces';
export interface DeriveSessionIndexes {
@@ -15,7 +15,7 @@ export interface DeriveSessionIndexes {
export interface DeriveSessionInfo extends DeriveSessionIndexes {
eraLength: BlockNumber;
isEpoch: boolean;
sessionLength: BlockNumber;
sessionLength: u64;
sessionsPerEra: SessionIndex;
}
+1 -1
View File
@@ -3,7 +3,7 @@
import { ApiPromise, WsProvider } from '@polkadot/api';
import { Metadata, TypeRegistry } from '@polkadot/types';
import metaStatic from '@polkadot/types/metadata/static-substrate';
import metaStatic from '@polkadot/types-support/metadata/static-substrate';
export function createApiWithAugmentations (): ApiPromise {
const registry = new TypeRegistry();
+11 -11
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api",
"version": "5.3.1",
"version": "5.8.3",
"type": "module",
"description": "Promise and RxJS wrappers around the Polkadot JS RPC",
"main": "index.js",
@@ -19,16 +19,16 @@
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
"dependencies": {
"@babel/runtime": "^7.14.8",
"@polkadot/api-derive": "5.3.1",
"@polkadot/keyring": "^7.1.1",
"@polkadot/rpc-core": "5.3.1",
"@polkadot/rpc-provider": "5.3.1",
"@polkadot/types": "5.3.1",
"@polkadot/types-known": "5.3.1",
"@polkadot/util": "^7.1.1",
"@polkadot/util-crypto": "^7.1.1",
"@babel/runtime": "^7.15.4",
"@polkadot/api-derive": "5.8.3",
"@polkadot/keyring": "^7.3.1",
"@polkadot/rpc-core": "5.8.3",
"@polkadot/rpc-provider": "5.8.3",
"@polkadot/types": "5.8.3",
"@polkadot/types-known": "5.8.3",
"@polkadot/util": "^7.3.1",
"@polkadot/util-crypto": "^7.3.1",
"eventemitter3": "^4.0.7",
"rxjs": "^7.2.0"
"rxjs": "^7.3.0"
}
}
+52 -30
View File
@@ -143,17 +143,18 @@ declare module '@polkadot/api/types/consts' {
* deposited while the contract is alive. Costs for additional storage are added to
* this base cost.
*
* This is a simple way to ensure that contracts with empty storage eventually get deleted by
* making them pay rent. This creates an incentive to remove them early in order to save rent.
* This is a simple way to ensure that contracts with empty storage eventually get deleted
* by making them pay rent. This creates an incentive to remove them early in order to save
* rent.
**/
depositPerContract: BalanceOf & AugmentedConst<ApiType>;
/**
* The balance a contract needs to deposit per storage byte to stay alive indefinitely.
*
* Let's suppose the deposit is 1,000 BU (balance units)/byte and the rent is 1 BU/byte/day,
* then a contract with 1,000,000 BU that uses 1,000 bytes of storage would pay no rent.
* But if the balance reduced to 500,000 BU and the storage stayed the same at 1,000,
* then it would pay 500 BU/day.
* Let's suppose the deposit is 1,000 BU (balance units)/byte and the rent is 1
* BU/byte/day, then a contract with 1,000,000 BU that uses 1,000 bytes of storage would
* pay no rent. But if the balance reduced to 500,000 BU and the storage stayed the same at
* 1,000, then it would pay 500 BU/day.
**/
depositPerStorageByte: BalanceOf & AugmentedConst<ApiType>;
/**
@@ -201,11 +202,11 @@ declare module '@polkadot/api/types/consts' {
**/
cooloffPeriod: BlockNumber & AugmentedConst<ApiType>;
/**
* The minimum period of locking and the period between a proposal being approved and enacted.
* The period between a proposal being approved and enacted.
*
* It should generally be a little more than the unstake period to ensure that
* voting stakers have an opportunity to remove themselves from the system in the case where
* they are on the losing side of a vote.
* voting stakers have an opportunity to remove themselves from the system in the case
* where they are on the losing side of a vote.
**/
enactmentPeriod: BlockNumber & AugmentedConst<ApiType>;
/**
@@ -213,9 +214,9 @@ declare module '@polkadot/api/types/consts' {
**/
fastTrackVotingPeriod: BlockNumber & AugmentedConst<ApiType>;
/**
* Indicator for whether an emergency origin is even allowed to happen. Some chains may want
* to set this permanently to `false`, others may want to condition it on things such as
* an upgrade having happened recently.
* Indicator for whether an emergency origin is even allowed to happen. Some chains may
* want to set this permanently to `false`, others may want to condition it on things such
* as an upgrade having happened recently.
**/
instantAllowed: bool & AugmentedConst<ApiType>;
/**
@@ -241,6 +242,13 @@ declare module '@polkadot/api/types/consts' {
* The amount of balance that must be deposited per byte of preimage stored.
**/
preimageByteDeposit: BalanceOf & AugmentedConst<ApiType>;
/**
* The minimum period of vote locking.
*
* It should be no shorter than enactment period to ensure that in the case of an approval,
* those successful voters are locked into the consequences that their votes entail.
**/
voteLockingPeriod: BlockNumber & AugmentedConst<ApiType>;
/**
* How often (in blocks) to check for new votes.
**/
@@ -449,8 +457,8 @@ declare module '@polkadot/api/types/consts' {
maxSubAccounts: u32 & AugmentedConst<ApiType>;
/**
* The amount held on deposit for a registered subaccount. This should account for the fact
* that one storage item's value will increase by the size of an account ID, and there will be
* another trie item whose value is the size of an account ID plus 32 bytes.
* that one storage item's value will increase by the size of an account ID, and there will
* be another trie item whose value is the size of an account ID plus 32 bytes.
**/
subAccountDeposit: BalanceOf & AugmentedConst<ApiType>;
/**
@@ -503,8 +511,8 @@ declare module '@polkadot/api/types/consts' {
};
multisig: {
/**
* The base amount of currency needed to reserve for creating a multisig execution or to store
* a dispatch call for later.
* The base amount of currency needed to reserve for creating a multisig execution or to
* store a dispatch call for later.
*
* This is held for an additional storage item whose value size is
* `4 + sizeof((BlockNumber, Balance, AccountId))` bytes and whose key size is
@@ -530,7 +538,8 @@ declare module '@polkadot/api/types/consts' {
/**
* The base amount of currency needed to reserve for creating an announcement.
*
* This is held when a new storage item holding a `Balance` is created (typically 16 bytes).
* This is held when a new storage item holding a `Balance` is created (typically 16
* bytes).
**/
announcementDepositBase: BalanceOf & AugmentedConst<ApiType>;
/**
@@ -558,9 +567,9 @@ declare module '@polkadot/api/types/consts' {
/**
* The amount of currency needed per proxy added.
*
* This is held for adding 32 bytes plus an instance of `ProxyType` more into a pre-existing
* storage value. Thus, when configuring `ProxyDepositFactor` one should take into account
* `32 + proxy_type.encode().len()` bytes of data.
* This is held for adding 32 bytes plus an instance of `ProxyType` more into a
* pre-existing storage value. Thus, when configuring `ProxyDepositFactor` one should take
* into account `32 + proxy_type.encode().len()` bytes of data.
**/
proxyDepositFactor: BalanceOf & AugmentedConst<ApiType>;
/**
@@ -577,9 +586,11 @@ declare module '@polkadot/api/types/consts' {
**/
configDepositBase: BalanceOf & AugmentedConst<ApiType>;
/**
* The amount of currency needed per additional user when creating a recovery configuration.
* The amount of currency needed per additional user when creating a recovery
* configuration.
*
* This is held for adding `sizeof(AccountId)` bytes more into a pre-existing storage value.
* This is held for adding `sizeof(AccountId)` bytes more into a pre-existing storage
* value.
**/
friendDepositFactor: BalanceOf & AugmentedConst<ApiType>;
/**
@@ -603,8 +614,8 @@ declare module '@polkadot/api/types/consts' {
};
scheduler: {
/**
* The maximum weight that may be scheduled per block for any dispatchables of less priority
* than `schedule::HARD_DEADLINE`.
* The maximum weight that may be scheduled per block for any dispatchables of less
* priority than `schedule::HARD_DEADLINE`.
**/
maximumWeight: Weight & AugmentedConst<ApiType>;
/**
@@ -666,8 +677,8 @@ declare module '@polkadot/api/types/consts' {
/**
* The maximum number of nominators rewarded for each validator.
*
* For each validator only the `$MaxNominatorRewardedPerValidator` biggest stakers can claim
* their reward. This used to limit the i/o cost for the nominator payout.
* For each validator only the `$MaxNominatorRewardedPerValidator` biggest stakers can
* claim their reward. This used to limit the i/o cost for the nominator payout.
**/
maxNominatorRewardedPerValidator: u32 & AugmentedConst<ApiType>;
/**
@@ -722,10 +733,10 @@ declare module '@polkadot/api/types/consts' {
};
timestamp: {
/**
* The minimum period between blocks. Beware that this is different to the *expected* period
* that the block production apparatus provides. Your chosen consensus system will generally
* work with this to determine a sensible block time. e.g. For Aura, it will be double this
* period on default settings.
* The minimum period between blocks. Beware that this is different to the *expected*
* period that the block production apparatus provides. Your chosen consensus system will
* generally work with this to determine a sensible block time. e.g. For Aura, it will be
* double this period on default settings.
**/
minimumPeriod: Moment & AugmentedConst<ApiType>;
/**
@@ -843,7 +854,18 @@ declare module '@polkadot/api/types/consts' {
**/
[key: string]: Codec;
};
utility: {
/**
* The limit on the number of batched calls.
**/
batchedCallsLimit: u32 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
vesting: {
maxVestingSchedules: u32 & AugmentedConst<ApiType>;
/**
* The minimum amount transferred to call `vested_transfer`.
**/
+29 -29
View File
@@ -39,7 +39,8 @@ declare module '@polkadot/api/types/errors' {
**/
NoPermission: AugmentedError<ApiType>;
/**
* No provider reference exists to allow a non-zero balance of a non-self-sufficient asset.
* No provider reference exists to allow a non-zero balance of a non-self-sufficient
* asset.
**/
NoProvider: AugmentedError<ApiType>;
/**
@@ -424,10 +425,6 @@ declare module '@polkadot/api/types/errors' {
* Identity may not veto a proposal twice
**/
AlreadyVetoed: AugmentedError<ApiType>;
/**
* Unknown index
**/
BadIndex: AugmentedError<ApiType>;
/**
* Preimage already noted
**/
@@ -452,10 +449,6 @@ declare module '@polkadot/api/types/errors' {
* Invalid hash
**/
InvalidHash: AugmentedError<ApiType>;
/**
* The provided witness data is wrong.
**/
InvalidWitness: AugmentedError<ApiType>;
/**
* Maximum number of votes reached.
**/
@@ -476,26 +469,14 @@ declare module '@polkadot/api/types/errors' {
* No external proposal
**/
NoProposal: AugmentedError<ApiType>;
/**
* Not delegated
**/
NotDelegated: AugmentedError<ApiType>;
/**
* The account is not currently delegating.
**/
NotDelegating: AugmentedError<ApiType>;
/**
* The lock on the account to be unlocked has not yet expired.
**/
NotExpired: AugmentedError<ApiType>;
/**
* Not imminent
**/
NotImminent: AugmentedError<ApiType>;
/**
* The target account does not have a lock.
**/
NotLocked: AugmentedError<ApiType>;
/**
* Next external proposal not simple majority
**/
@@ -680,8 +661,8 @@ declare module '@polkadot/api/types/errors' {
**/
AmountTooSmall: AugmentedError<ApiType>;
/**
* The queue for the bid's duration is full and the amount bid is too low to get in through
* replacing an existing bid.
* The queue for the bid's duration is full and the amount bid is too low to get in
* through replacing an existing bid.
**/
BidTooLow: AugmentedError<ApiType>;
/**
@@ -1271,8 +1252,8 @@ declare module '@polkadot/api/types/errors' {
**/
NoUnlockChunk: AugmentedError<ApiType>;
/**
* There are too many nominators in the system. Governance needs to adjust the staking settings
* to keep things safe for the runtime.
* There are too many nominators in the system. Governance needs to adjust the staking
* settings to keep things safe for the runtime.
**/
TooManyNominators: AugmentedError<ApiType>;
/**
@@ -1280,8 +1261,8 @@ declare module '@polkadot/api/types/errors' {
**/
TooManyTargets: AugmentedError<ApiType>;
/**
* There are too many validators in the system. Governance needs to adjust the staking settings
* to keep things safe for the runtime.
* There are too many validators in the system. Governance needs to adjust the staking
* settings to keep things safe for the runtime.
**/
TooManyValidators: AugmentedError<ApiType>;
/**
@@ -1541,19 +1522,38 @@ declare module '@polkadot/api/types/errors' {
**/
[key: string]: AugmentedError<ApiType>;
};
utility: {
/**
* Too many calls batched.
**/
TooManyCalls: AugmentedError<ApiType>;
/**
* Generic error
**/
[key: string]: AugmentedError<ApiType>;
};
vesting: {
/**
* Amount being transferred is too low to create a vesting schedule.
**/
AmountLow: AugmentedError<ApiType>;
/**
* An existing vesting schedule already exists for this account that cannot be clobbered.
* The account already has `MaxVestingSchedules` count of schedules and thus
* cannot add another one. Consider merging existing schedules in order to add another.
**/
ExistingVestingSchedule: AugmentedError<ApiType>;
AtMaxVestingSchedules: AugmentedError<ApiType>;
/**
* Failed to create a new schedule because some parameter was invalid.
**/
InvalidScheduleParams: AugmentedError<ApiType>;
/**
* The account given is not vesting.
**/
NotVesting: AugmentedError<ApiType>;
/**
* An index was out of bounds of the vesting schedules.
**/
ScheduleIndexOutOfBounds: AugmentedError<ApiType>;
/**
* Generic error
**/
+17 -15
View File
@@ -204,8 +204,8 @@ declare module '@polkadot/api/types/events' {
* # Params
*
* - `contract`: The contract that emitted the event.
* - `data`: Data supplied by the contract. Metadata generated during contract
* compilation is needed to decode it.
* - `data`: Data supplied by the contract. Metadata generated during contract compilation
* is needed to decode it.
**/
ContractEmitted: AugmentedEvent<ApiType, [AccountId, Bytes]>;
/**
@@ -362,17 +362,14 @@ declare module '@polkadot/api/types/events' {
**/
Started: AugmentedEvent<ApiType, [ReferendumIndex, VoteThreshold]>;
/**
* A public proposal has been tabled for referendum vote. \[proposal_index, deposit, depositors\]
* A public proposal has been tabled for referendum vote. \[proposal_index, deposit,
* depositors\]
**/
Tabled: AugmentedEvent<ApiType, [PropIndex, Balance, Vec<AccountId>]>;
/**
* An \[account\] has cancelled a previous delegation operation.
**/
Undelegated: AugmentedEvent<ApiType, [AccountId]>;
/**
* An \[account\] has been unlocked successfully.
**/
Unlocked: AugmentedEvent<ApiType, [AccountId]>;
/**
* An external proposal has been vetoed. \[who, proposal_hash, until\]
**/
@@ -653,9 +650,14 @@ declare module '@polkadot/api/types/events' {
Announced: AugmentedEvent<ApiType, [AccountId, AccountId, Hash]>;
/**
* Anonymous account has been created by new proxy with given
* disambiguation index and proxy type. \[anonymous, who, proxy_type, disambiguation_index\]
* disambiguation index and proxy type. \[anonymous, who, proxy_type,
* disambiguation_index\]
**/
AnonymousCreated: AugmentedEvent<ApiType, [AccountId, AccountId, ProxyType, u16]>;
/**
* A proxy was added. \[delegator, delegatee, proxy_type, delay\]
**/
ProxyAdded: AugmentedEvent<ApiType, [AccountId, AccountId, ProxyType, BlockNumber]>;
/**
* A proxy was executed correctly, with the given \[result\].
**/
@@ -719,8 +721,8 @@ declare module '@polkadot/api/types/events' {
};
session: {
/**
* New session has happened. Note that the argument is the \[session_index\], not the block
* number as the type might suggest.
* New session has happened. Note that the argument is the \[session_index\], not the
* block number as the type might suggest.
**/
NewSession: AugmentedEvent<ApiType, [SessionIndex]>;
/**
@@ -1129,7 +1131,7 @@ declare module '@polkadot/api/types/events' {
**/
Frozen: AugmentedEvent<ApiType, [ClassId, InstanceId]>;
/**
* An asset `instace` was issued. \[ class, instance, owner \]
* An asset `instance` was issued. \[ class, instance, owner \]
**/
Issued: AugmentedEvent<ApiType, [ClassId, InstanceId, AccountId]>;
/**
@@ -1158,7 +1160,7 @@ declare module '@polkadot/api/types/events' {
**/
Thawed: AugmentedEvent<ApiType, [ClassId, InstanceId]>;
/**
* An asset `instace` was transferred. \[ class, instance, from, to \]
* An asset `instance` was transferred. \[ class, instance, from, to \]
**/
Transferred: AugmentedEvent<ApiType, [ClassId, InstanceId, AccountId, AccountId]>;
/**
@@ -1187,12 +1189,12 @@ declare module '@polkadot/api/types/events' {
};
vesting: {
/**
* An \[account\] has become fully vested. No further vesting can happen.
* An \[account\] has become fully vested.
**/
VestingCompleted: AugmentedEvent<ApiType, [AccountId]>;
/**
* The amount vested has been updated. This could indicate more funds are available. The
* balance given is the amount which is left unvested (and thus locked).
* The amount vested has been updated. This could indicate a change in funds available.
* The balance given is the amount which is left unvested (and thus locked).
* \[account, unvested\]
**/
VestingUpdated: AugmentedEvent<ApiType, [AccountId, Balance]>;
+15 -5
View File
@@ -94,7 +94,8 @@ declare module '@polkadot/api/types/storage' {
**/
currentSlot: AugmentedQuery<ApiType, () => Observable<Slot>, []> & QueryableStorageEntry<ApiType, []>;
/**
* The configuration for the current epoch. Should never be `None` as it is initialized in genesis.
* The configuration for the current epoch. Should never be `None` as it is initialized in
* genesis.
**/
epochConfig: AugmentedQuery<ApiType, () => Observable<Option<BabeEpochConfiguration>>, []> & QueryableStorageEntry<ApiType, []>;
/**
@@ -916,9 +917,9 @@ declare module '@polkadot/api/types/storage' {
**/
canceledSlashPayout: AugmentedQuery<ApiType, () => Observable<BalanceOf>, []> & QueryableStorageEntry<ApiType, []>;
/**
* The threshold for when users can start calling `chill_other` for other validators / nominators.
* The threshold is compared to the actual number of validators / nominators (`CountFor*`) in
* the system compared to the configured max (`Max*Count`).
* The threshold for when users can start calling `chill_other` for other validators /
* nominators. The threshold is compared to the actual number of validators / nominators
* (`CountFor*`) in the system compared to the configured max (`Max*Count`).
**/
chillThreshold: AugmentedQuery<ApiType, () => Observable<Option<Percent>>, []> & QueryableStorageEntry<ApiType, []>;
/**
@@ -1145,6 +1146,9 @@ declare module '@polkadot/api/types/storage' {
eventCount: AugmentedQuery<ApiType, () => Observable<EventIndex>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Events deposited for the current block.
*
* NOTE: This storage item is explicitly unbounded since it is never intended to be read
* from within the runtime.
**/
events: AugmentedQuery<ApiType, () => Observable<Vec<EventRecord>>, []> & QueryableStorageEntry<ApiType, []>;
/**
@@ -1371,10 +1375,16 @@ declare module '@polkadot/api/types/storage' {
[key: string]: QueryableStorageEntry<ApiType>;
};
vesting: {
/**
* Storage version of the pallet.
*
* New networks start with latest version, as determined by the genesis build.
**/
storageVersion: AugmentedQuery<ApiType, () => Observable<Releases>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Information regarding the vesting of a given account.
**/
vesting: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<VestingInfo>>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
vesting: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<Vec<VestingInfo>>>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
/**
* Generic query
**/
+106 -73
View File
@@ -211,8 +211,8 @@ declare module '@polkadot/api/types/submittable' {
* - `id`: The identifier of the new asset. This must not be currently in use to identify
* an existing asset.
* - `owner`: The owner of this class of assets. The owner has full superuser permissions
* over this asset, but may later change and configure the permissions using `transfer_ownership`
* and `set_team`.
* over this asset, but may later change and configure the permissions using
* `transfer_ownership` and `set_team`.
* - `min_balance`: The minimum balance of this new asset that any single account must
* have. If an account's balance is reduced below this, then it collapses to zero.
*
@@ -486,8 +486,8 @@ declare module '@polkadot/api/types/submittable' {
* Exactly as `transfer`, except the origin must be root and the source account may be
* specified.
* # <weight>
* - Same as transfer, but additional read and write because the source account is
* not assumed to be in the overlay.
* - Same as transfer, but additional read and write because the source account is not
* assumed to be in the overlay.
* # </weight>
**/
forceTransfer: AugmentedSubmittable<(source: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, dest: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, LookupSource, Compact<Balance>]>;
@@ -523,9 +523,10 @@ declare module '@polkadot/api/types/submittable' {
* The dispatch origin for this call must be `Signed` by the transactor.
*
* # <weight>
* - Dependent on arguments but not critical, given proper implementations for
* input config types. See related functions below.
* - It contains a limited number of reads and writes internally and no complex computation.
* - Dependent on arguments but not critical, given proper implementations for input config
* types. See related functions below.
* - It contains a limited number of reads and writes internally and no complex
* computation.
*
* Related functions:
*
@@ -533,8 +534,8 @@ declare module '@polkadot/api/types/submittable' {
* - Transferring balances to accounts that did not exist before will cause
* `T::OnNewAccount::on_new_account` to be called.
* - Removing enough funds from an account will trigger `T::DustRemoval::on_unbalanced`.
* - `transfer_keep_alive` works the same way as `transfer`, but has an additional
* check that the transfer will not kill the origin account.
* - `transfer_keep_alive` works the same way as `transfer`, but has an additional check
* that the transfer will not kill the origin account.
* ---------------------------------
* - Base Weight: 73.64 µs, worst case scenario (account created, account removed)
* - DB Weight: 1 Read and 1 Write to destination account
@@ -557,8 +558,7 @@ declare module '@polkadot/api/types/submittable' {
* - `keep_alive`: A boolean to determine if the `transfer_all` operation should send all
* of the funds the account has, causing the sender account to be killed (false), or
* transfer everything except at least the existential deposit, which will guarantee to
* keep the sender account alive (true).
* # <weight>
* keep the sender account alive (true). # <weight>
* - O(1). Just like transfer, but reading the user's transferable balance first.
* #</weight>
**/
@@ -754,7 +754,8 @@ declare module '@polkadot/api/types/submittable' {
*
* Instantiation is executed as follows:
*
* - The supplied `code` is instrumented, deployed, and a `code_hash` is created for that code.
* - The supplied `code` is instrumented, deployed, and a `code_hash` is created for that
* code.
* - If the `code_hash` already exists on the chain the underlying `code` will be shared.
* - The destination address is computed based on the sender, code_hash and the salt.
* - The smart-contract account is created at the computed address.
@@ -980,8 +981,8 @@ declare module '@polkadot/api/types/submittable' {
* - `to`: The account whose voting the `target` account's voting power will follow.
* - `conviction`: The conviction that will be attached to the delegated votes. When the
* account is undelegated, the funds will be locked for the corresponding period.
* - `balance`: The amount of the account's balance to be used in delegating. This must
* not be more than the account's current balance.
* - `balance`: The amount of the account's balance to be used in delegating. This must not
* be more than the account's current balance.
*
* Emits `Delegated`.
*
@@ -1118,8 +1119,8 @@ declare module '@polkadot/api/types/submittable' {
* The dispatch origin of this call must be _Signed_.
*
* - `proposal_hash`: The preimage hash of a proposal.
* - `proposal_length_upper_bound`: an upper bound on length of the proposal.
* Extrinsic is weighted according to this value with no refund.
* - `proposal_length_upper_bound`: an upper bound on length of the proposal. Extrinsic is
* weighted according to this value with no refund.
*
* This will only work after `VotingPeriod` blocks from the time that the preimage was
* noted, if it's the same account doing it. If it's a different account, then it'll only
@@ -1280,7 +1281,7 @@ declare module '@polkadot/api/types/submittable' {
* Queue size must be provided as witness data.
* # </weight>
**/
submit: AugmentedSubmittable<(solution: RawSolution | { compact?: any; score?: any; round?: any } | string | Uint8Array, numSignedSubmissions: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [RawSolution, u32]>;
submit: AugmentedSubmittable<(rawSolution: RawSolution | { compact?: any; score?: any; round?: any } | string | Uint8Array, numSignedSubmissions: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [RawSolution, u32]>;
/**
* Submit a solution for the unsigned phase.
*
@@ -1297,7 +1298,7 @@ declare module '@polkadot/api/types/submittable' {
*
* No deposit or reward is associated with this submission.
**/
submitUnsigned: AugmentedSubmittable<(solution: RawSolution | { compact?: any; score?: any; round?: any } | string | Uint8Array, witness: SolutionOrSnapshotSize | { voters?: any; targets?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [RawSolution, SolutionOrSnapshotSize]>;
submitUnsigned: AugmentedSubmittable<(rawSolution: RawSolution | { compact?: any; score?: any; round?: any } | string | Uint8Array, witness: SolutionOrSnapshotSize | { voters?: any; targets?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [RawSolution, SolutionOrSnapshotSize]>;
/**
* Generic tx
**/
@@ -1352,9 +1353,9 @@ declare module '@polkadot/api/types/submittable' {
* origin is removed as a runner-up.
* - `origin` is a current member. In this case, the deposit is unreserved and origin is
* removed as a member, consequently not being a candidate for the next round anymore.
* Similar to [`remove_member`](Self::remove_member), if replacement runners exists,
* they are immediately used. If the prime is renouncing, then no prime will exist until
* the next round.
* Similar to [`remove_member`](Self::remove_member), if replacement runners exists, they
* are immediately used. If the prime is renouncing, then no prime will exist until the
* next round.
*
* The dispatch origin of this call must be signed, and have one of the above roles.
*
@@ -1768,8 +1769,8 @@ declare module '@polkadot/api/types/submittable' {
imOnline: {
/**
* # <weight>
* - Complexity: `O(K + E)` where K is length of `Keys` (heartbeat.validators_len)
* and E is length of `heartbeat.network_state.external_address`
* - Complexity: `O(K + E)` where K is length of `Keys` (heartbeat.validators_len) and E is
* length of `heartbeat.network_state.external_address`
* - `O(K)`: decoding of length `K`
* - `O(E)`: decoding/encoding of length `E`
* - DbReads: pallet_session `Validators`, pallet_session `CurrentIndex`, `Keys`,
@@ -1851,7 +1852,8 @@ declare module '@polkadot/api/types/submittable' {
**/
free: AugmentedSubmittable<(index: AccountIndex | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountIndex]>;
/**
* Freeze an index so it will always point to the sender account. This consumes the deposit.
* Freeze an index so it will always point to the sender account. This consumes the
* deposit.
*
* The dispatch origin for this call must be _Signed_ and the signing account must have a
* non-frozen account `index`.
@@ -1977,9 +1979,8 @@ declare module '@polkadot/api/types/submittable' {
* - Up to one binary search and insert (`O(logS + S)`).
* - I/O: 1 read `O(S)`, up to 1 mutate `O(S)`. Up to one remove.
* - One event.
* - Storage: inserts one item, value size bounded by `MaxSignatories`, with a
* deposit taken for its lifetime of
* `DepositBase + threshold * DepositFactor`.
* - Storage: inserts one item, value size bounded by `MaxSignatories`, with a deposit
* taken for its lifetime of `DepositBase + threshold * DepositFactor`.
* ----------------------------------
* - DB Weight:
* - Read: Multisig Storage, [Caller Account]
@@ -2025,9 +2026,8 @@ declare module '@polkadot/api/types/submittable' {
* - I/O: 1 read `O(S)`, up to 1 mutate `O(S)`. Up to one remove.
* - One event.
* - The weight of the `call`.
* - Storage: inserts one item, value size bounded by `MaxSignatories`, with a
* deposit taken for its lifetime of
* `DepositBase + threshold * DepositFactor`.
* - Storage: inserts one item, value size bounded by `MaxSignatories`, with a deposit
* taken for its lifetime of `DepositBase + threshold * DepositFactor`.
* -------------------------------
* - DB Weight:
* - Reads: Multisig Storage, [Caller Account], Calls (if `store_call`)
@@ -2326,8 +2326,8 @@ declare module '@polkadot/api/types/submittable' {
* `threshold` or more vouches, waited `delay_period` blocks since initiation.
*
* Parameters:
* - `account`: The lost account that you want to claim has been successfully
* recovered by you.
* - `account`: The lost account that you want to claim has been successfully recovered by
* you.
*
* # <weight>
* Key: F (len of friends in config), V (len of vouching friends)
@@ -2374,13 +2374,13 @@ declare module '@polkadot/api/types/submittable' {
* The dispatch origin for this call must be _Signed_.
*
* Parameters:
* - `friends`: A list of friends you trust to vouch for recovery attempts.
* Should be ordered and contain no duplicate values.
* - `threshold`: The number of friends that must vouch for a recovery attempt
* before the account can be recovered. Should be less than or equal to
* the length of the list of friends.
* - `delay_period`: The number of blocks after a recovery attempt is initialized
* that needs to pass before the account can be recovered.
* - `friends`: A list of friends you trust to vouch for recovery attempts. Should be
* ordered and contain no duplicate values.
* - `threshold`: The number of friends that must vouch for a recovery attempt before the
* account can be recovered. Should be less than or equal to the length of the list of
* friends.
* - `delay_period`: The number of blocks after a recovery attempt is initialized that
* needs to pass before the account can be recovered.
*
* # <weight>
* - Key: F (len of friends)
@@ -2404,8 +2404,8 @@ declare module '@polkadot/api/types/submittable' {
* The dispatch origin for this call must be _Signed_.
*
* Parameters:
* - `account`: The lost account that you want to recover. This account
* needs to be recoverable (i.e. have a recovery configuration).
* - `account`: The lost account that you want to recover. This account needs to be
* recoverable (i.e. have a recovery configuration).
*
* # <weight>
* - One storage read to check that account is recoverable. O(F)
@@ -2468,8 +2468,7 @@ declare module '@polkadot/api/types/submittable' {
*
* Parameters:
* - `lost`: The lost account that you want to recover.
* - `rescuer`: The account trying to rescue the lost account that you
* want to vouch for.
* - `rescuer`: The account trying to rescue the lost account that you want to vouch for.
*
* The combination of these two parameters must point to an active recovery
* process.
@@ -2955,8 +2954,8 @@ declare module '@polkadot/api/types/submittable' {
* The dispatch origin for this call must be _Signed_ by the stash, not the controller.
*
* Use this if there are additional funds in your stash account that you wish to bond.
* Unlike [`bond`](Self::bond) or [`unbond`](Self::unbond) this function does not impose any limitation
* on the amount that can be added.
* Unlike [`bond`](Self::bond) or [`unbond`](Self::unbond) this function does not impose
* any limitation on the amount that can be added.
*
* Emits `Bonded`.
*
@@ -3082,8 +3081,8 @@ declare module '@polkadot/api/types/submittable' {
* # <weight>
* O(S) where S is the number of slashing spans to be removed
* Reads: Bonded, Slashing Spans, Account, Locks
* Writes: Bonded, Slashing Spans (if S > 0), Ledger, Payee, Validators, Nominators, Account, Locks
* Writes Each: SpanSlash * S
* Writes: Bonded, Slashing Spans (if S > 0), Ledger, Payee, Validators, Nominators,
* Account, Locks Writes Each: SpanSlash * S
* # </weight>
**/
forceUnstake: AugmentedSubmittable<(stash: AccountId | string | Uint8Array, numSlashingSpans: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId, u32]>;
@@ -3162,7 +3161,8 @@ declare module '@polkadot/api/types/submittable' {
* Complexity: O(S) where S is the number of slashing spans on the account.
* DB Weight:
* - Reads: Stash Account, Bonded, Slashing Spans, Locks
* - Writes: Bonded, Slashing Spans (if S > 0), Ledger, Payee, Validators, Nominators, Stash Account, Locks
* - Writes: Bonded, Slashing Spans (if S > 0), Ledger, Payee, Validators, Nominators,
* Stash Account, Locks
* - Writes Each: SpanSlash * S
* # </weight>
**/
@@ -3214,10 +3214,10 @@ declare module '@polkadot/api/types/submittable' {
*
* Parameters:
* - `new_history_depth`: The new history depth you would like to set.
* - `era_items_deleted`: The number of items that will be deleted by this dispatch.
* This should report all the storage items that will be deleted by clearing old
* era history. Needed to report an accurate weight for the dispatch. Trusted by
* `Root` to report an accurate number.
* - `era_items_deleted`: The number of items that will be deleted by this dispatch. This
* should report all the storage items that will be deleted by clearing old era history.
* Needed to report an accurate weight for the dispatch. Trusted by `Root` to report an
* accurate number.
*
* Origin must be root.
*
@@ -3228,7 +3228,8 @@ declare module '@polkadot/api/types/submittable' {
* - Reads: Current Era, History Depth
* - Writes: History Depth
* - Clear Prefix Each: Era Stakers, EraStakersClipped, ErasValidatorPrefs
* - Writes Each: ErasValidatorReward, ErasRewardPoints, ErasTotalStake, ErasStartSessionIndex
* - Writes Each: ErasValidatorReward, ErasRewardPoints, ErasTotalStake,
* ErasStartSessionIndex
* # </weight>
**/
setHistoryDepth: AugmentedSubmittable<(newHistoryDepth: Compact<EraIndex> | AnyNumber | Uint8Array, eraItemsDeleted: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<EraIndex>, Compact<u32>]>;
@@ -3267,10 +3268,10 @@ declare module '@polkadot/api/types/submittable' {
*
* * `min_nominator_bond`: The minimum active bond needed to be a nominator.
* * `min_validator_bond`: The minimum active bond needed to be a validator.
* * `max_nominator_count`: The max number of users who can be a nominator at once.
* When set to `None`, no limit is enforced.
* * `max_validator_count`: The max number of users who can be a validator at once.
* When set to `None`, no limit is enforced.
* * `max_nominator_count`: The max number of users who can be a nominator at once. When
* set to `None`, no limit is enforced.
* * `max_validator_count`: The max number of users who can be a validator at once. When
* set to `None`, no limit is enforced.
*
* Origin must be Root to call this function.
*
@@ -3344,7 +3345,8 @@ declare module '@polkadot/api/types/submittable' {
};
sudo: {
/**
* Authenticates the current sudo key and sets the given AccountId (`new`) as the new sudo key.
* Authenticates the current sudo key and sets the given AccountId (`new`) as the new sudo
* key.
*
* The dispatch origin for this call must be _Signed_.
*
@@ -3466,10 +3468,11 @@ declare module '@polkadot/api/types/submittable' {
* # <weight>
* - `O(C + S)` where `C` length of `code` and `S` complexity of `can_set_code`
* - 1 storage write (codec `O(C)`).
* - 1 call to `can_set_code`: `O(S)` (calls `sp_io::misc::runtime_version` which is expensive).
* - 1 call to `can_set_code`: `O(S)` (calls `sp_io::misc::runtime_version` which is
* expensive).
* - 1 event.
* The weight of this function is dependent on the runtime, but generally this is very expensive.
* We will treat this as a full block.
* The weight of this function is dependent on the runtime, but generally this is very
* expensive. We will treat this as a full block.
* # </weight>
**/
setCode: AugmentedSubmittable<(code: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>;
@@ -3480,8 +3483,8 @@ declare module '@polkadot/api/types/submittable' {
* - `O(C)` where `C` length of `code`
* - 1 storage write (codec `O(C)`).
* - 1 event.
* The weight of this function is dependent on the runtime. We will treat this as a full block.
* # </weight>
* The weight of this function is dependent on the runtime. We will treat this as a full
* block. # </weight>
**/
setCodeWithoutChecks: AugmentedSubmittable<(code: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>;
/**
@@ -3720,7 +3723,8 @@ declare module '@polkadot/api/types/submittable' {
*
* # <weight>
* - `O(1)` (Note that implementations of `OnTimestampSet` must also be `O(1)`)
* - 1 storage read and 1 storage mutation (codec `O(1)`). (because of `DidUpdate::take` in `on_finalize`)
* - 1 storage read and 1 storage mutation (codec `O(1)`). (because of `DidUpdate::take` in
* `on_finalize`)
* - 1 event handler `on_timestamp_set`. Must be `O(1)`.
* # </weight>
**/
@@ -3873,7 +3877,8 @@ declare module '@polkadot/api/types/submittable' {
* Check storage proof for block number `block_number() - StoragePeriod`.
* If such block does not exist the proof is expected to be `None`.
* # <weight>
* - Linear w.r.t the number of indexed transactions in the proved block for random probing.
* - Linear w.r.t the number of indexed transactions in the proved block for random
* probing.
* There's a DB read for each transaction.
* Here we assume a maximum of 100 probed transactions.
* # </weight>
@@ -3890,9 +3895,9 @@ declare module '@polkadot/api/types/submittable' {
**/
renew: AugmentedSubmittable<(block: BlockNumber | AnyNumber | Uint8Array, index: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [BlockNumber, u32]>;
/**
* Index and store data on chain. Minimum data size is 1 bytes, maximum is `MaxTransactionSize`.
* Data will be removed after `STORAGE_PERIOD` blocks, unless `renew` is called.
* # <weight>
* Index and store data on chain. Minimum data size is 1 bytes, maximum is
* `MaxTransactionSize`. Data will be removed after `STORAGE_PERIOD` blocks, unless `renew`
* is called. # <weight>
* - n*log(n) of data size, as all data is pushed to an in-memory trie.
* Additionally contains a DB write.
* # </weight>
@@ -4339,7 +4344,8 @@ declare module '@polkadot/api/types/submittable' {
*
* May be called from any origin.
*
* - `calls`: The calls to be dispatched from the same origin.
* - `calls`: The calls to be dispatched from the same origin. The number of call must not
* exceed the constant: `batched_calls_limit` (available in constant metadata).
*
* If origin is root then call are dispatch without checking origin filter. (This includes
* bypassing `frame_system::Config::BaseCallFilter`).
@@ -4361,7 +4367,8 @@ declare module '@polkadot/api/types/submittable' {
*
* May be called from any origin.
*
* - `calls`: The calls to be dispatched from the same origin.
* - `calls`: The calls to be dispatched from the same origin. The number of call must not
* exceed the constant: `batched_calls_limit` (available in constant metadata).
*
* If origin is root then call are dispatch without checking origin filter. (This includes
* bypassing `frame_system::Config::BaseCallFilter`).
@@ -4384,11 +4391,12 @@ declare module '@polkadot/api/types/submittable' {
*
* - `source`: The account whose funds should be transferred.
* - `target`: The account that should be transferred the vested funds.
* - `amount`: The amount of funds to transfer and will be vested.
* - `schedule`: The vesting schedule attached to the transfer.
*
* Emits `VestingCreated`.
*
* NOTE: This will unlock all schedules through the current block.
*
* # <weight>
* - `O(1)`.
* - DbWeight: 4 Reads, 4 Writes
@@ -4397,6 +4405,30 @@ declare module '@polkadot/api/types/submittable' {
* # </weight>
**/
forceVestedTransfer: AugmentedSubmittable<(source: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, target: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, schedule: VestingInfo | { locked?: any; perBlock?: any; startingBlock?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, LookupSource, VestingInfo]>;
/**
* Merge two vesting schedules together, creating a new vesting schedule that unlocks over
* the highest possible start and end blocks. If both schedules have already started the
* current block will be used as the schedule start; with the caveat that if one schedule
* is finished by the current block, the other will be treated as the new merged schedule,
* unmodified.
*
* NOTE: If `schedule1_index == schedule2_index` this is a no-op.
* NOTE: This will unlock all schedules through the current block prior to merging.
* NOTE: If both schedules have ended by the current block, no new schedule will be created
* and both will be removed.
*
* Merged schedule attributes:
* - `starting_block`: `MAX(schedule1.starting_block, scheduled2.starting_block,
* current_block)`.
* - `ending_block`: `MAX(schedule1.ending_block, schedule2.ending_block)`.
* - `locked`: `schedule1.locked_at(current_block) + schedule2.locked_at(current_block)`.
*
* The dispatch origin for this call must be _Signed_.
*
* - `schedule1_index`: index of the first schedule to merge.
* - `schedule2_index`: index of the second schedule to merge.
**/
mergeSchedules: AugmentedSubmittable<(schedule1Index: u32 | AnyNumber | Uint8Array, schedule2Index: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32]>;
/**
* Unlock any vested funds of the sender account.
*
@@ -4418,12 +4450,13 @@ declare module '@polkadot/api/types/submittable' {
*
* The dispatch origin for this call must be _Signed_.
*
* - `target`: The account that should be transferred the vested funds.
* - `amount`: The amount of funds to transfer and will be vested.
* - `target`: The account receiving the vested funds.
* - `schedule`: The vesting schedule attached to the transfer.
*
* Emits `VestingCreated`.
*
* NOTE: This will unlock all schedules through the current block.
*
* # <weight>
* - `O(1)`.
* - DbWeight: 3 Reads, 3 Writes
+27 -28
View File
@@ -7,7 +7,7 @@ import type { Option, Raw, StorageKey, Text, u64 } from '@polkadot/types';
import type { Call, Hash, RuntimeVersion } from '@polkadot/types/interfaces';
import type { DecoratedMeta } from '@polkadot/types/metadata/decorate/types';
import type { StorageEntry } from '@polkadot/types/primitive/types';
import type { AnyFunction, AnyTuple, CallFunction, Codec, CodecArg as Arg, DefinitionRpc, DefinitionRpcSub, IMethod, InterfaceTypes, IStorageKey, Registry, RegistryTypes } from '@polkadot/types/types';
import type { AnyFunction, AnyTuple, CallFunction, Codec, DefinitionRpc, DefinitionRpcSub, DetectCodec, IMethod, IStorageKey, Registry, RegistryTypes } from '@polkadot/types/types';
import type { SubmittableExtrinsic } from '../submittable/types';
import type { ApiDecoration, ApiInterfaceRx, ApiOptions, ApiTypes, DecoratedErrors, DecoratedEvents, DecoratedRpc, DecoratedRpcSection, DecorateMethod, PaginationOptions, QueryableConsts, QueryableModuleStorage, QueryableModuleStorageAt, QueryableStorage, QueryableStorageAt, QueryableStorageEntry, QueryableStorageEntryAt, QueryableStorageMulti, QueryableStorageMultiArg, SubmittableExtrinsicFunction, SubmittableExtrinsics, SubmittableModuleExtrinsics } from '../types';
import type { VersionedRegistry } from './types';
@@ -164,7 +164,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
/**
* @description Creates an instance of a type as registered
*/
public createType <K extends keyof InterfaceTypes> (type: K, ...params: unknown[]): InterfaceTypes[K] {
public createType <T extends Codec = Codec, K extends string = string> (type: K, ...params: unknown[]): DetectCodec<T, K> {
return this.#registry.createType(type, ...params);
}
@@ -379,7 +379,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
}
private _decorateExtrinsicEntry<ApiType extends ApiTypes> (method: CallFunction, creator: (value: Call | Uint8Array | string) => SubmittableExtrinsic<ApiType>): SubmittableExtrinsicFunction<ApiType> {
const decorated = (...params: Arg[]): SubmittableExtrinsic<ApiType> =>
const decorated = (...params: unknown[]): SubmittableExtrinsic<ApiType> =>
creator(method(...params));
// pass through the `.is`
@@ -425,17 +425,17 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
decorated.creator = creator;
decorated.at = decorateMethod((hash: Hash, ...args: Arg[]): Observable<Codec> =>
decorated.at = decorateMethod((hash: Hash, ...args: unknown[]): Observable<Codec> =>
this._rpcCore.state.getStorage(getArgs(args), hash));
decorated.hash = decorateMethod((...args: Arg[]): Observable<Hash> =>
decorated.hash = decorateMethod((...args: unknown[]): Observable<Hash> =>
this._rpcCore.state.getStorageHash(getArgs(args)));
decorated.is = <A extends AnyTuple> (key: IStorageKey<AnyTuple>): key is IStorageKey<A> =>
key.section === creator.section &&
key.method === creator.method;
decorated.key = (...args: Arg[]): string =>
decorated.key = (...args: unknown[]): string =>
u8aToHex(compactStripLength(creator(
creator.meta.type.isPlain
? undefined
@@ -446,27 +446,27 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
: args
))[1]);
decorated.keyPrefix = (...keys: Arg[]): string =>
decorated.keyPrefix = (...keys: unknown[]): string =>
u8aToHex(creator.keyPrefix(...keys));
decorated.range = decorateMethod((range: [Hash, Hash?], ...args: Arg[]): Observable<[Hash, Codec][]> =>
decorated.range = decorateMethod((range: [Hash, Hash?], ...args: unknown[]): Observable<[Hash, Codec][]> =>
this._decorateStorageRange(decorated, args, range));
decorated.size = decorateMethod((...args: Arg[]): Observable<u64> =>
decorated.size = decorateMethod((...args: unknown[]): Observable<u64> =>
this._rpcCore.state.getStorageSize(getArgs(args)));
decorated.sizeAt = decorateMethod((hash: Hash | Uint8Array | string, ...args: Arg[]): Observable<u64> =>
decorated.sizeAt = decorateMethod((hash: Hash | Uint8Array | string, ...args: unknown[]): Observable<u64> =>
this._rpcCore.state.getStorageSize(getArgs(args), hash));
// FIXME NMap support
// .keys() & .entries() only available on map types
if (creator.iterKey && (creator.meta.type.isMap || creator.meta.type.isDoubleMap)) {
if (creator.iterKey && (creator.meta.type.isMap || creator.meta.type.isDoubleMap || creator.meta.type.isNMap)) {
decorated.entries = decorateMethod(
memo(this.#instanceId, (...args: Arg[]): Observable<[StorageKey, Codec][]> =>
memo(this.#instanceId, (...args: unknown[]): Observable<[StorageKey, Codec][]> =>
this._retrieveMapEntries(creator, null, args)));
decorated.entriesAt = decorateMethod(
memo(this.#instanceId, (hash: Hash | Uint8Array | string, ...args: Arg[]): Observable<[StorageKey, Codec][]> =>
memo(this.#instanceId, (hash: Hash | Uint8Array | string, ...args: unknown[]): Observable<[StorageKey, Codec][]> =>
this._retrieveMapEntries(creator, hash, args)));
decorated.entriesPaged = decorateMethod(
@@ -474,11 +474,11 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
this._retrieveMapEntriesPaged(creator, opts)));
decorated.keys = decorateMethod(
memo(this.#instanceId, (...args: Arg[]): Observable<StorageKey[]> =>
memo(this.#instanceId, (...args: unknown[]): Observable<StorageKey[]> =>
this._retrieveMapKeys(creator, null, args)));
decorated.keysAt = decorateMethod(
memo(this.#instanceId, (hash: Hash | Uint8Array | string, ...args: Arg[]): Observable<StorageKey[]> =>
memo(this.#instanceId, (hash: Hash | Uint8Array | string, ...args: unknown[]): Observable<StorageKey[]> =>
this._retrieveMapKeys(creator, hash, args)));
decorated.keysPaged = decorateMethod(
@@ -488,7 +488,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
if (this.supportMulti) {
// When using double map storage function, user need to pass double map key as an array
decorated.multi = decorateMethod((args: (Arg | Arg[])[]): Observable<Codec[]> =>
decorated.multi = decorateMethod((args: (unknown | unknown[])[]): Observable<Codec[]> =>
this._retrieveMulti(args.map((arg) => [creator, arg])));
}
@@ -504,19 +504,19 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
// Disable this where it occurs for each field we are decorating
/* eslint-disable @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment */
const decorated = decorateMethod((...args: Arg[]): Observable<Codec> =>
const decorated = decorateMethod((...args: unknown[]): Observable<Codec> =>
this._rpcCore.state.getStorage(getArgs(args), blockHash));
decorated.creator = creator;
decorated.hash = decorateMethod((...args: Arg[]): Observable<Hash> =>
decorated.hash = decorateMethod((...args: unknown[]): Observable<Hash> =>
this._rpcCore.state.getStorageHash(getArgs(args), blockHash));
decorated.is = <A extends AnyTuple> (key: IStorageKey<AnyTuple>): key is IStorageKey<A> =>
key.section === creator.section &&
key.method === creator.method;
decorated.key = (...args: Arg[]): string =>
decorated.key = (...args: unknown[]): string =>
u8aToHex(compactStripLength(creator(
creator.meta.type.isPlain
? undefined
@@ -527,21 +527,21 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
: args
))[1]);
decorated.keyPrefix = (...keys: Arg[]): string =>
decorated.keyPrefix = (...keys: unknown[]): string =>
u8aToHex(creator.keyPrefix(...keys));
decorated.size = decorateMethod((...args: Arg[]): Observable<u64> =>
decorated.size = decorateMethod((...args: unknown[]): Observable<u64> =>
this._rpcCore.state.getStorageSize(getArgs(args), blockHash));
// FIXME NMap support
// .keys() & .entries() only available on map types
if (creator.iterKey && (creator.meta.type.isMap || creator.meta.type.isDoubleMap)) {
decorated.entries = decorateMethod(
memo(this.#instanceId, (...args: Arg[]): Observable<[StorageKey, Codec][]> =>
memo(this.#instanceId, (...args: unknown[]): Observable<[StorageKey, Codec][]> =>
this._retrieveMapEntries(creator, blockHash, args)));
decorated.keys = decorateMethod(
memo(this.#instanceId, (...args: Arg[]): Observable<StorageKey[]> =>
memo(this.#instanceId, (...args: unknown[]): Observable<StorageKey[]> =>
this._retrieveMapKeys(creator, blockHash, args)));
}
@@ -553,7 +553,6 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
// Decorate the base storage call. In the case or rxjs or promise-without-callback (await)
// we make a subscription, alternatively we push this through a single-shot query
private _decorateStorageCall<ApiType extends ApiTypes> (creator: StorageEntry, decorateMethod: DecorateMethod<ApiType>): ReturnType<DecorateMethod<ApiType>> {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return decorateMethod((...args: unknown[]): Observable<Codec> => {
return this.hasSubscriptions
? this._rpcCore.state.subscribeStorage<[Codec]>([extractStorageArgs(this.#registry, creator, args)]).pipe(
@@ -566,7 +565,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
});
}
private _decorateStorageRange<ApiType extends ApiTypes> (decorated: QueryableStorageEntry<ApiType>, args: Arg[], range: [Hash, Hash?]): Observable<[Hash, Codec][]> {
private _decorateStorageRange<ApiType extends ApiTypes> (decorated: QueryableStorageEntry<ApiType>, args: unknown[], range: [Hash, Hash?]): Observable<[Hash, Codec][]> {
const outputType = unwrapStorageType(this.#registry, decorated.creator.meta.type, decorated.creator.meta.modifier.isOptional);
return this._rpcCore.state
@@ -580,7 +579,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
}
// retrieve a set of values for a specific set of keys - here we chunk the keys into PAGE_SIZE sizes
private _retrieveMulti (keys: [StorageEntry, Arg | Arg[]][]): Observable<Codec[]> {
private _retrieveMulti (keys: [StorageEntry, unknown | unknown[]][]): Observable<Codec[]> {
if (!keys.length) {
return of([]);
}
@@ -596,7 +595,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
);
}
private _retrieveMapKeys ({ iterKey, meta, method, section }: StorageEntry, at: Hash | Uint8Array | string | null, args: Arg[]): Observable<StorageKey[]> {
private _retrieveMapKeys ({ iterKey, meta, method, section }: StorageEntry, at: Hash | Uint8Array | string | null, args: unknown[]): Observable<StorageKey[]> {
assert(iterKey && (meta.type.isMap || meta.type.isDoubleMap || meta.type.isNMap), 'keys can only be retrieved on maps, linked maps and double maps');
const headKey = iterKey(...args).toHex();
@@ -630,7 +629,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
);
}
private _retrieveMapEntries (entry: StorageEntry, at: Hash | Uint8Array | string | null, args: Arg[]): Observable<[StorageKey, Codec][]> {
private _retrieveMapEntries (entry: StorageEntry, at: Hash | Uint8Array | string | null, args: unknown[]): Observable<[StorageKey, Codec][]> {
const query = at
? (keyset: StorageKey[]) => this._rpcCore.state.queryStorageAt(keyset, at)
: (keyset: StorageKey[]) => this._rpcCore.state.queryStorageAt(keyset);
+13 -7
View File
@@ -332,6 +332,15 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
return true;
}
private _subscribeHealth (): void {
// Only enable the health keepalive on WS, not needed on HTTP
this.#healthTimer = this.hasSubscriptions
? setInterval((): void => {
firstValueFrom(this._rpcCore.system.health()).catch(() => undefined);
}, KEEPALIVE_INTERVAL)
: null;
}
private _unsubscribeHealth (): void {
if (this.#healthTimer) {
clearInterval(this.#healthTimer);
@@ -352,8 +361,8 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
}
#onProviderConnect = async (): Promise<void> => {
this.emit('connected');
this._isConnected.next(true);
this.emit('connected');
try {
const [hasMeta, cryptoReady] = await Promise.all([
@@ -363,15 +372,13 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
: cryptoWaitReady()
]);
this._subscribeHealth();
if (hasMeta && !this._isReady && cryptoReady) {
this._isReady = true;
this.emit('ready', this);
}
this.#healthTimer = setInterval((): void => {
firstValueFrom(this._rpcCore.system.health()).catch(() => undefined);
}, KEEPALIVE_INTERVAL);
} catch (_error) {
const error = new Error(`FATAL: Unable to initialize the API: ${(_error as Error).message}`);
@@ -382,10 +389,9 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
}
#onProviderDisconnect = (): void => {
this.emit('disconnected');
this._isConnected.next(false);
this._unsubscribeHealth();
this.emit('disconnected');
};
#onProviderError = (error: Error): void => {
+1 -1
View File
@@ -190,7 +190,7 @@ function types (api: ApiPromise): void {
}
async function tx (api: ApiPromise, pairs: TestKeyringMap): Promise<void> {
// transfer, also allows for BigInt inputs here
// transfer, also allows for bigint inputs here
const transfer = api.tx.balances.transfer(pairs.bob.address, 123456789n);
console.log('transfer casted', transfer as IMethod<AnyTuple>, transfer as IExtrinsic<AnyTuple>);
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/api', version: '5.3.1' };
export const packageInfo = { name: '@polkadot/api', version: '5.8.3' };
+3 -4
View File
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { AnyFunction, Callback, Codec, CodecArg } from '@polkadot/types/types';
import type { AnyFunction, Callback, Codec } from '@polkadot/types/types';
export type Push<T extends readonly unknown[], V> = [...T, V]
@@ -57,9 +57,8 @@ export interface DecorateMethodOptions {
export type DecorateFn <T extends Codec> = (...args: any[]) => Observable<T>;
// FIXME We need a solution for NMap
export interface PaginationOptions<ArgType = CodecArg> {
args: ArgType[];
export interface PaginationOptions<A = unknown> {
args: A[];
pageSize: number;
startKey?: string;
}
+13 -13
View File
@@ -5,34 +5,34 @@ import type { Observable } from 'rxjs';
import type { StorageKey, u64 } from '@polkadot/types';
import type { Hash } from '@polkadot/types/interfaces';
import type { StorageEntry } from '@polkadot/types/primitive/types';
import type { AnyFunction, AnyTuple, Callback, Codec, CodecArg, IStorageKey } from '@polkadot/types/types';
import type { AnyFunction, AnyTuple, Callback, Codec, IStorageKey } from '@polkadot/types/types';
import type { ApiTypes, DropLast, MethodResult, ObsInnerType, PaginationOptions, PromiseOrObs, UnsubscribePromise } from './base';
interface StorageEntryObservableMulti {
<T extends Codec>(args: (CodecArg[] | CodecArg)[]): Observable<T[]>;
<T extends Codec>(args: (unknown[] | unknown)[]): Observable<T[]>;
}
interface StorageEntryPromiseMulti {
<T extends Codec>(args: (CodecArg[] | CodecArg)[]): Promise<T[]>;
<T extends Codec>(args: (CodecArg[] | CodecArg)[], callback: Callback<T[]>): UnsubscribePromise;
<T extends Codec>(args: (unknown[] | unknown)[]): Promise<T[]>;
<T extends Codec>(args: (unknown[] | unknown)[], callback: Callback<T[]>): UnsubscribePromise;
}
export interface StorageEntryPromiseOverloads {
(arg1?: CodecArg, arg2?: CodecArg, arg3?: CodecArg): Promise<Codec>;
<T extends Codec>(arg1?: CodecArg, arg2?: CodecArg, arg3?: CodecArg): Promise<T>;
(arg1?: unknown, arg2?: unknown, arg3?: unknown): Promise<Codec>;
<T extends Codec>(arg1?: unknown, arg2?: unknown, arg3?: unknown): Promise<T>;
<T extends Codec>(callback: Callback<T>): UnsubscribePromise;
<T extends Codec>(arg: CodecArg, callback: Callback<T>): UnsubscribePromise;
<T extends Codec>(arg1: CodecArg, arg2: CodecArg, callback: Callback<T>): UnsubscribePromise;
<T extends Codec>(arg1: CodecArg, arg2: CodecArg, arg3: CodecArg, callback: Callback<T>): UnsubscribePromise;
<T extends Codec>(arg: unknown, callback: Callback<T>): UnsubscribePromise;
<T extends Codec>(arg1: unknown, arg2: unknown, callback: Callback<T>): UnsubscribePromise;
<T extends Codec>(arg1: unknown, arg2: unknown, arg3: unknown, callback: Callback<T>): UnsubscribePromise;
}
export interface StorageEntryPromiseOverloadsAt {
(arg1?: CodecArg, arg2?: CodecArg, arg3?: CodecArg): Promise<Codec>;
<T extends Codec>(arg1?: CodecArg, arg2?: CodecArg, arg3?: CodecArg): Promise<T>;
(arg1?: unknown, arg2?: unknown, arg3?: unknown): Promise<Codec>;
<T extends Codec>(arg1?: unknown, arg2?: unknown, arg3?: unknown): Promise<T>;
}
// This is the most generic typings we can have for a storage entry function
type GenericStorageEntryFunction = (...args: CodecArg[]) => Observable<Codec>
type GenericStorageEntryFunction = (...args: unknown[]) => Observable<Codec>
export type QueryableStorageEntry<ApiType extends ApiTypes, A extends AnyTuple = AnyTuple> =
ApiType extends 'rxjs'
@@ -92,7 +92,7 @@ export interface QueryableModuleStorageAt<ApiType extends ApiTypes> {
export type QueryableStorageMultiArg<ApiType extends ApiTypes> =
QueryableStorageEntry<ApiType> |
[QueryableStorageEntry<ApiType>, ...CodecArg[]];
[QueryableStorageEntry<ApiType>, ...unknown[]];
export interface QueryableStorageMultiBase<ApiType extends ApiTypes> {
<T extends Codec[]>(calls: QueryableStorageMultiArg<ApiType>[]): Observable<T>;
+1 -1
View File
@@ -4,7 +4,7 @@
import type { Storage } from '@polkadot/types/metadata/decorate/types';
import { decorateStorage, Metadata, TypeRegistry } from '@polkadot/types';
import metaStatic from '@polkadot/types/metadata/static-substrate';
import metaStatic from '@polkadot/types-support/metadata/static-substrate';
import { extractStorageArgs } from './validate';
+7 -7
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-core",
"version": "5.3.1",
"version": "5.8.3",
"type": "module",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js",
@@ -19,13 +19,13 @@
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
"dependencies": {
"@babel/runtime": "^7.14.8",
"@polkadot/rpc-provider": "5.3.1",
"@polkadot/types": "5.3.1",
"@polkadot/util": "^7.1.1",
"rxjs": "^7.2.0"
"@babel/runtime": "^7.15.4",
"@polkadot/rpc-provider": "5.8.3",
"@polkadot/types": "5.8.3",
"@polkadot/util": "^7.3.1",
"rxjs": "^7.3.0"
},
"devDependencies": {
"@polkadot/keyring": "^7.1.1"
"@polkadot/keyring": "^7.3.1"
}
}
+1 -1
View File
@@ -305,7 +305,7 @@ export class RpcCore {
subscriptionPromise = this._createSubscriber({ paramsJson, subName, subType, update }, errorHandler);
} catch (error) {
errorHandler(error);
errorHandler(error as Error);
}
// Teardown logic
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/rpc-core', version: '5.3.1' };
export const packageInfo = { name: '@polkadot/rpc-core', version: '5.8.3' };
+11 -11
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-provider",
"version": "5.3.1",
"version": "5.8.3",
"type": "module",
"description": "Transport providers for the API",
"main": "index.js",
@@ -19,19 +19,19 @@
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
"dependencies": {
"@babel/runtime": "^7.14.8",
"@polkadot/types": "5.3.1",
"@polkadot/util": "^7.1.1",
"@polkadot/util-crypto": "^7.1.1",
"@polkadot/x-fetch": "^7.1.1",
"@polkadot/x-global": "^7.1.1",
"@polkadot/x-ws": "^7.1.1",
"@babel/runtime": "^7.15.4",
"@polkadot/types": "5.8.3",
"@polkadot/util": "^7.3.1",
"@polkadot/util-crypto": "^7.3.1",
"@polkadot/x-fetch": "^7.3.1",
"@polkadot/x-global": "^7.3.1",
"@polkadot/x-ws": "^7.3.1",
"eventemitter3": "^4.0.7"
},
"devDependencies": {
"@polkadot/keyring": "^7.1.1",
"@polkadot/types": "5.3.1",
"@polkadot/keyring": "^7.3.1",
"@polkadot/types": "5.8.3",
"mock-socket": "^9.0.3",
"nock": "^13.1.1"
"nock": "^13.1.3"
}
}
+3 -3
View File
@@ -13,9 +13,9 @@ import EventEmitter from 'eventemitter3';
import { createTestKeyring } from '@polkadot/keyring/testing';
import { decorateStorage, Metadata } from '@polkadot/types';
import jsonrpc from '@polkadot/types/interfaces/jsonrpc';
import rpcHeader from '@polkadot/types/json/Header.004.json';
import rpcSignedBlock from '@polkadot/types/json/SignedBlock.004.immortal.json';
import rpcMetadata from '@polkadot/types/metadata/static-substrate';
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 { randomAsU8a } from '@polkadot/util-crypto';
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/rpc-provider', version: '5.3.1' };
export const packageInfo = { name: '@polkadot/rpc-provider', version: '5.8.3' };
+2 -2
View File
@@ -418,7 +418,7 @@ export class WsProvider implements ProviderInterface {
}
}
} catch (error) {
handler.callback(error, undefined);
handler.callback(error as Error, undefined);
}
delete this.#handlers[response.id];
@@ -446,7 +446,7 @@ export class WsProvider implements ProviderInterface {
handler.callback(null, result);
} catch (error) {
handler.callback(error, undefined);
handler.callback(error as Error, undefined);
}
}
+1 -1
View File
@@ -27,7 +27,7 @@ interface ReplyDef {
};
}
global.WebSocket = WebSocket;
global.WebSocket = WebSocket as typeof global.WebSocket;
export const TEST_WS_URL = 'ws://localhost:9955';
+10 -9
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/typegen",
"version": "5.3.1",
"version": "5.8.3",
"type": "module",
"description": "Type generation scripts",
"main": "index.js",
@@ -26,16 +26,17 @@
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/typegen#readme",
"dependencies": {
"@babel/core": "^7.14.8",
"@babel/register": "^7.14.5",
"@babel/runtime": "^7.14.8",
"@polkadot/api": "5.3.1",
"@polkadot/rpc-provider": "5.3.1",
"@polkadot/types": "5.3.1",
"@polkadot/util": "^7.1.1",
"@babel/core": "^7.15.5",
"@babel/register": "^7.15.3",
"@babel/runtime": "^7.15.4",
"@polkadot/api": "5.8.3",
"@polkadot/rpc-provider": "5.8.3",
"@polkadot/types": "5.8.3",
"@polkadot/types-support": "5.8.3",
"@polkadot/util": "^7.3.1",
"handlebars": "^4.7.7",
"websocket": "^1.0.34",
"yargs": "^17.0.1"
"yargs": "^17.1.1"
},
"devDependencies": {
"@types/websocket": "^1.0.4",
@@ -21,6 +21,7 @@ try {
'^@polkadot/rpc-core(.*)': './packages/rpc-core/src\\1',
'^@polkadot/rpc-provider(.*)': './packages/rpc-provider/src\\1',
'^@polkadot/types-known(.*)': './packages/types-known/src\\1',
'^@polkadot/types-support(.*)': './packages/types-support/src\\1',
'^@polkadot/types(.*)': './packages/types/src\\1'
}
}]
@@ -17,6 +17,7 @@ try {
['module-resolver', {
alias: {
'^@polkadot/types-known(.*)': './packages/types-known/src\\1',
'^@polkadot/types-support(.*)': './packages/types-support/src\\1',
'^@polkadot/types(.*)': './packages/types/src\\1'
}
}]
@@ -18,6 +18,7 @@ try {
alias: {
'^@polkadot/typegen(.*)': './packages/typegen/src\\1',
'^@polkadot/types-known(.*)': './packages/types-known/src\\1',
'^@polkadot/types-support(.*)': './packages/types-support/src\\1',
'^@polkadot/types(.*)': './packages/types/src\\1'
}
}]
@@ -17,6 +17,7 @@ try {
['module-resolver', {
alias: {
'^@polkadot/types-known(.*)': './packages/types-known/src\\1',
'^@polkadot/types-support(.*)': './packages/types-support/src\\1',
'^@polkadot/types(.*)': './packages/types/src\\1'
}
}]
@@ -17,6 +17,7 @@ try {
['module-resolver', {
alias: {
'^@polkadot/types-known(.*)': './packages/types-known/src\\1',
'^@polkadot/types-support(.*)': './packages/types-support/src\\1',
'^@polkadot/types(.*)': './packages/types/src\\1'
}
}]
@@ -8,7 +8,7 @@ import { TypeRegistry } from '@polkadot/types/create';
import * as defaultDefinitions from '@polkadot/types/interfaces/definitions';
import * as defaultPrimitives from '@polkadot/types/primitive';
import { createImports, getDerivedTypes, readTemplate, setImports, writeFile } from '../util';
import { createImports, readTemplate, setImports, writeFile } from '../util';
import { ModuleTypes } from '../util/imports';
const primitiveClasses = {
@@ -35,10 +35,10 @@ export function generateInterfaceTypes (importDefinitions: { [importPath: string
Object
.keys(primitiveClasses)
.filter((name) => !name.includes('Generic'))
.forEach((primitiveName) => {
.forEach((primitiveName): void => {
setImports(definitions, imports, [primitiveName]);
items.push(...getDerivedTypes(registry, definitions, primitiveName, primitiveName, imports));
items.push(primitiveName);
});
const existingTypes: Record<string, boolean> = {};
@@ -55,10 +55,10 @@ export function generateInterfaceTypes (importDefinitions: { [importPath: string
const uniqueTypes = Object.keys(types).filter((type) => !existingTypes[type]);
uniqueTypes.forEach((type) => {
uniqueTypes.forEach((type): void => {
existingTypes[type] = true;
items.push(...getDerivedTypes(registry, definitions, type, types[type] as string, imports));
items.push(type);
});
});
+4 -2
View File
@@ -54,7 +54,7 @@ function tsEnum (registry: Registry, definitions: Record<string, ModuleTypes>, {
const keys = (sub as TypeDef[]).map((def, index): string => {
const { info, name = `unknown${index}`, type } = def;
const getter = stringUpperFirst(stringCamelCase(name.replace(' ', '_')));
const isComplex = [TypeDefInfo.Struct, TypeDefInfo.Tuple, TypeDefInfo.Vec, TypeDefInfo.VecFixed].includes(info);
const isComplex = [TypeDefInfo.Result, TypeDefInfo.Struct, TypeDefInfo.Tuple, TypeDefInfo.Vec, TypeDefInfo.VecFixed].includes(info);
const asGetter = type === 'Null' || info === TypeDefInfo.DoNotConstruct
? ''
: createGetter(definitions, `as${getter}`, isComplex ? formatType(registry, definitions, info === TypeDefInfo.Struct ? def : type, imports) : type, imports);
@@ -65,6 +65,7 @@ function tsEnum (registry: Registry, definitions: Record<string, ModuleTypes>, {
switch (info) {
case TypeDefInfo.Compact:
case TypeDefInfo.Plain:
case TypeDefInfo.Result:
case TypeDefInfo.Struct:
case TypeDefInfo.Tuple:
case TypeDefInfo.Vec:
@@ -76,7 +77,7 @@ function tsEnum (registry: Registry, definitions: Record<string, ModuleTypes>, {
return '';
default:
throw new Error(`Enum: ${enumName || 'undefined'}: Unhandled type ${TypeDefInfo[info]}`);
throw new Error(`Enum: ${enumName || 'undefined'}: Unhandled nested "${TypeDefInfo[info]}" type`);
}
});
@@ -189,6 +190,7 @@ const encoders: Record<TypeDefInfo, (registry: Registry, definitions: Record<str
[TypeDefInfo.Null]: errorUnhandled,
[TypeDefInfo.Option]: tsOption,
[TypeDefInfo.Plain]: tsPlain,
[TypeDefInfo.Range]: errorUnhandled,
[TypeDefInfo.Result]: tsResult,
[TypeDefInfo.Set]: tsSet,
[TypeDefInfo.Si]: tsSi,
+1 -1
View File
@@ -9,9 +9,9 @@ import fs from 'fs';
import { GenericCall as Call, Metadata, TypeRegistry, Vec } from '@polkadot/types';
import * as definitions from '@polkadot/types/interfaces/definitions';
import { getStorage as getSubstrateStorage } from '@polkadot/types/metadata/decorate/storage/getStorage';
import rpcdata from '@polkadot/types/metadata/static-substrate';
import { Text } from '@polkadot/types/primitive';
import { unwrapStorageType } from '@polkadot/types/primitive/StorageKey';
import rpcdata from '@polkadot/types-support/metadata/static-substrate';
import { stringCamelCase, stringLowerFirst } from '@polkadot/util';
interface SectionItem {
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/typegen', version: '5.3.1' };
export const packageInfo = { name: '@polkadot/typegen', version: '5.8.3' };
@@ -5,7 +5,7 @@
declare module '@polkadot/types/types/registry' {
export interface InterfaceTypes {
{{#each items}}
{{{this}}}
{{{this}}}: {{{this}}};
{{/each}}
}
}
-12
View File
@@ -1,12 +0,0 @@
// Copyright 2017-2021 @polkadot/typegen authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Constructor } from '@polkadot/types/types';
import { UInt } from '@polkadot/types/codec';
import { isChildClass } from '@polkadot/util';
/** @internal */
export function isCompactEncodable (Child: Constructor<any>): boolean {
return isChildClass(UInt, Child);
}
+2 -44
View File
@@ -6,15 +6,13 @@ import type { Constructor, Registry } from '@polkadot/types/types';
import { Compact, Enum, Option, Struct, Tuple, UInt, Vec } from '@polkadot/types/codec';
import { AbstractInt } from '@polkadot/types/codec/AbstractInt';
import { ClassOfUnsafe, getTypeDef } from '@polkadot/types/create';
import { getTypeDef } from '@polkadot/types/create';
import { TypeDefInfo } from '@polkadot/types/create/types';
import { GenericAccountId, GenericLookupSource, GenericVote } from '@polkadot/types/generic';
import { AllConvictions } from '@polkadot/types/interfaces/democracy/definitions';
import { bool, Null } from '@polkadot/types/primitive';
import * as primitiveClasses from '@polkadot/types/primitive';
import { isChildClass, stringify } from '@polkadot/util';
import { isCompactEncodable } from './class';
import { formatType } from './formatting';
import { ModuleTypes, setImports, TypeImports } from './imports';
@@ -24,46 +22,6 @@ function arrayToStrType (arr: string[]): string {
const voteConvictions = arrayToStrType(AllConvictions);
// From `T`, generate `Compact<T>, Option<T>, Vec<T>`
/** @internal */
export function getDerivedTypes (registry: Registry, definitions: Record<string, ModuleTypes>, type: string, primitiveName: string, imports: TypeImports): string[] {
// `primitiveName` represents the actual primitive type our type is mapped to
const isCompact = isCompactEncodable(
(primitiveClasses as Record<string, any>)[primitiveName] ||
ClassOfUnsafe(registry, type)
);
const def = getTypeDef(type);
setImports(definitions, imports, ['Option', 'Vec', isCompact ? 'Compact' : '']);
const types = [
{
info: TypeDefInfo.Option,
sub: def,
type
},
{
info: TypeDefInfo.Vec,
sub: def,
type
}
];
if (isCompact) {
types.unshift({
info: TypeDefInfo.Compact,
sub: def,
type
});
}
const result = types.map((t) => formatType(registry, definitions, t, imports)).map((t) => `'${t}': ${t};`);
result.unshift(`${type}: ${type};`);
return result;
}
// Make types a little bit more flexible
// - if param instanceof AbstractInt, then param: u64 | Uint8array | AnyNumber
// etc
@@ -87,7 +45,7 @@ export function getSimilarTypes (registry: Registry, definitions: Record<string,
return ['null'];
}
const Clazz = ClassOfUnsafe(registry, type);
const Clazz = registry.createClass(type);
if (isChildClass(Vec, Clazz)) {
const vecDef = getTypeDef(type);
+3
View File
@@ -129,6 +129,9 @@ const formatters: Record<TypeDefInfo, (registry: Registry, typeDef: TypeDef, def
return typeDef.type;
},
[TypeDefInfo.Range]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
throw new Error(`TypeDefInfo.Range: Not implemented on ${stringify(typeDef)}`);
},
[TypeDefInfo.Set]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
throw new Error(`TypeDefInfo.Set: Not implemented on ${stringify(typeDef)}`);
},
+1 -1
View File
@@ -4,7 +4,7 @@
import type { ExtraTypes } from '../generate/types';
import { Metadata, TypeRegistry } from '@polkadot/types';
import staticData from '@polkadot/types/metadata/static-substrate';
import staticData from '@polkadot/types-support/metadata/static-substrate';
import { registerDefinitions } from './register';
+6 -6
View File
@@ -1,8 +1,8 @@
{
"name": "@polkadot/types-known",
"version": "5.3.1",
"version": "5.8.3",
"type": "module",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"description": "Known type definitions",
"main": "index.js",
"sideEffects": [
"./detectPackage.js",
@@ -19,9 +19,9 @@
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types-known#readme",
"dependencies": {
"@babel/runtime": "^7.14.8",
"@polkadot/networks": "^7.1.1",
"@polkadot/types": "5.3.1",
"@polkadot/util": "^7.1.1"
"@babel/runtime": "^7.15.4",
"@polkadot/networks": "^7.3.1",
"@polkadot/types": "5.8.3",
"@polkadot/util": "^7.3.1"
}
}
+1 -1
View File
@@ -57,7 +57,7 @@ export function getSpecExtensions ({ knownTypes }: Registry, chainName: Text | s
/**
* @description Based on the chain and runtimeVersion, get the applicable types (ready for registration)
*/
export function getSpecTypes ({ knownTypes }: Registry, chainName: Text | string, specName: Text | string, specVersion: BigInt | BN | number): RegistryTypes {
export function getSpecTypes ({ knownTypes }: Registry, chainName: Text | string, specName: Text | string, specVersion: bigint | BN | number): RegistryTypes {
const _chainName = chainName.toString();
const _specName = specName.toString();
const _specVersion = bnToBn(specVersion).toNumber();
+15
View File
@@ -48,6 +48,15 @@ const typesModules: Record<string, OverrideModuleType> = {
inclusion: {
ValidatorIndex: 'ParaValidatorIndex'
},
paraInclusion: {
ValidatorIndex: 'ParaValidatorIndex'
},
paraScheduler: {
ValidatorIndex: 'ParaValidatorIndex'
},
paraShared: {
ValidatorIndex: 'ParaValidatorIndex'
},
parachains: {
Id: 'ParaId'
},
@@ -81,6 +90,12 @@ const typesModules: Record<string, OverrideModuleType> = {
},
treasury: {
Proposal: 'TreasuryProposal'
},
xcm: {
AssetId: 'XcmAssetId'
},
xcmPallet: {
AssetId: 'XcmAssetId'
}
};
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/types-known', version: '5.3.1' };
export const packageInfo = { name: '@polkadot/types-known', version: '5.8.3' };
+8 -2
View File
@@ -10,7 +10,7 @@ const sharedTypes = {
RawSolution: 'RawSolutionWith24',
Keys: 'SessionKeys6',
ProxyType: {
_enum: ['Any', 'NonTransfer', 'Governance', 'Staking', 'IdentityJudgement', 'CancelProxy']
_enum: ['Any', 'NonTransfer', 'Governance', 'Staking', 'IdentityJudgement', 'CancelProxy', 'Auction']
}
};
@@ -192,7 +192,13 @@ const versioned: OverrideVersionedType[] = [
{
minmax: [9010, undefined],
types: {
...sharedTypes
...sharedTypes,
AssetInstance: 'AssetInstanceV0',
MultiAsset: 'MultiAssetV0',
MultiLocation: 'MultiLocationV0',
Response: 'ResponseV0',
Xcm: 'XcmV0',
XcmOrder: 'XcmOrderV0'
}
}
];
+7 -1
View File
@@ -40,7 +40,13 @@ const versioned: OverrideVersionedType[] = [
{
minmax: [229, undefined],
types: {
...sharedTypes
...sharedTypes,
AssetInstance: 'AssetInstanceV0',
MultiAsset: 'MultiAssetV0',
MultiLocation: 'MultiLocationV0',
Response: 'ResponseV0',
Xcm: 'XcmV0',
XcmOrder: 'XcmOrderV0'
}
}
];
+8 -2
View File
@@ -5,7 +5,7 @@
import type { OverrideVersionedType } from '@polkadot/types/types';
// these are override types for Polkadot
// these are override types for Statemine, Statemint, Westmint
const versioned: OverrideVersionedType[] = [
{
minmax: [0, undefined],
@@ -21,7 +21,13 @@ const versioned: OverrideVersionedType[] = [
'AssetManager',
'Staking'
]
}
},
AssetInstance: 'AssetInstanceV0',
MultiAsset: 'MultiAssetV0',
MultiLocation: 'MultiLocationV0',
Response: 'ResponseV0',
Xcm: 'XcmV0',
XcmOrder: 'XcmOrderV0'
}
}
];
+7 -1
View File
@@ -91,7 +91,13 @@ const versioned: OverrideVersionedType[] = [
{
minmax: [50, undefined],
types: {
...sharedTypes
...sharedTypes,
AssetInstance: 'AssetInstanceV0',
MultiAsset: 'MultiAssetV0',
MultiLocation: 'MultiLocationV0',
Response: 'ResponseV0',
Xcm: 'XcmV0',
XcmOrder: 'XcmOrderV0'
}
}
];
+1 -1
View File
@@ -13,7 +13,7 @@ const upgrades: ChainUpgradesRaw = [
[2962294, 2012], [3240000, 2013], [3274408, 2015], [3323565, 2019], [3534175, 2022],
[3860281, 2023], [4143129, 2024], [4401242, 2025], [4841367, 2026], [5961600, 2027],
[6137912, 2028], [6561855, 2029], [7100891, 2030], [7468792, 9010], [7668600, 9030],
[7812476, 9040], [8010981, 9050], [8073833, 9070], [8555825, 9080]
[7812476, 9040], [8010981, 9050], [8073833, 9070], [8555825, 9080], [8945245, 9090]
];
export default upgrades;
@@ -8,7 +8,8 @@ const upgrades: ChainUpgradesRaw = [
[244358, 8], [303079, 9], [314201, 10], [342400, 11], [443963, 12],
[528470, 13], [687751, 14], [746085, 15], [787923, 16], [799302, 17],
[1205128, 18], [1603423, 23], [1733218, 24], [2005673, 25], [2436698, 26],
[3613564, 27], [3899547, 28], [4345767, 29], [4876134, 30], [5661442, 9050]
[3613564, 27], [3899547, 28], [4345767, 29], [4876134, 30], [5661442, 9050],
[6321619, 9080]
];
export default upgrades;
+1 -1
View File
@@ -11,7 +11,7 @@ const upgrades: ChainUpgradesRaw = [
[2549864, 45], [3925782, 46], [3925843, 47], [4207800, 48], [4627944, 49],
[5124076, 50], [5478664, 900], [5482450, 9000], [5584305, 9010], [5784566, 9030],
[5879822, 9031], [5896856, 9032], [5897316, 9033], [6117927, 9050], [6210274, 9070],
[6379314, 9080]
[6379314, 9080], [6979141, 9090]
];
export default upgrades;
+201
View File
@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+3
View File
@@ -0,0 +1,3 @@
# @polkadot/types-known
Specific known base type overrides (e.g. `Address`, etc) for chains & specs. This does not contain user-specfic types.
+25
View File
@@ -0,0 +1,25 @@
{
"name": "@polkadot/types-support",
"version": "5.8.3",
"type": "module",
"description": "Supporting files for types, mostly for testing",
"main": "index.js",
"sideEffects": [
"./detectPackage.js",
"./detectPackage.cjs"
],
"engines": {
"node": ">=14.0.0"
},
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [],
"contributors": [],
"license": "Apache-2.0",
"repository": "github:polkadot-js/api",
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types-support#readme",
"dependencies": {
"@babel/runtime": "^7.15.4",
"@polkadot/util": "^7.3.1"
}
}
@@ -0,0 +1,8 @@
// Copyright 2017-2021 @polkadot/types-support authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { detectPackage } from '@polkadot/util';
import { packageInfo } from './packageInfo';
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname, []);
+4
View File
@@ -0,0 +1,4 @@
// Copyright 2017-2021 @polkadot/types-support authors & contributors
// SPDX-License-Identifier: Apache-2.0
import './detectPackage';

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