Compare commits

..
99 Commits
Author SHA1 Message Date
github-actions[bot] dfe4bb32f0 [CI Skip] release/stable 6.11.1
skip-checks: true
2021-12-05 18:52:48 +00:00
Jaco b81c73b6ec 6.11.1 (#4288) 2021-12-05 20:45:20 +02:00
github-actions[bot] 9bb2549d0b [CI Skip] release/beta 6.10.4-4
skip-checks: true
2021-12-05 12:09:16 +00:00
Jaco ab90f8bd41 Bump metadata (#4286)
* Bump metadata

* Kusama & Polkadot

* Build interfaces

* Build json
2021-12-05 13:59:55 +02:00
github-actions[bot] 221712753f [CI Skip] release/beta 6.10.4-3
skip-checks: true
2021-12-05 11:49:23 +00:00
Jaco ed28a990af Bump common (#4285)
* Bump common

* 8.1.2
2021-12-05 13:40:10 +02:00
github-actions[bot] 055f32d1d9 [CI Skip] release/beta 6.10.4-2
skip-checks: true
2021-12-01 08:57:36 +00:00
Jaco a175ce87d7 Adjust cron (#4278) 2021-12-01 10:49:08 +02:00
github-actions[bot] f0f1714b12 [CI Skip] release/beta 6.10.4-1
skip-checks: true
2021-12-01 08:06:03 +00:00
Jaco 3778bd893b Add extra param to state_traceBlock (#4276)
* Add extra param to state_traceBlock

* CHANGELOG
2021-12-01 09:57:56 +02:00
github-actions[bot] d4436e19fa [CI Skip] release/beta 6.10.4-0
skip-checks: true
2021-12-01 07:48:35 +00:00
Jaco 4cf93fd4c0 Bump common (#4277) 2021-12-01 09:41:33 +02:00
github-actions[bot] 6d94896764 [CI Skip] release/stable 6.10.3
skip-checks: true
2021-11-30 14:14:46 +00:00
Jaco bacb757d7d Fix ss58Prefix extraction (#4274)
* Fix ss58Prefix extraction

* allow fallback

* adjust
2021-11-30 16:07:50 +02:00
github-actions[bot] 7be3cc949f [CI Skip] release/stable 6.10.2
skip-checks: true
2021-11-30 05:32:43 +00:00
Jaco 41cc8b34aa Bump util (#4272)
* Bump util

* util 8.0.4

* 8.0.4
2021-11-30 07:25:50 +02:00
github-actions[bot] 4bbba5bb35 [CI Skip] release/beta 6.10.2-0
skip-checks: true
2021-11-29 15:48:19 +00:00
Jaco feae323f5c Adjust augmentation interface consistency (#4269)
* Adjust augmetation interface consistency

* spelling

* Remove useless eslint slience

* slience escapes

* rebuild

* Fix indent

* comment fix (again)

* Adjust

* Additional adjustments
2021-11-29 17:41:23 +02:00
github-actions[bot] b363833a9f [CI Skip] release/stable 6.10.1
skip-checks: true
2021-11-29 06:45:19 +00:00
Jaco f083ea3861 6.10.1 (#4267) 2021-11-29 08:38:21 +02:00
github-actions[bot] f62e7f8bf9 [CI Skip] release/beta 6.9.3-6
skip-checks: true
2021-11-29 05:55:26 +00:00
Jaco fedb0a3f09 Re-order augmentation imports (#4266) 2021-11-29 07:46:34 +02:00
github-actions[bot] 38928448bf [CI Skip] release/beta 6.9.3-5
skip-checks: true
2021-11-26 12:54:56 +00:00
Jaco cfbde5f6bd Fix RPC non-available section init (#4263) 2021-11-26 14:47:54 +02:00
github-actions[bot] 4b0e0bc6d3 [CI Skip] release/beta 6.9.3-4
skip-checks: true
2021-11-26 10:51:45 +00:00
Jaco 9acb79f500 Bump common (#4262)
* Bump common

* Adjust
2021-11-26 12:45:02 +02:00
Github Actions 5dc0b38881 [CI Skip] release/beta 6.9.3-3
skip-checks: true
2021-11-24 14:59:43 +00:00
Jaco fab6f7e883 Adjust stale schedule (#4257) 2021-11-24 16:52:40 +02:00
Github Actions 66e635e909 [CI Skip] release/beta 6.9.3-2
skip-checks: true
2021-11-23 08:08:38 +00:00
Jaco 6e496d5a3c Add missing types -> types-known dep (#4252)
* Add missing types -> types-known dep

* Run install :)
2021-11-23 09:59:53 +02:00
Github Actions ca172c9a53 [CI Skip] release/beta 6.9.3-1
skip-checks: true
2021-11-22 09:49:34 +00:00
Jaco e9b83a9ff6 Bump static metadata (#4248)
* Bump static metadata

* metadata static json

* Adjust tests (new signed extensions)
2021-11-22 11:42:27 +02:00
Github Actions cf18d97b3a [CI Skip] release/beta 6.9.3-0
skip-checks: true
2021-11-22 06:41:45 +00:00
Jaco 0b1c715408 Bump dev (#4247) 2021-11-22 08:32:50 +02:00
Github Actions 5d493e1a03 [CI Skip] release/stable 6.9.2
skip-checks: true
2021-11-22 05:34:55 +00:00
Jaco e5437ef9e9 6.9.2 (#4246)
* 6.9.2

* Pull in new util
2021-11-22 07:26:47 +02:00
Github Actions b56bed39e1 [CI Skip] release/stable 6.9.1
skip-checks: true
2021-11-21 09:36:41 +00:00
Jaco e789f91850 6.9.1 (#4244) 2021-11-21 11:28:52 +02:00
Github Actions a236eb9453 [CI Skip] release/beta 6.8.2-18
skip-checks: true
2021-11-21 09:14:31 +00:00
Jaco 7ef01b8534 Bump common (#4243) 2021-11-21 11:06:08 +02:00
Github Actions 0e58545a9d [CI Skip] release/beta 6.8.2-17
skip-checks: true
2021-11-19 10:21:44 +00:00
Jaco c474123777 Bump common (#4239)
* Bump common

* CHANGELOG
2021-11-19 12:14:05 +02:00
Github Actions 93edfcf560 [CI Skip] release/beta 6.8.2-16
skip-checks: true
2021-11-19 07:59:40 +00:00
Daniel SavuandGithub Actions e5a67d82fa fix: Generate custom type definitions (#4224)
* fix: Generate custom type definitions

* Generate separate lookup types

* fix: Custom imports

* fix linting errors

Co-authored-by: Github Actions <action@github.com>
2021-11-19 09:51:51 +02:00
Github Actions 194f6aece1 [CI Skip] release/beta 6.8.2-15
skip-checks: true
2021-11-19 05:35:22 +00:00
Jaco 3b4fef8f6e Bump deps (#4238) 2021-11-19 07:26:28 +02:00
Github Actions 6c7323ee3a [CI Skip] release/beta 6.8.2-14
skip-checks: true
2021-11-18 20:00:39 +00:00
Jaco a97b50decb Additional isU8a decoding shortcuts (#4236) 2021-11-18 21:52:24 +02:00
Github Actions 52accf6444 [CI Skip] release/beta 6.8.2-13
skip-checks: true
2021-11-18 13:27:34 +00:00
Jaco 5b8eb231cc CHANGELOG (#4234) 2021-11-18 15:20:21 +02:00
Github Actions 5ea62367d3 [CI Skip] release/beta 6.8.2-12
skip-checks: true
2021-11-18 10:49:36 +00:00
Jaco 49a034a1a0 Place u8a decoding top-of-tree (#4230)
* Place u8a decoding top-of-tree

* Adjust
2021-11-18 12:41:27 +02:00
Github Actions 62a476cb4c [CI Skip] release/beta 6.8.2-11
skip-checks: true
2021-11-18 09:59:41 +00:00
Jaco b283673812 Squeek less recursion out of DetectCodec (#4232)
* Squeek less recursion out of DetectCodec

* Flatten more

* TS 4.5.2 for checking
2021-11-18 11:52:31 +02:00
Github Actions b6a075fefb [CI Skip] release/beta 6.8.2-10
skip-checks: true
2021-11-18 09:11:06 +00:00
Jaco afa844ae01 Bump deps (#4231) 2021-11-18 11:03:45 +02:00
Github Actions 353ef59a1c [CI Skip] release/beta 6.8.2-9
skip-checks: true
2021-11-18 06:32:55 +00:00
Jaco 6228999e6f Decoding cleanups (#4228)
* Decoding cleanups

* CHANGELOG

* Additional adjustments

* Adjust

* Ordering
2021-11-18 08:24:52 +02:00
Github Actions 56db42fedf [CI Skip] release/beta 6.8.2-8
skip-checks: true
2021-11-18 04:48:36 +00:00
Jaco df44693e5d Use stringPascalCase from @polkadot/util (#4211) 2021-11-18 06:40:28 +02:00
Github Actions cfa25f8dda [CI Skip] release/beta 6.8.2-7
skip-checks: true
2021-11-18 04:01:38 +00:00
Jaco bc8934f3c3 Ensure generation of Call/Event enums (#4226) 2021-11-18 05:53:54 +02:00
Github Actions bc67c72e9b [CI Skip] release/beta 6.8.2-6
skip-checks: true
2021-11-17 12:26:35 +00:00
Jaco 22d85e745a Bump deps (#4221)
* Bump deps

* Adjust

* Adjust
2021-11-17 14:19:21 +02:00
Github Actions 60ba2952f7 [CI Skip] release/beta 6.8.2-5
skip-checks: true
2021-11-17 08:28:22 +00:00
Jaco bb10d2813f Expand runtime Call/Event matching (#4220)
* Expand runtime Call/Event matching

* Adjust * matching

* CHANGELOG
2021-11-17 10:18:55 +02:00
Github Actions 80b581f0df [CI Skip] release/beta 6.8.2-4
skip-checks: true
2021-11-13 06:00:08 +00:00
Jaco ef37c421ac Option toJSON output same as from Substrate input (#4212)
* Option toJSON output same as from Substrate input

* CHANGELOG
2021-11-13 07:53:15 +02:00
Github Actions 6e1e8e622b [CI Skip] release/beta 6.8.2-3
skip-checks: true
2021-11-13 05:41:31 +00:00
Jaco ec38a1510f CHANGELOG (#4210) 2021-11-13 07:33:18 +02:00
Github Actions e550ca5a71 [CI Skip] release/beta 6.8.2-2
skip-checks: true
2021-11-12 10:56:32 +00:00
Jaco 80241f732f Split base/essential definition handling (#4206)
* Split base/essential definition handling

* Adjust
2021-11-12 12:47:34 +02:00
Github Actions 84fc0be12e [CI Skip] release/beta 6.8.2-1
skip-checks: true
2021-11-12 08:53:05 +00:00
flex e1f14e8a83 Change BeefySignedCommitment signatures type to EcdsaSignature (#4204) 2021-11-12 10:45:09 +02:00
Github Actions 1155724604 [CI Skip] release/beta 6.8.2-0
skip-checks: true
2021-11-11 12:55:42 +00:00
Jaco 3bb9541943 Bump deps (#4203) 2021-11-11 14:47:26 +02:00
Github Actions 25288f664a [CI Skip] release/stable 6.8.1
skip-checks: true
2021-11-11 11:15:45 +00:00
Jaco 879c5d7b44 6.8.1 (#4201)
* 6.8.1

* rx.queryAt param CHANGELOG
2021-11-11 13:08:24 +02:00
Jaco cdaec1953c Add knownVersion on rx.queryAt (#4194) 2021-11-11 11:30:16 +02:00
Github Actions f4bf7a9c52 [CI Skip] release/beta 6.7.3-7
skip-checks: true
2021-11-11 05:28:44 +00:00
Jaco 7b46c6aa15 Adjust signFake to apply large default signature (#4199)
* Adjust signFake to apply empty default signature

* 0x01... default

* Rename constant

* Add previously failing test
2021-11-11 07:19:21 +02:00
Github Actions d28f4ccfa0 [CI Skip] release/beta 6.7.3-6
skip-checks: true
2021-11-10 17:43:43 +00:00
Jaco e5b05dc700 Slight adjustment to rpc-provider LRU (#4198) 2021-11-10 19:35:20 +02:00
Github Actions bf9831753e [CI Skip] release/beta 6.7.3-5
skip-checks: true
2021-11-10 12:53:27 +00:00
Jaco 5e1670dbae Provider-level caching for historic requests (#4195)
* Provider-level caching for historic requests

* LRUCache

* Adjust

* Adjust

* Adjust

* Opts

* private variables

* Implementation link

* lru .entries adjustment (using .keys)

* Adjust expectations
2021-11-10 14:46:13 +02:00
Github Actions 0d0a230c86 [CI Skip] release/beta 6.7.3-4
skip-checks: true
2021-11-10 08:55:22 +00:00
Jaco 9989b69b46 Rename decorate method (#4193)
* Rename decorateMethod*

* Split exports
2021-11-10 10:48:20 +02:00
Github Actions 66693253ef [CI Skip] release/beta 6.7.3-3
skip-checks: true
2021-11-10 07:05:56 +00:00
Jaco cbffc37dcf Optimize PortableRegistry (#4192)
* Optimize PortableRegistry

* Additional

* Adjust shortcut

* Adjust params

* Move decorateMethod

* Ordering

* Adjust

* Exports

* Renames
2021-11-10 08:58:50 +02:00
Github Actions 74ee42ed66 [CI Skip] release/beta 6.7.3-2
skip-checks: true
2021-11-10 05:15:04 +00:00
Jaco f642e2399f Polkadot 9122 block (#4191) 2021-11-10 07:07:31 +02:00
Github Actions 8cefb055db [CI Skip] release/beta 6.7.3-1
skip-checks: true
2021-11-09 14:17:36 +00:00
Jaco 1f31756019 Ensure known types for v14 is empty (#4190) 2021-11-09 16:10:44 +02:00
Github Actions 4d6a1da6d5 [CI Skip] release/beta 6.7.3-0
skip-checks: true
2021-11-09 11:30:34 +00:00
Jaco d62e720627 Remove ::generic:: from names & namespaces (#4189) 2021-11-09 13:23:10 +02:00
Github Actions 4af4470998 [CI Skip] release/stable 6.7.2
skip-checks: true
2021-11-09 09:24:30 +00:00
Jaco 8bb6218132 Detect AccountId & Address via SpRuntime* defs (#4188)
* Detect AccountId & Address via SpRuntime* defs

* Always do check via UncheckedExtrinsic

* Adjust

* 6.7.2

* Add Signature detection

* Extract ExtrinsicSignature type
2021-11-09 11:14:31 +02:00
Github Actions f4197f8752 [CI Skip] release/beta 6.7.2-0
skip-checks: true
2021-11-08 14:31:55 +00:00
Jaco 7cfad3b1c4 Derive combineLatest order adjustments (#4186) 2021-11-08 16:24:27 +02:00
200 changed files with 30116 additions and 15921 deletions
+4
View File
@@ -42,3 +42,7 @@
6.4.2 6.4.2
6.5.2 6.5.2
6.7.2
6.9.2
6.10.2
6.10.3
+1 -1
View File
@@ -2,7 +2,7 @@ name: 'Lock Threads'
on: on:
schedule: schedule:
- cron: '30 1/2 * * *' - cron: '10 1/3 * * *'
jobs: jobs:
lock: lock:
+1 -1
View File
@@ -1,7 +1,7 @@
name: 'Close stale issues and PRs' name: 'Close stale issues and PRs'
on: on:
schedule: schedule:
- cron: '30 2/2 * * *' - cron: '55 1/3 * * *'
jobs: jobs:
stale: stale:
+95
View File
@@ -1,5 +1,100 @@
# CHANGELOG # CHANGELOG
## 6.11.1 Dec 5, 2021
Upgrade priority: Low. Maintenance upgrade, tacking the latest `@polkadot` libraries.
Changes:
- Align `state_traceBlock` RPC with Substrate
- Bump static metadata for latest Substrate, Polkadot & Kusama
## 6.10.3 Nov 30, 2021
Upgrade priority: Medium. Recommended for 6.10.x users
Changes:
- Fix ss58Prefix extraction
## 6.10.2 Nov 30, 2021
Upgrade priority: Low. Aligns TS augmentation and decoration with older behavior for ALL_CAPS identifiers.
Changes:
- Adjust augmentation interface consistency with top-level declarations
- Update `@polkadot/util` to 8.0.4 with adjusted `stringCamelCase`
## 6.10.1 Nov 29, 2021
Upgrade priority: Low. Recommended for users of `HttpProvider` and for chains generating types using TS augmentation.
Changes:
- Fix for HttpProvider init (RPC sections with only subscriptions)
- Re-order imports in lookup type augmentation interfaces
- Bump static metadata for latest Substrate, Polkadot & Kusama
## 6.9.2 Nov 22, 2021
Upgrade priority: Medium. Pulls in `@polkadot/util-crypto` fix for TS projects.
Changes:
- Update `@polkadot/util-crypto` with TS compilation work-around
## 6.9.1 Nov 21, 2021
Upgrade priority: Medium. Recommended for metadata v14 parachains. For TS users, the package now support TypeScript 4.5.2 and allows extraction of user types from metadata v14.
Contributed:
- Lookup TS generation for all metadata v14 chains (Thanks to https://github.com/savudani8)
- Update `BeefySignedCommitment` type (Thanks to https://github.com/czl1378)
Changes:
- Adjust runtime `*::{Call, Event}` matching for metadata v14
- Adjust derive decoration with (optional) known methods
- Expose `*{Call, Event, Error}` TS types for metadata v14
- Align Option `.toJSON` output with Substrate input
- Optimize Enum, Struct, Option & Number decoding paths
- Ajust PascalCase conversions with function from util
- Prepare pre-v13 types for optional injection
- Adjustments for TS 4.5.2 support (flatten type infers)
## 6.8.1 Nov 11, 2021
Upgrade priority: Low. Recommended for chains with non-MultiSignature variants where `paymentInfo` is required.
Changes:
- Adjust `paymentInfo` signatures to cater for non-MultiSignature variants
- Remove `::generic::` from names & namespaces under metadata v14
- Add Polkadot 9122 upgrade block
- Cleanup Polkadot/Kusama/Westend/Rococo known types (>= v14 metadata)
- Internal `decorateMethod{Promise, Rx}` renamed to `to{Promise, Rx}Method`
- Add RPC provider-level LRU for historic requests
- Add optional known runtime version param to internal `rx.queryAt`
## 6.7.2 Nov 9, 2021
Upgrade priority: Low. Recommended for chains on metadata v14 with non-default `Address` implementations.
Changes:
- Detect `AccountId` & `Address` types via `SpRuntime*` definitions
- Adjust api-derive call ordering when using `.queryAt`
## 6.7.1 Nov 7, 2021 ## 6.7.1 Nov 7, 2021
Upgrade priority: Low. Internal maintenance updates, focussed on internal optimizations. Upgrade priority: Low. Internal maintenance updates, focussed on internal optimizations.
+6 -6
View File
@@ -11,7 +11,7 @@
}, },
"sideEffects": false, "sideEffects": false,
"type": "commonjs", "type": "commonjs",
"version": "6.7.1", "version": "6.11.1",
"workspaces": [ "workspaces": [
"packages/*" "packages/*"
], ],
@@ -33,14 +33,14 @@
"devDependencies": { "devDependencies": {
"@babel/core": "^7.16.0", "@babel/core": "^7.16.0",
"@babel/register": "^7.16.0", "@babel/register": "^7.16.0",
"@babel/runtime": "^7.16.0", "@babel/runtime": "^7.16.3",
"@polkadot/dev": "^0.63.27", "@polkadot/dev": "^0.63.35",
"@polkadot/ts": "^0.4.13", "@polkadot/ts": "^0.4.16",
"@polkadot/typegen": "workspace:packages/typegen", "@polkadot/typegen": "workspace:packages/typegen",
"@types/jest": "^27.0.2", "@types/jest": "^27.0.3",
"copyfiles": "^2.4.1" "copyfiles": "^2.4.1"
}, },
"resolutions": { "resolutions": {
"typescript": "^4.4.4" "typescript": "^4.5.2"
} }
} }
+5 -5
View File
@@ -20,13 +20,13 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "6.7.1", "version": "6.11.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.16.0", "@babel/runtime": "^7.16.3",
"@polkadot/api": "6.7.1", "@polkadot/api": "6.11.1",
"@polkadot/types": "6.7.1", "@polkadot/types": "6.11.1",
"@polkadot/util": "^7.8.2", "@polkadot/util": "^8.1.2",
"rxjs": "^7.4.0" "rxjs": "^7.4.0"
} }
} }
+2 -1
View File
@@ -23,7 +23,8 @@ export abstract class Base<ApiType extends ApiTypes> {
this.api = api; this.api = api;
this._decorateMethod = decorateMethod; this._decorateMethod = decorateMethod;
assert(!!(api && api.isConnected && api.tx && api.tx.contracts && Object.keys(api.tx.contracts).length), 'Your API has not been initialized correctly and it not decorated with the runtime interfaces for contracts as retrieved from the on-chain runtime'); assert(!!(api && api.isConnected && api.tx), 'Your API has not been initialized correctly and is not connected to a chain');
assert(!!(api.tx.contracts && Object.keys(api.tx.contracts).length), 'You need to connect to a chain with a runtime that supports contracts');
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'); 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');
} }
+4 -4
View File
@@ -6,7 +6,7 @@ import type { AnyJson } from '@polkadot/types/types';
import fs from 'fs'; import fs from 'fs';
import path from 'path'; import path from 'path';
import { decorateMethodPromise } 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';
import v0abiFlipper from '../../test/contracts/ink/v0/flipper.json'; import v0abiFlipper from '../../test/contracts/ink/v0/flipper.json';
@@ -19,19 +19,19 @@ const v0wasmFlipper = fs.readFileSync(path.join(__dirname, '../../test/contracts
describe('Code', (): void => { describe('Code', (): void => {
it('can construct with an individual ABI/WASM combo', (): void => { it('can construct with an individual ABI/WASM combo', (): void => {
expect( expect(
() => new Code(mockApi, v0abiFlipper as AnyJson, v0wasmFlipper, decorateMethodPromise) () => new Code(mockApi, v0abiFlipper as AnyJson, v0wasmFlipper, toPromiseMethod)
).not.toThrow(); ).not.toThrow();
}); });
it('can construct with an .contract ABI (v0)', (): void => { it('can construct with an .contract ABI (v0)', (): void => {
expect( expect(
() => new Code(mockApi, v0contractFlipper as AnyJson, null, decorateMethodPromise) () => new Code(mockApi, v0contractFlipper as AnyJson, null, toPromiseMethod)
).not.toThrow(); ).not.toThrow();
}); });
it.only('can construct with an .contract ABI (v1)', (): void => { it.only('can construct with an .contract ABI (v1)', (): void => {
expect( expect(
() => new Code(mockApi, v1contractFlipper as AnyJson, null, decorateMethodPromise) () => new Code(mockApi, v1contractFlipper as AnyJson, null, toPromiseMethod)
).not.toThrow(); ).not.toThrow();
}); });
}); });
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit // Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/api-contract', version: '6.7.1' }; export const packageInfo = { name: '@polkadot/api-contract', version: '6.11.1' };
@@ -4,13 +4,13 @@
import type { Hash } from '@polkadot/types/interfaces'; import type { Hash } from '@polkadot/types/interfaces';
import type { AnyJson } from '@polkadot/types/types'; import type { AnyJson } from '@polkadot/types/types';
import { ApiPromise, decorateMethodPromise } from '@polkadot/api'; import { ApiPromise, toPromiseMethod } from '@polkadot/api';
import { Abi } from '../Abi'; import { Abi } from '../Abi';
import { Blueprint as BaseBlueprint } from '../base'; import { Blueprint as BaseBlueprint } from '../base';
export class Blueprint extends BaseBlueprint<'promise'> { export class Blueprint extends BaseBlueprint<'promise'> {
constructor (api: ApiPromise, abi: AnyJson | Abi, codeHash: string | Hash) { constructor (api: ApiPromise, abi: AnyJson | Abi, codeHash: string | Hash) {
super(api, abi, codeHash, decorateMethodPromise); super(api, abi, codeHash, toPromiseMethod);
} }
} }
+2 -2
View File
@@ -4,13 +4,13 @@
import type { ApiPromise } from '@polkadot/api'; import type { ApiPromise } from '@polkadot/api';
import type { AnyJson } from '@polkadot/types/types'; import type { AnyJson } from '@polkadot/types/types';
import { decorateMethodPromise } from '@polkadot/api'; import { toPromiseMethod } from '@polkadot/api';
import { Abi } from '../Abi'; import { Abi } from '../Abi';
import { Code as BaseCode } from '../base'; import { Code as BaseCode } from '../base';
export class Code extends BaseCode<'promise'> { export class Code extends BaseCode<'promise'> {
constructor (api: ApiPromise, abi: AnyJson | Abi, wasm: Uint8Array | string | Buffer | null | undefined) { constructor (api: ApiPromise, abi: AnyJson | Abi, wasm: Uint8Array | string | Buffer | null | undefined) {
super(api, abi, wasm, decorateMethodPromise); super(api, abi, wasm, toPromiseMethod);
} }
} }
@@ -4,13 +4,13 @@
import type { AccountId } from '@polkadot/types/interfaces'; import type { AccountId } from '@polkadot/types/interfaces';
import type { AnyJson } from '@polkadot/types/types'; import type { AnyJson } from '@polkadot/types/types';
import { ApiPromise, decorateMethodPromise } from '@polkadot/api'; import { ApiPromise, toPromiseMethod } from '@polkadot/api';
import { Abi } from '../Abi'; import { Abi } from '../Abi';
import { Contract as BaseContract } from '../base'; import { Contract as BaseContract } from '../base';
export class Contract extends BaseContract<'promise'> { export class Contract extends BaseContract<'promise'> {
constructor (api: ApiPromise, abi: AnyJson | Abi, address: string | AccountId) { constructor (api: ApiPromise, abi: AnyJson | Abi, address: string | AccountId) {
super(api, abi, address, decorateMethodPromise); super(api, abi, address, toPromiseMethod);
} }
} }
+2 -2
View File
@@ -4,13 +4,13 @@
import type { Hash } from '@polkadot/types/interfaces'; import type { Hash } from '@polkadot/types/interfaces';
import type { AnyJson } from '@polkadot/types/types'; import type { AnyJson } from '@polkadot/types/types';
import { ApiRx, decorateMethodRx } from '@polkadot/api'; import { ApiRx, toRxMethod } from '@polkadot/api';
import { Abi } from '../Abi'; import { Abi } from '../Abi';
import { Blueprint as BaseBlueprint } from '../base'; import { Blueprint as BaseBlueprint } from '../base';
export class Blueprint extends BaseBlueprint<'rxjs'> { export class Blueprint extends BaseBlueprint<'rxjs'> {
constructor (api: ApiRx, abi: AnyJson | Abi, codeHash: string | Hash) { constructor (api: ApiRx, abi: AnyJson | Abi, codeHash: string | Hash) {
super(api, abi, codeHash, decorateMethodRx); super(api, abi, codeHash, toRxMethod);
} }
} }
+2 -2
View File
@@ -4,13 +4,13 @@
import type { ApiRx } from '@polkadot/api'; import type { ApiRx } from '@polkadot/api';
import type { AnyJson } from '@polkadot/types/types'; import type { AnyJson } from '@polkadot/types/types';
import { decorateMethodRx } from '@polkadot/api'; import { toRxMethod } from '@polkadot/api';
import { Abi } from '../Abi'; import { Abi } from '../Abi';
import { Code as BaseCode } from '../base'; import { Code as BaseCode } from '../base';
export class Code extends BaseCode<'rxjs'> { export class Code extends BaseCode<'rxjs'> {
constructor (api: ApiRx, abi: AnyJson | Abi, wasm: Uint8Array | string | Buffer | null | undefined) { constructor (api: ApiRx, abi: AnyJson | Abi, wasm: Uint8Array | string | Buffer | null | undefined) {
super(api, abi, wasm, decorateMethodRx); super(api, abi, wasm, toRxMethod);
} }
} }
+2 -2
View File
@@ -4,13 +4,13 @@
import type { AccountId } from '@polkadot/types/interfaces'; import type { AccountId } from '@polkadot/types/interfaces';
import type { AnyJson } from '@polkadot/types/types'; import type { AnyJson } from '@polkadot/types/types';
import { ApiRx, decorateMethodRx } from '@polkadot/api'; import { ApiRx, toRxMethod } from '@polkadot/api';
import { Abi } from '../Abi'; import { Abi } from '../Abi';
import { Contract as BaseContract } from '../base'; import { Contract as BaseContract } from '../base';
export class Contract extends BaseContract<'rxjs'> { export class Contract extends BaseContract<'rxjs'> {
constructor (api: ApiRx, abi: AnyJson | Abi, address: string | AccountId) { constructor (api: ApiRx, abi: AnyJson | Abi, address: string | AccountId) {
super(api, abi, address, decorateMethodRx); super(api, abi, address, toRxMethod);
} }
} }
+9 -9
View File
@@ -20,19 +20,19 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "6.7.1", "version": "6.11.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.16.0", "@babel/runtime": "^7.16.3",
"@polkadot/api": "6.7.1", "@polkadot/api": "6.11.1",
"@polkadot/rpc-core": "6.7.1", "@polkadot/rpc-core": "6.11.1",
"@polkadot/types": "6.7.1", "@polkadot/types": "6.11.1",
"@polkadot/util": "^7.8.2", "@polkadot/util": "^8.1.2",
"@polkadot/util-crypto": "^7.8.2", "@polkadot/util-crypto": "^8.1.2",
"rxjs": "^7.4.0" "rxjs": "^7.4.0"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/keyring": "^7.8.2", "@polkadot/keyring": "^8.1.2",
"@polkadot/rpc-provider": "6.7.1" "@polkadot/rpc-provider": "6.11.1"
} }
} }
+74 -16
View File
@@ -30,6 +30,7 @@ export * from './type';
interface Avail { interface Avail {
instances: string[]; instances: string[];
methods: string[];
withDetect?: boolean; withDetect?: boolean;
} }
@@ -54,19 +55,61 @@ export type ExactDerive = DeriveAllSections<typeof derive>;
// Enable derive only if some of these modules are available // Enable derive only if some of these modules are available
const checks: Record<string, Avail> = { const checks: Record<string, Avail> = {
contracts: { instances: ['contracts'] }, contracts: {
council: { instances: ['council'], withDetect: true }, instances: ['contracts'],
crowdloan: { instances: ['crowdloan'] }, methods: []
democracy: { instances: ['democracy'] }, },
elections: { instances: ['phragmenElection', 'electionsPhragmen', 'elections', 'council'], withDetect: true }, council: {
imOnline: { instances: ['imOnline'] }, instances: ['council'],
membership: { instances: ['membership'] }, methods: [],
parachains: { instances: ['parachains', 'registrar'] }, withDetect: true
session: { instances: ['session'] }, },
society: { instances: ['society'] }, crowdloan: {
staking: { instances: ['staking'] }, instances: ['crowdloan'],
technicalCommittee: { instances: ['technicalCommittee'], withDetect: true }, methods: []
treasury: { instances: ['treasury'] } },
democracy: {
instances: ['democracy'],
methods: []
},
elections: {
instances: ['phragmenElection', 'electionsPhragmen', 'elections', 'council'],
methods: [],
withDetect: true
},
imOnline: {
instances: ['imOnline'],
methods: []
},
membership: {
instances: ['membership'],
methods: []
},
parachains: {
instances: ['parachains', 'registrar'],
methods: []
},
session: {
instances: ['session'],
methods: []
},
society: {
instances: ['society'],
methods: []
},
staking: {
instances: ['staking'],
methods: ['erasRewardPoints']
},
technicalCommittee: {
instances: ['technicalCommittee'],
methods: [],
withDetect: true
},
treasury: {
instances: ['treasury'],
methods: []
}
}; };
function getModuleInstances (api: ApiInterfaceRx, specName: string, moduleName: string): string[] { function getModuleInstances (api: ApiInterfaceRx, specName: string, moduleName: string): string[] {
@@ -88,12 +131,27 @@ function injectFunctions (instanceId: string, api: ApiInterfaceRx, derives: Deri
const filterInstances = (q: string) => const filterInstances = (q: string) =>
getModuleInstances(api, specName, q).some(filterQueryKeys); getModuleInstances(api, specName, q).some(filterQueryKeys);
const filterMethods = (instances: string[]) =>
(m: string) =>
instances.some((q) =>
queryKeys.includes(q) &&
!!api.query[q][m]
);
const isIncluded = (s: string) => ( const isIncluded = (s: string) => (
!checks[s] || !checks[s] ||
checks[s].instances.some(filterQueryKeys) ||
( (
checks[s].withDetect && (
checks[s].instances.some(filterInstances) checks[s].instances.some(filterQueryKeys) &&
(
!checks[s].methods.length ||
checks[s].methods.every(filterMethods(checks[s].instances))
)
) ||
(
checks[s].withDetect &&
checks[s].instances.some(filterInstances)
)
) )
); );
+14 -11
View File
@@ -25,17 +25,20 @@ import { memo } from '../util';
*/ */
export function getBlock (instanceId: string, api: ApiInterfaceRx): (hash: Uint8Array | string) => Observable<SignedBlockExtended | undefined> { export function getBlock (instanceId: string, api: ApiInterfaceRx): (hash: Uint8Array | string) => Observable<SignedBlockExtended | undefined> {
return memo(instanceId, (blockHash: Uint8Array | string): Observable<SignedBlockExtended | undefined> => return memo(instanceId, (blockHash: Uint8Array | string): Observable<SignedBlockExtended | undefined> =>
api.queryAt(blockHash).pipe( combineLatest([
switchMap((queryAt) => api.rpc.chain.getBlock(blockHash),
combineLatest([ api.queryAt(blockHash).pipe(
api.rpc.chain.getBlock(blockHash), switchMap((queryAt) =>
queryAt.system.events(), combineLatest([
queryAt.session queryAt.system.events(),
? queryAt.session.validators() queryAt.session
: of([]) ? queryAt.session.validators()
]) : of([])
), ])
map(([signedBlock, events, validators]) => )
)
]).pipe(
map(([signedBlock, [events, validators]]) =>
createSignedBlockExtended(api.registry, signedBlock, events, validators) createSignedBlockExtended(api.registry, signedBlock, events, validators)
), ),
catchError((): Observable<undefined> => catchError((): Observable<undefined> =>
+9 -8
View File
@@ -25,17 +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: ApiInterfaceRx): (hash: Uint8Array | string) => Observable<HeaderExtended | undefined> { export function getHeader (instanceId: string, api: ApiInterfaceRx): (blockHash: Uint8Array | string) => Observable<HeaderExtended | undefined> {
return memo(instanceId, (hash: Uint8Array | string): Observable<HeaderExtended | undefined> => return memo(instanceId, (blockHash: Uint8Array | string): Observable<HeaderExtended | undefined> =>
api.queryAt(hash).pipe( combineLatest([
switchMap((queryAt) => api.rpc.chain.getHeader(blockHash),
combineLatest([ api.queryAt(blockHash).pipe(
api.rpc.chain.getHeader(hash), switchMap((queryAt) =>
queryAt.session queryAt.session
? queryAt.session.validators() ? queryAt.session.validators()
: of([] as AccountId[]) : of([] as AccountId[])
]) )
), )
]).pipe(
map(([header, validators]) => map(([header, validators]) =>
createHeaderExtended(header.registry, header, validators) createHeaderExtended(header.registry, header, validators)
), ),
@@ -21,15 +21,15 @@ export function subscribeNewBlocks (instanceId: string, api: ApiInterfaceRx): ()
const blockHash = header.createdAtHash || header.hash; const blockHash = header.createdAtHash || header.hash;
// we get the block first, setting up the registry // we get the block first, setting up the registry
return api.queryAt(blockHash).pipe( return combineLatest([
switchMap((queryAt) => of(header),
combineLatest([ api.rpc.chain.getBlock(blockHash),
of(header), api.queryAt(blockHash).pipe(
api.rpc.chain.getBlock(blockHash), switchMap((queryAt) =>
queryAt.system.events() queryAt.system.events()
]) )
) )
); ]);
}), }),
map(([header, block, events]) => map(([header, block, events]) =>
createSignedBlockExtended(block.registry, block, events, header.validators) createSignedBlockExtended(block.registry, block, events, header.validators)
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit // Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/api-derive', version: '6.7.1' }; export const packageInfo = { name: '@polkadot/api-derive', version: '6.11.1' };
+7 -6
View File
@@ -16,13 +16,14 @@ interface Result {
export function events (instanceId: string, api: ApiInterfaceRx): (at: Hash) => Observable<Result> { export function events (instanceId: string, api: ApiInterfaceRx): (at: Hash) => Observable<Result> {
return memo(instanceId, (blockHash: Hash) => return memo(instanceId, (blockHash: Hash) =>
api.queryAt(blockHash).pipe( combineLatest([
switchMap((queryAt) => api.rpc.chain.getBlock(blockHash),
combineLatest([ api.queryAt(blockHash).pipe(
api.rpc.chain.getBlock(blockHash), switchMap((queryAt) =>
queryAt.system.events() queryAt.system.events()
]) )
), )
]).pipe(
map(([block, events]): Result => ({ block, events })) map(([block, events]): Result => ({ block, events }))
) )
); );
+16 -13
View File
@@ -32,20 +32,23 @@ function nextNonce (api: ApiInterfaceRx, address: string): Observable<Index> {
function signingHeader (api: ApiInterfaceRx): Observable<Header> { function signingHeader (api: ApiInterfaceRx): Observable<Header> {
return combineLatest([ return combineLatest([
api.rpc.chain.getHeader(), api.rpc.chain.getHeader().pipe(
api.rpc.chain.getFinalizedHead() switchMap((header) =>
]).pipe( // check for chains at genesis (until block 1 is produced, e.g. 6s), since
switchMap(([bestHeader, finHash]) => // we do need to allow transactions at chain start (also dev/seal chains)
// retrieve the headers - in the case of the current block, we use the parent header.parentHash.isEmpty
// to minimize (not completely remove) the impact that forks do have on the system ? of(header)
// (when at genesis, just return the current header as the last known) // in the case of the current block, we use the parent to minimize the
bestHeader.parentHash.isEmpty // impact of forks on the system, but not completely remove it
? of([bestHeader, bestHeader]) : api.rpc.chain.getHeader(header.parentHash)
: combineLatest([ )
api.rpc.chain.getHeader(bestHeader.parentHash),
api.rpc.chain.getHeader(finHash)
])
), ),
api.rpc.chain.getFinalizedHead().pipe(
switchMap((hash) =>
api.rpc.chain.getHeader(hash)
)
)
]).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) current.number.unwrap().sub(finalized.number.unwrap()).gt(MAX_FINALITY_LAG)
@@ -8,14 +8,14 @@ import type { ApprovalFlag } from '@polkadot/types/interfaces/elections';
export function approvalFlagsToBools (flags: Vec<ApprovalFlag> | ApprovalFlag[]): boolean[] { export function approvalFlagsToBools (flags: Vec<ApprovalFlag> | ApprovalFlag[]): boolean[] {
const bools: boolean[] = []; const bools: boolean[] = [];
flags.forEach((flag: ApprovalFlag): void => { for (let i = 0; i < flags.length; i++) {
const str = flag.toString(2); const str = flags[i].toString(2);
// read from lowest bit to highest // read from lowest bit to highest
for (const bit of str.split('').reverse()) { for (const bit of str.split('').reverse()) {
bools.push(!!parseInt(bit, 10)); bools.push(!!parseInt(bit, 10));
} }
}); }
// slice off trailing "false" values, as in substrate // slice off trailing "false" values, as in substrate
const lastApproval = bools.lastIndexOf(true); const lastApproval = bools.lastIndexOf(true);
+2 -4
View File
@@ -10,10 +10,8 @@ export const deriveMapCache: DeriveCache = {
mapCache.delete(key); mapCache.delete(key);
}, },
forEach: (cb: (key: string, value: any) => void): void => { forEach: (cb: (key: string, value: any) => void): void => {
const entries = mapCache.entries(); for (const [k, v] of mapCache.entries()) {
cb(k, v);
for (const entry in entries) {
cb(entry[0], entry[1]);
} }
}, },
get: <T = any> (key: string): T | undefined => { get: <T = any> (key: string): T | undefined => {
+10 -10
View File
@@ -20,18 +20,18 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "6.7.1", "version": "6.11.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.16.0", "@babel/runtime": "^7.16.3",
"@polkadot/api-derive": "6.7.1", "@polkadot/api-derive": "6.11.1",
"@polkadot/keyring": "^7.8.2", "@polkadot/keyring": "^8.1.2",
"@polkadot/rpc-core": "6.7.1", "@polkadot/rpc-core": "6.11.1",
"@polkadot/rpc-provider": "6.7.1", "@polkadot/rpc-provider": "6.11.1",
"@polkadot/types": "6.7.1", "@polkadot/types": "6.11.1",
"@polkadot/types-known": "6.7.1", "@polkadot/types-known": "6.11.1",
"@polkadot/util": "^7.8.2", "@polkadot/util": "^8.1.2",
"@polkadot/util-crypto": "^7.8.2", "@polkadot/util-crypto": "^8.1.2",
"eventemitter3": "^4.0.7", "eventemitter3": "^4.0.7",
"rxjs": "^7.4.0" "rxjs": "^7.4.0"
} }
+16 -11
View File
@@ -1,14 +1,14 @@
// 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 { ApiTypes } from '@polkadot/api/types';
import type { U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types';
import type { Perbill, Percent, Permill } from '@polkadot/types/interfaces/runtime';
import type { FrameSupportPalletId, FrameSupportWeightsRuntimeDbWeight, FrameSupportWeightsWeightToFeeCoefficient, FrameSystemLimitsBlockLength, FrameSystemLimitsBlockWeights, PalletContractsSchedule, SpVersionRuntimeVersion } from '@polkadot/types/lookup';
import type { Codec } from '@polkadot/types/types';
declare module '@polkadot/api/types/consts' { declare module '@polkadot/api/types/consts' {
export interface AugmentedConsts<ApiType> { import type { ApiTypes, AugmentedConst, QueryableModuleConsts } from '@polkadot/api/types';
import type { U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types';
import type { Perbill, Percent, Permill } from '@polkadot/types/interfaces/runtime';
import type { FrameSupportPalletId, FrameSupportWeightsRuntimeDbWeight, FrameSupportWeightsWeightToFeeCoefficient, FrameSystemLimitsBlockLength, FrameSystemLimitsBlockWeights, PalletContractsSchedule, SpVersionRuntimeVersion } from '@polkadot/types/lookup';
import type { Codec } from '@polkadot/types/types';
export interface AugmentedConsts<ApiType extends ApiTypes> {
assets: { assets: {
/** /**
* The amount of funds that must be reserved when creating a new approval. * The amount of funds that must be reserved when creating a new approval.
@@ -171,6 +171,8 @@ declare module '@polkadot/api/types/consts' {
dataDepositPerByte: u128 & AugmentedConst<ApiType>; dataDepositPerByte: u128 & AugmentedConst<ApiType>;
/** /**
* Maximum acceptable reason length. * Maximum acceptable reason length.
*
* Benchmarks depend on this value, be sure to update weights file when changing this value
**/ **/
maximumReasonLength: u32 & AugmentedConst<ApiType>; maximumReasonLength: u32 & AugmentedConst<ApiType>;
/** /**
@@ -181,7 +183,7 @@ declare module '@polkadot/api/types/consts' {
contracts: { contracts: {
/** /**
* The deposit that must be placed into the contract's account to instantiate it. * The deposit that must be placed into the contract's account to instantiate it.
* This is in **addition** to the [`pallet_balances::Pallet::ExistenialDeposit`]. * This is in **addition** to the [`Currency::minimum_balance`].
* The minimum balance for a contract's account can be queried using * The minimum balance for a contract's account can be queried using
* [`Pallet::subsistence_threshold`]. * [`Pallet::subsistence_threshold`].
**/ **/
@@ -771,6 +773,8 @@ declare module '@polkadot/api/types/consts' {
dataDepositPerByte: u128 & AugmentedConst<ApiType>; dataDepositPerByte: u128 & AugmentedConst<ApiType>;
/** /**
* Maximum acceptable reason length. * Maximum acceptable reason length.
*
* Benchmarks depend on this value, be sure to update weights file when changing this value
**/ **/
maximumReasonLength: u32 & AugmentedConst<ApiType>; maximumReasonLength: u32 & AugmentedConst<ApiType>;
/** /**
@@ -919,9 +923,10 @@ declare module '@polkadot/api/types/consts' {
**/ **/
[key: string]: Codec; [key: string]: Codec;
}; };
} } // AugmentedConsts
export interface QueryableConsts<ApiType extends ApiTypes> extends AugmentedConsts<ApiType> { export interface QueryableConsts<ApiType extends ApiTypes> extends AugmentedConsts<ApiType> {
[key: string]: QueryableModuleConsts; [key: string]: QueryableModuleConsts;
} } // QueryableConsts
}
} // declare module
+14 -7
View File
@@ -1,10 +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 { ApiTypes } from '@polkadot/api/types';
declare module '@polkadot/api/types/errors' { declare module '@polkadot/api/types/errors' {
export interface AugmentedErrors<ApiType> { import type { ApiTypes, AugmentedError, ModuleErrors } from '@polkadot/api/types';
export interface AugmentedErrors<ApiType extends ApiTypes> {
assets: { assets: {
/** /**
* Invalid metadata given. * Invalid metadata given.
@@ -1151,6 +1151,10 @@ declare module '@polkadot/api/types/errors' {
* The user has enough bond and thus cannot be chilled forcefully by an external person. * The user has enough bond and thus cannot be chilled forcefully by an external person.
**/ **/
CannotChillOther: AugmentedError<ApiType>; CannotChillOther: AugmentedError<ApiType>;
/**
* Commission is too low. Must be at least `MinCommission`.
**/
CommissionTooLow: AugmentedError<ApiType>;
/** /**
* Duplicate index. * Duplicate index.
**/ **/
@@ -1172,7 +1176,9 @@ declare module '@polkadot/api/types/errors' {
**/ **/
IncorrectSlashingSpans: AugmentedError<ApiType>; IncorrectSlashingSpans: AugmentedError<ApiType>;
/** /**
* Can not bond with value less than minimum required. * Cannot have a validator or nominator role, with value less than the minimum defined by
* governance (see `MinValidatorBond` and `MinNominatorBond`). If unbonding is the
* intention, `chill` first to remove one's role as validator/nominator.
**/ **/
InsufficientBond: AugmentedError<ApiType>; InsufficientBond: AugmentedError<ApiType>;
/** /**
@@ -1519,9 +1525,10 @@ declare module '@polkadot/api/types/errors' {
**/ **/
[key: string]: AugmentedError<ApiType>; [key: string]: AugmentedError<ApiType>;
}; };
} } // AugmentedErrors
export interface DecoratedErrors<ApiType extends ApiTypes> extends AugmentedErrors<ApiType> { export interface DecoratedErrors<ApiType extends ApiTypes> extends AugmentedErrors<ApiType> {
[key: string]: ModuleErrors<ApiType>; [key: string]: ModuleErrors<ApiType>;
} } // DecoratedErrors
}
} // declare module
+147 -184
View File
@@ -1,44 +1,41 @@
// 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 { ApiTypes } from '@polkadot/api/types';
import type { Bytes, Null, Option, Result, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types';
import type { AccountId32, H256 } from '@polkadot/types/interfaces/runtime';
import type { FrameSupportTokensMiscBalanceStatus, FrameSupportWeightsDispatchInfo, NodeRuntimeProxyType, PalletDemocracyVoteThreshold, PalletElectionProviderMultiPhaseElectionCompute, PalletImOnlineSr25519AppSr25519Public, PalletMultisigTimepoint, PalletStakingExposure, SpFinalityGrandpaAppPublic, SpRuntimeDispatchError } from '@polkadot/types/lookup';
import type { ITuple } from '@polkadot/types/types';
declare module '@polkadot/api/types/events' { declare module '@polkadot/api/types/events' {
export interface AugmentedEvents<ApiType> { import type { ApiTypes, AugmentedEvent, ModuleEvents } from '@polkadot/api/types';
import type { Bytes, Null, Option, Result, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types';
import type { AccountId32, H256 } from '@polkadot/types/interfaces/runtime';
import type { FrameSupportTokensMiscBalanceStatus, FrameSupportWeightsDispatchInfo, NodeRuntimeProxyType, PalletDemocracyVoteAccountVote, PalletDemocracyVoteThreshold, PalletElectionProviderMultiPhaseElectionCompute, PalletImOnlineSr25519AppSr25519Public, PalletMultisigTimepoint, PalletStakingExposure, SpFinalityGrandpaAppPublic, SpRuntimeDispatchError } from '@polkadot/types/lookup';
import type { ITuple } from '@polkadot/types/types';
export interface AugmentedEvents<ApiType extends ApiTypes> {
assets: { assets: {
/** /**
* An approval for account `delegate` was cancelled by `owner`. * An approval for account `delegate` was cancelled by `owner`.
* \[id, owner, delegate\]
**/ **/
ApprovalCancelled: AugmentedEvent<ApiType, [u32, AccountId32, AccountId32]>; ApprovalCancelled: AugmentedEvent<ApiType, [u32, AccountId32, AccountId32]>;
/** /**
* (Additional) funds have been approved for transfer to a destination account. * (Additional) funds have been approved for transfer to a destination account.
* \[asset_id, source, delegate, amount\]
**/ **/
ApprovedTransfer: AugmentedEvent<ApiType, [u32, AccountId32, AccountId32, u64]>; ApprovedTransfer: AugmentedEvent<ApiType, [u32, AccountId32, AccountId32, u128]>;
/** /**
* Some asset `asset_id` was frozen. \[asset_id\] * Some asset `asset_id` was frozen.
**/ **/
AssetFrozen: AugmentedEvent<ApiType, [u32]>; AssetFrozen: AugmentedEvent<ApiType, [u32]>;
/** /**
* An asset has had its attributes changed by the `Force` origin. * An asset has had its attributes changed by the `Force` origin.
* \[id\]
**/ **/
AssetStatusChanged: AugmentedEvent<ApiType, [u32]>; AssetStatusChanged: AugmentedEvent<ApiType, [u32]>;
/** /**
* Some asset `asset_id` was thawed. \[asset_id\] * Some asset `asset_id` was thawed.
**/ **/
AssetThawed: AugmentedEvent<ApiType, [u32]>; AssetThawed: AugmentedEvent<ApiType, [u32]>;
/** /**
* Some assets were destroyed. \[asset_id, owner, balance\] * Some assets were destroyed.
**/ **/
Burned: AugmentedEvent<ApiType, [u32, AccountId32, u64]>; Burned: AugmentedEvent<ApiType, [u32, AccountId32, u128]>;
/** /**
* Some asset class was created. \[asset_id, creator, owner\] * Some asset class was created.
**/ **/
Created: AugmentedEvent<ApiType, [u32, AccountId32, AccountId32]>; Created: AugmentedEvent<ApiType, [u32, AccountId32, AccountId32]>;
/** /**
@@ -46,47 +43,46 @@ declare module '@polkadot/api/types/events' {
**/ **/
Destroyed: AugmentedEvent<ApiType, [u32]>; Destroyed: AugmentedEvent<ApiType, [u32]>;
/** /**
* Some asset class was force-created. \[asset_id, owner\] * Some asset class was force-created.
**/ **/
ForceCreated: AugmentedEvent<ApiType, [u32, AccountId32]>; ForceCreated: AugmentedEvent<ApiType, [u32, AccountId32]>;
/** /**
* Some account `who` was frozen. \[asset_id, who\] * Some account `who` was frozen.
**/ **/
Frozen: AugmentedEvent<ApiType, [u32, AccountId32]>; Frozen: AugmentedEvent<ApiType, [u32, AccountId32]>;
/** /**
* Some assets were issued. \[asset_id, owner, total_supply\] * Some assets were issued.
**/ **/
Issued: AugmentedEvent<ApiType, [u32, AccountId32, u64]>; Issued: AugmentedEvent<ApiType, [u32, AccountId32, u128]>;
/** /**
* Metadata has been cleared for an asset. \[asset_id\] * Metadata has been cleared for an asset.
**/ **/
MetadataCleared: AugmentedEvent<ApiType, [u32]>; MetadataCleared: AugmentedEvent<ApiType, [u32]>;
/** /**
* New metadata has been set for an asset. \[asset_id, name, symbol, decimals, is_frozen\] * New metadata has been set for an asset.
**/ **/
MetadataSet: AugmentedEvent<ApiType, [u32, Bytes, Bytes, u8, bool]>; MetadataSet: AugmentedEvent<ApiType, [u32, Bytes, Bytes, u8, bool]>;
/** /**
* The owner changed \[asset_id, owner\] * The owner changed.
**/ **/
OwnerChanged: AugmentedEvent<ApiType, [u32, AccountId32]>; OwnerChanged: AugmentedEvent<ApiType, [u32, AccountId32]>;
/** /**
* The management team changed \[asset_id, issuer, admin, freezer\] * The management team changed.
**/ **/
TeamChanged: AugmentedEvent<ApiType, [u32, AccountId32, AccountId32, AccountId32]>; TeamChanged: AugmentedEvent<ApiType, [u32, AccountId32, AccountId32, AccountId32]>;
/** /**
* Some account `who` was thawed. \[asset_id, who\] * Some account `who` was thawed.
**/ **/
Thawed: AugmentedEvent<ApiType, [u32, AccountId32]>; Thawed: AugmentedEvent<ApiType, [u32, AccountId32]>;
/** /**
* Some assets were transferred. \[asset_id, from, to, amount\] * Some assets were transferred.
**/ **/
Transferred: AugmentedEvent<ApiType, [u32, AccountId32, AccountId32, u64]>; Transferred: AugmentedEvent<ApiType, [u32, AccountId32, AccountId32, u128]>;
/** /**
* An `amount` was transferred in its entirety from `owner` to `destination` by * An `amount` was transferred in its entirety from `owner` to `destination` by
* the approved `delegate`. * the approved `delegate`.
* \[id, owner, delegate, destination\]
**/ **/
TransferredApproved: AugmentedEvent<ApiType, [u32, AccountId32, AccountId32, AccountId32, u64]>; TransferredApproved: AugmentedEvent<ApiType, [u32, AccountId32, AccountId32, AccountId32, u128]>;
/** /**
* Generic event * Generic event
**/ **/
@@ -94,7 +90,7 @@ declare module '@polkadot/api/types/events' {
}; };
bagsList: { bagsList: {
/** /**
* Moved an account from one bag to another. \[who, from, to\]. * Moved an account from one bag to another.
**/ **/
Rebagged: AugmentedEvent<ApiType, [AccountId32, u64, u64]>; Rebagged: AugmentedEvent<ApiType, [AccountId32, u64, u64]>;
/** /**
@@ -104,48 +100,45 @@ declare module '@polkadot/api/types/events' {
}; };
balances: { balances: {
/** /**
* A balance was set by root. \[who, free, reserved\] * A balance was set by root.
**/ **/
BalanceSet: AugmentedEvent<ApiType, [AccountId32, u128, u128]>; BalanceSet: AugmentedEvent<ApiType, [AccountId32, u128, u128]>;
/** /**
* Some amount was deposited into the account (e.g. for transaction fees). \[who, * Some amount was deposited (e.g. for transaction fees).
* deposit\]
**/ **/
Deposit: AugmentedEvent<ApiType, [AccountId32, u128]>; Deposit: AugmentedEvent<ApiType, [AccountId32, u128]>;
/** /**
* An account was removed whose balance was non-zero but below ExistentialDeposit, * An account was removed whose balance was non-zero but below ExistentialDeposit,
* resulting in an outright loss. \[account, balance\] * resulting in an outright loss.
**/ **/
DustLost: AugmentedEvent<ApiType, [AccountId32, u128]>; DustLost: AugmentedEvent<ApiType, [AccountId32, u128]>;
/** /**
* An account was created with some free balance. \[account, free_balance\] * An account was created with some free balance.
**/ **/
Endowed: AugmentedEvent<ApiType, [AccountId32, u128]>; Endowed: AugmentedEvent<ApiType, [AccountId32, u128]>;
/** /**
* Some balance was reserved (moved from free to reserved). \[who, value\] * Some balance was reserved (moved from free to reserved).
**/ **/
Reserved: AugmentedEvent<ApiType, [AccountId32, u128]>; Reserved: AugmentedEvent<ApiType, [AccountId32, u128]>;
/** /**
* Some balance was moved from the reserve of the first account to the second account. * Some balance was moved from the reserve of the first account to the second account.
* Final argument indicates the destination balance type. * Final argument indicates the destination balance type.
* \[from, to, balance, destination_status\]
**/ **/
ReserveRepatriated: AugmentedEvent<ApiType, [AccountId32, AccountId32, u128, FrameSupportTokensMiscBalanceStatus]>; ReserveRepatriated: AugmentedEvent<ApiType, [AccountId32, AccountId32, u128, FrameSupportTokensMiscBalanceStatus]>;
/** /**
* Some amount was removed from the account (e.g. for misbehavior). \[who, * Some amount was removed from the account (e.g. for misbehavior).
* amount_slashed\]
**/ **/
Slashed: AugmentedEvent<ApiType, [AccountId32, u128]>; Slashed: AugmentedEvent<ApiType, [AccountId32, u128]>;
/** /**
* Transfer succeeded. \[from, to, value\] * Transfer succeeded.
**/ **/
Transfer: AugmentedEvent<ApiType, [AccountId32, AccountId32, u128]>; Transfer: AugmentedEvent<ApiType, [AccountId32, AccountId32, u128]>;
/** /**
* Some balance was unreserved (moved from reserved to free). \[who, value\] * Some balance was unreserved (moved from reserved to free).
**/ **/
Unreserved: AugmentedEvent<ApiType, [AccountId32, u128]>; Unreserved: AugmentedEvent<ApiType, [AccountId32, u128]>;
/** /**
* Some amount was withdrawn from the account (e.g. for transaction fees). \[who, value\] * Some amount was withdrawn from the account (e.g. for transaction fees).
**/ **/
Withdraw: AugmentedEvent<ApiType, [AccountId32, u128]>; Withdraw: AugmentedEvent<ApiType, [AccountId32, u128]>;
/** /**
@@ -155,31 +148,31 @@ declare module '@polkadot/api/types/events' {
}; };
bounties: { bounties: {
/** /**
* A bounty is awarded to a beneficiary. \[index, beneficiary\] * A bounty is awarded to a beneficiary.
**/ **/
BountyAwarded: AugmentedEvent<ApiType, [u32, AccountId32]>; BountyAwarded: AugmentedEvent<ApiType, [u32, AccountId32]>;
/** /**
* A bounty proposal is funded and became active. \[index\] * A bounty proposal is funded and became active.
**/ **/
BountyBecameActive: AugmentedEvent<ApiType, [u32]>; BountyBecameActive: AugmentedEvent<ApiType, [u32]>;
/** /**
* A bounty is cancelled. \[index\] * A bounty is cancelled.
**/ **/
BountyCanceled: AugmentedEvent<ApiType, [u32]>; BountyCanceled: AugmentedEvent<ApiType, [u32]>;
/** /**
* A bounty is claimed by beneficiary. \[index, payout, beneficiary\] * A bounty is claimed by beneficiary.
**/ **/
BountyClaimed: AugmentedEvent<ApiType, [u32, u128, AccountId32]>; BountyClaimed: AugmentedEvent<ApiType, [u32, u128, AccountId32]>;
/** /**
* A bounty expiry is extended. \[index\] * A bounty expiry is extended.
**/ **/
BountyExtended: AugmentedEvent<ApiType, [u32]>; BountyExtended: AugmentedEvent<ApiType, [u32]>;
/** /**
* New bounty proposal. \[index\] * New bounty proposal.
**/ **/
BountyProposed: AugmentedEvent<ApiType, [u32]>; BountyProposed: AugmentedEvent<ApiType, [u32]>;
/** /**
* A bounty proposal was rejected; funds were slashed. \[index, bond\] * A bounty proposal was rejected; funds were slashed.
**/ **/
BountyRejected: AugmentedEvent<ApiType, [u32, u128]>; BountyRejected: AugmentedEvent<ApiType, [u32, u128]>;
/** /**
@@ -227,39 +220,32 @@ declare module '@polkadot/api/types/events' {
council: { council: {
/** /**
* A motion was approved by the required threshold. * A motion was approved by the required threshold.
* \[proposal_hash\]
**/ **/
Approved: AugmentedEvent<ApiType, [H256]>; Approved: AugmentedEvent<ApiType, [H256]>;
/** /**
* A proposal was closed because its threshold was reached or after its duration was up. * A proposal was closed because its threshold was reached or after its duration was up.
* \[proposal_hash, yes, no\]
**/ **/
Closed: AugmentedEvent<ApiType, [H256, u32, u32]>; Closed: AugmentedEvent<ApiType, [H256, u32, u32]>;
/** /**
* A motion was not approved by the required threshold. * A motion was not approved by the required threshold.
* \[proposal_hash\]
**/ **/
Disapproved: AugmentedEvent<ApiType, [H256]>; Disapproved: AugmentedEvent<ApiType, [H256]>;
/** /**
* A motion was executed; result will be `Ok` if it returned without error. * A motion was executed; result will be `Ok` if it returned without error.
* \[proposal_hash, result\]
**/ **/
Executed: AugmentedEvent<ApiType, [H256, Result<Null, SpRuntimeDispatchError>]>; Executed: AugmentedEvent<ApiType, [H256, Result<Null, SpRuntimeDispatchError>]>;
/** /**
* A single member did some action; result will be `Ok` if it returned without error. * A single member did some action; result will be `Ok` if it returned without error.
* \[proposal_hash, result\]
**/ **/
MemberExecuted: AugmentedEvent<ApiType, [H256, Result<Null, SpRuntimeDispatchError>]>; MemberExecuted: AugmentedEvent<ApiType, [H256, Result<Null, SpRuntimeDispatchError>]>;
/** /**
* A motion (given hash) has been proposed (by given account) with a threshold (given * A motion (given hash) has been proposed (by given account) with a threshold (given
* `MemberCount`). * `MemberCount`).
* \[account, proposal_index, proposal_hash, threshold\]
**/ **/
Proposed: AugmentedEvent<ApiType, [AccountId32, u32, H256, u32]>; Proposed: AugmentedEvent<ApiType, [AccountId32, u32, H256, u32]>;
/** /**
* A motion (given hash) has been voted on by given account, leaving * A motion (given hash) has been voted on by given account, leaving
* a tally (yes votes and no votes given respectively as `MemberCount`). * a tally (yes votes and no votes given respectively as `MemberCount`).
* \[account, proposal_hash, voted, yes, no\]
**/ **/
Voted: AugmentedEvent<ApiType, [AccountId32, H256, bool, u32, u32]>; Voted: AugmentedEvent<ApiType, [AccountId32, H256, bool, u32, u32]>;
/** /**
@@ -269,19 +255,19 @@ declare module '@polkadot/api/types/events' {
}; };
democracy: { democracy: {
/** /**
* A proposal \[hash\] has been blacklisted permanently. * A proposal_hash has been blacklisted permanently.
**/ **/
Blacklisted: AugmentedEvent<ApiType, [H256]>; Blacklisted: AugmentedEvent<ApiType, [H256]>;
/** /**
* A referendum has been cancelled. \[ref_index\] * A referendum has been cancelled.
**/ **/
Cancelled: AugmentedEvent<ApiType, [u32]>; Cancelled: AugmentedEvent<ApiType, [u32]>;
/** /**
* An account has delegated their vote to another account. \[who, target\] * An account has delegated their vote to another account.
**/ **/
Delegated: AugmentedEvent<ApiType, [AccountId32, AccountId32]>; Delegated: AugmentedEvent<ApiType, [AccountId32, AccountId32]>;
/** /**
* A proposal has been enacted. \[ref_index, result\] * A proposal has been enacted.
**/ **/
Executed: AugmentedEvent<ApiType, [u32, Result<Null, SpRuntimeDispatchError>]>; Executed: AugmentedEvent<ApiType, [u32, Result<Null, SpRuntimeDispatchError>]>;
/** /**
@@ -289,58 +275,61 @@ declare module '@polkadot/api/types/events' {
**/ **/
ExternalTabled: AugmentedEvent<ApiType, []>; ExternalTabled: AugmentedEvent<ApiType, []>;
/** /**
* A proposal has been rejected by referendum. \[ref_index\] * A proposal has been rejected by referendum.
**/ **/
NotPassed: AugmentedEvent<ApiType, [u32]>; NotPassed: AugmentedEvent<ApiType, [u32]>;
/** /**
* A proposal has been approved by referendum. \[ref_index\] * A proposal has been approved by referendum.
**/ **/
Passed: AugmentedEvent<ApiType, [u32]>; Passed: AugmentedEvent<ApiType, [u32]>;
/** /**
* A proposal could not be executed because its preimage was invalid. * A proposal could not be executed because its preimage was invalid.
* \[proposal_hash, ref_index\]
**/ **/
PreimageInvalid: AugmentedEvent<ApiType, [H256, u32]>; PreimageInvalid: AugmentedEvent<ApiType, [H256, u32]>;
/** /**
* A proposal could not be executed because its preimage was missing. * A proposal could not be executed because its preimage was missing.
* \[proposal_hash, ref_index\]
**/ **/
PreimageMissing: AugmentedEvent<ApiType, [H256, u32]>; PreimageMissing: AugmentedEvent<ApiType, [H256, u32]>;
/** /**
* A proposal's preimage was noted, and the deposit taken. \[proposal_hash, who, deposit\] * A proposal's preimage was noted, and the deposit taken.
**/ **/
PreimageNoted: AugmentedEvent<ApiType, [H256, AccountId32, u128]>; PreimageNoted: AugmentedEvent<ApiType, [H256, AccountId32, u128]>;
/** /**
* A registered preimage was removed and the deposit collected by the reaper. * A registered preimage was removed and the deposit collected by the reaper.
* \[proposal_hash, provider, deposit, reaper\]
**/ **/
PreimageReaped: AugmentedEvent<ApiType, [H256, AccountId32, u128, AccountId32]>; PreimageReaped: AugmentedEvent<ApiType, [H256, AccountId32, u128, AccountId32]>;
/** /**
* A proposal preimage was removed and used (the deposit was returned). * A proposal preimage was removed and used (the deposit was returned).
* \[proposal_hash, provider, deposit\]
**/ **/
PreimageUsed: AugmentedEvent<ApiType, [H256, AccountId32, u128]>; PreimageUsed: AugmentedEvent<ApiType, [H256, AccountId32, u128]>;
/** /**
* A motion has been proposed by a public account. \[proposal_index, deposit\] * A motion has been proposed by a public account.
**/ **/
Proposed: AugmentedEvent<ApiType, [u32, u128]>; Proposed: AugmentedEvent<ApiType, [u32, u128]>;
/** /**
* A referendum has begun. \[ref_index, threshold\] * An account has secconded a proposal
**/
Seconded: AugmentedEvent<ApiType, [AccountId32, u32]>;
/**
* A referendum has begun.
**/ **/
Started: AugmentedEvent<ApiType, [u32, PalletDemocracyVoteThreshold]>; Started: AugmentedEvent<ApiType, [u32, PalletDemocracyVoteThreshold]>;
/** /**
* A public proposal has been tabled for referendum vote. \[proposal_index, deposit, * A public proposal has been tabled for referendum vote.
* depositors\]
**/ **/
Tabled: AugmentedEvent<ApiType, [u32, u128, Vec<AccountId32>]>; Tabled: AugmentedEvent<ApiType, [u32, u128, Vec<AccountId32>]>;
/** /**
* An \[account\] has cancelled a previous delegation operation. * An account has cancelled a previous delegation operation.
**/ **/
Undelegated: AugmentedEvent<ApiType, [AccountId32]>; Undelegated: AugmentedEvent<ApiType, [AccountId32]>;
/** /**
* An external proposal has been vetoed. \[who, proposal_hash, until\] * An external proposal has been vetoed.
**/ **/
Vetoed: AugmentedEvent<ApiType, [AccountId32, H256, u32]>; Vetoed: AugmentedEvent<ApiType, [AccountId32, H256, u32]>;
/**
* An account has voted in a referendum
**/
Voted: AugmentedEvent<ApiType, [AccountId32, u32, PalletDemocracyVoteAccountVote]>;
/** /**
* Generic event * Generic event
**/ **/
@@ -384,7 +373,7 @@ declare module '@polkadot/api/types/events' {
}; };
elections: { elections: {
/** /**
* A \[candidate\] was slashed by \[amount\] due to failing to obtain a seat as member or * A candidate was slashed by amount due to failing to obtain a seat as member or
* runner-up. * runner-up.
* *
* Note that old members and runners-up are also candidates. * Note that old members and runners-up are also candidates.
@@ -400,12 +389,12 @@ declare module '@polkadot/api/types/events' {
**/ **/
EmptyTerm: AugmentedEvent<ApiType, []>; EmptyTerm: AugmentedEvent<ApiType, []>;
/** /**
* A \[member\] has been removed. This should always be followed by either `NewTerm` or * A member has been removed. This should always be followed by either `NewTerm` or
* `EmptyTerm`. * `EmptyTerm`.
**/ **/
MemberKicked: AugmentedEvent<ApiType, [AccountId32]>; MemberKicked: AugmentedEvent<ApiType, [AccountId32]>;
/** /**
* A new term with \[new_members\]. This indicates that enough candidates existed to run * A new term with new_members. This indicates that enough candidates existed to run
* the election, not that enough have has been elected. The inner value must be examined * the election, not that enough have has been elected. The inner value must be examined
* for this purpose. A `NewTerm(\[\])` indicates that some candidates got their bond * for this purpose. A `NewTerm(\[\])` indicates that some candidates got their bond
* slashed and none were elected, whilst `EmptyTerm` means that no candidates existed to * slashed and none were elected, whilst `EmptyTerm` means that no candidates existed to
@@ -417,7 +406,7 @@ declare module '@polkadot/api/types/events' {
**/ **/
Renounced: AugmentedEvent<ApiType, [AccountId32]>; Renounced: AugmentedEvent<ApiType, [AccountId32]>;
/** /**
* A \[seat holder\] was slashed by \[amount\] by being forcefully removed from the set. * A seat holder was slashed by amount by being forcefully removed from the set.
**/ **/
SeatHolderSlashed: AugmentedEvent<ApiType, [AccountId32, u128]>; SeatHolderSlashed: AugmentedEvent<ApiType, [AccountId32, u128]>;
/** /**
@@ -428,22 +417,18 @@ declare module '@polkadot/api/types/events' {
gilt: { gilt: {
/** /**
* A bid was successfully placed. * A bid was successfully placed.
* \[ who, amount, duration \]
**/ **/
BidPlaced: AugmentedEvent<ApiType, [AccountId32, u128, u32]>; BidPlaced: AugmentedEvent<ApiType, [AccountId32, u128, u32]>;
/** /**
* A bid was successfully removed (before being accepted as a gilt). * A bid was successfully removed (before being accepted as a gilt).
* \[ who, amount, duration \]
**/ **/
BidRetracted: AugmentedEvent<ApiType, [AccountId32, u128, u32]>; BidRetracted: AugmentedEvent<ApiType, [AccountId32, u128, u32]>;
/** /**
* A bid was accepted as a gilt. The balance may not be released until expiry. * A bid was accepted as a gilt. The balance may not be released until expiry.
* \[ index, expiry, who, amount \]
**/ **/
GiltIssued: AugmentedEvent<ApiType, [u32, u32, AccountId32, u128]>; GiltIssued: AugmentedEvent<ApiType, [u32, u32, AccountId32, u128]>;
/** /**
* An expired gilt has been thawed. * An expired gilt has been thawed.
* \[ index, who, original_amount, additional_amount \]
**/ **/
GiltThawed: AugmentedEvent<ApiType, [u32, AccountId32, u128, u128]>; GiltThawed: AugmentedEvent<ApiType, [u32, AccountId32, u128, u128]>;
/** /**
@@ -453,7 +438,7 @@ declare module '@polkadot/api/types/events' {
}; };
grandpa: { grandpa: {
/** /**
* New authority set has been applied. \[authority_set\] * New authority set has been applied.
**/ **/
NewAuthorities: AugmentedEvent<ApiType, [Vec<ITuple<[SpFinalityGrandpaAppPublic, u64]>>]>; NewAuthorities: AugmentedEvent<ApiType, [Vec<ITuple<[SpFinalityGrandpaAppPublic, u64]>>]>;
/** /**
@@ -471,45 +456,44 @@ declare module '@polkadot/api/types/events' {
}; };
identity: { identity: {
/** /**
* A name was cleared, and the given balance returned. \[who, deposit\] * A name was cleared, and the given balance returned.
**/ **/
IdentityCleared: AugmentedEvent<ApiType, [AccountId32, u128]>; IdentityCleared: AugmentedEvent<ApiType, [AccountId32, u128]>;
/** /**
* A name was removed and the given balance slashed. \[who, deposit\] * A name was removed and the given balance slashed.
**/ **/
IdentityKilled: AugmentedEvent<ApiType, [AccountId32, u128]>; IdentityKilled: AugmentedEvent<ApiType, [AccountId32, u128]>;
/** /**
* A name was set or reset (which will remove all judgements). \[who\] * A name was set or reset (which will remove all judgements).
**/ **/
IdentitySet: AugmentedEvent<ApiType, [AccountId32]>; IdentitySet: AugmentedEvent<ApiType, [AccountId32]>;
/** /**
* A judgement was given by a registrar. \[target, registrar_index\] * A judgement was given by a registrar.
**/ **/
JudgementGiven: AugmentedEvent<ApiType, [AccountId32, u32]>; JudgementGiven: AugmentedEvent<ApiType, [AccountId32, u32]>;
/** /**
* A judgement was asked from a registrar. \[who, registrar_index\] * A judgement was asked from a registrar.
**/ **/
JudgementRequested: AugmentedEvent<ApiType, [AccountId32, u32]>; JudgementRequested: AugmentedEvent<ApiType, [AccountId32, u32]>;
/** /**
* A judgement request was retracted. \[who, registrar_index\] * A judgement request was retracted.
**/ **/
JudgementUnrequested: AugmentedEvent<ApiType, [AccountId32, u32]>; JudgementUnrequested: AugmentedEvent<ApiType, [AccountId32, u32]>;
/** /**
* A registrar was added. \[registrar_index\] * A registrar was added.
**/ **/
RegistrarAdded: AugmentedEvent<ApiType, [u32]>; RegistrarAdded: AugmentedEvent<ApiType, [u32]>;
/** /**
* A sub-identity was added to an identity and the deposit paid. \[sub, main, deposit\] * A sub-identity was added to an identity and the deposit paid.
**/ **/
SubIdentityAdded: AugmentedEvent<ApiType, [AccountId32, AccountId32, u128]>; SubIdentityAdded: AugmentedEvent<ApiType, [AccountId32, AccountId32, u128]>;
/** /**
* A sub-identity was removed from an identity and the deposit freed. * A sub-identity was removed from an identity and the deposit freed.
* \[sub, main, deposit\]
**/ **/
SubIdentityRemoved: AugmentedEvent<ApiType, [AccountId32, AccountId32, u128]>; SubIdentityRemoved: AugmentedEvent<ApiType, [AccountId32, AccountId32, u128]>;
/** /**
* A sub-identity was cleared, and the given deposit repatriated from the * A sub-identity was cleared, and the given deposit repatriated from the
* main identity account to the sub-identity account. \[sub, main, deposit\] * main identity account to the sub-identity account.
**/ **/
SubIdentityRevoked: AugmentedEvent<ApiType, [AccountId32, AccountId32, u128]>; SubIdentityRevoked: AugmentedEvent<ApiType, [AccountId32, AccountId32, u128]>;
/** /**
@@ -523,11 +507,11 @@ declare module '@polkadot/api/types/events' {
**/ **/
AllGood: AugmentedEvent<ApiType, []>; AllGood: AugmentedEvent<ApiType, []>;
/** /**
* A new heartbeat was received from `AuthorityId` \[authority_id\] * A new heartbeat was received from `AuthorityId`.
**/ **/
HeartbeatReceived: AugmentedEvent<ApiType, [PalletImOnlineSr25519AppSr25519Public]>; HeartbeatReceived: AugmentedEvent<ApiType, [PalletImOnlineSr25519AppSr25519Public]>;
/** /**
* At the end of the session, at least one validator was found to be \[offline\]. * At the end of the session, at least one validator was found to be offline.
**/ **/
SomeOffline: AugmentedEvent<ApiType, [Vec<ITuple<[AccountId32, PalletStakingExposure]>>]>; SomeOffline: AugmentedEvent<ApiType, [Vec<ITuple<[AccountId32, PalletStakingExposure]>>]>;
/** /**
@@ -537,15 +521,15 @@ declare module '@polkadot/api/types/events' {
}; };
indices: { indices: {
/** /**
* A account index was assigned. \[index, who\] * A account index was assigned.
**/ **/
IndexAssigned: AugmentedEvent<ApiType, [AccountId32, u32]>; IndexAssigned: AugmentedEvent<ApiType, [AccountId32, u32]>;
/** /**
* A account index has been freed up (unassigned). \[index\] * A account index has been freed up (unassigned).
**/ **/
IndexFreed: AugmentedEvent<ApiType, [u32]>; IndexFreed: AugmentedEvent<ApiType, [u32]>;
/** /**
* A account index has been frozen to its current account ID. \[index, who\] * A account index has been frozen to its current account ID.
**/ **/
IndexFrozen: AugmentedEvent<ApiType, [u32, AccountId32]>; IndexFrozen: AugmentedEvent<ApiType, [u32, AccountId32]>;
/** /**
@@ -578,19 +562,18 @@ declare module '@polkadot/api/types/events' {
multisig: { multisig: {
/** /**
* A multisig operation has been approved by someone. * A multisig operation has been approved by someone.
* \[approving, timepoint, multisig, call_hash\]
**/ **/
MultisigApproval: AugmentedEvent<ApiType, [AccountId32, PalletMultisigTimepoint, AccountId32, U8aFixed]>; MultisigApproval: AugmentedEvent<ApiType, [AccountId32, PalletMultisigTimepoint, AccountId32, U8aFixed]>;
/** /**
* A multisig operation has been cancelled. \[canceling, timepoint, multisig, call_hash\] * A multisig operation has been cancelled.
**/ **/
MultisigCancelled: AugmentedEvent<ApiType, [AccountId32, PalletMultisigTimepoint, AccountId32, U8aFixed]>; MultisigCancelled: AugmentedEvent<ApiType, [AccountId32, PalletMultisigTimepoint, AccountId32, U8aFixed]>;
/** /**
* A multisig operation has been executed. \[approving, timepoint, multisig, call_hash\] * A multisig operation has been executed.
**/ **/
MultisigExecuted: AugmentedEvent<ApiType, [AccountId32, PalletMultisigTimepoint, AccountId32, U8aFixed, Result<Null, SpRuntimeDispatchError>]>; MultisigExecuted: AugmentedEvent<ApiType, [AccountId32, PalletMultisigTimepoint, AccountId32, U8aFixed, Result<Null, SpRuntimeDispatchError>]>;
/** /**
* A new multisig operation has begun. \[approving, multisig, call_hash\] * A new multisig operation has begun.
**/ **/
NewMultisig: AugmentedEvent<ApiType, [AccountId32, AccountId32, U8aFixed]>; NewMultisig: AugmentedEvent<ApiType, [AccountId32, AccountId32, U8aFixed]>;
/** /**
@@ -612,21 +595,20 @@ declare module '@polkadot/api/types/events' {
}; };
proxy: { proxy: {
/** /**
* An announcement was placed to make a call in the future. \[real, proxy, call_hash\] * An announcement was placed to make a call in the future.
**/ **/
Announced: AugmentedEvent<ApiType, [AccountId32, AccountId32, H256]>; Announced: AugmentedEvent<ApiType, [AccountId32, AccountId32, H256]>;
/** /**
* Anonymous account has been created by new proxy with given * Anonymous account has been created by new proxy with given
* disambiguation index and proxy type. \[anonymous, who, proxy_type, * disambiguation index and proxy type.
* disambiguation_index\]
**/ **/
AnonymousCreated: AugmentedEvent<ApiType, [AccountId32, AccountId32, NodeRuntimeProxyType, u16]>; AnonymousCreated: AugmentedEvent<ApiType, [AccountId32, AccountId32, NodeRuntimeProxyType, u16]>;
/** /**
* A proxy was added. \[delegator, delegatee, proxy_type, delay\] * A proxy was added.
**/ **/
ProxyAdded: AugmentedEvent<ApiType, [AccountId32, AccountId32, NodeRuntimeProxyType, u32]>; ProxyAdded: AugmentedEvent<ApiType, [AccountId32, AccountId32, NodeRuntimeProxyType, u32]>;
/** /**
* A proxy was executed correctly, with the given \[result\]. * A proxy was executed correctly, with the given.
**/ **/
ProxyExecuted: AugmentedEvent<ApiType, [Result<Null, SpRuntimeDispatchError>]>; ProxyExecuted: AugmentedEvent<ApiType, [Result<Null, SpRuntimeDispatchError>]>;
/** /**
@@ -637,30 +619,26 @@ declare module '@polkadot/api/types/events' {
recovery: { recovery: {
/** /**
* Lost account has been successfully recovered by rescuer account. * Lost account has been successfully recovered by rescuer account.
* \[lost, rescuer\]
**/ **/
AccountRecovered: AugmentedEvent<ApiType, [AccountId32, AccountId32]>; AccountRecovered: AugmentedEvent<ApiType, [AccountId32, AccountId32]>;
/** /**
* A recovery process for lost account by rescuer account has been closed. * A recovery process for lost account by rescuer account has been closed.
* \[lost, rescuer\]
**/ **/
RecoveryClosed: AugmentedEvent<ApiType, [AccountId32, AccountId32]>; RecoveryClosed: AugmentedEvent<ApiType, [AccountId32, AccountId32]>;
/** /**
* A recovery process has been set up for an \[account\]. * A recovery process has been set up for an account.
**/ **/
RecoveryCreated: AugmentedEvent<ApiType, [AccountId32]>; RecoveryCreated: AugmentedEvent<ApiType, [AccountId32]>;
/** /**
* A recovery process has been initiated for lost account by rescuer account. * A recovery process has been initiated for lost account by rescuer account.
* \[lost, rescuer\]
**/ **/
RecoveryInitiated: AugmentedEvent<ApiType, [AccountId32, AccountId32]>; RecoveryInitiated: AugmentedEvent<ApiType, [AccountId32, AccountId32]>;
/** /**
* A recovery process has been removed for an \[account\]. * A recovery process has been removed for an account.
**/ **/
RecoveryRemoved: AugmentedEvent<ApiType, [AccountId32]>; RecoveryRemoved: AugmentedEvent<ApiType, [AccountId32]>;
/** /**
* A recovery process for lost account by rescuer account has been vouched for by sender. * A recovery process for lost account by rescuer account has been vouched for by sender.
* \[lost, rescuer, sender\]
**/ **/
RecoveryVouched: AugmentedEvent<ApiType, [AccountId32, AccountId32, AccountId32]>; RecoveryVouched: AugmentedEvent<ApiType, [AccountId32, AccountId32, AccountId32]>;
/** /**
@@ -670,15 +648,15 @@ declare module '@polkadot/api/types/events' {
}; };
scheduler: { scheduler: {
/** /**
* Canceled some task. \[when, index\] * Canceled some task.
**/ **/
Canceled: AugmentedEvent<ApiType, [u32, u32]>; Canceled: AugmentedEvent<ApiType, [u32, u32]>;
/** /**
* Dispatched some task. \[task, id, result\] * Dispatched some task.
**/ **/
Dispatched: AugmentedEvent<ApiType, [ITuple<[u32, u32]>, Option<Bytes>, Result<Null, SpRuntimeDispatchError>]>; Dispatched: AugmentedEvent<ApiType, [ITuple<[u32, u32]>, Option<Bytes>, Result<Null, SpRuntimeDispatchError>]>;
/** /**
* Scheduled some task. \[when, index\] * Scheduled some task.
**/ **/
Scheduled: AugmentedEvent<ApiType, [u32, u32]>; Scheduled: AugmentedEvent<ApiType, [u32, u32]>;
/** /**
@@ -688,7 +666,7 @@ declare module '@polkadot/api/types/events' {
}; };
session: { session: {
/** /**
* New session has happened. Note that the argument is the \[session_index\], not the * New session has happened. Note that the argument is the session index, not the
* block number as the type might suggest. * block number as the type might suggest.
**/ **/
NewSession: AugmentedEvent<ApiType, [u32]>; NewSession: AugmentedEvent<ApiType, [u32]>;
@@ -699,41 +677,41 @@ declare module '@polkadot/api/types/events' {
}; };
society: { society: {
/** /**
* A \[candidate\] was dropped (due to an excess of bids in the system). * A candidate was dropped (due to an excess of bids in the system).
**/ **/
AutoUnbid: AugmentedEvent<ApiType, [AccountId32]>; AutoUnbid: AugmentedEvent<ApiType, [AccountId32]>;
/** /**
* A membership bid just happened. The given account is the candidate's ID and their offer * A membership bid just happened. The given account is the candidate's ID and their offer
* is the second. \[candidate_id, offer\] * is the second.
**/ **/
Bid: AugmentedEvent<ApiType, [AccountId32, u128]>; Bid: AugmentedEvent<ApiType, [AccountId32, u128]>;
/** /**
* A \[candidate\] has been suspended * A candidate has been suspended
**/ **/
CandidateSuspended: AugmentedEvent<ApiType, [AccountId32]>; CandidateSuspended: AugmentedEvent<ApiType, [AccountId32]>;
/** /**
* A \[member\] has been challenged * A member has been challenged
**/ **/
Challenged: AugmentedEvent<ApiType, [AccountId32]>; Challenged: AugmentedEvent<ApiType, [AccountId32]>;
/** /**
* A vote has been placed for a defending member \[voter, vote\] * A vote has been placed for a defending member
**/ **/
DefenderVote: AugmentedEvent<ApiType, [AccountId32, bool]>; DefenderVote: AugmentedEvent<ApiType, [AccountId32, bool]>;
/** /**
* Some funds were deposited into the society account. \[value\] * Some funds were deposited into the society account.
**/ **/
Deposit: AugmentedEvent<ApiType, [u128]>; Deposit: AugmentedEvent<ApiType, [u128]>;
/** /**
* The society is founded by the given identity. \[founder\] * The society is founded by the given identity.
**/ **/
Founded: AugmentedEvent<ApiType, [AccountId32]>; Founded: AugmentedEvent<ApiType, [AccountId32]>;
/** /**
* A group of candidates have been inducted. The batch's primary is the first value, the * A group of candidates have been inducted. The batch's primary is the first value, the
* batch in full is the second. \[primary, candidates\] * batch in full is the second.
**/ **/
Inducted: AugmentedEvent<ApiType, [AccountId32, Vec<AccountId32>]>; Inducted: AugmentedEvent<ApiType, [AccountId32, Vec<AccountId32>]>;
/** /**
* A \[member\] has been suspended * A member has been suspended
**/ **/
MemberSuspended: AugmentedEvent<ApiType, [AccountId32]>; MemberSuspended: AugmentedEvent<ApiType, [AccountId32]>;
/** /**
@@ -741,29 +719,28 @@ declare module '@polkadot/api/types/events' {
**/ **/
NewMaxMembers: AugmentedEvent<ApiType, [u32]>; NewMaxMembers: AugmentedEvent<ApiType, [u32]>;
/** /**
* A suspended member has been judged. \[who, judged\] * A suspended member has been judged.
**/ **/
SuspendedMemberJudgement: AugmentedEvent<ApiType, [AccountId32, bool]>; SuspendedMemberJudgement: AugmentedEvent<ApiType, [AccountId32, bool]>;
/** /**
* A \[candidate\] was dropped (by their request). * A candidate was dropped (by their request).
**/ **/
Unbid: AugmentedEvent<ApiType, [AccountId32]>; Unbid: AugmentedEvent<ApiType, [AccountId32]>;
/** /**
* Society is unfounded. \[founder\] * Society is unfounded.
**/ **/
Unfounded: AugmentedEvent<ApiType, [AccountId32]>; Unfounded: AugmentedEvent<ApiType, [AccountId32]>;
/** /**
* A \[candidate\] was dropped (by request of who vouched for them). * A candidate was dropped (by request of who vouched for them).
**/ **/
Unvouch: AugmentedEvent<ApiType, [AccountId32]>; Unvouch: AugmentedEvent<ApiType, [AccountId32]>;
/** /**
* A vote has been placed \[candidate, voter, vote\] * A vote has been placed
**/ **/
Vote: AugmentedEvent<ApiType, [AccountId32, AccountId32, bool]>; Vote: AugmentedEvent<ApiType, [AccountId32, AccountId32, bool]>;
/** /**
* A membership bid just happened by vouching. The given account is the candidate's ID and * A membership bid just happened by vouching. The given account is the candidate's ID and
* their offer is the second. The vouching party is the third. \[candidate_id, offer, * their offer is the second. The vouching party is the third.
* vouching\]
**/ **/
Vouch: AugmentedEvent<ApiType, [AccountId32, u128, AccountId32]>; Vouch: AugmentedEvent<ApiType, [AccountId32, u128, AccountId32]>;
/** /**
@@ -858,23 +835,23 @@ declare module '@polkadot/api/types/events' {
**/ **/
CodeUpdated: AugmentedEvent<ApiType, []>; CodeUpdated: AugmentedEvent<ApiType, []>;
/** /**
* An extrinsic failed. \[error, info\] * An extrinsic failed.
**/ **/
ExtrinsicFailed: AugmentedEvent<ApiType, [SpRuntimeDispatchError, FrameSupportWeightsDispatchInfo]>; ExtrinsicFailed: AugmentedEvent<ApiType, [SpRuntimeDispatchError, FrameSupportWeightsDispatchInfo]>;
/** /**
* An extrinsic completed successfully. \[info\] * An extrinsic completed successfully.
**/ **/
ExtrinsicSuccess: AugmentedEvent<ApiType, [FrameSupportWeightsDispatchInfo]>; ExtrinsicSuccess: AugmentedEvent<ApiType, [FrameSupportWeightsDispatchInfo]>;
/** /**
* An \[account\] was reaped. * An account was reaped.
**/ **/
KilledAccount: AugmentedEvent<ApiType, [AccountId32]>; KilledAccount: AugmentedEvent<ApiType, [AccountId32]>;
/** /**
* A new \[account\] was created. * A new account was created.
**/ **/
NewAccount: AugmentedEvent<ApiType, [AccountId32]>; NewAccount: AugmentedEvent<ApiType, [AccountId32]>;
/** /**
* On on-chain remark happened. \[origin, remark_hash\] * On on-chain remark happened.
**/ **/
Remarked: AugmentedEvent<ApiType, [AccountId32, H256]>; Remarked: AugmentedEvent<ApiType, [AccountId32, H256]>;
/** /**
@@ -885,39 +862,32 @@ declare module '@polkadot/api/types/events' {
technicalCommittee: { technicalCommittee: {
/** /**
* A motion was approved by the required threshold. * A motion was approved by the required threshold.
* \[proposal_hash\]
**/ **/
Approved: AugmentedEvent<ApiType, [H256]>; Approved: AugmentedEvent<ApiType, [H256]>;
/** /**
* A proposal was closed because its threshold was reached or after its duration was up. * A proposal was closed because its threshold was reached or after its duration was up.
* \[proposal_hash, yes, no\]
**/ **/
Closed: AugmentedEvent<ApiType, [H256, u32, u32]>; Closed: AugmentedEvent<ApiType, [H256, u32, u32]>;
/** /**
* A motion was not approved by the required threshold. * A motion was not approved by the required threshold.
* \[proposal_hash\]
**/ **/
Disapproved: AugmentedEvent<ApiType, [H256]>; Disapproved: AugmentedEvent<ApiType, [H256]>;
/** /**
* A motion was executed; result will be `Ok` if it returned without error. * A motion was executed; result will be `Ok` if it returned without error.
* \[proposal_hash, result\]
**/ **/
Executed: AugmentedEvent<ApiType, [H256, Result<Null, SpRuntimeDispatchError>]>; Executed: AugmentedEvent<ApiType, [H256, Result<Null, SpRuntimeDispatchError>]>;
/** /**
* A single member did some action; result will be `Ok` if it returned without error. * A single member did some action; result will be `Ok` if it returned without error.
* \[proposal_hash, result\]
**/ **/
MemberExecuted: AugmentedEvent<ApiType, [H256, Result<Null, SpRuntimeDispatchError>]>; MemberExecuted: AugmentedEvent<ApiType, [H256, Result<Null, SpRuntimeDispatchError>]>;
/** /**
* A motion (given hash) has been proposed (by given account) with a threshold (given * A motion (given hash) has been proposed (by given account) with a threshold (given
* `MemberCount`). * `MemberCount`).
* \[account, proposal_index, proposal_hash, threshold\]
**/ **/
Proposed: AugmentedEvent<ApiType, [AccountId32, u32, H256, u32]>; Proposed: AugmentedEvent<ApiType, [AccountId32, u32, H256, u32]>;
/** /**
* A motion (given hash) has been voted on by given account, leaving * A motion (given hash) has been voted on by given account, leaving
* a tally (yes votes and no votes given respectively as `MemberCount`). * a tally (yes votes and no votes given respectively as `MemberCount`).
* \[account, proposal_hash, voted, yes, no\]
**/ **/
Voted: AugmentedEvent<ApiType, [AccountId32, H256, bool, u32, u32]>; Voted: AugmentedEvent<ApiType, [AccountId32, H256, bool, u32, u32]>;
/** /**
@@ -957,23 +927,23 @@ declare module '@polkadot/api/types/events' {
}; };
tips: { tips: {
/** /**
* A new tip suggestion has been opened. \[tip_hash\] * A new tip suggestion has been opened.
**/ **/
NewTip: AugmentedEvent<ApiType, [H256]>; NewTip: AugmentedEvent<ApiType, [H256]>;
/** /**
* A tip suggestion has been closed. \[tip_hash, who, payout\] * A tip suggestion has been closed.
**/ **/
TipClosed: AugmentedEvent<ApiType, [H256, AccountId32, u128]>; TipClosed: AugmentedEvent<ApiType, [H256, AccountId32, u128]>;
/** /**
* A tip suggestion has reached threshold and is closing. \[tip_hash\] * A tip suggestion has reached threshold and is closing.
**/ **/
TipClosing: AugmentedEvent<ApiType, [H256]>; TipClosing: AugmentedEvent<ApiType, [H256]>;
/** /**
* A tip suggestion has been retracted. \[tip_hash\] * A tip suggestion has been retracted.
**/ **/
TipRetracted: AugmentedEvent<ApiType, [H256]>; TipRetracted: AugmentedEvent<ApiType, [H256]>;
/** /**
* A tip suggestion has been slashed. \[tip_hash, finder, deposit\] * A tip suggestion has been slashed.
**/ **/
TipSlashed: AugmentedEvent<ApiType, [H256, AccountId32, u128]>; TipSlashed: AugmentedEvent<ApiType, [H256, AccountId32, u128]>;
/** /**
@@ -1001,32 +971,31 @@ declare module '@polkadot/api/types/events' {
}; };
treasury: { treasury: {
/** /**
* Some funds have been allocated. \[proposal_index, award, beneficiary\] * Some funds have been allocated.
**/ **/
Awarded: AugmentedEvent<ApiType, [u32, u128, AccountId32]>; Awarded: AugmentedEvent<ApiType, [u32, u128, AccountId32]>;
/** /**
* Some of our funds have been burnt. \[burn\] * Some of our funds have been burnt.
**/ **/
Burnt: AugmentedEvent<ApiType, [u128]>; Burnt: AugmentedEvent<ApiType, [u128]>;
/** /**
* Some funds have been deposited. \[deposit\] * Some funds have been deposited.
**/ **/
Deposit: AugmentedEvent<ApiType, [u128]>; Deposit: AugmentedEvent<ApiType, [u128]>;
/** /**
* New proposal. \[proposal_index\] * New proposal.
**/ **/
Proposed: AugmentedEvent<ApiType, [u32]>; Proposed: AugmentedEvent<ApiType, [u32]>;
/** /**
* A proposal was rejected; funds were slashed. \[proposal_index, slashed\] * A proposal was rejected; funds were slashed.
**/ **/
Rejected: AugmentedEvent<ApiType, [u32, u128]>; Rejected: AugmentedEvent<ApiType, [u32, u128]>;
/** /**
* Spending has finished; this is the amount that rolls over until next spend. * Spending has finished; this is the amount that rolls over until next spend.
* \[budget_remaining\]
**/ **/
Rollover: AugmentedEvent<ApiType, [u128]>; Rollover: AugmentedEvent<ApiType, [u128]>;
/** /**
* We have ended a spend period and will now allocate funds. \[budget_remaining\] * We have ended a spend period and will now allocate funds.
**/ **/
Spending: AugmentedEvent<ApiType, [u128]>; Spending: AugmentedEvent<ApiType, [u128]>;
/** /**
@@ -1038,97 +1007,91 @@ declare module '@polkadot/api/types/events' {
/** /**
* An approval for a `delegate` account to transfer the `instance` of an asset `class` was * An approval for a `delegate` account to transfer the `instance` of an asset `class` was
* cancelled by its `owner`. * cancelled by its `owner`.
* \[ class, instance, owner, delegate \]
**/ **/
ApprovalCancelled: AugmentedEvent<ApiType, [u32, u32, AccountId32, AccountId32]>; ApprovalCancelled: AugmentedEvent<ApiType, [u32, u32, AccountId32, AccountId32]>;
/** /**
* An `instance` of an asset `class` has been approved by the `owner` for transfer by a * An `instance` of an asset `class` has been approved by the `owner` for transfer by a
* `delegate`. * `delegate`.
* \[ class, instance, owner, delegate \]
**/ **/
ApprovedTransfer: AugmentedEvent<ApiType, [u32, u32, AccountId32, AccountId32]>; ApprovedTransfer: AugmentedEvent<ApiType, [u32, u32, AccountId32, AccountId32]>;
/** /**
* An asset `class` has had its attributes changed by the `Force` origin. * An asset `class` has had its attributes changed by the `Force` origin.
* \[ class \]
**/ **/
AssetStatusChanged: AugmentedEvent<ApiType, [u32]>; AssetStatusChanged: AugmentedEvent<ApiType, [u32]>;
/** /**
* Attribute metadata has been cleared for an asset class or instance. * Attribute metadata has been cleared for an asset class or instance.
* \[ class, maybe_instance, key, maybe_value \]
**/ **/
AttributeCleared: AugmentedEvent<ApiType, [u32, Option<u32>, Bytes]>; AttributeCleared: AugmentedEvent<ApiType, [u32, Option<u32>, Bytes]>;
/** /**
* New attribute metadata has been set for an asset class or instance. * New attribute metadata has been set for an asset class or instance.
* \[ class, maybe_instance, key, value \]
**/ **/
AttributeSet: AugmentedEvent<ApiType, [u32, Option<u32>, Bytes, Bytes]>; AttributeSet: AugmentedEvent<ApiType, [u32, Option<u32>, Bytes, Bytes]>;
/** /**
* An asset `instance` was destroyed. \[ class, instance, owner \] * An asset `instance` was destroyed.
**/ **/
Burned: AugmentedEvent<ApiType, [u32, u32, AccountId32]>; Burned: AugmentedEvent<ApiType, [u32, u32, AccountId32]>;
/** /**
* Some asset `class` was frozen. \[ class \] * Some asset `class` was frozen.
**/ **/
ClassFrozen: AugmentedEvent<ApiType, [u32]>; ClassFrozen: AugmentedEvent<ApiType, [u32]>;
/** /**
* Metadata has been cleared for an asset class. \[ class \] * Metadata has been cleared for an asset class.
**/ **/
ClassMetadataCleared: AugmentedEvent<ApiType, [u32]>; ClassMetadataCleared: AugmentedEvent<ApiType, [u32]>;
/** /**
* New metadata has been set for an asset class. \[ class, data, is_frozen \] * New metadata has been set for an asset class.
**/ **/
ClassMetadataSet: AugmentedEvent<ApiType, [u32, Bytes, bool]>; ClassMetadataSet: AugmentedEvent<ApiType, [u32, Bytes, bool]>;
/** /**
* Some asset `class` was thawed. \[ class \] * Some asset `class` was thawed.
**/ **/
ClassThawed: AugmentedEvent<ApiType, [u32]>; ClassThawed: AugmentedEvent<ApiType, [u32]>;
/** /**
* An asset class was created. \[ class, creator, owner \] * An asset class was created.
**/ **/
Created: AugmentedEvent<ApiType, [u32, AccountId32, AccountId32]>; Created: AugmentedEvent<ApiType, [u32, AccountId32, AccountId32]>;
/** /**
* An asset `class` was destroyed. \[ class \] * An asset `class` was destroyed.
**/ **/
Destroyed: AugmentedEvent<ApiType, [u32]>; Destroyed: AugmentedEvent<ApiType, [u32]>;
/** /**
* An asset class was force-created. \[ class, owner \] * An asset class was force-created.
**/ **/
ForceCreated: AugmentedEvent<ApiType, [u32, AccountId32]>; ForceCreated: AugmentedEvent<ApiType, [u32, AccountId32]>;
/** /**
* Some asset `instance` was frozen. \[ class, instance \] * Some asset `instance` was frozen.
**/ **/
Frozen: AugmentedEvent<ApiType, [u32, u32]>; Frozen: AugmentedEvent<ApiType, [u32, u32]>;
/** /**
* An asset `instance` was issued. \[ class, instance, owner \] * An asset `instance` was issued.
**/ **/
Issued: AugmentedEvent<ApiType, [u32, u32, AccountId32]>; Issued: AugmentedEvent<ApiType, [u32, u32, AccountId32]>;
/** /**
* Metadata has been cleared for an asset instance. \[ class, instance \] * Metadata has been cleared for an asset instance.
**/ **/
MetadataCleared: AugmentedEvent<ApiType, [u32, u32]>; MetadataCleared: AugmentedEvent<ApiType, [u32, u32]>;
/** /**
* New metadata has been set for an asset instance. * New metadata has been set for an asset instance.
* \[ class, instance, data, is_frozen \]
**/ **/
MetadataSet: AugmentedEvent<ApiType, [u32, u32, Bytes, bool]>; MetadataSet: AugmentedEvent<ApiType, [u32, u32, Bytes, bool]>;
/** /**
* The owner changed \[ class, new_owner \] * The owner changed.
**/ **/
OwnerChanged: AugmentedEvent<ApiType, [u32, AccountId32]>; OwnerChanged: AugmentedEvent<ApiType, [u32, AccountId32]>;
/** /**
* Metadata has been cleared for an asset instance. \[ class, successful_instances \] * Metadata has been cleared for an asset instance.
**/ **/
Redeposited: AugmentedEvent<ApiType, [u32, Vec<u32>]>; Redeposited: AugmentedEvent<ApiType, [u32, Vec<u32>]>;
/** /**
* The management team changed \[ class, issuer, admin, freezer \] * The management team changed.
**/ **/
TeamChanged: AugmentedEvent<ApiType, [u32, AccountId32, AccountId32, AccountId32]>; TeamChanged: AugmentedEvent<ApiType, [u32, AccountId32, AccountId32, AccountId32]>;
/** /**
* Some asset `instance` was thawed. \[ class, instance \] * Some asset `instance` was thawed.
**/ **/
Thawed: AugmentedEvent<ApiType, [u32, u32]>; Thawed: AugmentedEvent<ApiType, [u32, u32]>;
/** /**
* An asset `instance` was transferred. \[ class, instance, from, to \] * An asset `instance` was transferred.
**/ **/
Transferred: AugmentedEvent<ApiType, [u32, u32, AccountId32, AccountId32]>; Transferred: AugmentedEvent<ApiType, [u32, u32, AccountId32, AccountId32]>;
/** /**
@@ -1143,11 +1106,11 @@ declare module '@polkadot/api/types/events' {
BatchCompleted: AugmentedEvent<ApiType, []>; BatchCompleted: AugmentedEvent<ApiType, []>;
/** /**
* Batch of dispatches did not complete fully. Index of first failing dispatch given, as * Batch of dispatches did not complete fully. Index of first failing dispatch given, as
* well as the error. \[index, error\] * well as the error.
**/ **/
BatchInterrupted: AugmentedEvent<ApiType, [u32, SpRuntimeDispatchError]>; BatchInterrupted: AugmentedEvent<ApiType, [u32, SpRuntimeDispatchError]>;
/** /**
* A call was dispatched. \[result\] * A call was dispatched.
**/ **/
DispatchedAs: AugmentedEvent<ApiType, [Result<Null, SpRuntimeDispatchError>]>; DispatchedAs: AugmentedEvent<ApiType, [Result<Null, SpRuntimeDispatchError>]>;
/** /**
@@ -1167,7 +1130,6 @@ declare module '@polkadot/api/types/events' {
/** /**
* The amount vested has been updated. This could indicate a change in funds available. * The amount vested has been updated. This could indicate a change in funds available.
* The balance given is the amount which is left unvested (and thus locked). * The balance given is the amount which is left unvested (and thus locked).
* \[account, unvested\]
**/ **/
VestingUpdated: AugmentedEvent<ApiType, [AccountId32, u128]>; VestingUpdated: AugmentedEvent<ApiType, [AccountId32, u128]>;
/** /**
@@ -1175,9 +1137,10 @@ declare module '@polkadot/api/types/events' {
**/ **/
[key: string]: AugmentedEvent<ApiType>; [key: string]: AugmentedEvent<ApiType>;
}; };
} } // AugmentedEvents
export interface DecoratedEvents<ApiType extends ApiTypes> extends AugmentedEvents<ApiType> { export interface DecoratedEvents<ApiType extends ApiTypes> extends AugmentedEvents<ApiType> {
[key: string]: ModuleEvents<ApiType>; [key: string]: ModuleEvents<ApiType>;
} } // DecoratedEvents
}
} // declare module
+19 -12
View File
@@ -1,14 +1,14 @@
// 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 { ApiTypes } from '@polkadot/api/types';
import type { BTreeMap, Bytes, Data, Null, Option, U8aFixed, Vec, WrapperOpaque, bool, u128, u32, u64, u8 } from '@polkadot/types';
import type { AccountId32, Call, H256, Perbill, Percent } from '@polkadot/types/interfaces/runtime';
import type { FrameSupportWeightsPerDispatchClassU64, FrameSystemAccountInfo, FrameSystemEventRecord, FrameSystemLastRuntimeUpgradeInfo, FrameSystemPhase, NodeRuntimeSessionKeys, PalletAssetsApproval, PalletAssetsAssetBalance, PalletAssetsAssetDetails, PalletAssetsAssetMetadata, PalletAuthorshipUncleEntryItem, PalletBagsListListBag, PalletBagsListListNode, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesReleases, PalletBalancesReserveData, PalletBountiesBounty, PalletCollectiveVotes, PalletContractsStorageDeletedContract, PalletContractsStorageRawContractInfo, PalletContractsWasmPrefabWasmModule, PalletDemocracyPreimageStatus, PalletDemocracyReferendumInfo, PalletDemocracyReleases, PalletDemocracyVoteThreshold, PalletDemocracyVoteVoting, PalletElectionProviderMultiPhasePhase, PalletElectionProviderMultiPhaseReadySolution, PalletElectionProviderMultiPhaseRoundSnapshot, PalletElectionProviderMultiPhaseSignedSignedSubmission, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenSeatHolder, PalletElectionsPhragmenVoter, PalletGiltActiveGilt, PalletGiltActiveGiltsTotal, PalletGiltGiltBid, PalletGrandpaStoredPendingChange, PalletGrandpaStoredState, PalletIdentityRegistrarInfo, PalletIdentityRegistration, PalletImOnlineBoundedOpaqueNetworkState, PalletImOnlineSr25519AppSr25519Public, PalletLotteryLotteryConfig, PalletMultisigMultisig, PalletProxyAnnouncement, PalletProxyProxyDefinition, PalletRecoveryActiveRecovery, PalletRecoveryRecoveryConfig, PalletSchedulerReleases, PalletSchedulerScheduledV2, PalletSocietyBid, PalletSocietyBidKind, PalletSocietyVote, PalletSocietyVouchingStatus, PalletStakingActiveEraInfo, PalletStakingEraRewardPoints, PalletStakingExposure, PalletStakingForcing, PalletStakingNominations, PalletStakingReleases, PalletStakingRewardDestination, PalletStakingSlashingSlashingSpans, PalletStakingSlashingSpanRecord, PalletStakingStakingLedger, PalletStakingUnappliedSlash, PalletStakingValidatorPrefs, PalletTipsOpenTip, PalletTransactionPaymentReleases, PalletTransactionStorageTransactionInfo, PalletTreasuryProposal, PalletUniquesClassDetails, PalletUniquesClassMetadata, PalletUniquesInstanceDetails, PalletUniquesInstanceMetadata, PalletVestingReleases, PalletVestingVestingInfo, SpAuthorityDiscoveryAppPublic, SpConsensusBabeAppPublic, SpConsensusBabeBabeEpochConfiguration, SpConsensusBabeDigestsNextConfigDescriptor, SpCoreCryptoKeyTypeId, SpRuntimeGenericDigest, SpStakingOffenceOffenceDetails } from '@polkadot/types/lookup';
import type { AnyNumber, ITuple, Observable } from '@polkadot/types/types';
declare module '@polkadot/api/types/storage' { declare module '@polkadot/api/types/storage' {
export interface AugmentedQueries<ApiType> { import type { ApiTypes, AugmentedQuery, QueryableModuleStorage, QueryableStorageEntry } from '@polkadot/api/types';
import type { BTreeMap, Bytes, Data, Null, Option, U8aFixed, Vec, WrapperOpaque, bool, u128, u32, u64, u8 } from '@polkadot/types';
import type { AccountId32, Call, H256, Perbill, Percent } from '@polkadot/types/interfaces/runtime';
import type { FrameSupportWeightsPerDispatchClassU64, FrameSystemAccountInfo, FrameSystemEventRecord, FrameSystemLastRuntimeUpgradeInfo, FrameSystemPhase, NodeRuntimeSessionKeys, PalletAssetsApproval, PalletAssetsAssetBalance, PalletAssetsAssetDetails, PalletAssetsAssetMetadata, PalletAuthorshipUncleEntryItem, PalletBagsListListBag, PalletBagsListListNode, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesReleases, PalletBalancesReserveData, PalletBountiesBounty, PalletCollectiveVotes, PalletContractsStorageDeletedContract, PalletContractsStorageRawContractInfo, PalletContractsWasmPrefabWasmModule, PalletDemocracyPreimageStatus, PalletDemocracyReferendumInfo, PalletDemocracyReleases, PalletDemocracyVoteThreshold, PalletDemocracyVoteVoting, PalletElectionProviderMultiPhasePhase, PalletElectionProviderMultiPhaseReadySolution, PalletElectionProviderMultiPhaseRoundSnapshot, PalletElectionProviderMultiPhaseSignedSignedSubmission, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenSeatHolder, PalletElectionsPhragmenVoter, PalletGiltActiveGilt, PalletGiltActiveGiltsTotal, PalletGiltGiltBid, PalletGrandpaStoredPendingChange, PalletGrandpaStoredState, PalletIdentityRegistrarInfo, PalletIdentityRegistration, PalletImOnlineBoundedOpaqueNetworkState, PalletImOnlineSr25519AppSr25519Public, PalletLotteryLotteryConfig, PalletMultisigMultisig, PalletProxyAnnouncement, PalletProxyProxyDefinition, PalletRecoveryActiveRecovery, PalletRecoveryRecoveryConfig, PalletSchedulerReleases, PalletSchedulerScheduledV2, PalletSocietyBid, PalletSocietyBidKind, PalletSocietyVote, PalletSocietyVouchingStatus, PalletStakingActiveEraInfo, PalletStakingEraRewardPoints, PalletStakingExposure, PalletStakingForcing, PalletStakingNominations, PalletStakingReleases, PalletStakingRewardDestination, PalletStakingSlashingSlashingSpans, PalletStakingSlashingSpanRecord, PalletStakingStakingLedger, PalletStakingUnappliedSlash, PalletStakingValidatorPrefs, PalletTipsOpenTip, PalletTransactionPaymentReleases, PalletTransactionStorageTransactionInfo, PalletTreasuryProposal, PalletUniquesClassDetails, PalletUniquesClassMetadata, PalletUniquesInstanceDetails, PalletUniquesInstanceMetadata, PalletVestingReleases, PalletVestingVestingInfo, SpAuthorityDiscoveryAppPublic, SpConsensusBabeAppPublic, SpConsensusBabeBabeEpochConfiguration, SpConsensusBabeDigestsNextConfigDescriptor, SpCoreCryptoKeyTypeId, SpRuntimeDigest, SpStakingOffenceOffenceDetails } from '@polkadot/types/lookup';
import type { AnyNumber, ITuple, Observable } from '@polkadot/types/types';
export interface AugmentedQueries<ApiType extends ApiTypes> {
assets: { assets: {
/** /**
* The number of units of assets held by any given account. * The number of units of assets held by any given account.
@@ -169,7 +169,7 @@ declare module '@polkadot/api/types/storage' {
}; };
bagsList: { bagsList: {
/** /**
* How many ids are registered. * Counter for the related counted storage map
**/ **/
counterForListNodes: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>; counterForListNodes: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
/** /**
@@ -1049,6 +1049,12 @@ declare module '@polkadot/api/types/storage' {
* When this value is not set, no limits are enforced. * When this value is not set, no limits are enforced.
**/ **/
maxValidatorsCount: AugmentedQuery<ApiType, () => Observable<Option<u32>>, []> & QueryableStorageEntry<ApiType, []>; maxValidatorsCount: AugmentedQuery<ApiType, () => Observable<Option<u32>>, []> & QueryableStorageEntry<ApiType, []>;
/**
* The minimum amount of commission that validators can set.
*
* If set to `0`, no limit exists.
**/
minCommission: AugmentedQuery<ApiType, () => Observable<Perbill>, []> & QueryableStorageEntry<ApiType, []>;
/** /**
* Minimum number of staking participants before emergency conditions are imposed. * Minimum number of staking participants before emergency conditions are imposed.
**/ **/
@@ -1163,7 +1169,7 @@ declare module '@polkadot/api/types/storage' {
/** /**
* Digest of the current block, also part of the block header. * Digest of the current block, also part of the block header.
**/ **/
digest: AugmentedQuery<ApiType, () => Observable<SpRuntimeGenericDigest>, []> & QueryableStorageEntry<ApiType, []>; digest: AugmentedQuery<ApiType, () => Observable<SpRuntimeDigest>, []> & QueryableStorageEntry<ApiType, []>;
/** /**
* The number of events in the `Events<T>` list. * The number of events in the `Events<T>` list.
**/ **/
@@ -1414,9 +1420,10 @@ declare module '@polkadot/api/types/storage' {
**/ **/
[key: string]: QueryableStorageEntry<ApiType>; [key: string]: QueryableStorageEntry<ApiType>;
}; };
} } // AugmentedQueries
export interface QueryableStorage<ApiType extends ApiTypes> extends AugmentedQueries<ApiType> { export interface QueryableStorage<ApiType extends ApiTypes> extends AugmentedQueries<ApiType> {
[key: string]: QueryableModuleStorage<ApiType>; [key: string]: QueryableModuleStorage<ApiType>;
} } // QueryableStorage
}
} // declare module
+26 -24
View File
@@ -1,28 +1,29 @@
// 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 { Bytes, HashMap, Json, Metadata, Null, Option, StorageKey, Text, U256, U64, Vec, bool, u32, u64 } from '@polkadot/types';
import type { ExtrinsicOrHash, ExtrinsicStatus } from '@polkadot/types/interfaces/author';
import type { EpochAuthorship } from '@polkadot/types/interfaces/babe';
import type { BeefySignedCommitment } from '@polkadot/types/interfaces/beefy';
import type { BlockHash } from '@polkadot/types/interfaces/chain';
import type { PrefixedStorageKey } from '@polkadot/types/interfaces/childstate';
import type { AuthorityId } from '@polkadot/types/interfaces/consensus';
import type { ContractCallRequest, ContractExecResult, ContractInstantiateResult, InstantiateRequest } from '@polkadot/types/interfaces/contracts';
import type { CreatedBlock } from '@polkadot/types/interfaces/engine';
import type { EthAccount, EthCallRequest, EthFilter, EthFilterChanges, EthLog, EthReceipt, EthRichBlock, EthSubKind, EthSubParams, EthSyncStatus, EthTransaction, EthTransactionRequest, EthWork } from '@polkadot/types/interfaces/eth';
import type { Extrinsic } from '@polkadot/types/interfaces/extrinsics';
import type { EncodedFinalityProofs, JustificationNotification, ReportedRoundStates } from '@polkadot/types/interfaces/grandpa';
import type { MmrLeafProof } from '@polkadot/types/interfaces/mmr';
import type { StorageKind } from '@polkadot/types/interfaces/offchain';
import type { FeeDetails, RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment';
import type { RpcMethods } from '@polkadot/types/interfaces/rpc';
import type { AccountId, BlockNumber, H160, H256, H64, Hash, Header, Index, Justification, KeyValue, SignedBlock, StorageData } from '@polkadot/types/interfaces/runtime';
import type { ReadProof, RuntimeVersion, TraceBlockResponse } from '@polkadot/types/interfaces/state';
import type { ApplyExtrinsicResult, ChainProperties, ChainType, Health, NetworkState, NodeRole, PeerInfo, SyncState } from '@polkadot/types/interfaces/system';
import type { AnyNumber, Codec, IExtrinsic, Observable } from '@polkadot/types/types';
declare module '@polkadot/rpc-core/types.jsonrpc' { declare module '@polkadot/rpc-core/types.jsonrpc' {
import type { AugmentedRpc } from '@polkadot/api/types';
import type { Bytes, HashMap, Json, Metadata, Null, Option, StorageKey, Text, U256, U64, Vec, bool, u32, u64 } from '@polkadot/types';
import type { ExtrinsicOrHash, ExtrinsicStatus } from '@polkadot/types/interfaces/author';
import type { EpochAuthorship } from '@polkadot/types/interfaces/babe';
import type { BeefySignedCommitment } from '@polkadot/types/interfaces/beefy';
import type { BlockHash } from '@polkadot/types/interfaces/chain';
import type { PrefixedStorageKey } from '@polkadot/types/interfaces/childstate';
import type { AuthorityId } from '@polkadot/types/interfaces/consensus';
import type { ContractCallRequest, ContractExecResult, ContractInstantiateResult, InstantiateRequest } from '@polkadot/types/interfaces/contracts';
import type { CreatedBlock } from '@polkadot/types/interfaces/engine';
import type { EthAccount, EthCallRequest, EthFilter, EthFilterChanges, EthLog, EthReceipt, EthRichBlock, EthSubKind, EthSubParams, EthSyncStatus, EthTransaction, EthTransactionRequest, EthWork } from '@polkadot/types/interfaces/eth';
import type { Extrinsic } from '@polkadot/types/interfaces/extrinsics';
import type { EncodedFinalityProofs, JustificationNotification, ReportedRoundStates } from '@polkadot/types/interfaces/grandpa';
import type { MmrLeafProof } from '@polkadot/types/interfaces/mmr';
import type { StorageKind } from '@polkadot/types/interfaces/offchain';
import type { FeeDetails, RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment';
import type { RpcMethods } from '@polkadot/types/interfaces/rpc';
import type { AccountId, BlockNumber, H160, H256, H64, Hash, Header, Index, Justification, KeyValue, SignedBlock, StorageData } from '@polkadot/types/interfaces/runtime';
import type { ReadProof, RuntimeVersion, TraceBlockResponse } from '@polkadot/types/interfaces/state';
import type { ApplyExtrinsicResult, ChainProperties, ChainType, Health, NetworkState, NodeRole, PeerInfo, SyncState } from '@polkadot/types/interfaces/system';
import type { AnyNumber, Codec, IExtrinsic, Observable } from '@polkadot/types/types';
export interface RpcInterface { export interface RpcInterface {
author: { author: {
/** /**
@@ -460,7 +461,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) => Observable<TraceBlockResponse>>; 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>>;
}; };
syncstate: { syncstate: {
/** /**
@@ -556,5 +557,6 @@ declare module '@polkadot/rpc-core/types.jsonrpc' {
**/ **/
sha3: AugmentedRpc<(data: Bytes | string | Uint8Array) => Observable<H256>>; sha3: AugmentedRpc<(data: Bytes | string | Uint8Array) => Observable<H256>>;
}; };
} } // RpcInterface
}
} // declare module
+52 -132
View File
@@ -1,15 +1,15 @@
// 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 { ApiTypes, SubmittableExtrinsic } from '@polkadot/api/types';
import type { Bytes, Compact, Data, Option, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types';
import type { Extrinsic } from '@polkadot/types/interfaces/extrinsics';
import type { AccountId32, Call, H256, MultiAddress, Perbill, Percent, Perquintill } from '@polkadot/types/interfaces/runtime';
import type { NodeRuntimeOriginCaller, NodeRuntimeProxyType, NodeRuntimeSessionKeys, PalletAssetsDestroyWitness, PalletDemocracyConviction, PalletDemocracyVoteAccountVote, PalletElectionProviderMultiPhaseRawSolution, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenRenouncing, PalletIdentityBitFlags, PalletIdentityIdentityInfo, PalletIdentityJudgement, PalletImOnlineHeartbeat, PalletImOnlineSr25519AppSr25519Signature, PalletMultisigTimepoint, PalletSocietyJudgement, PalletStakingRewardDestination, PalletStakingValidatorPrefs, PalletUniquesDestroyWitness, PalletVestingVestingInfo, SpConsensusBabeDigestsNextConfigDescriptor, SpConsensusSlotsEquivocationProof, SpCoreChangesTrieChangesTrieConfiguration, SpFinalityGrandpaEquivocationProof, SpNposElectionsSupport, SpRuntimeGenericHeader, SpSessionMembershipProof, SpTransactionStorageProofTransactionStorageProof } from '@polkadot/types/lookup';
import type { AnyNumber, ITuple } from '@polkadot/types/types';
declare module '@polkadot/api/types/submittable' { declare module '@polkadot/api/types/submittable' {
export interface AugmentedSubmittables<ApiType> { import type { ApiTypes, AugmentedSubmittable, SubmittableExtrinsic, SubmittableExtrinsicFunction, SubmittableModuleExtrinsics } from '@polkadot/api/types';
import type { Bytes, Compact, Data, Option, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types';
import type { Extrinsic } from '@polkadot/types/interfaces/extrinsics';
import type { AccountId32, Call, H256, MultiAddress, Perbill, Percent, Perquintill } from '@polkadot/types/interfaces/runtime';
import type { NodeRuntimeOriginCaller, NodeRuntimeProxyType, NodeRuntimeSessionKeys, PalletAssetsDestroyWitness, PalletDemocracyConviction, PalletDemocracyVoteAccountVote, PalletElectionProviderMultiPhaseRawSolution, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenRenouncing, PalletIdentityBitFlags, PalletIdentityIdentityInfo, PalletIdentityJudgement, PalletImOnlineHeartbeat, PalletImOnlineSr25519AppSr25519Signature, PalletMultisigTimepoint, PalletSocietyJudgement, PalletStakingRewardDestination, PalletStakingValidatorPrefs, PalletUniquesDestroyWitness, PalletVestingVestingInfo, SpConsensusBabeDigestsNextConfigDescriptor, SpConsensusSlotsEquivocationProof, SpFinalityGrandpaEquivocationProof, SpNposElectionsSupport, SpRuntimeHeader, SpSessionMembershipProof, SpTransactionStorageProofTransactionStorageProof } from '@polkadot/types/lookup';
import type { AnyNumber, ITuple } from '@polkadot/types/types';
export interface AugmentedSubmittables<ApiType extends ApiTypes> {
assets: { assets: {
/** /**
* Approve an amount of asset for transfer by a delegated third-party account. * Approve an amount of asset for transfer by a delegated third-party account.
@@ -33,7 +33,7 @@ declare module '@polkadot/api/types/submittable' {
* *
* Weight: `O(1)` * Weight: `O(1)`
**/ **/
approveTransfer: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, delegate: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<u64> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, Compact<u64>]>; approveTransfer: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, delegate: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, Compact<u128>]>;
/** /**
* Reduce the balance of `who` by as much as possible up to `amount` assets of `id`. * Reduce the balance of `who` by as much as possible up to `amount` assets of `id`.
* *
@@ -51,7 +51,7 @@ declare module '@polkadot/api/types/submittable' {
* Weight: `O(1)` * Weight: `O(1)`
* Modes: Post-existence of `who`; Pre & post Zombie-status of `who`. * Modes: Post-existence of `who`; Pre & post Zombie-status of `who`.
**/ **/
burn: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, who: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<u64> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, Compact<u64>]>; burn: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, who: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, Compact<u128>]>;
/** /**
* Cancel all of some asset approved for delegated transfer by a third-party account. * Cancel all of some asset approved for delegated transfer by a third-party account.
* *
@@ -103,7 +103,7 @@ declare module '@polkadot/api/types/submittable' {
* *
* Weight: `O(1)` * Weight: `O(1)`
**/ **/
create: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, admin: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, minBalance: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, u64]>; create: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, admin: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, minBalance: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, u128]>;
/** /**
* Destroy a class of fungible assets. * Destroy a class of fungible assets.
* *
@@ -149,7 +149,7 @@ declare module '@polkadot/api/types/submittable' {
* *
* Weight: `O(1)` * Weight: `O(1)`
**/ **/
forceAssetStatus: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, owner: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, issuer: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, admin: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, freezer: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, minBalance: Compact<u64> | AnyNumber | Uint8Array, isSufficient: bool | boolean | Uint8Array, isFrozen: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, MultiAddress, MultiAddress, MultiAddress, Compact<u64>, bool, bool]>; forceAssetStatus: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, owner: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, issuer: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, admin: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, freezer: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, minBalance: Compact<u128> | AnyNumber | Uint8Array, isSufficient: bool | boolean | Uint8Array, isFrozen: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, MultiAddress, MultiAddress, MultiAddress, Compact<u128>, bool, bool]>;
/** /**
* Cancel all of some asset approved for delegated transfer by a third-party account. * Cancel all of some asset approved for delegated transfer by a third-party account.
* *
@@ -201,7 +201,7 @@ declare module '@polkadot/api/types/submittable' {
* *
* Weight: `O(1)` * Weight: `O(1)`
**/ **/
forceCreate: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, owner: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, isSufficient: bool | boolean | Uint8Array, minBalance: Compact<u64> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, bool, Compact<u64>]>; forceCreate: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, owner: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, isSufficient: bool | boolean | Uint8Array, minBalance: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, bool, Compact<u128>]>;
/** /**
* Force the metadata for an asset to some value. * Force the metadata for an asset to some value.
* *
@@ -240,7 +240,7 @@ declare module '@polkadot/api/types/submittable' {
* Modes: Pre-existence of `dest`; Post-existence of `source`; Account pre-existence of * Modes: Pre-existence of `dest`; Post-existence of `source`; Account pre-existence of
* `dest`. * `dest`.
**/ **/
forceTransfer: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, source: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, dest: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<u64> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, MultiAddress, Compact<u64>]>; forceTransfer: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, source: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, dest: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, MultiAddress, Compact<u128>]>;
/** /**
* Disallow further unprivileged transfers from an account. * Disallow further unprivileged transfers from an account.
* *
@@ -280,7 +280,7 @@ declare module '@polkadot/api/types/submittable' {
* Weight: `O(1)` * Weight: `O(1)`
* Modes: Pre-existing balance of `beneficiary`; Account pre-existence of `beneficiary`. * Modes: Pre-existing balance of `beneficiary`; Account pre-existence of `beneficiary`.
**/ **/
mint: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, beneficiary: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<u64> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, Compact<u64>]>; mint: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, beneficiary: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, Compact<u128>]>;
/** /**
* Set the metadata for an asset. * Set the metadata for an asset.
* *
@@ -360,7 +360,7 @@ declare module '@polkadot/api/types/submittable' {
* Modes: Pre-existence of `target`; Post-existence of sender; Account pre-existence of * Modes: Pre-existence of `target`; Post-existence of sender; Account pre-existence of
* `target`. * `target`.
**/ **/
transfer: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, target: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<u64> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, Compact<u64>]>; transfer: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, target: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, Compact<u128>]>;
/** /**
* Transfer some asset balance from a previously delegated account to some third-party * Transfer some asset balance from a previously delegated account to some third-party
* account. * account.
@@ -381,7 +381,7 @@ declare module '@polkadot/api/types/submittable' {
* *
* Weight: `O(1)` * Weight: `O(1)`
**/ **/
transferApproved: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, owner: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, destination: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<u64> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, MultiAddress, Compact<u64>]>; transferApproved: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, owner: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, destination: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, MultiAddress, Compact<u128>]>;
/** /**
* Move some assets from the sender account to another, keeping the sender account alive. * Move some assets from the sender account to another, keeping the sender account alive.
* *
@@ -402,7 +402,7 @@ declare module '@polkadot/api/types/submittable' {
* Modes: Pre-existence of `target`; Post-existence of sender; Account pre-existence of * Modes: Pre-existence of `target`; Post-existence of sender; Account pre-existence of
* `target`. * `target`.
**/ **/
transferKeepAlive: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, target: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<u64> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, Compact<u64>]>; transferKeepAlive: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, target: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, Compact<u128>]>;
/** /**
* Change the Owner of an asset. * Change the Owner of an asset.
* *
@@ -425,7 +425,7 @@ declare module '@polkadot/api/types/submittable' {
/** /**
* Provide a set of uncles. * Provide a set of uncles.
**/ **/
setUncles: AugmentedSubmittable<(newUncles: Vec<SpRuntimeGenericHeader> | (SpRuntimeGenericHeader | { parentHash?: any; number?: any; stateRoot?: any; extrinsicsRoot?: any; digest?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<SpRuntimeGenericHeader>]>; setUncles: AugmentedSubmittable<(newUncles: Vec<SpRuntimeHeader> | (SpRuntimeHeader | { parentHash?: any; number?: any; stateRoot?: any; extrinsicsRoot?: any; digest?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<SpRuntimeHeader>]>;
/** /**
* Generic tx * Generic tx
**/ **/
@@ -504,16 +504,6 @@ declare module '@polkadot/api/types/submittable' {
* it will reset the account nonce (`frame_system::AccountNonce`). * it will reset the account nonce (`frame_system::AccountNonce`).
* *
* The dispatch origin for this call is `root`. * The dispatch origin for this call is `root`.
*
* # <weight>
* - Independent of the arguments.
* - Contains a limited number of reads and writes.
* ---------------------
* - Base Weight:
* - Creating: 27.56 µs
* - Killing: 35.11 µs
* - DB Weight: 1 Read, 1 Write to `who`
* # </weight>
**/ **/
setBalance: AugmentedSubmittable<(who: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, newFree: Compact<u128> | AnyNumber | Uint8Array, newReserved: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, Compact<u128>, Compact<u128>]>; setBalance: AugmentedSubmittable<(who: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, newFree: Compact<u128> | AnyNumber | Uint8Array, newReserved: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, Compact<u128>, Compact<u128>]>;
/** /**
@@ -541,8 +531,6 @@ declare module '@polkadot/api/types/submittable' {
* - `transfer_keep_alive` works the same way as `transfer`, but has an additional check * - `transfer_keep_alive` works the same way as `transfer`, but has an additional check
* that the transfer will not kill the origin account. * that the transfer will not kill the origin account.
* --------------------------------- * ---------------------------------
* - Base Weight: 73.64 µs, worst case scenario (account created, account removed)
* - DB Weight: 1 Read and 1 Write to destination account
* - Origin account is already in memory, so no DB operations for them. * - Origin account is already in memory, so no DB operations for them.
* # </weight> * # </weight>
**/ **/
@@ -574,11 +562,6 @@ declare module '@polkadot/api/types/submittable' {
* 99% of the time you want [`transfer`] instead. * 99% of the time you want [`transfer`] instead.
* *
* [`transfer`]: struct.Pallet.html#method.transfer * [`transfer`]: struct.Pallet.html#method.transfer
* # <weight>
* - Cheaper than transfer because account cannot be killed.
* - Base Weight: 51.4 µs
* - DB Weight: 1 Read and 1 Write to dest (sender is in overlay already)
* #</weight>
**/ **/
transferKeepAlive: AugmentedSubmittable<(dest: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, Compact<u128>]>; transferKeepAlive: AugmentedSubmittable<(dest: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, Compact<u128>]>;
/** /**
@@ -871,6 +854,13 @@ declare module '@polkadot/api/types/submittable' {
* NOTE: Does not enforce the expected `MaxMembers` limit on the amount of members, but * NOTE: Does not enforce the expected `MaxMembers` limit on the amount of members, but
* the weight estimations rely on it to estimate dispatchable weight. * the weight estimations rely on it to estimate dispatchable weight.
* *
* # WARNING:
*
* The `pallet-collective` can also be managed by logic outside of the pallet through the
* implementation of the trait [`ChangeMembers`].
* Any call to `set_members` must be careful that the member set doesn't get out of sync
* with other logic managing the member set.
*
* # <weight> * # <weight>
* ## Weight * ## Weight
* - `O(MP + N)` where: * - `O(MP + N)` where:
@@ -2493,41 +2483,14 @@ declare module '@polkadot/api/types/submittable' {
scheduler: { scheduler: {
/** /**
* Cancel an anonymously scheduled task. * Cancel an anonymously scheduled task.
*
* # <weight>
* - S = Number of already scheduled calls
* - Base Weight: 22.15 + 2.869 * S µs
* - DB Weight:
* - Read: Agenda
* - Write: Agenda, Lookup
* - Will use base weight of 100 which should be good for up to 30 scheduled calls
* # </weight>
**/ **/
cancel: AugmentedSubmittable<(when: u32 | AnyNumber | Uint8Array, index: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32]>; cancel: AugmentedSubmittable<(when: u32 | AnyNumber | Uint8Array, index: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32]>;
/** /**
* Cancel a named scheduled task. * Cancel a named scheduled task.
*
* # <weight>
* - S = Number of already scheduled calls
* - Base Weight: 24.91 + 2.907 * S µs
* - DB Weight:
* - Read: Agenda, Lookup
* - Write: Agenda, Lookup
* - Will use base weight of 100 which should be good for up to 30 scheduled calls
* # </weight>
**/ **/
cancelNamed: AugmentedSubmittable<(id: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>; cancelNamed: AugmentedSubmittable<(id: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>;
/** /**
* Anonymously schedule a task. * Anonymously schedule a task.
*
* # <weight>
* - S = Number of already scheduled calls
* - Base Weight: 22.29 + .126 * S µs
* - DB Weight:
* - Read: Agenda
* - Write: Agenda
* - Will use base weight of 25 which should be good for up to 30 scheduled calls
* # </weight>
**/ **/
schedule: AugmentedSubmittable<(when: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | object | string | Uint8Array, priority: u8 | AnyNumber | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, Option<ITuple<[u32, u32]>>, u8, Call]>; schedule: AugmentedSubmittable<(when: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | object | string | Uint8Array, priority: u8 | AnyNumber | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, Option<ITuple<[u32, u32]>>, u8, Call]>;
/** /**
@@ -2540,15 +2503,6 @@ declare module '@polkadot/api/types/submittable' {
scheduleAfter: AugmentedSubmittable<(after: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | object | string | Uint8Array, priority: u8 | AnyNumber | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, Option<ITuple<[u32, u32]>>, u8, Call]>; scheduleAfter: AugmentedSubmittable<(after: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | object | string | Uint8Array, priority: u8 | AnyNumber | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, Option<ITuple<[u32, u32]>>, u8, Call]>;
/** /**
* Schedule a named task. * Schedule a named task.
*
* # <weight>
* - S = Number of already scheduled calls
* - Base Weight: 29.6 + .159 * S µs
* - DB Weight:
* - Read: Agenda, Lookup
* - Write: Agenda, Lookup
* - Will use base weight of 35 which should be good for more than 30 scheduled calls
* # </weight>
**/ **/
scheduleNamed: AugmentedSubmittable<(id: Bytes | string | Uint8Array, when: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | object | string | Uint8Array, priority: u8 | AnyNumber | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes, u32, Option<ITuple<[u32, u32]>>, u8, Call]>; scheduleNamed: AugmentedSubmittable<(id: Bytes | string | Uint8Array, when: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | object | string | Uint8Array, priority: u8 | AnyNumber | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes, u32, Option<ITuple<[u32, u32]>>, u8, Call]>;
/** /**
@@ -3156,22 +3110,18 @@ declare module '@polkadot/api/types/submittable' {
**/ **/
payoutStakers: AugmentedSubmittable<(validatorStash: AccountId32 | string | Uint8Array, era: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, u32]>; payoutStakers: AugmentedSubmittable<(validatorStash: AccountId32 | string | Uint8Array, era: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, u32]>;
/** /**
* Remove all data structure concerning a staker/stash once its balance is at the minimum. * Remove all data structures concerning a staker/stash once it is at a state where it can
* This is essentially equivalent to `withdraw_unbonded` except it can be called by anyone * be considered `dust` in the staking system. The requirements are:
* and the target `stash` must have no funds left beyond the ED.
* *
* This can be called from any origin. * 1. the `total_balance` of the stash is below existential deposit.
* 2. or, the `ledger.total` of the stash is below existential deposit.
* *
* - `stash`: The stash account to reap. Its balance must be zero. * The former can happen in cases like a slash; the latter when a fully unbonded account
* is still receiving staking rewards in `RewardDestination::Staked`.
* *
* # <weight> * It can be called by anyone, as long as `stash` meets the above requirements.
* Complexity: O(S) where S is the number of slashing spans on the account. *
* DB Weight: * Refunds the transaction fees upon successful execution.
* - Reads: Stash Account, Bonded, Slashing Spans, Locks
* - Writes: Bonded, Slashing Spans (if S > 0), Ledger, Payee, Validators, Nominators,
* Stash Account, Locks
* - Writes Each: SpanSlash * S
* # </weight>
**/ **/
reapStash: AugmentedSubmittable<(stash: AccountId32 | string | Uint8Array, numSlashingSpans: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, u32]>; reapStash: AugmentedSubmittable<(stash: AccountId32 | string | Uint8Array, numSlashingSpans: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, u32]>;
/** /**
@@ -3271,7 +3221,7 @@ declare module '@polkadot/api/types/submittable' {
**/ **/
setPayee: AugmentedSubmittable<(payee: PalletStakingRewardDestination | { Staked: any } | { Stash: any } | { Controller: any } | { Account: any } | { None: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [PalletStakingRewardDestination]>; setPayee: AugmentedSubmittable<(payee: PalletStakingRewardDestination | { Staked: any } | { Stash: any } | { Controller: any } | { Account: any } | { None: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [PalletStakingRewardDestination]>;
/** /**
* Update the various staking limits this pallet. * Update the various staking configurations .
* *
* * `min_nominator_bond`: The minimum active bond needed to be a nominator. * * `min_nominator_bond`: The minimum active bond needed to be a nominator.
* * `min_validator_bond`: The minimum active bond needed to be a validator. * * `min_validator_bond`: The minimum active bond needed to be a validator.
@@ -3279,13 +3229,17 @@ declare module '@polkadot/api/types/submittable' {
* set to `None`, no limit is enforced. * set to `None`, no limit is enforced.
* * `max_validator_count`: The max number of users who can be a validator at once. When * * `max_validator_count`: The max number of users who can be a validator at once. When
* set to `None`, no limit is enforced. * set to `None`, no limit is enforced.
* * `chill_threshold`: The ratio of `max_nominator_count` or `max_validator_count` which
* should be filled in order for the `chill_other` transaction to work.
* * `min_commission`: The minimum amount of commission that each validators must maintain.
* This is checked only upon calling `validate`. Existing validators are not affected.
* *
* Origin must be Root to call this function. * Origin must be Root to call this function.
* *
* NOTE: Existing nominators and validators will not be affected by this update. * NOTE: Existing nominators and validators will not be affected by this update.
* to kick people under the new limits, `chill_other` should be called. * to kick people under the new limits, `chill_other` should be called.
**/ **/
setStakingLimits: AugmentedSubmittable<(minNominatorBond: u128 | AnyNumber | Uint8Array, minValidatorBond: u128 | AnyNumber | Uint8Array, maxNominatorCount: Option<u32> | null | object | string | Uint8Array, maxValidatorCount: Option<u32> | null | object | string | Uint8Array, threshold: Option<Percent> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u128, u128, Option<u32>, Option<u32>, Option<Percent>]>; setStakingConfigs: AugmentedSubmittable<(minNominatorBond: u128 | AnyNumber | Uint8Array, minValidatorBond: u128 | AnyNumber | Uint8Array, maxNominatorCount: Option<u32> | null | object | string | Uint8Array, maxValidatorCount: Option<u32> | null | object | string | Uint8Array, chillThreshold: Option<Percent> | null | object | string | Uint8Array, minCommission: Perbill | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u128, u128, Option<u32>, Option<u32>, Option<Percent>, Perbill]>;
/** /**
* Sets the ideal number of validators. * Sets the ideal number of validators.
* *
@@ -3419,24 +3373,10 @@ declare module '@polkadot/api/types/submittable' {
* *
* **NOTE:** We rely on the Root origin to provide us the number of subkeys under * **NOTE:** We rely on the Root origin to provide us the number of subkeys under
* the prefix we are removing to accurately calculate the weight of this function. * the prefix we are removing to accurately calculate the weight of this function.
*
* # <weight>
* - `O(P)` where `P` amount of keys with prefix `prefix`
* - `P` storage deletions.
* - Base Weight: 0.834 * P µs
* - Writes: Number of subkeys + 1
* # </weight>
**/ **/
killPrefix: AugmentedSubmittable<(prefix: Bytes | string | Uint8Array, subkeys: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes, u32]>; killPrefix: AugmentedSubmittable<(prefix: Bytes | string | Uint8Array, subkeys: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes, u32]>;
/** /**
* Kill some items from storage. * Kill some items from storage.
*
* # <weight>
* - `O(IK)` where `I` length of `keys` and `K` length of one key
* - `I` storage deletions.
* - Base Weight: .378 * i µs
* - Writes: Number of items
* # </weight>
**/ **/
killStorage: AugmentedSubmittable<(keys: Vec<Bytes> | (Bytes | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<Bytes>]>; killStorage: AugmentedSubmittable<(keys: Vec<Bytes> | (Bytes | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<Bytes>]>;
/** /**
@@ -3456,19 +3396,6 @@ declare module '@polkadot/api/types/submittable' {
* # </weight> * # </weight>
**/ **/
remarkWithEvent: AugmentedSubmittable<(remark: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>; remarkWithEvent: AugmentedSubmittable<(remark: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>;
/**
* Set the new changes trie configuration.
*
* # <weight>
* - `O(1)`
* - 1 storage write or delete (codec `O(1)`).
* - 1 call to `deposit_log`: Uses `append` API, so O(1)
* - Base Weight: 7.218 µs
* - DB Weight:
* - Writes: Changes Trie, System Digest
* # </weight>
**/
setChangesTrieConfig: AugmentedSubmittable<(changesTrieConfig: Option<SpCoreChangesTrieChangesTrieConfiguration> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Option<SpCoreChangesTrieChangesTrieConfiguration>]>;
/** /**
* Set the new runtime code. * Set the new runtime code.
* *
@@ -3498,25 +3425,10 @@ declare module '@polkadot/api/types/submittable' {
setCodeWithoutChecks: AugmentedSubmittable<(code: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>; setCodeWithoutChecks: AugmentedSubmittable<(code: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>;
/** /**
* Set the number of pages in the WebAssembly environment's heap. * Set the number of pages in the WebAssembly environment's heap.
*
* # <weight>
* - `O(1)`
* - 1 storage write.
* - Base Weight: 1.405 µs
* - 1 write to HEAP_PAGES
* - 1 digest item
* # </weight>
**/ **/
setHeapPages: AugmentedSubmittable<(pages: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u64]>; setHeapPages: AugmentedSubmittable<(pages: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u64]>;
/** /**
* Set some items of storage. * Set some items of storage.
*
* # <weight>
* - `O(I)` where `I` length of `items`
* - `I` storage writes (`O(1)`).
* - Base Weight: 0.568 * i µs
* - Writes: Number of items
* # </weight>
**/ **/
setStorage: AugmentedSubmittable<(items: Vec<ITuple<[Bytes, Bytes]>> | ([Bytes | string | Uint8Array, Bytes | string | Uint8Array])[]) => SubmittableExtrinsic<ApiType>, [Vec<ITuple<[Bytes, Bytes]>>]>; setStorage: AugmentedSubmittable<(items: Vec<ITuple<[Bytes, Bytes]>> | ([Bytes | string | Uint8Array, Bytes | string | Uint8Array])[]) => SubmittableExtrinsic<ApiType>, [Vec<ITuple<[Bytes, Bytes]>>]>;
/** /**
@@ -3634,6 +3546,13 @@ declare module '@polkadot/api/types/submittable' {
* NOTE: Does not enforce the expected `MaxMembers` limit on the amount of members, but * NOTE: Does not enforce the expected `MaxMembers` limit on the amount of members, but
* the weight estimations rely on it to estimate dispatchable weight. * the weight estimations rely on it to estimate dispatchable weight.
* *
* # WARNING:
*
* The `pallet-collective` can also be managed by logic outside of the pallet through the
* implementation of the trait [`ChangeMembers`].
* Any call to `set_members` must be careful that the member set doesn't get out of sync
* with other logic managing the member set.
*
* # <weight> * # <weight>
* ## Weight * ## Weight
* - `O(MP + N)` where: * - `O(MP + N)` where:
@@ -4515,10 +4434,11 @@ declare module '@polkadot/api/types/submittable' {
**/ **/
[key: string]: SubmittableExtrinsicFunction<ApiType>; [key: string]: SubmittableExtrinsicFunction<ApiType>;
}; };
} } // AugmentedSubmittables
export interface SubmittableExtrinsics<ApiType extends ApiTypes> extends AugmentedSubmittables<ApiType> { export interface SubmittableExtrinsics<ApiType extends ApiTypes> extends AugmentedSubmittables<ApiType> {
(extrinsic: Call | Extrinsic | Uint8Array | string): SubmittableExtrinsic<ApiType>; (extrinsic: Call | Extrinsic | Uint8Array | string): SubmittableExtrinsic<ApiType>;
[key: string]: SubmittableModuleExtrinsics<ApiType>; [key: string]: SubmittableModuleExtrinsics<ApiType>;
} } // SubmittableExtrinsics
}
} // declare module
+6 -4
View File
@@ -146,8 +146,8 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
this.#instanceId = `${++instanceCounter}`; this.#instanceId = `${++instanceCounter}`;
this.#registry = options.source?.registry || options.registry || new TypeRegistry(); this.#registry = options.source?.registry || options.registry || new TypeRegistry();
this._rx.queryAt = (blockHash: Uint8Array | string) => this._rx.queryAt = (blockHash: Uint8Array | string, knownVersion?: RuntimeVersion) =>
from(this.at(blockHash)).pipe(map((a) => a.rx.query)); from(this.at(blockHash, knownVersion)).pipe(map((a) => a.rx.query));
this._rx.registry = this.#registry; this._rx.registry = this.#registry;
const thisProvider = options.source const thisProvider = options.source
@@ -354,8 +354,10 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
const [k, { method, section }] = allKnown[i]; const [k, { method, section }] = allKnown[i];
if (hasResults && !exposed.includes(k) && k !== 'rpc_methods') { if (hasResults && !exposed.includes(k) && k !== 'rpc_methods') {
delete (this._rpc as Record<string, Record<string, unknown>>)[section][method]; if ((this._rpc as Record<string, Record<string, unknown>>)[section]) {
delete (this._rx.rpc as Record<string, Record<string, unknown>>)[section][method]; delete (this._rpc as Record<string, Record<string, unknown>>)[section][method];
delete (this._rx.rpc as Record<string, Record<string, unknown>>)[section][method];
}
} }
} }
} }
+2 -2
View File
@@ -5,6 +5,6 @@ export { Keyring } from '@polkadot/keyring';
export { WsProvider, HttpProvider } from '@polkadot/rpc-provider'; export { WsProvider, HttpProvider } from '@polkadot/rpc-provider';
export { packageInfo } from './packageInfo'; export { packageInfo } from './packageInfo';
export { ApiPromise, decorateMethod as decorateMethodPromise } from './promise'; export * from './promise';
export { SubmittableResult } from './submittable'; export { SubmittableResult } from './submittable';
export { ApiRx, decorateMethod as decorateMethodRx } from './rx'; export * from './rx';
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit // Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/api', version: '6.7.1' }; export const packageInfo = { name: '@polkadot/api', version: '6.11.1' };
+215
View File
@@ -0,0 +1,215 @@
// Copyright 2017-2021 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { ApiOptions, UnsubscribePromise } from '../types';
import { objectSpread } from '@polkadot/util';
import { ApiBase } from '../base';
import { Combinator, CombinatorCallback, CombinatorFunction } from './Combinator';
import { promiseTracker, toPromiseMethod } from './decorateMethod';
/**
* # @polkadot/api/promise
*
* ## Overview
*
* @name ApiPromise
* @description
* ApiPromise is a standard JavaScript wrapper around the RPC and interfaces on the Polkadot network. As a full Promise-based, all interface calls return Promises, including the static `.create(...)`. Subscription calls utilise `(value) => {}` callbacks to pass through the latest values.
*
* The API is well suited to real-time applications where either the single-shot state is needed or use is to be made of the subscription-based features of Polkadot (and Substrate) clients.
*
* @see [[ApiRx]]
*
* ## Usage
*
* Making rpc calls -
* <BR>
*
* ```javascript
* import ApiPromise from '@polkadot/api/promise';
*
* // initialise via static create
* const api = await ApiPromise.create();
*
* // make a subscription to the network head
* api.rpc.chain.subscribeNewHeads((header) => {
* console.log(`Chain is at #${header.number}`);
* });
* ```
* <BR>
*
* Subscribing to chain state -
* <BR>
*
* ```javascript
* import { ApiPromise, WsProvider } from '@polkadot/api';
*
* // initialise a provider with a specific endpoint
* const provider = new WsProvider('wss://example.com:9944')
*
* // initialise via isReady & new with specific provider
* const api = await new ApiPromise({ provider }).isReady;
*
* // retrieve the block target time
* const blockPeriod = await api.query.timestamp.blockPeriod().toNumber();
* let last = 0;
*
* // subscribe to the current block timestamp, updates automatically (callback provided)
* api.query.timestamp.now((timestamp) => {
* const elapsed = last
* ? `, ${timestamp.toNumber() - last}s since last`
* : '';
*
* last = timestamp.toNumber();
* console.log(`timestamp ${timestamp}${elapsed} (${blockPeriod}s target)`);
* });
* ```
* <BR>
*
* Submitting a transaction -
* <BR>
*
* ```javascript
* import ApiPromise from '@polkadot/api/promise';
*
* ApiPromise.create().then((api) => {
* const [nonce] = await api.query.system.account(keyring.alice.address);
*
* api.tx.balances
* // create transfer
* transfer(keyring.bob.address, 12345)
* // sign the transcation
* .sign(keyring.alice, { nonce })
* // send the transaction (optional status callback)
* .send((status) => {
* console.log(`current status ${status.type}`);
* })
* // retrieve the submitted extrinsic hash
* .then((hash) => {
* console.log(`submitted with hash ${hash}`);
* });
* });
* ```
*/
export class ApiPromise extends ApiBase<'promise'> {
#isReadyPromise: Promise<ApiPromise>;
#isReadyOrErrorPromise: Promise<ApiPromise>;
/**
* @description Creates an instance of the ApiPromise class
* @param options Options to create an instance. This can be either [[ApiOptions]] or
* an [[WsProvider]].
* @example
* <BR>
*
* ```javascript
* import Api from '@polkadot/api/promise';
*
* new Api().isReady.then((api) => {
* api.rpc.subscribeNewHeads((header) => {
* console.log(`new block #${header.number.toNumber()}`);
* });
* });
* ```
*/
constructor (options?: ApiOptions) {
super(options, 'promise', toPromiseMethod);
this.#isReadyPromise = new Promise((resolve): void => {
super.once('ready', () => resolve(this));
});
this.#isReadyOrErrorPromise = new Promise((resolve, reject): void => {
const tracker = promiseTracker(resolve, reject);
super.once('ready', () => tracker.resolve(this));
super.once('error', (error: Error) => tracker.reject(error));
});
}
/**
* @description Creates an ApiPromise instance using the supplied provider. Returns an Promise containing the actual Api instance.
* @param options options that is passed to the class contructor. Can be either [[ApiOptions]] or a
* provider (see the constructor arguments)
* @example
* <BR>
*
* ```javascript
* import Api from '@polkadot/api/promise';
*
* Api.create().then(async (api) => {
* const timestamp = await api.query.timestamp.now();
*
* console.log(`lastest block timestamp ${timestamp}`);
* });
* ```
*/
public static create (options?: ApiOptions): Promise<ApiPromise> {
const instance = new ApiPromise(options);
if (options && options.throwOnConnect) {
return instance.isReadyOrError;
}
// Swallow any rejections on isReadyOrError
// (in Node 15.x this creates issues, when not being looked at)
instance.isReadyOrError.catch(() => {
// ignore
});
return instance.isReady;
}
/**
* @description Promise that resolves the first time we are connected and loaded
*/
public get isReady (): Promise<ApiPromise> {
return this.#isReadyPromise;
}
/**
* @description Promise that resolves if we can connect, or reject if there is an error
*/
public get isReadyOrError (): Promise<ApiPromise> {
return this.#isReadyOrErrorPromise;
}
/**
* @description Returns a clone of this ApiPromise instance (new underlying provider connection)
*/
public clone (): ApiPromise {
return new ApiPromise(
objectSpread({}, this._options, { source: this })
);
}
/**
* @description Creates a combinator that can be used to combine the latest results from multiple subscriptions
* @param fns An array of function to combine, each in the form of `(cb: (value: void)) => void`
* @param callback A callback that will return an Array of all the values this combinator has been applied to
* @example
* <BR>
*
* ```javascript
* const address = '5DTestUPts3kjeXSTMyerHihn1uwMfLj8vU8sqF7qYrFacT7';
*
* // combines values from balance & nonce as it updates
* api.combineLatest([
* api.rpc.chain.subscribeNewHeads,
* (cb) => api.query.system.account(address, cb)
* ], ([head, [balance, nonce]]) => {
* console.log(`#${head.number}: You have ${balance.free} units, with ${nonce} transactions sent`);
* });
* ```
*/
// eslint-disable-next-line @typescript-eslint/require-await
public async combineLatest <T extends any[] = any[]> (fns: (CombinatorFunction | [CombinatorFunction, ...any[]])[], callback: CombinatorCallback<T>): UnsubscribePromise {
const combinator = new Combinator(fns, callback);
return (): void => {
combinator.unsubscribe();
};
}
}
+108
View File
@@ -0,0 +1,108 @@
// Copyright 2017-2021 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { Callback, Codec } from '@polkadot/types/types';
import type { DecorateFn, DecorateMethodOptions, ObsInnerType, StorageEntryPromiseOverloads, UnsubscribePromise, VoidFn } from '../types';
import { catchError, EMPTY, Subscription, tap } from 'rxjs';
import { assert, isFunction } from '@polkadot/util';
interface Tracker<T> {
reject: (value: Error) => Observable<never>;
resolve: (value: T) => void;
}
// a Promise completion tracker, wrapping an isComplete variable that ensures the promise only resolves once
export function promiseTracker<T> (resolve: (value: T) => void, reject: (value: Error) => void): Tracker<T> {
let isCompleted = false;
return {
reject: (error: Error): Observable<never> => {
if (!isCompleted) {
isCompleted = true;
reject(error);
}
return EMPTY;
},
resolve: (value: T): void => {
if (!isCompleted) {
isCompleted = true;
resolve(value);
}
}
};
}
// extract the arguments and callback params from a value array possibly containing a callback
function extractArgs (args: unknown[], needsCallback: boolean): [unknown[], Callback<Codec> | undefined] {
let callback: Callback<Codec> | undefined;
const actualArgs = args.slice();
// If the last arg is a function, we pop it, put it into callback.
// actualArgs will then hold the actual arguments to be passed to `method`
if (args.length && isFunction(args[args.length - 1])) {
callback = actualArgs.pop() as Callback<Codec>;
}
// 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');
return [actualArgs, callback];
}
// Decorate a call for a single-shot result - retrieve and then immediate unsubscribe
function decorateCall<M extends DecorateFn<ObsInnerType<ReturnType<M>>>> (method: M, args: unknown[]): Promise<ObsInnerType<ReturnType<M>>> {
return new Promise((resolve, reject): void => {
// single result tracker - either reject with Error or resolve with Codec result
const tracker = promiseTracker(resolve, reject);
// encoding errors reject immediately, any result unsubscribes and resolves
const subscription: Subscription = method(...args)
.pipe(
catchError((error: Error) => tracker.reject(error))
)
.subscribe((result): void => {
tracker.resolve(result);
setTimeout(() => subscription.unsubscribe(), 0);
});
});
}
// Decorate a subscription where we have a result callback specified
function decorateSubscribe<M extends DecorateFn<ObsInnerType<ReturnType<M>>>> (method: M, args: unknown[], resultCb: Callback<Codec>): UnsubscribePromise {
return new Promise<VoidFn>((resolve, reject): void => {
// either reject with error or resolve with unsubscribe callback
const tracker = promiseTracker(resolve, reject);
// errors reject immediately, the first result resolves with an unsubscribe promise, all results via callback
const subscription: Subscription = method(...args)
.pipe(
catchError((error: Error) => tracker.reject(error)),
tap(() => tracker.resolve(() => subscription.unsubscribe()))
)
.subscribe((result): void => {
// queue result (back of queue to clear current)
setTimeout(() => resultCb(result) as void, 0);
});
});
}
/**
* @description Decorate method for ApiPromise, where the results are converted to the Promise equivalent
*/
export function toPromiseMethod<M extends DecorateFn<ObsInnerType<ReturnType<M>>>> (method: M, options?: DecorateMethodOptions): StorageEntryPromiseOverloads {
const needsCallback = !!(options && options.methodName && options.methodName.includes('subscribe'));
return function (...args: unknown[]): Promise<ObsInnerType<ReturnType<M>>> | UnsubscribePromise {
const [actualArgs, resultCb] = extractArgs(args, needsCallback);
return resultCb
? decorateSubscribe(method, actualArgs, resultCb)
: decorateCall((options?.overrideNoSub as M) || method, actualArgs);
} as StorageEntryPromiseOverloads;
}
+1 -1
View File
@@ -14,7 +14,7 @@ import { hexToU8a } from '@polkadot/util';
import { SingleAccountSigner } from '../../test/util'; import { SingleAccountSigner } from '../../test/util';
import { ApiPromise } from '.'; import { ApiPromise } from '.';
const TRANSFER_SIG = '0x54f39e43f32376a5ab6cdfd4d0ce57802aa9ff85514a7ffa9f2a949078f02beca16af87427c45fe60d54aa847fd241d127ed39e21b101806f6b1f50f7a82500b'; const TRANSFER_SIG = '0xcc277eb341d3801c08f149508221583fa3185cc3944e6cb376cd061640305edd7dc24dfd754adb24768f1d8547389b7720e6f626bc81f5593fba1141e7f7ba07';
describe('ApiPromise', (): void => { describe('ApiPromise', (): void => {
const registry = new TypeRegistry(); const registry = new TypeRegistry();
+2 -309
View File
@@ -1,312 +1,5 @@
// Copyright 2017-2021 @polkadot/api authors & contributors // Copyright 2017-2021 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs'; export { ApiPromise } from './Api';
import type { Callback, Codec } from '@polkadot/types/types'; export { toPromiseMethod } from './decorateMethod';
import type { ApiOptions, DecorateFn, DecorateMethodOptions, ObsInnerType, StorageEntryPromiseOverloads, UnsubscribePromise, VoidFn } from '../types';
import { catchError, EMPTY, Subscription, tap } from 'rxjs';
import { assert, isFunction, objectSpread } from '@polkadot/util';
import { ApiBase } from '../base';
import { Combinator, CombinatorCallback, CombinatorFunction } from './Combinator';
interface Tracker<T> {
reject: (value: Error) => Observable<never>;
resolve: (value: T) => void;
}
// extract the arguments and callback params from a value array possibly containing a callback
function extractArgs (args: unknown[], needsCallback: boolean): [unknown[], Callback<Codec> | undefined] {
let callback: Callback<Codec> | undefined;
const actualArgs = args.slice();
// If the last arg is a function, we pop it, put it into callback.
// actualArgs will then hold the actual arguments to be passed to `method`
if (args.length && isFunction(args[args.length - 1])) {
callback = actualArgs.pop() as Callback<Codec>;
}
// 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');
return [actualArgs, callback];
}
// a Promise completion tracker, wrapping an isComplete variable that ensures the promise only resolves once
function promiseTracker<T> (resolve: (value: T) => void, reject: (value: Error) => void): Tracker<T> {
let isCompleted = false;
return {
reject: (error: Error): Observable<never> => {
if (!isCompleted) {
isCompleted = true;
reject(error);
}
return EMPTY;
},
resolve: (value: T): void => {
if (!isCompleted) {
isCompleted = true;
resolve(value);
}
}
};
}
// Decorate a call for a single-shot result - retrieve and then immediate unsubscribe
function decorateCall<Method extends DecorateFn<ObsInnerType<ReturnType<Method>>>> (method: Method, actualArgs: unknown[]): Promise<ObsInnerType<ReturnType<Method>>> {
return new Promise((resolve, reject): void => {
// single result tracker - either reject with Error or resolve with Codec result
const tracker = promiseTracker(resolve, reject);
// encoding errors reject immediately, any result unsubscribes and resolves
const subscription: Subscription = method(...actualArgs).pipe(
catchError((error: Error) => tracker.reject(error))
).subscribe((result): void => {
tracker.resolve(result);
setTimeout(() => subscription.unsubscribe(), 0);
});
});
}
// Decorate a subscription where we have a result callback specified
function decorateSubscribe<Method extends DecorateFn<ObsInnerType<ReturnType<Method>>>> (method: Method, actualArgs: unknown[], resultCb: Callback<Codec>): UnsubscribePromise {
return new Promise<VoidFn>((resolve, reject): void => {
// either reject with error or resolve with unsubscribe callback
const tracker = promiseTracker(resolve, reject);
// errors reject immediately, the first result resolves with an unsubscribe promise, all results via callback
const subscription: Subscription = method(...actualArgs).pipe(
catchError((error: Error) => tracker.reject(error)),
tap(() => tracker.resolve(() => subscription.unsubscribe()))
).subscribe((result): void => {
// queue result (back of queue to clear current)
setTimeout(() => resultCb(result) as void, 0);
});
});
}
/**
* @description Decorate method for ApiPromise, where the results are converted to the Promise equivalent
*/
export function decorateMethod<Method extends DecorateFn<ObsInnerType<ReturnType<Method>>>> (method: Method, options?: DecorateMethodOptions): StorageEntryPromiseOverloads {
const needsCallback = options && options.methodName && options.methodName.includes('subscribe');
return function (...args: unknown[]): Promise<ObsInnerType<ReturnType<Method>>> | UnsubscribePromise {
const [actualArgs, resultCb] = extractArgs(args, !!needsCallback);
return resultCb
? decorateSubscribe(method, actualArgs, resultCb)
: decorateCall((options?.overrideNoSub as Method) || method, actualArgs);
} as StorageEntryPromiseOverloads;
}
/**
* # @polkadot/api/promise
*
* ## Overview
*
* @name ApiPromise
* @description
* ApiPromise is a standard JavaScript wrapper around the RPC and interfaces on the Polkadot network. As a full Promise-based, all interface calls return Promises, including the static `.create(...)`. Subscription calls utilise `(value) => {}` callbacks to pass through the latest values.
*
* The API is well suited to real-time applications where either the single-shot state is needed or use is to be made of the subscription-based features of Polkadot (and Substrate) clients.
*
* @see [[ApiRx]]
*
* ## Usage
*
* Making rpc calls -
* <BR>
*
* ```javascript
* import ApiPromise from '@polkadot/api/promise';
*
* // initialise via static create
* const api = await ApiPromise.create();
*
* // make a subscription to the network head
* api.rpc.chain.subscribeNewHeads((header) => {
* console.log(`Chain is at #${header.number}`);
* });
* ```
* <BR>
*
* Subscribing to chain state -
* <BR>
*
* ```javascript
* import { ApiPromise, WsProvider } from '@polkadot/api';
*
* // initialise a provider with a specific endpoint
* const provider = new WsProvider('wss://example.com:9944')
*
* // initialise via isReady & new with specific provider
* const api = await new ApiPromise({ provider }).isReady;
*
* // retrieve the block target time
* const blockPeriod = await api.query.timestamp.blockPeriod().toNumber();
* let last = 0;
*
* // subscribe to the current block timestamp, updates automatically (callback provided)
* api.query.timestamp.now((timestamp) => {
* const elapsed = last
* ? `, ${timestamp.toNumber() - last}s since last`
* : '';
*
* last = timestamp.toNumber();
* console.log(`timestamp ${timestamp}${elapsed} (${blockPeriod}s target)`);
* });
* ```
* <BR>
*
* Submitting a transaction -
* <BR>
*
* ```javascript
* import ApiPromise from '@polkadot/api/promise';
*
* ApiPromise.create().then((api) => {
* const [nonce] = await api.query.system.account(keyring.alice.address);
*
* api.tx.balances
* // create transfer
* transfer(keyring.bob.address, 12345)
* // sign the transcation
* .sign(keyring.alice, { nonce })
* // send the transaction (optional status callback)
* .send((status) => {
* console.log(`current status ${status.type}`);
* })
* // retrieve the submitted extrinsic hash
* .then((hash) => {
* console.log(`submitted with hash ${hash}`);
* });
* });
* ```
*/
export class ApiPromise extends ApiBase<'promise'> {
#isReadyPromise: Promise<ApiPromise>;
#isReadyOrErrorPromise: Promise<ApiPromise>;
/**
* @description Creates an ApiPromise instance using the supplied provider. Returns an Promise containing the actual Api instance.
* @param options options that is passed to the class contructor. Can be either [[ApiOptions]] or a
* provider (see the constructor arguments)
* @example
* <BR>
*
* ```javascript
* import Api from '@polkadot/api/promise';
*
* Api.create().then(async (api) => {
* const timestamp = await api.query.timestamp.now();
*
* console.log(`lastest block timestamp ${timestamp}`);
* });
* ```
*/
public static create (options?: ApiOptions): Promise<ApiPromise> {
const instance = new ApiPromise(options);
if (options && options.throwOnConnect) {
return instance.isReadyOrError;
}
// Swallow any rejections on isReadyOrError
// (in Node 15.x this creates issues, when not being looked at)
instance.isReadyOrError.catch(() => {
// ignore
});
return instance.isReady;
}
/**
* @description Creates an instance of the ApiPromise class
* @param options Options to create an instance. This can be either [[ApiOptions]] or
* an [[WsProvider]].
* @example
* <BR>
*
* ```javascript
* import Api from '@polkadot/api/promise';
*
* new Api().isReady.then((api) => {
* api.rpc.subscribeNewHeads((header) => {
* console.log(`new block #${header.number.toNumber()}`);
* });
* });
* ```
*/
constructor (options?: ApiOptions) {
super(options, 'promise', decorateMethod);
this.#isReadyPromise = new Promise((resolve): void => {
super.once('ready', () => resolve(this));
});
this.#isReadyOrErrorPromise = new Promise((resolve, reject): void => {
const tracker = promiseTracker(resolve, reject);
super.once('ready', () => tracker.resolve(this));
super.once('error', (error: Error) => tracker.reject(error));
});
}
/**
* @description Promise that resolves the first time we are connected and loaded
*/
public get isReady (): Promise<ApiPromise> {
return this.#isReadyPromise;
}
/**
* @description Promise that resolves if we can connect, or reject if there is an error
*/
public get isReadyOrError (): Promise<ApiPromise> {
return this.#isReadyOrErrorPromise;
}
/**
* @description Returns a clone of this ApiPromise instance (new underlying provider connection)
*/
public clone (): ApiPromise {
return new ApiPromise(
objectSpread({}, this._options, { source: this })
);
}
/**
* @description Creates a combinator that can be used to combine the latest results from multiple subscriptions
* @param fns An array of function to combine, each in the form of `(cb: (value: void)) => void`
* @param callback A callback that will return an Array of all the values this combinator has been applied to
* @example
* <BR>
*
* ```javascript
* const address = '5DTestUPts3kjeXSTMyerHihn1uwMfLj8vU8sqF7qYrFacT7';
*
* // combines values from balance & nonce as it updates
* api.combineLatest([
* api.rpc.chain.subscribeNewHeads,
* (cb) => api.query.system.account(address, cb)
* ], ([head, [balance, nonce]]) => {
* console.log(`#${head.number}: You have ${balance.free} units, with ${nonce} transactions sent`);
* });
* ```
*/
// eslint-disable-next-line @typescript-eslint/require-await
public async combineLatest <T extends any[] = any[]> (fns: (CombinatorFunction | [CombinatorFunction, ...any[]])[], callback: CombinatorCallback<T>): UnsubscribePromise {
const combinator = new Combinator(fns, callback);
return (): void => {
combinator.unsubscribe();
};
}
}
+185
View File
@@ -0,0 +1,185 @@
// Copyright 2017-2021 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { ApiOptions } from '../types';
import { from, Observable } from 'rxjs';
import { objectSpread } from '@polkadot/util';
import { ApiBase } from '../base';
import { toRxMethod } from './decorateMethod';
/**
* # @polkadot/api/rx
*
* ## Overview
*
* @name ApiRx
*
* @description
* ApiRx is a powerful RxJS Observable wrapper around the RPC and interfaces on the Polkadot network. As a full Observable API, all interface calls return RxJS Observables, including the static `.create(...)`. In the same fashion and subscription-based methods return long-running Observables that update with the latest values.
*
* The API is well suited to real-time applications where the latest state is needed, unlocking the subscription-based features of Polkadot (and Substrate) clients. Some familiarity with RxJS is a requirement to use the API, however just understanding `.subscribe` and `.pipe` on Observables will unlock full-scale use thereof.
*
* @see [[ApiPromise]]
*
* ## Usage
*
* Making rpc calls -
* <BR>
*
* ```javascript
* import ApiRx from '@polkadot/api/rx';
*
* // initialize via Promise & static create
* const api = await ApiRx.create().toPromise();
*
* // make a call to retrieve the current network head
* api.rpc.chain.subscribeNewHeads().subscribe((header) => {
* console.log(`Chain is at #${header.number}`);
* });
* ```
* <BR>
*
* Subscribing to chain state -
* <BR>
*
* ```javascript
* import { combineLatest, pairwise, switchMap } from 'rxjs';
* import { ApiRx, WsProvider } from '@polkadot/api';
*
*
* // initialize a provider with a specific endpoint
* const provider = new WsProvider('wss://example.com:9944')
*
* // initialize via isReady & new with specific provider
* new ApiRx({ provider })
* .isReady
* .pipe(
* switchMap((api) =>
* combineLatest([
* api.query.timestamp.blockPeriod(),
* api.query.timestamp.now().pipe(pairwise())
* ])
* )
* )
* .subscribe(([blockPeriod, timestamp]) => {
* const elapsed = timestamp[1].toNumber() - timestamp[0].toNumber();
* console.log(`timestamp ${timestamp[1]} \nelapsed ${elapsed} \n(${blockPeriod}s target)`);
* });
* ```
* <BR>
*
* Submitting a transaction -
* <BR>
*
* ```javascript
* import { first, switchMap } from 'rxjs';
* import ApiRx from '@polkadot/api/rx';
*
* // import the test keyring (already has dev keys for Alice, Bob, Charlie, Eve & Ferdie)
* import testingPairs from '@polkadot/keyring/testingPairs';
* const keyring = testingPairs();
*
* // get api via Promise
* const api = await ApiRx.create().toPromise();
*
* // retrieve nonce for the account
* api.query.system
* .account(keyring.alice.address)
* .pipe(
* first(),
* // pipe nonce into transfer
* switchMap(([nonce]) =>
* api.tx.balances
* // create transfer
* .transfer(keyring.bob.address, 12345)
* // sign the transaction
* .sign(keyring.alice, { nonce })
* // send the transaction
* .send()
* )
* )
* // subscribe to overall result
* .subscribe(({ status }) => {
* if (status.isInBlock) {
* console.log('Completed at block hash', status.asFinalized.toHex());
* }
* });
* ```
*/
export class ApiRx extends ApiBase<'rxjs'> {
#isReadyRx: Observable<ApiRx>;
/**
* @description Create an instance of the ApiRx class
* @param options Options to create an instance. Can be either [[ApiOptions]] or [[WsProvider]]
* @example
* <BR>
*
* ```javascript
* import { switchMap } from 'rxjs';
* import Api from '@polkadot/api/rx';
*
* new Api().isReady
* .pipe(
* switchMap((api) =>
* api.rpc.chain.subscribeNewHeads()
* ))
* .subscribe((header) => {
* console.log(`new block #${header.number.toNumber()}`);
* });
* ```
*/
constructor (options?: ApiOptions) {
super(options, 'rxjs', toRxMethod);
this.#isReadyRx = from<Promise<ApiRx>>(
// You can create an observable from an event, however my mind groks this form better
new Promise((resolve): void => {
super.on('ready', () => resolve(this));
})
);
}
/**
* @description Creates an ApiRx instance using the supplied provider. Returns an Observable containing the actual Api instance.
* @param options options that is passed to the class constructor. Can be either [[ApiOptions]] or [[WsProvider]]
* @example
* <BR>
*
* ```javascript
* import { switchMap } from 'rxjs';
* import Api from '@polkadot/api/rx';
*
* Api.create()
* .pipe(
* switchMap((api) =>
* api.rpc.chain.subscribeNewHeads()
* ))
* .subscribe((header) => {
* console.log(`new block #${header.number.toNumber()}`);
* });
* ```
*/
public static create (options?: ApiOptions): Observable<ApiRx> {
return new ApiRx(options).isReady;
}
/**
* @description Observable that returns the first time we are connected and loaded
*/
public get isReady (): Observable<ApiRx> {
return this.#isReadyRx;
}
/**
* @description Returns a clone of this ApiRx instance (new underlying provider connection)
*/
public clone (): ApiRx {
return new ApiRx(
objectSpread({}, this._options, { source: this })
);
}
}
+9
View File
@@ -0,0 +1,9 @@
// Copyright 2017-2021 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Codec } from '@polkadot/types/types';
import type { DecorateFn } from '../types';
export function toRxMethod <M extends DecorateFn<Codec>> (method: M): M {
return method;
}
+2 -186
View File
@@ -1,189 +1,5 @@
// Copyright 2017-2021 @polkadot/api authors & contributors // Copyright 2017-2021 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { Codec } from '@polkadot/types/types'; export { ApiRx } from './Api';
import type { ApiOptions, DecorateFn } from '../types'; export { toRxMethod } from './decorateMethod';
import { from, Observable } from 'rxjs';
import { objectSpread } from '@polkadot/util';
import { ApiBase } from '../base';
export function decorateMethod <Method extends DecorateFn<Codec>> (method: Method): Method {
return method;
}
/**
* # @polkadot/api/rx
*
* ## Overview
*
* @name ApiRx
*
* @description
* ApiRx is a powerful RxJS Observable wrapper around the RPC and interfaces on the Polkadot network. As a full Observable API, all interface calls return RxJS Observables, including the static `.create(...)`. In the same fashion and subscription-based methods return long-running Observables that update with the latest values.
*
* The API is well suited to real-time applications where the latest state is needed, unlocking the subscription-based features of Polkadot (and Substrate) clients. Some familiarity with RxJS is a requirement to use the API, however just understanding `.subscribe` and `.pipe` on Observables will unlock full-scale use thereof.
*
* @see [[ApiPromise]]
*
* ## Usage
*
* Making rpc calls -
* <BR>
*
* ```javascript
* import ApiRx from '@polkadot/api/rx';
*
* // initialize via Promise & static create
* const api = await ApiRx.create().toPromise();
*
* // make a call to retrieve the current network head
* api.rpc.chain.subscribeNewHeads().subscribe((header) => {
* console.log(`Chain is at #${header.number}`);
* });
* ```
* <BR>
*
* Subscribing to chain state -
* <BR>
*
* ```javascript
* import { combineLatest, pairwise, switchMap } from 'rxjs';
* import { ApiRx, WsProvider } from '@polkadot/api';
*
*
* // initialize a provider with a specific endpoint
* const provider = new WsProvider('wss://example.com:9944')
*
* // initialize via isReady & new with specific provider
* new ApiRx({ provider })
* .isReady
* .pipe(
* switchMap((api) =>
* combineLatest([
* api.query.timestamp.blockPeriod(),
* api.query.timestamp.now().pipe(pairwise())
* ])
* )
* )
* .subscribe(([blockPeriod, timestamp]) => {
* const elapsed = timestamp[1].toNumber() - timestamp[0].toNumber();
* console.log(`timestamp ${timestamp[1]} \nelapsed ${elapsed} \n(${blockPeriod}s target)`);
* });
* ```
* <BR>
*
* Submitting a transaction -
* <BR>
*
* ```javascript
* import { first, switchMap } from 'rxjs';
* import ApiRx from '@polkadot/api/rx';
*
* // import the test keyring (already has dev keys for Alice, Bob, Charlie, Eve & Ferdie)
* import testingPairs from '@polkadot/keyring/testingPairs';
* const keyring = testingPairs();
*
* // get api via Promise
* const api = await ApiRx.create().toPromise();
*
* // retrieve nonce for the account
* api.query.system
* .account(keyring.alice.address)
* .pipe(
* first(),
* // pipe nonce into transfer
* switchMap(([nonce]) =>
* api.tx.balances
* // create transfer
* .transfer(keyring.bob.address, 12345)
* // sign the transaction
* .sign(keyring.alice, { nonce })
* // send the transaction
* .send()
* )
* )
* // subscribe to overall result
* .subscribe(({ status }) => {
* if (status.isInBlock) {
* console.log('Completed at block hash', status.asFinalized.toHex());
* }
* });
* ```
*/
export class ApiRx extends ApiBase<'rxjs'> {
#isReadyRx: Observable<ApiRx>;
/**
* @description Creates an ApiRx instance using the supplied provider. Returns an Observable containing the actual Api instance.
* @param options options that is passed to the class constructor. Can be either [[ApiOptions]] or [[WsProvider]]
* @example
* <BR>
*
* ```javascript
* import { switchMap } from 'rxjs';
* import Api from '@polkadot/api/rx';
*
* Api.create()
* .pipe(
* switchMap((api) =>
* api.rpc.chain.subscribeNewHeads()
* ))
* .subscribe((header) => {
* console.log(`new block #${header.number.toNumber()}`);
* });
* ```
*/
public static create (options?: ApiOptions): Observable<ApiRx> {
return new ApiRx(options).isReady;
}
/**
* @description Create an instance of the ApiRx class
* @param options Options to create an instance. Can be either [[ApiOptions]] or [[WsProvider]]
* @example
* <BR>
*
* ```javascript
* import { switchMap } from 'rxjs';
* import Api from '@polkadot/api/rx';
*
* new Api().isReady
* .pipe(
* switchMap((api) =>
* api.rpc.chain.subscribeNewHeads()
* ))
* .subscribe((header) => {
* console.log(`new block #${header.number.toNumber()}`);
* });
* ```
*/
constructor (options?: ApiOptions) {
super(options, 'rxjs', decorateMethod);
this.#isReadyRx = from<Promise<ApiRx>>(
// You can create an observable from an event, however my mind groks this form better
new Promise((resolve): void => {
super.on('ready', () => resolve(this));
})
);
}
/**
* @description Observable that returns the first time we are connected and loaded
*/
public get isReady (): Observable<ApiRx> {
return this.#isReadyRx;
}
/**
* @description Returns a clone of this ApiRx instance (new underlying provider connection)
*/
public clone (): ApiRx {
return new ApiRx(
objectSpread({}, this._options, { source: this })
);
}
}
-3
View File
@@ -5,9 +5,6 @@ import type { PalletConstantMetadataLatest } from '@polkadot/types/interfaces';
import type { Codec } from '@polkadot/types/types'; import type { Codec } from '@polkadot/types/types';
import type { ApiTypes } from './base'; import type { ApiTypes } from './base';
// eslint-disable-next-line @typescript-eslint/no-empty-interface,@typescript-eslint/no-unused-vars
export interface AugmentedConsts<ApiType extends ApiTypes> { }
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
export interface AugmentedConst<ApiType extends ApiTypes> { export interface AugmentedConst<ApiType extends ApiTypes> {
meta: PalletConstantMetadataLatest; meta: PalletConstantMetadataLatest;
-4
View File
@@ -4,10 +4,6 @@
import type { IsError } from '@polkadot/types/metadata/decorate/types'; import type { IsError } from '@polkadot/types/metadata/decorate/types';
import type { ApiTypes } from './base'; import type { ApiTypes } from './base';
// In errors we don't need the ApiType, however add it for consistency
// eslint-disable-next-line @typescript-eslint/no-empty-interface,@typescript-eslint/no-unused-vars
export interface AugmentedErrors<ApiType extends ApiTypes> { }
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
export type AugmentedError<ApiType extends ApiTypes> = IsError; export type AugmentedError<ApiType extends ApiTypes> = IsError;
-4
View File
@@ -5,10 +5,6 @@ import type { IsEvent } from '@polkadot/types/metadata/decorate/types';
import type { AnyTuple } from '@polkadot/types/types'; import type { AnyTuple } from '@polkadot/types/types';
import type { ApiTypes } from './base'; import type { ApiTypes } from './base';
// In events we don't need the ApiType, however add it for consistency
// eslint-disable-next-line @typescript-eslint/no-empty-interface,@typescript-eslint/no-unused-vars
export interface AugmentedEvents<ApiType extends ApiTypes> { }
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
export type AugmentedEvent<ApiType extends ApiTypes, T extends AnyTuple = AnyTuple> = IsEvent<T>; export type AugmentedEvent<ApiType extends ApiTypes, T extends AnyTuple = AnyTuple> = IsEvent<T>;
+14 -7
View File
@@ -1,10 +1,14 @@
// Copyright 2017-2021 @polkadot/api authors & contributors // Copyright 2017-2021 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// Augment the modules
import '@polkadot/api/augment'; import '@polkadot/api/augment';
import type { Observable } from 'rxjs'; import type { Observable } from 'rxjs';
import type { QueryableConsts } from '@polkadot/api/types/consts';
import type { DecoratedErrors } from '@polkadot/api/types/errors';
import type { DecoratedEvents } from '@polkadot/api/types/events';
import type { QueryableStorage } from '@polkadot/api/types/storage';
import type { SubmittableExtrinsics } from '@polkadot/api/types/submittable';
import type { DeriveCustom, ExactDerive } from '@polkadot/api-derive'; import type { DeriveCustom, ExactDerive } from '@polkadot/api-derive';
import type { RpcInterface } from '@polkadot/rpc-core/types'; import type { RpcInterface } from '@polkadot/rpc-core/types';
import type { ProviderInterface, ProviderInterfaceEmitted } from '@polkadot/rpc-provider/types'; import type { ProviderInterface, ProviderInterfaceEmitted } from '@polkadot/rpc-provider/types';
@@ -16,14 +20,17 @@ import type { BN } from '@polkadot/util';
import type { ApiBase } from '../base'; import type { ApiBase } from '../base';
import type { DeriveAllSections } from '../util/decorate'; import type { DeriveAllSections } from '../util/decorate';
import type { ApiTypes } from './base'; import type { ApiTypes } from './base';
import type { QueryableConsts } from './consts';
import type { DecoratedErrors } from './errors';
import type { DecoratedEvents } from './events';
import type { DecoratedRpc } from './rpc'; import type { DecoratedRpc } from './rpc';
import type { QueryableStorage, QueryableStorageMulti } from './storage'; import type { QueryableStorageMulti } from './storage';
import type { SubmittableExtrinsics } from './submittable';
export * from '@polkadot/api/types/consts';
export * from '@polkadot/api/types/errors';
export * from '@polkadot/api/types/events';
export * from '@polkadot/api/types/storage';
export * from '@polkadot/api/types/submittable';
export * from '@polkadot/api/types/rpc';
export { Signer, SignerResult } from '@polkadot/types/types'; export { Signer, SignerResult } from '@polkadot/types/types';
export { ApiBase } from '../base'; export { ApiBase } from '../base';
export * from '../submittable/types'; export * from '../submittable/types';
export * from './base'; export * from './base';
@@ -95,7 +102,7 @@ export interface ApiInterfaceRx {
runtimeMetadata: Metadata; runtimeMetadata: Metadata;
runtimeVersion: RuntimeVersion; runtimeVersion: RuntimeVersion;
query: QueryableStorage<'rxjs'>; query: QueryableStorage<'rxjs'>;
queryAt: (blockHash: Uint8Array | string) => Observable<QueryableStorage<'rxjs'>>; queryAt: (blockHash: Uint8Array | string, knownVersion?: RuntimeVersion) => Observable<QueryableStorage<'rxjs'>>;
queryMulti: QueryableStorageMulti<'rxjs'>; queryMulti: QueryableStorageMulti<'rxjs'>;
rpc: DecoratedRpc<'rxjs', RpcInterface>; rpc: DecoratedRpc<'rxjs', RpcInterface>;
tx: SubmittableExtrinsics<'rxjs'>; tx: SubmittableExtrinsics<'rxjs'>;
+5 -1
View File
@@ -4,7 +4,6 @@
import type { Observable } from 'rxjs'; import type { Observable } from 'rxjs';
import type { AnyFunction, Callback, DefinitionRpc } from '@polkadot/types/types'; import type { AnyFunction, Callback, DefinitionRpc } from '@polkadot/types/types';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { ApiTypes, PromiseResult, Push, RxResult, UnsubscribePromise } from './base'; import { ApiTypes, PromiseResult, Push, RxResult, UnsubscribePromise } from './base';
export interface RpcRxResult<F extends AnyFunction> extends RxResult<F> { export interface RpcRxResult<F extends AnyFunction> extends RxResult<F> {
@@ -31,3 +30,8 @@ export type DecoratedRpcSection<ApiType extends ApiTypes, Section> = {
export type DecoratedRpc<ApiType extends ApiTypes, AllSections> = { export type DecoratedRpc<ApiType extends ApiTypes, AllSections> = {
[Section in keyof AllSections]: DecoratedRpcSection<ApiType, AllSections[Section]> [Section in keyof AllSections]: DecoratedRpcSection<ApiType, AllSections[Section]>
} }
export type AugmentedRpc<F extends AnyFunction> = F & {
raw: <T> (...params: Parameters<F>) => Observable<T>;
meta: DefinitionRpc;
};
+1 -3
View File
@@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs'; import type { Observable } from 'rxjs';
import type { AugmentedQueries } from '@polkadot/api/types/storage';
import type { StorageKey, u64 } from '@polkadot/types'; import type { StorageKey, u64 } from '@polkadot/types';
import type { Hash } from '@polkadot/types/interfaces'; import type { Hash } from '@polkadot/types/interfaces';
import type { StorageEntry } from '@polkadot/types/primitive/types'; import type { StorageEntry } from '@polkadot/types/primitive/types';
@@ -123,9 +124,6 @@ export type QueryableStorageMulti<ApiType extends ApiTypes> =
? QueryableStorageMultiBase<ApiType> ? QueryableStorageMultiBase<ApiType>
: QueryableStorageMultiPromise<ApiType>; : QueryableStorageMultiPromise<ApiType>;
// eslint-disable-next-line @typescript-eslint/no-empty-interface,@typescript-eslint/no-unused-vars
export interface AugmentedQueries<ApiType extends ApiTypes> { }
export type AugmentedQuery<ApiType extends ApiTypes, F extends AnyFunction, A extends AnyTuple = AnyTuple> = MethodResult<ApiType, F> & StorageEntryBase<ApiType, F, A>; export type AugmentedQuery<ApiType extends ApiTypes, F extends AnyFunction, A extends AnyTuple = AnyTuple> = MethodResult<ApiType, F> & StorageEntryBase<ApiType, F, A>;
export type AugmentedQueryAt<ApiType extends ApiTypes, F extends AnyFunction, A extends AnyTuple = AnyTuple> = MethodResult<ApiType, F> & StorageEntryBaseAt<ApiType, F, A>; export type AugmentedQueryAt<ApiType extends ApiTypes, F extends AnyFunction, A extends AnyTuple = AnyTuple> = MethodResult<ApiType, F> & StorageEntryBaseAt<ApiType, F, A>;
-3
View File
@@ -5,9 +5,6 @@ import type { AnyFunction, AnyTuple, CallBase } from '@polkadot/types/types';
import type { SubmittableExtrinsic } from '../submittable/types'; import type { SubmittableExtrinsic } from '../submittable/types';
import type { ApiTypes } from './base'; import type { ApiTypes } from './base';
// eslint-disable-next-line @typescript-eslint/no-empty-interface,@typescript-eslint/no-unused-vars
export interface AugmentedSubmittables<ApiType extends ApiTypes> { }
export type AugmentedSubmittable<T extends AnyFunction, A extends AnyTuple = AnyTuple> = T & CallBase<A>; export type AugmentedSubmittable<T extends AnyFunction, A extends AnyTuple = AnyTuple> = T & CallBase<A>;
export interface SubmittableExtrinsicFunction<ApiType extends ApiTypes, A extends AnyTuple = AnyTuple> extends CallBase<A> { export interface SubmittableExtrinsicFunction<ApiType extends ApiTypes, A extends AnyTuple = AnyTuple> extends CallBase<A> {
+6 -6
View File
@@ -20,16 +20,16 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "6.7.1", "version": "6.11.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.16.0", "@babel/runtime": "^7.16.3",
"@polkadot/rpc-provider": "6.7.1", "@polkadot/rpc-provider": "6.11.1",
"@polkadot/types": "6.7.1", "@polkadot/types": "6.11.1",
"@polkadot/util": "^7.8.2", "@polkadot/util": "^8.1.2",
"rxjs": "^7.4.0" "rxjs": "^7.4.0"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/keyring": "^7.8.2" "@polkadot/keyring": "^8.1.2"
} }
} }
+1 -1
View File
@@ -204,7 +204,7 @@ export class RpcCore {
? await this.#getBlockRegistry(u8aToU8a(blockHash)) ? await this.#getBlockRegistry(u8aToU8a(blockHash))
: { registry: this.#registryDefault }; : { registry: this.#registryDefault };
const params = this._formatInputs(registry, null, def, values); const params = this._formatInputs(registry, null, def, values);
const result = await this.provider.send<AnyJson>(rpcName, params.map((p) => p.toJSON())); const result = await this.provider.send<AnyJson>(rpcName, params.map((p) => p.toJSON()), !!blockHash);
return this._formatResult(isScale, registry, blockHash, method, def, params, result); return this._formatResult(isScale, registry, blockHash, method, def, params, result);
}; };
+1 -1
View File
@@ -62,7 +62,7 @@ describe('methodSend', (): void => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
method(new Uint8Array([2 << 2, 0x12, 0x34])).subscribe((): void => { method(new Uint8Array([2 << 2, 0x12, 0x34])).subscribe((): void => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
expect(provider.send).toHaveBeenCalledWith('test_blah', ['0x1234']); expect(provider.send).toHaveBeenCalledWith('test_blah', ['0x1234'], false);
done(); done();
}); });
}); });
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit // Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/rpc-core', version: '6.7.1' }; export const packageInfo = { name: '@polkadot/rpc-core', version: '6.11.1' };
+1 -12
View File
@@ -1,15 +1,4 @@
// Copyright 2017-2021 @polkadot/rpc-core authors & contributors // Copyright 2017-2021 @polkadot/rpc-core authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// FIXME, this whole file needs to move to API export const __PHANTOM_RPC = 'phantom-rpc';
import type { Observable } from 'rxjs';
import type { AnyFunction, DefinitionRpc } from '@polkadot/types/types';
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface RpcInterface {}
export type AugmentedRpc<F extends AnyFunction> = F & {
raw: <T> (...params: Parameters<F>) => Observable<T>;
meta: DefinitionRpc;
};
+1 -1
View File
@@ -4,7 +4,7 @@
import type { Observable } from 'rxjs'; import type { Observable } from 'rxjs';
import type { Codec, DefinitionRpc } from '@polkadot/types/types'; import type { Codec, DefinitionRpc } from '@polkadot/types/types';
export * from './types.jsonrpc'; export * from '@polkadot/rpc-core/types.jsonrpc';
export interface RpcInterfaceMethod { export interface RpcInterfaceMethod {
<T extends Codec> (...params: unknown[]): Observable<T>; <T extends Codec> (...params: unknown[]): Observable<T>;
+12 -12
View File
@@ -20,22 +20,22 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "6.7.1", "version": "6.11.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.16.0", "@babel/runtime": "^7.16.3",
"@polkadot/types": "6.7.1", "@polkadot/types": "6.11.1",
"@polkadot/util": "^7.8.2", "@polkadot/util": "^8.1.2",
"@polkadot/util-crypto": "^7.8.2", "@polkadot/util-crypto": "^8.1.2",
"@polkadot/x-fetch": "^7.8.2", "@polkadot/x-fetch": "^8.1.2",
"@polkadot/x-global": "^7.8.2", "@polkadot/x-global": "^8.1.2",
"@polkadot/x-ws": "^7.8.2", "@polkadot/x-ws": "^8.1.2",
"eventemitter3": "^4.0.7" "eventemitter3": "^4.0.7"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/keyring": "^7.8.2", "@polkadot/keyring": "^8.1.2",
"@polkadot/types": "6.7.1", "@polkadot/types": "6.11.1",
"mock-socket": "^9.0.7", "mock-socket": "^9.0.8",
"nock": "^13.1.4" "nock": "^13.2.1"
} }
} }
+20 -1
View File
@@ -8,6 +8,7 @@ import { fetch } from '@polkadot/x-fetch';
import { RpcCoder } from '../coder'; import { RpcCoder } from '../coder';
import defaults from '../defaults'; import defaults from '../defaults';
import { LRUCache } from '../lru';
const ERROR_SUBSCRIBE = 'HTTP Provider does not have subscriptions, use WebSockets instead'; const ERROR_SUBSCRIBE = 'HTTP Provider does not have subscriptions, use WebSockets instead';
@@ -34,6 +35,8 @@ const l = logger('api-http');
* @see [[WsProvider]] * @see [[WsProvider]]
*/ */
export class HttpProvider implements ProviderInterface { export class HttpProvider implements ProviderInterface {
readonly #callCache = new LRUCache();
readonly #coder: RpcCoder; readonly #coder: RpcCoder;
readonly #endpoint: string; readonly #endpoint: string;
@@ -103,8 +106,24 @@ export class HttpProvider implements ProviderInterface {
/** /**
* @summary Send HTTP POST Request with Body to configured HTTP Endpoint. * @summary Send HTTP POST Request with Body to configured HTTP Endpoint.
*/ */
public async send <T> (method: string, params: unknown[]): Promise<T> { public async send <T> (method: string, params: unknown[], isCacheable?: boolean): Promise<T> {
const body = this.#coder.encodeJson(method, params); const body = this.#coder.encodeJson(method, params);
let resultPromise: Promise<T> | null = isCacheable
? this.#callCache.get(body) as Promise<T>
: null;
if (!resultPromise) {
resultPromise = this.#send(body);
if (isCacheable) {
this.#callCache.set(body, resultPromise);
}
}
return resultPromise;
}
async #send <T> (body: string): Promise<T> {
const response = await fetch(this.#endpoint, { const response = await fetch(this.#endpoint, {
body, body,
headers: { headers: {
+55
View File
@@ -0,0 +1,55 @@
// Copyright 2017-2021 @polkadot/rpc-provider authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { LRUCache } from './lru';
describe('LRUCache', (): void => {
it('allows getting of items below capacity', (): void => {
const keys = ['1', '2', '3', '4'];
const lru = new LRUCache(4);
keys.forEach((k) => lru.set(k, `${k}${k}${k}`));
expect(lru.keys().join(', ')).toEqual(keys.reverse().join(', '));
expect(lru.length === lru.lengthData && lru.length === lru.lengthRefs).toBe(true);
keys.forEach((k) => expect(lru.get(k)).toEqual(`${k}${k}${k}`));
});
it('drops items when at capacity', (): void => {
const keys = ['1', '2', '3', '4', '5', '6'];
const lru = new LRUCache(4);
keys.forEach((k) => lru.set(k, `${k}${k}${k}`));
expect(lru.keys().join(', ')).toEqual(keys.slice(2).reverse().join(', '));
expect(lru.length === lru.lengthData && lru.length === lru.lengthRefs).toBe(true);
keys.slice(2).forEach((k) => expect(lru.get(k)).toEqual(`${k}${k}${k}`));
});
it('adjusts the order as they are used', (): void => {
const keys = ['1', '2', '3', '4', '5'];
const lru = new LRUCache(4);
keys.forEach((k) => lru.set(k, `${k}${k}${k}`));
expect(lru.entries()).toEqual([['5', '555'], ['4', '444'], ['3', '333'], ['2', '222']]);
expect(lru.length === lru.lengthData && lru.length === lru.lengthRefs).toBe(true);
lru.get('3');
expect(lru.entries()).toEqual([['3', '333'], ['5', '555'], ['4', '444'], ['2', '222']]);
expect(lru.length === lru.lengthData && lru.length === lru.lengthRefs).toBe(true);
lru.set('4', '4433');
expect(lru.entries()).toEqual([['4', '4433'], ['3', '333'], ['5', '555'], ['2', '222']]);
expect(lru.length === lru.lengthData && lru.length === lru.lengthRefs).toBe(true);
lru.set('6', '666');
expect(lru.entries()).toEqual([['6', '666'], ['4', '4433'], ['3', '333'], ['5', '555']]);
expect(lru.length === lru.lengthData && lru.length === lru.lengthRefs).toBe(true);
});
});
+128
View File
@@ -0,0 +1,128 @@
// Copyright 2017-2021 @polkadot/rpc-provider authors & contributors
// SPDX-License-Identifier: Apache-2.0
const DEFAULT_CAPACITY = 2048;
class LRUNode {
public readonly key: string;
public next: LRUNode;
public prev: LRUNode;
constructor (key: string) {
this.key = key;
this.next = this.prev = this;
}
}
// https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU
export class LRUCache {
readonly capacity: number;
readonly #data: Map<string, unknown> = new Map();
readonly #refs: Map<string, LRUNode> = new Map();
#length = 0;
#head: LRUNode;
#tail: LRUNode;
constructor (capacity = DEFAULT_CAPACITY) {
this.capacity = capacity;
this.#head = this.#tail = new LRUNode('<empty>');
}
get length (): number {
return this.#length;
}
get lengthData (): number {
return this.#data.size;
}
get lengthRefs (): number {
return this.#refs.size;
}
entries (): [string, unknown][] {
const keys = this.keys();
const entries = new Array<[string, unknown]>(keys.length);
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
entries[i] = [key, this.#data.get(key)];
}
return entries;
}
keys (): string[] {
const keys: string[] = [];
if (this.#length) {
let curr = this.#head;
while (curr !== this.#tail) {
keys.push(curr.key);
curr = curr.next;
}
keys.push(curr.key);
}
return keys;
}
get <T> (key: string): T | null {
const data = this.#data.get(key);
if (data) {
this.#toHead(key);
return data as T;
}
return null;
}
set <T> (key: string, value: T): void {
if (this.#data.has(key)) {
this.#toHead(key);
} else {
const node = new LRUNode(key);
this.#refs.set(node.key, node);
if (this.length === 0) {
this.#head = this.#tail = node;
} else {
this.#head.prev = node;
node.next = this.#head;
this.#head = node;
}
if (this.#length === this.capacity) {
this.#data.delete(this.#tail.key);
this.#refs.delete(this.#tail.key);
this.#tail = this.#tail.prev;
} else {
this.#length += 1;
}
}
this.#data.set(key, value);
}
#toHead (key: string): void {
const ref = this.#refs.get(key);
if (ref && ref !== this.#head) {
ref.prev.next = ref.next;
ref.next.prev = ref.prev;
ref.next = this.#head;
this.#head.prev = ref;
this.#head = ref;
}
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit // Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/rpc-provider', version: '6.7.1' }; export const packageInfo = { name: '@polkadot/rpc-provider', version: '6.11.1' };
+1 -1
View File
@@ -49,7 +49,7 @@ export interface ProviderInterface {
connect (): Promise<void>; connect (): Promise<void>;
disconnect (): Promise<void>; disconnect (): Promise<void>;
on (type: ProviderInterfaceEmitted, sub: ProviderInterfaceEmitCb): () => void; on (type: ProviderInterfaceEmitted, sub: ProviderInterfaceEmitCb): () => void;
send <T = any> (method: string, params: unknown[]): Promise<T>; send <T = any> (method: string, params: unknown[], isCacheable?: boolean): Promise<T>;
subscribe (type: string, method: string, params: unknown[], cb: ProviderInterfaceCallback): Promise<number | string>; subscribe (type: string, method: string, params: unknown[], cb: ProviderInterfaceCallback): Promise<number | string>;
unsubscribe (type: string, method: string, id: number | string): Promise<boolean>; unsubscribe (type: string, method: string, id: number | string): Promise<boolean>;
} }
+25 -7
View File
@@ -7,12 +7,13 @@ import type { JsonRpcResponse, ProviderInterface, ProviderInterfaceCallback, Pro
import EventEmitter from 'eventemitter3'; import EventEmitter from 'eventemitter3';
import { assert, isChildClass, isNull, isUndefined, logger } from '@polkadot/util'; import { assert, isChildClass, isNull, isUndefined, logger, objectSpread } from '@polkadot/util';
import { xglobal } from '@polkadot/x-global'; import { xglobal } from '@polkadot/x-global';
import { WebSocket } from '@polkadot/x-ws'; import { WebSocket } from '@polkadot/x-ws';
import { RpcCoder } from '../coder'; import { RpcCoder } from '../coder';
import defaults from '../defaults'; import defaults from '../defaults';
import { LRUCache } from '../lru';
import { getWSErrorString } from './errors'; import { getWSErrorString } from './errors';
interface SubscriptionHandler { interface SubscriptionHandler {
@@ -75,6 +76,8 @@ function eraseRecord<T> (record: Record<string, T>, cb?: (item: T) => void): voi
* @see [[HttpProvider]] * @see [[HttpProvider]]
*/ */
export class WsProvider implements ProviderInterface { export class WsProvider implements ProviderInterface {
readonly #callCache = new LRUCache();
readonly #coder: RpcCoder; readonly #coder: RpcCoder;
readonly #endpoints: string[]; readonly #endpoints: string[];
@@ -260,12 +263,28 @@ export class WsProvider implements ProviderInterface {
* @param params Encoded parameters as applicable for the method * @param params Encoded parameters as applicable for the method
* @param subscription Subscription details (internally used) * @param subscription Subscription details (internally used)
*/ */
public send <T = any> (method: string, params: unknown[], subscription?: SubscriptionHandler): Promise<T> { public send <T = any> (method: string, params: unknown[], isCacheable?: boolean, subscription?: SubscriptionHandler): Promise<T> {
const body = this.#coder.encodeJson(method, params);
let resultPromise: Promise<T> | null = isCacheable
? this.#callCache.get(body) as Promise<T>
: null;
if (!resultPromise) {
resultPromise = this.#send(body, method, params, subscription);
if (isCacheable) {
this.#callCache.set(body, resultPromise);
}
}
return resultPromise;
}
async #send <T> (json: string, method: string, params: unknown[], subscription?: SubscriptionHandler): Promise<T> {
return new Promise<T>((resolve, reject): void => { return new Promise<T>((resolve, reject): void => {
try { try {
assert(this.isConnected && !isNull(this.#websocket), 'WebSocket is not connected'); assert(this.isConnected && !isNull(this.#websocket), 'WebSocket is not connected');
const json = this.#coder.encodeJson(method, params);
const id = this.#coder.getId(); const id = this.#coder.getId();
const callback = (error?: Error | null, result?: T): void => { const callback = (error?: Error | null, result?: T): void => {
@@ -309,7 +328,7 @@ export class WsProvider implements ProviderInterface {
* ``` * ```
*/ */
public subscribe (type: string, method: string, params: unknown[], callback: ProviderInterfaceCallback): Promise<number | string> { public subscribe (type: string, method: string, params: unknown[], callback: ProviderInterfaceCallback): Promise<number | string> {
return this.send<number | string>(method, params, { callback, type }); return this.send<number | string>(method, params, false, { callback, type });
} }
/** /**
@@ -410,11 +429,10 @@ export class WsProvider implements ProviderInterface {
if (subscription) { if (subscription) {
const subId = `${subscription.type}::${result}`; const subId = `${subscription.type}::${result}`;
this.#subscriptions[subId] = { this.#subscriptions[subId] = objectSpread({}, subscription, {
...subscription,
method, method,
params params
}; });
// if we have a result waiting for this subscription already // if we have a result waiting for this subscription already
if (this.#waitingForId[subId]) { if (this.#waitingForId[subId]) {
+8 -8
View File
@@ -20,7 +20,7 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "6.7.1", "version": "6.11.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",
@@ -32,18 +32,18 @@
"dependencies": { "dependencies": {
"@babel/core": "^7.16.0", "@babel/core": "^7.16.0",
"@babel/register": "^7.16.0", "@babel/register": "^7.16.0",
"@babel/runtime": "^7.16.0", "@babel/runtime": "^7.16.3",
"@polkadot/api": "6.7.1", "@polkadot/api": "6.11.1",
"@polkadot/rpc-provider": "6.7.1", "@polkadot/rpc-provider": "6.11.1",
"@polkadot/types": "6.7.1", "@polkadot/types": "6.11.1",
"@polkadot/types-support": "6.7.1", "@polkadot/types-support": "6.11.1",
"@polkadot/util": "^7.8.2", "@polkadot/util": "^8.1.2",
"handlebars": "^4.7.7", "handlebars": "^4.7.7",
"websocket": "^1.0.34", "websocket": "^1.0.34",
"yargs": "^17.2.1" "yargs": "^17.2.1"
}, },
"devDependencies": { "devDependencies": {
"@types/websocket": "^1.0.4", "@types/websocket": "^1.0.4",
"@types/yargs": "^17.0.5" "@types/yargs": "^17.0.7"
} }
} }
+17 -4
View File
@@ -4,6 +4,7 @@
import path from 'path'; import path from 'path';
import yargs from 'yargs'; import yargs from 'yargs';
import { Definitions } from '@polkadot/types/types';
import { formatNumber } from '@polkadot/util'; import { formatNumber } from '@polkadot/util';
import { WebSocket } from '@polkadot/x-ws'; import { WebSocket } from '@polkadot/x-ws';
@@ -18,12 +19,24 @@ function generate (metaHex: string, pkg: string | undefined, output: string, isS
? { [pkg]: require(path.join(process.cwd(), output, 'definitions')) as Record<string, any> } ? { [pkg]: require(path.join(process.cwd(), output, 'definitions')) as Record<string, any> }
: {}; : {};
generateDefaultConsts(path.join(process.cwd(), output, 'augment-api-consts.ts'), metaHex, extraTypes, isStrict); let customLookupDefinitions;
try {
customLookupDefinitions = {
rpc: {},
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-var-requires
types: require(path.join(process.cwd(), output, 'lookup.ts')).default
} as Definitions;
} catch (error) {
console.log('No custom definitions found.');
}
generateDefaultConsts(path.join(process.cwd(), output, 'augment-api-consts.ts'), metaHex, extraTypes, isStrict, customLookupDefinitions);
generateDefaultErrors(path.join(process.cwd(), output, 'augment-api-errors.ts'), metaHex, extraTypes, isStrict); generateDefaultErrors(path.join(process.cwd(), output, 'augment-api-errors.ts'), metaHex, extraTypes, isStrict);
generateDefaultEvents(path.join(process.cwd(), output, 'augment-api-events.ts'), metaHex, extraTypes, isStrict); generateDefaultEvents(path.join(process.cwd(), output, 'augment-api-events.ts'), metaHex, extraTypes, isStrict, customLookupDefinitions);
generateDefaultQuery(path.join(process.cwd(), output, 'augment-api-query.ts'), metaHex, extraTypes, isStrict); generateDefaultQuery(path.join(process.cwd(), output, 'augment-api-query.ts'), metaHex, extraTypes, isStrict, customLookupDefinitions);
generateDefaultRpc(path.join(process.cwd(), output, 'augment-api-rpc.ts'), extraTypes); generateDefaultRpc(path.join(process.cwd(), output, 'augment-api-rpc.ts'), extraTypes);
generateDefaultTx(path.join(process.cwd(), output, 'augment-api-tx.ts'), metaHex, extraTypes, isStrict); generateDefaultTx(path.join(process.cwd(), output, 'augment-api-tx.ts'), metaHex, extraTypes, isStrict, customLookupDefinitions);
writeFile(path.join(process.cwd(), output, 'augment-api.ts'), (): string => writeFile(path.join(process.cwd(), output, 'augment-api.ts'), (): string =>
[ [
+14 -2
View File
@@ -8,11 +8,16 @@ import * as substrateDefs from '@polkadot/types/interfaces/definitions';
import { generateInterfaceTypes } from './generate/interfaceRegistry'; import { generateInterfaceTypes } from './generate/interfaceRegistry';
import { generateTsDef } from './generate/tsDef'; import { generateTsDef } from './generate/tsDef';
import { generateDefaultLookup } from './generate';
type ArgV = { input: string; package: string }; type ArgV = { input: string; package: string; endpoint?: string; };
export function main (): void { export function main (): void {
const { input, package: pkg } = yargs.strict().options({ const { endpoint, input, package: pkg } = yargs.strict().options({
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',
type: 'string'
},
input: { input: {
description: 'The directory to use for the user definitions', description: 'The directory to use for the user definitions',
required: true, required: true,
@@ -25,6 +30,13 @@ export function main (): void {
} }
}).argv as ArgV; }).argv as ArgV;
if (endpoint) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const metaHex = (require(path.join(process.cwd(), endpoint)) as Record<string, string>).result;
generateDefaultLookup(path.join(process.cwd(), input), metaHex);
}
// eslint-disable-next-line @typescript-eslint/no-var-requires // eslint-disable-next-line @typescript-eslint/no-var-requires
const userDefs = require(path.join(process.cwd(), input, 'definitions.ts')) as Record<string, any>; const userDefs = require(path.join(process.cwd(), input, 'definitions.ts')) as Record<string, any>;
const userKeys = Object.keys(userDefs); const userKeys = Object.keys(userDefs);
+11 -5
View File
@@ -8,6 +8,7 @@ import Handlebars from 'handlebars';
import lookupDefinitions from '@polkadot/types/augment/lookup/definitions'; import lookupDefinitions from '@polkadot/types/augment/lookup/definitions';
import * as defaultDefs from '@polkadot/types/interfaces/definitions'; import * as defaultDefs from '@polkadot/types/interfaces/definitions';
import { Definitions } from '@polkadot/types/types';
import { stringCamelCase } from '@polkadot/util'; import { stringCamelCase } from '@polkadot/util';
import { compareName, createImports, formatType, initMeta, readTemplate, setImports, writeFile } from '../util'; import { compareName, createImports, formatType, initMeta, readTemplate, setImports, writeFile } from '../util';
@@ -16,10 +17,15 @@ const template = readTemplate('consts');
const generateForMetaTemplate = Handlebars.compile(template); const generateForMetaTemplate = Handlebars.compile(template);
/** @internal */ /** @internal */
function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes, isStrict: boolean): void { function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes, isStrict: boolean, customLookupDefinitions?: Definitions): void {
writeFile(dest, (): string => { writeFile(dest, (): string => {
const allTypes = { const allTypes = {
'@polkadot/types/augment': { lookup: lookupDefinitions }, '@polkadot/types/augment': {
lookup: {
...lookupDefinitions,
...customLookupDefinitions
}
},
'@polkadot/types/interfaces': defaultDefs, '@polkadot/types/interfaces': defaultDefs,
...extraTypes ...extraTypes
}; };
@@ -70,7 +76,7 @@ function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes,
})), })),
{ {
file: '@polkadot/api/types', file: '@polkadot/api/types',
types: ['ApiTypes'] types: ['ApiTypes', 'AugmentedConst', 'QueryableModuleConsts']
} }
] ]
}); });
@@ -79,8 +85,8 @@ function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes,
// Call `generateForMeta()` with current static metadata // Call `generateForMeta()` with current static metadata
/** @internal */ /** @internal */
export function generateDefaultConsts (dest = 'packages/api/src/augment/consts.ts', data?: string, extraTypes: ExtraTypes = {}, isStrict = false): void { export function generateDefaultConsts (dest = 'packages/api/src/augment/consts.ts', data?: string, extraTypes: ExtraTypes = {}, isStrict = false, customLookupDefinitions?: Definitions): void {
const { metadata } = initMeta(data, extraTypes); const { metadata } = initMeta(data, extraTypes);
return generateForMeta(metadata, dest, extraTypes, isStrict); return generateForMeta(metadata, dest, extraTypes, isStrict, customLookupDefinitions);
} }
+1 -1
View File
@@ -39,7 +39,7 @@ function generateForMeta (meta: Metadata, dest: string, isStrict: boolean): void
types: [ types: [
{ {
file: '@polkadot/api/types', file: '@polkadot/api/types',
types: ['ApiTypes'] types: ['ApiTypes', 'AugmentedError', 'ModuleErrors']
} }
] ]
}); });
+11 -5
View File
@@ -8,6 +8,7 @@ import Handlebars from 'handlebars';
import lookupDefinitions from '@polkadot/types/augment/lookup/definitions'; import lookupDefinitions from '@polkadot/types/augment/lookup/definitions';
import * as defaultDefs from '@polkadot/types/interfaces/definitions'; import * as defaultDefs from '@polkadot/types/interfaces/definitions';
import { Definitions } from '@polkadot/types/types';
import { stringCamelCase } from '@polkadot/util'; import { stringCamelCase } from '@polkadot/util';
import { compareName, createImports, formatType, initMeta, readTemplate, setImports, writeFile } from '../util'; import { compareName, createImports, formatType, initMeta, readTemplate, setImports, writeFile } from '../util';
@@ -16,10 +17,15 @@ const template = readTemplate('events');
const generateForMetaTemplate = Handlebars.compile(template); const generateForMetaTemplate = Handlebars.compile(template);
/** @internal */ /** @internal */
function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes, isStrict: boolean): void { function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes, isStrict: boolean, customLookupDefinitions?: Definitions): void {
writeFile(dest, (): string => { writeFile(dest, (): string => {
const allTypes = { const allTypes = {
'@polkadot/types/augment': { lookup: lookupDefinitions }, '@polkadot/types/augment': {
lookup: {
...lookupDefinitions,
...customLookupDefinitions
}
},
'@polkadot/types/interfaces': defaultDefs, '@polkadot/types/interfaces': defaultDefs,
...extraTypes ...extraTypes
}; };
@@ -62,7 +68,7 @@ function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes,
})), })),
{ {
file: '@polkadot/api/types', file: '@polkadot/api/types',
types: ['ApiTypes'] types: ['ApiTypes', 'AugmentedEvent', 'ModuleEvents']
} }
] ]
}); });
@@ -71,8 +77,8 @@ function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes,
// Call `generateForMeta()` with current static metadata // Call `generateForMeta()` with current static metadata
/** @internal */ /** @internal */
export function generateDefaultEvents (dest = 'packages/api/src/augment/events.ts', data?: string, extraTypes: ExtraTypes = {}, isStrict = false): void { export function generateDefaultEvents (dest = 'packages/api/src/augment/events.ts', data?: string, extraTypes: ExtraTypes = {}, isStrict = false, customLookupDefinitions?: Definitions): void {
const { metadata } = initMeta(data, extraTypes); const { metadata } = initMeta(data, extraTypes);
return generateForMeta(metadata, dest, extraTypes, isStrict); return generateForMeta(metadata, dest, extraTypes, isStrict, customLookupDefinitions);
} }
+2 -29
View File
@@ -18,7 +18,6 @@ import { isString, stringify } from '@polkadot/util';
import { createImports, exportType, initMeta, readTemplate, writeFile } from '../util'; import { createImports, exportType, initMeta, readTemplate, writeFile } from '../util';
import { typeEncoders } from './tsDef'; import { typeEncoders } from './tsDef';
const MAP_ENUMS = ['Call', 'Event', 'Error', 'RawEvent'];
const WITH_TYPEDEF = false; const WITH_TYPEDEF = false;
const generateLookupDefsTmpl = Handlebars.compile(readTemplate('lookup/defs')); const generateLookupDefsTmpl = Handlebars.compile(readTemplate('lookup/defs'));
@@ -131,33 +130,7 @@ function expandDefToString ({ lookupNameRoot, type }: TypeDef, indent: number):
} }
function getFilteredTypes (lookup: PortableRegistry, exclude: string[] = []): [PortableType, TypeDef][] { function getFilteredTypes (lookup: PortableRegistry, exclude: string[] = []): [PortableType, TypeDef][] {
const named = lookup.types.filter(({ id, type: { path } }) => { const named = lookup.types.filter(({ id }) => !!lookup.getTypeDef(id).lookupName);
const typeDef = lookup.getTypeDef(id);
return (
// We actually only want those with lookupName set
!!typeDef.lookupName &&
!(
path.length === 2 &&
(
(
// Ensure that we match {node, kusama, *}_runtime
path[0].toString().split('_')[1] === 'runtime' &&
!['Call', 'Event'].includes(path[1].toString())
) ||
path[0].toString().startsWith('pallet_')
) &&
// Ensure we strip generics, e.g. Event<T>
MAP_ENUMS.includes(path[1].toString().split('<')[0])
) &&
!(
path.length >= 3 &&
path[path.length - 2].toString() === 'pallet' &&
// As above, cater for generics
MAP_ENUMS.includes(path[path.length - 1].toString().split('<')[0])
)
);
});
const names = named.map(({ id }) => lookup.getName(id)); const names = named.map(({ id }) => lookup.getName(id));
return named return named
@@ -261,7 +234,7 @@ export function generateDefaultLookup (destDir = 'packages/types/src/augment/loo
generateLookup( generateLookup(
destDir, destDir,
staticData staticData
? [[undefined, staticData]] ? [['lookup', staticData]]
: [ : [
['substrate', staticSubstrate], ['substrate', staticSubstrate],
['polkadot', staticPolkadot], ['polkadot', staticPolkadot],
+11 -6
View File
@@ -3,7 +3,7 @@
import type { StorageEntryMetadataLatest } from '@polkadot/types/interfaces'; import type { StorageEntryMetadataLatest } from '@polkadot/types/interfaces';
import type { Metadata, PortableRegistry } from '@polkadot/types/metadata'; import type { Metadata, PortableRegistry } from '@polkadot/types/metadata';
import type { Registry } from '@polkadot/types/types'; import type { Definitions, Registry } from '@polkadot/types/types';
import type { ExtraTypes } from './types'; import type { ExtraTypes } from './types';
import Handlebars from 'handlebars'; import Handlebars from 'handlebars';
@@ -66,10 +66,15 @@ const template = readTemplate('query');
const generateForMetaTemplate = Handlebars.compile(template); const generateForMetaTemplate = Handlebars.compile(template);
/** @internal */ /** @internal */
function generateForMeta (registry: Registry, meta: Metadata, dest: string, extraTypes: ExtraTypes, isStrict: boolean): void { function generateForMeta (registry: Registry, 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': { lookup: lookupDefinitions }, '@polkadot/types/augment': {
lookup: {
...lookupDefinitions,
...customLookupDefinitions
}
},
'@polkadot/types/interfaces': defaultDefs, '@polkadot/types/interfaces': defaultDefs,
...extraTypes ...extraTypes
}; };
@@ -120,7 +125,7 @@ function generateForMeta (registry: Registry, meta: Metadata, dest: string, extr
})), })),
{ {
file: '@polkadot/api/types', file: '@polkadot/api/types',
types: ['ApiTypes'] types: ['ApiTypes', 'AugmentedQuery', 'QueryableStorageEntry', 'QueryableModuleStorage']
} }
] ]
}); });
@@ -129,8 +134,8 @@ function generateForMeta (registry: Registry, meta: Metadata, dest: string, extr
// Call `generateForMeta()` with current static metadata // Call `generateForMeta()` with current static metadata
/** @internal */ /** @internal */
export function generateDefaultQuery (dest = 'packages/api/src/augment/query.ts', data?: string, extraTypes: ExtraTypes = {}, isStrict = false): void { export function generateDefaultQuery (dest = 'packages/api/src/augment/query.ts', data?: string, extraTypes: ExtraTypes = {}, isStrict = false, customLookupDefinitions?: Definitions): void {
const { metadata, registry } = initMeta(data, extraTypes); const { metadata, registry } = initMeta(data, extraTypes);
return generateForMeta(registry, metadata, dest, extraTypes, isStrict); return generateForMeta(registry, metadata, dest, extraTypes, isStrict, customLookupDefinitions);
} }
+5 -1
View File
@@ -134,7 +134,11 @@ export function generateRpcTypes (registry: TypeRegistry, importDefinitions: Rec
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({ ...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
file: packagePath.replace('@polkadot/types/augment', '@polkadot/types'), file: packagePath.replace('@polkadot/types/augment', '@polkadot/types'),
types: Object.keys(imports.localTypes[packagePath]) types: Object.keys(imports.localTypes[packagePath])
})) })),
{
file: '@polkadot/api/types',
types: ['AugmentedRpc']
}
] ]
}); });
}); });
+2 -2
View File
@@ -11,7 +11,7 @@ import path from 'path';
import { getTypeDef, TypeRegistry } from '@polkadot/types/create'; import { getTypeDef, TypeRegistry } from '@polkadot/types/create';
import { TypeDefInfo } from '@polkadot/types/create/types'; import { TypeDefInfo } from '@polkadot/types/create/types';
import * as defaultDefinitions from '@polkadot/types/interfaces/definitions'; import * as defaultDefinitions from '@polkadot/types/interfaces/definitions';
import { assert, isString, stringCamelCase, stringify, stringUpperFirst } from '@polkadot/util'; import { assert, isString, stringify, stringPascalCase } from '@polkadot/util';
import { createImports, exportInterface, exportType, formatType, readTemplate, setImports, TypeImports, writeFile } from '../util'; import { createImports, exportInterface, exportType, formatType, readTemplate, setImports, TypeImports, writeFile } from '../util';
@@ -56,7 +56,7 @@ function tsEnum (registry: Registry, definitions: Record<string, ModuleTypes>, {
.filter(({ name }) => !!name && !name.startsWith('__Unused')) .filter(({ name }) => !!name && !name.startsWith('__Unused'))
.map((def, index): string => { .map((def, index): string => {
const { info, lookupName, name = `unknown${index}`, type } = def; const { info, lookupName, name = `unknown${index}`, type } = def;
const getter = stringUpperFirst(stringCamelCase(name.replace(' ', '_'))); const getter = stringPascalCase(name.replace(' ', '_'));
const isComplex = [TypeDefInfo.Option, TypeDefInfo.Result, TypeDefInfo.Struct, TypeDefInfo.Tuple, TypeDefInfo.Vec, TypeDefInfo.VecFixed].includes(info); const isComplex = [TypeDefInfo.Option, TypeDefInfo.Result, TypeDefInfo.Struct, TypeDefInfo.Tuple, TypeDefInfo.Vec, TypeDefInfo.VecFixed].includes(info);
const asGetter = type === 'Null' || info === TypeDefInfo.DoNotConstruct const asGetter = type === 'Null' || info === TypeDefInfo.DoNotConstruct
? '' ? ''
+11 -6
View File
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { Metadata } from '@polkadot/types/metadata/Metadata'; import type { Metadata } from '@polkadot/types/metadata/Metadata';
import type { Registry } from '@polkadot/types/types'; import type { Definitions, Registry } from '@polkadot/types/types';
import type { ExtraTypes } from './types'; import type { ExtraTypes } from './types';
import Handlebars from 'handlebars'; import Handlebars from 'handlebars';
@@ -29,10 +29,15 @@ const template = readTemplate('tx');
const generateForMetaTemplate = Handlebars.compile(template); const generateForMetaTemplate = Handlebars.compile(template);
/** @internal */ /** @internal */
function generateForMeta (registry: Registry, meta: Metadata, dest: string, extraTypes: ExtraTypes, isStrict: boolean): void { function generateForMeta (registry: Registry, 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': { lookup: lookupDefinitions }, '@polkadot/types/augment': {
lookup: {
...lookupDefinitions,
...customLookupDefinitions
}
},
'@polkadot/types/interfaces': defaultDefs, '@polkadot/types/interfaces': defaultDefs,
...extraTypes ...extraTypes
}; };
@@ -105,7 +110,7 @@ function generateForMeta (registry: Registry, meta: Metadata, dest: string, extr
})), })),
{ {
file: '@polkadot/api/types', file: '@polkadot/api/types',
types: ['ApiTypes', 'SubmittableExtrinsic'] types: ['ApiTypes', 'AugmentedSubmittable', 'SubmittableExtrinsic', 'SubmittableExtrinsicFunction', 'SubmittableModuleExtrinsics']
} }
] ]
}); });
@@ -114,8 +119,8 @@ function generateForMeta (registry: Registry, meta: Metadata, dest: string, extr
// Call `generateForMeta()` with current static metadata // Call `generateForMeta()` with current static metadata
/** @internal */ /** @internal */
export function generateDefaultTx (dest = 'packages/api/src/augment/tx.ts', data?: string, extraTypes: ExtraTypes = {}, isStrict = false): void { export function generateDefaultTx (dest = 'packages/api/src/augment/tx.ts', data?: string, extraTypes: ExtraTypes = {}, isStrict = false, customLookupDefinitions?: Definitions): void {
const { metadata, registry } = initMeta(data, extraTypes); const { metadata, registry } = initMeta(data, extraTypes);
return generateForMeta(registry, metadata, dest, extraTypes, isStrict); return generateForMeta(registry, metadata, dest, extraTypes, isStrict, customLookupDefinitions);
} }
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit // Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/typegen', version: '6.7.1' }; export const packageInfo = { name: '@polkadot/typegen', version: '6.11.1' };
+7 -7
View File
@@ -1,9 +1,9 @@
{{> header }} {{> header }}
{{{ imports }}}
declare module '@polkadot/api/types/consts' { declare module '@polkadot/api/types/consts' {
export interface AugmentedConsts<ApiType> { {{{ imports }}}
export interface AugmentedConsts<ApiType extends ApiTypes> {
{{#each modules}} {{#each modules}}
{{{name}}}: { {{{name}}}: {
{{#each items}} {{#each items}}
@@ -18,12 +18,12 @@ declare module '@polkadot/api/types/consts' {
{{/unless}} {{/unless}}
}; };
{{/each}} {{/each}}
} } // AugmentedConsts
export interface QueryableConsts<ApiType extends ApiTypes> extends AugmentedConsts<ApiType> { export interface QueryableConsts<ApiType extends ApiTypes> extends AugmentedConsts<ApiType> {
{{#unless isStrict}} {{#unless isStrict}}
[key: string]: QueryableModuleConsts; [key: string]: QueryableModuleConsts;
{{/unless}} {{/unless}}
} } // QueryableConsts
}
{{> footer }} } // declare module
+7 -7
View File
@@ -1,9 +1,9 @@
{{> header }} {{> header }}
{{{ imports }}}
declare module '@polkadot/api/types/errors' { declare module '@polkadot/api/types/errors' {
export interface AugmentedErrors<ApiType> { {{{ imports }}}
export interface AugmentedErrors<ApiType extends ApiTypes> {
{{#each modules}} {{#each modules}}
{{{name}}}: { {{{name}}}: {
{{#each items}} {{#each items}}
@@ -18,12 +18,12 @@ declare module '@polkadot/api/types/errors' {
{{/unless}} {{/unless}}
}; };
{{/each}} {{/each}}
} } // AugmentedErrors
export interface DecoratedErrors<ApiType extends ApiTypes> extends AugmentedErrors<ApiType> { export interface DecoratedErrors<ApiType extends ApiTypes> extends AugmentedErrors<ApiType> {
{{#unless isStrict}} {{#unless isStrict}}
[key: string]: ModuleErrors<ApiType>; [key: string]: ModuleErrors<ApiType>;
{{/unless}} {{/unless}}
} } // DecoratedErrors
}
{{> footer }} } // declare module
+7 -7
View File
@@ -1,9 +1,9 @@
{{> header }} {{> header }}
{{{ imports }}}
declare module '@polkadot/api/types/events' { declare module '@polkadot/api/types/events' {
export interface AugmentedEvents<ApiType> { {{{ imports }}}
export interface AugmentedEvents<ApiType extends ApiTypes> {
{{#each modules}} {{#each modules}}
{{{name}}}: { {{{name}}}: {
{{#each items}} {{#each items}}
@@ -18,12 +18,12 @@ declare module '@polkadot/api/types/events' {
{{/unless}} {{/unless}}
}; };
{{/each}} {{/each}}
} } // AugmentedEvents
export interface DecoratedEvents<ApiType extends ApiTypes> extends AugmentedEvents<ApiType> { export interface DecoratedEvents<ApiType extends ApiTypes> extends AugmentedEvents<ApiType> {
{{#unless isStrict}} {{#unless isStrict}}
[key: string]: ModuleEvents<ApiType>; [key: string]: ModuleEvents<ApiType>;
{{/unless}} {{/unless}}
} } // DecoratedEvents
}
{{> footer }} } // declare module
@@ -1,12 +1,11 @@
{{> header }} {{> header }}
{{{ imports }}}
declare module '@polkadot/types/types/registry' { declare module '@polkadot/types/types/registry' {
{{{ imports }}}
export interface InterfaceTypes { export interface InterfaceTypes {
{{#each items}} {{#each items}}
{{{this}}}: {{{this}}}; {{{this}}}: {{{this}}};
{{/each}} {{/each}}
} } // InterfaceTypes
} } // declare module
{{> footer }}
@@ -2,8 +2,6 @@
/* eslint-disable sort-keys */ /* eslint-disable sort-keys */
import type { DefinitionsTypes } from '../../types';
export default { export default {
{{#each defs}} {{#each defs}}
{{> docs}} {{> docs}}
@@ -11,5 +9,4 @@ export default {
{{{this}}} {{{this}}}
{{/each}} {{/each}}
{{/each}} {{/each}}
} as DefinitionsTypes; };
{{> footer }}
@@ -2,8 +2,6 @@
/* eslint-disable sort-keys */ /* eslint-disable sort-keys */
import type { Definitions } from '../../types';
export default { export default {
rpc: {}, rpc: {},
types: { types: {
@@ -14,5 +12,4 @@ export default {
{{/each}} {{/each}}
{{/each}} {{/each}}
} }
} as Definitions; };
{{> footer }}
@@ -1,4 +1,3 @@
{{> header }} {{> header }}
export * from './types'; export * from './types';
{{> footer }}
@@ -1,12 +1,10 @@
{{> header }} {{> header }}
{{{ imports }}}
declare module '@polkadot/types/lookup' { declare module '@polkadot/types/lookup' {
{{{ imports }}}
{{#each items}} {{#each items}}
{{{this}}} {{{this}}}
{{/each}} {{/each}}
} } // declare module
{{> footer }}
+7 -7
View File
@@ -1,9 +1,9 @@
{{> header }} {{> header }}
{{{ imports }}}
declare module '@polkadot/api/types/storage' { declare module '@polkadot/api/types/storage' {
export interface AugmentedQueries<ApiType> { {{{ imports }}}
export interface AugmentedQueries<ApiType extends ApiTypes> {
{{#each modules}} {{#each modules}}
{{{name}}}: { {{{name}}}: {
{{#each items}} {{#each items}}
@@ -18,12 +18,12 @@ declare module '@polkadot/api/types/storage' {
{{/unless}} {{/unless}}
}; };
{{/each}} {{/each}}
} } // AugmentedQueries
export interface QueryableStorage<ApiType extends ApiTypes> extends AugmentedQueries<ApiType> { export interface QueryableStorage<ApiType extends ApiTypes> extends AugmentedQueries<ApiType> {
{{#unless isStrict}} {{#unless isStrict}}
[key: string]: QueryableModuleStorage<ApiType>; [key: string]: QueryableModuleStorage<ApiType>;
{{/unless}} {{/unless}}
} } // QueryableStorage
}
{{> footer }} } // declare module
+5 -5
View File
@@ -1,8 +1,8 @@
{{> header }} {{> header }}
{{{ imports }}}
declare module '@polkadot/rpc-core/types.jsonrpc' { declare module '@polkadot/rpc-core/types.jsonrpc' {
{{{ imports }}}
export interface RpcInterface { export interface RpcInterface {
{{#each modules}} {{#each modules}}
{{{name}}}: { {{{name}}}: {
@@ -12,6 +12,6 @@ declare module '@polkadot/rpc-core/types.jsonrpc' {
{{/each}} {{/each}}
}; };
{{/each}} {{/each}}
} } // RpcInterface
}
{{> footer }} } // declare module
@@ -1,4 +1,3 @@
{{> header }} {{> header }}
export * from './types'; export * from './types';
{{> footer }}
@@ -8,4 +8,3 @@
{{/each}} {{/each}}
export type PHANTOM_{{#upper}}{{{name}}}{{/upper}} = '{{{name}}}'; export type PHANTOM_{{#upper}}{{{name}}}{{/upper}} = '{{{name}}}';
{{> footer }}
@@ -3,4 +3,3 @@
{{#each items}} {{#each items}}
export * from './{{{this}}}/types'; export * from './{{{this}}}/types';
{{/each}} {{/each}}
{{> footer }}
+7 -7
View File
@@ -1,9 +1,9 @@
{{> header }} {{> header }}
{{{ imports }}}
declare module '@polkadot/api/types/submittable' { declare module '@polkadot/api/types/submittable' {
export interface AugmentedSubmittables<ApiType> { {{{ imports }}}
export interface AugmentedSubmittables<ApiType extends ApiTypes> {
{{#each modules}} {{#each modules}}
{{{name}}}: { {{{name}}}: {
{{#each items}} {{#each items}}
@@ -18,13 +18,13 @@ declare module '@polkadot/api/types/submittable' {
{{/unless}} {{/unless}}
}; };
{{/each}} {{/each}}
} } // AugmentedSubmittables
export interface SubmittableExtrinsics<ApiType extends ApiTypes> extends AugmentedSubmittables<ApiType> { export interface SubmittableExtrinsics<ApiType extends ApiTypes> extends AugmentedSubmittables<ApiType> {
(extrinsic: Call | Extrinsic | Uint8Array | string): SubmittableExtrinsic<ApiType>; (extrinsic: Call | Extrinsic | Uint8Array | string): SubmittableExtrinsic<ApiType>;
{{#unless isStrict}} {{#unless isStrict}}
[key: string]: SubmittableModuleExtrinsics<ApiType>; [key: string]: SubmittableModuleExtrinsics<ApiType>;
{{/unless}} {{/unless}}
} } // SubmittableExtrinsics
}
{{> footer }} } // declare module
+1 -2
View File
@@ -30,7 +30,6 @@ const NO_CODEC = ['Tuple', 'VecFixed'];
export const HEADER = (type: 'chain' | 'defs'): string => `// Auto-generated via \`yarn polkadot-types-from-${type}\`, do not edit\n/* eslint-disable */\n\n`; export const HEADER = (type: 'chain' | 'defs'): string => `// Auto-generated via \`yarn polkadot-types-from-${type}\`, do not edit\n/* eslint-disable */\n\n`;
Handlebars.registerPartial({ Handlebars.registerPartial({
footer: Handlebars.compile(readTemplate('footer')),
header: Handlebars.compile(readTemplate('header')) header: Handlebars.compile(readTemplate('header'))
}); });
@@ -57,7 +56,7 @@ Handlebars.registerHelper({
return [...defs].sort((a, b) => a.file.localeCompare(b.file)).reduce((result, { file, types }): string => { return [...defs].sort((a, b) => a.file.localeCompare(b.file)).reduce((result, { file, types }): string => {
return types.length return types.length
? `${result}import type { ${types.sort().join(', ')} } from '${file}';\n` ? `${result}${result.length ? ' ' : ''}import type { ${types.sort().join(', ')} } from '${file}';\n`
: result; : result;
}, ''); }, '');
}, },
+5 -5
View File
@@ -20,12 +20,12 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "6.7.1", "version": "6.11.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.16.0", "@babel/runtime": "^7.16.3",
"@polkadot/networks": "^7.8.2", "@polkadot/networks": "^8.1.2",
"@polkadot/types": "6.7.1", "@polkadot/types": "6.11.1",
"@polkadot/util": "^7.8.2" "@polkadot/util": "^8.1.2"
} }
} }
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit // Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/types-known', version: '6.7.1' }; export const packageInfo = { name: '@polkadot/types-known', version: '6.11.1' };
+1 -1
View File
@@ -185,7 +185,7 @@ const versioned: OverrideVersionedType[] = [
{ {
// metadata v14 // metadata v14
minmax: [9106, undefined], minmax: [9106, undefined],
types: objectSpread({}, sharedTypes) types: {}
} }
]; ];
+1 -1
View File
@@ -73,7 +73,7 @@ const versioned: OverrideVersionedType[] = [
{ {
// metadata v14 // metadata v14
minmax: [9110, undefined], minmax: [9110, undefined],
types: objectSpread({}, sharedTypes) types: {}
} }
]; ];
+1 -1
View File
@@ -49,7 +49,7 @@ const versioned: OverrideVersionedType[] = [
{ {
// metadata v14 // metadata v14
minmax: [9106, undefined], minmax: [9106, undefined],
types: objectSpread({}, sharedTypes) types: {}
} }
]; ];
+1 -1
View File
@@ -37,7 +37,7 @@ const versioned: OverrideVersionedType[] = [
{ {
// metadata V14 // metadata V14
minmax: [500, undefined], minmax: [500, undefined],
types: objectSpread({}, sharedTypes) types: {}
} }
]; ];
+1 -1
View File
@@ -91,7 +91,7 @@ const versioned: OverrideVersionedType[] = [
{ {
// metadata v14 // metadata v14
minmax: [9106, undefined], minmax: [9106, undefined],
types: objectSpread({}, sharedTypes) types: {}
} }
]; ];
@@ -9,7 +9,7 @@ const upgrades: ChainUpgradesRaw = [
[528470, 13], [687751, 14], [746085, 15], [787923, 16], [799302, 17], [528470, 13], [687751, 14], [746085, 15], [787923, 16], [799302, 17],
[1205128, 18], [1603423, 23], [1733218, 24], [2005673, 25], [2436698, 26], [1205128, 18], [1603423, 23], [1733218, 24], [2005673, 25], [2436698, 26],
[3613564, 27], [3899547, 28], [4345767, 29], [4876134, 30], [5661442, 9050], [3613564, 27], [3899547, 28], [4345767, 29], [4876134, 30], [5661442, 9050],
[6321619, 9080], [6713249, 9090], [7217907, 9100], [7229126, 9110] [6321619, 9080], [6713249, 9090], [7217907, 9100], [7229126, 9110], [7560558, 9122]
]; ];
export default upgrades; export default upgrades;
+3 -3
View File
@@ -20,10 +20,10 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "6.7.1", "version": "6.11.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.16.0", "@babel/runtime": "^7.16.3",
"@polkadot/util": "^7.8.2" "@polkadot/util": "^8.1.2"
} }
} }
File diff suppressed because one or more lines are too long

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