Compare commits

..
85 Commits
Author SHA1 Message Date
github-actions[bot] 5e891f68ca [CI Skip] release/stable 8.13.1
skip-checks: true
2022-07-16 06:19:09 +00:00
Jaco 040e8cbe94 8.13.1 (#5078) 2022-07-16 09:11:01 +03:00
github-actions[bot] 1b5a772a4a [CI Skip] bump/beta 8.12.3-18-x
skip-checks: true
2022-07-16 05:58:22 +00:00
Jaco 12d8465cf4 Update to latest Substrate, Polkadot & Kusama metadata (#5077) 2022-07-16 08:50:15 +03:00
github-actions[bot] 190f4194cc [CI Skip] bump/beta 8.12.3-17-x
skip-checks: true
2022-07-15 17:59:01 +00:00
Jaco c01a6001fc Deupe decodeU8a result format on failure (#5076) 2022-07-15 20:50:18 +03:00
github-actions[bot] c847920f86 [CI Skip] bump/beta 8.12.3-16-x
skip-checks: true
2022-07-15 15:49:36 +00:00
Jaco 67325dbc09 Additional historic DispatchError variant (#5075) 2022-07-15 18:39:59 +03:00
github-actions[bot] 63d72e7d36 [CI Skip] bump/beta 8.12.3-15-x
skip-checks: true
2022-07-15 10:04:43 +00:00
Jaco 64ddc05bc8 Support DebugRuntimeApi runtime calls (frontier) (#5073) 2022-07-15 12:57:11 +03:00
github-actions[bot] d15dec1e58 [CI Skip] bump/beta 8.12.3-14-x
skip-checks: true
2022-07-15 08:22:01 +00:00
Jaco cb283c410b Use type asserts for json imports (#5072) 2022-07-15 11:13:12 +03:00
github-actions[bot] 7c6ca42c10 [CI Skip] bump/beta 8.12.3-13-x
skip-checks: true
2022-07-15 07:15:32 +00:00
Jaco bd6ad3a2ef Asupport for NimbusApi on runtime (#5071) 2022-07-15 10:08:11 +03:00
github-actions[bot] 1a29d7950c [CI Skip] bump/beta 8.12.3-12-x
skip-checks: true
2022-07-15 06:37:43 +00:00
Jaco 7049186928 Support for NominationPoolsApi runtime (#5069)
* Support for NominationPoolsApi runtime

* CHANGELOG
2022-07-15 09:27:30 +03:00
github-actions[bot] dc34974a06 [CI Skip] bump/beta 8.12.3-11-x
skip-checks: true
2022-07-15 06:05:10 +00:00
Jaco 932e02e018 Remove old test infrastructure (#5070) 2022-07-15 08:57:17 +03:00
github-actions[bot] 6f91fbd847 [CI Skip] bump/beta 8.12.3-10-x
skip-checks: true
2022-07-14 11:37:39 +00:00
Jaco af7c4609f2 Add Kusama 9250 upgrade block (#5068) 2022-07-14 14:29:20 +03:00
github-actions[bot] 3600a4bdd7 [CI Skip] bump/beta 8.12.3-9-x
skip-checks: true
2022-07-14 11:12:10 +00:00
Jaco 3bf4e905e9 BlockBuilder 2/3/4 & GrandpaApi 2 runtime interface definitions (#5067) 2022-07-14 14:03:15 +03:00
github-actions[bot] 38984af858 [CI Skip] bump/beta 8.12.3-8-x
skip-checks: true
2022-07-13 14:07:26 +00:00
Jaco 60384ad850 Adjust blockNumber extract (w & w/o Compact) (#5066)
* Adjust blockNumber extract (w & w/o Compact)

* Adjust unused test file
2022-07-13 16:59:39 +03:00
github-actions[bot] 998f88be05 [CI Skip] bump/beta 8.12.3-7-x
skip-checks: true
2022-07-13 09:25:42 +00:00
Jaco 551a081990 Support for Moonbeam author extraction in derive.chain.* (#5065)
* Support for Moonbeam author extraction in derive.chain.*

* use unwrapOr

* Adjust logic
2022-07-13 12:18:07 +03:00
github-actions[bot] 51e6e528ce [CI Skip] bump/beta 8.12.3-6-x
skip-checks: true
2022-07-13 06:54:31 +00:00
Jaco 1f5e939b73 derive.subscribeFinalizedBlocks w/ events & author (#5064)
* derive.subscribeFinalizedBlocks w/ events & author

* Apply createdAtHash (some)

* Pass through events registry

* Throw on use
2022-07-13 09:44:47 +03:00
github-actions[bot] 3813152b46 [CI Skip] bump/beta 8.12.3-5-x
skip-checks: true
2022-07-13 05:12:42 +00:00
Jaco cfec580956 derive.chain.subscribeFinalizedHeads (#5063)
* derive.chain.subscribeFinalizedHeads

* Remove extra map
2022-07-13 08:02:49 +03:00
github-actions[bot] 859ce51eab [CI Skip] bump/beta 8.12.3-4-x
skip-checks: true
2022-07-12 05:41:05 +00:00
Jaco aa5cc1eef1 Use ReturnType<typeof setInterval> for timerIds (#5060)
* Use ReturnType<typeof setInterval> for timerIds

* Remove as number casts for clearInterval
2022-07-12 08:31:50 +03:00
Jaco 2548601c9f Bump rxjs (#5059) 2022-07-12 08:07:41 +03:00
github-actions[bot] 51ceede446 [CI Skip] bump/beta 8.12.3-3-x
skip-checks: true
2022-07-12 05:00:18 +00:00
Nikos Kontakis a16ba9f2ac Bump substrate connect to 0.7.8 (#5058) 2022-07-12 07:48:54 +03:00
github-actions[bot] 9926fcd14f [CI Skip] bump/beta 8.12.3-2-x
skip-checks: true
2022-07-11 12:53:27 +00:00
Jaco fa5ec1b4a8 Adjust assert usage in api-contract (#5057) 2022-07-11 15:43:03 +03:00
github-actions[bot] 29d9c8a279 [CI Skip] bump/beta 8.12.3-1-x
skip-checks: true
2022-07-11 11:00:34 +00:00
Jaco 6a9428943d Adjust some API assertions (#5056) 2022-07-11 13:52:48 +03:00
github-actions[bot] ea9cd6981d [CI Skip] bump/beta 8.12.3-0-x
skip-checks: true
2022-07-11 05:27:13 +00:00
Jaco c7d37c9504 Bump dev (#5053) 2022-07-11 08:19:08 +03:00
github-actions[bot] a41bc2113d [CI Skip] release/stable 8.12.2
skip-checks: true
2022-07-10 09:21:43 +00:00
Jaco e514d9b5a9 8.12.2 (#5052) 2022-07-10 12:14:17 +03:00
github-actions[bot] 3b4310a418 [CI Skip] bump/beta 8.12.2-0-x
skip-checks: true
2022-07-10 06:55:16 +00:00
Jaco 0ec32636a9 Bump common (#5051) 2022-07-10 09:47:21 +03:00
github-actions[bot] f76ac9634a [CI Skip] release/stable 8.12.1
skip-checks: true
2022-07-09 06:39:12 +00:00
Jaco 2ee4fa7f52 8.12.1 (#5050) 2022-07-09 09:31:43 +03:00
github-actions[bot] d627c16d31 [CI Skip] bump/beta 8.11.4-18-x
skip-checks: true
2022-07-09 06:16:19 +00:00
Jaco 2c7a5fb74d Pass StakingQueryFlags through to derive staking.account (#5049)
* Pass StakingQueryFlags through to derive staking.account

* CHANGELOG
2022-07-09 09:08:22 +03:00
github-actions[bot] 3d55f51d87 [CI Skip] bump/beta 8.11.4-17-x
skip-checks: true
2022-07-09 05:31:47 +00:00
Jaco 62e437ba06 Use system.version constant for runtime typegen (#5048)
* Use system.version constant for runtime typegen

* Adjust entries cast

* Adjust
2022-07-09 08:24:23 +03:00
github-actions[bot] 63094fa179 [CI Skip] bump/beta 8.11.4-16-x
skip-checks: true
2022-07-09 04:57:20 +00:00
Jaco 6d1546a88f Bump static metadata (#5047) 2022-07-09 07:49:24 +03:00
github-actions[bot] 65fe44f06f [CI Skip] bump/beta 8.11.4-15-x
skip-checks: true
2022-07-08 21:32:50 +00:00
Jaco 09dd7506ee Bump dev deps (#5046) 2022-07-09 00:22:20 +03:00
github-actions[bot] d228d1260e [CI Skip] bump/beta 8.11.4-14-x
skip-checks: true
2022-07-08 12:27:42 +00:00
Jaco 5a0281452c Adjust test infra (#5044)
* Adjust test infra

* .eslintrc.cjs
2022-07-08 15:19:32 +03:00
github-actions[bot] 332acbb0c2 [CI Skip] bump/beta 8.11.4-13-x
skip-checks: true
2022-07-08 06:39:41 +00:00
Jaco fd5b48058e Bump common (#5043)
* Bump common

* Adjust deprecated util signatures

* Adjust

* Adjust http mock typings
2022-07-08 09:31:49 +03:00
github-actions[bot] 3c5091f2d0 [CI Skip] bump/beta 8.11.4-12-x
skip-checks: true
2022-07-08 04:54:50 +00:00
Jaco fd0ac61254 Bump deps (#5042)
* Bump deps

* Rebump
2022-07-08 07:45:51 +03:00
github-actions[bot] 9b22b2bf72 [CI Skip] bump/beta 8.11.4-11-x
skip-checks: true
2022-07-07 13:32:49 +00:00
Jaco 5f12f98208 Historic XcmV0 BuyExecution fix (#5041) 2022-07-07 16:25:07 +03:00
github-actions[bot] 336baf076a [CI Skip] bump/beta 8.11.4-10-x
skip-checks: true
2022-07-07 11:08:17 +00:00
Jaco 5cb6cf0a00 Alias for WrapperOpaque to Opaque (#5039) 2022-07-07 14:00:38 +03:00
github-actions[bot] 07a837fa8c [CI Skip] bump/beta 8.11.4-9-x
skip-checks: true
2022-07-06 14:22:12 +00:00
Jaco 51924ea20e Opaque{Metadata, Multiaddr, PeerId} -> WrapperOpaque<Bytes> (#5038)
* Opaque{Metadata, Multiaddr, PeerId} -> WrapperOpaque<Bytes>

* Adjust

* Adjust
2022-07-06 17:14:39 +03:00
github-actions[bot] 2721ee93a1 [CI Skip] bump/beta 8.11.4-8-x
skip-checks: true
2022-07-06 13:31:40 +00:00
Jaco 16c0d95928 Adjust issue template (#5037)
* Adjust issue template

* Adjust test with NODE_OPTIONS=--experimental-vm-modules

* Adjust/skip
2022-07-06 16:23:55 +03:00
github-actions[bot] d2458c238e [CI Skip] bump/beta 8.11.4-7-x
skip-checks: true
2022-07-05 21:30:18 +00:00
Jaco 617a03ec05 Additional CI actions (#5036) 2022-07-06 00:22:36 +03:00
github-actions[bot] ed1e3987dc [CI Skip] bump/beta 8.11.4-6-x
skip-checks: true
2022-07-05 13:08:58 +00:00
Jaco 5c6294b71c Improve type argument generation for Option<...> types (#5035) 2022-07-05 16:01:10 +03:00
github-actions[bot] 46b0fe6f78 [CI Skip] bump/beta 8.11.4-5-x
skip-checks: true
2022-07-05 12:53:44 +00:00
Jaco c69ed65bb6 Adjust type generation to correctly cater for ambient definitions (#5034) 2022-07-05 15:44:59 +03:00
github-actions[bot] 23660cf7f7 [CI Skip] bump/beta 8.11.4-4-x
skip-checks: true
2022-07-05 11:16:43 +00:00
Jaco 97abcb4581 Revert header augment imports 2022-07-05 14:08:58 +03:00
github-actions[bot] 2cdc348dcf [CI Skip] bump/beta 8.11.4-3-x
skip-checks: true
2022-07-05 10:53:26 +00:00
Jaco f8bba790d3 Fix import path for untime augmentation (#5033) 2022-07-05 13:43:56 +03:00
github-actions[bot] b22c1377ac [CI Skip] bump/beta 8.11.4-2-x
skip-checks: true
2022-07-05 10:34:28 +00:00
Jaco 9368abaf1c Push build to deno 2022-07-05 13:23:03 +03:00
github-actions[bot] 0be55c038c [CI Skip] bump/beta 8.11.4-1-x
skip-checks: true
2022-07-05 10:20:53 +00:00
Jaco d953e101ff Align augmentation with an import-first approach (#5032) 2022-07-05 13:10:29 +03:00
github-actions[bot] 63182552a3 [CI Skip] bump/beta 8.11.4-0-x
skip-checks: true
2022-07-05 09:21:44 +00:00
Jaco bb4b71033d Remove unneeded export * from augmentation (#5031)
* Remove unneeded export * from augmentation

* Adjust lookup augmentation
2022-07-05 12:13:46 +03:00
202 changed files with 3900 additions and 3331 deletions
-1
View File
@@ -1 +0,0 @@
8.11.3
-60
View File
@@ -1,60 +0,0 @@
40
1.4.2
1.6.2
1.11.2
1.12.2
1.17.2
1.31.2
2.8.2
3.2.2
3.2.3
3.3.2
3.6.2
3.6.3
3.6.4
3.7.2
3.7.3
3.9.2
3.9.3
3.10.2
4.0.2
4.0.3
4.6.2
4.7.2
4.9.2
4.11.2
4.16.2
5.3.2
5.5.2
5.8.2
5.8.3
6.0.2
6.0.3
6.0.4
6.0.5
6.1.2
6.4.2
6.5.2
6.7.2
6.9.2
6.10.2
6.10.3
7.0.2
7.14.2
7.14.3
8.0.2
8.3.2
8.4.2
8.6.2
8.8.2
8.11.2
8.11.3
View File
+49 -13
View File
@@ -1,50 +1,86 @@
<!-- <!--
For general support, howto, coding and bundling questions, please use the Substrate & Polkadot StackExchange at https://substrate.stackexchange.com/ and get other ecosystem developers involved. This issues in this repository are meant for the tracking of feature requests and bug reports. For general support, howto, coding and bundling questions, please
use the Substrate & Polkadot StackExchange at
While all issues are looked at non-bug and non-features would take quite a bit longer to get to and may yield less than satisfactory responses in this format. https://substrate.stackexchange.com/
Additionally, please ensure you have done a search on the existing and closed issues before logging a new request. This saves time on all sides. and get other ecosystem developers involved. This issues in this
repository are meant for the tracking of feature requests and bug
reports.
While all issues are looked at non-bug and non-features would take
quite a bit longer to get to and may yield less than satisfactory
responses in this format.
Additionally, please ensure you have done a search on the existing
and closed issues before logging a new request. This saves time on
all sides.
--> -->
* **I'm submitting a ...** * **I'm submitting a ...**
<!--- Try and classify your actual report --> <!---
REQUIRED:
Classify the type of report your are submitting
-->
- [ ] Bug report - [ ] Bug report
- [ ] Feature request - [ ] Feature request
- [ ] Support request (please bear the comments above in mind) - [ ] Support request
- [ ] Other - [ ] Other
* **What is the current behavior and expected behavior?** * **What is the current behavior and expected behavior?**
<!--- If you're describing a bug, tell us what should happen --> <!---
<!--- If you're suggesting a change/improvement, tell us how it should work -->
REQUIRED:
If you're describing a bug, tell us what should happen. If you're
suggesting a change/improvement, tell us how it should work.
-->
* **What is the motivation for changing the behavior?** * **What is the motivation for changing the behavior?**
<!--- Not obligatory, but suggest a motivation for the request --> <!---
<!--- or ideas how to implement the addition or change -->
OPTIONAL:
Suggest a motivation for the request or ideas how to implement the
addition or change
-->
* **Please tell us about your environment:** * **Please tell us about your environment:**
<!--- Include as many relevant details about the environment you experienced the issue in --> <!---
<!--- Also snsure that you have tested against the latest stable releases if a bug -->
REQUIRED:
Include as many relevant details about the environment in which you
experienced the issue. Also ensure that you have tested against the
latest stable releases if you believe this to be a bug
-->
- Version: - Version:
- Environment: - Environment:
- [ ] Node.js - [ ] Node.js
- [ ] Browser - [ ] Browser
- [ ] Other (limited support for other environments available) - [ ] Other (limited support for other environments)
- Language: - Language:
- [ ] JavaScript - [ ] JavaScript
- [ ] TypeScript - [ ] TypeScript (include tsc --version)
- [ ] Other - [ ] Other
+5 -1
View File
@@ -5,14 +5,18 @@ jobs:
pr: pr:
strategy: strategy:
matrix: matrix:
step: ['lint', 'test', 'build'] step: ['lint', 'test', 'build', 'deno']
name: ${{ matrix.step }} name: ${{ matrix.step }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
YARN_ENABLE_SCRIPTS: false YARN_ENABLE_SCRIPTS: false
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: denoland/setup-deno@v1
with:
deno-version: vx.x.x
- name: ${{ matrix.step }} - name: ${{ matrix.step }}
if: always()
run: | run: |
yarn install --immutable | grep -v 'YN0013' yarn install --immutable | grep -v 'YN0013'
yarn ${{ matrix.step }} yarn ${{ matrix.step }}
+3 -6
View File
@@ -1,14 +1,11 @@
_book/ _book/
build/ build/
build-cjs/ build-*/
build-esm/
build-deno/
build-docs/
coverage/ coverage/
docs/.vuepress/dist/
docs/substrate/*.md
node_modules/ node_modules/
tmp/ tmp/
/import_map.json
/mod.ts
NOTES.md NOTES.md
.DS_Store .DS_Store
.env.local .env.local
+37
View File
@@ -1,5 +1,42 @@
# CHANGELOG # CHANGELOG
## 8.13.1 Jul 16, 2022
Changes:
- Add `derive.chain.subscribeFinalized{Heads, Blocks}` which returns all finalized, no skips
- Support Moonbeam author extraction on `derive.chain.*` (w/ shared logic dedupe)
- Cater for older `BlockBuilder 2/3/4` & `GrandpaApi 2` runtime interface definitions
- Support for `NominationPoolsApi` runtime interface
- Support for `DebugRuntimeApi` runtime interface, Frontier-specific
- Support for `NimbusApi` runtime interface (& older `AuthorFilterAPI`)
- Add additional historic `DispatchError` enum variant for asset chains
- Add Kusama 9250 upgrade block
- Update to latest Substrate, Polkadot & Kusama metadata
## 8.12.2 Jul 10, 2022
Changes:
- Update to `@polkadot/util` 10.0.2
## 8.12.1 Jul 9, 2022
Changes:
- Adjust `Opaque{Metadata, Multiaddr, PeerId}` decoding to `Opaque<Bytes>`
- Fix historic `XcmV0` definitions for `BuyExecution`
- Adjust type generation to correctly cater for ambient definitions
- Improve type argument generation for `Option<...>` types
- Adjust usage of deprecated `@polkadot/util` methods
- Runtime call typegen from `system.version` constant value
- Expose query flags on `derive.staking.account`
- Update to latest Substrate, Polkadot & Kusama metadata
- Update to `@polkadot/util` 10.0.1
## 8.11.3 Jul 5, 2022 ## 8.11.3 Jul 5, 2022
Changes: Changes:
+2 -2
View File
@@ -1,4 +1,4 @@
3094 Jaco 8.11.3 (#5029) 3136 Jaco 8.13.1 (#5078)
83 Amaury Martiny StatementKind: Regular and Saft (#2303) 83 Amaury Martiny StatementKind: Regular and Saft (#2303)
37 Keith Ingram Update contract types and rpc (#4541) 37 Keith Ingram Update contract types and rpc (#4541)
35 Stefanie Doll Updated child storage parameters (#1709) 35 Stefanie Doll Updated child storage parameters (#1709)
@@ -7,9 +7,9 @@
15 Jeremías Díaz feat(types): add correct tuple type to storage key (#3054) 15 Jeremías Díaz feat(types): add correct tuple type to storage key (#3054)
11 Ian He HttpProvider support clone() (#3949) 11 Ian He HttpProvider support clone() (#3949)
10 Axel Chalon Make Enum/Tuple constructor use value directly if instance (#1954) 10 Axel Chalon Make Enum/Tuple constructor use value directly if instance (#1954)
6 Nikos Kontakis Bump substrate connect to 0.7.8 (#5058)
5 Chevdor Fix metadata package link (#3458) 5 Chevdor Fix metadata package link (#3458)
5 Jake Naviasky Fixing approvalFlagsToBools. (#1250) 5 Jake Naviasky Fixing approvalFlagsToBools. (#1250)
5 Nikos Kontakis Bump substrate connect to 0.7.7 (#4962)
4 Alex D Use derive customAccount and customLocks for balance overrides (#3248) 4 Alex D Use derive customAccount and customLocks for balance overrides (#3248)
4 Alex Wang fix issue that creates duplicate providers (#983) 4 Alex Wang fix issue that creates duplicate providers (#983)
4 Alexander Popiak Add asset id in signing (#4009) 4 Alexander Popiak Add asset id in signing (#4009)
+11 -8
View File
@@ -10,8 +10,12 @@
"url": "https://github.com/polkadot-js/api.git" "url": "https://github.com/polkadot-js/api.git"
}, },
"sideEffects": false, "sideEffects": false,
"type": "commonjs", "type": "module",
"version": "8.11.3", "version": "8.13.1",
"versions": {
"git": "8.13.1",
"npm": "8.13.1"
},
"workspaces": [ "workspaces": [
"packages/*" "packages/*"
], ],
@@ -23,20 +27,19 @@
"build:rollup": "polkadot-exec-rollup --config", "build:rollup": "polkadot-exec-rollup --config",
"chain:info": "polkadot-types-chain-info", "chain:info": "polkadot-types-chain-info",
"clean": "polkadot-dev-clean-build", "clean": "polkadot-dev-clean-build",
"docs:metadata": "polkadot-types-internal-metadata", "deno": "yarn polkadot-dev-deno-map && yarn build && deno check --import-map=import_map.json mod.ts",
"lint": "polkadot-dev-run-lint", "lint": "polkadot-dev-run-lint",
"postinstall": "polkadot-dev-yarn-only", "postinstall": "polkadot-dev-yarn-only",
"test": "polkadot-dev-run-test --coverage --forceExit --runInBand --testPathIgnorePatterns e2e", "test": "NODE_OPTIONS=--experimental-vm-modules polkadot-dev-run-test --coverage --forceExit --runInBand --testPathIgnorePatterns e2e",
"test:one": "polkadot-dev-run-test --detectOpenHandles --forceExit", "test:one": "NODE_OPTIONS=--experimental-vm-modules polkadot-dev-run-test --detectOpenHandles --forceExit"
"test:watch": "polkadot-dev-run-test --watch"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.18.6", "@babel/core": "^7.18.6",
"@babel/register": "^7.18.6", "@babel/register": "^7.18.6",
"@babel/runtime": "^7.18.6", "@babel/runtime": "^7.18.6",
"@polkadot/dev": "^0.67.53", "@polkadot/dev": "^0.67.79",
"@polkadot/typegen": "workspace:packages/typegen", "@polkadot/typegen": "workspace:packages/typegen",
"@types/jest": "^28.1.4", "@types/jest": "^28.1.6",
"copyfiles": "^2.4.1" "copyfiles": "^2.4.1"
}, },
"resolutions": { "resolutions": {
+8 -8
View File
@@ -20,18 +20,18 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "8.11.3", "version": "8.13.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.18.6", "@babel/runtime": "^7.18.6",
"@polkadot/api-base": "8.11.3", "@polkadot/api-base": "8.13.1",
"@polkadot/rpc-augment": "8.11.3", "@polkadot/rpc-augment": "8.13.1",
"@polkadot/types": "8.11.3", "@polkadot/types": "8.13.1",
"@polkadot/types-augment": "8.11.3", "@polkadot/types-augment": "8.13.1",
"@polkadot/types-codec": "8.11.3", "@polkadot/types-codec": "8.13.1",
"@polkadot/util": "^9.7.2" "@polkadot/util": "^10.0.2"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/types-support": "8.11.3" "@polkadot/types-support": "8.13.1"
} }
} }
+14 -3
View File
@@ -1,6 +1,10 @@
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit // Auto-generated via `yarn polkadot-types-from-chain`, do not edit
/* eslint-disable */ /* eslint-disable */
// import type lookup before we augment - in some environments
// this is required to allow for ambient/previous definitions
import '@polkadot/api-base/types/consts';
import type { ApiTypes, AugmentedConst } from '@polkadot/api-base/types'; import type { ApiTypes, AugmentedConst } from '@polkadot/api-base/types';
import type { Bytes, Option, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec'; import type { Bytes, Option, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
import type { Codec } from '@polkadot/types-codec/types'; import type { Codec } from '@polkadot/types-codec/types';
@@ -10,7 +14,7 @@ import type { FrameSupportPalletId, FrameSupportWeightsRuntimeDbWeight, FrameSys
export type __AugmentedConst<ApiType extends ApiTypes> = AugmentedConst<ApiType>; export type __AugmentedConst<ApiType extends ApiTypes> = AugmentedConst<ApiType>;
declare module '@polkadot/api-base/types/consts' { declare module '@polkadot/api-base/types/consts' {
export interface AugmentedConsts<ApiType extends ApiTypes> { interface AugmentedConsts<ApiType extends ApiTypes> {
auctions: { auctions: {
/** /**
* The number of blocks over which an auction may be retroactively ended. * The number of blocks over which an auction may be retroactively ended.
@@ -459,13 +463,20 @@ declare module '@polkadot/api-base/types/consts' {
}; };
nominationPools: { nominationPools: {
/** /**
* The minimum pool points-to-balance ratio that must be maintained for it to be `open`. * The maximum pool points-to-balance ratio that an `open` pool can have.
*
* This is important in the event slashing takes place and the pool's points-to-balance * This is important in the event slashing takes place and the pool's points-to-balance
* ratio becomes disproportional. * ratio becomes disproportional.
*
* Moreover, this relates to the `RewardCounter` type as well, as the arithmetic operations
* are a function of number of points, and by setting this value to e.g. 10, you ensure
* that the total number of points in the system are at most 10 times the total_issuance of
* the chain, in the absolute worse case.
*
* For a value of 10, the threshold would be a pool points-to-balance ratio of 10:1. * For a value of 10, the threshold would be a pool points-to-balance ratio of 10:1.
* Such a scenario would also be the equivalent of the pool being 90% slashed. * Such a scenario would also be the equivalent of the pool being 90% slashed.
**/ **/
minPointsToBalance: u32 & AugmentedConst<ApiType>; maxPointsToBalance: u8 & AugmentedConst<ApiType>;
/** /**
* The nomination pool's pallet id. * The nomination pool's pallet id.
**/ **/
+9 -5
View File
@@ -1,12 +1,16 @@
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit // Auto-generated via `yarn polkadot-types-from-chain`, do not edit
/* eslint-disable */ /* eslint-disable */
// import type lookup before we augment - in some environments
// this is required to allow for ambient/previous definitions
import '@polkadot/api-base/types/errors';
import type { ApiTypes, AugmentedError } from '@polkadot/api-base/types'; import type { ApiTypes, AugmentedError } from '@polkadot/api-base/types';
export type __AugmentedError<ApiType extends ApiTypes> = AugmentedError<ApiType>; export type __AugmentedError<ApiType extends ApiTypes> = AugmentedError<ApiType>;
declare module '@polkadot/api-base/types/errors' { declare module '@polkadot/api-base/types/errors' {
export interface AugmentedErrors<ApiType extends ApiTypes> { interface AugmentedErrors<ApiType extends ApiTypes> {
auctions: { auctions: {
/** /**
* The para is already leased out for part of this range. * The para is already leased out for part of this range.
@@ -1292,14 +1296,14 @@ declare module '@polkadot/api-base/types/errors' {
* Must vote for at least one candidate. * Must vote for at least one candidate.
**/ **/
NoVotes: AugmentedError<ApiType>; NoVotes: AugmentedError<ApiType>;
/**
* Cannot report self.
**/
ReportSelf: AugmentedError<ApiType>;
/** /**
* Runner cannot re-submit candidacy. * Runner cannot re-submit candidacy.
**/ **/
RunnerUpSubmit: AugmentedError<ApiType>; RunnerUpSubmit: AugmentedError<ApiType>;
/**
* Too many candidates have been created.
**/
TooManyCandidates: AugmentedError<ApiType>;
/** /**
* Cannot vote more than candidates. * Cannot vote more than candidates.
**/ **/
+5 -1
View File
@@ -1,6 +1,10 @@
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit // Auto-generated via `yarn polkadot-types-from-chain`, do not edit
/* eslint-disable */ /* eslint-disable */
// import type lookup before we augment - in some environments
// this is required to allow for ambient/previous definitions
import '@polkadot/api-base/types/events';
import type { ApiTypes, AugmentedEvent } from '@polkadot/api-base/types'; import type { ApiTypes, AugmentedEvent } from '@polkadot/api-base/types';
import type { Bytes, Null, Option, Result, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec'; import type { Bytes, Null, Option, Result, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
import type { ITuple } from '@polkadot/types-codec/types'; import type { ITuple } from '@polkadot/types-codec/types';
@@ -11,7 +15,7 @@ import type { FrameSupportScheduleLookupError, FrameSupportTokensMiscBalanceStat
export type __AugmentedEvent<ApiType extends ApiTypes> = AugmentedEvent<ApiType>; export type __AugmentedEvent<ApiType extends ApiTypes> = AugmentedEvent<ApiType>;
declare module '@polkadot/api-base/types/events' { declare module '@polkadot/api-base/types/events' {
export interface AugmentedEvents<ApiType extends ApiTypes> { interface AugmentedEvents<ApiType extends ApiTypes> {
auctions: { auctions: {
/** /**
* An auction ended. All funds become unreserved. * An auction ended. All funds become unreserved.
+5 -1
View File
@@ -1,6 +1,10 @@
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit // Auto-generated via `yarn polkadot-types-from-chain`, do not edit
/* eslint-disable */ /* eslint-disable */
// import type lookup before we augment - in some environments
// this is required to allow for ambient/previous definitions
import '@polkadot/api-base/types/storage';
import type { ApiTypes, AugmentedQuery, QueryableStorageEntry } from '@polkadot/api-base/types'; import type { ApiTypes, AugmentedQuery, QueryableStorageEntry } from '@polkadot/api-base/types';
import type { Data } from '@polkadot/types'; import type { Data } from '@polkadot/types';
import type { BTreeMap, Bytes, Null, Option, U8aFixed, Vec, WrapperKeepOpaque, WrapperOpaque, bool, u128, u32, u64 } from '@polkadot/types-codec'; import type { BTreeMap, Bytes, Null, Option, U8aFixed, Vec, WrapperKeepOpaque, WrapperOpaque, bool, u128, u32, u64 } from '@polkadot/types-codec';
@@ -14,7 +18,7 @@ export type __AugmentedQuery<ApiType extends ApiTypes> = AugmentedQuery<ApiType,
export type __QueryableStorageEntry<ApiType extends ApiTypes> = QueryableStorageEntry<ApiType>; export type __QueryableStorageEntry<ApiType extends ApiTypes> = QueryableStorageEntry<ApiType>;
declare module '@polkadot/api-base/types/storage' { declare module '@polkadot/api-base/types/storage' {
export interface AugmentedQueries<ApiType extends ApiTypes> { interface AugmentedQueries<ApiType extends ApiTypes> {
auctions: { auctions: {
/** /**
* Number of auctions started so far. * Number of auctions started so far.
+6 -2
View File
@@ -1,6 +1,10 @@
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit // Auto-generated via `yarn polkadot-types-from-chain`, do not edit
/* eslint-disable */ /* eslint-disable */
// import type lookup before we augment - in some environments
// this is required to allow for ambient/previous definitions
import '@polkadot/api-base/types/calls';
import type { ApiTypes, AugmentedCall, DecoratedCallBase } from '@polkadot/api-base/types'; import type { ApiTypes, AugmentedCall, DecoratedCallBase } from '@polkadot/api-base/types';
import type { Bytes, Null, Option, Result, Vec, bool, u32 } from '@polkadot/types-codec'; import type { Bytes, Null, Option, Result, Vec, bool, u32 } from '@polkadot/types-codec';
import type { AnyNumber, ITuple } from '@polkadot/types-codec/types'; import type { AnyNumber, ITuple } from '@polkadot/types-codec/types';
@@ -26,7 +30,7 @@ export type __AugmentedCall<ApiType extends ApiTypes> = AugmentedCall<ApiType>;
export type __DecoratedCallBase<ApiType extends ApiTypes> = DecoratedCallBase<ApiType>; export type __DecoratedCallBase<ApiType extends ApiTypes> = DecoratedCallBase<ApiType>;
declare module '@polkadot/api-base/types/calls' { declare module '@polkadot/api-base/types/calls' {
export interface AugmentedCalls<ApiType extends ApiTypes> { interface AugmentedCalls<ApiType extends ApiTypes> {
/** 0xbc9d89904f5b923f/1 */ /** 0xbc9d89904f5b923f/1 */
accountNonceApi: { accountNonceApi: {
/** /**
@@ -301,7 +305,7 @@ declare module '@polkadot/api-base/types/calls' {
/** /**
* Generate a set of session keys with optionally using the given seed. * Generate a set of session keys with optionally using the given seed.
**/ **/
generateSessionKeys: AugmentedCall<ApiType, (seed: Option<Bytes> | null | object | string | Uint8Array) => Observable<Bytes>>; generateSessionKeys: AugmentedCall<ApiType, (seed: Option<Bytes> | null | Uint8Array | Bytes | string) => Observable<Bytes>>;
/** /**
* Generic call * Generic call
**/ **/
+43 -27
View File
@@ -1,6 +1,10 @@
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit // Auto-generated via `yarn polkadot-types-from-chain`, do not edit
/* eslint-disable */ /* eslint-disable */
// import type lookup before we augment - in some environments
// this is required to allow for ambient/previous definitions
import '@polkadot/api-base/types/submittable';
import type { ApiTypes, AugmentedSubmittable, SubmittableExtrinsic, SubmittableExtrinsicFunction } from '@polkadot/api-base/types'; import type { ApiTypes, AugmentedSubmittable, SubmittableExtrinsic, SubmittableExtrinsicFunction } from '@polkadot/api-base/types';
import type { Data } from '@polkadot/types'; import type { Data } from '@polkadot/types';
import type { Bytes, Compact, Option, U8aFixed, Vec, WrapperKeepOpaque, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec'; import type { Bytes, Compact, Option, U8aFixed, Vec, WrapperKeepOpaque, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
@@ -14,7 +18,7 @@ export type __SubmittableExtrinsic<ApiType extends ApiTypes> = SubmittableExtrin
export type __SubmittableExtrinsicFunction<ApiType extends ApiTypes> = SubmittableExtrinsicFunction<ApiType>; export type __SubmittableExtrinsicFunction<ApiType extends ApiTypes> = SubmittableExtrinsicFunction<ApiType>;
declare module '@polkadot/api-base/types/submittable' { declare module '@polkadot/api-base/types/submittable' {
export interface AugmentedSubmittables<ApiType extends ApiTypes> { interface AugmentedSubmittables<ApiType extends ApiTypes> {
auctions: { auctions: {
/** /**
* Make a new bid from an account (including a parachain account) for deploying a new * Make a new bid from an account (including a parachain account) for deploying a new
@@ -573,8 +577,8 @@ declare module '@polkadot/api-base/types/submittable' {
* Total Complexity: O(1) * Total Complexity: O(1)
* </weight> * </weight>
**/ **/
mintClaim: AugmentedSubmittable<(who: EthereumAddress | string | Uint8Array, value: u128 | AnyNumber | Uint8Array, vestingSchedule: Option<ITuple<[u128, u128, u32]>> | null | object | string | Uint8Array, statement: Option<PolkadotRuntimeCommonClaimsStatementKind> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [EthereumAddress, u128, Option<ITuple<[u128, u128, u32]>>, Option<PolkadotRuntimeCommonClaimsStatementKind>]>; mintClaim: AugmentedSubmittable<(who: EthereumAddress | string | Uint8Array, value: u128 | AnyNumber | Uint8Array, vestingSchedule: Option<ITuple<[u128, u128, u32]>> | null | Uint8Array | ITuple<[u128, u128, u32]> | [u128 | AnyNumber | Uint8Array, u128 | AnyNumber | Uint8Array, u32 | AnyNumber | Uint8Array], statement: Option<PolkadotRuntimeCommonClaimsStatementKind> | null | Uint8Array | PolkadotRuntimeCommonClaimsStatementKind | 'Regular' | 'Saft' | number) => SubmittableExtrinsic<ApiType>, [EthereumAddress, u128, Option<ITuple<[u128, u128, u32]>>, Option<PolkadotRuntimeCommonClaimsStatementKind>]>;
moveClaim: AugmentedSubmittable<(old: EthereumAddress | string | Uint8Array, updated: EthereumAddress | string | Uint8Array, maybePreclaim: Option<AccountId32> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [EthereumAddress, EthereumAddress, Option<AccountId32>]>; moveClaim: AugmentedSubmittable<(old: EthereumAddress | string | Uint8Array, updated: EthereumAddress | string | Uint8Array, maybePreclaim: Option<AccountId32> | null | Uint8Array | AccountId32 | string) => SubmittableExtrinsic<ApiType>, [EthereumAddress, EthereumAddress, Option<AccountId32>]>;
/** /**
* Generic tx * Generic tx
**/ **/
@@ -694,11 +698,11 @@ declare module '@polkadot/api-base/types/submittable' {
/** /**
* Set the maximum number of validators to use in parachain consensus. * Set the maximum number of validators to use in parachain consensus.
**/ **/
setMaxValidators: AugmentedSubmittable<(updated: Option<u32> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Option<u32>]>; setMaxValidators: AugmentedSubmittable<(updated: Option<u32> | null | Uint8Array | u32 | AnyNumber) => SubmittableExtrinsic<ApiType>, [Option<u32>]>;
/** /**
* Set the maximum number of validators to assign to any core. * Set the maximum number of validators to assign to any core.
**/ **/
setMaxValidatorsPerCore: AugmentedSubmittable<(updated: Option<u32> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Option<u32>]>; setMaxValidatorsPerCore: AugmentedSubmittable<(updated: Option<u32> | null | Uint8Array | u32 | AnyNumber) => SubmittableExtrinsic<ApiType>, [Option<u32>]>;
/** /**
* Sets the minimum delay between announcing the upgrade block for a parachain until the * Sets the minimum delay between announcing the upgrade block for a parachain until the
* upgrade taking place. * upgrade taking place.
@@ -903,7 +907,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - 1 storage write (codec `O(1)`) for deleting the old `prime` and setting the new one * - 1 storage write (codec `O(1)`) for deleting the old `prime` and setting the new one
* # </weight> * # </weight>
**/ **/
setMembers: AugmentedSubmittable<(newMembers: Vec<AccountId32> | (AccountId32 | string | Uint8Array)[], prime: Option<AccountId32> | null | object | string | Uint8Array, oldCount: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Vec<AccountId32>, Option<AccountId32>, u32]>; setMembers: AugmentedSubmittable<(newMembers: Vec<AccountId32> | (AccountId32 | string | Uint8Array)[], prime: Option<AccountId32> | null | Uint8Array | AccountId32 | string, oldCount: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Vec<AccountId32>, Option<AccountId32>, u32]>;
/** /**
* Add an aye or nay vote for the sender to the given proposal. * Add an aye or nay vote for the sender to the given proposal.
* *
@@ -938,19 +942,19 @@ declare module '@polkadot/api-base/types/submittable' {
* Contribute to a crowd sale. This will transfer some balance over to fund a parachain * Contribute to a crowd sale. This will transfer some balance over to fund a parachain
* slot. It will be withdrawable when the crowdloan has ended and the funds are unused. * slot. It will be withdrawable when the crowdloan has ended and the funds are unused.
**/ **/
contribute: AugmentedSubmittable<(index: Compact<u32> | AnyNumber | Uint8Array, value: Compact<u128> | AnyNumber | Uint8Array, signature: Option<SpRuntimeMultiSignature> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, Compact<u128>, Option<SpRuntimeMultiSignature>]>; contribute: AugmentedSubmittable<(index: Compact<u32> | AnyNumber | Uint8Array, value: Compact<u128> | AnyNumber | Uint8Array, signature: Option<SpRuntimeMultiSignature> | null | Uint8Array | SpRuntimeMultiSignature | { Ed25519: any } | { Sr25519: any } | { Ecdsa: any } | string) => SubmittableExtrinsic<ApiType>, [Compact<u32>, Compact<u128>, Option<SpRuntimeMultiSignature>]>;
/** /**
* Contribute your entire balance to a crowd sale. This will transfer the entire balance of a user over to fund a parachain * Contribute your entire balance to a crowd sale. This will transfer the entire balance of a user over to fund a parachain
* slot. It will be withdrawable when the crowdloan has ended and the funds are unused. * slot. It will be withdrawable when the crowdloan has ended and the funds are unused.
**/ **/
contributeAll: AugmentedSubmittable<(index: Compact<u32> | AnyNumber | Uint8Array, signature: Option<SpRuntimeMultiSignature> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, Option<SpRuntimeMultiSignature>]>; contributeAll: AugmentedSubmittable<(index: Compact<u32> | AnyNumber | Uint8Array, signature: Option<SpRuntimeMultiSignature> | null | Uint8Array | SpRuntimeMultiSignature | { Ed25519: any } | { Sr25519: any } | { Ecdsa: any } | string) => SubmittableExtrinsic<ApiType>, [Compact<u32>, Option<SpRuntimeMultiSignature>]>;
/** /**
* Create a new crowdloaning campaign for a parachain slot with the given lease period range. * Create a new crowdloaning campaign for a parachain slot with the given lease period range.
* *
* This applies a lock to your parachain configuration, ensuring that it cannot be changed * This applies a lock to your parachain configuration, ensuring that it cannot be changed
* by the parachain manager. * by the parachain manager.
**/ **/
create: AugmentedSubmittable<(index: Compact<u32> | AnyNumber | Uint8Array, cap: Compact<u128> | AnyNumber | Uint8Array, firstPeriod: Compact<u32> | AnyNumber | Uint8Array, lastPeriod: Compact<u32> | AnyNumber | Uint8Array, end: Compact<u32> | AnyNumber | Uint8Array, verifier: Option<SpRuntimeMultiSigner> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, Compact<u128>, Compact<u32>, Compact<u32>, Compact<u32>, Option<SpRuntimeMultiSigner>]>; create: AugmentedSubmittable<(index: Compact<u32> | AnyNumber | Uint8Array, cap: Compact<u128> | AnyNumber | Uint8Array, firstPeriod: Compact<u32> | AnyNumber | Uint8Array, lastPeriod: Compact<u32> | AnyNumber | Uint8Array, end: Compact<u32> | AnyNumber | Uint8Array, verifier: Option<SpRuntimeMultiSigner> | null | Uint8Array | SpRuntimeMultiSigner | { Ed25519: any } | { Sr25519: any } | { Ecdsa: any } | string) => SubmittableExtrinsic<ApiType>, [Compact<u32>, Compact<u128>, Compact<u32>, Compact<u32>, Compact<u32>, Option<SpRuntimeMultiSigner>]>;
/** /**
* Remove a fund after the retirement period has ended and all funds have been returned. * Remove a fund after the retirement period has ended and all funds have been returned.
**/ **/
@@ -960,7 +964,7 @@ declare module '@polkadot/api-base/types/submittable' {
* *
* Can only be called by Root origin. * Can only be called by Root origin.
**/ **/
edit: AugmentedSubmittable<(index: Compact<u32> | AnyNumber | Uint8Array, cap: Compact<u128> | AnyNumber | Uint8Array, firstPeriod: Compact<u32> | AnyNumber | Uint8Array, lastPeriod: Compact<u32> | AnyNumber | Uint8Array, end: Compact<u32> | AnyNumber | Uint8Array, verifier: Option<SpRuntimeMultiSigner> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, Compact<u128>, Compact<u32>, Compact<u32>, Compact<u32>, Option<SpRuntimeMultiSigner>]>; edit: AugmentedSubmittable<(index: Compact<u32> | AnyNumber | Uint8Array, cap: Compact<u128> | AnyNumber | Uint8Array, firstPeriod: Compact<u32> | AnyNumber | Uint8Array, lastPeriod: Compact<u32> | AnyNumber | Uint8Array, end: Compact<u32> | AnyNumber | Uint8Array, verifier: Option<SpRuntimeMultiSigner> | null | Uint8Array | SpRuntimeMultiSigner | { Ed25519: any } | { Sr25519: any } | { Ecdsa: any } | string) => SubmittableExtrinsic<ApiType>, [Compact<u32>, Compact<u128>, Compact<u32>, Compact<u32>, Compact<u32>, Option<SpRuntimeMultiSigner>]>;
/** /**
* Poke the fund into `NewRaise` * Poke the fund into `NewRaise`
* *
@@ -1018,7 +1022,7 @@ declare module '@polkadot/api-base/types/submittable' {
* Weight: `O(p)` (though as this is an high-privilege dispatch, we assume it has a * Weight: `O(p)` (though as this is an high-privilege dispatch, we assume it has a
* reasonable value). * reasonable value).
**/ **/
blacklist: AugmentedSubmittable<(proposalHash: H256 | string | Uint8Array, maybeRefIndex: Option<u32> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [H256, Option<u32>]>; blacklist: AugmentedSubmittable<(proposalHash: H256 | string | Uint8Array, maybeRefIndex: Option<u32> | null | Uint8Array | u32 | AnyNumber) => SubmittableExtrinsic<ApiType>, [H256, Option<u32>]>;
/** /**
* Remove a proposal. * Remove a proposal.
* *
@@ -1350,7 +1354,7 @@ declare module '@polkadot/api-base/types/submittable' {
* This can only be called when [`Phase::Emergency`] is enabled, as an alternative to * This can only be called when [`Phase::Emergency`] is enabled, as an alternative to
* calling [`Call::set_emergency_election_result`]. * calling [`Call::set_emergency_election_result`].
**/ **/
governanceFallback: AugmentedSubmittable<(maybeMaxVoters: Option<u32> | null | object | string | Uint8Array, maybeMaxTargets: Option<u32> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Option<u32>, Option<u32>]>; governanceFallback: AugmentedSubmittable<(maybeMaxVoters: Option<u32> | null | Uint8Array | u32 | AnyNumber, maybeMaxTargets: Option<u32> | null | Uint8Array | u32 | AnyNumber) => SubmittableExtrinsic<ApiType>, [Option<u32>, Option<u32>]>;
/** /**
* Set a solution in the queue, to be handed out to the client of this pallet in the next * Set a solution in the queue, to be handed out to the client of this pallet in the next
* call to `ElectionProvider::elect`. * call to `ElectionProvider::elect`.
@@ -1369,7 +1373,7 @@ declare module '@polkadot/api-base/types/submittable' {
* *
* This check can be turned off by setting the value to `None`. * This check can be turned off by setting the value to `None`.
**/ **/
setMinimumUntrustedScore: AugmentedSubmittable<(maybeNextScore: Option<SpNposElectionsElectionScore> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Option<SpNposElectionsElectionScore>]>; setMinimumUntrustedScore: AugmentedSubmittable<(maybeNextScore: Option<SpNposElectionsElectionScore> | null | Uint8Array | SpNposElectionsElectionScore | { minimalStake?: any; sumStake?: any; sumStakeSquared?: any } | string) => SubmittableExtrinsic<ApiType>, [Option<SpNposElectionsElectionScore>]>;
/** /**
* Submit a solution for the signed phase. * Submit a solution for the signed phase.
* *
@@ -2017,7 +2021,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - Write: Multisig Storage, [Caller Account] * - Write: Multisig Storage, [Caller Account]
* # </weight> * # </weight>
**/ **/
approveAsMulti: AugmentedSubmittable<(threshold: u16 | AnyNumber | Uint8Array, otherSignatories: Vec<AccountId32> | (AccountId32 | string | Uint8Array)[], maybeTimepoint: Option<PalletMultisigTimepoint> | null | object | string | Uint8Array, callHash: U8aFixed | string | Uint8Array, maxWeight: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u16, Vec<AccountId32>, Option<PalletMultisigTimepoint>, U8aFixed, u64]>; approveAsMulti: AugmentedSubmittable<(threshold: u16 | AnyNumber | Uint8Array, otherSignatories: Vec<AccountId32> | (AccountId32 | string | Uint8Array)[], maybeTimepoint: Option<PalletMultisigTimepoint> | null | Uint8Array | PalletMultisigTimepoint | { height?: any; index?: any } | string, callHash: U8aFixed | string | Uint8Array, maxWeight: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u16, Vec<AccountId32>, Option<PalletMultisigTimepoint>, U8aFixed, u64]>;
/** /**
* Register approval for a dispatch to be made from a deterministic composite account if * Register approval for a dispatch to be made from a deterministic composite account if
* approved by a total of `threshold - 1` of `other_signatories`. * approved by a total of `threshold - 1` of `other_signatories`.
@@ -2065,7 +2069,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - Plus Call Weight * - Plus Call Weight
* # </weight> * # </weight>
**/ **/
asMulti: AugmentedSubmittable<(threshold: u16 | AnyNumber | Uint8Array, otherSignatories: Vec<AccountId32> | (AccountId32 | string | Uint8Array)[], maybeTimepoint: Option<PalletMultisigTimepoint> | null | object | string | Uint8Array, call: WrapperKeepOpaque<Call> | object | string | Uint8Array, storeCall: bool | boolean | Uint8Array, maxWeight: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u16, Vec<AccountId32>, Option<PalletMultisigTimepoint>, WrapperKeepOpaque<Call>, bool, u64]>; asMulti: AugmentedSubmittable<(threshold: u16 | AnyNumber | Uint8Array, otherSignatories: Vec<AccountId32> | (AccountId32 | string | Uint8Array)[], maybeTimepoint: Option<PalletMultisigTimepoint> | null | Uint8Array | PalletMultisigTimepoint | { height?: any; index?: any } | string, call: WrapperKeepOpaque<Call> | object | string | Uint8Array, storeCall: bool | boolean | Uint8Array, maxWeight: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u16, Vec<AccountId32>, Option<PalletMultisigTimepoint>, WrapperKeepOpaque<Call>, bool, u64]>;
/** /**
* Immediately dispatch a multi-signature call using a single approval from the caller. * Immediately dispatch a multi-signature call using a single approval from the caller.
* *
@@ -2125,6 +2129,8 @@ declare module '@polkadot/api-base/types/submittable' {
* *
* Additional funds can come from either the free balance of the account, of from the * Additional funds can come from either the free balance of the account, of from the
* accumulated rewards, see [`BondExtra`]. * accumulated rewards, see [`BondExtra`].
*
* Bonding extra funds implies an automatic payout of all pending rewards as well.
**/ **/
bondExtra: AugmentedSubmittable<(extra: PalletNominationPoolsBondExtra | { FreeBalance: any } | { Rewards: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [PalletNominationPoolsBondExtra]>; bondExtra: AugmentedSubmittable<(extra: PalletNominationPoolsBondExtra | { FreeBalance: any } | { Rewards: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [PalletNominationPoolsBondExtra]>;
/** /**
@@ -2221,8 +2227,14 @@ declare module '@polkadot/api-base/types/submittable' {
/** /**
* Set a new state for the pool. * Set a new state for the pool.
* *
* The dispatch origin of this call must be signed by the state toggler, or the root role * If a pool is already in the `Destroying` state, then under no condition can its state
* of the pool. * change again.
*
* The dispatch origin of this call must be either:
*
* 1. signed by the state toggler, or the root role of the pool,
* 2. if the pool conditions to be open are NOT met (as described by `ok_to_be_open`), and
* then the state of the pool can be permissionlessly changed to `Destroying`.
**/ **/
setState: AugmentedSubmittable<(poolId: u32 | AnyNumber | Uint8Array, state: PalletNominationPoolsPoolState | 'Open' | 'Blocked' | 'Destroying' | number | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletNominationPoolsPoolState]>; setState: AugmentedSubmittable<(poolId: u32 | AnyNumber | Uint8Array, state: PalletNominationPoolsPoolState | 'Open' | 'Blocked' | 'Destroying' | number | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletNominationPoolsPoolState]>;
/** /**
@@ -2398,7 +2410,11 @@ declare module '@polkadot/api-base/types/submittable' {
* the outgoing member is slashed. * the outgoing member is slashed.
* *
* If a runner-up is available, then the best runner-up will be removed and replaces the * If a runner-up is available, then the best runner-up will be removed and replaces the
* outgoing member. Otherwise, a new phragmen election is started. * outgoing member. Otherwise, if `rerun_election` is `true`, a new phragmen election is
* started, else, nothing happens.
*
* If `slash_bond` is set to true, the bond of the member being removed is slashed. Else,
* it is returned.
* *
* The dispatch origin of this call must be root. * The dispatch origin of this call must be root.
* *
@@ -2409,7 +2425,7 @@ declare module '@polkadot/api-base/types/submittable' {
* will go into phragmen, we assume full block for now. * will go into phragmen, we assume full block for now.
* # </weight> * # </weight>
**/ **/
removeMember: AugmentedSubmittable<(who: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, hasReplacement: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, bool]>; removeMember: AugmentedSubmittable<(who: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, slashBond: bool | boolean | Uint8Array, rerunElection: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, bool, bool]>;
/** /**
* Remove `origin` as a voter. * Remove `origin` as a voter.
* *
@@ -2625,7 +2641,7 @@ declare module '@polkadot/api-base/types/submittable' {
* Weight is a function of the number of proxies the user has (P). * Weight is a function of the number of proxies the user has (P).
* # </weight> * # </weight>
**/ **/
proxy: AugmentedSubmittable<(real: AccountId32 | string | Uint8Array, forceProxyType: Option<KusamaRuntimeProxyType> | null | object | string | Uint8Array, call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, Option<KusamaRuntimeProxyType>, Call]>; proxy: AugmentedSubmittable<(real: AccountId32 | string | Uint8Array, forceProxyType: Option<KusamaRuntimeProxyType> | null | Uint8Array | KusamaRuntimeProxyType | 'Any' | 'NonTransfer' | 'Governance' | 'Staking' | 'IdentityJudgement' | 'CancelProxy' | 'Auction' | 'Society' | number, call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, Option<KusamaRuntimeProxyType>, Call]>;
/** /**
* Dispatch the given `call` from an account that the sender is authorized for through * Dispatch the given `call` from an account that the sender is authorized for through
* `add_proxy`. * `add_proxy`.
@@ -2645,7 +2661,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - P: the number of proxies the user has. * - P: the number of proxies the user has.
* # </weight> * # </weight>
**/ **/
proxyAnnounced: AugmentedSubmittable<(delegate: AccountId32 | string | Uint8Array, real: AccountId32 | string | Uint8Array, forceProxyType: Option<KusamaRuntimeProxyType> | null | object | string | Uint8Array, call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, AccountId32, Option<KusamaRuntimeProxyType>, Call]>; proxyAnnounced: AugmentedSubmittable<(delegate: AccountId32 | string | Uint8Array, real: AccountId32 | string | Uint8Array, forceProxyType: Option<KusamaRuntimeProxyType> | null | Uint8Array | KusamaRuntimeProxyType | 'Any' | 'NonTransfer' | 'Governance' | 'Staking' | 'IdentityJudgement' | 'CancelProxy' | 'Auction' | 'Society' | number, call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, AccountId32, Option<KusamaRuntimeProxyType>, Call]>;
/** /**
* Remove the given announcement of a delegate. * Remove the given announcement of a delegate.
* *
@@ -2930,7 +2946,7 @@ declare module '@polkadot/api-base/types/submittable' {
/** /**
* Anonymously schedule a task. * Anonymously schedule a task.
**/ **/
schedule: AugmentedSubmittable<(when: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | object | string | Uint8Array, priority: u8 | AnyNumber | Uint8Array, call: FrameSupportScheduleMaybeHashed | { Value: any } | { Hash: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, Option<ITuple<[u32, u32]>>, u8, FrameSupportScheduleMaybeHashed]>; schedule: AugmentedSubmittable<(when: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | Uint8Array | ITuple<[u32, u32]> | [u32 | AnyNumber | Uint8Array, u32 | AnyNumber | Uint8Array], priority: u8 | AnyNumber | Uint8Array, call: FrameSupportScheduleMaybeHashed | { Value: any } | { Hash: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, Option<ITuple<[u32, u32]>>, u8, FrameSupportScheduleMaybeHashed]>;
/** /**
* Anonymously schedule a task after a delay. * Anonymously schedule a task after a delay.
* *
@@ -2938,11 +2954,11 @@ declare module '@polkadot/api-base/types/submittable' {
* Same as [`schedule`]. * Same as [`schedule`].
* # </weight> * # </weight>
**/ **/
scheduleAfter: AugmentedSubmittable<(after: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | object | string | Uint8Array, priority: u8 | AnyNumber | Uint8Array, call: FrameSupportScheduleMaybeHashed | { Value: any } | { Hash: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, Option<ITuple<[u32, u32]>>, u8, FrameSupportScheduleMaybeHashed]>; scheduleAfter: AugmentedSubmittable<(after: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | Uint8Array | ITuple<[u32, u32]> | [u32 | AnyNumber | Uint8Array, u32 | AnyNumber | Uint8Array], priority: u8 | AnyNumber | Uint8Array, call: FrameSupportScheduleMaybeHashed | { Value: any } | { Hash: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, Option<ITuple<[u32, u32]>>, u8, FrameSupportScheduleMaybeHashed]>;
/** /**
* Schedule a named task. * Schedule a named task.
**/ **/
scheduleNamed: AugmentedSubmittable<(id: Bytes | string | Uint8Array, when: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | object | string | Uint8Array, priority: u8 | AnyNumber | Uint8Array, call: FrameSupportScheduleMaybeHashed | { Value: any } | { Hash: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes, u32, Option<ITuple<[u32, u32]>>, u8, FrameSupportScheduleMaybeHashed]>; scheduleNamed: AugmentedSubmittable<(id: Bytes | string | Uint8Array, when: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | Uint8Array | ITuple<[u32, u32]> | [u32 | AnyNumber | Uint8Array, u32 | AnyNumber | Uint8Array], priority: u8 | AnyNumber | Uint8Array, call: FrameSupportScheduleMaybeHashed | { Value: any } | { Hash: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes, u32, Option<ITuple<[u32, u32]>>, u8, FrameSupportScheduleMaybeHashed]>;
/** /**
* Schedule a named task after a delay. * Schedule a named task after a delay.
* *
@@ -2950,7 +2966,7 @@ declare module '@polkadot/api-base/types/submittable' {
* Same as [`schedule_named`](Self::schedule_named). * Same as [`schedule_named`](Self::schedule_named).
* # </weight> * # </weight>
**/ **/
scheduleNamedAfter: AugmentedSubmittable<(id: Bytes | string | Uint8Array, after: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | object | string | Uint8Array, priority: u8 | AnyNumber | Uint8Array, call: FrameSupportScheduleMaybeHashed | { Value: any } | { Hash: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes, u32, Option<ITuple<[u32, u32]>>, u8, FrameSupportScheduleMaybeHashed]>; scheduleNamedAfter: AugmentedSubmittable<(id: Bytes | string | Uint8Array, after: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | Uint8Array | ITuple<[u32, u32]> | [u32 | AnyNumber | Uint8Array, u32 | AnyNumber | Uint8Array], priority: u8 | AnyNumber | Uint8Array, call: FrameSupportScheduleMaybeHashed | { Value: any } | { Hash: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes, u32, Option<ITuple<[u32, u32]>>, u8, FrameSupportScheduleMaybeHashed]>;
/** /**
* Generic tx * Generic tx
**/ **/
@@ -3956,7 +3972,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - 1 storage write (codec `O(1)`) for deleting the old `prime` and setting the new one * - 1 storage write (codec `O(1)`) for deleting the old `prime` and setting the new one
* # </weight> * # </weight>
**/ **/
setMembers: AugmentedSubmittable<(newMembers: Vec<AccountId32> | (AccountId32 | string | Uint8Array)[], prime: Option<AccountId32> | null | object | string | Uint8Array, oldCount: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Vec<AccountId32>, Option<AccountId32>, u32]>; setMembers: AugmentedSubmittable<(newMembers: Vec<AccountId32> | (AccountId32 | string | Uint8Array)[], prime: Option<AccountId32> | null | Uint8Array | AccountId32 | string, oldCount: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Vec<AccountId32>, Option<AccountId32>, u32]>;
/** /**
* Add an aye or nay vote for the sender to the given proposal. * Add an aye or nay vote for the sender to the given proposal.
* *
@@ -4535,7 +4551,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - `origin`: Must be Root. * - `origin`: Must be Root.
* - `maybe_xcm_version`: The default XCM encoding version, or `None` to disable. * - `maybe_xcm_version`: The default XCM encoding version, or `None` to disable.
**/ **/
forceDefaultXcmVersion: AugmentedSubmittable<(maybeXcmVersion: Option<u32> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Option<u32>]>; forceDefaultXcmVersion: AugmentedSubmittable<(maybeXcmVersion: Option<u32> | null | Uint8Array | u32 | AnyNumber) => SubmittableExtrinsic<ApiType>, [Option<u32>]>;
/** /**
* Ask a location to notify us regarding their XCM version and any changes to it. * Ask a location to notify us regarding their XCM version and any changes to it.
* *
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/api-augment', path: 'auto', type: 'auto', version: '8.11.3' }; export const packageInfo = { name: '@polkadot/api-augment', path: 'auto', type: 'auto', version: '8.13.1' };
+5 -1
View File
@@ -1,6 +1,10 @@
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit // Auto-generated via `yarn polkadot-types-from-chain`, do not edit
/* eslint-disable */ /* eslint-disable */
// import type lookup before we augment - in some environments
// this is required to allow for ambient/previous definitions
import '@polkadot/api-base/types/consts';
import type { ApiTypes, AugmentedConst } from '@polkadot/api-base/types'; import type { ApiTypes, AugmentedConst } from '@polkadot/api-base/types';
import type { Bytes, Option, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec'; import type { Bytes, Option, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
import type { Codec } from '@polkadot/types-codec/types'; import type { Codec } from '@polkadot/types-codec/types';
@@ -10,7 +14,7 @@ import type { FrameSupportPalletId, FrameSupportWeightsRuntimeDbWeight, FrameSys
export type __AugmentedConst<ApiType extends ApiTypes> = AugmentedConst<ApiType>; export type __AugmentedConst<ApiType extends ApiTypes> = AugmentedConst<ApiType>;
declare module '@polkadot/api-base/types/consts' { declare module '@polkadot/api-base/types/consts' {
export interface AugmentedConsts<ApiType extends ApiTypes> { interface AugmentedConsts<ApiType extends ApiTypes> {
auctions: { auctions: {
/** /**
* The number of blocks over which an auction may be retroactively ended. * The number of blocks over which an auction may be retroactively ended.
+9 -5
View File
@@ -1,12 +1,16 @@
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit // Auto-generated via `yarn polkadot-types-from-chain`, do not edit
/* eslint-disable */ /* eslint-disable */
// import type lookup before we augment - in some environments
// this is required to allow for ambient/previous definitions
import '@polkadot/api-base/types/errors';
import type { ApiTypes, AugmentedError } from '@polkadot/api-base/types'; import type { ApiTypes, AugmentedError } from '@polkadot/api-base/types';
export type __AugmentedError<ApiType extends ApiTypes> = AugmentedError<ApiType>; export type __AugmentedError<ApiType extends ApiTypes> = AugmentedError<ApiType>;
declare module '@polkadot/api-base/types/errors' { declare module '@polkadot/api-base/types/errors' {
export interface AugmentedErrors<ApiType extends ApiTypes> { interface AugmentedErrors<ApiType extends ApiTypes> {
auctions: { auctions: {
/** /**
* The para is already leased out for part of this range. * The para is already leased out for part of this range.
@@ -1150,14 +1154,14 @@ declare module '@polkadot/api-base/types/errors' {
* Must vote for at least one candidate. * Must vote for at least one candidate.
**/ **/
NoVotes: AugmentedError<ApiType>; NoVotes: AugmentedError<ApiType>;
/**
* Cannot report self.
**/
ReportSelf: AugmentedError<ApiType>;
/** /**
* Runner cannot re-submit candidacy. * Runner cannot re-submit candidacy.
**/ **/
RunnerUpSubmit: AugmentedError<ApiType>; RunnerUpSubmit: AugmentedError<ApiType>;
/**
* Too many candidates have been created.
**/
TooManyCandidates: AugmentedError<ApiType>;
/** /**
* Cannot vote more than candidates. * Cannot vote more than candidates.
**/ **/
+5 -1
View File
@@ -1,6 +1,10 @@
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit // Auto-generated via `yarn polkadot-types-from-chain`, do not edit
/* eslint-disable */ /* eslint-disable */
// import type lookup before we augment - in some environments
// this is required to allow for ambient/previous definitions
import '@polkadot/api-base/types/events';
import type { ApiTypes, AugmentedEvent } from '@polkadot/api-base/types'; import type { ApiTypes, AugmentedEvent } from '@polkadot/api-base/types';
import type { Bytes, Null, Option, Result, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec'; import type { Bytes, Null, Option, Result, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
import type { ITuple } from '@polkadot/types-codec/types'; import type { ITuple } from '@polkadot/types-codec/types';
@@ -11,7 +15,7 @@ import type { FrameSupportScheduleLookupError, FrameSupportTokensMiscBalanceStat
export type __AugmentedEvent<ApiType extends ApiTypes> = AugmentedEvent<ApiType>; export type __AugmentedEvent<ApiType extends ApiTypes> = AugmentedEvent<ApiType>;
declare module '@polkadot/api-base/types/events' { declare module '@polkadot/api-base/types/events' {
export interface AugmentedEvents<ApiType extends ApiTypes> { interface AugmentedEvents<ApiType extends ApiTypes> {
auctions: { auctions: {
/** /**
* An auction ended. All funds become unreserved. * An auction ended. All funds become unreserved.
+5 -1
View File
@@ -1,6 +1,10 @@
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit // Auto-generated via `yarn polkadot-types-from-chain`, do not edit
/* eslint-disable */ /* eslint-disable */
// import type lookup before we augment - in some environments
// this is required to allow for ambient/previous definitions
import '@polkadot/api-base/types/storage';
import type { ApiTypes, AugmentedQuery, QueryableStorageEntry } from '@polkadot/api-base/types'; import type { ApiTypes, AugmentedQuery, QueryableStorageEntry } from '@polkadot/api-base/types';
import type { Data } from '@polkadot/types'; import type { Data } from '@polkadot/types';
import type { BTreeMap, Bytes, Null, Option, U8aFixed, Vec, WrapperKeepOpaque, WrapperOpaque, bool, u128, u32, u64 } from '@polkadot/types-codec'; import type { BTreeMap, Bytes, Null, Option, U8aFixed, Vec, WrapperKeepOpaque, WrapperOpaque, bool, u128, u32, u64 } from '@polkadot/types-codec';
@@ -14,7 +18,7 @@ export type __AugmentedQuery<ApiType extends ApiTypes> = AugmentedQuery<ApiType,
export type __QueryableStorageEntry<ApiType extends ApiTypes> = QueryableStorageEntry<ApiType>; export type __QueryableStorageEntry<ApiType extends ApiTypes> = QueryableStorageEntry<ApiType>;
declare module '@polkadot/api-base/types/storage' { declare module '@polkadot/api-base/types/storage' {
export interface AugmentedQueries<ApiType extends ApiTypes> { interface AugmentedQueries<ApiType extends ApiTypes> {
auctions: { auctions: {
/** /**
* Number of auctions started so far. * Number of auctions started so far.
+6 -2
View File
@@ -1,6 +1,10 @@
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit // Auto-generated via `yarn polkadot-types-from-chain`, do not edit
/* eslint-disable */ /* eslint-disable */
// import type lookup before we augment - in some environments
// this is required to allow for ambient/previous definitions
import '@polkadot/api-base/types/calls';
import type { ApiTypes, AugmentedCall, DecoratedCallBase } from '@polkadot/api-base/types'; import type { ApiTypes, AugmentedCall, DecoratedCallBase } from '@polkadot/api-base/types';
import type { Bytes, Null, Option, Result, Vec, bool, u32 } from '@polkadot/types-codec'; import type { Bytes, Null, Option, Result, Vec, bool, u32 } from '@polkadot/types-codec';
import type { AnyNumber, ITuple } from '@polkadot/types-codec/types'; import type { AnyNumber, ITuple } from '@polkadot/types-codec/types';
@@ -26,7 +30,7 @@ export type __AugmentedCall<ApiType extends ApiTypes> = AugmentedCall<ApiType>;
export type __DecoratedCallBase<ApiType extends ApiTypes> = DecoratedCallBase<ApiType>; export type __DecoratedCallBase<ApiType extends ApiTypes> = DecoratedCallBase<ApiType>;
declare module '@polkadot/api-base/types/calls' { declare module '@polkadot/api-base/types/calls' {
export interface AugmentedCalls<ApiType extends ApiTypes> { interface AugmentedCalls<ApiType extends ApiTypes> {
/** 0xbc9d89904f5b923f/1 */ /** 0xbc9d89904f5b923f/1 */
accountNonceApi: { accountNonceApi: {
/** /**
@@ -301,7 +305,7 @@ declare module '@polkadot/api-base/types/calls' {
/** /**
* Generate a set of session keys with optionally using the given seed. * Generate a set of session keys with optionally using the given seed.
**/ **/
generateSessionKeys: AugmentedCall<ApiType, (seed: Option<Bytes> | null | object | string | Uint8Array) => Observable<Bytes>>; generateSessionKeys: AugmentedCall<ApiType, (seed: Option<Bytes> | null | Uint8Array | Bytes | string) => Observable<Bytes>>;
/** /**
* Generic call * Generic call
**/ **/
+33 -25
View File
@@ -1,6 +1,10 @@
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit // Auto-generated via `yarn polkadot-types-from-chain`, do not edit
/* eslint-disable */ /* eslint-disable */
// import type lookup before we augment - in some environments
// this is required to allow for ambient/previous definitions
import '@polkadot/api-base/types/submittable';
import type { ApiTypes, AugmentedSubmittable, SubmittableExtrinsic, SubmittableExtrinsicFunction } from '@polkadot/api-base/types'; import type { ApiTypes, AugmentedSubmittable, SubmittableExtrinsic, SubmittableExtrinsicFunction } from '@polkadot/api-base/types';
import type { Data } from '@polkadot/types'; import type { Data } from '@polkadot/types';
import type { Bytes, Compact, Option, U8aFixed, Vec, WrapperKeepOpaque, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec'; import type { Bytes, Compact, Option, U8aFixed, Vec, WrapperKeepOpaque, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
@@ -14,7 +18,7 @@ export type __SubmittableExtrinsic<ApiType extends ApiTypes> = SubmittableExtrin
export type __SubmittableExtrinsicFunction<ApiType extends ApiTypes> = SubmittableExtrinsicFunction<ApiType>; export type __SubmittableExtrinsicFunction<ApiType extends ApiTypes> = SubmittableExtrinsicFunction<ApiType>;
declare module '@polkadot/api-base/types/submittable' { declare module '@polkadot/api-base/types/submittable' {
export interface AugmentedSubmittables<ApiType extends ApiTypes> { interface AugmentedSubmittables<ApiType extends ApiTypes> {
auctions: { auctions: {
/** /**
* Make a new bid from an account (including a parachain account) for deploying a new * Make a new bid from an account (including a parachain account) for deploying a new
@@ -573,8 +577,8 @@ declare module '@polkadot/api-base/types/submittable' {
* Total Complexity: O(1) * Total Complexity: O(1)
* </weight> * </weight>
**/ **/
mintClaim: AugmentedSubmittable<(who: EthereumAddress | string | Uint8Array, value: u128 | AnyNumber | Uint8Array, vestingSchedule: Option<ITuple<[u128, u128, u32]>> | null | object | string | Uint8Array, statement: Option<PolkadotRuntimeCommonClaimsStatementKind> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [EthereumAddress, u128, Option<ITuple<[u128, u128, u32]>>, Option<PolkadotRuntimeCommonClaimsStatementKind>]>; mintClaim: AugmentedSubmittable<(who: EthereumAddress | string | Uint8Array, value: u128 | AnyNumber | Uint8Array, vestingSchedule: Option<ITuple<[u128, u128, u32]>> | null | Uint8Array | ITuple<[u128, u128, u32]> | [u128 | AnyNumber | Uint8Array, u128 | AnyNumber | Uint8Array, u32 | AnyNumber | Uint8Array], statement: Option<PolkadotRuntimeCommonClaimsStatementKind> | null | Uint8Array | PolkadotRuntimeCommonClaimsStatementKind | 'Regular' | 'Saft' | number) => SubmittableExtrinsic<ApiType>, [EthereumAddress, u128, Option<ITuple<[u128, u128, u32]>>, Option<PolkadotRuntimeCommonClaimsStatementKind>]>;
moveClaim: AugmentedSubmittable<(old: EthereumAddress | string | Uint8Array, updated: EthereumAddress | string | Uint8Array, maybePreclaim: Option<AccountId32> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [EthereumAddress, EthereumAddress, Option<AccountId32>]>; moveClaim: AugmentedSubmittable<(old: EthereumAddress | string | Uint8Array, updated: EthereumAddress | string | Uint8Array, maybePreclaim: Option<AccountId32> | null | Uint8Array | AccountId32 | string) => SubmittableExtrinsic<ApiType>, [EthereumAddress, EthereumAddress, Option<AccountId32>]>;
/** /**
* Generic tx * Generic tx
**/ **/
@@ -694,11 +698,11 @@ declare module '@polkadot/api-base/types/submittable' {
/** /**
* Set the maximum number of validators to use in parachain consensus. * Set the maximum number of validators to use in parachain consensus.
**/ **/
setMaxValidators: AugmentedSubmittable<(updated: Option<u32> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Option<u32>]>; setMaxValidators: AugmentedSubmittable<(updated: Option<u32> | null | Uint8Array | u32 | AnyNumber) => SubmittableExtrinsic<ApiType>, [Option<u32>]>;
/** /**
* Set the maximum number of validators to assign to any core. * Set the maximum number of validators to assign to any core.
**/ **/
setMaxValidatorsPerCore: AugmentedSubmittable<(updated: Option<u32> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Option<u32>]>; setMaxValidatorsPerCore: AugmentedSubmittable<(updated: Option<u32> | null | Uint8Array | u32 | AnyNumber) => SubmittableExtrinsic<ApiType>, [Option<u32>]>;
/** /**
* Sets the minimum delay between announcing the upgrade block for a parachain until the * Sets the minimum delay between announcing the upgrade block for a parachain until the
* upgrade taking place. * upgrade taking place.
@@ -903,7 +907,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - 1 storage write (codec `O(1)`) for deleting the old `prime` and setting the new one * - 1 storage write (codec `O(1)`) for deleting the old `prime` and setting the new one
* # </weight> * # </weight>
**/ **/
setMembers: AugmentedSubmittable<(newMembers: Vec<AccountId32> | (AccountId32 | string | Uint8Array)[], prime: Option<AccountId32> | null | object | string | Uint8Array, oldCount: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Vec<AccountId32>, Option<AccountId32>, u32]>; setMembers: AugmentedSubmittable<(newMembers: Vec<AccountId32> | (AccountId32 | string | Uint8Array)[], prime: Option<AccountId32> | null | Uint8Array | AccountId32 | string, oldCount: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Vec<AccountId32>, Option<AccountId32>, u32]>;
/** /**
* Add an aye or nay vote for the sender to the given proposal. * Add an aye or nay vote for the sender to the given proposal.
* *
@@ -938,19 +942,19 @@ declare module '@polkadot/api-base/types/submittable' {
* Contribute to a crowd sale. This will transfer some balance over to fund a parachain * Contribute to a crowd sale. This will transfer some balance over to fund a parachain
* slot. It will be withdrawable when the crowdloan has ended and the funds are unused. * slot. It will be withdrawable when the crowdloan has ended and the funds are unused.
**/ **/
contribute: AugmentedSubmittable<(index: Compact<u32> | AnyNumber | Uint8Array, value: Compact<u128> | AnyNumber | Uint8Array, signature: Option<SpRuntimeMultiSignature> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, Compact<u128>, Option<SpRuntimeMultiSignature>]>; contribute: AugmentedSubmittable<(index: Compact<u32> | AnyNumber | Uint8Array, value: Compact<u128> | AnyNumber | Uint8Array, signature: Option<SpRuntimeMultiSignature> | null | Uint8Array | SpRuntimeMultiSignature | { Ed25519: any } | { Sr25519: any } | { Ecdsa: any } | string) => SubmittableExtrinsic<ApiType>, [Compact<u32>, Compact<u128>, Option<SpRuntimeMultiSignature>]>;
/** /**
* Contribute your entire balance to a crowd sale. This will transfer the entire balance of a user over to fund a parachain * Contribute your entire balance to a crowd sale. This will transfer the entire balance of a user over to fund a parachain
* slot. It will be withdrawable when the crowdloan has ended and the funds are unused. * slot. It will be withdrawable when the crowdloan has ended and the funds are unused.
**/ **/
contributeAll: AugmentedSubmittable<(index: Compact<u32> | AnyNumber | Uint8Array, signature: Option<SpRuntimeMultiSignature> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, Option<SpRuntimeMultiSignature>]>; contributeAll: AugmentedSubmittable<(index: Compact<u32> | AnyNumber | Uint8Array, signature: Option<SpRuntimeMultiSignature> | null | Uint8Array | SpRuntimeMultiSignature | { Ed25519: any } | { Sr25519: any } | { Ecdsa: any } | string) => SubmittableExtrinsic<ApiType>, [Compact<u32>, Option<SpRuntimeMultiSignature>]>;
/** /**
* Create a new crowdloaning campaign for a parachain slot with the given lease period range. * Create a new crowdloaning campaign for a parachain slot with the given lease period range.
* *
* This applies a lock to your parachain configuration, ensuring that it cannot be changed * This applies a lock to your parachain configuration, ensuring that it cannot be changed
* by the parachain manager. * by the parachain manager.
**/ **/
create: AugmentedSubmittable<(index: Compact<u32> | AnyNumber | Uint8Array, cap: Compact<u128> | AnyNumber | Uint8Array, firstPeriod: Compact<u32> | AnyNumber | Uint8Array, lastPeriod: Compact<u32> | AnyNumber | Uint8Array, end: Compact<u32> | AnyNumber | Uint8Array, verifier: Option<SpRuntimeMultiSigner> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, Compact<u128>, Compact<u32>, Compact<u32>, Compact<u32>, Option<SpRuntimeMultiSigner>]>; create: AugmentedSubmittable<(index: Compact<u32> | AnyNumber | Uint8Array, cap: Compact<u128> | AnyNumber | Uint8Array, firstPeriod: Compact<u32> | AnyNumber | Uint8Array, lastPeriod: Compact<u32> | AnyNumber | Uint8Array, end: Compact<u32> | AnyNumber | Uint8Array, verifier: Option<SpRuntimeMultiSigner> | null | Uint8Array | SpRuntimeMultiSigner | { Ed25519: any } | { Sr25519: any } | { Ecdsa: any } | string) => SubmittableExtrinsic<ApiType>, [Compact<u32>, Compact<u128>, Compact<u32>, Compact<u32>, Compact<u32>, Option<SpRuntimeMultiSigner>]>;
/** /**
* Remove a fund after the retirement period has ended and all funds have been returned. * Remove a fund after the retirement period has ended and all funds have been returned.
**/ **/
@@ -960,7 +964,7 @@ declare module '@polkadot/api-base/types/submittable' {
* *
* Can only be called by Root origin. * Can only be called by Root origin.
**/ **/
edit: AugmentedSubmittable<(index: Compact<u32> | AnyNumber | Uint8Array, cap: Compact<u128> | AnyNumber | Uint8Array, firstPeriod: Compact<u32> | AnyNumber | Uint8Array, lastPeriod: Compact<u32> | AnyNumber | Uint8Array, end: Compact<u32> | AnyNumber | Uint8Array, verifier: Option<SpRuntimeMultiSigner> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, Compact<u128>, Compact<u32>, Compact<u32>, Compact<u32>, Option<SpRuntimeMultiSigner>]>; edit: AugmentedSubmittable<(index: Compact<u32> | AnyNumber | Uint8Array, cap: Compact<u128> | AnyNumber | Uint8Array, firstPeriod: Compact<u32> | AnyNumber | Uint8Array, lastPeriod: Compact<u32> | AnyNumber | Uint8Array, end: Compact<u32> | AnyNumber | Uint8Array, verifier: Option<SpRuntimeMultiSigner> | null | Uint8Array | SpRuntimeMultiSigner | { Ed25519: any } | { Sr25519: any } | { Ecdsa: any } | string) => SubmittableExtrinsic<ApiType>, [Compact<u32>, Compact<u128>, Compact<u32>, Compact<u32>, Compact<u32>, Option<SpRuntimeMultiSigner>]>;
/** /**
* Poke the fund into `NewRaise` * Poke the fund into `NewRaise`
* *
@@ -1018,7 +1022,7 @@ declare module '@polkadot/api-base/types/submittable' {
* Weight: `O(p)` (though as this is an high-privilege dispatch, we assume it has a * Weight: `O(p)` (though as this is an high-privilege dispatch, we assume it has a
* reasonable value). * reasonable value).
**/ **/
blacklist: AugmentedSubmittable<(proposalHash: H256 | string | Uint8Array, maybeRefIndex: Option<u32> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [H256, Option<u32>]>; blacklist: AugmentedSubmittable<(proposalHash: H256 | string | Uint8Array, maybeRefIndex: Option<u32> | null | Uint8Array | u32 | AnyNumber) => SubmittableExtrinsic<ApiType>, [H256, Option<u32>]>;
/** /**
* Remove a proposal. * Remove a proposal.
* *
@@ -1350,7 +1354,7 @@ declare module '@polkadot/api-base/types/submittable' {
* This can only be called when [`Phase::Emergency`] is enabled, as an alternative to * This can only be called when [`Phase::Emergency`] is enabled, as an alternative to
* calling [`Call::set_emergency_election_result`]. * calling [`Call::set_emergency_election_result`].
**/ **/
governanceFallback: AugmentedSubmittable<(maybeMaxVoters: Option<u32> | null | object | string | Uint8Array, maybeMaxTargets: Option<u32> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Option<u32>, Option<u32>]>; governanceFallback: AugmentedSubmittable<(maybeMaxVoters: Option<u32> | null | Uint8Array | u32 | AnyNumber, maybeMaxTargets: Option<u32> | null | Uint8Array | u32 | AnyNumber) => SubmittableExtrinsic<ApiType>, [Option<u32>, Option<u32>]>;
/** /**
* Set a solution in the queue, to be handed out to the client of this pallet in the next * Set a solution in the queue, to be handed out to the client of this pallet in the next
* call to `ElectionProvider::elect`. * call to `ElectionProvider::elect`.
@@ -1369,7 +1373,7 @@ declare module '@polkadot/api-base/types/submittable' {
* *
* This check can be turned off by setting the value to `None`. * This check can be turned off by setting the value to `None`.
**/ **/
setMinimumUntrustedScore: AugmentedSubmittable<(maybeNextScore: Option<SpNposElectionsElectionScore> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Option<SpNposElectionsElectionScore>]>; setMinimumUntrustedScore: AugmentedSubmittable<(maybeNextScore: Option<SpNposElectionsElectionScore> | null | Uint8Array | SpNposElectionsElectionScore | { minimalStake?: any; sumStake?: any; sumStakeSquared?: any } | string) => SubmittableExtrinsic<ApiType>, [Option<SpNposElectionsElectionScore>]>;
/** /**
* Submit a solution for the signed phase. * Submit a solution for the signed phase.
* *
@@ -1966,7 +1970,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - Write: Multisig Storage, [Caller Account] * - Write: Multisig Storage, [Caller Account]
* # </weight> * # </weight>
**/ **/
approveAsMulti: AugmentedSubmittable<(threshold: u16 | AnyNumber | Uint8Array, otherSignatories: Vec<AccountId32> | (AccountId32 | string | Uint8Array)[], maybeTimepoint: Option<PalletMultisigTimepoint> | null | object | string | Uint8Array, callHash: U8aFixed | string | Uint8Array, maxWeight: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u16, Vec<AccountId32>, Option<PalletMultisigTimepoint>, U8aFixed, u64]>; approveAsMulti: AugmentedSubmittable<(threshold: u16 | AnyNumber | Uint8Array, otherSignatories: Vec<AccountId32> | (AccountId32 | string | Uint8Array)[], maybeTimepoint: Option<PalletMultisigTimepoint> | null | Uint8Array | PalletMultisigTimepoint | { height?: any; index?: any } | string, callHash: U8aFixed | string | Uint8Array, maxWeight: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u16, Vec<AccountId32>, Option<PalletMultisigTimepoint>, U8aFixed, u64]>;
/** /**
* Register approval for a dispatch to be made from a deterministic composite account if * Register approval for a dispatch to be made from a deterministic composite account if
* approved by a total of `threshold - 1` of `other_signatories`. * approved by a total of `threshold - 1` of `other_signatories`.
@@ -2014,7 +2018,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - Plus Call Weight * - Plus Call Weight
* # </weight> * # </weight>
**/ **/
asMulti: AugmentedSubmittable<(threshold: u16 | AnyNumber | Uint8Array, otherSignatories: Vec<AccountId32> | (AccountId32 | string | Uint8Array)[], maybeTimepoint: Option<PalletMultisigTimepoint> | null | object | string | Uint8Array, call: WrapperKeepOpaque<Call> | object | string | Uint8Array, storeCall: bool | boolean | Uint8Array, maxWeight: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u16, Vec<AccountId32>, Option<PalletMultisigTimepoint>, WrapperKeepOpaque<Call>, bool, u64]>; asMulti: AugmentedSubmittable<(threshold: u16 | AnyNumber | Uint8Array, otherSignatories: Vec<AccountId32> | (AccountId32 | string | Uint8Array)[], maybeTimepoint: Option<PalletMultisigTimepoint> | null | Uint8Array | PalletMultisigTimepoint | { height?: any; index?: any } | string, call: WrapperKeepOpaque<Call> | object | string | Uint8Array, storeCall: bool | boolean | Uint8Array, maxWeight: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u16, Vec<AccountId32>, Option<PalletMultisigTimepoint>, WrapperKeepOpaque<Call>, bool, u64]>;
/** /**
* Immediately dispatch a multi-signature call using a single approval from the caller. * Immediately dispatch a multi-signature call using a single approval from the caller.
* *
@@ -2173,7 +2177,11 @@ declare module '@polkadot/api-base/types/submittable' {
* the outgoing member is slashed. * the outgoing member is slashed.
* *
* If a runner-up is available, then the best runner-up will be removed and replaces the * If a runner-up is available, then the best runner-up will be removed and replaces the
* outgoing member. Otherwise, a new phragmen election is started. * outgoing member. Otherwise, if `rerun_election` is `true`, a new phragmen election is
* started, else, nothing happens.
*
* If `slash_bond` is set to true, the bond of the member being removed is slashed. Else,
* it is returned.
* *
* The dispatch origin of this call must be root. * The dispatch origin of this call must be root.
* *
@@ -2184,7 +2192,7 @@ declare module '@polkadot/api-base/types/submittable' {
* will go into phragmen, we assume full block for now. * will go into phragmen, we assume full block for now.
* # </weight> * # </weight>
**/ **/
removeMember: AugmentedSubmittable<(who: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, hasReplacement: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, bool]>; removeMember: AugmentedSubmittable<(who: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, slashBond: bool | boolean | Uint8Array, rerunElection: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, bool, bool]>;
/** /**
* Remove `origin` as a voter. * Remove `origin` as a voter.
* *
@@ -2400,7 +2408,7 @@ declare module '@polkadot/api-base/types/submittable' {
* Weight is a function of the number of proxies the user has (P). * Weight is a function of the number of proxies the user has (P).
* # </weight> * # </weight>
**/ **/
proxy: AugmentedSubmittable<(real: AccountId32 | string | Uint8Array, forceProxyType: Option<PolkadotRuntimeProxyType> | null | object | string | Uint8Array, call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, Option<PolkadotRuntimeProxyType>, Call]>; proxy: AugmentedSubmittable<(real: AccountId32 | string | Uint8Array, forceProxyType: Option<PolkadotRuntimeProxyType> | null | Uint8Array | PolkadotRuntimeProxyType | 'Any' | 'NonTransfer' | 'Governance' | 'Staking' | 'IdentityJudgement' | 'CancelProxy' | 'Auction' | number, call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, Option<PolkadotRuntimeProxyType>, Call]>;
/** /**
* Dispatch the given `call` from an account that the sender is authorized for through * Dispatch the given `call` from an account that the sender is authorized for through
* `add_proxy`. * `add_proxy`.
@@ -2420,7 +2428,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - P: the number of proxies the user has. * - P: the number of proxies the user has.
* # </weight> * # </weight>
**/ **/
proxyAnnounced: AugmentedSubmittable<(delegate: AccountId32 | string | Uint8Array, real: AccountId32 | string | Uint8Array, forceProxyType: Option<PolkadotRuntimeProxyType> | null | object | string | Uint8Array, call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, AccountId32, Option<PolkadotRuntimeProxyType>, Call]>; proxyAnnounced: AugmentedSubmittable<(delegate: AccountId32 | string | Uint8Array, real: AccountId32 | string | Uint8Array, forceProxyType: Option<PolkadotRuntimeProxyType> | null | Uint8Array | PolkadotRuntimeProxyType | 'Any' | 'NonTransfer' | 'Governance' | 'Staking' | 'IdentityJudgement' | 'CancelProxy' | 'Auction' | number, call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, AccountId32, Option<PolkadotRuntimeProxyType>, Call]>;
/** /**
* Remove the given announcement of a delegate. * Remove the given announcement of a delegate.
* *
@@ -2579,7 +2587,7 @@ declare module '@polkadot/api-base/types/submittable' {
/** /**
* Anonymously schedule a task. * Anonymously schedule a task.
**/ **/
schedule: AugmentedSubmittable<(when: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | object | string | Uint8Array, priority: u8 | AnyNumber | Uint8Array, call: FrameSupportScheduleMaybeHashed | { Value: any } | { Hash: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, Option<ITuple<[u32, u32]>>, u8, FrameSupportScheduleMaybeHashed]>; schedule: AugmentedSubmittable<(when: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | Uint8Array | ITuple<[u32, u32]> | [u32 | AnyNumber | Uint8Array, u32 | AnyNumber | Uint8Array], priority: u8 | AnyNumber | Uint8Array, call: FrameSupportScheduleMaybeHashed | { Value: any } | { Hash: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, Option<ITuple<[u32, u32]>>, u8, FrameSupportScheduleMaybeHashed]>;
/** /**
* Anonymously schedule a task after a delay. * Anonymously schedule a task after a delay.
* *
@@ -2587,11 +2595,11 @@ declare module '@polkadot/api-base/types/submittable' {
* Same as [`schedule`]. * Same as [`schedule`].
* # </weight> * # </weight>
**/ **/
scheduleAfter: AugmentedSubmittable<(after: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | object | string | Uint8Array, priority: u8 | AnyNumber | Uint8Array, call: FrameSupportScheduleMaybeHashed | { Value: any } | { Hash: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, Option<ITuple<[u32, u32]>>, u8, FrameSupportScheduleMaybeHashed]>; scheduleAfter: AugmentedSubmittable<(after: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | Uint8Array | ITuple<[u32, u32]> | [u32 | AnyNumber | Uint8Array, u32 | AnyNumber | Uint8Array], priority: u8 | AnyNumber | Uint8Array, call: FrameSupportScheduleMaybeHashed | { Value: any } | { Hash: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, Option<ITuple<[u32, u32]>>, u8, FrameSupportScheduleMaybeHashed]>;
/** /**
* Schedule a named task. * Schedule a named task.
**/ **/
scheduleNamed: AugmentedSubmittable<(id: Bytes | string | Uint8Array, when: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | object | string | Uint8Array, priority: u8 | AnyNumber | Uint8Array, call: FrameSupportScheduleMaybeHashed | { Value: any } | { Hash: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes, u32, Option<ITuple<[u32, u32]>>, u8, FrameSupportScheduleMaybeHashed]>; scheduleNamed: AugmentedSubmittable<(id: Bytes | string | Uint8Array, when: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | Uint8Array | ITuple<[u32, u32]> | [u32 | AnyNumber | Uint8Array, u32 | AnyNumber | Uint8Array], priority: u8 | AnyNumber | Uint8Array, call: FrameSupportScheduleMaybeHashed | { Value: any } | { Hash: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes, u32, Option<ITuple<[u32, u32]>>, u8, FrameSupportScheduleMaybeHashed]>;
/** /**
* Schedule a named task after a delay. * Schedule a named task after a delay.
* *
@@ -2599,7 +2607,7 @@ declare module '@polkadot/api-base/types/submittable' {
* Same as [`schedule_named`](Self::schedule_named). * Same as [`schedule_named`](Self::schedule_named).
* # </weight> * # </weight>
**/ **/
scheduleNamedAfter: AugmentedSubmittable<(id: Bytes | string | Uint8Array, after: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | object | string | Uint8Array, priority: u8 | AnyNumber | Uint8Array, call: FrameSupportScheduleMaybeHashed | { Value: any } | { Hash: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes, u32, Option<ITuple<[u32, u32]>>, u8, FrameSupportScheduleMaybeHashed]>; scheduleNamedAfter: AugmentedSubmittable<(id: Bytes | string | Uint8Array, after: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | Uint8Array | ITuple<[u32, u32]> | [u32 | AnyNumber | Uint8Array, u32 | AnyNumber | Uint8Array], priority: u8 | AnyNumber | Uint8Array, call: FrameSupportScheduleMaybeHashed | { Value: any } | { Hash: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes, u32, Option<ITuple<[u32, u32]>>, u8, FrameSupportScheduleMaybeHashed]>;
/** /**
* Generic tx * Generic tx
**/ **/
@@ -3278,7 +3286,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - 1 storage write (codec `O(1)`) for deleting the old `prime` and setting the new one * - 1 storage write (codec `O(1)`) for deleting the old `prime` and setting the new one
* # </weight> * # </weight>
**/ **/
setMembers: AugmentedSubmittable<(newMembers: Vec<AccountId32> | (AccountId32 | string | Uint8Array)[], prime: Option<AccountId32> | null | object | string | Uint8Array, oldCount: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Vec<AccountId32>, Option<AccountId32>, u32]>; setMembers: AugmentedSubmittable<(newMembers: Vec<AccountId32> | (AccountId32 | string | Uint8Array)[], prime: Option<AccountId32> | null | Uint8Array | AccountId32 | string, oldCount: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Vec<AccountId32>, Option<AccountId32>, u32]>;
/** /**
* Add an aye or nay vote for the sender to the given proposal. * Add an aye or nay vote for the sender to the given proposal.
* *
@@ -3857,7 +3865,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - `origin`: Must be Root. * - `origin`: Must be Root.
* - `maybe_xcm_version`: The default XCM encoding version, or `None` to disable. * - `maybe_xcm_version`: The default XCM encoding version, or `None` to disable.
**/ **/
forceDefaultXcmVersion: AugmentedSubmittable<(maybeXcmVersion: Option<u32> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Option<u32>]>; forceDefaultXcmVersion: AugmentedSubmittable<(maybeXcmVersion: Option<u32> | null | Uint8Array | u32 | AnyNumber) => SubmittableExtrinsic<ApiType>, [Option<u32>]>;
/** /**
* Ask a location to notify us regarding their XCM version and any changes to it. * Ask a location to notify us regarding their XCM version and any changes to it.
* *
+14 -3
View File
@@ -1,6 +1,10 @@
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit // Auto-generated via `yarn polkadot-types-from-chain`, do not edit
/* eslint-disable */ /* eslint-disable */
// import type lookup before we augment - in some environments
// this is required to allow for ambient/previous definitions
import '@polkadot/api-base/types/consts';
import type { ApiTypes, AugmentedConst } from '@polkadot/api-base/types'; import type { ApiTypes, AugmentedConst } from '@polkadot/api-base/types';
import type { Option, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec'; import type { Option, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
import type { Codec } from '@polkadot/types-codec/types'; import type { Codec } from '@polkadot/types-codec/types';
@@ -10,7 +14,7 @@ import type { FrameSupportPalletId, FrameSupportWeightsRuntimeDbWeight, FrameSys
export type __AugmentedConst<ApiType extends ApiTypes> = AugmentedConst<ApiType>; export type __AugmentedConst<ApiType extends ApiTypes> = AugmentedConst<ApiType>;
declare module '@polkadot/api-base/types/consts' { declare module '@polkadot/api-base/types/consts' {
export interface AugmentedConsts<ApiType extends ApiTypes> { interface AugmentedConsts<ApiType extends ApiTypes> {
alliance: { alliance: {
/** /**
* The deposit required for submitting candidacy. * The deposit required for submitting candidacy.
@@ -679,13 +683,20 @@ declare module '@polkadot/api-base/types/consts' {
}; };
nominationPools: { nominationPools: {
/** /**
* The minimum pool points-to-balance ratio that must be maintained for it to be `open`. * The maximum pool points-to-balance ratio that an `open` pool can have.
*
* This is important in the event slashing takes place and the pool's points-to-balance * This is important in the event slashing takes place and the pool's points-to-balance
* ratio becomes disproportional. * ratio becomes disproportional.
*
* Moreover, this relates to the `RewardCounter` type as well, as the arithmetic operations
* are a function of number of points, and by setting this value to e.g. 10, you ensure
* that the total number of points in the system are at most 10 times the total_issuance of
* the chain, in the absolute worse case.
*
* For a value of 10, the threshold would be a pool points-to-balance ratio of 10:1. * For a value of 10, the threshold would be a pool points-to-balance ratio of 10:1.
* Such a scenario would also be the equivalent of the pool being 90% slashed. * Such a scenario would also be the equivalent of the pool being 90% slashed.
**/ **/
minPointsToBalance: u32 & AugmentedConst<ApiType>; maxPointsToBalance: u8 & AugmentedConst<ApiType>;
/** /**
* The nomination pool's pallet id. * The nomination pool's pallet id.
**/ **/
+25 -14
View File
@@ -1,12 +1,16 @@
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit // Auto-generated via `yarn polkadot-types-from-chain`, do not edit
/* eslint-disable */ /* eslint-disable */
// import type lookup before we augment - in some environments
// this is required to allow for ambient/previous definitions
import '@polkadot/api-base/types/errors';
import type { ApiTypes, AugmentedError } from '@polkadot/api-base/types'; import type { ApiTypes, AugmentedError } from '@polkadot/api-base/types';
export type __AugmentedError<ApiType extends ApiTypes> = AugmentedError<ApiType>; export type __AugmentedError<ApiType extends ApiTypes> = AugmentedError<ApiType>;
declare module '@polkadot/api-base/types/errors' { declare module '@polkadot/api-base/types/errors' {
export interface AugmentedErrors<ApiType extends ApiTypes> { interface AugmentedErrors<ApiType extends ApiTypes> {
alliance: { alliance: {
/** /**
* Account has been deemed unscrupulous by the Alliance and is not welcome to join or be * Account has been deemed unscrupulous by the Alliance and is not welcome to join or be
@@ -851,14 +855,14 @@ declare module '@polkadot/api-base/types/errors' {
* Must vote for at least one candidate. * Must vote for at least one candidate.
**/ **/
NoVotes: AugmentedError<ApiType>; NoVotes: AugmentedError<ApiType>;
/**
* Cannot report self.
**/
ReportSelf: AugmentedError<ApiType>;
/** /**
* Runner cannot re-submit candidacy. * Runner cannot re-submit candidacy.
**/ **/
RunnerUpSubmit: AugmentedError<ApiType>; RunnerUpSubmit: AugmentedError<ApiType>;
/**
* Too many candidates have been created.
**/
TooManyCandidates: AugmentedError<ApiType>;
/** /**
* Cannot vote more than candidates. * Cannot vote more than candidates.
**/ **/
@@ -1203,6 +1207,10 @@ declare module '@polkadot/api-base/types/errors' {
MetadataExceedsMaxLen: AugmentedError<ApiType>; MetadataExceedsMaxLen: AugmentedError<ApiType>;
/** /**
* The amount does not meet the minimum bond to either join or create a pool. * The amount does not meet the minimum bond to either join or create a pool.
*
* The depositor can never unbond to a value less than
* `Pallet::depositor_min_bond`. The caller does not have nominating
* permissions for the pool. Members can never unbond to a value below `MinJoinBond`.
**/ **/
MinimumBondNotMet: AugmentedError<ApiType>; MinimumBondNotMet: AugmentedError<ApiType>;
/** /**
@@ -1210,10 +1218,6 @@ declare module '@polkadot/api-base/types/errors' {
* other members to be permissionlessly unbonded. * other members to be permissionlessly unbonded.
**/ **/
NotDestroying: AugmentedError<ApiType>; NotDestroying: AugmentedError<ApiType>;
/**
* Not enough points. Ty unbonding less.
**/
NotEnoughPointsToUnbond: AugmentedError<ApiType>;
/** /**
* Either a) the caller cannot make a valid kick or b) the pool is not destroying. * Either a) the caller cannot make a valid kick or b) the pool is not destroying.
**/ **/
@@ -1222,11 +1226,6 @@ declare module '@polkadot/api-base/types/errors' {
* The caller does not have nominating permissions for the pool. * The caller does not have nominating permissions for the pool.
**/ **/
NotNominator: AugmentedError<ApiType>; NotNominator: AugmentedError<ApiType>;
/**
* The depositor must be the only member in the bonded pool in order to unbond. And the
* depositor must be the only member in the sub pools in order to withdraw unbonded.
**/
NotOnlyPoolMember: AugmentedError<ApiType>;
/** /**
* The pool is not open to join * The pool is not open to join
**/ **/
@@ -2054,6 +2053,10 @@ declare module '@polkadot/api-base/types/errors' {
* Invalid witness data given. * Invalid witness data given.
**/ **/
BadWitness: AugmentedError<ApiType>; BadWitness: AugmentedError<ApiType>;
/**
* The provided bid is too low.
**/
BidTooLow: AugmentedError<ApiType>;
/** /**
* The item or collection is frozen. * The item or collection is frozen.
**/ **/
@@ -2086,6 +2089,10 @@ declare module '@polkadot/api-base/types/errors' {
* The signing account has no permission to do the operation. * The signing account has no permission to do the operation.
**/ **/
NoPermission: AugmentedError<ApiType>; NoPermission: AugmentedError<ApiType>;
/**
* Item is not for sale.
**/
NotForSale: AugmentedError<ApiType>;
/** /**
* The named owner has not signed ownership of the collection is acceptable. * The named owner has not signed ownership of the collection is acceptable.
**/ **/
@@ -2098,6 +2105,10 @@ declare module '@polkadot/api-base/types/errors' {
* The given item ID is unknown. * The given item ID is unknown.
**/ **/
UnknownCollection: AugmentedError<ApiType>; UnknownCollection: AugmentedError<ApiType>;
/**
* The given item ID is unknown.
**/
UnknownItem: AugmentedError<ApiType>;
/** /**
* The delegate turned out to be different to what was expected. * The delegate turned out to be different to what was expected.
**/ **/
+17 -1
View File
@@ -1,6 +1,10 @@
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit // Auto-generated via `yarn polkadot-types-from-chain`, do not edit
/* eslint-disable */ /* eslint-disable */
// import type lookup before we augment - in some environments
// this is required to allow for ambient/previous definitions
import '@polkadot/api-base/types/events';
import type { ApiTypes, AugmentedEvent } from '@polkadot/api-base/types'; import type { ApiTypes, AugmentedEvent } from '@polkadot/api-base/types';
import type { Bytes, Null, Option, Result, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec'; import type { Bytes, Null, Option, Result, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
import type { ITuple } from '@polkadot/types-codec/types'; import type { ITuple } from '@polkadot/types-codec/types';
@@ -10,7 +14,7 @@ import type { FrameSupportScheduleLookupError, FrameSupportTokensMiscBalanceStat
export type __AugmentedEvent<ApiType extends ApiTypes> = AugmentedEvent<ApiType>; export type __AugmentedEvent<ApiType extends ApiTypes> = AugmentedEvent<ApiType>;
declare module '@polkadot/api-base/types/events' { declare module '@polkadot/api-base/types/events' {
export interface AugmentedEvents<ApiType extends ApiTypes> { interface AugmentedEvents<ApiType extends ApiTypes> {
alliance: { alliance: {
/** /**
* An ally has been elevated to Fellow. * An ally has been elevated to Fellow.
@@ -1465,6 +1469,18 @@ declare module '@polkadot/api-base/types/events' {
* An `item` was issued. * An `item` was issued.
**/ **/
Issued: AugmentedEvent<ApiType, [collection: u32, item: u32, owner: AccountId32], { collection: u32, item: u32, owner: AccountId32 }>; Issued: AugmentedEvent<ApiType, [collection: u32, item: u32, owner: AccountId32], { collection: u32, item: u32, owner: AccountId32 }>;
/**
* An item was bought.
**/
ItemBought: AugmentedEvent<ApiType, [collection: u32, item: u32, price: u128, seller: AccountId32, buyer: AccountId32], { collection: u32, item: u32, price: u128, seller: AccountId32, buyer: AccountId32 }>;
/**
* The price for the instance was removed.
**/
ItemPriceRemoved: AugmentedEvent<ApiType, [collection: u32, item: u32], { collection: u32, item: u32 }>;
/**
* The price was set for the instance.
**/
ItemPriceSet: AugmentedEvent<ApiType, [collection: u32, item: u32, price: u128, whitelistedBuyer: Option<AccountId32>], { collection: u32, item: u32, price: u128, whitelistedBuyer: Option<AccountId32> }>;
/** /**
* A `collection` has had its attributes changed by the `Force` origin. * A `collection` has had its attributes changed by the `Force` origin.
**/ **/
+10 -2
View File
@@ -1,6 +1,10 @@
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit // Auto-generated via `yarn polkadot-types-from-chain`, do not edit
/* eslint-disable */ /* eslint-disable */
// import type lookup before we augment - in some environments
// this is required to allow for ambient/previous definitions
import '@polkadot/api-base/types/storage';
import type { ApiTypes, AugmentedQuery, QueryableStorageEntry } from '@polkadot/api-base/types'; import type { ApiTypes, AugmentedQuery, QueryableStorageEntry } from '@polkadot/api-base/types';
import type { Data } from '@polkadot/types'; import type { Data } from '@polkadot/types';
import type { BTreeMap, Bytes, Null, Option, U8aFixed, Vec, WrapperKeepOpaque, WrapperOpaque, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec'; import type { BTreeMap, Bytes, Null, Option, U8aFixed, Vec, WrapperKeepOpaque, WrapperOpaque, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
@@ -13,7 +17,7 @@ export type __AugmentedQuery<ApiType extends ApiTypes> = AugmentedQuery<ApiType,
export type __QueryableStorageEntry<ApiType extends ApiTypes> = QueryableStorageEntry<ApiType>; export type __QueryableStorageEntry<ApiType extends ApiTypes> = QueryableStorageEntry<ApiType>;
declare module '@polkadot/api-base/types/storage' { declare module '@polkadot/api-base/types/storage' {
export interface AugmentedQueries<ApiType extends ApiTypes> { interface AugmentedQueries<ApiType extends ApiTypes> {
alliance: { alliance: {
/** /**
* The current IPFS CIDs of any announcements. * The current IPFS CIDs of any announcements.
@@ -1753,7 +1757,7 @@ declare module '@polkadot/api-base/types/storage' {
/** /**
* Attributes of a collection. * Attributes of a collection.
**/ **/
attribute: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: Option<u32> | null | object | string | Uint8Array, arg3: Bytes | string | Uint8Array) => Observable<Option<ITuple<[Bytes, u128]>>>, [u32, Option<u32>, Bytes]> & QueryableStorageEntry<ApiType, [u32, Option<u32>, Bytes]>; attribute: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: Option<u32> | null | Uint8Array | u32 | AnyNumber, arg3: Bytes | string | Uint8Array) => Observable<Option<ITuple<[Bytes, u128]>>>, [u32, Option<u32>, Bytes]> & QueryableStorageEntry<ApiType, [u32, Option<u32>, Bytes]>;
/** /**
* Details of a collection. * Details of a collection.
**/ **/
@@ -1775,6 +1779,10 @@ declare module '@polkadot/api-base/types/storage' {
* Metadata of an item. * Metadata of an item.
**/ **/
instanceMetadataOf: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<Option<PalletUniquesItemMetadata>>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>; instanceMetadataOf: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<Option<PalletUniquesItemMetadata>>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
/**
* Price of an asset instance.
**/
itemPriceOf: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<Option<ITuple<[u128, Option<AccountId32>]>>>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
/** /**
* The collection, if any, of which an account is willing to take ownership. * The collection, if any, of which an account is willing to take ownership.
**/ **/
@@ -1,6 +1,10 @@
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit // Auto-generated via `yarn polkadot-types-from-chain`, do not edit
/* eslint-disable */ /* eslint-disable */
// import type lookup before we augment - in some environments
// this is required to allow for ambient/previous definitions
import '@polkadot/api-base/types/calls';
import type { ApiTypes, AugmentedCall, DecoratedCallBase } from '@polkadot/api-base/types'; import type { ApiTypes, AugmentedCall, DecoratedCallBase } from '@polkadot/api-base/types';
import type { Bytes, Null, Option, Result, Vec, u32, u64 } from '@polkadot/types-codec'; import type { Bytes, Null, Option, Result, Vec, u32, u64 } from '@polkadot/types-codec';
import type { AnyNumber, ITuple } from '@polkadot/types-codec/types'; import type { AnyNumber, ITuple } from '@polkadot/types-codec/types';
@@ -24,7 +28,7 @@ export type __AugmentedCall<ApiType extends ApiTypes> = AugmentedCall<ApiType>;
export type __DecoratedCallBase<ApiType extends ApiTypes> = DecoratedCallBase<ApiType>; export type __DecoratedCallBase<ApiType extends ApiTypes> = DecoratedCallBase<ApiType>;
declare module '@polkadot/api-base/types/calls' { declare module '@polkadot/api-base/types/calls' {
export interface AugmentedCalls<ApiType extends ApiTypes> { interface AugmentedCalls<ApiType extends ApiTypes> {
/** 0xbc9d89904f5b923f/1 */ /** 0xbc9d89904f5b923f/1 */
accountNonceApi: { accountNonceApi: {
/** /**
@@ -106,7 +110,7 @@ declare module '@polkadot/api-base/types/calls' {
/** /**
* Perform a call from a specified account to a given contract. * Perform a call from a specified account to a given contract.
**/ **/
call: AugmentedCall<ApiType, (origin: AccountId | string | Uint8Array, dest: AccountId | string | Uint8Array, value: Balance | AnyNumber | Uint8Array, gasLimit: u64 | AnyNumber | Uint8Array, storageDepositLimit: Option<Balance> | null | object | string | Uint8Array, inputData: Bytes | string | Uint8Array) => Observable<ContractExecResult>>; call: AugmentedCall<ApiType, (origin: AccountId | string | Uint8Array, dest: AccountId | string | Uint8Array, value: Balance | AnyNumber | Uint8Array, gasLimit: u64 | AnyNumber | Uint8Array, storageDepositLimit: Option<Balance> | null | Uint8Array | Balance | AnyNumber, inputData: Bytes | string | Uint8Array) => Observable<ContractExecResult>>;
/** /**
* Query a given storage key in a given contract. * Query a given storage key in a given contract.
**/ **/
@@ -114,11 +118,11 @@ declare module '@polkadot/api-base/types/calls' {
/** /**
* Instantiate a new contract. * Instantiate a new contract.
**/ **/
instantiate: AugmentedCall<ApiType, (origin: AccountId | string | Uint8Array, value: Balance | AnyNumber | Uint8Array, gasLimit: u64 | AnyNumber | Uint8Array, storageDepositLimit: Option<Balance> | null | object | string | Uint8Array, code: Bytes | string | Uint8Array, data: Bytes | string | Uint8Array, salt: Bytes | string | Uint8Array) => Observable<ContractInstantiateResult>>; instantiate: AugmentedCall<ApiType, (origin: AccountId | string | Uint8Array, value: Balance | AnyNumber | Uint8Array, gasLimit: u64 | AnyNumber | Uint8Array, storageDepositLimit: Option<Balance> | null | Uint8Array | Balance | AnyNumber, code: Bytes | string | Uint8Array, data: Bytes | string | Uint8Array, salt: Bytes | string | Uint8Array) => Observable<ContractInstantiateResult>>;
/** /**
* Upload new code without instantiating a contract from it. * Upload new code without instantiating a contract from it.
**/ **/
uploadCode: AugmentedCall<ApiType, (origin: AccountId | string | Uint8Array, code: Bytes | string | Uint8Array, storageDepositLimit: Option<Balance> | null | object | string | Uint8Array) => Observable<CodeUploadResult>>; uploadCode: AugmentedCall<ApiType, (origin: AccountId | string | Uint8Array, code: Bytes | string | Uint8Array, storageDepositLimit: Option<Balance> | null | Uint8Array | Balance | AnyNumber) => Observable<CodeUploadResult>>;
/** /**
* Generic call * Generic call
**/ **/
@@ -232,7 +236,7 @@ declare module '@polkadot/api-base/types/calls' {
/** /**
* Generate a set of session keys with optionally using the given seed. * Generate a set of session keys with optionally using the given seed.
**/ **/
generateSessionKeys: AugmentedCall<ApiType, (seed: Option<Bytes> | null | object | string | Uint8Array) => Observable<Bytes>>; generateSessionKeys: AugmentedCall<ApiType, (seed: Option<Bytes> | null | Uint8Array | Bytes | string) => Observable<Bytes>>;
/** /**
* Generic call * Generic call
**/ **/
+72 -30
View File
@@ -1,6 +1,10 @@
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit // Auto-generated via `yarn polkadot-types-from-chain`, do not edit
/* eslint-disable */ /* eslint-disable */
// import type lookup before we augment - in some environments
// this is required to allow for ambient/previous definitions
import '@polkadot/api-base/types/submittable';
import type { ApiTypes, AugmentedSubmittable, SubmittableExtrinsic, SubmittableExtrinsicFunction } from '@polkadot/api-base/types'; import type { ApiTypes, AugmentedSubmittable, SubmittableExtrinsic, SubmittableExtrinsicFunction } from '@polkadot/api-base/types';
import type { Data } from '@polkadot/types'; import type { Data } from '@polkadot/types';
import type { Bytes, Compact, Option, U8aFixed, Vec, WrapperKeepOpaque, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec'; import type { Bytes, Compact, Option, U8aFixed, Vec, WrapperKeepOpaque, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
@@ -13,7 +17,7 @@ export type __SubmittableExtrinsic<ApiType extends ApiTypes> = SubmittableExtrin
export type __SubmittableExtrinsicFunction<ApiType extends ApiTypes> = SubmittableExtrinsicFunction<ApiType>; export type __SubmittableExtrinsicFunction<ApiType extends ApiTypes> = SubmittableExtrinsicFunction<ApiType>;
declare module '@polkadot/api-base/types/submittable' { declare module '@polkadot/api-base/types/submittable' {
export interface AugmentedSubmittables<ApiType extends ApiTypes> { interface AugmentedSubmittables<ApiType extends ApiTypes> {
alliance: { alliance: {
/** /**
* Add accounts or websites to the list of unscrupulous items. * Add accounts or websites to the list of unscrupulous items.
@@ -223,7 +227,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - 1 storage write (codec `O(1)`) for deleting the old `prime` and setting the new one * - 1 storage write (codec `O(1)`) for deleting the old `prime` and setting the new one
* # </weight> * # </weight>
**/ **/
setMembers: AugmentedSubmittable<(newMembers: Vec<AccountId32> | (AccountId32 | string | Uint8Array)[], prime: Option<AccountId32> | null | object | string | Uint8Array, oldCount: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Vec<AccountId32>, Option<AccountId32>, u32]>; setMembers: AugmentedSubmittable<(newMembers: Vec<AccountId32> | (AccountId32 | string | Uint8Array)[], prime: Option<AccountId32> | null | Uint8Array | AccountId32 | string, oldCount: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Vec<AccountId32>, Option<AccountId32>, u32]>;
/** /**
* Add an aye or nay vote for the sender to the given proposal. * Add an aye or nay vote for the sender to the given proposal.
* *
@@ -1155,7 +1159,7 @@ declare module '@polkadot/api-base/types/submittable' {
* * If no account exists and the call value is not less than `existential_deposit`, * * If no account exists and the call value is not less than `existential_deposit`,
* a regular account will be created and any value will be transferred. * a regular account will be created and any value will be transferred.
**/ **/
call: AugmentedSubmittable<(dest: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact<u128> | AnyNumber | Uint8Array, gasLimit: Compact<u64> | AnyNumber | Uint8Array, storageDepositLimit: Option<Compact<u128>> | null | object | string | Uint8Array, data: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, Compact<u128>, Compact<u64>, Option<Compact<u128>>, Bytes]>; call: AugmentedSubmittable<(dest: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact<u128> | AnyNumber | Uint8Array, gasLimit: Compact<u64> | AnyNumber | Uint8Array, storageDepositLimit: Option<Compact<u128>> | null | Uint8Array | Compact<u128> | AnyNumber, data: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, Compact<u128>, Compact<u64>, Option<Compact<u128>>, Bytes]>;
/** /**
* Instantiates a contract from a previously deployed wasm binary. * Instantiates a contract from a previously deployed wasm binary.
* *
@@ -1163,7 +1167,7 @@ declare module '@polkadot/api-base/types/submittable' {
* code deployment step. Instead, the `code_hash` of an on-chain deployed wasm binary * code deployment step. Instead, the `code_hash` of an on-chain deployed wasm binary
* must be supplied. * must be supplied.
**/ **/
instantiate: AugmentedSubmittable<(value: Compact<u128> | AnyNumber | Uint8Array, gasLimit: Compact<u64> | AnyNumber | Uint8Array, storageDepositLimit: Option<Compact<u128>> | null | object | string | Uint8Array, codeHash: H256 | string | Uint8Array, data: Bytes | string | Uint8Array, salt: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u128>, Compact<u64>, Option<Compact<u128>>, H256, Bytes, Bytes]>; instantiate: AugmentedSubmittable<(value: Compact<u128> | AnyNumber | Uint8Array, gasLimit: Compact<u64> | AnyNumber | Uint8Array, storageDepositLimit: Option<Compact<u128>> | null | Uint8Array | Compact<u128> | AnyNumber, codeHash: H256 | string | Uint8Array, data: Bytes | string | Uint8Array, salt: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u128>, Compact<u64>, Option<Compact<u128>>, H256, Bytes, Bytes]>;
/** /**
* Instantiates a new contract from the supplied `code` optionally transferring * Instantiates a new contract from the supplied `code` optionally transferring
* some balance. * some balance.
@@ -1192,7 +1196,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - The `value` is transferred to the new account. * - The `value` is transferred to the new account.
* - The `deploy` function is executed in the context of the newly-created account. * - The `deploy` function is executed in the context of the newly-created account.
**/ **/
instantiateWithCode: AugmentedSubmittable<(value: Compact<u128> | AnyNumber | Uint8Array, gasLimit: Compact<u64> | AnyNumber | Uint8Array, storageDepositLimit: Option<Compact<u128>> | null | object | string | Uint8Array, code: Bytes | string | Uint8Array, data: Bytes | string | Uint8Array, salt: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u128>, Compact<u64>, Option<Compact<u128>>, Bytes, Bytes, Bytes]>; instantiateWithCode: AugmentedSubmittable<(value: Compact<u128> | AnyNumber | Uint8Array, gasLimit: Compact<u64> | AnyNumber | Uint8Array, storageDepositLimit: Option<Compact<u128>> | null | Uint8Array | Compact<u128> | AnyNumber, code: Bytes | string | Uint8Array, data: Bytes | string | Uint8Array, salt: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u128>, Compact<u64>, Option<Compact<u128>>, Bytes, Bytes, Bytes]>;
/** /**
* Remove the code stored under `code_hash` and refund the deposit to its owner. * Remove the code stored under `code_hash` and refund the deposit to its owner.
* *
@@ -1231,7 +1235,7 @@ declare module '@polkadot/api-base/types/submittable' {
* only be instantiated by permissioned entities. The same is true when uploading * only be instantiated by permissioned entities. The same is true when uploading
* through [`Self::instantiate_with_code`]. * through [`Self::instantiate_with_code`].
**/ **/
uploadCode: AugmentedSubmittable<(code: Bytes | string | Uint8Array, storageDepositLimit: Option<Compact<u128>> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes, Option<Compact<u128>>]>; uploadCode: AugmentedSubmittable<(code: Bytes | string | Uint8Array, storageDepositLimit: Option<Compact<u128>> | null | Uint8Array | Compact<u128> | AnyNumber) => SubmittableExtrinsic<ApiType>, [Bytes, Option<Compact<u128>>]>;
/** /**
* Generic tx * Generic tx
**/ **/
@@ -1314,7 +1318,7 @@ declare module '@polkadot/api-base/types/submittable' {
* Weight: `O(R + log R)` where R is the number of polls that `target` has voted on. * Weight: `O(R + log R)` where R is the number of polls that `target` has voted on.
* Weight is calculated for the maximum number of vote. * Weight is calculated for the maximum number of vote.
**/ **/
removeVote: AugmentedSubmittable<(clazz: Option<u16> | null | object | string | Uint8Array, index: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Option<u16>, u32]>; removeVote: AugmentedSubmittable<(clazz: Option<u16> | null | Uint8Array | u16 | AnyNumber, index: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Option<u16>, u32]>;
/** /**
* Undelegate the voting power of the sending account for a particular class of polls. * Undelegate the voting power of the sending account for a particular class of polls.
* *
@@ -1492,7 +1496,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - 1 storage write (codec `O(1)`) for deleting the old `prime` and setting the new one * - 1 storage write (codec `O(1)`) for deleting the old `prime` and setting the new one
* # </weight> * # </weight>
**/ **/
setMembers: AugmentedSubmittable<(newMembers: Vec<AccountId32> | (AccountId32 | string | Uint8Array)[], prime: Option<AccountId32> | null | object | string | Uint8Array, oldCount: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Vec<AccountId32>, Option<AccountId32>, u32]>; setMembers: AugmentedSubmittable<(newMembers: Vec<AccountId32> | (AccountId32 | string | Uint8Array)[], prime: Option<AccountId32> | null | Uint8Array | AccountId32 | string, oldCount: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Vec<AccountId32>, Option<AccountId32>, u32]>;
/** /**
* Add an aye or nay vote for the sender to the given proposal. * Add an aye or nay vote for the sender to the given proposal.
* *
@@ -1534,7 +1538,7 @@ declare module '@polkadot/api-base/types/submittable' {
* Weight: `O(p)` (though as this is an high-privilege dispatch, we assume it has a * Weight: `O(p)` (though as this is an high-privilege dispatch, we assume it has a
* reasonable value). * reasonable value).
**/ **/
blacklist: AugmentedSubmittable<(proposalHash: H256 | string | Uint8Array, maybeRefIndex: Option<u32> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [H256, Option<u32>]>; blacklist: AugmentedSubmittable<(proposalHash: H256 | string | Uint8Array, maybeRefIndex: Option<u32> | null | Uint8Array | u32 | AnyNumber) => SubmittableExtrinsic<ApiType>, [H256, Option<u32>]>;
/** /**
* Remove a proposal. * Remove a proposal.
* *
@@ -1860,7 +1864,7 @@ declare module '@polkadot/api-base/types/submittable' {
* This can only be called when [`Phase::Emergency`] is enabled, as an alternative to * This can only be called when [`Phase::Emergency`] is enabled, as an alternative to
* calling [`Call::set_emergency_election_result`]. * calling [`Call::set_emergency_election_result`].
**/ **/
governanceFallback: AugmentedSubmittable<(maybeMaxVoters: Option<u32> | null | object | string | Uint8Array, maybeMaxTargets: Option<u32> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Option<u32>, Option<u32>]>; governanceFallback: AugmentedSubmittable<(maybeMaxVoters: Option<u32> | null | Uint8Array | u32 | AnyNumber, maybeMaxTargets: Option<u32> | null | Uint8Array | u32 | AnyNumber) => SubmittableExtrinsic<ApiType>, [Option<u32>, Option<u32>]>;
/** /**
* Set a solution in the queue, to be handed out to the client of this pallet in the next * Set a solution in the queue, to be handed out to the client of this pallet in the next
* call to `ElectionProvider::elect`. * call to `ElectionProvider::elect`.
@@ -1879,7 +1883,7 @@ declare module '@polkadot/api-base/types/submittable' {
* *
* This check can be turned off by setting the value to `None`. * This check can be turned off by setting the value to `None`.
**/ **/
setMinimumUntrustedScore: AugmentedSubmittable<(maybeNextScore: Option<SpNposElectionsElectionScore> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Option<SpNposElectionsElectionScore>]>; setMinimumUntrustedScore: AugmentedSubmittable<(maybeNextScore: Option<SpNposElectionsElectionScore> | null | Uint8Array | SpNposElectionsElectionScore | { minimalStake?: any; sumStake?: any; sumStakeSquared?: any } | string) => SubmittableExtrinsic<ApiType>, [Option<SpNposElectionsElectionScore>]>;
/** /**
* Submit a solution for the signed phase. * Submit a solution for the signed phase.
* *
@@ -1933,7 +1937,11 @@ declare module '@polkadot/api-base/types/submittable' {
* the outgoing member is slashed. * the outgoing member is slashed.
* *
* If a runner-up is available, then the best runner-up will be removed and replaces the * If a runner-up is available, then the best runner-up will be removed and replaces the
* outgoing member. Otherwise, a new phragmen election is started. * outgoing member. Otherwise, if `rerun_election` is `true`, a new phragmen election is
* started, else, nothing happens.
*
* If `slash_bond` is set to true, the bond of the member being removed is slashed. Else,
* it is returned.
* *
* The dispatch origin of this call must be root. * The dispatch origin of this call must be root.
* *
@@ -1944,7 +1952,7 @@ declare module '@polkadot/api-base/types/submittable' {
* will go into phragmen, we assume full block for now. * will go into phragmen, we assume full block for now.
* # </weight> * # </weight>
**/ **/
removeMember: AugmentedSubmittable<(who: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, hasReplacement: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, bool]>; removeMember: AugmentedSubmittable<(who: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, slashBond: bool | boolean | Uint8Array, rerunElection: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, bool, bool]>;
/** /**
* Remove `origin` as a voter. * Remove `origin` as a voter.
* *
@@ -2602,7 +2610,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - Write: Multisig Storage, [Caller Account] * - Write: Multisig Storage, [Caller Account]
* # </weight> * # </weight>
**/ **/
approveAsMulti: AugmentedSubmittable<(threshold: u16 | AnyNumber | Uint8Array, otherSignatories: Vec<AccountId32> | (AccountId32 | string | Uint8Array)[], maybeTimepoint: Option<PalletMultisigTimepoint> | null | object | string | Uint8Array, callHash: U8aFixed | string | Uint8Array, maxWeight: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u16, Vec<AccountId32>, Option<PalletMultisigTimepoint>, U8aFixed, u64]>; approveAsMulti: AugmentedSubmittable<(threshold: u16 | AnyNumber | Uint8Array, otherSignatories: Vec<AccountId32> | (AccountId32 | string | Uint8Array)[], maybeTimepoint: Option<PalletMultisigTimepoint> | null | Uint8Array | PalletMultisigTimepoint | { height?: any; index?: any } | string, callHash: U8aFixed | string | Uint8Array, maxWeight: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u16, Vec<AccountId32>, Option<PalletMultisigTimepoint>, U8aFixed, u64]>;
/** /**
* Register approval for a dispatch to be made from a deterministic composite account if * Register approval for a dispatch to be made from a deterministic composite account if
* approved by a total of `threshold - 1` of `other_signatories`. * approved by a total of `threshold - 1` of `other_signatories`.
@@ -2650,7 +2658,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - Plus Call Weight * - Plus Call Weight
* # </weight> * # </weight>
**/ **/
asMulti: AugmentedSubmittable<(threshold: u16 | AnyNumber | Uint8Array, otherSignatories: Vec<AccountId32> | (AccountId32 | string | Uint8Array)[], maybeTimepoint: Option<PalletMultisigTimepoint> | null | object | string | Uint8Array, call: WrapperKeepOpaque<Call> | object | string | Uint8Array, storeCall: bool | boolean | Uint8Array, maxWeight: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u16, Vec<AccountId32>, Option<PalletMultisigTimepoint>, WrapperKeepOpaque<Call>, bool, u64]>; asMulti: AugmentedSubmittable<(threshold: u16 | AnyNumber | Uint8Array, otherSignatories: Vec<AccountId32> | (AccountId32 | string | Uint8Array)[], maybeTimepoint: Option<PalletMultisigTimepoint> | null | Uint8Array | PalletMultisigTimepoint | { height?: any; index?: any } | string, call: WrapperKeepOpaque<Call> | object | string | Uint8Array, storeCall: bool | boolean | Uint8Array, maxWeight: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u16, Vec<AccountId32>, Option<PalletMultisigTimepoint>, WrapperKeepOpaque<Call>, bool, u64]>;
/** /**
* Immediately dispatch a multi-signature call using a single approval from the caller. * Immediately dispatch a multi-signature call using a single approval from the caller.
* *
@@ -2710,6 +2718,8 @@ declare module '@polkadot/api-base/types/submittable' {
* *
* Additional funds can come from either the free balance of the account, of from the * Additional funds can come from either the free balance of the account, of from the
* accumulated rewards, see [`BondExtra`]. * accumulated rewards, see [`BondExtra`].
*
* Bonding extra funds implies an automatic payout of all pending rewards as well.
**/ **/
bondExtra: AugmentedSubmittable<(extra: PalletNominationPoolsBondExtra | { FreeBalance: any } | { Rewards: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [PalletNominationPoolsBondExtra]>; bondExtra: AugmentedSubmittable<(extra: PalletNominationPoolsBondExtra | { FreeBalance: any } | { Rewards: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [PalletNominationPoolsBondExtra]>;
/** /**
@@ -2806,8 +2816,14 @@ declare module '@polkadot/api-base/types/submittable' {
/** /**
* Set a new state for the pool. * Set a new state for the pool.
* *
* The dispatch origin of this call must be signed by the state toggler, or the root role * If a pool is already in the `Destroying` state, then under no condition can its state
* of the pool. * change again.
*
* The dispatch origin of this call must be either:
*
* 1. signed by the state toggler, or the root role of the pool,
* 2. if the pool conditions to be open are NOT met (as described by `ok_to_be_open`), and
* then the state of the pool can be permissionlessly changed to `Destroying`.
**/ **/
setState: AugmentedSubmittable<(poolId: u32 | AnyNumber | Uint8Array, state: PalletNominationPoolsPoolState | 'Open' | 'Blocked' | 'Destroying' | number | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletNominationPoolsPoolState]>; setState: AugmentedSubmittable<(poolId: u32 | AnyNumber | Uint8Array, state: PalletNominationPoolsPoolState | 'Open' | 'Blocked' | 'Destroying' | number | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletNominationPoolsPoolState]>;
/** /**
@@ -3015,7 +3031,7 @@ declare module '@polkadot/api-base/types/submittable' {
* Weight is a function of the number of proxies the user has (P). * Weight is a function of the number of proxies the user has (P).
* # </weight> * # </weight>
**/ **/
proxy: AugmentedSubmittable<(real: AccountId32 | string | Uint8Array, forceProxyType: Option<NodeRuntimeProxyType> | null | object | string | Uint8Array, call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, Option<NodeRuntimeProxyType>, Call]>; proxy: AugmentedSubmittable<(real: AccountId32 | string | Uint8Array, forceProxyType: Option<NodeRuntimeProxyType> | null | Uint8Array | NodeRuntimeProxyType | 'Any' | 'NonTransfer' | 'Governance' | 'Staking' | number, call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, Option<NodeRuntimeProxyType>, Call]>;
/** /**
* Dispatch the given `call` from an account that the sender is authorized for through * Dispatch the given `call` from an account that the sender is authorized for through
* `add_proxy`. * `add_proxy`.
@@ -3035,7 +3051,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - P: the number of proxies the user has. * - P: the number of proxies the user has.
* # </weight> * # </weight>
**/ **/
proxyAnnounced: AugmentedSubmittable<(delegate: AccountId32 | string | Uint8Array, real: AccountId32 | string | Uint8Array, forceProxyType: Option<NodeRuntimeProxyType> | null | object | string | Uint8Array, call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, AccountId32, Option<NodeRuntimeProxyType>, Call]>; proxyAnnounced: AugmentedSubmittable<(delegate: AccountId32 | string | Uint8Array, real: AccountId32 | string | Uint8Array, forceProxyType: Option<NodeRuntimeProxyType> | null | Uint8Array | NodeRuntimeProxyType | 'Any' | 'NonTransfer' | 'Governance' | 'Staking' | number, call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, AccountId32, Option<NodeRuntimeProxyType>, Call]>;
/** /**
* Remove the given announcement of a delegate. * Remove the given announcement of a delegate.
* *
@@ -3478,7 +3494,7 @@ declare module '@polkadot/api-base/types/submittable' {
/** /**
* Anonymously schedule a task. * Anonymously schedule a task.
**/ **/
schedule: AugmentedSubmittable<(when: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | object | string | Uint8Array, priority: u8 | AnyNumber | Uint8Array, call: FrameSupportScheduleMaybeHashed | { Value: any } | { Hash: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, Option<ITuple<[u32, u32]>>, u8, FrameSupportScheduleMaybeHashed]>; schedule: AugmentedSubmittable<(when: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | Uint8Array | ITuple<[u32, u32]> | [u32 | AnyNumber | Uint8Array, u32 | AnyNumber | Uint8Array], priority: u8 | AnyNumber | Uint8Array, call: FrameSupportScheduleMaybeHashed | { Value: any } | { Hash: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, Option<ITuple<[u32, u32]>>, u8, FrameSupportScheduleMaybeHashed]>;
/** /**
* Anonymously schedule a task after a delay. * Anonymously schedule a task after a delay.
* *
@@ -3486,11 +3502,11 @@ declare module '@polkadot/api-base/types/submittable' {
* Same as [`schedule`]. * Same as [`schedule`].
* # </weight> * # </weight>
**/ **/
scheduleAfter: AugmentedSubmittable<(after: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | object | string | Uint8Array, priority: u8 | AnyNumber | Uint8Array, call: FrameSupportScheduleMaybeHashed | { Value: any } | { Hash: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, Option<ITuple<[u32, u32]>>, u8, FrameSupportScheduleMaybeHashed]>; scheduleAfter: AugmentedSubmittable<(after: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | Uint8Array | ITuple<[u32, u32]> | [u32 | AnyNumber | Uint8Array, u32 | AnyNumber | Uint8Array], priority: u8 | AnyNumber | Uint8Array, call: FrameSupportScheduleMaybeHashed | { Value: any } | { Hash: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, Option<ITuple<[u32, u32]>>, u8, FrameSupportScheduleMaybeHashed]>;
/** /**
* Schedule a named task. * Schedule a named task.
**/ **/
scheduleNamed: AugmentedSubmittable<(id: Bytes | string | Uint8Array, when: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | object | string | Uint8Array, priority: u8 | AnyNumber | Uint8Array, call: FrameSupportScheduleMaybeHashed | { Value: any } | { Hash: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes, u32, Option<ITuple<[u32, u32]>>, u8, FrameSupportScheduleMaybeHashed]>; scheduleNamed: AugmentedSubmittable<(id: Bytes | string | Uint8Array, when: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | Uint8Array | ITuple<[u32, u32]> | [u32 | AnyNumber | Uint8Array, u32 | AnyNumber | Uint8Array], priority: u8 | AnyNumber | Uint8Array, call: FrameSupportScheduleMaybeHashed | { Value: any } | { Hash: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes, u32, Option<ITuple<[u32, u32]>>, u8, FrameSupportScheduleMaybeHashed]>;
/** /**
* Schedule a named task after a delay. * Schedule a named task after a delay.
* *
@@ -3498,7 +3514,7 @@ declare module '@polkadot/api-base/types/submittable' {
* Same as [`schedule_named`](Self::schedule_named). * Same as [`schedule_named`](Self::schedule_named).
* # </weight> * # </weight>
**/ **/
scheduleNamedAfter: AugmentedSubmittable<(id: Bytes | string | Uint8Array, after: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | object | string | Uint8Array, priority: u8 | AnyNumber | Uint8Array, call: FrameSupportScheduleMaybeHashed | { Value: any } | { Hash: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes, u32, Option<ITuple<[u32, u32]>>, u8, FrameSupportScheduleMaybeHashed]>; scheduleNamedAfter: AugmentedSubmittable<(id: Bytes | string | Uint8Array, after: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | Uint8Array | ITuple<[u32, u32]> | [u32 | AnyNumber | Uint8Array, u32 | AnyNumber | Uint8Array], priority: u8 | AnyNumber | Uint8Array, call: FrameSupportScheduleMaybeHashed | { Value: any } | { Hash: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes, u32, Option<ITuple<[u32, u32]>>, u8, FrameSupportScheduleMaybeHashed]>;
/** /**
* Generic tx * Generic tx
**/ **/
@@ -4306,7 +4322,7 @@ declare module '@polkadot/api-base/types/submittable' {
* *
* The dispatch origin of this call must be [`Config::ControlOrigin`]. * The dispatch origin of this call must be [`Config::ControlOrigin`].
**/ **/
controlAutoMigration: AugmentedSubmittable<(maybeConfig: Option<PalletStateTrieMigrationMigrationLimits> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Option<PalletStateTrieMigrationMigrationLimits>]>; controlAutoMigration: AugmentedSubmittable<(maybeConfig: Option<PalletStateTrieMigrationMigrationLimits> | null | Uint8Array | PalletStateTrieMigrationMigrationLimits | { size_?: any; item?: any } | string) => SubmittableExtrinsic<ApiType>, [Option<PalletStateTrieMigrationMigrationLimits>]>;
/** /**
* Forcefully set the progress the running migration. * Forcefully set the progress the running migration.
* *
@@ -4602,7 +4618,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - 1 storage write (codec `O(1)`) for deleting the old `prime` and setting the new one * - 1 storage write (codec `O(1)`) for deleting the old `prime` and setting the new one
* # </weight> * # </weight>
**/ **/
setMembers: AugmentedSubmittable<(newMembers: Vec<AccountId32> | (AccountId32 | string | Uint8Array)[], prime: Option<AccountId32> | null | object | string | Uint8Array, oldCount: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Vec<AccountId32>, Option<AccountId32>, u32]>; setMembers: AugmentedSubmittable<(newMembers: Vec<AccountId32> | (AccountId32 | string | Uint8Array)[], prime: Option<AccountId32> | null | Uint8Array | AccountId32 | string, oldCount: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Vec<AccountId32>, Option<AccountId32>, u32]>;
/** /**
* Add an aye or nay vote for the sender to the given proposal. * Add an aye or nay vote for the sender to the given proposal.
* *
@@ -4978,7 +4994,19 @@ declare module '@polkadot/api-base/types/submittable' {
* Weight: `O(1)` * Weight: `O(1)`
* Modes: `check_owner.is_some()`. * Modes: `check_owner.is_some()`.
**/ **/
burn: AugmentedSubmittable<(collection: u32 | AnyNumber | Uint8Array, item: u32 | AnyNumber | Uint8Array, checkOwner: Option<MultiAddress> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32, Option<MultiAddress>]>; burn: AugmentedSubmittable<(collection: u32 | AnyNumber | Uint8Array, item: u32 | AnyNumber | Uint8Array, checkOwner: Option<MultiAddress> | null | Uint8Array | MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string) => SubmittableExtrinsic<ApiType>, [u32, u32, Option<MultiAddress>]>;
/**
* Allows to buy an item if it's up for sale.
*
* Origin must be Signed and must not be the owner of the `item`.
*
* - `collection`: The collection of the item.
* - `item`: The item the sender wants to buy.
* - `bid_price`: The price the sender is willing to pay.
*
* Emits `ItemBought` on success.
**/
buyItem: AugmentedSubmittable<(collection: u32 | AnyNumber | Uint8Array, item: u32 | AnyNumber | Uint8Array, bidPrice: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32, u128]>;
/** /**
* Cancel the prior approval for the transfer of an item by a delegate. * Cancel the prior approval for the transfer of an item by a delegate.
* *
@@ -4997,7 +5025,7 @@ declare module '@polkadot/api-base/types/submittable' {
* *
* Weight: `O(1)` * Weight: `O(1)`
**/ **/
cancelApproval: AugmentedSubmittable<(collection: u32 | AnyNumber | Uint8Array, item: u32 | AnyNumber | Uint8Array, maybeCheckDelegate: Option<MultiAddress> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32, Option<MultiAddress>]>; cancelApproval: AugmentedSubmittable<(collection: u32 | AnyNumber | Uint8Array, item: u32 | AnyNumber | Uint8Array, maybeCheckDelegate: Option<MultiAddress> | null | Uint8Array | MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string) => SubmittableExtrinsic<ApiType>, [u32, u32, Option<MultiAddress>]>;
/** /**
* Clear an attribute for a collection or item. * Clear an attribute for a collection or item.
* *
@@ -5014,7 +5042,7 @@ declare module '@polkadot/api-base/types/submittable' {
* *
* Weight: `O(1)` * Weight: `O(1)`
**/ **/
clearAttribute: AugmentedSubmittable<(collection: u32 | AnyNumber | Uint8Array, maybeItem: Option<u32> | null | object | string | Uint8Array, key: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, Option<u32>, Bytes]>; clearAttribute: AugmentedSubmittable<(collection: u32 | AnyNumber | Uint8Array, maybeItem: Option<u32> | null | Uint8Array | u32 | AnyNumber, key: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, Option<u32>, Bytes]>;
/** /**
* Clear the metadata for a collection. * Clear the metadata for a collection.
* *
@@ -5193,7 +5221,7 @@ declare module '@polkadot/api-base/types/submittable' {
* *
* Emits `OwnershipAcceptanceChanged`. * Emits `OwnershipAcceptanceChanged`.
**/ **/
setAcceptOwnership: AugmentedSubmittable<(maybeCollection: Option<u32> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Option<u32>]>; setAcceptOwnership: AugmentedSubmittable<(maybeCollection: Option<u32> | null | Uint8Array | u32 | AnyNumber) => SubmittableExtrinsic<ApiType>, [Option<u32>]>;
/** /**
* Set an attribute for a collection or item. * Set an attribute for a collection or item.
* *
@@ -5213,7 +5241,7 @@ declare module '@polkadot/api-base/types/submittable' {
* *
* Weight: `O(1)` * Weight: `O(1)`
**/ **/
setAttribute: AugmentedSubmittable<(collection: u32 | AnyNumber | Uint8Array, maybeItem: Option<u32> | null | object | string | Uint8Array, key: Bytes | string | Uint8Array, value: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, Option<u32>, Bytes, Bytes]>; setAttribute: AugmentedSubmittable<(collection: u32 | AnyNumber | Uint8Array, maybeItem: Option<u32> | null | Uint8Array | u32 | AnyNumber, key: Bytes | string | Uint8Array, value: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, Option<u32>, Bytes, Bytes]>;
/** /**
* Set the maximum amount of items a collection could have. * Set the maximum amount of items a collection could have.
* *
@@ -5267,6 +5295,20 @@ declare module '@polkadot/api-base/types/submittable' {
* Weight: `O(1)` * Weight: `O(1)`
**/ **/
setMetadata: AugmentedSubmittable<(collection: u32 | AnyNumber | Uint8Array, item: u32 | AnyNumber | Uint8Array, data: Bytes | string | Uint8Array, isFrozen: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32, Bytes, bool]>; setMetadata: AugmentedSubmittable<(collection: u32 | AnyNumber | Uint8Array, item: u32 | AnyNumber | Uint8Array, data: Bytes | string | Uint8Array, isFrozen: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32, Bytes, bool]>;
/**
* Set (or reset) the price for an item.
*
* Origin must be Signed and must be the owner of the asset `item`.
*
* - `collection`: The collection of the item.
* - `item`: The item to set the price for.
* - `price`: The price for the item. Pass `None`, to reset the price.
* - `buyer`: Restricts the buy operation to a specific account.
*
* Emits `ItemPriceSet` on success if the price is not `None`.
* Emits `ItemPriceRemoved` on success if the price is `None`.
**/
setPrice: AugmentedSubmittable<(collection: u32 | AnyNumber | Uint8Array, item: u32 | AnyNumber | Uint8Array, price: Option<u128> | null | Uint8Array | u128 | AnyNumber, whitelistedBuyer: Option<MultiAddress> | null | Uint8Array | MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string) => SubmittableExtrinsic<ApiType>, [u32, u32, Option<u128>, Option<MultiAddress>]>;
/** /**
* Change the Issuer, Admin and Freezer of a collection. * Change the Issuer, Admin and Freezer of a collection.
* *
+5 -5
View File
@@ -20,13 +20,13 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "8.11.3", "version": "8.13.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.18.6", "@babel/runtime": "^7.18.6",
"@polkadot/rpc-core": "8.11.3", "@polkadot/rpc-core": "8.13.1",
"@polkadot/types": "8.11.3", "@polkadot/types": "8.13.1",
"@polkadot/util": "^9.7.2", "@polkadot/util": "^10.0.2",
"rxjs": "^7.5.5" "rxjs": "^7.5.6"
} }
} }
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/api-base', path: 'auto', type: 'auto', version: '8.11.3' }; export const packageInfo = { name: '@polkadot/api-base', path: 'auto', type: 'auto', version: '8.13.1' };
+10 -10
View File
@@ -20,20 +20,20 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "8.11.3", "version": "8.13.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.18.6", "@babel/runtime": "^7.18.6",
"@polkadot/api": "8.11.3", "@polkadot/api": "8.13.1",
"@polkadot/types": "8.11.3", "@polkadot/types": "8.13.1",
"@polkadot/types-codec": "8.11.3", "@polkadot/types-codec": "8.13.1",
"@polkadot/types-create": "8.11.3", "@polkadot/types-create": "8.13.1",
"@polkadot/util": "^9.7.2", "@polkadot/util": "^10.0.2",
"@polkadot/util-crypto": "^9.7.2", "@polkadot/util-crypto": "^10.0.2",
"rxjs": "^7.5.5" "rxjs": "^7.5.6"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/api-augment": "8.11.3", "@polkadot/api-augment": "8.13.1",
"@polkadot/keyring": "^9.7.2" "@polkadot/keyring": "^10.0.2"
} }
} }
+16 -6
View File
@@ -8,7 +8,7 @@ import type { AbiConstructor, AbiEvent, AbiMessage, AbiParam, DecodedEvent, Deco
import { TypeRegistry } from '@polkadot/types'; import { TypeRegistry } from '@polkadot/types';
import { TypeDefInfo } from '@polkadot/types-create'; import { TypeDefInfo } from '@polkadot/types-create';
import { assert, assertReturn, compactAddLength, compactStripLength, isNumber, isObject, isString, logger, stringCamelCase, stringify, u8aConcat, u8aToHex } from '@polkadot/util'; import { assertReturn, compactAddLength, compactStripLength, isNumber, isObject, isString, logger, stringCamelCase, stringify, u8aConcat, u8aToHex } from '@polkadot/util';
import { convertVersions, enumVersions } from './toLatest'; import { convertVersions, enumVersions } from './toLatest';
@@ -35,7 +35,9 @@ function getLatestMeta (registry: Registry, json: Record<string, unknown>): Cont
) as unknown as ContractMetadata; ) as unknown as ContractMetadata;
const converter = convertVersions.find(([v]) => metadata[`is${v}`]); const converter = convertVersions.find(([v]) => metadata[`is${v}`]);
assert(converter, () => `Unable to convert ABI with version ${metadata.type} to latest`); if (!converter) {
throw new Error(`Unable to convert ABI with version ${metadata.type} to latest`);
}
return converter[1](registry, metadata[`as${converter[0]}`]); return converter[1](registry, metadata[`as${converter[0]}`]);
} }
@@ -112,7 +114,9 @@ export class Abi {
const index = data[0]; const index = data[0];
const event = this.events[index]; const event = this.events[index];
assert(event, () => `Unable to find event with index ${index}`); if (!event) {
throw new Error(`Unable to find event with index ${index}`);
}
return event.fromU8a(data.subarray(1)); return event.fromU8a(data.subarray(1));
} }
@@ -142,7 +146,9 @@ export class Abi {
#createArgs = (args: ContractMessageParamSpecLatest[], spec: unknown): AbiParam[] => { #createArgs = (args: ContractMessageParamSpecLatest[], spec: unknown): AbiParam[] => {
return args.map(({ label, type }, index): AbiParam => { return args.map(({ label, type }, index): AbiParam => {
try { try {
assert(isObject(type), 'Invalid type definition found'); if (!isObject(type)) {
throw new Error('Invalid type definition found');
}
const displayName = type.displayName.length const displayName = type.displayName.length
? type.displayName[type.displayName.length - 1].toString() ? type.displayName[type.displayName.length - 1].toString()
@@ -233,13 +239,17 @@ export class Abi {
const selector = trimmed.subarray(0, 4); const selector = trimmed.subarray(0, 4);
const message = list.find((m) => m.selector.eq(selector)); const message = list.find((m) => m.selector.eq(selector));
assert(message, `Unable to find ${type} with selector ${u8aToHex(selector)}`); if (!message) {
throw new Error(`Unable to find ${type} with selector ${u8aToHex(selector)}`);
}
return message.fromU8a(trimmed.subarray(4)); return message.fromU8a(trimmed.subarray(4));
}; };
#encodeArgs = ({ label, selector }: ContractMessageSpecLatest | ContractConstructorSpecLatest, args: AbiParam[], data: unknown[]): Uint8Array => { #encodeArgs = ({ label, selector }: ContractMessageSpecLatest | ContractConstructorSpecLatest, args: AbiParam[], data: unknown[]): Uint8Array => {
assert(data.length === args.length, () => `Expected ${args.length} arguments to contract message '${label.toString()}', found ${data.length}`); if (data.length !== args.length) {
throw new Error(`Expected ${args.length} arguments to contract message '${label.toString()}', found ${data.length}`);
}
return compactAddLength( return compactAddLength(
u8aConcat( u8aConcat(
+8 -4
View File
@@ -5,7 +5,7 @@ import type { ApiTypes, DecorateMethod } from '@polkadot/api/types';
import type { Registry } from '@polkadot/types/types'; import type { Registry } from '@polkadot/types/types';
import { ApiBase } from '@polkadot/api/base'; import { ApiBase } from '@polkadot/api/base';
import { assert, isFunction } from '@polkadot/util'; import { isFunction } from '@polkadot/util';
import { Abi } from '../Abi'; import { Abi } from '../Abi';
@@ -24,9 +24,13 @@ export abstract class Base<ApiType extends ApiTypes> {
this._decorateMethod = decorateMethod; this._decorateMethod = decorateMethod;
assert(!!(api && api.isConnected && api.tx), 'Your API has not been initialized correctly and is not connected to a chain'); if (!api || !api.isConnected || !api.tx) {
assert(!!(api.tx.contracts && Object.keys(api.tx.contracts).length), 'You need to connect to a chain with a runtime that supports contracts'); throw new Error('Your API has not been initialized correctly and is not connected to a chain');
assert(isFunction(api.tx.contracts.instantiateWithCode), 'You need to connect to a chain with a runtime with a V3 contracts module. The runtime does not expose api.tx.contracts.instantiateWithCode'); } else if (!api.tx.contracts || !Object.keys(api.tx.contracts).length) {
throw new Error('You need to connect to a chain with a runtime that supports contracts');
} else if (!isFunction(api.tx.contracts.instantiateWithCode)) {
throw new Error('You need to connect to a chain with a runtime with a V3 contracts module. The runtime does not expose api.tx.contracts.instantiateWithCode');
}
} }
public get registry (): Registry { public get registry (): Registry {
+3 -3
View File
@@ -6,9 +6,9 @@ import path from 'path';
import { toPromiseMethod } from '@polkadot/api'; import { toPromiseMethod } from '@polkadot/api';
import v0contractFlipper from '../test/contracts/ink/v0/flipper.contract.json'; import v0contractFlipper from '../test/contracts/ink/v0/flipper.contract.json' assert { type: 'json' };
import v0abiFlipper from '../test/contracts/ink/v0/flipper.json'; import v0abiFlipper from '../test/contracts/ink/v0/flipper.json' assert { type: 'json' };
import v1contractFlipper from '../test/contracts/ink/v1/flipper.contract.json'; import v1contractFlipper from '../test/contracts/ink/v1/flipper.contract.json' assert { type: 'json' };
import { Code } from './Code'; import { Code } from './Code';
import { mockApi } from './mock'; import { mockApi } from './mock';
+4 -2
View File
@@ -11,7 +11,7 @@ import type { MapConstructorExec } from './types';
import { SubmittableResult } from '@polkadot/api'; import { SubmittableResult } from '@polkadot/api';
import { ApiBase } from '@polkadot/api/base'; import { ApiBase } from '@polkadot/api/base';
import { assert, BN_ZERO, compactAddLength, isUndefined, isWasm, u8aToU8a } from '@polkadot/util'; import { BN_ZERO, compactAddLength, isUndefined, isWasm, u8aToU8a } from '@polkadot/util';
import { Abi } from '../Abi'; import { Abi } from '../Abi';
import { applyOnEvent } from '../util'; import { applyOnEvent } from '../util';
@@ -48,7 +48,9 @@ export class Code<ApiType extends ApiTypes> extends Base<ApiType> {
? this.abi.info.source.wasm ? this.abi.info.source.wasm
: u8aToU8a(wasm); : u8aToU8a(wasm);
assert(isWasm(this.code), 'No WASM code provided'); if (!isWasm(this.code)) {
throw new Error('No WASM code provided');
}
this.abi.constructors.forEach((c): void => { this.abi.constructors.forEach((c): void => {
if (isUndefined(this.#tx[c.method])) { if (isUndefined(this.#tx[c.method])) {
+7 -3
View File
@@ -13,7 +13,7 @@ import { map } from 'rxjs';
import { SubmittableResult } from '@polkadot/api'; import { SubmittableResult } from '@polkadot/api';
import { ApiBase } from '@polkadot/api/base'; import { ApiBase } from '@polkadot/api/base';
import { assert, BN, BN_HUNDRED, BN_ONE, BN_ZERO, bnToBn, isFunction, isUndefined, logger } from '@polkadot/util'; import { BN, BN_HUNDRED, BN_ONE, BN_ZERO, bnToBn, isFunction, isUndefined, logger } from '@polkadot/util';
import { Abi } from '../Abi'; import { Abi } from '../Abi';
import { applyOnEvent, extractOptions, isOptions } from '../util'; import { applyOnEvent, extractOptions, isOptions } from '../util';
@@ -87,7 +87,9 @@ export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
} }
public get query (): MapMessageQuery<ApiType> { public get query (): MapMessageQuery<ApiType> {
assert(this.hasRpcContractsCall, ERROR_NO_CALL); if (!this.hasRpcContractsCall) {
throw new Error(ERROR_NO_CALL);
}
return this.#query; return this.#query;
} }
@@ -138,7 +140,9 @@ export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
}; };
#read = (messageOrId: AbiMessage | string | number, { gasLimit = BN_ZERO, storageDepositLimit = null, value = BN_ZERO }: ContractOptions, params: unknown[]): ContractCallSend<ApiType> => { #read = (messageOrId: AbiMessage | string | number, { gasLimit = BN_ZERO, storageDepositLimit = null, value = BN_ZERO }: ContractOptions, params: unknown[]): ContractCallSend<ApiType> => {
assert(this.hasRpcContractsCall, ERROR_NO_CALL); if (!this.hasRpcContractsCall) {
throw new Error(ERROR_NO_CALL);
}
const message = this.abi.findMessage(messageOrId); const message = this.abi.findMessage(messageOrId);
@@ -9,7 +9,7 @@ import { ApiPromise } from '@polkadot/api';
import { BlueprintPromise, ContractPromise } from '@polkadot/api-contract'; import { BlueprintPromise, ContractPromise } from '@polkadot/api-contract';
import { createTestPairs, TestKeyringMap } from '@polkadot/keyring/testingPairs'; import { createTestPairs, TestKeyringMap } from '@polkadot/keyring/testingPairs';
import abiIncrementer from './test/contracts/ink/v0/incrementer.json'; import abiIncrementer from './test/contracts/ink/v0/incrementer.json' assert { type: 'json' };
async function checkBlueprint (api: ApiPromise, pairs: TestKeyringMap): Promise<void> { async function checkBlueprint (api: ApiPromise, pairs: TestKeyringMap): Promise<void> {
const blueprint = new BlueprintPromise(api, abiIncrementer as Record<string, unknown>, '0x1234'); const blueprint = new BlueprintPromise(api, abiIncrementer as Record<string, unknown>, '0x1234');
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/api-contract', path: 'auto', type: 'auto', version: '8.11.3' }; export const packageInfo = { name: '@polkadot/api-contract', path: 'auto', type: 'auto', version: '8.13.1' };
@@ -1,11 +1,11 @@
// Copyright 2017-2022 @polkadot/api-contract authors & contributors // Copyright 2017-2022 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
export { default as delegator } from './delegator.json'; export { default as delegator } from './delegator.json' assert { type: 'json' };
export { default as dns } from './dns.json'; export { default as dns } from './dns.json' assert { type: 'json' };
export { default as erc20 } from './erc20.json'; export { default as erc20 } from './erc20.json' assert { type: 'json' };
export { default as erc721 } from './erc721.json'; export { default as erc721 } from './erc721.json' assert { type: 'json' };
export { default as flipper } from './flipper.json'; export { default as flipper } from './flipper.json' assert { type: 'json' };
export { default as flipperBundle } from './flipper.contract.json'; export { default as flipperBundle } from './flipper.contract.json' assert { type: 'json' };
export { default as incrementer } from './incrementer.json'; export { default as incrementer } from './incrementer.json' assert { type: 'json' };
export { default as multisigPlain } from './multisig_plain.json'; export { default as multisigPlain } from './multisig_plain.json' assert { type: 'json' };
@@ -1,6 +1,6 @@
// Copyright 2017-2022 @polkadot/api-contract authors & contributors // Copyright 2017-2022 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
export { default as flipper } from './flipper.contract.json'; export { default as flipper } from './flipper.contract.json' assert { type: 'json' };
// A complex contract example with traits. // A complex contract example with traits.
export { default as psp22 } from './psp22_minter_pauser.contract.json'; export { default as psp22 } from './psp22_minter_pauser.contract.json' assert { type: 'json' };
@@ -1,5 +1,5 @@
// Copyright 2017-2022 @polkadot/api-contract authors & contributors // Copyright 2017-2022 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
export { default as erc20 } from './erc20.contract.json'; export { default as erc20 } from './erc20.contract.json' assert { type: 'json' };
export { default as flipper } from './flipper.contract.json'; export { default as flipper } from './flipper.contract.json' assert { type: 'json' };
@@ -1,6 +1,6 @@
// Copyright 2017-2022 @polkadot/api-contract authors & contributors // Copyright 2017-2022 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
export { default as flipper } from './flipper.contract.json'; export { default as flipper } from './flipper.contract.json' assert { type: 'json' };
// A complex contract example with traits. // A complex contract example with traits.
export { default as traitErc20 } from './trait_erc20.contract.json'; export { default as traitErc20 } from './trait_erc20.contract.json' assert { type: 'json' };
@@ -1,4 +1,4 @@
// Copyright 2017-2022 @polkadot/api-contract authors & contributors // Copyright 2017-2022 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
export { default as ints256 } from './ints256.json'; export { default as ints256 } from './ints256.json' assert { type: 'json' };
@@ -1,7 +1,7 @@
// Copyright 2017-2022 @polkadot/api-contract authors & contributors // Copyright 2017-2022 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
export { default as assetTransfer } from './assetTransfer.json'; export { default as assetTransfer } from './assetTransfer.json' assert { type: 'json' };
export { default as enumExample } from './enumExample.json'; export { default as enumExample } from './enumExample.json' assert { type: 'json' };
export { default as recursive } from './recursive.contract.json'; export { default as recursive } from './recursive.contract.json' assert { type: 'json' };
export { default as withString } from './withString.json'; export { default as withString } from './withString.json' assert { type: 'json' };
+15 -15
View File
@@ -20,25 +20,25 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "8.11.3", "version": "8.13.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.18.6", "@babel/runtime": "^7.18.6",
"@polkadot/api": "8.11.3", "@polkadot/api": "8.13.1",
"@polkadot/api-augment": "8.11.3", "@polkadot/api-augment": "8.13.1",
"@polkadot/api-base": "8.11.3", "@polkadot/api-base": "8.13.1",
"@polkadot/rpc-core": "8.11.3", "@polkadot/rpc-core": "8.13.1",
"@polkadot/types": "8.11.3", "@polkadot/types": "8.13.1",
"@polkadot/types-codec": "8.11.3", "@polkadot/types-codec": "8.13.1",
"@polkadot/util": "^9.7.2", "@polkadot/util": "^10.0.2",
"@polkadot/util-crypto": "^9.7.2", "@polkadot/util-crypto": "^10.0.2",
"rxjs": "^7.5.5" "rxjs": "^7.5.6"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/api": "8.11.3", "@polkadot/api": "8.13.1",
"@polkadot/api-augment": "8.11.3", "@polkadot/api-augment": "8.13.1",
"@polkadot/rpc-augment": "8.11.3", "@polkadot/rpc-augment": "8.13.1",
"@polkadot/rpc-provider": "8.11.3", "@polkadot/rpc-provider": "8.13.1",
"@polkadot/types-support": "8.11.3" "@polkadot/types-support": "8.13.1"
} }
} }
+3 -3
View File
@@ -3,7 +3,7 @@
import type { DeriveApi } from '../types'; import type { DeriveApi } from '../types';
import { unwrapBlockNumber } from './util'; import { createBlockNumberDerive } from './util';
/** /**
* @name bestNumber * @name bestNumber
@@ -17,7 +17,7 @@ import { unwrapBlockNumber } from './util';
* }); * });
* ``` * ```
*/ */
export const bestNumber = unwrapBlockNumber( export const bestNumber = createBlockNumberDerive(
(api: DeriveApi) => (api: DeriveApi) =>
api.derive.chain.subscribeNewHeads() api.rpc.chain.subscribeNewHeads()
); );
@@ -3,7 +3,7 @@
import type { DeriveApi } from '../types'; import type { DeriveApi } from '../types';
import { unwrapBlockNumber } from './util'; import { createBlockNumberDerive } from './util';
/** /**
* @name bestNumberFinalized * @name bestNumberFinalized
@@ -18,7 +18,7 @@ import { unwrapBlockNumber } from './util';
* }); * });
* ``` * ```
*/ */
export const bestNumberFinalized = unwrapBlockNumber( export const bestNumberFinalized = createBlockNumberDerive(
(api: DeriveApi) => (api: DeriveApi) =>
api.rpc.chain.subscribeFinalizedHeads() api.rpc.chain.subscribeFinalizedHeads()
); );
+15 -21
View File
@@ -5,10 +5,11 @@ import type { Observable } from 'rxjs';
import type { SignedBlockExtended } from '../type/types'; import type { SignedBlockExtended } from '../type/types';
import type { DeriveApi } from '../types'; import type { DeriveApi } from '../types';
import { catchError, combineLatest, map, of, switchMap } from 'rxjs'; import { combineLatest, map, of, switchMap } from 'rxjs';
import { createSignedBlockExtended } from '../type'; import { createSignedBlockExtended } from '../type';
import { memo } from '../util'; import { memo } from '../util';
import { getAuthorDetails } from './util';
/** /**
* @name getBlock * @name getBlock
@@ -23,29 +24,22 @@ import { memo } from '../util';
* console.log(`block #${block.header.number} was authored by ${author}`); * console.log(`block #${block.header.number} was authored by ${author}`);
* ``` * ```
*/ */
export function getBlock (instanceId: string, api: DeriveApi): (hash: Uint8Array | string) => Observable<SignedBlockExtended | undefined> { export function getBlock (instanceId: string, api: DeriveApi): (hash: Uint8Array | string) => Observable<SignedBlockExtended> {
return memo(instanceId, (blockHash: Uint8Array | string): Observable<SignedBlockExtended | undefined> => return memo(instanceId, (blockHash: Uint8Array | string): Observable<SignedBlockExtended> =>
combineLatest([ combineLatest([
api.rpc.chain.getBlock(blockHash), api.rpc.chain.getBlock(blockHash),
api.queryAt(blockHash).pipe( api.queryAt(blockHash)
switchMap((queryAt) =>
combineLatest([
queryAt.system.events(),
queryAt.session
? queryAt.session.validators()
: of([])
])
)
)
]).pipe( ]).pipe(
map(([signedBlock, [events, validators]]) => switchMap(([signedBlock, queryAt]) =>
createSignedBlockExtended(api.registry, signedBlock, events, validators) combineLatest([
of(signedBlock),
queryAt.system.events(),
getAuthorDetails(signedBlock.block.header, queryAt)
])
), ),
catchError((): Observable<undefined> => map(([signedBlock, events, [, validators, author]]) =>
// where rpc.chain.getHeader throws, we will land here - it can happen that createSignedBlockExtended(events.registry, signedBlock, events, validators, author)
// we supplied an invalid hash. (Due to defaults, storage will have an
// empty value, so only the RPC is affected). So return undefined
of()
) )
)); )
);
} }
@@ -10,8 +10,8 @@ import { switchMap } from 'rxjs';
import { memo } from '../util'; import { memo } from '../util';
export function getBlockByNumber (instanceId: string, api: DeriveApi): (blockNumber: AnyNumber) => Observable<SignedBlockExtended | undefined> { export function getBlockByNumber (instanceId: string, api: DeriveApi): (blockNumber: AnyNumber) => Observable<SignedBlockExtended> {
return memo(instanceId, (blockNumber: AnyNumber): Observable<SignedBlockExtended | undefined> => return memo(instanceId, (blockNumber: AnyNumber): Observable<SignedBlockExtended> =>
api.rpc.chain.getBlockHash(blockNumber).pipe( api.rpc.chain.getBlockHash(blockNumber).pipe(
switchMap((h) => api.derive.chain.getBlock(h)) switchMap((h) => api.derive.chain.getBlock(h))
) )
+11 -19
View File
@@ -2,14 +2,14 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs'; import type { Observable } from 'rxjs';
import type { AccountId } from '@polkadot/types/interfaces';
import type { HeaderExtended } from '../type/types'; import type { HeaderExtended } from '../type/types';
import type { DeriveApi } from '../types'; import type { DeriveApi } from '../types';
import { catchError, combineLatest, map, of, switchMap } from 'rxjs'; import { combineLatest, map, switchMap } from 'rxjs';
import { createHeaderExtended } from '../type'; import { createHeaderExtended } from '../type';
import { memo } from '../util'; import { memo } from '../util';
import { getAuthorDetails } from './util';
/** /**
* @name getHeader * @name getHeader
@@ -25,26 +25,18 @@ import { memo } from '../util';
* console.log(`block #${number} was authored by ${author}`); * console.log(`block #${number} was authored by ${author}`);
* ``` * ```
*/ */
export function getHeader (instanceId: string, api: DeriveApi): (blockHash: Uint8Array | string) => Observable<HeaderExtended | undefined> { export function getHeader (instanceId: string, api: DeriveApi): (blockHash: Uint8Array | string) => Observable<HeaderExtended> {
return memo(instanceId, (blockHash: Uint8Array | string): Observable<HeaderExtended | undefined> => return memo(instanceId, (blockHash: Uint8Array | string): Observable<HeaderExtended> =>
combineLatest([ combineLatest([
api.rpc.chain.getHeader(blockHash), api.rpc.chain.getHeader(blockHash),
api.queryAt(blockHash).pipe( api.queryAt(blockHash)
switchMap((queryAt) =>
queryAt.session
? queryAt.session.validators()
: of([] as AccountId[])
)
)
]).pipe( ]).pipe(
map(([header, validators]) => switchMap(([header, queryAt]) =>
createHeaderExtended(header.registry, header, validators) getAuthorDetails(header, queryAt)
), ),
catchError((): Observable<undefined> => map(([header, validators, author]) =>
// where rpc.chain.getHeader throws, we will land here - it can happen that createHeaderExtended((validators || header).registry, header, validators, author)
// we supplied an invalid hash. (Due to defaults, storeage will have an
// empty value, so only the RPC is affected). So return undefined
of()
) )
)); )
);
} }
+1
View File
@@ -7,5 +7,6 @@ export * from './bestNumberLag';
export * from './getHeader'; export * from './getHeader';
export * from './getBlock'; export * from './getBlock';
export * from './getBlockByNumber'; export * from './getBlockByNumber';
export * from './subscribeFinalizedHeads';
export * from './subscribeNewBlocks'; export * from './subscribeNewBlocks';
export * from './subscribeNewHeads'; export * from './subscribeNewHeads';
@@ -0,0 +1,24 @@
// Copyright 2017-2022 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { SignedBlockExtended } from '../type/types';
import type { DeriveApi } from '../types';
import { switchMap } from 'rxjs';
import { memo } from '../util';
/**
* @name subscribeFinalizedBlocks
* @returns The finalized block & events for that block
*/
export function subscribeFinalizedBlocks (instanceId: string, api: DeriveApi): () => Observable<SignedBlockExtended> {
return memo(instanceId, (): Observable<SignedBlockExtended> =>
api.derive.chain.subscribeFinalizedHeads().pipe(
switchMap((header) =>
api.derive.chain.getBlock(header.createdAtHash || header.hash)
)
)
);
}
@@ -0,0 +1,56 @@
// Copyright 2017-2022 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { Hash, Header } from '@polkadot/types/interfaces';
import type { DeriveApi } from '../types';
import { from, of, switchMap } from 'rxjs';
import { memo } from '../util';
/**
* Returns a header range from startHash to to (not including) endHash, i.e. lastBlock.parentHash === endHash
*/
export function _getHeaderRange (instanceId: string, api: DeriveApi): (startHash: Hash, endHash: Hash, prev?: Header[]) => Observable<Header[]> {
return memo(instanceId, (startHash: Hash, endHash: Hash, prev: Header[] = []): Observable<Header[]> =>
api.rpc.chain.getHeader(startHash).pipe(
switchMap((header) =>
header.parentHash.eq(endHash)
? of([header, ...prev])
: api.derive.chain._getHeaderRange(header.parentHash, endHash, [header, ...prev])
)
)
);
}
/**
* @name subscribeFinalizedHeads
* @description An observable of the finalized block headers. Unlike the base
* chain.subscribeFinalizedHeads this does not skip any headers. Since finalization
* may skip specific blocks (finalization happens in terms of chains), this version
* of the derive tracks missing headers (since last retrieved) and provides them
* to the caller
*/
export function subscribeFinalizedHeads (instanceId: string, api: DeriveApi): () => Observable<Header> {
return memo(instanceId, (): Observable<Header> => {
let prevHash: Hash | null = null;
return api.rpc.chain.subscribeFinalizedHeads().pipe(
switchMap((header) => {
const endHash = prevHash;
const startHash = header.parentHash;
prevHash = header.createdAtHash = header.hash;
return endHash === null || startHash.eq(endHash)
? of(header)
: api.derive.chain._getHeaderRange(startHash, endHash, [header]).pipe(
switchMap((headers) =>
from(headers)
)
);
})
);
});
}
@@ -5,9 +5,8 @@ import type { Observable } from 'rxjs';
import type { SignedBlockExtended } from '../type/types'; import type { SignedBlockExtended } from '../type/types';
import type { DeriveApi } from '../types'; import type { DeriveApi } from '../types';
import { combineLatest, map, of, switchMap } from 'rxjs'; import { switchMap } from 'rxjs';
import { createSignedBlockExtended } from '../type';
import { memo } from '../util'; import { memo } from '../util';
/** /**
@@ -17,22 +16,8 @@ import { memo } from '../util';
export function subscribeNewBlocks (instanceId: string, api: DeriveApi): () => Observable<SignedBlockExtended> { export function subscribeNewBlocks (instanceId: string, api: DeriveApi): () => Observable<SignedBlockExtended> {
return memo(instanceId, (): Observable<SignedBlockExtended> => return memo(instanceId, (): Observable<SignedBlockExtended> =>
api.derive.chain.subscribeNewHeads().pipe( api.derive.chain.subscribeNewHeads().pipe(
switchMap((header) => { switchMap((header) =>
const blockHash = header.createdAtHash || header.hash; api.derive.chain.getBlock(header.createdAtHash || header.hash)
// we get the block first, setting up the registry
return combineLatest([
of(header),
api.rpc.chain.getBlock(blockHash),
api.queryAt(blockHash).pipe(
switchMap((queryAt) =>
queryAt.system.events()
)
)
]);
}),
map(([header, block, events]) =>
createSignedBlockExtended(block.registry, block, events, header.validators)
) )
) )
); );
@@ -5,10 +5,11 @@ import type { Observable } from 'rxjs';
import type { HeaderExtended } from '../type/types'; import type { HeaderExtended } from '../type/types';
import type { DeriveApi } from '../types'; import type { DeriveApi } from '../types';
import { combineLatest, map, of } from 'rxjs'; import { combineLatest, map, of, switchMap } from 'rxjs';
import { createHeaderExtended } from '../type'; import { createHeaderExtended } from '../type';
import { memo } from '../util'; import { memo } from '../util';
import { getAuthorDetails } from './util';
/** /**
* @name subscribeNewHeads * @name subscribeNewHeads
@@ -25,16 +26,20 @@ import { memo } from '../util';
*/ */
export function subscribeNewHeads (instanceId: string, api: DeriveApi): () => Observable<HeaderExtended> { export function subscribeNewHeads (instanceId: string, api: DeriveApi): () => Observable<HeaderExtended> {
return memo(instanceId, (): Observable<HeaderExtended> => return memo(instanceId, (): Observable<HeaderExtended> =>
combineLatest([ api.rpc.chain.subscribeNewHeads().pipe(
api.rpc.chain.subscribeNewHeads(), switchMap((header) =>
api.query.session combineLatest([
? api.query.session.validators() of(header),
: of(undefined) api.queryAt(header.hash)
]).pipe( ])
map(([header, validators]): HeaderExtended => { ),
switchMap(([header, queryAt]) =>
getAuthorDetails(header, queryAt)
),
map(([header, validators, author]): HeaderExtended => {
header.createdAtHash = header.hash; header.createdAtHash = header.hash;
return createHeaderExtended(header.registry, header, validators); return createHeaderExtended(header.registry, header, validators, author);
}) })
) )
); );
+45 -8
View File
@@ -2,21 +2,58 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs'; import type { Observable } from 'rxjs';
import type { Compact } from '@polkadot/types'; import type { QueryableStorage } from '@polkadot/api-base/types';
import type { BlockNumber } from '@polkadot/types/interfaces'; import type { Compact, Vec } from '@polkadot/types';
import type { AccountId, BlockNumber, Header } from '@polkadot/types/interfaces';
import type { Codec, IOption } from '@polkadot/types/types';
import type { DeriveApi } from '../types'; import type { DeriveApi } from '../types';
import { map } from 'rxjs'; import { combineLatest, map, of } from 'rxjs';
import { memo } from '../util'; import { memo, unwrapBlockNumber } from '../util';
// re-export these - since these needs to be resolvable from api-derive, i.e. without this // re-export these - since these needs to be resolvable from api-derive, i.e. without this
// we would emit code with ../<somewhere>/src embedded in the *.d.ts files // we would emit code with ../<somewhere>/src embedded in the *.d.ts files
export type { BlockNumber } from '@polkadot/types/interfaces'; export type { BlockNumber } from '@polkadot/types/interfaces';
export function unwrapBlockNumber <T extends { number: Compact<BlockNumber> }> (fn: (api: DeriveApi) => Observable<T>): (instanceId: string, api: DeriveApi) => () => Observable<BlockNumber> { export function createBlockNumberDerive <T extends { number: Compact<BlockNumber> | BlockNumber }> (fn: (api: DeriveApi) => Observable<T>): (instanceId: string, api: DeriveApi) => () => Observable<BlockNumber> {
return (instanceId: string, api: DeriveApi) => return (instanceId: string, api: DeriveApi) =>
memo(instanceId, () => fn(api).pipe( memo(instanceId, () =>
map((r) => r.number.unwrap()) fn(api).pipe(
)); map(unwrapBlockNumber)
)
);
}
export function getAuthorDetails (header: Header, queryAt: QueryableStorage<'rxjs'>): Observable<[Header, Vec<AccountId> | null, AccountId | null]> {
// this is Moonbeam specific
if (queryAt.authorMapping && queryAt.authorMapping.mappingWithDeposit) {
const mapId = header.digest.logs[0] && (
(header.digest.logs[0].isConsensus && header.digest.logs[0].asConsensus[1]) ||
(header.digest.logs[0].isPreRuntime && header.digest.logs[0].asPreRuntime[1])
);
if (mapId) {
return combineLatest([
of(header),
queryAt.session
? queryAt.session.validators()
: of(null),
queryAt.authorMapping.mappingWithDeposit<IOption<{ account: AccountId } & Codec>>(mapId).pipe(
map((opt) =>
opt.unwrapOr({ account: null }).account
)
)
]);
}
}
// normal operation, non-mapping
return combineLatest([
of(header),
queryAt.session
? queryAt.session.validators()
: of(null),
of(null)
]);
} }
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/api-derive', path: 'auto', type: 'auto', version: '8.11.3' }; export const packageInfo = { name: '@polkadot/api-derive', path: 'auto', type: 'auto', version: '8.13.1' };
+6 -5
View File
@@ -5,6 +5,7 @@ import type { Observable } from 'rxjs';
import type { Balance } from '@polkadot/types/interfaces'; import type { Balance } from '@polkadot/types/interfaces';
import type { PalletStakingStakingLedger, PalletStakingUnlockChunk } from '@polkadot/types/lookup'; import type { PalletStakingStakingLedger, PalletStakingUnlockChunk } from '@polkadot/types/lookup';
import type { DeriveApi, DeriveSessionInfo, DeriveStakingAccount, DeriveStakingKeys, DeriveStakingQuery, DeriveUnlocking } from '../types'; import type { DeriveApi, DeriveSessionInfo, DeriveStakingAccount, DeriveStakingKeys, DeriveStakingQuery, DeriveUnlocking } from '../types';
import type { StakingQueryFlags } from './types';
import { combineLatest, map, switchMap } from 'rxjs'; import { combineLatest, map, switchMap } from 'rxjs';
@@ -64,13 +65,13 @@ function parseResult (api: DeriveApi, sessionInfo: DeriveSessionInfo, keys: Deri
/** /**
* @description From a list of stashes, fill in all the relevant staking details * @description From a list of stashes, fill in all the relevant staking details
*/ */
export function accounts (instanceId: string, api: DeriveApi): (accountIds: (Uint8Array | string)[]) => Observable<DeriveStakingAccount[]> { export function accounts (instanceId: string, api: DeriveApi): (accountIds: (Uint8Array | string)[], opts?: StakingQueryFlags) => Observable<DeriveStakingAccount[]> {
return memo(instanceId, (accountIds: (Uint8Array | string)[]): Observable<DeriveStakingAccount[]> => return memo(instanceId, (accountIds: (Uint8Array | string)[], opts: StakingQueryFlags = QUERY_OPTS): Observable<DeriveStakingAccount[]> =>
api.derive.session.info().pipe( api.derive.session.info().pipe(
switchMap((sessionInfo) => switchMap((sessionInfo) =>
combineLatest([ combineLatest([
api.derive.staking.keysMulti(accountIds), api.derive.staking.keysMulti(accountIds),
api.derive.staking.queryMulti(accountIds, QUERY_OPTS) api.derive.staking.queryMulti(accountIds, opts)
]).pipe( ]).pipe(
map(([keys, queries]) => map(([keys, queries]) =>
queries.map((q, index) => parseResult(api, sessionInfo, keys[index], q)) queries.map((q, index) => parseResult(api, sessionInfo, keys[index], q))
@@ -85,6 +86,6 @@ export function accounts (instanceId: string, api: DeriveApi): (accountIds: (Uin
* @description From a stash, retrieve the controllerId and fill in all the relevant staking details * @description From a stash, retrieve the controllerId and fill in all the relevant staking details
*/ */
export const account = firstMemo( export const account = firstMemo(
(api: DeriveApi, accountId: Uint8Array | string) => (api: DeriveApi, accountId: Uint8Array | string, opts?: StakingQueryFlags) =>
api.derive.staking.accounts([accountId]) api.derive.staking.accounts([accountId], opts)
); );
+2 -1
View File
@@ -10,6 +10,7 @@ import { combineLatest, map, of, switchMap } from 'rxjs';
import { isNumber, isUndefined } from '@polkadot/util'; import { isNumber, isUndefined } from '@polkadot/util';
import { unwrapBlockNumber } from '../util';
import { FALLBACK_MAX_HASH_COUNT, FALLBACK_PERIOD, MAX_FINALITY_LAG, MORTAL_PERIOD } from './constants'; import { FALLBACK_MAX_HASH_COUNT, FALLBACK_PERIOD, MAX_FINALITY_LAG, MORTAL_PERIOD } from './constants';
interface Result { interface Result {
@@ -51,7 +52,7 @@ function signingHeader (api: DeriveApi): Observable<Header> {
]).pipe( ]).pipe(
map(([current, finalized]) => map(([current, finalized]) =>
// determine the hash to use, current when lag > max, else finalized // determine the hash to use, current when lag > max, else finalized
current.number.unwrap().sub(finalized.number.unwrap()).gt(MAX_FINALITY_LAG) unwrapBlockNumber(current).sub(unwrapBlockNumber(finalized)).gt(MAX_FINALITY_LAG)
? current ? current
: finalized : finalized
) )
+4 -13
View File
@@ -7,19 +7,17 @@ import type { HeaderExtended } from './types';
import { extractAuthor } from './util'; import { extractAuthor } from './util';
export function createHeaderExtended (registry: Registry, header?: Header, validators?: AccountId[]): HeaderExtended { export function createHeaderExtended (registry: Registry, header?: Header, validators?: AccountId[] | null, author?: AccountId | null): HeaderExtended {
// an instance of the base extrinsic for us to extend // an instance of the base extrinsic for us to extend
const HeaderBase = registry.createClass('Header'); const HeaderBase = registry.createClass('Header');
class Implementation extends HeaderBase implements HeaderExtended { class Implementation extends HeaderBase implements HeaderExtended {
readonly #author?: AccountId; readonly #author?: AccountId;
readonly #validators?: AccountId[];
constructor (registry: Registry, header?: Header, validators?: AccountId[]) { constructor (registry: Registry, header?: Header, validators?: AccountId[] | null, author?: AccountId | null) {
super(registry, header); super(registry, header);
this.#author = extractAuthor(this.digest, validators); this.#author = author || extractAuthor(this.digest, validators || []);
this.#validators = validators;
this.createdAtHash = header?.createdAtHash; this.createdAtHash = header?.createdAtHash;
} }
@@ -29,14 +27,7 @@ export function createHeaderExtended (registry: Registry, header?: Header, valid
public get author (): AccountId | undefined { public get author (): AccountId | undefined {
return this.#author; return this.#author;
} }
/**
* @description Convenience method, returns the validators for the block
*/
public get validators (): AccountId[] | undefined {
return this.#validators;
}
} }
return new Implementation(registry, header, validators); return new Implementation(registry, header, validators, author);
} }
@@ -31,7 +31,7 @@ function mapExtrinsics (extrinsics: Extrinsic[], records: EventRecord[]): TxWith
}); });
} }
export function createSignedBlockExtended (registry: Registry, block?: SignedBlock, events?: EventRecord[], validators?: AccountId[]): SignedBlockExtended { export function createSignedBlockExtended (registry: Registry, block?: SignedBlock, events?: EventRecord[], validators?: AccountId[] | null, author?: AccountId | null): SignedBlockExtended {
// an instance of the base extrinsic for us to extend // an instance of the base extrinsic for us to extend
const SignedBlockBase = registry.createClass('SignedBlock'); const SignedBlockBase = registry.createClass('SignedBlock');
@@ -40,10 +40,10 @@ export function createSignedBlockExtended (registry: Registry, block?: SignedBlo
readonly #events: EventRecord[]; readonly #events: EventRecord[];
readonly #extrinsics: TxWithEvent[]; readonly #extrinsics: TxWithEvent[];
constructor (registry: Registry, block?: SignedBlock, events?: EventRecord[], validators?: AccountId[]) { constructor (registry: Registry, block?: SignedBlock, events?: EventRecord[], validators?: AccountId[] | null, author?: AccountId | null) {
super(registry, block); super(registry, block);
this.#author = extractAuthor(this.block.header.digest, validators); this.#author = author || extractAuthor(this.block.header.digest, validators || []);
this.#events = events || ([] as EventRecord[]); this.#events = events || ([] as EventRecord[]);
this.#extrinsics = mapExtrinsics(this.block.extrinsics, this.#events); this.#extrinsics = mapExtrinsics(this.block.extrinsics, this.#events);
this.createdAtHash = block?.createdAtHash; this.createdAtHash = block?.createdAtHash;
@@ -71,5 +71,5 @@ export function createSignedBlockExtended (registry: Registry, block?: SignedBlo
} }
} }
return new Implementation(registry, block, events, validators); return new Implementation(registry, block, events, validators, author);
} }
-1
View File
@@ -5,7 +5,6 @@ import type { AccountId, DispatchError, DispatchInfo, Event, EventRecord, Extrin
export interface HeaderExtended extends Header { export interface HeaderExtended extends Header {
readonly author: AccountId | undefined; readonly author: AccountId | undefined;
readonly validators: AccountId[] | undefined;
} }
export interface SignedBlockExtended extends SignedBlock { export interface SignedBlockExtended extends SignedBlock {
@@ -0,0 +1,15 @@
// Copyright 2017-2022 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Compact } from '@polkadot/types';
import type { BlockNumber } from '@polkadot/types/interfaces';
import { isCompact } from '@polkadot/util';
type CompatHeader = { number: Compact<BlockNumber> | BlockNumber };
export function unwrapBlockNumber (hdr: CompatHeader): BlockNumber {
return isCompact<BlockNumber>(hdr.number)
? hdr.number.unwrap()
: hdr.number;
}
+1
View File
@@ -4,6 +4,7 @@
export { drr, memo } from '@polkadot/rpc-core'; export { drr, memo } from '@polkadot/rpc-core';
export * from './approvalFlagsToBools'; export * from './approvalFlagsToBools';
export * from './blockNumber';
export * from './cache'; export * from './cache';
export * from './cacheImpl'; export * from './cacheImpl';
export * from './first'; export * from './first';
+18 -18
View File
@@ -20,29 +20,29 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "8.11.3", "version": "8.13.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.18.6", "@babel/runtime": "^7.18.6",
"@polkadot/api-augment": "8.11.3", "@polkadot/api-augment": "8.13.1",
"@polkadot/api-base": "8.11.3", "@polkadot/api-base": "8.13.1",
"@polkadot/api-derive": "8.11.3", "@polkadot/api-derive": "8.13.1",
"@polkadot/keyring": "^9.7.2", "@polkadot/keyring": "^10.0.2",
"@polkadot/rpc-augment": "8.11.3", "@polkadot/rpc-augment": "8.13.1",
"@polkadot/rpc-core": "8.11.3", "@polkadot/rpc-core": "8.13.1",
"@polkadot/rpc-provider": "8.11.3", "@polkadot/rpc-provider": "8.13.1",
"@polkadot/types": "8.11.3", "@polkadot/types": "8.13.1",
"@polkadot/types-augment": "8.11.3", "@polkadot/types-augment": "8.13.1",
"@polkadot/types-codec": "8.11.3", "@polkadot/types-codec": "8.13.1",
"@polkadot/types-create": "8.11.3", "@polkadot/types-create": "8.13.1",
"@polkadot/types-known": "8.11.3", "@polkadot/types-known": "8.13.1",
"@polkadot/util": "^9.7.2", "@polkadot/util": "^10.0.2",
"@polkadot/util-crypto": "^9.7.2", "@polkadot/util-crypto": "^10.0.2",
"eventemitter3": "^4.0.7", "eventemitter3": "^4.0.7",
"rxjs": "^7.5.5" "rxjs": "^7.5.6"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/api-augment": "8.11.3", "@polkadot/api-augment": "8.13.1",
"@polkadot/types-support": "8.11.3" "@polkadot/types-support": "8.13.1"
} }
} }
+7 -3
View File
@@ -21,7 +21,7 @@ import { memo, RpcCore } from '@polkadot/rpc-core';
import { WsProvider } from '@polkadot/rpc-provider'; import { WsProvider } from '@polkadot/rpc-provider';
import { expandMetadata, Metadata, typeDefinitions, TypeRegistry, unwrapStorageType } from '@polkadot/types'; import { expandMetadata, Metadata, typeDefinitions, TypeRegistry, unwrapStorageType } from '@polkadot/types';
import { getSpecRuntime } from '@polkadot/types-known'; import { getSpecRuntime } from '@polkadot/types-known';
import { arrayChunk, arrayFlatten, assert, assertReturn, BN, compactStripLength, lazyMethod, lazyMethods, logger, nextTick, objectSpread, stringCamelCase, stringUpperFirst, u8aConcatStrict, u8aToHex } from '@polkadot/util'; import { arrayChunk, arrayFlatten, assertReturn, BN, compactStripLength, lazyMethod, lazyMethods, logger, nextTick, objectSpread, stringCamelCase, stringUpperFirst, u8aConcatStrict, u8aToHex } from '@polkadot/util';
import { blake2AsHex } from '@polkadot/util-crypto'; import { blake2AsHex } from '@polkadot/util-crypto';
import { createSubmittable } from '../submittable'; import { createSubmittable } from '../submittable';
@@ -918,7 +918,9 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
} }
private _retrieveMapKeys ({ iterKey, meta, method, section }: StorageEntry, at: Hash | Uint8Array | string | null, args: unknown[]): Observable<StorageKey[]> { private _retrieveMapKeys ({ iterKey, meta, method, section }: StorageEntry, at: Hash | Uint8Array | string | null, args: unknown[]): Observable<StorageKey[]> {
assert(iterKey && meta.type.isMap, 'keys can only be retrieved on maps'); if (!iterKey || !meta.type.isMap) {
throw new Error('keys can only be retrieved on maps');
}
const headKey = iterKey(...args).toHex(); const headKey = iterKey(...args).toHex();
const startSubject = new BehaviorSubject<string>(headKey); const startSubject = new BehaviorSubject<string>(headKey);
@@ -945,7 +947,9 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
} }
private _retrieveMapKeysPaged ({ iterKey, meta, method, section }: StorageEntry, at: Hash | Uint8Array | string | undefined, opts: PaginationOptions): Observable<StorageKey[]> { private _retrieveMapKeysPaged ({ iterKey, meta, method, section }: StorageEntry, at: Hash | Uint8Array | string | undefined, opts: PaginationOptions): Observable<StorageKey[]> {
assert(iterKey && meta.type.isMap, 'keys can only be retrieved on maps'); if (!iterKey || !meta.type.isMap) {
throw new Error('keys can only be retrieved on maps');
}
const setMeta = (key: StorageKey) => key.setMeta(meta, section, method); const setMeta = (key: StorageKey) => key.setMeta(meta, section, method);
const query = at const query = at
+9 -7
View File
@@ -15,7 +15,7 @@ import { firstValueFrom, map, of, switchMap } from 'rxjs';
import { Metadata, TypeRegistry } from '@polkadot/types'; import { Metadata, TypeRegistry } from '@polkadot/types';
import { getSpecAlias, getSpecExtensions, getSpecHasher, getSpecRpc, getSpecTypes, getUpgradeVersion } from '@polkadot/types-known'; import { getSpecAlias, getSpecExtensions, getSpecHasher, getSpecRpc, getSpecTypes, getUpgradeVersion } from '@polkadot/types-known';
import { assert, assertReturn, BN_ZERO, isUndefined, logger, objectSpread, u8aEq, u8aToHex, u8aToU8a } from '@polkadot/util'; import { assertReturn, BN_ZERO, isUndefined, logger, objectSpread, u8aEq, u8aToHex, u8aToU8a } from '@polkadot/util';
import { cryptoWaitReady } from '@polkadot/util-crypto'; import { cryptoWaitReady } from '@polkadot/util-crypto';
import { Decorate } from './Decorate'; import { Decorate } from './Decorate';
@@ -29,8 +29,7 @@ function textToString (t: Text): string {
} }
export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> { export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
// Browser/Deno = number, Node = Timeout #healthTimer: ReturnType<typeof setInterval> | null = null;
#healthTimer: unknown | null = null;
#registries: VersionedRegistry<ApiType>[] = []; #registries: VersionedRegistry<ApiType>[] = [];
@@ -180,7 +179,9 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
private async _getBlockRegistryViaHash (blockHash: Uint8Array): Promise<VersionedRegistry<ApiType>> { private async _getBlockRegistryViaHash (blockHash: Uint8Array): Promise<VersionedRegistry<ApiType>> {
// ensure we have everything required // ensure we have everything required
assert(this._genesisHash && this._runtimeVersion, 'Cannot retrieve data on an uninitialized chain'); if (!this._genesisHash || !this._runtimeVersion) {
throw new Error('Cannot retrieve data on an uninitialized chain');
}
// We have to assume that on the RPC layer the calls used here does not call back into // We have to assume that on the RPC layer the calls used here does not call back into
// the registry swap, so getHeader & getRuntimeVersion should not be historic // the registry swap, so getHeader & getRuntimeVersion should not be historic
@@ -190,7 +191,9 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
: await firstValueFrom(this._rpcCore.chain.getHeader.raw(blockHash)) : await firstValueFrom(this._rpcCore.chain.getHeader.raw(blockHash))
); );
assert(!header.parentHash.isEmpty, 'Unable to retrieve header and parent from supplied hash'); if (header.parentHash.isEmpty) {
throw new Error('Unable to retrieve header and parent from supplied hash');
}
// get the runtime version, either on-chain or via an known upgrade history // get the runtime version, either on-chain or via an known upgrade history
const [firstVersion, lastVersion] = getUpgradeVersion(this._genesisHash, header.number); const [firstVersion, lastVersion] = getUpgradeVersion(this._genesisHash, header.number);
@@ -370,8 +373,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
private _unsubscribeHealth (): void { private _unsubscribeHealth (): void {
if (this.#healthTimer) { if (this.#healthTimer) {
// different method signatures for Node vs Browser/Deno clearInterval(this.#healthTimer);
clearInterval(this.#healthTimer as number);
this.#healthTimer = null; this.#healthTimer = null;
} }
} }
+4 -2
View File
@@ -4,7 +4,7 @@
import type { SignerPayloadRawBase } from '@polkadot/types/types'; import type { SignerPayloadRawBase } from '@polkadot/types/types';
import type { ApiOptions, ApiTypes, DecorateMethod, Signer } from '../types'; import type { ApiOptions, ApiTypes, DecorateMethod, Signer } from '../types';
import { assert, isString, objectSpread, u8aToHex, u8aToU8a } from '@polkadot/util'; import { isString, objectSpread, u8aToHex, u8aToU8a } from '@polkadot/util';
import { Getters } from './Getters'; import { Getters } from './Getters';
@@ -69,7 +69,9 @@ export abstract class ApiBase<ApiType extends ApiTypes> extends Getters<ApiType>
if (isString(address)) { if (isString(address)) {
const _signer = signer || this._rx.signer; const _signer = signer || this._rx.signer;
assert(_signer?.signRaw, 'No signer exists with a signRaw interface. You possibly need to pass through an explicit keypair for the origin so it can be used for signing.'); if (!_signer || !_signer.signRaw) {
throw new Error('No signer exists with a signRaw interface. You possibly need to pass through an explicit keypair for the origin so it can be used for signing.');
}
return ( return (
await _signer.signRaw( await _signer.signRaw(
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/api', path: 'auto', type: 'auto', version: '8.11.3' }; export const packageInfo = { name: '@polkadot/api', path: 'auto', type: 'auto', version: '8.13.1' };
+4 -2
View File
@@ -7,7 +7,7 @@ import type { DecorateFn, DecorateMethodOptions, ObsInnerType, StorageEntryPromi
import { catchError, EMPTY, Subscription, tap } from 'rxjs'; import { catchError, EMPTY, Subscription, tap } from 'rxjs';
import { assert, isFunction, nextTick } from '@polkadot/util'; import { isFunction, nextTick } from '@polkadot/util';
interface Tracker<T> { interface Tracker<T> {
reject: (value: Error) => Observable<never>; reject: (value: Error) => Observable<never>;
@@ -57,7 +57,9 @@ function extractArgs (args: unknown[], needsCallback: boolean): [unknown[], Call
: undefined; : undefined;
// When we need a subscription, ensure that a valid callback is actually passed // When we need a subscription, ensure that a valid callback is actually passed
assert(!needsCallback || isFunction(callback), 'Expected a callback to be passed with subscriptions'); if (needsCallback && !isFunction(callback)) {
throw new Error('Expected a callback to be passed with subscriptions');
}
return [actualArgs, callback]; return [actualArgs, callback];
} }
+1 -1
View File
@@ -12,7 +12,7 @@ import { MockProvider } from '@polkadot/rpc-provider/mock';
import { TypeRegistry } from '@polkadot/types'; import { TypeRegistry } from '@polkadot/types';
import { hexToU8a } from '@polkadot/util'; import { hexToU8a } from '@polkadot/util';
import { SingleAccountSigner } from '../test/util'; import { SingleAccountSigner } from '../test';
import { ApiPromise } from '.'; import { ApiPromise } from '.';
const TRANSFER_SIG = '0xcc277eb341d3801c08f149508221583fa3185cc3944e6cb376cd061640305edd7dc24dfd754adb24768f1d8547389b7720e6f626bc81f5593fba1141e7f7ba07'; const TRANSFER_SIG = '0xcc277eb341d3801c08f149508221583fa3185cc3944e6cb376cd061640305edd7dc24dfd754adb24768f1d8547389b7720e6f626bc81f5593fba1141e7f7ba07';
+7 -3
View File
@@ -12,7 +12,7 @@ import type { AddressOrPair, SignerOptions, SubmittableDryRunResult, Submittable
import { catchError, first, map, mapTo, mergeMap, of, switchMap, tap } from 'rxjs'; import { catchError, first, map, mapTo, mergeMap, of, switchMap, tap } from 'rxjs';
import { assert, isBn, isFunction, isNumber, isString, isU8a, isUndefined, objectSpread } from '@polkadot/util'; import { isBn, isFunction, isNumber, isString, isU8a, objectSpread } from '@polkadot/util';
import { ApiBase } from '../base'; import { ApiBase } from '../base';
import { filterEvents, isKeyringPair } from '../util'; import { filterEvents, isKeyringPair } from '../util';
@@ -34,7 +34,9 @@ const identity = <T> (input: T): T => input;
function makeEraOptions (api: ApiInterfaceRx, registry: Registry, partialOptions: Partial<SignerOptions>, { header, mortalLength, nonce }: { header: Header | null; mortalLength: number; nonce: Index }): SignatureOptions { function makeEraOptions (api: ApiInterfaceRx, registry: Registry, partialOptions: Partial<SignerOptions>, { header, mortalLength, nonce }: { header: Header | null; mortalLength: number; nonce: Index }): SignatureOptions {
if (!header) { if (!header) {
assert(partialOptions.era === 0 || !isUndefined(partialOptions.blockHash), 'Expected blockHash to be passed alongside non-immortal era options'); if (partialOptions.era && !partialOptions.blockHash) {
throw new Error('Expected blockHash to be passed alongside non-immortal era options');
}
if (isNumber(partialOptions.era)) { if (isNumber(partialOptions.era)) {
// since we have no header, it is immortal, remove any option overrides // since we have no header, it is immortal, remove any option overrides
@@ -299,7 +301,9 @@ export function createClass <ApiType extends ApiTypes> ({ api, apiType, blockHas
#signViaSigner = async (address: Address | string | Uint8Array, options: SignatureOptions, header: Header | null): Promise<number> => { #signViaSigner = async (address: Address | string | Uint8Array, options: SignatureOptions, header: Header | null): Promise<number> => {
const signer = options.signer || api.signer; const signer = options.signer || api.signer;
assert(signer, 'No signer specified, either via api.setSigner or via sign options. You possibly need to pass through an explicit keypair for the origin so it can be used for signing.'); if (!signer) {
throw new Error('No signer specified, either via api.setSigner or via sign options. You possibly need to pass through an explicit keypair for the origin so it can be used for signing.');
}
const payload = this.registry.createTypeUnsafe<SignerPayload>('SignerPayload', [objectSpread({}, options, { const payload = this.registry.createTypeUnsafe<SignerPayload>('SignerPayload', [objectSpread({}, options, {
address, address,
@@ -5,7 +5,7 @@ import type { Signer, SignerResult } from '@polkadot/api/types';
import type { KeyringPair } from '@polkadot/keyring/types'; import type { KeyringPair } from '@polkadot/keyring/types';
import type { Registry, SignerPayloadJSON, SignerPayloadRaw } from '@polkadot/types/types'; import type { Registry, SignerPayloadJSON, SignerPayloadRaw } from '@polkadot/types/types';
import { assert, hexToU8a, u8aToHex } from '@polkadot/util'; import { hexToU8a, u8aToHex } from '@polkadot/util';
let id = 0; let id = 0;
@@ -23,7 +23,9 @@ export class SingleAccountSigner implements Signer {
} }
public async signPayload (payload: SignerPayloadJSON): Promise<SignerResult> { public async signPayload (payload: SignerPayloadJSON): Promise<SignerResult> {
assert(payload.address === this.#keyringPair.address, 'Signer does not have the keyringPair'); if (payload.address !== this.#keyringPair.address) {
throw new Error('Signer does not have the keyringPair');
}
return new Promise((resolve): void => { return new Promise((resolve): void => {
setTimeout((): void => { setTimeout((): void => {
@@ -38,7 +40,9 @@ export class SingleAccountSigner implements Signer {
} }
public async signRaw ({ address, data }: SignerPayloadRaw): Promise<SignerResult> { public async signRaw ({ address, data }: SignerPayloadRaw): Promise<SignerResult> {
assert(address === this.#keyringPair.address, 'Signer does not have the keyringPair'); if (address !== this.#keyringPair.address) {
throw new Error('Signer does not have the keyringPair');
}
return new Promise((resolve): void => { return new Promise((resolve): void => {
setTimeout((): void => { setTimeout((): void => {
-72
View File
@@ -1,72 +0,0 @@
// Copyright 2017-2022 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { jest } from '@jest/globals';
import { ApiPromise, WsProvider } from '@polkadot/api';
describe.skip('misc online tests', (): void => {
let api: ApiPromise;
beforeEach(async () => {
jest.setTimeout(30000);
process.env.NODE_ENV = 'test';
// const provider = new WsProvider('wss://kusama-rpc.polkadot.io');
const provider = new WsProvider('wss://westend-rpc.polkadot.io/');
api = await ApiPromise.create({ provider });
});
afterEach(async () => {
await api.disconnect();
});
it('expose rpc and rx definition', (): void => {
console.error(api.rpc.payment.queryFeeDetails.meta);
console.error(api.rx.rpc.chain.getBlock.meta);
});
it.skip('retrieves balances correctly', async (): Promise<void> => {
console.error(JSON.stringify(
await api.query.system.account('FPzukZw2mphWsXDqdkNzLaxnanjZEWH9i2vqwobTdtde5me')
));
console.error(JSON.stringify(
await api.query.system.account('HUewJvzVuEeyaxH2vx9XiyAPKrpu1Zj5r5Pi9VrGiBVty7q')
));
});
it.skip('handles map keys', async (): Promise<void> => {
console.time('map.keys');
const keys = await api.query.system.account.keys();
console.error('# keys', keys.length);
console.timeEnd('map.keys');
});
it.skip('handles map entries', async (): Promise<void> => {
console.time('map.entries');
const entries = await api.query.system.account.entries(); // api.query.indices.accounts.entries();
console.error('# entries', entries.length);
console.timeEnd('map.entries');
});
it.skip('handles doublemap entries', async (): Promise<void> => {
const activeEra = await api.query.staking.activeEra();
console.error(JSON.stringify(
await api.query.staking.erasStakers.entries(activeEra.unwrapOrDefault().index)
));
});
it.skip('does something in society', async (): Promise<void> => {
console.error(JSON.stringify(
await api.query.society.defenderVotes('Dab4bfYTZRUDMWjYAUQuFbDreQ9mt7nULWu3Dw7jodbzVe9')
));
});
});
@@ -3,7 +3,7 @@
import type { EventRecord } from '@polkadot/types/interfaces'; import type { EventRecord } from '@polkadot/types/interfaces';
import { SubmittableResult } from '../..'; import { SubmittableResult } from '..';
// log all events for the transfers, calling done() when finalized // log all events for the transfers, calling done() when finalized
export const logEvents = (done: () => Record<string, unknown>): (r: SubmittableResult) => void => export const logEvents = (done: () => Record<string, unknown>): (r: SubmittableResult) => void =>
@@ -1,237 +0,0 @@
// Copyright 2017-2022 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Enum, Struct } from '@polkadot/types';
import type { Option } from '@polkadot/types/codec';
import type { AccountId, AccountIndex, AccountInfo, Address, Balance, BlockNumber, Index } from '@polkadot/types/interfaces';
import { jest } from '@jest/globals';
import { combineLatest, map, of, switchMap } from 'rxjs';
import { ApiPromise, WsProvider } from '@polkadot/api';
import { memo } from '@polkadot/rpc-core';
interface VestingInfo extends Struct {
readonly locked: Balance;
readonly perBlock: Balance;
readonly startingBlock: BlockNumber;
}
interface SignedBalance extends Enum {
readonly isPositive: boolean;
readonly asPositive: Balance;
readonly isNegative: boolean;
readonly asNegative: Balance;
}
export interface EQDeriveBalancesAll {
freeBalance: Balance;
reservedBalance: Balance;
vestingLocked: Balance;
lockedBalance: Balance;
accountId: AccountId;
accountNonce: Index;
lockedBreakdown: unknown[];
}
type Result = [Balance, Balance, Balance, Index];
type RawResult = [
SignedBalance,
Option<Balance>,
Option<VestingInfo>,
AccountInfo
];
type EQDeriveBalancesQuery = (address: AccountIndex | AccountId | Address | string) => Observable<EQDeriveBalancesAll>;
const typesBundle = {
spec: {
Equilibrium: {
derives: {
balances: {
all: (
instanceId: string,
api: ApiInterfaceRx
): EQDeriveBalancesQuery =>
memo(
instanceId,
(address: AccountIndex | AccountId | Address | string) =>
api.derive.accounts.accountId(address).pipe(
switchMap(
(accountId): Observable<[AccountId, Result]> =>
accountId
? combineLatest([
of(accountId),
api
.queryMulti([
[api.query.balances.account, [accountId, 'EQ']],
[api.query.eqVesting.vested, accountId],
[api.query.eqVesting.vesting, accountId],
[api.query.system.account, accountId]
])
.pipe(
map(
(raw): Result => {
if (raw.length < 4) {
throw new Error('4 members expected');
}
const res = raw as RawResult;
const freeBalance = res[0].asPositive;
let reservedBalance = api.registry.createType(
'Balance'
);
let vestingLocked = api.registry.createType(
'Balance'
);
if (res[1].isSome && res[2].isSome) {
const vested = res[1].unwrap();
const info = res[2].unwrap();
vestingLocked = info.locked;
reservedBalance = api.registry.createType(
'Balance',
vestingLocked.sub(vested)
);
}
return [
freeBalance,
reservedBalance,
vestingLocked,
res[3].nonce
];
}
)
)
])
: of([
api.registry.createType('AccountId'),
[
api.registry.createType('Balance'),
api.registry.createType('Balance'),
api.registry.createType('Balance'),
api.registry.createType('Index')
]
])
),
map(
([
accountId,
[
freeBalance,
reservedBalance,
vestingLocked,
accountNonce
]
]): EQDeriveBalancesAll => ({
accountId,
accountNonce,
freeBalance,
lockedBalance: vestingLocked,
lockedBreakdown: [],
reservedBalance,
vestingLocked
})
)
)
)
}
},
types: [
{
minmax: [0, undefined],
types: {
Balance: 'u64',
BalanceOf: 'Balance',
BalancesAggregate: {
total_debt: 'Balance',
total_issuance: 'Balance'
},
BlockNumber: 'u64',
Currency: {
_enum: ['Unknown', 'Usd', 'EQ', 'Eth', 'Btc', 'Eos', 'Dot']
},
DataPoint: {
account_id: 'AccountId',
block_number: 'BlockNumber',
price: 'u64',
timestamp: 'u64'
},
FixedI64: 'i64',
Keys: 'SessionKeys3',
LookupSource: 'AccountId',
PricePeriod: {
_enum: ['Min', 'TenMin', 'Hour', 'FourHour', 'Day']
},
PricePoint: {
block_number: 'BlockNumber',
data_points: 'Vec<DataPoint>',
price: 'u64',
timestamp: 'u64'
},
ReinitRequest: {
account: 'AccountId',
authority_index: 'AuthIndex',
block_num: 'BlockNumber',
validators_len: 'u32'
},
SignedBalance: {
_enum: {
Negative: 'Balance',
Positive: 'Balance'
}
},
TotalAggregates: {
collateral: 'Balance',
debt: 'Balance'
},
TransferReason: {
_enum: [
'Common',
'InterestFee',
'MarginCall',
'BailsmenRedistribution',
'TreasuryEqBuyout',
'TreasuryBuyEq'
]
},
UserGroup: {
_enum: ['Unknown', 'Balances', 'Bailsman']
},
VestingInfo: {
locked: 'Balance',
perBlock: 'Balance',
startingBlock: 'BlockNumber'
}
}
}
]
}
}
};
function createApi (): Promise<ApiPromise> {
jest.setTimeout(30000);
const provider = new WsProvider('wss://tge.equilibrium.io');
return new ApiPromise({ provider, typesBundle }).isReady;
}
describe.skip('equilibrium api', () => {
it.skip('does not fail on derive.balances.all', async () => {
const api = await createApi();
await api.derive.balances.all(
'5DnoYz3koaRcMZ9Hj4FmQ2nNRKQfS73yBmEzzM9SsPn9cLtb'
);
});
});
+7 -3
View File
@@ -5,7 +5,7 @@ import type { SiLookupTypeId } from '@polkadot/types/interfaces';
import type { StorageEntry } from '@polkadot/types/primitive/types'; import type { StorageEntry } from '@polkadot/types/primitive/types';
import type { Registry } from '@polkadot/types/types'; import type { Registry } from '@polkadot/types/types';
import { assert, isUndefined } from '@polkadot/util'; import { isUndefined } from '@polkadot/util';
function sig ({ lookup }: Registry, { method, section }: StorageEntry, args: SiLookupTypeId[]): string { function sig ({ lookup }: Registry, { method, section }: StorageEntry, args: SiLookupTypeId[]): string {
return `${section}.${method}(${args.map((a) => lookup.getTypeDef(a).type).join(', ')})`; return `${section}.${method}(${args.map((a) => lookup.getTypeDef(a).type).join(', ')})`;
@@ -17,14 +17,18 @@ export function extractStorageArgs (registry: Registry, creator: StorageEntry, _
const args = _args.filter((a) => !isUndefined(a)); const args = _args.filter((a) => !isUndefined(a));
if (creator.meta.type.isPlain) { if (creator.meta.type.isPlain) {
assert(args.length === 0, () => `${sig(registry, creator, [])} does not take any arguments, ${args.length} found`); if (args.length !== 0) {
throw new Error(`${sig(registry, creator, [])} does not take any arguments, ${args.length} found`);
}
} else { } else {
const { hashers, key } = creator.meta.type.asMap; const { hashers, key } = creator.meta.type.asMap;
const keys = hashers.length === 1 const keys = hashers.length === 1
? [key] ? [key]
: registry.lookup.getSiType(key).def.asTuple.map((t) => t); : registry.lookup.getSiType(key).def.asTuple.map((t) => t);
assert(args.length === keys.length, () => `${sig(registry, creator, keys)} is a map, requiring ${keys.length} arguments, ${args.length} found`); if (args.length !== keys.length) {
throw new Error(`${sig(registry, creator, keys)} is a map, requiring ${keys.length} arguments, ${args.length} found`);
}
} }
// pass as tuple // pass as tuple
+5 -5
View File
@@ -20,13 +20,13 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "8.11.3", "version": "8.13.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.18.6", "@babel/runtime": "^7.18.6",
"@polkadot/rpc-core": "8.11.3", "@polkadot/rpc-core": "8.13.1",
"@polkadot/types": "8.11.3", "@polkadot/types": "8.13.1",
"@polkadot/types-codec": "8.11.3", "@polkadot/types-codec": "8.13.1",
"@polkadot/util": "^9.7.2" "@polkadot/util": "^10.0.2"
} }
} }
+9 -3
View File
@@ -1,6 +1,10 @@
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit // Auto-generated via `yarn polkadot-types-from-chain`, do not edit
/* eslint-disable */ /* eslint-disable */
// import type lookup before we augment - in some environments
// this is required to allow for ambient/previous definitions
import '@polkadot/rpc-core/types/jsonrpc';
import type { AugmentedRpc } from '@polkadot/rpc-core/types'; import type { AugmentedRpc } from '@polkadot/rpc-core/types';
import type { Metadata, StorageKey } from '@polkadot/types'; import type { Metadata, StorageKey } from '@polkadot/types';
import type { Bytes, HashMap, Json, Null, Option, Text, U256, U64, Vec, bool, f64, u32, u64 } from '@polkadot/types-codec'; import type { Bytes, HashMap, Json, Null, Option, Text, U256, U64, Vec, bool, f64, u32, u64 } from '@polkadot/types-codec';
@@ -26,8 +30,10 @@ import type { MigrationStatusResult, ReadProof, RuntimeVersion, TraceBlockRespon
import type { ApplyExtrinsicResult, ChainProperties, ChainType, Health, NetworkState, NodeRole, PeerInfo, SyncState } from '@polkadot/types/interfaces/system'; import type { ApplyExtrinsicResult, ChainProperties, ChainType, Health, NetworkState, NodeRole, PeerInfo, SyncState } from '@polkadot/types/interfaces/system';
import type { IExtrinsic, Observable } from '@polkadot/types/types'; import type { IExtrinsic, Observable } from '@polkadot/types/types';
export type __AugmentedRpc = AugmentedRpc<() => unknown>;
declare module '@polkadot/rpc-core/types/jsonrpc' { declare module '@polkadot/rpc-core/types/jsonrpc' {
export interface RpcInterface { interface RpcInterface {
author: { author: {
/** /**
* Returns true if the keystore has private keys for the given public key and key type. * Returns true if the keystore has private keys for the given public key and key type.
@@ -200,7 +206,7 @@ declare module '@polkadot/rpc-core/types/jsonrpc' {
/** /**
* Returns fee history for given block count & reward percentiles * Returns fee history for given block count & reward percentiles
**/ **/
feeHistory: AugmentedRpc<(blockCount: U256 | AnyNumber | Uint8Array, newestBlock: BlockNumber | AnyNumber | Uint8Array, rewardPercentiles: Option<Vec<f64>> | null | object | string | Uint8Array) => Observable<EthFeeHistory>>; feeHistory: AugmentedRpc<(blockCount: U256 | AnyNumber | Uint8Array, newestBlock: BlockNumber | AnyNumber | Uint8Array, rewardPercentiles: Option<Vec<f64>> | null | Uint8Array | Vec<f64> | (f64)[]) => Observable<EthFeeHistory>>;
/** /**
* Returns current gas price. * Returns current gas price.
**/ **/
@@ -490,7 +496,7 @@ declare module '@polkadot/rpc-core/types/jsonrpc' {
/** /**
* Provides a way to trace the re-execution of a single block * Provides a way to trace the re-execution of a single block
**/ **/
traceBlock: AugmentedRpc<(block: Hash | string | Uint8Array, targets: Option<Text> | null | object | string | Uint8Array, storageKeys: Option<Text> | null | object | string | Uint8Array, methods: Option<Text> | null | object | string | Uint8Array) => Observable<TraceBlockResponse>>; traceBlock: AugmentedRpc<(block: Hash | string | Uint8Array, targets: Option<Text> | null | Uint8Array | Text | string, storageKeys: Option<Text> | null | Uint8Array | Text | string, methods: Option<Text> | null | Uint8Array | Text | string) => Observable<TraceBlockResponse>>;
/** /**
* Check current migration state * Check current migration state
**/ **/
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/rpc-augment', path: 'auto', type: 'auto', version: '8.11.3' }; export const packageInfo = { name: '@polkadot/rpc-augment', path: 'auto', type: 'auto', version: '8.13.1' };
+8 -8
View File
@@ -20,18 +20,18 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "8.11.3", "version": "8.13.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.18.6", "@babel/runtime": "^7.18.6",
"@polkadot/rpc-augment": "8.11.3", "@polkadot/rpc-augment": "8.13.1",
"@polkadot/rpc-provider": "8.11.3", "@polkadot/rpc-provider": "8.13.1",
"@polkadot/types": "8.11.3", "@polkadot/types": "8.13.1",
"@polkadot/util": "^9.7.2", "@polkadot/util": "^10.0.2",
"rxjs": "^7.5.5" "rxjs": "^7.5.6"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/keyring": "^9.7.2", "@polkadot/keyring": "^10.0.2",
"@polkadot/rpc-augment": "8.11.3" "@polkadot/rpc-augment": "8.13.1"
} }
} }
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/rpc-core', path: 'auto', type: 'auto', version: '8.11.3' }; export const packageInfo = { name: '@polkadot/rpc-core', path: 'auto', type: 'auto', version: '8.13.1' };
+10 -10
View File
@@ -20,19 +20,19 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "8.11.3", "version": "8.13.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.18.6", "@babel/runtime": "^7.18.6",
"@polkadot/keyring": "^9.7.2", "@polkadot/keyring": "^10.0.2",
"@polkadot/types": "8.11.3", "@polkadot/types": "8.13.1",
"@polkadot/types-support": "8.11.3", "@polkadot/types-support": "8.13.1",
"@polkadot/util": "^9.7.2", "@polkadot/util": "^10.0.2",
"@polkadot/util-crypto": "^9.7.2", "@polkadot/util-crypto": "^10.0.2",
"@polkadot/x-fetch": "^9.7.2", "@polkadot/x-fetch": "^10.0.2",
"@polkadot/x-global": "^9.7.2", "@polkadot/x-global": "^10.0.2",
"@polkadot/x-ws": "^9.7.2", "@polkadot/x-ws": "^10.0.2",
"@substrate/connect": "0.7.7", "@substrate/connect": "0.7.8",
"eventemitter3": "^4.0.7", "eventemitter3": "^4.0.7",
"mock-socket": "^9.1.5", "mock-socket": "^9.1.5",
"nock": "^13.2.8" "nock": "^13.2.8"
+3 -6
View File
@@ -21,7 +21,6 @@ describe('send', (): void => {
}); });
it('passes the body through correctly', (): Promise<void> => { it('passes the body through correctly', (): Promise<void> => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
mock = mockHttp([{ mock = mockHttp([{
method: 'test_body', method: 'test_body',
reply: { reply: {
@@ -32,8 +31,7 @@ describe('send', (): void => {
return http return http
.send('test_body', ['param']) .send('test_body', ['param'])
.then((): void => { .then((): void => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access expect(mock.body.test_body).toEqual({
expect((mock.body as any).test_body).toEqual({
id: 1, id: 1,
jsonrpc: '2.0', jsonrpc: '2.0',
method: 'test_body', method: 'test_body',
@@ -42,8 +40,7 @@ describe('send', (): void => {
}); });
}); });
it('throws error when !response.ok', (): Promise<any> => { it('throws error when !response.ok', async (): Promise<any> => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
mock = mockHttp([{ mock = mockHttp([{
code: 500, code: 500,
method: 'test_error' method: 'test_error'
@@ -52,7 +49,7 @@ describe('send', (): void => {
return http return http
.send('test_error', []) .send('test_error', [])
.catch((error): void => { .catch((error): void => {
expect((error as Error).message).toMatch(/\[500\]: Internal Server/); expect((error as Error).message).toMatch(/\[500\]/);
}); });
}); });
}); });
+7 -9
View File
@@ -13,8 +13,8 @@ import EventEmitter from 'eventemitter3';
import { createTestKeyring } from '@polkadot/keyring/testing'; import { createTestKeyring } from '@polkadot/keyring/testing';
import { decorateStorage, Metadata } from '@polkadot/types'; import { decorateStorage, Metadata } from '@polkadot/types';
import jsonrpc from '@polkadot/types/interfaces/jsonrpc'; import jsonrpc from '@polkadot/types/interfaces/jsonrpc';
import rpcHeader from '@polkadot/types-support/json/Header.004.json'; import rpcHeader from '@polkadot/types-support/json/Header.004.json' assert { type: 'json' };
import rpcSignedBlock from '@polkadot/types-support/json/SignedBlock.004.immortal.json'; import rpcSignedBlock from '@polkadot/types-support/json/SignedBlock.004.immortal.json' assert { type: 'json' };
import rpcMetadata from '@polkadot/types-support/metadata/static-substrate'; import rpcMetadata from '@polkadot/types-support/metadata/static-substrate';
import { BN, bnToU8a, logger, u8aToHex } from '@polkadot/util'; import { BN, bnToU8a, logger, u8aToHex } from '@polkadot/util';
import { randomAsU8a } from '@polkadot/util-crypto'; import { randomAsU8a } from '@polkadot/util-crypto';
@@ -44,8 +44,7 @@ export class MockProvider implements ProviderInterface {
private emitter = new EventEmitter(); private emitter = new EventEmitter();
// Browser/Deno = number, Node = Timeout private intervalId?: ReturnType<typeof setInterval> | null;
private intervalId?: unknown | null;
public isUpdating = true; public isUpdating = true;
@@ -110,8 +109,7 @@ export class MockProvider implements ProviderInterface {
// eslint-disable-next-line @typescript-eslint/require-await // eslint-disable-next-line @typescript-eslint/require-await
public async disconnect (): Promise<void> { public async disconnect (): Promise<void> {
if (this.intervalId) { if (this.intervalId) {
// different method signatures for Node vs Browser/Deno clearInterval(this.intervalId);
clearInterval(this.intervalId as number);
this.intervalId = null; this.intervalId = null;
} }
} }
@@ -227,8 +225,8 @@ export class MockProvider implements ProviderInterface {
number: blockNumber, number: blockNumber,
parentHash: blockNumber.isZero() parentHash: blockNumber.isZero()
? new Uint8Array(32) ? new Uint8Array(32)
: bnToU8a(this.prevNumber, 256, false), : bnToU8a(this.prevNumber, { bitLength: 256, isLe: false }),
stateRoot: bnToU8a(blockNumber, 256, false) stateRoot: bnToU8a(blockNumber, { bitLength: 256, isLe: false })
}); });
this.prevNumber = blockNumber; this.prevNumber = blockNumber;
@@ -237,7 +235,7 @@ export class MockProvider implements ProviderInterface {
} }
private setStateBn (key: Uint8Array, value: BN | number): void { private setStateBn (key: Uint8Array, value: BN | number): void {
this.db[u8aToHex(key)] = bnToU8a(value, 64, true); this.db[u8aToHex(key)] = bnToU8a(value, { bitLength: 64, isLe: true });
} }
private updateSubs (method: string, value: Codec): void { private updateSubs (method: string, value: Codec): void {
+20 -8
View File
@@ -1,23 +1,35 @@
// Copyright 2017-2022 @polkadot/rpc-provider authors & contributors // Copyright 2017-2022 @polkadot/rpc-provider authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
/* eslint-disable */ import type { Mock } from './types';
import nock from 'nock'; import nock from 'nock';
interface Request {
code?: number;
method: string;
reply?: Record<string, unknown>;
}
interface HttpMock extends Mock {
post: (uri: string) => {
reply: (code: number, handler: (uri: string, body: { id: string }) => unknown) => HttpMock
}
}
export const TEST_HTTP_URL = 'http://localhost:9944'; export const TEST_HTTP_URL = 'http://localhost:9944';
export function mockHttp (requests: any[]): any { export function mockHttp (requests: Request[]): Mock {
nock.cleanAll(); nock.cleanAll();
return requests.reduce((scope, request: any): nock.Scope => { return requests.reduce((scope: HttpMock, request: Request) =>
return scope scope
.post('/') .post('/')
.reply(request.code || 200, (uri: string, body: { id: string }): any => { .reply(request.code || 200, (uri: string, body: { id: string }) => {
scope.body = scope.body || {}; scope.body = scope.body || {};
scope.body[request.method] = body; scope.body[request.method] = body;
return Object.assign({ id: body.id, jsonrpc: '2.0' }, request.reply || {}); return Object.assign({ id: body.id, jsonrpc: '2.0' }, request.reply || {}) as unknown;
}); }),
}, nock(TEST_HTTP_URL)); nock(TEST_HTTP_URL) as unknown as HttpMock);
} }
+1 -1
View File
@@ -11,7 +11,7 @@ export interface Global extends NodeJS.Global {
} }
export interface Mock { export interface Mock {
body: Record<string, any>; body: Record<string, Record<string, unknown>>;
requests: number; requests: number;
server: Server; server: Server;
done: () => Record<string, unknown>; done: () => Record<string, unknown>;
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/rpc-provider', path: 'auto', type: 'auto', version: '8.11.3' }; export const packageInfo = { name: '@polkadot/rpc-provider', path: 'auto', type: 'auto', version: '8.13.1' };
@@ -15,6 +15,9 @@
/* eslint-disable @typescript-eslint/restrict-template-expressions */ /* eslint-disable @typescript-eslint/restrict-template-expressions */
/* eslint-disable @typescript-eslint/ban-types */ /* eslint-disable @typescript-eslint/ban-types */
// FIXME A number of tests here, that were passing, is not skipped since
// Jest has "some" issues with `await import` - we don't transform these
import type { Chain, JsonRpcCallback } from '@substrate/connect'; import type { Chain, JsonRpcCallback } from '@substrate/connect';
import type { HealthChecker, SmoldotHealth } from './Health'; import type { HealthChecker, SmoldotHealth } from './Health';
import type { ScProviderClass } from './ScProvider'; import type { ScProviderClass } from './ScProvider';
@@ -199,7 +202,7 @@ beforeAll(async () => {
mockedConnector = (await import( mockedConnector = (await import(
'@substrate/connect' '@substrate/connect'
)) as unknown as ReturnType<typeof connectorFactory>; )) as unknown as ReturnType<typeof connectorFactory>;
mockedHealthChecker = await (import('./Health') as any); mockedHealthChecker = healthCheckerFactory(); // await import('./Health')
}); });
describe('ScProvider', () => { describe('ScProvider', () => {
@@ -207,7 +210,7 @@ describe('ScProvider', () => {
it('emits `connected` as soon as the chain is not syncing', async () => { it('emits `connected` as soon as the chain is not syncing', async () => {
const provider = new ScProvider(''); const provider = new ScProvider('');
await provider.connect(); await provider.connect(undefined, mockedHealthChecker.healthChecker);
const onConnected = jest.fn(); const onConnected = jest.fn();
@@ -221,7 +224,7 @@ describe('ScProvider', () => {
it('stops receiving notifications after unsubscribing', async () => { it('stops receiving notifications after unsubscribing', async () => {
const provider = new ScProvider(''); const provider = new ScProvider('');
await provider.connect(); await provider.connect(undefined, mockedHealthChecker.healthChecker);
const onConnected = jest.fn(); const onConnected = jest.fn();
@@ -235,7 +238,7 @@ describe('ScProvider', () => {
it('synchronously emits connected if the Provider is already `connected`', async () => { it('synchronously emits connected if the Provider is already `connected`', async () => {
const provider = new ScProvider(''); const provider = new ScProvider('');
await provider.connect(); await provider.connect(undefined, mockedHealthChecker.healthChecker);
setChainSyncyingStatus(false); setChainSyncyingStatus(false);
@@ -248,7 +251,7 @@ describe('ScProvider', () => {
it('emits `disconnected` once the chain goes back to syncing', async () => { it('emits `disconnected` once the chain goes back to syncing', async () => {
const provider = new ScProvider(''); const provider = new ScProvider('');
await provider.connect(); await provider.connect(undefined, mockedHealthChecker.healthChecker);
setChainSyncyingStatus(false); setChainSyncyingStatus(false);
@@ -274,7 +277,7 @@ describe('ScProvider', () => {
it('supports subscriptions', async () => { it('supports subscriptions', async () => {
const provider = new ScProvider(''); const provider = new ScProvider('');
await provider.connect(); await provider.connect(undefined, mockedHealthChecker.healthChecker);
expect(provider.hasSubscriptions).toBe(true); expect(provider.hasSubscriptions).toBe(true);
}); });
@@ -284,41 +287,41 @@ describe('ScProvider', () => {
it('can not be clonned', async () => { it('can not be clonned', async () => {
const provider = new ScProvider(''); const provider = new ScProvider('');
await provider.connect(); await provider.connect(undefined, mockedHealthChecker.healthChecker);
expect(() => provider.clone()).toThrowError(); expect(() => provider.clone()).toThrowError();
}); });
}); });
describe('connect', () => { describe('connect', () => {
it('does not create a new chain when trying to re-connect while the current chain is syncing', async () => { it.skip('does not create a new chain when trying to re-connect while the current chain is syncing', async () => {
const provider = new ScProvider(''); const provider = new ScProvider('');
await provider.connect(); await provider.connect(undefined, mockedHealthChecker.healthChecker);
const chain = mockedConnector.latestChain(); const chain = mockedConnector.latestChain();
await provider.connect(); await provider.connect(undefined, mockedHealthChecker.healthChecker);
expect(chain).toBe(mockedConnector.latestChain()); expect(chain).toBe(mockedConnector.latestChain());
}); });
it('throws when trying to connect on an already connected Provider', async () => { it('throws when trying to connect on an already connected Provider', async () => {
const provider = new ScProvider(''); const provider = new ScProvider('');
await provider.connect(); await provider.connect(undefined, mockedHealthChecker.healthChecker);
setChainSyncyingStatus(false); setChainSyncyingStatus(false);
await expect(provider.connect()).rejects.toThrowError( await expect(provider.connect(undefined, mockedHealthChecker.healthChecker)).rejects.toThrowError(
'Already connected!' 'Already connected!'
); );
}); });
}); });
describe('disconnect', () => { describe('disconnect', () => {
it('removes the chain and cleans up', async () => { it.skip('removes the chain and cleans up', async () => {
const provider = new ScProvider(''); const provider = new ScProvider('');
await provider.connect(); await provider.connect(undefined, mockedHealthChecker.healthChecker);
const chain = mockedConnector.latestChain(); const chain = mockedConnector.latestChain();
await provider.disconnect(); await provider.disconnect();
@@ -329,7 +332,7 @@ describe('ScProvider', () => {
it('does not throw when disconnecting on an already disconnected Provider', async () => { it('does not throw when disconnecting on an already disconnected Provider', async () => {
const provider = new ScProvider(''); const provider = new ScProvider('');
await provider.connect(); await provider.connect(undefined, mockedHealthChecker.healthChecker);
await provider.disconnect(); await provider.disconnect();
await expect(provider.disconnect()).resolves.not.toThrow(); await expect(provider.disconnect()).resolves.not.toThrow();
@@ -340,15 +343,15 @@ describe('ScProvider', () => {
it('throws when trying to send a request while the Provider is not connected', async () => { it('throws when trying to send a request while the Provider is not connected', async () => {
const provider = new ScProvider(''); const provider = new ScProvider('');
await provider.connect(); await provider.connect(undefined, mockedHealthChecker.healthChecker);
await expect(provider.send('', [])).rejects.toThrow(); await expect(provider.send('', [])).rejects.toThrow();
}); });
it('receives responses to its requests', async () => { it.skip('receives responses to its requests', async () => {
const provider = new ScProvider(''); const provider = new ScProvider('');
await provider.connect(); await provider.connect(undefined, mockedHealthChecker.healthChecker);
const chain = mockedConnector.latestChain(); const chain = mockedConnector.latestChain();
setChainSyncyingStatus(false); setChainSyncyingStatus(false);
@@ -373,10 +376,10 @@ describe('ScProvider', () => {
expect(response).toEqual(result); expect(response).toEqual(result);
}); });
it("rejects when the response can't be deserialized", async () => { it.skip("rejects when the response can't be deserialized", async () => {
const provider = new ScProvider(''); const provider = new ScProvider('');
await provider.connect(); await provider.connect(undefined, mockedHealthChecker.healthChecker);
const chain = mockedConnector.latestChain(); const chain = mockedConnector.latestChain();
setChainSyncyingStatus(false); setChainSyncyingStatus(false);
@@ -391,10 +394,10 @@ describe('ScProvider', () => {
await expect(provider.send('getData', ['foo'])).rejects.toThrow(); await expect(provider.send('getData', ['foo'])).rejects.toThrow();
}); });
it('rejects when the smoldot chain has crashed', async () => { it.skip('rejects when the smoldot chain has crashed', async () => {
const provider = new ScProvider(''); const provider = new ScProvider('');
await provider.connect(); await provider.connect(undefined, mockedHealthChecker.healthChecker);
const chain = mockedConnector.latestChain(); const chain = mockedConnector.latestChain();
setChainSyncyingStatus(false); setChainSyncyingStatus(false);
@@ -412,10 +415,10 @@ describe('ScProvider', () => {
}); });
describe('subscribe', () => { describe('subscribe', () => {
it('subscribes and recives messages until it unsubscribes', async () => { it.skip('subscribes and recives messages until it unsubscribes', async () => {
const provider = new ScProvider(''); const provider = new ScProvider('');
await provider.connect(); await provider.connect(undefined, mockedHealthChecker.healthChecker);
const chain = mockedConnector.latestChain(); const chain = mockedConnector.latestChain();
setChainSyncyingStatus(false); setChainSyncyingStatus(false);
@@ -477,10 +480,10 @@ describe('ScProvider', () => {
expect(cb).toHaveBeenLastCalledWith(null, 2); expect(cb).toHaveBeenLastCalledWith(null, 2);
}); });
it('ignores subscription messages that were received before the subscription token', async () => { it.skip('ignores subscription messages that were received before the subscription token', async () => {
const provider = new ScProvider(''); const provider = new ScProvider('');
await provider.connect(); await provider.connect(undefined, mockedHealthChecker.healthChecker);
const chain = mockedConnector.latestChain(); const chain = mockedConnector.latestChain();
setChainSyncyingStatus(false); setChainSyncyingStatus(false);
@@ -515,10 +518,10 @@ describe('ScProvider', () => {
expect(cb).not.toHaveBeenCalled(); expect(cb).not.toHaveBeenCalled();
}); });
it('emits the error when the message has an error', async () => { it.skip('emits the error when the message has an error', async () => {
const provider = new ScProvider(''); const provider = new ScProvider('');
await provider.connect(); await provider.connect(undefined, mockedHealthChecker.healthChecker);
const chain = mockedConnector.latestChain(); const chain = mockedConnector.latestChain();
setChainSyncyingStatus(false); setChainSyncyingStatus(false);
@@ -560,7 +563,7 @@ describe('ScProvider', () => {
it('errors when subscribing to an unsupported method', async () => { it('errors when subscribing to an unsupported method', async () => {
const provider = new ScProvider(''); const provider = new ScProvider('');
await provider.connect(); await provider.connect(undefined, mockedHealthChecker.healthChecker);
setChainSyncyingStatus(false); setChainSyncyingStatus(false);
await wait(0); await wait(0);
@@ -575,7 +578,7 @@ describe('ScProvider', () => {
it('rejects when trying to unsubscribe from un unexisting subscription', async () => { it('rejects when trying to unsubscribe from un unexisting subscription', async () => {
const provider = new ScProvider(''); const provider = new ScProvider('');
await provider.connect(); await provider.connect(undefined, mockedHealthChecker.healthChecker);
setChainSyncyingStatus(false); setChainSyncyingStatus(false);
@@ -585,10 +588,10 @@ describe('ScProvider', () => {
}); });
}); });
it('cleans up the stale subscriptions once it reconnects', async () => { it.skip('cleans up the stale subscriptions once it reconnects', async () => {
const provider = new ScProvider(''); const provider = new ScProvider('');
await provider.connect(); await provider.connect(undefined, mockedHealthChecker.healthChecker);
const chain = mockedConnector.latestChain(); const chain = mockedConnector.latestChain();
// setting the syncing status of the chain to fals so that the Provider // setting the syncing status of the chain to fals so that the Provider
@@ -70,7 +70,7 @@ export class ScProvider implements ProviderInterface {
// Config details can be found in @substrate/connect repo following the link: // Config details can be found in @substrate/connect repo following the link:
// https://github.com/paritytech/substrate-connect/blob/main/packages/connect/src/connector/index.ts // https://github.com/paritytech/substrate-connect/blob/main/packages/connect/src/connector/index.ts
async connect (config?: ScConfig): Promise<void> { async connect (config?: ScConfig, checkerFactory = healthChecker): Promise<void> {
if (this.isConnected) { if (this.isConnected) {
throw new Error('Already connected!'); throw new Error('Already connected!');
} }
@@ -99,7 +99,7 @@ export class ScProvider implements ProviderInterface {
scClients.set(this, client); scClients.set(this, client);
const hc = healthChecker(); const hc = checkerFactory();
const onResponse = (res: string): void => { const onResponse = (res: string): void => {
const hcRes = hc.responsePassThrough(res); const hcRes = hc.responsePassThrough(res);
+11 -9
View File
@@ -106,8 +106,7 @@ export class WsProvider implements ProviderInterface {
#subscriptions: Record<string, WsStateSubscription> = {}; #subscriptions: Record<string, WsStateSubscription> = {};
// Browser/Deno = number, Node = Timeout #timeoutId?: ReturnType<typeof setInterval> | null = null;
#timeoutId?: unknown | null = null;
#websocket: WebSocket | null; #websocket: WebSocket | null;
@@ -197,7 +196,9 @@ export class WsProvider implements ProviderInterface {
public async connect (): Promise<void> { public async connect (): Promise<void> {
try { try {
this.#endpointIndex = (this.#endpointIndex + 1) % this.#endpoints.length; this.#endpointIndex = (this.#endpointIndex + 1) % this.#endpoints.length;
this.#websocket = typeof xglobal.WebSocket !== 'undefined' && isChildClass(xglobal.WebSocket, WebSocket)
// the as typeof WebSocket here is Deno-specific - not available on the globalThis
this.#websocket = typeof xglobal.WebSocket !== 'undefined' && isChildClass(xglobal.WebSocket as typeof WebSocket, WebSocket)
? new WebSocket(this.#endpoints[this.#endpointIndex]) ? new WebSocket(this.#endpoints[this.#endpointIndex])
// eslint-disable-next-line @typescript-eslint/ban-ts-comment // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore - WS may be an instance of w3cwebsocket, which supports headers // @ts-ignore - WS may be an instance of w3cwebsocket, which supports headers
@@ -212,10 +213,12 @@ export class WsProvider implements ProviderInterface {
maxReceivedMessageSize: 24 * MEGABYTE maxReceivedMessageSize: 24 * MEGABYTE
}); });
this.#websocket.onclose = this.#onSocketClose; if (this.#websocket) {
this.#websocket.onerror = this.#onSocketError; this.#websocket.onclose = this.#onSocketClose;
this.#websocket.onmessage = this.#onSocketMessage; this.#websocket.onerror = this.#onSocketError;
this.#websocket.onopen = this.#onSocketOpen; this.#websocket.onmessage = this.#onSocketMessage;
this.#websocket.onopen = this.#onSocketOpen;
}
// timeout any handlers that have not had a response // timeout any handlers that have not had a response
this.#timeoutId = setInterval(() => this.#timeoutHandlers(), TIMEOUT_INTERVAL); this.#timeoutId = setInterval(() => this.#timeoutHandlers(), TIMEOUT_INTERVAL);
@@ -427,8 +430,7 @@ export class WsProvider implements ProviderInterface {
} }
if (this.#timeoutId) { if (this.#timeoutId) {
// different method signatures for Node vs Browser/Deno clearInterval(this.#timeoutId);
clearInterval(this.#timeoutId as number);
this.#timeoutId = null; this.#timeoutId = null;
} }
+13 -13
View File
@@ -20,7 +20,7 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "8.11.3", "version": "8.13.1",
"main": "index.js", "main": "index.js",
"bin": { "bin": {
"polkadot-types-chain-info": "./scripts/polkadot-types-chain-info.cjs", "polkadot-types-chain-info": "./scripts/polkadot-types-chain-info.cjs",
@@ -33,18 +33,18 @@
"@babel/core": "^7.18.6", "@babel/core": "^7.18.6",
"@babel/register": "^7.18.6", "@babel/register": "^7.18.6",
"@babel/runtime": "^7.18.6", "@babel/runtime": "^7.18.6",
"@polkadot/api": "8.11.3", "@polkadot/api": "8.13.1",
"@polkadot/api-augment": "8.11.3", "@polkadot/api-augment": "8.13.1",
"@polkadot/rpc-augment": "8.11.3", "@polkadot/rpc-augment": "8.13.1",
"@polkadot/rpc-provider": "8.11.3", "@polkadot/rpc-provider": "8.13.1",
"@polkadot/types": "8.11.3", "@polkadot/types": "8.13.1",
"@polkadot/types-augment": "8.11.3", "@polkadot/types-augment": "8.13.1",
"@polkadot/types-codec": "8.11.3", "@polkadot/types-codec": "8.13.1",
"@polkadot/types-create": "8.11.3", "@polkadot/types-create": "8.13.1",
"@polkadot/types-support": "8.11.3", "@polkadot/types-support": "8.13.1",
"@polkadot/util": "^9.7.2", "@polkadot/util": "^10.0.2",
"@polkadot/util-crypto": "^9.7.2", "@polkadot/util-crypto": "^10.0.2",
"@polkadot/x-ws": "^9.7.2", "@polkadot/x-ws": "^10.0.2",
"handlebars": "^4.7.7", "handlebars": "^4.7.7",
"websocket": "^1.0.34", "websocket": "^1.0.34",
"yargs": "^17.5.1" "yargs": "^17.5.1"
+6 -19
View File
@@ -12,9 +12,7 @@ import { formatNumber } from '@polkadot/util';
import { generateDefaultCalls, generateDefaultConsts, generateDefaultErrors, generateDefaultEvents, generateDefaultQuery, generateDefaultRpc, generateDefaultTx } from './generate'; import { generateDefaultCalls, generateDefaultConsts, generateDefaultErrors, generateDefaultEvents, generateDefaultQuery, generateDefaultRpc, generateDefaultTx } from './generate';
import { assertDir, assertFile, getMetadataViaWs, HEADER, writeFile } from './util'; import { assertDir, assertFile, getMetadataViaWs, HEADER, writeFile } from './util';
type Version = { apis: [HexString, number][] }; function generate (metaHex: HexString, pkg: string | undefined, output: string, isStrict?: boolean): void {
function generate (metaHex: HexString, version: Version | null, pkg: string | undefined, output: string, isStrict?: boolean): void {
console.log(`Generating from metadata, ${formatNumber((metaHex.length - 2) / 2)} bytes`); console.log(`Generating from metadata, ${formatNumber((metaHex.length - 2) / 2)} bytes`);
const outputPath = assertDir(path.join(process.cwd(), output)); const outputPath = assertDir(path.join(process.cwd(), output));
@@ -48,7 +46,7 @@ function generate (metaHex: HexString, version: Version | null, pkg: string | un
generateDefaultQuery(path.join(outputPath, 'augment-api-query.ts'), metaHex, extraTypes, isStrict, customLookupDefinitions); generateDefaultQuery(path.join(outputPath, 'augment-api-query.ts'), metaHex, extraTypes, isStrict, customLookupDefinitions);
generateDefaultRpc(path.join(outputPath, 'augment-api-rpc.ts'), extraTypes); generateDefaultRpc(path.join(outputPath, 'augment-api-rpc.ts'), extraTypes);
generateDefaultTx(path.join(outputPath, 'augment-api-tx.ts'), metaHex, extraTypes, isStrict, customLookupDefinitions); generateDefaultTx(path.join(outputPath, 'augment-api-tx.ts'), metaHex, extraTypes, isStrict, customLookupDefinitions);
generateDefaultCalls(path.join(outputPath, 'augment-api-runtime.ts'), metaHex, version, extraTypes, isStrict, customLookupDefinitions); generateDefaultCalls(path.join(outputPath, 'augment-api-runtime.ts'), metaHex, extraTypes, isStrict, customLookupDefinitions);
writeFile(path.join(outputPath, 'augment-api.ts'), (): string => writeFile(path.join(outputPath, 'augment-api.ts'), (): string =>
[ [
@@ -64,10 +62,10 @@ function generate (metaHex: HexString, version: Version | null, pkg: string | un
process.exit(0); process.exit(0);
} }
type ArgV = { endpoint: string; output: string; package?: string; strict?: boolean, version?: string }; type ArgV = { endpoint: string; output: string; package?: string; strict?: boolean };
export function main (): void { export function main (): void {
const { endpoint, output, package: pkg, strict: isStrict, version } = yargs.strict().options({ const { endpoint, output, package: pkg, strict: isStrict } = yargs.strict().options({
endpoint: { endpoint: {
description: 'The endpoint to connect to (e.g. wss://kusama-rpc.polkadot.io) or relative path to a file containing the JSON output of an RPC state_getMetadata call', description: 'The endpoint to connect to (e.g. wss://kusama-rpc.polkadot.io) or relative path to a file containing the JSON output of an RPC state_getMetadata call',
required: true, required: true,
@@ -85,28 +83,17 @@ export function main (): void {
strict: { strict: {
description: 'Turns on strict mode, no output of catch-all generic versions', description: 'Turns on strict mode, no output of catch-all generic versions',
type: 'boolean' type: 'boolean'
},
version: {
description: 'Pass through a version JSON (if endpoint is non-wss)',
type: 'string'
} }
}).argv as ArgV; }).argv as ArgV;
if (endpoint.startsWith('wss://') || endpoint.startsWith('ws://')) { if (endpoint.startsWith('wss://') || endpoint.startsWith('ws://')) {
getMetadataViaWs(endpoint) getMetadataViaWs(endpoint)
.then(({ metadata, version }) => generate(metadata, version, pkg, output, isStrict)) .then((metadata) => generate(metadata, pkg, output, isStrict))
.catch(() => process.exit(1)); .catch(() => process.exit(1));
} else { } else {
let rtv: Version | null = null;
if (version) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
rtv = (require(assertFile(path.join(process.cwd(), version))) as Record<string, Version>).result;
}
// eslint-disable-next-line @typescript-eslint/no-var-requires // eslint-disable-next-line @typescript-eslint/no-var-requires
const metadata = (require(assertFile(path.join(process.cwd(), endpoint))) as Record<string, HexString>).result; const metadata = (require(assertFile(path.join(process.cwd(), endpoint))) as Record<string, HexString>).result;
generate(metadata, rtv, pkg, output, isStrict); generate(metadata, pkg, output, isStrict);
} }
} }
+1 -1
View File
@@ -72,7 +72,7 @@ export function main (): void {
if (endpoint) { if (endpoint) {
if (endpoint.startsWith('wss://') || endpoint.startsWith('ws://')) { if (endpoint.startsWith('wss://') || endpoint.startsWith('ws://')) {
getMetadataViaWs(endpoint) getMetadataViaWs(endpoint)
.then(({ metadata }) => generateDefaultLookup(inputPath, metadata)) .then((metadata) => generateDefaultLookup(inputPath, metadata))
.catch(() => process.exit(1)); .catch(() => process.exit(1));
} else { } else {
// eslint-disable-next-line @typescript-eslint/no-var-requires // eslint-disable-next-line @typescript-eslint/no-var-requires
+9 -6
View File
@@ -188,13 +188,16 @@ function generateLookupTypes (registry: Registry, filtered: [PortableType, TypeD
), ),
interfaces: [] interfaces: []
}; };
const items = filtered.map(([, typeDef]) => { const items = filtered
typeDef.name = typeDef.lookupName; .map(([, typeDef]) => {
typeDef.name = typeDef.lookupName;
return typeDef.lookupNameRoot && typeDef.lookupName return typeDef.lookupNameRoot && typeDef.lookupName
? exportInterface(typeDef.lookupIndex, typeDef.lookupName, typeDef.lookupNameRoot) ? exportInterface(typeDef.lookupIndex, typeDef.lookupName, typeDef.lookupNameRoot)
: typeEncoders[typeDef.info](registry, imports.definitions, typeDef, imports); : typeEncoders[typeDef.info](registry, imports.definitions, typeDef, imports);
}).filter((t): t is string => !!t); })
.filter((t): t is string => !!t)
.map((t) => t.replace(/\nexport /, '\n'));
writeFile(path.join(destDir, `types${subPath ? `-${subPath}` : ''}.ts`), () => generateLookupTypesTmpl({ writeFile(path.join(destDir, `types${subPath ? `-${subPath}` : ''}.ts`), () => generateLookupTypesTmpl({
headerType: 'defs', headerType: 'defs',
+23 -6
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2022 @polkadot/typegen authors & contributors // Copyright 2017-2022 @polkadot/typegen authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { TypeRegistry } from '@polkadot/types/create'; import type { Metadata } from '@polkadot/types/metadata/Metadata';
import type { DefinitionCallNamed, Definitions } from '@polkadot/types/types'; import type { DefinitionCallNamed, Definitions } from '@polkadot/types/types';
import type { HexString } from '@polkadot/util/types'; import type { HexString } from '@polkadot/util/types';
import type { ExtraTypes } from './types'; import type { ExtraTypes } from './types';
@@ -67,7 +67,7 @@ function getDefs (apis: Apis | null, defs: Record<string, Definitions>): Record<
} }
/** @internal */ /** @internal */
export function generateCallTypes (registry: TypeRegistry, dest: string, apis: Apis | null, extraTypes: ExtraTypes, isStrict: boolean, customLookupDefinitions?: Definitions): void { export function generateCallTypes (meta: Metadata, dest: string, extraTypes: ExtraTypes, isStrict: boolean, customLookupDefinitions?: Definitions): void {
writeFile(dest, (): string => { writeFile(dest, (): string => {
const allTypes: ExtraTypes = { const allTypes: ExtraTypes = {
'@polkadot/types-augment': { '@polkadot/types-augment': {
@@ -80,6 +80,24 @@ export function generateCallTypes (registry: TypeRegistry, dest: string, apis: A
...extraTypes ...extraTypes
}; };
const imports = createImports(allTypes); const imports = createImports(allTypes);
// find the system.Version in metadata
let apis: Apis | null = null;
const { pallets, registry } = meta.asLatest;
const sysp = pallets.find(({ name }) => name.eq('System'));
if (sysp) {
const verc = sysp.constants.find(({ name }) => name.eq('Version'));
if (verc) {
apis = registry.createType('RuntimeVersion', verc.value).apis.map(([k, v]): [HexString, number] => [k.toHex(), v.toNumber()]);
} else {
console.error('Unable to find System.Version pallet, skipping API extraction');
}
} else {
console.error('Unable to find System pallet, skipping API extraction');
}
const allDefs = Object.entries(allTypes).reduce((defs, [path, obj]) => { const allDefs = Object.entries(allTypes).reduce((defs, [path, obj]) => {
return Object.entries(obj).reduce((defs, [key, value]) => ({ ...defs, [`${path}/${key}`]: value }), defs); return Object.entries(obj).reduce((defs, [key, value]) => ({ ...defs, [`${path}/${key}`]: value }), defs);
}, {}); }, {});
@@ -145,13 +163,12 @@ export function generateCallTypes (registry: TypeRegistry, dest: string, apis: A
}); });
} }
export function generateDefaultCalls (dest: string, data: HexString, rtVersion: { apis: Apis } | null = null, extraTypes: ExtraTypes = {}, isStrict = false, customLookupDefinitions?: Definitions): void { export function generateDefaultCalls (dest: string, data: HexString, extraTypes: ExtraTypes = {}, isStrict = false, customLookupDefinitions?: Definitions): void {
const { registry } = initMeta(data, extraTypes); const { metadata } = initMeta(data, extraTypes);
generateCallTypes( generateCallTypes(
registry, metadata,
dest, dest,
rtVersion && rtVersion.apis,
extraTypes, extraTypes,
isStrict, isStrict,
customLookupDefinitions customLookupDefinitions
+2 -6
View File
@@ -6,15 +6,11 @@ import type { HexString } from '@polkadot/util/types';
import kusama from '@polkadot/types-support/metadata/static-kusama'; import kusama from '@polkadot/types-support/metadata/static-kusama';
import polkadot from '@polkadot/types-support/metadata/static-polkadot'; import polkadot from '@polkadot/types-support/metadata/static-polkadot';
import substrate from '@polkadot/types-support/metadata/static-substrate'; import substrate from '@polkadot/types-support/metadata/static-substrate';
import kusamaVer from '@polkadot/types-support/versions/kusama';
import polkadotVer from '@polkadot/types-support/versions/polkadot';
import substrateVer from '@polkadot/types-support/versions/substrate';
import { generateDefaultCalls, generateDefaultConsts, generateDefaultErrors, generateDefaultEvents, generateDefaultInterface, generateDefaultLookup, generateDefaultQuery, generateDefaultRpc, generateDefaultTsDef, generateDefaultTx } from './generate'; import { generateDefaultCalls, generateDefaultConsts, generateDefaultErrors, generateDefaultEvents, generateDefaultInterface, generateDefaultLookup, generateDefaultQuery, generateDefaultRpc, generateDefaultTsDef, generateDefaultTx } from './generate';
const BASE = 'packages/api-augment/src'; const BASE = 'packages/api-augment/src';
const METAS = Object.entries({ kusama, polkadot, substrate }) as [string, HexString][]; const METAS = Object.entries<HexString>({ kusama, polkadot, substrate });
const VERS = { kusama: kusamaVer, polkadot: polkadotVer, substrate: substrateVer };
export function main (): void { export function main (): void {
generateDefaultInterface(); generateDefaultInterface();
@@ -31,6 +27,6 @@ export function main (): void {
generateDefaultEvents(`${BASE}/${name}/events.ts`, staticMeta); generateDefaultEvents(`${BASE}/${name}/events.ts`, staticMeta);
generateDefaultQuery(`${BASE}/${name}/query.ts`, staticMeta); generateDefaultQuery(`${BASE}/${name}/query.ts`, staticMeta);
generateDefaultTx(`${BASE}/${name}/tx.ts`, staticMeta); generateDefaultTx(`${BASE}/${name}/tx.ts`, staticMeta);
generateDefaultCalls(`${BASE}/${name}/runtime.ts`, staticMeta, VERS[name as keyof typeof VERS] as unknown as { apis: [HexString, number][] }); generateDefaultCalls(`${BASE}/${name}/runtime.ts`, staticMeta);
} }
} }
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/typegen', path: 'auto', type: 'auto', version: '8.11.3' }; export const packageInfo = { name: '@polkadot/typegen', path: 'auto', type: 'auto', version: '8.13.1' };

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