Compare commits

..
49 Commits
Author SHA1 Message Date
ian.he 9fbf4bf478 v0.78.102 2019-06-06 12:50:29 +12:00
ian.he 385150bd81 fix: lock typescript to 3.4.5 until merge upstream 2019-06-06 12:40:16 +12:00
ian.he 14216a42a3 0.78.101 2019-06-05 10:04:08 +12:00
Alex Wang 0055cb594f fix: clean code (#1) 2019-06-05 10:04:08 +12:00
Jaco Greeff 63e08d8357 Fix ContractAbi assert name (#951) 2019-06-04 17:01:39 +12:00
ian.he c9f9e2ec8a docs: include statement and link of upstream project 2019-05-27 15:55:12 +12:00
ian.he 019f1f761f rebase upstream and bump to 0.78.100 2019-05-27 15:46:59 +12:00
Jaco Greeff c91e72b60b 0.78.1 (#884)
* update CHANGELOG

* Bump common

* Bump to 0.78
2019-05-27 15:46:31 +12:00
Amaury Martiny e4cf97d71e Linked map in v0 (#886) 2019-05-27 15:46:31 +12:00
Jaco Greeff dcdbd2ca40 Fix bug in metadata conversion (return converted) (#880)
* Fix bug in metadata conversion (return converted)

* v2 -> v3
2019-05-27 15:46:31 +12:00
Jaco Greeff 13ae360c7a assert type on all asXxx getters (#879)
* assert type on all asXxx getters

* Convert via built-in asVx

* Implicit index

* Re-add V0 (not dropped here, but dropped somewhere)

* MetadataDeprectated -> MetadataDeprecated
2019-05-27 15:46:31 +12:00
Jaco Greeff 6c0d683235 Add contract fees (#875) 2019-05-27 15:46:31 +12:00
Amaury Martiny 6fc35d641a Fix linked maps (#878)
* Fix linked maps

* Line breaks
2019-05-27 15:46:31 +12:00
Jaco Greeff d79c0ea28d Update to latest metadata (with ContractInfo) (#874)
* Update to latest metadata (with ContractInfo)

* isAlive/isTomstone

* typo
2019-05-27 15:46:30 +12:00
Jaco Greeff 486412d051 Fix struct keys, log additional decoding error info (#872)
* Re-create test cases for failures

* Fix cloberring of keys

* Add logging to pinpoint decoding failures
2019-05-27 15:46:30 +12:00
Jaco Greeff f3f1807013 Bump dev (& fix indents) (#870)
* Bump dev (& fix indents)

* Bump common
2019-05-27 15:46:30 +12:00
Jaco Greeff d9e581fbdc Basic same-type multi queries (#866)
* Basic same-type multi queries

* Remove extra map, straight to switchMap
2019-05-27 15:46:30 +12:00
Xiliang Chen 89ebae9d78 Update WithdrawReasons to match substrate (#865)
* Update WithdrawReasons to match substrate

* Linting, comment alignment
2019-05-27 15:46:30 +12:00
Jaco Greeff 071d872adf USize -> U32 (#839)
- Possibly a fix for https://github.com/polkadot-js/api/issues/838
2019-05-27 15:46:30 +12:00
Jaco Greeff 1b6d6d970c rm -rf cc-test-reporter 2019-05-27 15:46:30 +12:00
Jaco Greeff 9f5be747e7 Bump deps (#861)
* Bump deps

* Align with published common

* Fix rxjs to 6.4.0 (false deprecations on 6.5.1)
2019-05-27 15:46:30 +12:00
Amaury Martiny 86cb0962bc Update Changelog (#859) 2019-05-27 15:46:29 +12:00
ian.he 75884d22a3 0.77.102 2019-05-27 15:46:29 +12:00
ian.he a4d09f799d fix: import for Api.spec.ts 2019-05-27 15:46:29 +12:00
Karishma Bothara 85a29de479 Api pre-bundled metadata (#850)
(cherry picked from commit 19eb484a29)

Approved-by: Ian He <ian-he@outlook.com>
2019-05-27 15:46:29 +12:00
Alex Wang ed2e44ac93 v0.77.101 2019-05-27 15:46:29 +12:00
Alex Wang c88d284a5c fix: storageNames in metadata v4 to support DoubleMap
Merged in polkadot_v77_1 (pull request #4)

Approved-by: Ian He <ian-he@outlook.com>
2019-05-27 15:46:29 +12:00
ian.he daaa16523d v0.77.100 2019-05-27 15:46:27 +12:00
Travis CI 116714a8f9 upstream upgrade(v0.77.1)
release v0.77.100
2019-05-27 15:46:19 +12:00
Amaury Martiny 5c1f7fb527 Use custom hasher for Map (#857)
* Use blake2 instead of two_x

* Add v4

* Update to new v4 static

* Update json

* Revert

* Use hasher enum

* Fix metadata v4 test

* Fix metadata v4 test

* Fix versioned metadata

* refactor & clean

* Use consistent naming

* Make jsons consistent

* Add backward compat

* Fix tests

* Start working on type-storage

* Fix output

* Grumble

* Update to latest static

* Clean code

* Fix imports

* Remove useless imports

* Fix tests

* Use prettier output for toJSON in metadata

* Implement different hashers

* Remove generic storageKey

* Bump version

* Add backwards-compat

* Fix hashing function, use Twox128

* Grumbles

* Add tests
2019-05-27 15:46:19 +12:00
Stefanie Doll 8a69bc4458 Fix the md table formatting (#855)
* Last attempt

* Poke Travis
2019-05-27 15:46:18 +12:00
Stefanie Doll a8dd059097 Type definitions formatting fix (#851)
* attempt to fix vuepress falsy markdown interpretation

* Linebreak fix

* Roll-back yarn.lock
2019-05-27 15:46:16 +12:00
Stefanie Doll 1204ac37f6 Add short description to all types on overview page (#849)
* Smaller typos/ wording

* Grammar An - A

* Add short description to each type on overview page WIP

* Removed 'Derived types' section because HeaderExtended was the only derived method left

* Commit current state

* Description completed

* Removed empty row placeholder

* Fixed Typo in LockPeriods

* Spell out Little Endian

* Fixed accidentaly removed space character
2019-05-27 15:46:09 +12:00
Jaco Greeff b2f03e500e Remove contract encoding debug (confirmed working) (#836)
* Remove contract encoding debug (confirmed working)

* Remove (now-unused) import
2019-05-27 15:46:09 +12:00
Jaco Greeff de90242456 Bumps (#834) 2019-05-27 15:46:06 +12:00
Jaco Greeff a7ffe44ae6 AbstractArray base & VectorAny (no types in constructor) (#833)
* AbstractArray base & VectorAny (no  types in constrctor)

* Remove noInheritDoc from Tuple, Vector* (already on abstract)
2019-05-27 15:45:51 +12:00
Jaco Greeff ac5bfeda39 Contract ABI (extended) 2019-05-27 15:45:50 +12:00
Jaco Greeff 73a184ec7d Expand Digest for asAura, use in HeaderExtended (#832) 2019-05-27 15:45:50 +12:00
Jaco Greeff e4371684b6 Properly map indexes (swapped in balances -> indices change) (#831)
* Properly map indexes (swapped in balances -> indices change)

* Typos
2019-05-27 15:45:50 +12:00
Jaco Greeff 382e903b8f TreasuryProposal (#825) 2019-05-27 15:45:50 +12:00
ian.he 6b6b7fe145 chore: rebranding to @plugnet 2019-04-26 16:43:32 +12:00
ian.he 1f4e7638d5 v0.76.102 2019-04-16 16:37:21 +12:00
Alex Wang 4d95d622a9 fix: fix double map
Merged in check (pull request #2)

Approved-by: Ian He <ian-he@outlook.com>
2019-04-16 04:36:17 +00:00
ian.he 327c20ddea v0.76.101 2019-04-16 14:55:50 +12:00
Alex Wang 04f6d352d9 feat: adding double map support
Merged in double-map (pull request #1)

Approved-by: Ian He <ian-he@outlook.com>
2019-04-16 02:53:30 +00:00
ian.he c14a071b74 docs: add examples from polkadot 2019-04-12 17:40:12 +12:00
ian.he f103863fdd docs: add examples from polkadot 2019-04-12 17:33:55 +12:00
ian.he 3c7c79f18f merge v0.76.1 2019-04-12 11:26:54 +12:00
ian.he 4e30fab9d6 init 2019-04-11 13:42:06 +12:00
1822 changed files with 60049 additions and 1440315 deletions
+1
View File
@@ -0,0 +1 @@
5
+1
View File
@@ -0,0 +1 @@
module.exports = require('./babel.config.js');
-86
View File
@@ -1,86 +0,0 @@
<!--
For general support, howto, coding and bundling questions, please
use the Substrate & Polkadot StackExchange at
https://substrate.stackexchange.com/
and get other ecosystem developers involved. This issues in this
repository are meant for the tracking of feature requests and bug
reports.
While all issues are looked at non-bug and non-features would take
quite a bit longer to get to and may yield less than satisfactory
responses in this format.
Additionally, please ensure you have done a search on the existing
and closed issues before logging a new request. This saves time on
all sides.
-->
* **I'm submitting a ...**
<!---
REQUIRED:
Classify the type of report your are submitting
-->
- [ ] Bug report
- [ ] Feature request
- [ ] Support request
- [ ] Other
* **What is the current behavior and expected behavior?**
<!---
REQUIRED:
If you're describing a bug, tell us what should happen. If you're
suggesting a change/improvement, tell us how it should work.
-->
* **What is the motivation for changing the behavior?**
<!---
OPTIONAL:
Suggest a motivation for the request or ideas how to implement the
addition or change
-->
* **Please tell us about your environment:**
<!---
REQUIRED:
Include as many relevant details about the environment in which you
experienced the issue. Also ensure that you have tested against the
latest stable releases if you believe this to be a bug
-->
- Version:
- Environment:
- [ ] Node.js
- [ ] Browser
- [ ] Other (limited support for other environments)
- Language:
- [ ] JavaScript
- [ ] TypeScript (include tsc --version)
- [ ] Other
-16
View File
@@ -1,16 +0,0 @@
name: bot
on:
pull_request:
types: [labeled]
jobs:
approve:
if: "! startsWith(github.event.head_commit.message, '[CI Skip]') && (!github.event.pull_request || github.event.pull_request.head.repo.full_name == github.repository)"
runs-on: ubuntu-latest
steps:
- uses: jacogr/action-approve@795afd1dd096a2071d7ec98740661af4e853b7da
with:
authors: jacogr, TarikGul
labels: -auto
token: ${{ secrets.GH_PAT_BOT }}
-16
View File
@@ -1,16 +0,0 @@
name: bot
on:
pull_request:
types: [labeled]
jobs:
merge:
runs-on: ubuntu-latest
steps:
- uses: jacogr/action-merge@d2d64b4545acd93b0a9575177d3d215ae3f92029
with:
checks: pr (build),pr (lint),pr (test)
labels: -auto
strategy: squash
token: ${{ secrets.GH_PAT_BOT }}
-25
View File
@@ -1,25 +0,0 @@
name: 'Lock Threads'
on:
schedule:
- cron: '10 1/3 * * *'
jobs:
lock:
runs-on: ubuntu-latest
env:
YARN_ENABLE_SCRIPTS: false
steps:
- uses: dessant/lock-threads@c1b35aecc5cdb1a34539d14196df55838bb2f836
with:
github-token: ${{ secrets.GH_PAT_BOT }}
issue-inactive-days: '7'
issue-comment: >
This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue
if you think you have a related problem or query.
pr-inactive-days: '2'
pr-comment: >
This pull request has been automatically locked since there
has not been any recent activity after it was closed.
Please open a new issue for related bugs.
-25
View File
@@ -1,25 +0,0 @@
name: PR
on: [pull_request]
jobs:
pr:
continue-on-error: true
strategy:
matrix:
step: ['lint', 'test', 'build', 'deno']
runs-on: ubuntu-latest
env:
YARN_ENABLE_SCRIPTS: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- uses: denoland/setup-deno@v1
with:
deno-version: v1.46.3
- name: ${{ matrix.step }}
if: always()
run: |
yarn install --immutable
yarn ${{ matrix.step }}
-31
View File
@@ -1,31 +0,0 @@
name: Master
on:
push:
branches:
- master
jobs:
master:
if: "! startsWith(github.event.head_commit.message, '[CI Skip]')"
strategy:
matrix:
step: ['build:release']
runs-on: ubuntu-latest
env:
YARN_ENABLE_SCRIPTS: false
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
GH_PAT: ${{ secrets.GH_PAT_BOT }}
GH_RELEASE_GITHUB_API_TOKEN: ${{ secrets.GH_PAT_BOT }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GH_PAT_BOT }}
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: ${{ matrix.step }}
run: |
yarn install --immutable
yarn ${{ matrix.step }}
+3 -13
View File
@@ -1,29 +1,19 @@
_book/
build/
build-*/
build-docs/
coverage/
docs/.vuepress/dist/
node_modules/
tmp/
/import_map.json
/mod.ts
NOTES.md
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
.npmrc
.rpt2_cache
.yarn/*
!.yarn/releases
!.yarn/plugins
.pnp.*
.vscode/
.idea/
cc-test-reporter
lerna-debug.log*
npm-debug.log*
package-lock.json
tsconfig*buildinfo
yarn-debug.log*
yarn-error.log*
package-lock.json
-3
View File
@@ -1,3 +0,0 @@
Jaco <jacogr@gmail.com>
github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> <action@github.com>
github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Github Actions <action@github.com>
+1 -1
View File
@@ -1 +1 @@
v18.15
10
-3
View File
@@ -1,3 +0,0 @@
build
coverage
packages
-4
View File
@@ -1,4 +0,0 @@
// Copyright 2017-2026 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0
module.exports = require('@polkadot/dev/config/prettier.cjs');
View File
-934
View File
File diff suppressed because one or more lines are too long
-15
View File
@@ -1,15 +0,0 @@
compressionLevel: mixed
enableGlobalCache: false
enableImmutableInstalls: false
enableProgressBars: false
logFilters:
- code: YN0013
level: discard
nodeLinker: node-modules
yarnPath: .yarn/releases/yarn-4.6.0.cjs
+34 -4563
View File
File diff suppressed because it is too large Load Diff
-156
View File
@@ -1,156 +0,0 @@
3512 Jaco Bump deps (#5785)
174 Tarik Gul fix(types-known): decode foreign-asset ChargeAssetTxPayment on Westend Asset Hub (#6268)
83 Amaury Martiny StatementKind: Regular and Saft (#2303)
58 Valentin Fernandez 16.4.9 (#6217)
37 Keith Ingram Update contract types and rpc (#4541)
35 Stefanie Doll Updated child storage parameters (#1709)
20 Luke Schoen fix: Fixes TypeError: Cannot read property 'vesting' of undefined (#1970)
19 Xiliang Chen no warm for unknown signed extensions (#5601)
18 rajk93 16.5.4 (#6234)
15 Jeremías Díaz feat(types): add correct tuple type to storage key (#3054)
14 Nikos Kontakis Bump substrate connect to 0.7.16 (#5307)
12 Arjun Porwal 16.5.5 (#6237)
11 Ian He HttpProvider support clone() (#3949)
10 Axel Chalon Make Enum/Tuple constructor use value directly if instance (#1954)
6 Andreea Eftene Update check for contract instantiation (#5699)
6 Branislav Kontur Fix for fungiblesApi (#5944)
5 Alberto Nicolas Penayo added use of accountNonceApi (#5915)
5 Chevdor Fix metadata package link (#3458)
5 Jake Naviasky Fixing approvalFlagsToBools. (#1250)
5 Julien Eluard General WsProvider extensibility improvements (#5467)
5 Matias Volpe Bump @substrate/connect to 0.8.10 (#5863)
5 Thibaut Sardan Allow external signers to modify the payload (#6030)
4 Alex D Use derive customAccount and customLocks for balance overrides (#3248)
4 Alex Wang fix issue that creates duplicate providers (#983)
4 Alexander Popiak Add asset id in signing (#4009)
4 Joshy Orndorff spelling; efect -> effect (#2295)
4 Nantian fix bigint type (#3869)
4 Scott Twiname Add support for historical BlockNumber rpc methods (#4574)
3 Alex Bean refactor: retrieve contract address from `Instantiated` event (#6210)
3 André Silva add support for ValidationCodeHash (#3640)
3 Antoine Estienne Adapted to display moonbeam author (#3108)
3 Arjan Zijderveld Added `Emergency` to `ElectionPhase` (#3707)
3 Ewa Kowalska Handle no council for bounties proposals (#3062)
3 hamidra add support for n key entries for NMaps (#3886)
3 Hamza Tokuchi more typos (#2532)
3 Jeeyong Um Revert "Alias for Noir types (#5678)" (#5946)
3 Josep M Sobrepere docs: improve rpc-provider README (#4719)
3 KarishmaBothara Backward compatibility thing (#3511)
3 Miguel Hervas Adding RT4 Types (#3007)
3 Shawn Tabrizi Add `isReadyOrError` when connecting to API (#2577)
3 YJ feat: Vote interface as U8a (#1061)
2 Alexander Krupenkin Add [u8; 33] type width for U8aFixed type (#2391)
2 Branan Riley Add proxy type for Centrifuge (#3940)
2 Caio Add `Range` and `RangeInclusive` types (#3791)
2 Francis O'Brien Add missing RPC methods for author_rotateKeysWithOwner and mmr_generateAncestryProof (#6263)
2 Francisco Gamundi Add chainIsEthereum prop to Registry interface (#5761)
2 HackFisher Update maxExtrinsic definition (#4703)
2 Jakub Pánik All heads subscription (#1899)
2 James Lefrère Add `.eq()` usage to docs and fix docs typos (#1405)
2 Javier Viola add muln(2), as was in the old code (#5829)
2 Jegor Sidorenko Use Box<XcmV3MultiLocation> instead of MultiAssetId (#5700)
2 Keith Yeung Allow keyPrefix to accept an additional argument for double maps (#2230)
2 MOZGIII Follow-up fix after #4665 (#4666)
2 Paweł Nguyen Fix a minor typo in cookbook blocks docs (#2294)
2 peetzweg/ feat: ink! v5 (#5791)
2 rob thijssen nimbus author mapping correction (#5590)
2 sung wu Update tx.md (#2485)
2 Veliko Abi constructor takes different parameters (#3347)
2 Wei Tang Use /usr/bin/env bash instead of /bin/bash (#2053)
2 Yaroslav Bolyukin feat: allow objects to be supplied as map keys (#5128)
2 Zannis Kalampoukis fix: Typegen handles structs and vectors of structs without erroring (#4743)
2 扩散性百万甜面包 Typo, deocrateMethod -> decorateMethod (#1594)
1 Alan Sapede Adds Eth feeHistory & maxPriorityFeePerGas rpc (#4956)
1 Aleš Ferlan fix: use H160 for address in getTransactionCount (#5472)
1 Alisher A. Khassanov Add `offchain_localStorageClear` RPC method (#6070)
1 Andrew Carpenter fix(rpc-provider): repair LRU list corruption when the tail entry is retrieved (#6270)
1 Brad Larson [NEW] Support for custom headers with providers (#2423)
1 Btwiuse Arch Add side effect check workaround (#4994) (#5009)
1 Cameron Marshall implement xcm dry run api (#5970)
1 Carlo Sala fix(ExtrinsicPayload): decode assetId with and without option (#6037)
1 chriswmercer little readme tweak (#279)
1 codingsh #2182 - add: search for docs (#2232)
1 coolcorexix Investigate 4559 v2 (#4608)
1 Dan Forbes Add WeightToFeeCoefficient type (#2296)
1 Daniel Maricic Fixed typo in README (#2402)
1 Daniel Savu fix: Generate custom type definitions (#4224)
1 Daria choosing AccountId20 type if the address is 20 bytes (#5991)
1 David Don't log full error (#2952)
1 David Duong Avoid reserved words during named enum fields augmentation (#5203)
1 Denis Tsai realign AccountKey20Junction to polkadot xcm's Junction enum (#3770)
1 djuanito.eth Update fees to current constants (#2320)
1 Dominique fix: add optional chaining operator in `toHuman` (#5825)
1 Drew Stone Update evm definitions to include vicinity (#2279)
1 Dylan Galea Updated users of the polkadot-js/api (#2027)
1 Ermal Kaleci fix cache key (rpc-provider) (#5745)
1 filvecchiato Add lru ttl cache implementation (#5997)
1 filvecchiato fix: update LRUcache to not keep thread (#6013)
1 flex Change BeefySignedCommitment signatures type to EcdsaSignature (#4204)
1 Florian Franzen metadataMd: use endpoint for rpc and runtime details too (#5628)
1 Furqan A fix: fixed 404 to the docs from the api readme (#3985)
1 Gérard Dethier Fix LRUCache memory leak. (#4520)
1 Gerben van de Wiel Adding some extra notes on changes in the specname (#2329)
1 girazoki Implement xcm payment api (#5911)
1 gupnik Adds a check for tip in Submittable (#5953)
1 HackFisher fix OutboundLaneData types (#3992)
1 Hoani Bryson Multiple Endpoint support for WsProvider (#2234)
1 Hyungsuk Kang Update fees.ts (#1014)
1 icodezjb Update SessionKeys (#3035)
1 iiiiiiii Make unknownTypes externally accessible (#3263)
1 JesseAbram added 07 Example showing how to make a transfer with allowed block permissions folder in docs (#1062)
1 Joey don't throw error at `onSocketClose` (#4363)
1 Jordan Allow typegen for custom RPCs (#2876)
1 JQQQ Allow rpc expose definition/ metadata (#3488)
1 Jun Jiang Update contract' gas to Weight type (#5324)
1 Ken Vu Expose `blockNumber` via filterEvents function (#5394)
1 Kian Paimani Update definitions.ts (#2514)
1 Krzysztof Jelski Derive for bounties and descriptions (#2925)
1 Lae Make sure awaiting on an api object won't stuck forever on error (#1763)
1 Lauro Gripa Fix multi call of `defenderVotes` and `isDefenderVoter` flag in `society.members` derivation (#5834)
1 Lezek123 BTreeSet and BTreeMap - encoding and serialization fixes (#3789)
1 Lovesh Harchandani Fix name of "getBlock" in package "api-derive" and export it in "index.ts" (#2857)
1 Manuel Mauro Add EIP-7702 transaction type (#6188)
1 Marc Fornós add beefy compact signed commitment definition (#5781)
1 Mario Neises fix usage with typescript (#405)
1 Mario Pino Add PolkaStats to API users (#1593)
1 Mark Robert Henderson Update warnings.ts to have the latest URLs (#2720)
1 Martin Rieke If possible, rpc-core should decode results into the lookupId type to avoid issues with multiple types that share the same name (#6089)
1 Matej Nemček added Kodadot to @polkadot/api users section (#2220)
1 Mokhtar Naamani Disable websocket outgoing message fragmentation for w3cwebsocket (#2738)
1 Nazar Mokrynskyi Performance tweaks (#4143)
1 Nikhil Ranjan add vestingPerBlock and vestingEndBlock in DeriveBalancesAll when doing calcBalances (#2563)
1 Nikolay Volf Fix typo (#1730)
1 Noah Corona Add rpc error fields (#4637)
1 Oleksandr Mykhailenko Add more complex namespaced contracts & test cases for them (#4472)
1 Paul M Fox Basic BTreeMaps codec support (#1474)
1 philipstanislaus Update types for centrifuge chain v1.2.0 (#2424)
1 Pierre Krieger Update substrate/connect to 0.7.6 (#4940)
1 polymath-eric Allow unset external signer (#5649)
1 Przemek Rzad Increase Vec max length (#5947)
1 Qinxuan Chen Add fp_account::AccountId20 mapping (#5551)
1 qiuhao update DeriveCustom type (#2581)
1 r0t0r-r0t0r Fix memory leak on raw rpc call (#4505)
1 Raphael Flechtner fix: typegen disconnect ws on success (#4901)
1 Robert Gabriel Jakabosky Fix sorting of `Option` values and error on duplicates from BTreeSet/BTreeMap. (#5731)
1 Robert Hambrock update MMR API (#5479)
1 Rocco Musolino remove broken link (#2671)
1 sander2 fix: type generation for nested tuples (#5395)
1 satellitex Add BTreeSet<V> Codec (#1639)
1 satellitex Add traits replace rules. for invalid cases `::<type>` and `<type>::`. (#885)
1 Satyam Agrawal update as per the 0.97.0-beta.38 release (#1617)
1 Sean Young Solang requires u256 and i256 types (#2752)
1 Serban Iorga Fix `beefy::subscribeJustifications()` return type (#5740)
1 serge make WS provider timeout configurable (#4758)
1 Sergei Pepyakin INK! -> ink! (#1347)
1 Shunji Zhan small polish (#5276)
1 Snoppy chore: fix typos (#5835)
1 Stephen Shelton Add transaction-payment runtime API V3 (#5430)
1 Tim B added EthRTApiV5 ifaces (#5680)
1 WoeOm adapt Darwinia, Crab Network types (#3498)
1 Xat_MassacrE Fix packages/types/src/codec/utils/encodeTypes.ts encodeSubTypes bug (#1544)
1 xiaolou86 Fix typos (#5747)
1 yjh fix MetadataVersioned.asV12 (#2983)
1 Yuri fixes #3693 Fix uniques return types (#3694)
1 Zeke Mostov fix: Allow sudo for polkadot indexed proxy enum (#3286)
1 ZeroX-Toml Refactor signing functions to use blake2AsU8a for hashing instead of registry.hash in conditional sign of extrinsic payload (#6183)
1 zjb0807 Throws detailed error information (#6116)
+37 -4
View File
@@ -1,9 +1,42 @@
# @polkadot/api
# @plugnet/api
This library provides a clean wrapper around all the methods exposed by a Polkadot/Substrate network client and defines all the types exposed by a node. For complete documentation around the interfaces and their use, visit the [documentation portal](https://polkadot.js.org/docs/api/).
_This repo is a fork of [@polkadot/api](https://github.com/polkadot-js/api), up to the version which works with current plug-node_
If you are an existing user, please be sure to track the [CHANGELOG](CHANGELOG.md) when changing versions.
This library provides a clean wrapper around all the methods exposed by a Plugnet/Subtrate network client and defines all the types exposed by a node. For complete documentation around the classes, interfaces and their use, visit the [documentation portal](https://www.poweredbyplug.com/).
## tutorials
Looking for tutorials to get started? Look at [examples](https://polkadot.js.org/docs/api/examples/promise/) for guides on how to use the API to make queries and submit transactions.
Looking for tutorials to get started? Look at [examples](https://www.poweredbyplug.com/) for guides on how to use the API to make queries and submit transactions.
## overview
The API is split up into a number of internal packages -
- [@plugnet/api](packages/api/) The API library, providing both Promise and RxJS Observable-based interfaces. This is the main user-facing entry point.
- [@plugnet/api-derive](packages/api-derive/) Derived results that are injected into the API, allowing for combinations of various query results (only used internally and exposed on the Api instances via `api.derive.*`)
- [@plugnet/rpc-core](packages/rpc-core/) Wrapper around all [JSON-RPC methods](https://www.poweredbyplug.com/) exposed by a Plugnet network client
- [@plugnet/rpc-provider](packages/rpc-provider/) Providers for connecting to nodes, including WebSockets and Http
- [@plugnet/rpc-rx](packages/rpc-rx/) A RxJs Observable wrapper around [@plugnet/rpc-provider](packages/rpc-provider)
Type definitions for interfaces as exposed by Plugnet & Substrate clients -
- [@plugnet/extrinsics](packages/type-extrinsics/) Base extrinsic definitions & codecs
- [@plugnet/jsonrpc](packages/type-jsonrpc/) Definitions for JSONRPC endpoints
- [@plugnet/storage](packages/type-storage/) Definitions for storage entries
- [@plugnet/types](packages/types/) Codecs for all Plugnet primitives
## development
Contributions are welcome!
To start off, this repo (along with others in the [@plugnet](https://github.com/plugblockchain/) family) uses yarn workspaces to organise the code. As such, after cloning, its dependencies _should_ be installed via `yarn`, not via npm; the latter will result in broken dependencies.
To get started -
1. Clone the repo locally, via `git clone https://github.com/plugblockchain/api.js <optional local path>`
2. Ensure that you have a recent version of Node.js, for development purposes [Node 10](https://nodejs.org/en/) is recommended.
3. Ensure that you have a recent version of Yarn, for development purposes [Yarn >=1.10.1](https://yarnpkg.com/docs/install) is required.
4. Install the dependencies by running `yarn`
5. Build the everything via `yarn run build`
6. You can also launch the API Docs, via `yarn vuepress dev docs`
7. Access the docs via [http://localhost:8080](http://localhost:8080)
+3
View File
@@ -0,0 +1,3 @@
module.exports = {
extends: '@plugnet/dev/config/babel'
};
View File
-12
View File
@@ -1,12 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="initial-scale=0.5, maximum-scale=1">
<meta http-equiv="refresh" content="0;URL='https://polkadot.js.org/docs/api/'" />
<title>Redirecting to https://polkadot.js.org/docs/api/</title>
</head>
<body>
Redirecting to <a href="https://polkadot.js.org/docs/api/">https://polkadot.js.org/docs/api/</a>
</body>
</html>
+214
View File
@@ -0,0 +1,214 @@
## Events
Events are emitted for certain operations on the runtime. The following sections describe the events that are part of the default Substrate runtime.
- **[balances](#balances)**
- **[contract](#contract)**
- **[council](#council)**
- **[councilMotions](#councilMotions)**
- **[councilVoting](#councilVoting)**
- **[democracy](#democracy)**
- **[grandpa](#grandpa)**
- **[indices](#indices)**
- **[session](#session)**
- **[staking](#staking)**
- **[sudo](#sudo)**
- **[system](#system)**
- **[treasury](#treasury)**
___
### balances
**NewAccount**(`AccountId`, `Balance`)
- **summary**: A new account was created.
**ReapedAccount**(`AccountId`)
- **summary**: An account was reaped.
**Transfer**(`AccountId`, `AccountId`, `Balance`, `Balance`)
- **summary**: Transfer succeeded (from, to, value, fees).
___
### contract
**CodeStored**(`Hash`)
- **summary**: Code with the specified hash has been stored.
**Dispatched**(`AccountId`, `bool`)
- **summary**: A call was dispatched from the given account. The bool signals whether it was successful execution or not.
**Instantiated**(`AccountId`, `AccountId`)
- **summary**: Contract deployed by address at the specified address.
**ScheduleUpdated**(`u32`)
- **summary**: Triggered when the current schedule is updated.
**Transfer**(`AccountId`, `AccountId`, `Balance`)
- **summary**: Transfer happened `from` to `to` with given `value` as part of a `call` or `create`.
___
### council
**BadReaperSlashed**(`AccountId`)
- **summary**: slashed reaper
**TallyFinalized**(`Vec<AccountId>`, `Vec<AccountId>`)
- **summary**: A tally (for approval votes of council seat(s)) has ended (with one or more new members).
**TallyStarted**(`u32`)
- **summary**: A tally (for approval votes of council seat(s)) has started.
**VoterReaped**(`AccountId`, `AccountId`)
- **summary**: reaped voter, reaper
___
### councilMotions
**Approved**(`Hash`)
- **summary**: A motion was approved by the required threshold.
**Disapproved**(`Hash`)
- **summary**: A motion was not approved by the required threshold.
**Executed**(`Hash`, `bool`)
- **summary**: A motion was executed; `bool` is true if returned without error.
**Proposed**(`AccountId`, `ProposalIndex`, `Hash`, `u32`)
- **summary**: A motion (given hash) has been proposed (by given account) with a threshold (given u32).
**Voted**(`AccountId`, `Hash`, `bool`, `u32`, `u32`)
- **summary**: A motion (given hash) has been voted on by given account, leaving a tally (yes votes and no votes given as u32s respectively).
___
### councilVoting
**TallyCancelation**(`Hash`, `u32`, `u32`, `u32`)
- **summary**: A voting tally has happened for a referendum cancellation vote. Last three are yes, no, abstain counts.
**TallyReferendum**(`Hash`, `u32`, `u32`, `u32`)
- **summary**: A voting tally has happened for a referendum vote. Last three are yes, no, abstain counts.
___
### democracy
**Cancelled**(`ReferendumIndex`)
**Delegated**(`AccountId`, `AccountId`)
**Executed**(`ReferendumIndex`, `bool`)
**NotPassed**(`ReferendumIndex`)
**Passed**(`ReferendumIndex`)
**Proposed**(`PropIndex`, `Balance`)
**Started**(`ReferendumIndex`, `VoteThreshold`)
**Tabled**(`PropIndex`, `Balance`, `Vec<AccountId>`)
**Undelegated**(`AccountId`)
___
### grandpa
**NewAuthorities**(`Vec<(SessionKey,u64)>`)
- **summary**: New authority set has been applied.
___
### indices
**NewAccountIndex**(`AccountId`, `AccountIndex`)
- **summary**: A new account index was assigned. This event is not triggered when an existing index is reassigned to another `AccountId`.
___
### session
**NewSession**(`BlockNumber`)
- **summary**: New session has happened. Note that the argument is the session index, not the block number as the type might suggest.
___
### staking
**OfflineSlash**(`AccountId`, `Balance`)
- **summary**: One validator (and their nominators) has been slashed by the given amount.
**OfflineWarning**(`AccountId`, `u32`)
- **summary**: One validator (and their nominators) has been given a offline-warning (they're still within their grace). The accrued number of slashes is recorded, too.
**Reward**(`Balance`)
- **summary**: All validators have been rewarded by the given balance.
___
### sudo
**KeyChanged**(`AccountId`)
- **summary**: The sudoer just switched identity; the old key is supplied.
**Sudid**(`bool`)
- **summary**: A sudo just took place.
___
### system
**ExtrinsicFailed**()
- **summary**: An extrinsic failed.
**ExtrinsicSuccess**()
- **summary**: An extrinsic completed successfully.
___
### treasury
**Awarded**(`ProposalIndex`, `Balance`, `AccountId`)
- **summary**: Some funds have been allocated.
**Burnt**(`Balance`)
- **summary**: Some of our funds have been burnt.
**Proposed**(`ProposalIndex`)
- **summary**: New proposal.
**Rollover**(`Balance`)
- **summary**: Spending has finished; this is the amount that rolls over until next spend.
**Spending**(`Balance`)
- **summary**: We have ended a spend period and will now allocate funds.
+287
View File
@@ -0,0 +1,287 @@
## Extrinsics
_The following sections contain Extrinsics methods are part of the default Substrate runtime._
- **[balances](#balances)**
- **[consensus](#consensus)**
- **[contract](#contract)**
- **[council](#council)**
- **[councilMotions](#councilMotions)**
- **[councilVoting](#councilVoting)**
- **[democracy](#democracy)**
- **[finalityTracker](#finalityTracker)**
- **[grandpa](#grandpa)**
- **[session](#session)**
- **[staking](#staking)**
- **[sudo](#sudo)**
- **[timestamp](#timestamp)**
- **[treasury](#treasury)**
___
### balances
**setBalance**(who: `Address`, free: `Compact<Balance>`, reserved: `Compact<Balance>`)
- **summary**: Set the balances of a given account. This will alter `FreeBalance` and `ReservedBalance` in storage. If the new free or reserved balance is below the existential deposit, it will also decrease the total issuance of the system (`TotalIssuance`) and reset the account nonce (`system::AccountNonce`). The dispatch origin for this call is `root`.
**transfer**(dest: `Address`, value: `Compact<Balance>`)
- **summary**: Transfer some liquid free balance to another account. `transfer` will set the `FreeBalance` of the sender and receiver. It will decrease the total issuance of the system by the `TransferFee`. If the sender's account is below the existential deposit as a result of the transfer, the account will be reaped. The dispatch origin for this call must be `Signed` by the transactor.
___
### consensus
**killStorage**(keys: `Vec<Key>`)
- **summary**: Kill some items from storage.
**noteOffline**(offline: `InherentOfflineReport`)
- **summary**: Note the previous block's validator missed their opportunity to propose a block.
**remark**(_remark: `Bytes`)
- **summary**: Make some on-chain remark.
**reportMisbehavior**(_report: `Bytes`)
- **summary**: Report some misbehavior.
**setCode**(new: `Bytes`)
- **summary**: Set the new code.
**setHeapPages**(pages: `u64`)
- **summary**: Set the number of pages in the WebAssembly environment's heap.
**setStorage**(items: `Vec<KeyValue>`)
- **summary**: Set some items of storage.
___
### contract
**call**(dest: `Address`, value: `Compact<BalanceOf>`, gas_limit: `Compact<Gas>`, data: `Bytes`)
- **summary**: Makes a call to an account, optionally transferring some balance. * If the account is a smart-contract account, the associated code will be executed and any value will be transferred. * If the account is a regular account, any value will be transferred. * If no account exists and the call value is not less than `existential_deposit`, a regular account will be created and any value will be transferred.
**create**(endowment: `Compact<BalanceOf>`, gas_limit: `Compact<Gas>`, code_hash: `CodeHash`, data: `Bytes`)
- **summary**: Creates a new contract from the `codehash` generated by `put_code`, optionally transferring some balance. Creation is executed as follows: - the destination address is computed based on the sender and hash of the code. - the smart-contract account is created at the computed address. - the `ctor_code` is executed in the context of the newly created account. Buffer returned after the execution is saved as the `code` of the account. That code will be invoked upon any call received by this account. - The contract is initialized.
**putCode**(gas_limit: `Compact<Gas>`, code: `Bytes`)
- **summary**: Stores the given binary Wasm code into the chains storage and returns its `codehash`. You can instantiate contracts only with stored code.
**updateSchedule**(schedule: `Schedule`)
- **summary**: Updates the schedule for metering contracts. The schedule must have a greater version than the stored schedule.
___
### council
**presentWinner**(candidate: `Address`, total: `Compact<BalanceOf>`, index: `Compact<VoteIndex>`)
- **summary**: Claim that `signed` is one of the top Self::carry_count() + current_vote().1 candidates. Only works if the `block_number >= current_vote().0` and `< current_vote().0 + presentation_duration()`` `signed` should have at least
**reapInactiveVoter**(reporter_index: `Compact<u32>`, who: `Address`, who_index: `Compact<u32>`, assumed_vote_index: `Compact<VoteIndex>`)
- **summary**: Remove a voter. For it not to be a bond-consuming no-op, all approved candidate indices must now be either unregistered or registered to a candidate that registered the slot after the voter gave their last approval set. May be called by anyone. Returns the voter deposit to `signed`.
**removeMember**(who: `Address`)
- **summary**: Remove a particular member. A tally will happen instantly (if not already in a presentation period) to fill the seat if removal means that the desired members are not met. This is effective immediately.
**retractVoter**(index: `Compact<u32>`)
- **summary**: Remove a voter. All votes are cancelled and the voter deposit is returned.
**setApprovals**(votes: `Vec<bool>`, index: `Compact<VoteIndex>`)
- **summary**: Set candidate approvals. Approval slots stay valid as long as candidates in those slots are registered.
**setDesiredSeats**(count: `Compact<u32>`)
- **summary**: Set the desired member count; if lower than the current count, then seats will not be up election when they expire. If more, then a new vote will be started if one is not already in progress.
**setPresentationDuration**(count: `Compact<BlockNumber>`)
- **summary**: Set the presentation duration. If there is currently a vote being presented for, will invoke `finalize_vote`.
**setTermDuration**(count: `Compact<BlockNumber>`)
- **summary**: Set the presentation duration. If there is current a vote being presented for, will invoke `finalize_vote`.
**submitCandidacy**(slot: `Compact<u32>`)
- **summary**: Submit oneself for candidacy. Account must have enough transferrable funds in it to pay the bond.
___
### councilMotions
**propose**(threshold: `Compact<u32>`, proposal: `Proposal`)
**vote**(proposal: `Hash`, index: `Compact<ProposalIndex>`, approve: `bool`)
___
### councilVoting
**propose**(proposal: `Proposal`)
**setCooloffPeriod**(blocks: `Compact<BlockNumber>`)
**setVotingPeriod**(blocks: `Compact<BlockNumber>`)
**veto**(proposal_hash: `Hash`)
**vote**(proposal: `Hash`, approve: `bool`)
___
### democracy
**cancelQueued**(when: `Compact<BlockNumber>`, which: `Compact<u32>`)
- **summary**: Cancel a proposal queued for enactment.
**cancelReferendum**(ref_index: `Compact<ReferendumIndex>`)
- **summary**: Remove a referendum.
**delegate**(to: `AccountId`, lock_periods: `LockPeriods`)
- **summary**: Delegate vote.
**propose**(proposal: `Proposal`, value: `Compact<BalanceOf>`)
- **summary**: Propose a sensitive action to be taken.
**second**(proposal: `Compact<PropIndex>`)
- **summary**: Propose a sensitive action to be taken.
**startReferendum**(proposal: `Proposal`, threshold: `VoteThreshold`, delay: `BlockNumber`)
- **summary**: Start a referendum.
**undelegate**()
- **summary**: Undelegate vote.
**vote**(ref_index: `Compact<ReferendumIndex>`, vote: `Vote`)
- **summary**: Vote in a referendum. If `vote.is_aye()`, the vote is to enact the proposal; otherwise it is a vote to keep the status quo.
___
### finalityTracker
**finalHint**(hint: `Compact<BlockNumber>`)
- **summary**: Hint that the author of this block thinks the best finalized block is the given number.
___
### grandpa
**reportMisbehavior**(_report: `Bytes`)
- **summary**: Report some misbehavior.
___
### session
**forceNewSession**(apply_rewards: `bool`)
- **summary**: Forces a new session.
**setKey**(key: `SessionKey`)
- **summary**: Sets the session key of `_validator` to `_key`. This doesn't take effect until the next session.
**setLength**(new: `Compact<BlockNumber>`)
- **summary**: Set a new session length. Won't kick in until the next session change (at current length).
___
### staking
**bond**(controller: `Address`, value: `Compact<BalanceOf>`, payee: `RewardDestination`)
- **summary**: Take the origin account as a stash and lock up `value` of its balance. `controller` will be the account that controls it. The dispatch origin for this call must be _Signed_.
**bondExtra**(max_additional: `Compact<BalanceOf>`)
- **summary**: Add some extra amount that have appeared in the stash `free_balance` into the balance up for staking. Use this if there are additional funds in your stash account that you wish to bond. The dispatch origin for this call must be _Signed_ by the stash, not the controller.
**chill**()
- **summary**: Declare no desire to either validate or nominate. Effects will be felt at the beginning of the next era. The dispatch origin for this call must be _Signed_ by the controller, not the stash.
**forceNewEra**(apply_rewards: `bool`)
- **summary**: Force there to be a new era. This also forces a new session immediately after. `apply_rewards` should be true for validators to get the session reward.
**nominate**(targets: `Vec<Address>`)
- **summary**: Declare the desire to nominate `targets` for the origin controller. Effects will be felt at the beginning of the next era. The dispatch origin for this call must be _Signed_ by the controller, not the stash.
**setBondingDuration**(new: `Compact<BlockNumber>`)
- **summary**: The length of the bonding duration in eras.
**setController**(controller: `Address`)
- **summary**: (Re-)set the payment target for a controller. Effects will be felt at the beginning of the next era. The dispatch origin for this call must be _Signed_ by the stash, not the controller.
**setInvulnerables**(validators: `Vec<AccountId>`)
- **summary**: Set the validators who cannot be slashed (if any).
**setOfflineSlashGrace**(new: `Compact<u32>`)
- **summary**: Set the offline slash grace period.
**setPayee**(payee: `RewardDestination`)
- **summary**: (Re-)set the payment target for a controller. Effects will be felt at the beginning of the next era. The dispatch origin for this call must be _Signed_ by the controller, not the stash.
**setSessionsPerEra**(new: `Compact<BlockNumber>`)
- **summary**: Set the number of sessions in an era.
**setValidatorCount**(new: `Compact<u32>`)
- **summary**: The ideal number of validators.
**unbond**(value: `Compact<BalanceOf>`)
- **summary**: Schedule a portion of the stash to be unlocked ready for transfer out after the bond period ends. If this leaves an amount actively bonded less than T::Currency::existential_deposit(), then it is increased to the full amount. Once the unlock period is done, you can call `withdraw_unbonded` to actually move the funds out of management ready for transfer. The dispatch origin for this call must be _Signed_ by the controller, not the stash. See also [`Call::withdraw_unbonded`].
**validate**(prefs: `ValidatorPrefs`)
- **summary**: Declare the desire to validate for the origin controller. Effects will be felt at the beginning of the next era. The dispatch origin for this call must be _Signed_ by the controller, not the stash.
**withdrawUnbonded**()
- **summary**: Remove any unlocked chunks from the `unlocking` queue from our management. This essentially frees up that balance to be used by the stash account to do whatever it wants. The dispatch origin for this call must be _Signed_ by the controller, not the stash. See also [`Call::unbond`].
___
### sudo
**setKey**(new: `Address`)
**sudo**(proposal: `Proposal`)
___
### timestamp
**set**(now: `Compact<Moment>`)
- **summary**: Set the current time. This call should be invoked exactly once per block. It will panic at the finalization phase, if this call hasn't been invoked by that time. The timestamp should be greater than the previous one by the amount specified by `minimum_period`. The dispatch origin for this call must be `Inherent`.
___
### treasury
**approveProposal**(proposal_id: `Compact<ProposalIndex>`)
- **summary**: Approve a proposal. At a later time, the proposal will be allocated to the beneficiary and the original deposit will be returned.
**configure**(proposal_bond: `Compact<Permill>`, proposal_bond_minimum: `Compact<BalanceOf>`, spend_period: `Compact<BlockNumber>`, burn: `Compact<Permill>`)
- **summary**: (Re-)configure this module.
**proposeSpend**(value: `Compact<BalanceOf>`, beneficiary: `Address`)
- **summary**: Put forward a suggestion for spending. A deposit proportional to the value is reserved and slashed if the proposal is rejected. It is returned once the proposal is awarded.
**rejectProposal**(proposal_id: `Compact<ProposalIndex>`)
- **summary**: Reject a proposed spend. The original deposit will be slashed.
**setPot**(new_pot: `Compact<BalanceOf>`)
- **summary**: Set the balance of funds available to spend.
+117
View File
@@ -0,0 +1,117 @@
## JSON-RPC
_The following sections contain RPC methods that are Remote Calls available by default and allow you to interact with the actual node, query, and submit. The RPCs are provided by Substrate itself._
- **[author](#author)**
- **[chain](#chain)**
- **[state](#state)**
- **[system](#system)**
___
### author
_Authoring of network items_
**pendingExtrinsics**(): `PendingExtrinsics`
- **summary**: Returns all pending extrinsics, potentially grouped by sender
**submitAndWatchExtrinsic**(extrinsic: `Extrinsic`): `ExtrinsicStatus`
- **summary**: Subscribe and watch an extrinsic until unsubscribed
**submitExtrinsic**(extrinsic: `Extrinsic`): `Hash`
- **summary**: Submit a fully formatted extrinsic for block inclusion
___
### chain
_Retrieval of chain data_
**getBlock**(hash?: `Hash`): `SignedBlock`
- **summary**: Get header and body of a relay chain block
**getBlockHash**(blockNumber?: `BlockNumber`): `Hash`
- **summary**: Get the block hash for a specific block
**getFinalizedHead**(): `Hash`
- **summary**: Get hash of the last finalised block in the canon chain
**getHeader**(hash?: `Hash`): `Header`
- **summary**: Retrieves the header for a specific block
**getRuntimeVersion**(hash?: `Hash`): `RuntimeVersion`
- **summary**: Get the runtime version (alias of state_getRuntimeVersion)
**subscribeFinalizedHeads**(): `Header`
- **summary**: Retrieves the best finalized header via subscription
**subscribeNewHead**(): `Header`
- **summary**: Retrieves the best header via subscription
**subscribeRuntimeVersion**(): `RuntimeVersion`
- **summary**: Retrieves the runtime version via subscription
___
### state
_Query of state_
**call**(method: `Text`, data: `Bytes`, block?: `Hash`): `Bytes`
- **summary**: Perform a call to a builtin on the chain
**getMetadata**(block?: `Hash`): `Metadata`
- **summary**: Returns the runtime metadata
**getRuntimeVersion**(hash?: `Hash`): `RuntimeVersion`
- **summary**: Get the runtime version
**getStorage**(key: `StorageKey`, block?: `Hash`): `StorageData`
- **summary**: Retrieves the storage for a key
**getStorageHash**(key: `StorageKey`, block?: `Hash`): `Hash`
- **summary**: Retrieves the storage hash
**getStorageSize**(key: `StorageKey`, block?: `Hash`): `u64`
- **summary**: Retrieves the storage size
**queryStorage**(keys: `Vec<StorageKey>`, startBlock: `Hash`, block?: `Hash`): `Vec<StorageChangeSet>`
- **summary**: Query historical storage entries (by key) starting from a start block
**subscribeStorage**(keys: `Vec<StorageKey>`): `StorageChangeSet`
- **summary**: Subscribes to storage changes for the provided keys
___
### system
_Methods to retrieve system info_
**chain**(): `Text`
- **summary**: Retrieves the chain
**health**(): `Health`
- **summary**: Return health status of the node
**name**(): `Text`
- **summary**: Retrieves the node name
**networkState**(): `NetworkState`
- **summary**: Returns current state of the network
**peers**(): `Vec<PeerInfo>`
- **summary**: Returns the currently connected peers
**properties**(): `ChainProperties`
- **summary**: Get a custom set of properties as a JSON object, defined in the chain spec
**version**(): `Text`
- **summary**: Retrieves the version of the node
+529
View File
@@ -0,0 +1,529 @@
## Storage
_The following sections contain Storage methods are part of the default Substrate runtime._
- **[balances](#balances)**
- **[consensus](#consensus)**
- **[contract](#contract)**
- **[council](#council)**
- **[councilMotions](#councilMotions)**
- **[councilVoting](#councilVoting)**
- **[democracy](#democracy)**
- **[grandpaFinality](#grandpaFinality)**
- **[indices](#indices)**
- **[session](#session)**
- **[staking](#staking)**
- **[sudo](#sudo)**
- **[system](#system)**
- **[timestamp](#timestamp)**
- **[treasury](#treasury)**
- **[substrate](#substrate)**
___
### balances
**creationFee**(): `Balance`
- **summary**: The fee required to create an account.
**existentialDeposit**(): `Balance`
- **summary**: The minimum amount required to keep an account open.
**freeBalance**(`AccountId`): `Balance`
- **summary**: The 'free' balance of a given account. This is the only balance that matters in terms of most operations on tokens. It alone is used to determine the balance when in the contract execution environment. When this balance falls below the value of `ExistentialDeposit`, then the 'current account' is deleted: specifically `FreeBalance`. Further, the `OnFreeBalanceZero` callback is invoked, giving a chance to external modules to clean up data associated with the deleted account. `system::AccountNonce` is also deleted if `ReservedBalance` is also zero (it also gets collapsed to zero if it ever becomes less than `ExistentialDeposit`.
**locks**(`AccountId`): `Vec<BalanceLock>`
- **summary**: Any liquidity locks on some account balances.
**reservedBalance**(`AccountId`): `Balance`
- **summary**: The amount of the balance of a given account that is externally reserved; this can still get slashed, but gets slashed last of all. This balance is a 'reserve' balance that other subsystems use in order to set aside tokens that are still 'owned' by the account holder, but which are suspendable. When this balance falls below the value of `ExistentialDeposit`, then this 'reserve account' is deleted: specifically, `ReservedBalance`. `system::AccountNonce` is also deleted if `FreeBalance` is also zero (it also gets collapsed to zero if it ever becomes less than `ExistentialDeposit`.)
**totalIssuance**(): `Balance`
- **summary**: The total units issued in the system.
**transactionBaseFee**(): `Balance`
- **summary**: The fee to be paid for making a transaction; the base.
**transactionByteFee**(): `Balance`
- **summary**: The fee to be paid for making a transaction; the per-byte portion.
**transferFee**(): `Balance`
- **summary**: The fee required to make a transfer.
**vesting**(`AccountId`): `Option<VestingSchedule>`
- **summary**: Information regarding the vesting of a given account.
___
### consensus
**originalAuthorities**(): `Option<Vec<SessionKey>>`
___
### contract
**accountCounter**(): `u64`
- **summary**: The subtrie counter
**accountInfoOf**(`AccountId`): `Option<AccountInfo>`
- **summary**: The code associated with a given account.
**blockGasLimit**(): `Gas`
- **summary**: The maximum amount of gas that could be expended per block.
**callBaseFee**(): `Gas`
- **summary**: The base fee charged for calling into a contract.
**codeHashOf**(`AccountId`): `Option<CodeHash>`
- **summary**: The code associated with a given account.
**codeStorage**(`CodeHash`): `Option<PrefabWasmModule>`
- **summary**: A mapping between an original code hash and instrumented wasm code, ready for the execution.
**contractFee**(): `BalanceOf`
- **summary**: The fee required to create a contract instance.
**createBaseFee**(): `Gas`
- **summary**: The base fee charged for creating a contract.
**creationFee**(): `BalanceOf`
- **summary**: The fee required to create an account.
**currentSchedule**(): `Schedule`
- **summary**: Current cost schedule for contracts.
**gasPrice**(): `BalanceOf`
- **summary**: The price of one unit of gas.
**gasSpent**(): `Gas`
- **summary**: Gas spent so far in this block.
**maxDepth**(): `u32`
- **summary**: The maximum nesting level of a call/create stack.
**pristineCode**(`CodeHash`): `Option<Bytes>`
- **summary**: A mapping from an original code hash to the original code, untouched by instrumentation.
**transactionBaseFee**(): `BalanceOf`
- **summary**: The fee to be paid for making a transaction; the base.
**transactionByteFee**(): `BalanceOf`
- **summary**: The fee to be paid for making a transaction; the per-byte portion.
**transferFee**(): `BalanceOf`
- **summary**: The fee required to make a transfer.
___
### council
**activeCouncil**(): `Vec<(AccountId,BlockNumber)>`
- **summary**: The current council. When there's a vote going on, this should still be used for executive matters. The block number (second element in the tuple) is the block that their position is active until (calculated by the sum of the block number when the council member was elected and their term duration).
**approvalsOf**(`AccountId`): `Vec<bool>`
- **summary**: A list of votes for each voter, respecting the last cleared vote index that this voter was last active at.
**candidacyBond**(): `BalanceOf`
- **summary**: How much should be locked up in order to submit one's candidacy.
**candidateCount**(): `u32`
**candidates**(): `Vec<AccountId>`
- **summary**: The present candidate list.
**carryCount**(): `u32`
- **summary**: How many runners-up should have their approvals persist until the next vote.
**desiredSeats**(): `u32`
- **summary**: Number of accounts that should be sitting on the council.
**inactiveGracePeriod**(): `VoteIndex`
- **summary**: How many vote indexes need to go by after a target voter's last vote before they can be reaped if their approvals are moot.
**lastActiveOf**(`AccountId`): `Option<VoteIndex>`
- **summary**: The last cleared vote index that this voter was last active at.
**leaderboard**(): `Option<Vec<(BalanceOf,AccountId)>>`
- **summary**: Get the leaderboard if we;re in the presentation phase.
**nextFinalize**(): `Option<(BlockNumber,u32,Vec<AccountId>)>`
- **summary**: The accounts holding the seats that will become free on the next tally.
**presentSlashPerVoter**(): `BalanceOf`
- **summary**: The punishment, per voter, if you provide an invalid presentation.
**presentationDuration**(): `BlockNumber`
- **summary**: How long to give each top candidate to present themselves after the vote ends.
**registerInfoOf**(`AccountId`): `Option<(VoteIndex,u32)>`
- **summary**: The vote index and list slot that the candidate `who` was registered or `None` if they are not currently registered.
**snapshotedStakes**(): `Vec<BalanceOf>`
- **summary**: The stakes as they were at the point that the vote ended.
**termDuration**(): `BlockNumber`
- **summary**: How long each position is active for.
**voteCount**(): `VoteIndex`
- **summary**: The total number of votes that have happened or are in progress.
**voters**(): `Vec<AccountId>`
- **summary**: The present voter list.
**votingBond**(): `BalanceOf`
- **summary**: How much should be locked up in order to be able to submit votes.
**votingPeriod**(): `BlockNumber`
- **summary**: How often (in blocks) to check for new votes.
___
### councilMotions
**proposalCount**(): `u32`
- **summary**: Proposals so far.
**proposalOf**(`Hash`): `Option<Proposal>`
- **summary**: Actual proposal for a given hash, if it's current.
**proposals**(): `Vec<Hash>`
- **summary**: The (hashes of) the active proposals.
**voting**(`Hash`): `Option<(ProposalIndex,u32,Vec<AccountId>,Vec<AccountId>)>`
- **summary**: Votes for a given proposal: (required_yes_votes, yes_voters, no_voters).
___
### councilVoting
**cooloffPeriod**(): `BlockNumber`
**councilVoteOf**(`(Hash,AccountId)`): `Option<bool>`
**enactDelayPeriod**(): `BlockNumber`
- **summary**: Number of blocks by which to delay enactment of successful, non-unanimous-council-instigated referendum proposals.
**proposalOf**(`Hash`): `Option<Proposal>`
**proposalVoters**(`Hash`): `Vec<AccountId>`
**proposals**(): `Vec<(BlockNumber,Hash)>`
**vetoedProposal**(`Hash`): `Option<(BlockNumber,Vec<AccountId>)>`
**votingPeriod**(): `BlockNumber`
___
### democracy
**delegations**(`AccountId`): `((AccountId,LockPeriods), Linkage<AccountId>)`
- **summary**: Get the account (and lock periods) to which another account is delegating vote.
**depositOf**(`PropIndex`): `Option<(BalanceOf,Vec<AccountId>)>`
- **summary**: Those who have locked a deposit.
**dispatchQueue**(`BlockNumber`): `Vec<Option<(Proposal,ReferendumIndex)>>`
- **summary**: Queue of successful referenda to be dispatched.
**launchPeriod**(): `BlockNumber`
- **summary**: How often (in blocks) new public referenda are launched.
**maxLockPeriods**(): `LockPeriods`
- **summary**: The maximum number of additional lock periods a voter may offer to strengthen their vote. Multiples of `PublicDelay`.
**minimumDeposit**(): `BalanceOf`
- **summary**: The minimum amount to be used as a deposit for a public referendum proposal.
**nextTally**(): `ReferendumIndex`
- **summary**: The next referendum index that should be tallied.
**publicDelay**(): `BlockNumber`
- **summary**: The delay before enactment for all public referenda.
**publicPropCount**(): `PropIndex`
- **summary**: The number of (public) proposals that have been made so far.
**publicProps**(): `Vec<(PropIndex,Proposal,AccountId)>`
- **summary**: The public proposals. Unsorted.
**referendumCount**(): `ReferendumIndex`
- **summary**: The next free referendum index, aka the number of referendums started so far.
**referendumInfoOf**(`ReferendumIndex`): `Option<ReferendumInfo>`
- **summary**: Information concerning any given referendum.
**voteOf**(`(ReferendumIndex,AccountId)`): `Vote`
- **summary**: Get the vote in a given referendum of a particular voter. The result is meaningful only if `voters_for` includes the voter when called with the referendum (you'll get the default `Vote` value otherwise). If you don't want to check `voters_for`, then you can also check for simple existence with `VoteOf::exists` first.
**votersFor**(`ReferendumIndex`): `Vec<AccountId>`
- **summary**: Get the voters for the current proposal.
**votingPeriod**(): `BlockNumber`
- **summary**: How often (in blocks) to check for new votes.
___
### grandpaFinality
**nextForced**(): `Option<BlockNumber>`
**pendingChange**(): `Option<StoredPendingChange>`
___
### indices
**enumSet**(`AccountIndex`): `Vec<AccountId>`
- **summary**: The enumeration sets.
**nextEnumSet**(): `AccountIndex`
- **summary**: The next free enumeration set.
___
### session
**currentIndex**(): `BlockNumber`
- **summary**: Current index of the session.
**currentStart**(): `Moment`
- **summary**: Timestamp when current session started.
**forcingNewSession**(): `Option<bool>`
- **summary**: New session is being forced is this entry exists; in which case, the boolean value is whether the new session should be considered a normal rotation (rewardable) or exceptional (slashable).
**lastLengthChange**(): `Option<BlockNumber>`
- **summary**: Block at which the session length last changed.
**nextKeyFor**(`AccountId`): `Option<SessionKey>`
- **summary**: The next key for a given validator.
**nextSessionLength**(): `Option<BlockNumber>`
- **summary**: The next session length.
**sessionLength**(): `BlockNumber`
- **summary**: Current length of the session.
**validators**(): `Vec<AccountId>`
- **summary**: The current set of validators.
___
### staking
**bonded**(`AccountId`): `Option<AccountId>`
- **summary**: Map from all locked "stash" accounts to the controller account.
**bondingDuration**(): `BlockNumber`
- **summary**: The length of the bonding duration in blocks.
**currentElected**(): `Vec<AccountId>`
- **summary**: The currently elected validator set keyed by stash account ID.
**currentEra**(): `BlockNumber`
- **summary**: The current era index.
**currentEraReward**(): `BalanceOf`
- **summary**: The accumulated reward for the current era. Reset to zero at the beginning of the era and increased for every successfully finished session.
**currentSessionReward**(): `BalanceOf`
- **summary**: Maximum reward, per validator, that is provided per acceptable session.
**forcingNewEra**(): `Option<Null>`
- **summary**: We are forcing a new era.
**invulnerables**(): `Vec<AccountId>`
- **summary**: Any validators that may never be slashed or forcibly kicked. It's a Vec since they're easy to initialize and the performance hit is minimal (we expect no more than four invulnerables) and restricted to testnets.
**lastEraLengthChange**(): `BlockNumber`
- **summary**: The session index at which the era length last changed.
**ledger**(`AccountId`): `Option<StakingLedger>`
- **summary**: Map from all (unlocked) "controller" accounts to the info regarding the staking.
**minimumValidatorCount**(): `u32`
- **summary**: Minimum number of staking participants before emergency conditions are imposed.
**nextSessionsPerEra**(): `Option<BlockNumber>`
- **summary**: The next value of sessions per era.
**nominators**(`AccountId`): `(Vec<AccountId>, Linkage<AccountId>)`
- **summary**: The map from nominator stash key to the set of stash keys of all validators to nominate.
**offlineSlash**(): `Perbill`
- **summary**: Slash, per validator that is taken for the first time they are found to be offline.
**offlineSlashGrace**(): `u32`
- **summary**: Number of instances of offline reports before slashing begins for validators.
**payee**(`AccountId`): `RewardDestination`
- **summary**: Where the reward payment should be made. Keyed by stash.
**recentlyOffline**(): `Vec<(AccountId,BlockNumber,u32)>`
- **summary**: Most recent `RECENT_OFFLINE_COUNT` instances. (who it was, when it was reported, how many instances they were offline for).
**sessionReward**(): `Perbill`
- **summary**: Maximum reward, per validator, that is provided per acceptable session.
**sessionsPerEra**(): `BlockNumber`
- **summary**: The length of a staking era in sessions.
**slashCount**(`AccountId`): `u32`
- **summary**: The number of times a given validator has been reported offline. This gets decremented by one each era that passes.
**slotStake**(): `BalanceOf`
- **summary**: The amount of balance actively at stake for each validator slot, currently. This is used to derive rewards and punishments.
**stakers**(`AccountId`): `Exposure`
- **summary**: Nominators for a particular account that is in action right now. You can't iterate through validators here, but you can find them in the `sessions` module. This is keyed by the stash account.
**validatorCount**(): `u32`
- **summary**: The ideal number of staking participants.
**validators**(`AccountId`): `(ValidatorPrefs, Linkage<AccountId>)`
- **summary**: The map from (wannabe) validator stash key to the preferences of that validator.
___
### sudo
**key**(): `AccountId`
___
### system
**accountNonce**(`AccountId`): `Index`
- **summary**: Extrinsics nonce for accounts.
**allExtrinsicsLen**(): `Option<u32>`
- **summary**: Total length in bytes for all extrinsics put together, for the current block.
**blockHash**(`BlockNumber`): `Hash`
- **summary**: Map of block numbers to block hashes.
**digest**(): `Digest`
- **summary**: Digest of the current block, also part of the block header.
**events**(): `Vec<EventRecord>`
- **summary**: Events deposited for the current block.
**extrinsicCount**(): `Option<u32>`
- **summary**: Total extrinsics count for the current block.
**extrinsicData**(`u32`): `Bytes`
- **summary**: Extrinsics data for the current block (maps extrinsic's index to its data).
**extrinsicsRoot**(): `Hash`
- **summary**: Extrinsics root of the current block, also part of the block header.
**number**(): `BlockNumber`
- **summary**: The current block number being processed. Set by `execute_block`.
**parentHash**(): `Hash`
- **summary**: Hash of the previous block.
**randomSeed**(): `Hash`
- **summary**: Random seed of the current block.
___
### timestamp
**blockPeriod**(): `Option<Moment>`
- **summary**: Old storage item provided for compatibility. Remove after all networks upgraded.
**didUpdate**(): `bool`
- **summary**: Did the timestamp get updated in this block?
**minimumPeriod**(): `Moment`
- **summary**: The minimum period between blocks. Beware that this is different to the *expected* period that the block production apparatus provides. Your chosen consensus system will generally work with this to determine a sensible block time. e.g. For Aura, it will be double this period on default settings.
**now**(): `Moment`
- **summary**: Current time for the current block.
___
### treasury
**approvals**(): `Vec<ProposalIndex>`
- **summary**: Proposal indices that have been approved but not yet awarded.
**burn**(): `Permill`
- **summary**: Percentage of spare funds (if any) that are burnt per spend period.
**pot**(): `BalanceOf`
- **summary**: Total funds available to this module for spending.
**proposalBond**(): `Permill`
- **summary**: Proportion of funds that should be bonded in order to place a proposal. An accepted proposal gets these back. A rejected proposal doesn't.
**proposalBondMinimum**(): `BalanceOf`
- **summary**: Minimum amount of funds that should be placed in a deposit for making a proposal.
**proposalCount**(): `ProposalIndex`
- **summary**: Number of proposals that have been made.
**proposals**(`ProposalIndex`): `Option<TreasuryProposal>`
- **summary**: Proposals that have been made.
**spendPeriod**(): `BlockNumber`
- **summary**: Period between successive spends.
---
### substrate
_These are keys that are always available to the runtime implementation_
**authorityCount**(): `u32`
- **summary**: Number of authorities.
**authorityPrefix**(): `u32`
- **summary**: Prefix under which authorities are stored.
**changesTrieConfig**(): `u32`
- **summary**: Changes trie configuration is stored under this key.
**code**(): `Bytes`
- **summary**: Wasm code of the runtime.
**extrinsicIndex**(): `u32`
- **summary**: Current extrinsic index (u32) is stored under this key.
**heapPages**(): `u64`
- **summary**: Number of wasm linear memory pages required for execution of the runtime.
---
+1
View File
@@ -0,0 +1 @@
yarn.lock
@@ -0,0 +1,5 @@
# Simple Connect
The following example shows how to instantiate a Plugnet API object and use it to connect to a node using ApiPromise.
<<< @/docs/examples/promise/01_simple_connect/index.js
+22
View File
@@ -0,0 +1,22 @@
// @ts-check
// Required imports
const { ApiPromise, WsProvider } = require('@plugnet/api');
async function main () {
// Initialise the provider to connect to the local node
const provider = new WsProvider('ws://127.0.0.1:9944');
// Create the API and wait until ready
const api = await ApiPromise.create(provider);
// Retrieve the chain & node information information via rpc calls
const [chain, nodeName, nodeVersion] = await Promise.all([
api.rpc.system.chain(),
api.rpc.system.name(),
api.rpc.system.version()
]);
console.log(`You are connected to chain ${chain} using ${nodeName} v${nodeVersion}`);
}
main().catch(console.error).finally(() => process.exit());
@@ -0,0 +1,19 @@
{
"name": "01_simple_connect",
"version": "0.2.0",
"description": "Example showing how to connect using a WebSocket",
"main": "index.js",
"author": "chevdor",
"license": "MIT",
"scripts": {
"clean": "rimraf node_modules",
"start": "node index.js"
},
"dependencies": {
"@plugnet/api": "^0.76.102"
},
"devDependencies": {
"rimraf": "^2.6.2"
}
}
@@ -0,0 +1,8 @@
# Listen to new blocks
This example shows how to subscribe to new blocks.
It displays the block number every time a new block is seen by the node you are connected to.
NOTE: The example runs until you stop it with CTRL+C
<<< @/docs/examples/promise/02_listen_to_blocks/index.js
+19
View File
@@ -0,0 +1,19 @@
// @ts-check
// Import the API
const { ApiPromise } = require('@plugnet/api');
async function main () {
// Here we don't pass the (optional) provider, connecting directly to the default
// node/port, i.e. `ws://127.0.0.1:9944`. Await for the isReady promise to ensure
// the API has connected to the node and completed the initialisation process
const api = await ApiPromise.create();
// Subscribe to the new headers on-chain. The callback is fired when new headers
// are found, the call itself returns a promise with a subscription that can be
// used to unsubscribe from the newHead subscription
const unsubscribe = await api.rpc.chain.subscribeNewHead((header) => {
console.log(`Chain is at block: #${header.blockNumber}`);
});
}
main().catch(console.error);
@@ -0,0 +1,18 @@
{
"name": "02_listen_to_blocks",
"version": "0.2.0",
"description": "Example showing how to use subscriptions",
"main": "index.js",
"author": "chevdor",
"license": "MIT",
"scripts": {
"clean": "rimraf node_modules",
"start": "node index.js"
},
"dependencies": {
"@plugnet/api": "^0.76.102"
},
"devDependencies": {
"rimraf": "^2.6.2"
}
}
@@ -0,0 +1,5 @@
# Listen to balance changes
This example shows how to instantiate a Plugnet API object and use it to connect to a node and retrieve balance updates.
<<< @/docs/examples/promise/03_listen_to_balance_change/index.js
+33
View File
@@ -0,0 +1,33 @@
// @ts-check
// Import the API
const { ApiPromise } = require('@plugnet/api');
// Known account we want to use (available on dev chain, with funds)
const Alice = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
async function main () {
// Create an await for the API
const api = await ApiPromise.create();
// Retrieve the initial balance. Since the call has no callback, it is simply a promise
// that resolves to the current on-chain value
let previous = await api.query.balances.freeBalance(Alice);
console.log(`${Alice} has a balance of ${previous}`);
console.log(`You may leave this example running and start example 06 or transfer any value to ${Alice}`);
// Here we subscribe to any balance changes and update the on-screen value
api.query.balances.freeBalance(Alice, (current) => {
// Calculate the delta
const change = current.sub(previous);
// Only display positive value changes (Since we are pulling `previous` above already,
// the initial balance change will also be zero)
if (!change.isZero()) {
previous = current;
console.log(`New balance change of: ${change}`);
}
});
}
main().catch(console.error);
@@ -0,0 +1,18 @@
{
"name": "03_listen_to_balance_change",
"version": "0.2.0",
"description": "Example showing how to subscribe to balance change",
"main": "index.js",
"author": "chevdor",
"license": "MIT",
"scripts": {
"clean": "rimraf node_modules",
"start": "node index.js"
},
"dependencies": {
"@plugnet/api": "^0.76.102"
},
"devDependencies": {
"rimraf": "^2.6.2"
}
}
@@ -0,0 +1,7 @@
# Unsubscribe from listening to updates
This example shows how to subscribe to and later unsubscribe from listening to block updates.
In this example we're calling the built-in unsubscribe() function after a timeOut of 20s to cleanup and unsubscribe from listening to updates.
<<< @/docs/examples/promise/04_unsubscribe/index.js
@@ -0,0 +1,23 @@
// @ts-check
// Import the API
const { ApiPromise } = require('@plugnet/api');
async function main () {
// Create a new instance of the api
const api = await ApiPromise.create();
// Subscribe to chain updates and log the current block number on update.
const unsubscribe = await api.rpc.chain.subscribeNewHead((header) => {
console.log(`Chain is at block: #${header.blockNumber}`);
});
// In this example we're calling the unsubscribe() function that is being
// returned by the api call function after 20s.
setTimeout(() => {
unsubscribe();
console.log('Unsubscribed')
}, 20000);
}
main().catch(console.error);
@@ -0,0 +1,18 @@
{
"name": "04_unsubscribe",
"version": "0.2.0",
"description": "Example showing how to unsubscribe from a subscription",
"main": "index.js",
"author": "Stefie",
"license": "MIT",
"scripts": {
"clean": "rimraf node_modules",
"start": "node index.js"
},
"dependencies": {
"@plugnet/api": "^0.76.102"
},
"devDependencies": {
"rimraf": "^2.6.2"
}
}
@@ -0,0 +1,5 @@
# Read storage
Many important variables are available through the storage API. This example shows how to call a few of those APIs.
<<< @/docs/examples/promise/05_read_storage/index.js
+38
View File
@@ -0,0 +1,38 @@
// @ts-check
// Import the API
const { ApiPromise } = require('@plugnet/api');
// Our address for Alice on the dev chain
const Alice = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
async function main () {
// Create our API with a default connection to the local node
const api = await ApiPromise.create();
// Make our basic chain state/storage queries, all in one go
const [accountNonce, blockPeriod, validators] = await Promise.all([
api.query.system.accountNonce(Alice),
api.query.timestamp.blockPeriod(),
api.query.session.validators()
]);
console.log(`accountNonce(${Alice}) ${accountNonce}`);
console.log(`blockPeriod ${blockPeriod.toNumber()} seconds`);
if (validators && validators.length > 0) {
// Retrieve the balances for all validators
const validatorBalances = await Promise.all(
validators.map(authorityId =>
api.query.balances.freeBalance(authorityId)
)
);
// Print out the authorityIds and balances of all validators
console.log('validators', validators.map((authorityId, index) => ({
address: authorityId.toString(),
balance: validatorBalances[index].toString()
})));
}
}
main().catch(console.error).finally(_ => process.exit());
@@ -0,0 +1,18 @@
{
"name": "05_read_storage",
"version": "0.2.0",
"description": "Example showing how to query storage",
"main": "index.js",
"author": "chevdor",
"license": "MIT",
"scripts": {
"clean": "rimraf node_modules",
"start": "node index.js"
},
"dependencies": {
"@plugnet/api": "^0.76.102"
},
"devDependencies": {
"rimraf": "^2.6.2"
}
}
@@ -0,0 +1,5 @@
# Make a simple transfer
This sample shows how to create a transaction to make a transfer from one an account to another.
<<< @/docs/examples/promise/06_make_transfer/index.js
+27
View File
@@ -0,0 +1,27 @@
// @ts-check
// Import the API, Keyring and some utility functions
const { ApiPromise } = require('@plugnet/api');
const { Keyring } = require('@plugnet/keyring');
const BOB = '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty';
async function main () {
// Instantiate the API
const api = await ApiPromise.create();
// Constuct the keying after the API (crypto has an async init)
const keyring = new Keyring({ type: 'sr25519' });
// Add alice to our keyring with a hard-deived path (empty phrase, so uses dev)
const alice = keyring.addFromUri('//Alice');
// Create a extrinsic, transferring 12345 units to Bob
const transfer = api.tx.balances.transfer(BOB, 12345);
// Sign and send the transaction using our account
const hash = await transfer.signAndSend(alice);
console.log('Transfer sent with hash', hash.toHex());
}
main().catch(console.error).finally(() => process.exit());
@@ -0,0 +1,18 @@
{
"name": "06_make_transfer",
"version": "0.2.0",
"description": "Example showing how to make a transfer",
"main": "index.js",
"author": "chevdor",
"license": "MIT",
"scripts": {
"clean": "rimraf node_modules",
"start": "node index.js"
},
"dependencies": {
"@plugnet/api": "^0.76.102"
},
"devDependencies": {
"rimraf": "^2.6.2"
}
}
@@ -0,0 +1,5 @@
# Traverse events
Query the system events and extract information from them. This example runs until exited via Ctrl-C
<<< @/docs/examples/promise/08_system_events/index.js
+34
View File
@@ -0,0 +1,34 @@
// @ts-check
// Import the API
const { ApiPromise } = require('@plugnet/api');
async function main () {
// Create our API with a default connection to the local node
const api = await ApiPromise.create();
// subscribe to system events via storage
api.query.system.events((events) => {
console.log(`\nReceived ${events.length} events:`);
// loop through the Vec<EventRecord>
events.forEach((record) => {
// extract the phase, event and the event types
const { event, phase } = record;
const types = event.typeDef;
// show what we are busy with
console.log(`\t${event.section}:${event.method}:: (phase=${phase.toString()})`);
console.log(`\t\t${event.meta.documentation.toString()}`);
// loop through each of the parameters, displaying the type and data
event.data.forEach((data, index) => {
console.log(`\t\t\t${types[index].type}: ${data.toString()}`);
});
});
});
}
main().catch((error) => {
console.error(error);
process.exit(-1);
});
@@ -0,0 +1,18 @@
{
"name": "08_system_events",
"version": "0.1.0",
"description": "Example showing how to query and parse events",
"main": "index.js",
"author": "Jaco Greeff <jacogr@gmail.com>",
"license": "MIT",
"scripts": {
"clean": "rimraf node_modules",
"start": "node index.js"
},
"dependencies": {
"@plugnet/api": "^0.76.102"
},
"devDependencies": {
"rimraf": "^2.6.2"
}
}
@@ -0,0 +1,5 @@
# Transfer events
Display the events that occur during a transfer by sending a value to a random account
<<< @/docs/examples/promise/09_transfer_events/index.js
+55
View File
@@ -0,0 +1,55 @@
// @ts-check
// Import the API & Provider and some utility functions
const { ApiPromise } = require('@plugnet/api');
// import the test keyring (already has dev keys for Alice, Bob, Charlie, Eve & Ferdie)
const testKeyring = require('@plugnet/keyring/testing');
// utility function for random values
const { randomAsU8a } = require('@plugnet/util-crypto');
// some constants we are using in this sample
const ALICE = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
const AMOUNT = 10000;
async function main () {
// Create the API and wait until ready
const api = await ApiPromise.create();
// create an instance of our testing keyring
// If you're using ES6 module imports instead of require, just change this line to:
// const keyring = testKeyring();
const keyring = testKeyring.default();
// get the nonce for the admin key
const nonce = await api.query.system.accountNonce(ALICE);
// find the actual keypair in the keyring
const alicePair = keyring.getPair(ALICE);
// create a new random recipient
const recipient = keyring.addFromSeed(randomAsU8a(32)).address();
console.log('Sending', AMOUNT, 'from', alicePair.address(), 'to', recipient, 'with nonce', nonce.toString());
// Do the transfer and track the actual status
api.tx.balances
.transfer(recipient, AMOUNT)
.sign(alicePair, { nonce })
.send(({ events = [], status }) => {
console.log('Transaction status:', status.type);
if (status.isFinalized) {
console.log('Completed at block hash', status.asFinalized.toHex());
console.log('Events:');
events.forEach(({ phase, event: { data, method, section } }) => {
console.log('\t', phase.toString(), `: ${section}.${method}`, data.toString());
});
process.exit(0);
}
});
}
main().catch(console.error);
@@ -0,0 +1,18 @@
{
"name": "09_transfer_events",
"version": "0.1.0",
"description": "Example showing how to transfer DOTs (with events)",
"main": "index.js",
"author": "Jaco Greeff <jacogr@gmail.com>",
"license": "MIT",
"scripts": {
"clean": "rimraf node_modules",
"start": "node index.js"
},
"dependencies": {
"@plugnet/api": "^0.76.102"
},
"devDependencies": {
"rimraf": "^2.6.2"
}
}
@@ -0,0 +1,5 @@
# Chain upgrade
Performs a chain upgrade using the `sudo` module. This may brick your chain, so us it as an educational sample. (use `substrate --dev purge-chain` to remove DB and recover).
<<< @/docs/examples/promise/10_upgrade_chain/index.js
+56
View File
@@ -0,0 +1,56 @@
// @ts-check
// Import the API & Provider and some utility functions
const { ApiPromise, WsProvider } = require('@plugnet/api');
// import the test keyring (already has dev keys for Alice, Bob, Charlie, Eve & Ferdie)
const testKeyring = require('@plugnet/keyring/testing');
const fs = require('fs');
async function main () {
// Initialise the provider to connect to the local node
const provider = new WsProvider('ws://127.0.0.1:9944');
// Create the API and wait until ready (optional provider passed through)
const api = await ApiPromise.create(provider);
// retrieve the upgrade key from the chain state
const adminId = await api.query.sudo.key();
// find the actual keypair in the keyring (if this is an changed value, the key
// needs to be added to the keyring before - this assumes we have defaults, i.e.
// Alice as the key - and this already exists on the test keyring)
const keyring = testKeyring.default();
const adminPair = keyring.getPair(adminId.toString());
// retrieve the runtime to upgrade to
const code = fs.readFileSync('./test.wasm').toString('hex');
const proposal = api.tx.consensus.setCode(`0x${code}`);
console.log(`Upgrading from ${adminId}, ${code.length / 2} bytes`);
// preform the actual chain upgrade via the sudo module
api.tx.sudo
.sudo(proposal)
.signAndSend(adminPair, ({ events = [], status }) => {
console.log('Proposal status:', status.type);
if (status.isFinalized) {
console.error('You have just upgraded your chain');
console.log('Completed at block hash', status.asFinalized.toHex());
console.log('Events:');
events.forEach(({ phase, event: { data, method, section } }) => {
console.log('\t', phase.toString(), `: ${section}.${method}`, data.toString());
});
process.exit(0);
}
});
}
main().catch((error) => {
console.error(error);
process.exit(-1);
});
@@ -0,0 +1,18 @@
{
"name": "10_upgrade_chain",
"version": "0.2.0",
"description": "Example showing how to upgrade via upgradeKey",
"main": "index.js",
"author": "Jaco Greeff <jacogr@gmail.com>",
"license": "MIT",
"scripts": {
"clean": "rimraf node_modules",
"start": "node index.js"
},
"dependencies": {
"@plugnet/api": "^0.76.102"
},
"devDependencies": {
"rimraf": "^2.6.2"
}
}
Binary file not shown.
+26
View File
@@ -0,0 +1,26 @@
# ApiPromise Examples
Here you will find a list of examples that takes you through the basics of connecting to a local node, retrieving data from the Node and chain and execute transactions on the chain. It uses the [[ApiPromise]] interface.
## Prerequisites
For the following examples, you need a local node. It is usually convenient testing with:
```
substrate --dev
```
## Running the examples
From each folder, run `yarn` to install the required dependencies and then run `yarn start` to execute the example against the running node.
## Development accounts
Some of the examples use the following accounts:
- Alice: `5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ`
- Bob: `5Gw3s7q4QLkSWwknsiPtjujPv3XM4Trxi5d4PgKMMk3gfGTE`
Those accounts are easy to add if you don't have/see them. The seed of Alice's account is `Alice␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣` and the seed of Bob is... well you guess...
NOTE: Note the spaces padding Alice's key up to 32 chars.
@@ -0,0 +1,5 @@
# Simple Connect
The following example shows how to instantiate a Plugnet API object and use it to connect to a node using ApiRx.
<<< @/docs/examples/rx/01_simple_connect/index.js
@@ -0,0 +1,26 @@
// Required imports
const { zip } = require('rxjs');
const { ApiRx } = require('@plugnet/api');
const { WsProvider } = require('@plugnet/rpc-provider');
function main () {
// Initialise the provider to connect to the local node
const provider = new WsProvider('ws://127.0.0.1:9944');
// Create the API and wait until ready
const api = await ApiRx.create(provider).toPromise();
// We're using RxJs 'zip()' combination operator to get the emitted values
// of multiple observables as an array
zip(
api.rpc.system.chain(),
api.rpc.system.name(),
api.rpc.system.version()
)
// Then we subscribe to the result
.subscribe(([chain, nodeName, nodeVersion]) => {
console.log(`You are connected to chain ${chain} using ${nodeName} v${nodeVersion}`);
});
}
main().catch(console.error).finally(() => process.exit());
@@ -0,0 +1,19 @@
{
"name": "rx_01_simple_connect",
"version": "0.2.0",
"description": "Example showing how to connect using a WebSocket",
"main": "index.js",
"author": "Stefie",
"license": "MIT",
"scripts": {
"clean": "rimraf node_modules",
"start": "node index.js"
},
"dependencies": {
"@plugnet/api": "^0.76.102"
},
"devDependencies": {
"rimraf": "^2.6.2"
}
}
@@ -0,0 +1,9 @@
# Listen to new blocks
This example shows how to subscribe to new blocks.
It displays the block number every time a new block is seen by the node you are connected to.
NOTE: The example runs until you stop it with CTRL+C
<<< @/docs/examples/rx/02_listen_to_blocks/index.js
@@ -0,0 +1,19 @@
// Import the API
const { ApiRx } = require('@plugnet/api');
const { switchMap } = require('rxjs/operators');
async function main () {
// Here we don't pass the (optional) provider, connecting directly to the default
// node/port, i.e. `ws://127.0.0.1:9944`. Await for the isReady promise to ensure
// the API has connected to the node and completed the initialisation process
new ApiRx().isReady
.pipe(
switchMap((api) =>
api.rpc.chain.subscribeNewHead()
))
.subscribe((header) => {
console.log(`Chain is at block: #${header.blockNumber}`);
});
}
main().catch(console.error);
@@ -0,0 +1,18 @@
{
"name": "rx_02_listen_to_blocks",
"version": "0.2.0",
"description": "Example showing how to use subscriptions",
"main": "index.js",
"author": "Stefie",
"license": "MIT",
"scripts": {
"clean": "rimraf node_modules",
"start": "node index.js"
},
"dependencies": {
"@plugnet/api": "^0.76.102"
},
"devDependencies": {
"rimraf": "^2.6.2"
}
}
@@ -0,0 +1,5 @@
# Listen to balance changes
This example shows how to instantiate a Plugnet API object and use it to connect to a node and retrieve balance updates.
<<< @/docs/examples/rx/03_listent_to_balance_change/index.js
@@ -0,0 +1,38 @@
// Import the API and operators from RxJs
const { ApiRx } = require('@plugnet/api');
const { pairwise, startWith } = require('rxjs/operators');
// Known account we want to use (available on dev chain, with funds)
const Alice = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
async function main () {
// Create an await for the API
const api = await ApiRx.create().toPromise();
// Here we subscribe to any balance changes and update the on-screen value.
// We're using RxJs pairwise() operator to get the previous and current values as an array.
api.query.balances.freeBalance(Alice)
.pipe(
// since pairwise only starts emitting values on the second emission, we prepend an
// initial value with the startWith() operator to be able to also receive the first value
startWith('first'),
pairwise()
)
.subscribe((balance) => {
if (balance[0] === 'first') {
// Now we know that if the previous value emitted as balance[0] is `first`,
// then balance[1] is the initial value of Alice account.
console.log(`Alice ${Alice} has a balance of ${balance[1]}`);
console.log('You may leave this example running and start the "Make a transfer" example or transfer any value to Alice address');
return;
}
const change = balance[1].sub(balance[0]);
// Only display value changes
if (!change.isZero()) {
console.log(`New balance change of: ${change}`);
}
});
}
main().catch(console.error);
@@ -0,0 +1,18 @@
{
"name": "rx_03_listen_to_balance_change",
"version": "0.2.0",
"description": "Example showing how to subscribe to balance change",
"main": "index.js",
"author": "Stefie",
"license": "MIT",
"scripts": {
"clean": "rimraf node_modules",
"start": "node index.js"
},
"dependencies": {
"@plugnet/api": "^0.76.102"
},
"devDependencies": {
"rimraf": "^2.6.2"
}
}
@@ -0,0 +1,7 @@
# Unsubscribe from listening to updates
This example shows how to subscribe to and later unsubscribe from listening to block updates.
In this example we're calling the built-in unsubscribe() function after a timeOut of 20s to cleanup and unsubscribe from listening to updates.
<<< @/docs/examples/rx/04_unsubscribe/index.js
+25
View File
@@ -0,0 +1,25 @@
// Import the API
const { ApiRx } = require('@plugnet/api');
const { switchMap } = require('rxjs/operators');
async function main () {
// Create a new instance of the api
// Subscribe to chain updates and log the current block number on update.
const subscription = new ApiRx().isReady
.pipe(
switchMap((api) =>
api.rpc.chain.subscribeNewHead()
))
.subscribe((header) => {
console.log(`Chain is at block: #${header.blockNumber}`);
});
// In this example we're calling the Overvables unsubscribe() //
// function after 20s.
setTimeout(() => {
subscription.unsubscribe();
console.log('Unsubscribed');
}, 20000);
}
main().catch(console.error);
@@ -0,0 +1,18 @@
{
"name": "rx_04_unsubscribe",
"version": "0.2.0",
"description": "Example showing how to unsubscribe from a subscription",
"main": "index.js",
"author": "Stefie",
"license": "MIT",
"scripts": {
"clean": "rimraf node_modules",
"start": "node index.js"
},
"dependencies": {
"@plugnet/api": "^0.76.102"
},
"devDependencies": {
"rimraf": "^2.6.2"
}
}
@@ -0,0 +1,5 @@
# Read storage
Many important variables are available through the storage API. This example shows how to call a few of those APIs.
<<< @/docs/examples/rx/05_read_storage/index.js
+51
View File
@@ -0,0 +1,51 @@
// Import the API
const { ApiRx } = require('@plugnet/api');
// Import dependencies from RxJs
const { combineLatest, of } = require('rxjs');
const { first, switchMap } = require('rxjs/operators');
// Our address for Alice on the dev chain
const Alice = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
function main () {
// Create our API with a default connection to the local node
new ApiRx(provider).isReady
.pipe(
// Here we ake our basic chain state/storage queries
switchMap((api) => combineLatest(
of(api),
api.query.session.validators().pipe(first())
)),
switchMap(([api, validators]) => {
// In the next step, we're checking if the node has active validators.
// If it does, we're making another call to the api to get the balances for all validators
const balances = (validators && validators.length > 0)
? combineLatest(validators.map(authorityId => api.query.balances.freeBalance(authorityId).pipe(first())))
: of(null);
// We're combining the results together with the emitted value 'validators',
// which we're turning back into an observable using of()
return combineLatest(
api.query.system.accountNonce(Alice).pipe(first()),
api.query.timestamp.blockPeriod().pipe(first()),
of(validators),
balances
);
})
)
// Then we're subscribing to the emitted results
.subscribe(([accountNonce, blockPeriod, validators, validatorBalances]) => {
console.log(`accountNonce(${Alice}) ${accountNonce}`);
console.log(`blockPeriod ${blockPeriod.toNumber()} seconds`);
if (validatorBalances) {
// And lastly we print out the authorityIds and balances of all validators
console.log('validators', validators.map((authorityId, index) => ({
address: authorityId.toString(),
balance: validatorBalances[index].toString()
})));
}
});
}
main().catch(console.error).finally(_ => process.exit());
@@ -0,0 +1,18 @@
{
"name": "rx_05_read_storage",
"version": "0.2.0",
"description": "Example showing how to query storage",
"main": "index.js",
"author": "Stefie",
"license": "MIT",
"scripts": {
"clean": "rimraf node_modules",
"start": "node index.js"
},
"dependencies": {
"@plugnet/api": "^0.76.102"
},
"devDependencies": {
"rimraf": "^2.6.2"
}
}
@@ -0,0 +1,5 @@
# Make a simple transfer
This sample shows how to create a transaction to make a transfer from one an account to another.
<<< @/docs/examples/rx/06_make_transfer/index.js
@@ -0,0 +1,33 @@
// Import the API, Keyring and some utility functions
const { ApiRx } = require('@plugnet/api');
const { Keyring } = require('@plugnet/keyring');
const BOB = '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty';
async function main () {
// Instantiate the API
const api = await ApiRx.create().toPromise();
// Create an instance of the keyring
const keyring = new Keyring({ type: 's25519' });
// Add Alice to our keyring (with the known seed for the account)
const alice = keyring.addFomUri('//Alice');
// Create a extrinsic, transferring 12345 units to Bob.
api.tx.balances
// create transfer
.transfer(BOB, randomAmount)
// Sign and send the transcation
.signAndSend(alice)
// Subscribe to the status updates of the transfer
.subscribe(({ status }) => {
if (status.isFinalized) {
console.log(`Successful transfer of 12345 from Alice to Bob with hash ${status.asFinalized.toHex()}`);
} else {
console.log(`Staus of transfer: ${status.type}`);
}
});
}
main().catch(console.error).finally(_ => process.exit());
@@ -0,0 +1,18 @@
{
"name": "rx_06_make_transfer",
"version": "0.2.0",
"description": "Example showing how to make a transfer",
"main": "index.js",
"author": "Stefie",
"license": "MIT",
"scripts": {
"clean": "rimraf node_modules",
"start": "node index.js"
},
"dependencies": {
"@plugnet/api": "^0.76.102"
},
"devDependencies": {
"rimraf": "^2.6.2"
}
}
@@ -0,0 +1,5 @@
# Traverse events
Query the system events and extract information from them. This example runs until exited via Ctrl-C
<<< @/docs/examples/rx/08_system_events/index.js
@@ -0,0 +1,37 @@
// Import the API and selected RxJs operators
const { switchMap } = require('rxjs/operators');
const { ApiRx } = require('@plugnet/api');
async function main () {
// Create our API with a default connection to the local node
ApiRx.create()
.pipe(
switchMap((api) =>
// subscribe to system events via storage
api.query.system.events()
))
// Then we're subscribing to the emitted results
.subscribe((events) => {
console.log(`\nReceived ${events.length} events:`);
// loop through the Vec<EventRecord>
events.forEach((record) => {
// extract the phase, event and the event types
const { event, phase } = record;
const types = event.typeDef;
// show what we are busy with
console.log(`\t${event.section}:${event.method}:: (phase=${phase.toString()})`);
console.log(`\t\t${event.meta.documentation.toString()}`);
// loop through each of the parameters, displaying the type and data
event.data.forEach((data, index) => {
console.log(`\t\t\t${types[index].type}: ${data.toString()}`);
});
});
});
};
main().catch((error) => {
console.error(error);
process.exit(-1);
});
@@ -0,0 +1,18 @@
{
"name": "rx_08_system_events",
"version": "0.1.0",
"description": "Example showing how to query and parse events",
"main": "index.js",
"author": "Stefie",
"license": "MIT",
"scripts": {
"clean": "rimraf node_modules",
"start": "node index.js"
},
"dependencies": {
"@plugnet/api": "^0.76.102"
},
"devDependencies": {
"rimraf": "^2.6.2"
}
}
@@ -0,0 +1,5 @@
# Transfer events
Display the events that occur during a transfer by sending a value to a random account
<<< @/docs/examples/rx/09_transfer_events/index.js
@@ -0,0 +1,55 @@
// Import the API and some utility functions
const { ApiRx } = require('@plugnet/api');
// import the test keyring (already has dev keys for Alice, Bob, Charlie, Eve & Ferdie)
const testKeyring = require('@plugnet/keyring/testing');
// utility function for random values
const { randomAsU8a } = require('@plugnet/util-crypto');
// some constants we are using in this sample
const ALICE = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
const AMOUNT = 10000;
async function main () {
// Create our API with a connection to the node
const api = await ApiRx.create().toPromise();
// create an instance of our testign keyring
// If you're using ES6 module imports instead of require, just change this line to:
// const keyring = testKeyring();
const keyring = testKeyring.default();
// find the actual keypair in the keyring
const alicePair = keyring.getPair(ALICE);
// create a new random recipient
const recipient = keyring.addFromSeed(randomAsU8a(32)).address();
console.log('Sending', AMOUNT, 'from', alicePair.address(), 'to', recipient);
// get the nonce for the admin key
// Create a extrinsic, transferring 12345 units to Bob.
api.tx.balances
// Do the transfer
.transfer(recipient, AMOUNT)
// Sign and send it
.signAndSend(alicePair)
// And subscribe to the actual status
.subscribe(({ events = [], status }) => {
// Log transfer events
console.log('Transfer status:', status.type);
// Log system events once the transfer is finalised
if (status.isFinalized) {
console.log('Completed at block hash', status.asFinalized.toHex());
console.log('Events:');
events.forEach(({ phase, event: { data, method, section } }) => {
console.log('\t', phase.toString(), `: ${section}.${method}`, data.toString());
});
}
});
}
main().catch(console.error);
@@ -0,0 +1,18 @@
{
"name": "rx_09_transfer_events",
"version": "0.1.0",
"description": "Example showing how to transfer DOTs (with events)",
"main": "index.js",
"author": "Stefie",
"license": "MIT",
"scripts": {
"clean": "rimraf node_modules",
"start": "node index.js"
},
"dependencies": {
"@plugnet/api": "^0.76.102"
},
"devDependencies": {
"rimraf": "^2.6.2"
}
}
@@ -0,0 +1,5 @@
# Chain upgrade
Performs a chain upgrade using the `sudo` module. This may brick your chain, so us it as an educational sample. (use `substrate --dev purge-chain` to remove DB and recover).
<<< @/docs/examples/rx/10_upgrade_chain/index.js
@@ -0,0 +1,58 @@
// Import the API & Provider and some utility functions
const { ApiRx, WsPovider } = require('@plugnet/api');
// import the test keyring (already has dev keys for Alice, Bob, Charlie, Eve & Ferdie)
const testKeyring = require('@plugnet/keyring/testing');
const fs = require('fs');
async function main () {
// Initialise the provider to connect to the local node
const provider = new WsProvider('ws://127.0.0.1:9944');
// Create the API and wait until ready (optional provider passed through)
const api = await ApiRx.create(provider).toPromise();
// retrieve the upgrade key from the chain state
const adminId = await api.query.sudo.key().toPromise();
// find the actual keypair in the keyring (if this is an changed value, the key
// needs to be added to the keyring before - this assumes we have defaults, i.e.
// Alice as the key - and this already exists on the test keyring)
const keyring = testKeyring.default();
const adminPair = keyring.getPair(adminId.toString());
// retrieve the runtime to upgrade to
const code = fs.readFileSync('./test.wasm').toString('hex');
const proposal = api.tx.consensus.setCode(`0x${code}`);
console.log(`Upgrading chain runtime from ${adminId}`);
api.tx.sudo
// preform the actual chain upgrade via the sudo module
.sudo(proposal)
// sign and send the proposal
.signAndSend(adminPair)
// subscribe to overall result
.subscribe(({ events = [], status }) => {
// Log transfer events
console.log('Proposal status:', status.type);
if (status.isFinalized) {
console.error('You have just upgraded your chain');
console.log('Completed at block hash', status.asFinalized.toHex());
console.log('Events:');
// Log system events once the chain update is finalised
events.forEach(({ phase, event: { data, method, section } }) => {
console.log('\t', phase.toString(), `: ${section}.${method}`, data.toString());
});
process.exit(0);
}
});
}
main().catch((error) => {
console.error(error);
process.exit(-1);
});
@@ -0,0 +1,18 @@
{
"name": "rx_10_upgrade_chain",
"version": "0.2.0",
"description": "Example showing how to upgrade via upgradeKey",
"main": "index.js",
"author": "Stefie",
"license": "MIT",
"scripts": {
"clean": "rimraf node_modules",
"start": "node index.js"
},
"dependencies": {
"@plugnet/api": "^0.76.102"
},
"devDependencies": {
"rimraf": "^2.6.2"
}
}
Binary file not shown.
+26
View File
@@ -0,0 +1,26 @@
# ApiRx Examples
Here you will find a list of examples that takes you through the basics of connecting to a local node, retrieving data from the Node and chain and execute transactions on the chain. It uses the [[ApiRx]] interface.
## Prerequisites
For the following examples, you need a local node. It is usually convenient testing with:
```
substrate --dev
```
## Running the examples
From each folder, run `yarn` to install the required dependencies and then run `yarn start` to execute the example against the running node.
## Development accounts
Some of the examples use the following accounts:
- Alice: `5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ`
- Bob: `5Gw3s7q4QLkSWwknsiPtjujPv3XM4Trxi5d4PgKMMk3gfGTE`
Those accounts are easy to add if you don't have/see them. The seed of Alice's account is `Alice␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣` and the seed of Bob is... well you guess...
NOTE: Note the spaces padding Alice's key up to 32 chars.
-12
View File
@@ -1,12 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="initial-scale=0.5, maximum-scale=1">
<meta http-equiv="refresh" content="0;URL='https://polkadot.js.org/docs/api/'" />
<title>Redirecting to https://polkadot.js.org/docs/api/</title>
</head>
<body>
Redirecting to <a href="https://polkadot.js.org/docs/api/">https://polkadot.js.org/docs/api/</a>
</body>
</html>
-23
View File
@@ -1,23 +0,0 @@
// Copyright 2017-2026 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0
import baseConfig from '@polkadot/dev/config/eslint';
export default [
{
ignores: [
// see the tsconfig.eslint.json for explanation
'packages/api-augment/src/kusama/*.ts',
'packages/api-augment/src/polkadot/*.ts'
]
},
...baseConfig,
{
rules: {
// add override for any (a metric ton of them, initial conversion)
'@typescript-eslint/no-explicit-any': 'off',
// we generally use this in isFunction, not via calling
'@typescript-eslint/unbound-method': 'off'
}
}
];
-5
View File
@@ -1,5 +0,0 @@
{
"imports": {
"https://esm.sh/v90/@types/bn.js@~5.2/index.d.ts": "https://esm.sh/v90/@types/bn.js@5.1.0/index.d.ts"
}
}
+24
View File
@@ -0,0 +1,24 @@
const config = require('@plugnet/dev/config/jest');
module.exports = Object.assign({}, config, {
moduleNameMapper: {
'@plugnet/api-derive(.*)$': '<rootDir>/packages/api-derive/src/$1',
'@plugnet/api(.*)$': '<rootDir>/packages/api/src/$1',
'@plugnet/rpc-(core|provider|rx)(.*)$': '<rootDir>/packages/rpc-$1/src/$2',
'@plugnet/extrinsics(.*)$': '<rootDir>/packages/type-extrinsics/src/$1',
'@plugnet/jsonrpc(.*)$': '<rootDir>/packages/type-jsonrpc/src/$1',
'@plugnet/storage(.*)$': '<rootDir>/packages/type-storage/src/$1',
'@plugnet/types(.*)$': '<rootDir>/packages/types/src/$1'
},
modulePathIgnorePatterns: [
'<rootDir>/packages/api/build',
'<rootDir>/packages/api-derive/build',
'<rootDir>/packages/rpc-core/build',
'<rootDir>/packages/rpc-provider/build',
'<rootDir>/packages/rpc-rx/build',
'<rootDir>/packages/type-extrinsics/build',
'<rootDir>/packages/type-jsonrpc/build',
'<rootDir>/packages/type-storage/build/',
'<rootDir>/packages/types/build'
]
});
+13
View File
@@ -0,0 +1,13 @@
{
"npmClient": "yarn",
"useWorkspaces": true,
"command": {
"publish": {
"allowBranch": "master"
}
},
"packages": [
"packages/*"
],
"version": "0.78.102"
}
+22 -39
View File
@@ -1,50 +1,33 @@
{
"author": "Jaco Greeff <jacogr@gmail.com>",
"bugs": "https://github.com/polkadot-js/api/issues",
"engines": {
"node": ">=18.14"
},
"homepage": "https://github.com/polkadot-js/api#readme",
"license": "Apache-2.0",
"packageManager": "yarn@4.6.0",
"version": "0.0.0",
"private": true,
"repository": {
"type": "git",
"url": "https://github.com/polkadot-js/api.git"
},
"sideEffects": false,
"type": "module",
"version": "16.5.7-4-x",
"versions": {
"git": "16.5.7-4-x",
"npm": "16.5.6"
"engines": {
"node": ">=10.13.0",
"yarn": "^1.10.1"
},
"workspaces": [
"packages/*"
],
"resolutions": {
"babel-core": "^7.0.0-bridge.0",
"typescript": "~3.4.5"
},
"scripts": {
"build": "yarn build:interfaces && polkadot-dev-build-ts",
"build:before": "polkadot-dev-copy-dir --cd packages/typegen scripts build",
"build:interfaces": "node --loader @polkadot/dev-ts packages/typegen/scripts/polkadot-types-internal-interfaces.mjs",
"build:metadata": "yarn build:interfaces && polkadot-dev-run-test packages/types/src/metadata/v14",
"build:release": "polkadot-ci-ghact-build",
"build:rollup": "polkadot-exec-rollup --config",
"build:upgrades": "polkadot-dev-run-test upgrades/e2e",
"chain:info": "polkadot-types-chain-info",
"clean": "polkadot-dev-clean-build",
"deno": "yarn polkadot-dev-deno-map && yarn build && deno check --import-map=import_map.json mod.ts",
"lint": "polkadot-dev-run-lint",
"postinstall": "polkadot-dev-yarn-only",
"test": "polkadot-dev-run-test --env node ^e2e",
"test:node": "polkadot-dev-run-test --env node ^e2e",
"test:one": "polkadot-dev-run-test --env node"
"build": "plugnet-dev-build-ts && yarn run build:methodsdoc",
"build:htmldoc": "yarn clean && typedoc --theme default --out docs/html",
"build:methodsdoc": "node packages/types/src/scripts/MetadataMdWrapper.js",
"check": "yarn lint",
"lint": "tslint --project . && tsc --noEmit --pretty",
"clean": "plugnet-dev-clean-build",
"postinstall": "plugnet-dev-yarn-only",
"test": "jest --coverage"
},
"devDependencies": {
"@polkadot/dev": "^0.83.3",
"@polkadot/typegen": "workspace:packages/typegen",
"@types/node": "^22.10.5"
},
"resolutions": {
"typescript": "^5.5.4"
"@babel/core": "^7.4.4",
"@babel/register": "^7.4.4",
"@babel/runtime": "^7.4.4",
"@plugnet/dev": "^0.30.4",
"@polkadot/ts": "^0.1.56",
"gh-pages": "^2.0.1"
}
}
-3
View File
@@ -1,3 +0,0 @@
# @polkadot/api-augment
Generated augmentation.
-32
View File
@@ -1,32 +0,0 @@
{
"author": "Jaco Greeff <jacogr@gmail.com>",
"bugs": "https://github.com/polkadot-js/api/issues",
"description": "API generated augmentation",
"engines": {
"node": ">=18"
},
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-augment#readme",
"license": "Apache-2.0",
"name": "@polkadot/api-augment",
"repository": {
"directory": "packages/api-augment",
"type": "git",
"url": "https://github.com/polkadot-js/api.git"
},
"sideEffects": [
"./packageDetect.js",
"./packageDetect.cjs"
],
"type": "module",
"version": "16.5.7-4-x",
"main": "index.js",
"dependencies": {
"@polkadot/api-base": "16.5.7-4-x",
"@polkadot/rpc-augment": "16.5.7-4-x",
"@polkadot/types": "16.5.7-4-x",
"@polkadot/types-augment": "16.5.7-4-x",
"@polkadot/types-codec": "16.5.7-4-x",
"@polkadot/util": "^14.0.3",
"tslib": "^2.8.1"
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -1,11 +0,0 @@
// Copyright 2017-2026 @polkadot/api-augment authors & contributors
// SPDX-License-Identifier: Apache-2.0
import '../base.js';
import './consts.js';
import './errors.js';
import './events.js';
import './query.js';
import './registry.js';
import './runtime.js';
import './tx.js';
File diff suppressed because it is too large Load Diff
@@ -1,4 +0,0 @@
// Copyright 2017-2026 @polkadot/api-augment authors & contributors
// SPDX-License-Identifier: Apache-2.0
import '@polkadot/types-augment/registry/assetHubKusama';
@@ -1,584 +0,0 @@
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit
/* eslint-disable */
// import type lookup before we augment - in some environments
// this is required to allow for ambient/previous definitions
import '@polkadot/api-base/types/calls';
import type { ApiTypes, AugmentedCall, DecoratedCallBase } from '@polkadot/api-base/types';
import type { Bytes, Null, Option, Result, Text, U256, U8aFixed, Vec, bool, u128, u32 } from '@polkadot/types-codec';
import type { AnyNumber, IMethod, ITuple } from '@polkadot/types-codec/types';
import type { Extrinsic } from '@polkadot/types/interfaces/extrinsics';
import type { OpaqueMetadata } from '@polkadot/types/interfaces/metadata';
import type { ParaId } from '@polkadot/types/interfaces/parachains';
import type { AccountId32, H160, H256, RuntimeCall, Slot, SlotDuration } from '@polkadot/types/interfaces/runtime';
import type { AssetHubKusamaRuntimeOriginCaller, AssetsCommonRuntimeApiFungiblesAccessError, CumulusPrimitivesCoreCollationInfo, FrameSupportViewFunctionsViewFunctionDispatchError, FrameSupportViewFunctionsViewFunctionId, PalletReviveEvmApiDebugRpcTypesTrace, PalletReviveEvmApiDebugRpcTypesTracerType, PalletReviveEvmApiRpcTypesDryRunConfig, PalletReviveEvmApiRpcTypesGenBlock, PalletReviveEvmApiRpcTypesGenGenericTransaction, PalletReviveEvmApiRpcTypesTracingConfig, PalletReviveEvmBlockHashReceiptGasInfo, PalletRevivePrimitivesBalanceConversionError, PalletRevivePrimitivesCode, PalletRevivePrimitivesCodeUploadReturnValue, PalletRevivePrimitivesContractAccessError, PalletRevivePrimitivesContractResultExecReturnValue, PalletRevivePrimitivesContractResultInstantiateReturnValue, PalletRevivePrimitivesEthTransactError, PalletRevivePrimitivesEthTransactInfo, PalletTransactionPaymentFeeDetails, PalletTransactionPaymentRuntimeDispatchInfo, SpConsensusAuraSr25519AppSr25519Public, SpCoreCryptoKeyTypeId, SpInherentsCheckInherentsResult, SpInherentsInherentData, SpRuntimeBlock, SpRuntimeBlockLazyBlock, SpRuntimeDispatchError, SpRuntimeExtrinsicInclusionMode, SpRuntimeHeader, SpRuntimeTransactionValidityTransactionSource, SpRuntimeTransactionValidityTransactionValidityError, SpRuntimeTransactionValidityValidTransaction, SpSessionRuntimeApiOpaqueGeneratedSessionKeys, SpVersionRuntimeVersion, SpWeightsWeightV2Weight, StagingXcmV5Location, SystemParachainsCommonApisInflationInfo, XcmRuntimeApisAuthorizedAliasesError, XcmRuntimeApisAuthorizedAliasesOriginAliaser, XcmRuntimeApisConversionsError, XcmRuntimeApisDryRunCallDryRunEffects, XcmRuntimeApisDryRunError, XcmRuntimeApisDryRunXcmDryRunEffects, XcmRuntimeApisFeesError, XcmRuntimeApisTrustedQueryError, XcmVersionedAsset, XcmVersionedAssetId, XcmVersionedAssets, XcmVersionedLocation, XcmVersionedXcm } from '@polkadot/types/lookup';
import type { IExtrinsic, Observable } from '@polkadot/types/types';
export type __AugmentedCall<ApiType extends ApiTypes> = AugmentedCall<ApiType>;
export type __DecoratedCallBase<ApiType extends ApiTypes> = DecoratedCallBase<ApiType>;
declare module '@polkadot/api-base/types/calls' {
interface AugmentedCalls<ApiType extends ApiTypes> {
/** 0xbc9d89904f5b923f/ */
accountNonceApi: {
/**
* Get current account nonce of given `AccountId`.
**/
accountNonce: AugmentedCall<ApiType, (account: AccountId32 | string | Uint8Array) => Observable<u32>>;
/**
* Generic call
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0x8a8047a53a8277ec/ */
assetConversionApi: {
/**
* Returns the size of the liquidity pool for the given asset pair.
**/
getReserves: AugmentedCall<ApiType, (asset1: StagingXcmV5Location | { parents?: any; interior?: any } | string | Uint8Array, asset2: StagingXcmV5Location | { parents?: any; interior?: any } | string | Uint8Array) => Observable<Option<ITuple<[u128, u128]>>>>;
/**
* Provides a quote for [`Pallet::swap_exact_tokens_for_tokens`].,, Note that the price may have changed by the time the transaction is executed., (Use `amount_out_min` to control slippage.)
**/
quotePriceExactTokensForTokens: AugmentedCall<ApiType, (asset1: StagingXcmV5Location | { parents?: any; interior?: any } | string | Uint8Array, asset2: StagingXcmV5Location | { parents?: any; interior?: any } | string | Uint8Array, amount: u128 | AnyNumber | Uint8Array, include_fee: bool | boolean | Uint8Array) => Observable<Option<u128>>>;
/**
* Provides a quote for [`Pallet::swap_tokens_for_exact_tokens`].,, Note that the price may have changed by the time the transaction is executed., (Use `amount_in_max` to control slippage.)
**/
quotePriceTokensForExactTokens: AugmentedCall<ApiType, (asset1: StagingXcmV5Location | { parents?: any; interior?: any } | string | Uint8Array, asset2: StagingXcmV5Location | { parents?: any; interior?: any } | string | Uint8Array, amount: u128 | AnyNumber | Uint8Array, include_fee: bool | boolean | Uint8Array) => Observable<Option<u128>>>;
/**
* Generic call
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0xc1b8f0c037f97de8/ */
assetHubMigrationApi: {
/**
* Returns the block number when the migration ended.
**/
migrationEndBlock: AugmentedCall<ApiType, () => Observable<u32>>;
/**
* Returns the block number when the migration started.
**/
migrationStartBlock: AugmentedCall<ApiType, () => Observable<u32>>;
/**
* Generic call
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0xdd718d5cc53262d4/ */
auraApi: {
/**
* Return the current set of authorities.
**/
authorities: AugmentedCall<ApiType, () => Observable<Vec<SpConsensusAuraSr25519AppSr25519Public>>>;
/**
* Returns the slot duration for Aura.,, Currently, only the value provided by this type at genesis will be used.
**/
slotDuration: AugmentedCall<ApiType, () => Observable<SlotDuration>>;
/**
* Generic call
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0xd7bdd8a272ca0d65/ */
auraUnincludedSegmentApi: {
/**
* Whether it is legal to extend the chain, assuming the given block is the most, recently included one as-of the relay parent that will be built against, and, the given relay chain slot.,, This should be consistent with the logic the runtime uses when validating blocks to, avoid issues.,, When the unincluded segment is empty, i.e. `included_hash == at`, where at is the block, whose state we are querying against, this must always return `true` as long as the slot, is more recent than the included block itself.
**/
canBuildUpon: AugmentedCall<ApiType, (included_hash: H256 | string | Uint8Array, slot: Slot | AnyNumber | Uint8Array) => Observable<bool>>;
/**
* Generic call
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0x12c8e3d4d7e06de0/ */
authorizedAliasersApi: {
/**
* Returns locations allowed to alias into and act as `target`.
**/
authorizedAliasers: AugmentedCall<ApiType, (target: XcmVersionedLocation | { V3: any } | { V4: any } | { V5: any } | string | Uint8Array) => Observable<Result<Vec<XcmRuntimeApisAuthorizedAliasesOriginAliaser>, XcmRuntimeApisAuthorizedAliasesError>>>;
/**
* Returns whether `origin` is allowed to alias into and act as `target`.
**/
isAuthorizedAlias: AugmentedCall<ApiType, (origin: XcmVersionedLocation | { V3: any } | { V4: any } | { V5: any } | string | Uint8Array, target: XcmVersionedLocation | { V3: any } | { V4: any } | { V5: any } | string | Uint8Array) => Observable<Result<bool, XcmRuntimeApisAuthorizedAliasesError>>>;
/**
* Generic call
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0x40fe3ad401f8959a/ */
blockBuilder: {
/**
* Apply the given extrinsic.,, Returns an inclusion outcome which specifies if this extrinsic is included in, this block or not.
**/
applyExtrinsic: AugmentedCall<ApiType, (extrinsic: Extrinsic | IExtrinsic | string | Uint8Array) => Observable<Result<Result<Null, SpRuntimeDispatchError>, SpRuntimeTransactionValidityTransactionValidityError>>>;
/**
* Check that the inherents are valid. The inherent data will vary from chain to chain.
**/
checkInherents: AugmentedCall<ApiType, (block: SpRuntimeBlockLazyBlock | { header?: any; extrinsics?: any } | string | Uint8Array, data: SpInherentsInherentData | { data?: any } | string | Uint8Array) => Observable<SpInherentsCheckInherentsResult>>;
/**
* Finish the current block.
**/
finalizeBlock: AugmentedCall<ApiType, () => Observable<SpRuntimeHeader>>;
/**
* Generate inherent extrinsics. The inherent data will vary from chain to chain.
**/
inherentExtrinsics: AugmentedCall<ApiType, (inherent: SpInherentsInherentData | { data?: any } | string | Uint8Array) => Observable<Vec<Bytes>>>;
/**
* Generic call
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0xea93e3f16f3d6962/ */
collectCollationInfo: {
/**
* Collect information about a collation.,, The given `header` is the header of the built block for that, we are collecting the collation info for.
**/
collectCollationInfo: AugmentedCall<ApiType, (header: SpRuntimeHeader | { parentHash?: any; number?: any; stateRoot?: any; extrinsicsRoot?: any; digest?: any } | string | Uint8Array) => Observable<CumulusPrimitivesCoreCollationInfo>>;
/**
* Generic call
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0xdf6acb689907609b/ */
core: {
/**
* Execute the given block.
**/
executeBlock: AugmentedCall<ApiType, (block: SpRuntimeBlockLazyBlock | { header?: any; extrinsics?: any } | string | Uint8Array) => Observable<Null>>;
/**
* Initialize a block with the given header and return the runtime executive mode.
**/
initializeBlock: AugmentedCall<ApiType, (header: SpRuntimeHeader | { parentHash?: any; number?: any; stateRoot?: any; extrinsicsRoot?: any; digest?: any } | string | Uint8Array) => Observable<SpRuntimeExtrinsicInclusionMode>>;
/**
* Returns the version of the runtime.
**/
version: AugmentedCall<ApiType, () => Observable<SpVersionRuntimeVersion>>;
/**
* Generic call
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0x91b1c8b16328eb92/ */
dryRunApi: {
/**
* Dry run call V2.
**/
dryRunCall: AugmentedCall<ApiType, (origin: AssetHubKusamaRuntimeOriginCaller | { system: any } | { PolkadotXcm: any } | { CumulusXcm: any } | { Revive: any } | { Origins: any } | string | Uint8Array, call: RuntimeCall | IMethod | string | Uint8Array, result_xcms_version: u32 | AnyNumber | Uint8Array) => Observable<Result<XcmRuntimeApisDryRunCallDryRunEffects, XcmRuntimeApisDryRunError>>>;
/**
* Dry run XCM program
**/
dryRunXcm: AugmentedCall<ApiType, (origin_location: XcmVersionedLocation | { V3: any } | { V4: any } | { V5: any } | string | Uint8Array, xcm: XcmVersionedXcm | { V3: any } | { V4: any } | { V5: any } | string | Uint8Array) => Observable<Result<XcmRuntimeApisDryRunXcmDryRunEffects, XcmRuntimeApisDryRunError>>>;
/**
* Generic call
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0xde92b8a0426b9bf6/ */
fungiblesApi: {
/**
* Returns the list of all [`Asset`] that an `AccountId` has.
**/
queryAccountBalances: AugmentedCall<ApiType, (account: AccountId32 | string | Uint8Array) => Observable<Result<XcmVersionedAssets, AssetsCommonRuntimeApiFungiblesAccessError>>>;
/**
* Generic call
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0xfbc577b9d747efd6/ */
genesisBuilder: {
/**
* Build `RuntimeGenesisConfig` from a JSON blob not using any defaults and store it in the, storage.,, In the case of a FRAME-based runtime, this function deserializes the full, `RuntimeGenesisConfig` from the given JSON blob and puts it into the storage. If the, provided JSON blob is incorrect or incomplete or the deserialization fails, an error, is returned.,, Please note that provided JSON blob must contain all `RuntimeGenesisConfig` fields, no, defaults will be used.
**/
buildState: AugmentedCall<ApiType, (json: Bytes | string | Uint8Array) => Observable<Result<Null, Text>>>;
/**
* Returns a JSON blob representation of the built-in `RuntimeGenesisConfig` identified by, `id`.,, If `id` is `None` the function should return JSON blob representation of the default, `RuntimeGenesisConfig` struct of the runtime. Implementation must provide default, `RuntimeGenesisConfig`.,, Otherwise function returns a JSON representation of the built-in, named, `RuntimeGenesisConfig` preset identified by `id`, or `None` if such preset does not, exist. Returned `Vec<u8>` contains bytes of JSON blob (patch) which comprises a list of, (potentially nested) key-value pairs that are intended for customizing the default, runtime genesis config. The patch shall be merged (rfc7386) with the JSON representation, of the default `RuntimeGenesisConfig` to create a comprehensive genesis config that can, be used in `build_state` method.
**/
getPreset: AugmentedCall<ApiType, (id: Option<Text> | null | Uint8Array | Text | string) => Observable<Option<Bytes>>>;
/**
* Returns a list of identifiers for available builtin `RuntimeGenesisConfig` presets.,, The presets from the list can be queried with [`GenesisBuilder::get_preset`] method. If, no named presets are provided by the runtime the list is empty.
**/
presetNames: AugmentedCall<ApiType, () => Observable<Vec<Text>>>;
/**
* Generic call
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0xa2ddb6a58477bf63/ */
getParachainInfo: {
/**
* Retrieve the parachain id used for runtime.
**/
parachainId: AugmentedCall<ApiType, () => Observable<ParaId>>;
/**
* Generic call
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0xc51ff1fa3f5d0cca/ */
inflation: {
/**
* Return the current estimates of the issuance amount.,, This is marked as experimental in light of RFC#89. Nonetheless, its usage is highly, recommended over trying to read-storage, or re-create the onchain logic.
**/
experimentalIssuancePredictionInfo: AugmentedCall<ApiType, () => Observable<SystemParachainsCommonApisInflationInfo>>;
/**
* Generic call
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0x9ffb505aa738d69c/ */
locationToAccountApi: {
/**
* Converts `Location` to `AccountId`.
**/
convertLocation: AugmentedCall<ApiType, (location: XcmVersionedLocation | { V3: any } | { V4: any } | { V5: any } | string | Uint8Array) => Observable<Result<AccountId32, XcmRuntimeApisConversionsError>>>;
/**
* Generic call
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0x37e397fc7c91f5e4/ */
metadata: {
/**
* Returns the metadata of a runtime.
**/
metadata: AugmentedCall<ApiType, () => Observable<OpaqueMetadata>>;
/**
* Returns the metadata at a given version.,, If the given `version` isn't supported, this will return `None`., Use [`Self::metadata_versions`] to find out about supported metadata version of the runtime.
**/
metadataAtVersion: AugmentedCall<ApiType, (version: u32 | AnyNumber | Uint8Array) => Observable<Option<OpaqueMetadata>>>;
/**
* Returns the supported metadata versions.,, This can be used to call `metadata_at_version`.
**/
metadataVersions: AugmentedCall<ApiType, () => Observable<Vec<u32>>>;
/**
* Generic call
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0x17a6bc0d0062aeb3/ */
nominationPoolsApi: {
/**
* Returns the equivalent points of `new_funds` for a given pool.
**/
balanceToPoints: AugmentedCall<ApiType, (pool_id: u32 | AnyNumber | Uint8Array, new_funds: u128 | AnyNumber | Uint8Array) => Observable<u128>>;
/**
* Returns true if the delegated funds of the pool `member` needs migration.,, Once a pool has successfully migrated to the strategy, [`DelegateStake`](pallet_nomination_pools::adapter::DelegateStake), the funds of the, member can be migrated from pool account to the member's account. Use, [`migrate_delegation`](pallet_nomination_pools::Call::migrate_delegation), to migrate the funds of the pool member.
**/
memberNeedsDelegateMigration: AugmentedCall<ApiType, (member: AccountId32 | string | Uint8Array) => Observable<bool>>;
/**
* Returns the pending slash for a given pool member.,, If pending slash of the member exceeds `ExistentialDeposit`, it can be reported on, chain.
**/
memberPendingSlash: AugmentedCall<ApiType, (member: AccountId32 | string | Uint8Array) => Observable<u128>>;
/**
* Returns the total contribution of a pool member including any balance that is unbonding.
**/
memberTotalBalance: AugmentedCall<ApiType, (who: AccountId32 | string | Uint8Array) => Observable<u128>>;
/**
* Returns the pending rewards for the member that the AccountId was given for.
**/
pendingRewards: AugmentedCall<ApiType, (who: AccountId32 | string | Uint8Array) => Observable<u128>>;
/**
* Returns the equivalent balance of `points` for a given pool.
**/
pointsToBalance: AugmentedCall<ApiType, (pool_id: u32 | AnyNumber | Uint8Array, points: u128 | AnyNumber | Uint8Array) => Observable<u128>>;
/**
* Returns the bonded account and reward account associated with the pool_id.
**/
poolAccounts: AugmentedCall<ApiType, (pool_id: u32 | AnyNumber | Uint8Array) => Observable<ITuple<[AccountId32, AccountId32]>>>;
/**
* Total balance contributed to the pool.
**/
poolBalance: AugmentedCall<ApiType, (pool_id: u32 | AnyNumber | Uint8Array) => Observable<u128>>;
/**
* Returns true if the pool with `pool_id` needs migration.,, This can happen when the `pallet-nomination-pools` has switched to using strategy, [`DelegateStake`](pallet_nomination_pools::adapter::DelegateStake) but the pool, still has funds that were staked using the older strategy, [TransferStake](pallet_nomination_pools::adapter::TransferStake). Use, [`migrate_pool_to_delegate_stake`](pallet_nomination_pools::Call::migrate_pool_to_delegate_stake), to migrate the pool.
**/
poolNeedsDelegateMigration: AugmentedCall<ApiType, (pool_id: u32 | AnyNumber | Uint8Array) => Observable<bool>>;
/**
* Returns the pending slash for a given pool.
**/
poolPendingSlash: AugmentedCall<ApiType, (pool_id: u32 | AnyNumber | Uint8Array) => Observable<u128>>;
/**
* Generic call
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0xf78b278be53f454c/ */
offchainWorkerApi: {
/**
* Starts the off-chain task for given block header.
**/
offchainWorker: AugmentedCall<ApiType, (header: SpRuntimeHeader | { parentHash?: any; number?: any; stateRoot?: any; extrinsicsRoot?: any; digest?: any } | string | Uint8Array) => Observable<Null>>;
/**
* Generic call
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0x04e70521a0d3d2f8/ */
relayParentOffsetApi: {
/**
* Fetch the slot offset that is expected from the relay chain.
**/
relayParentOffset: AugmentedCall<ApiType, () => Observable<u32>>;
/**
* Generic call
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0x8c403e5c4a9fd442/ */
reviveApi: {
/**
* Get the account id associated to this H160 address.
**/
accountId: AugmentedCall<ApiType, (address: H160 | string | Uint8Array) => Observable<AccountId32>>;
/**
* Get the H160 address associated to this account id
**/
address: AugmentedCall<ApiType, (account_id: AccountId32 | string | Uint8Array) => Observable<H160>>;
/**
* Returns the free balance of the given `[H160]` address, using EVM decimals.
**/
balance: AugmentedCall<ApiType, (address: H160 | string | Uint8Array) => Observable<U256>>;
/**
* The address of the validator that produced the current block.
**/
blockAuthor: AugmentedCall<ApiType, () => Observable<H160>>;
/**
* Returns the block gas limit.
**/
blockGasLimit: AugmentedCall<ApiType, () => Observable<U256>>;
/**
* Perform a call from a specified account to a given contract.,, See [`crate::Pallet::bare_call`].
**/
call: AugmentedCall<ApiType, (origin: AccountId32 | string | Uint8Array, dest: H160 | string | Uint8Array, value: u128 | AnyNumber | Uint8Array, gas_limit: Option<SpWeightsWeightV2Weight> | null | Uint8Array | SpWeightsWeightV2Weight | { refTime?: any; proofSize?: any } | string, storage_deposit_limit: Option<u128> | null | Uint8Array | u128 | AnyNumber, input_data: Bytes | string | Uint8Array) => Observable<PalletRevivePrimitivesContractResultExecReturnValue>>;
/**
* The code at the specified address taking pre-compiles into account.
**/
code: AugmentedCall<ApiType, (address: H160 | string | Uint8Array) => Observable<Bytes>>;
/**
* Returns the current ETH block.,, This is one block behind the substrate block.
**/
ethBlock: AugmentedCall<ApiType, () => Observable<PalletReviveEvmApiRpcTypesGenBlock>>;
/**
* Returns the ETH block hash for the given block number.
**/
ethBlockHash: AugmentedCall<ApiType, (number: U256 | AnyNumber | Uint8Array) => Observable<Option<H256>>>;
/**
* Estimates the amount of gas that a transactions requires.,, This function estimates the gas of the transaction according to the same binary search, algorithm that's implemented in Geth. It stops when with an acceptable error ratio of, 1.5% so that the algorithm terminates early.
**/
ethEstimateGas: AugmentedCall<ApiType, (tx: PalletReviveEvmApiRpcTypesGenGenericTransaction | { accessList?: any; authorizationList?: any; blobVersionedHashes?: any; blobs?: any; chainId?: any; from?: any; gas?: any; gasPrice?: any; input?: any; maxFeePerBlobGas?: any; maxFeePerGas?: any; maxPriorityFeePerGas?: any; nonce?: any; to?: any; r_type?: any; value?: any } | string | Uint8Array, config: PalletReviveEvmApiRpcTypesDryRunConfig | { timestampOverride?: any; performBalanceChecks?: any; stateOverrides?: any } | string | Uint8Array) => Observable<Result<U256, PalletRevivePrimitivesEthTransactError>>>;
/**
* Return the pre-dispatch weight booked for the signed Ethereum transaction payload.
**/
ethPreDispatchWeight: AugmentedCall<ApiType, (tx: Bytes | string | Uint8Array) => Observable<Result<SpWeightsWeightV2Weight, PalletRevivePrimitivesEthTransactError>>>;
/**
* The details needed to reconstruct the receipt information offchain.,, # Note,, Each entry corresponds to the appropriate Ethereum transaction in the current block.
**/
ethReceiptData: AugmentedCall<ApiType, () => Observable<Vec<PalletReviveEvmBlockHashReceiptGasInfo>>>;
/**
* Perform an Ethereum call.,, Deprecated use `v2` version instead., See [`crate::Pallet::dry_run_eth_transact`]
**/
ethTransact: AugmentedCall<ApiType, (tx: PalletReviveEvmApiRpcTypesGenGenericTransaction | { accessList?: any; authorizationList?: any; blobVersionedHashes?: any; blobs?: any; chainId?: any; from?: any; gas?: any; gasPrice?: any; input?: any; maxFeePerBlobGas?: any; maxFeePerGas?: any; maxPriorityFeePerGas?: any; nonce?: any; to?: any; r_type?: any; value?: any } | string | Uint8Array) => Observable<Result<PalletRevivePrimitivesEthTransactInfo, PalletRevivePrimitivesEthTransactError>>>;
/**
* Perform an Ethereum call.,, See [`crate::Pallet::dry_run_eth_transact`]
**/
ethTransactWithConfig: AugmentedCall<ApiType, (tx: PalletReviveEvmApiRpcTypesGenGenericTransaction | { accessList?: any; authorizationList?: any; blobVersionedHashes?: any; blobs?: any; chainId?: any; from?: any; gas?: any; gasPrice?: any; input?: any; maxFeePerBlobGas?: any; maxFeePerGas?: any; maxPriorityFeePerGas?: any; nonce?: any; to?: any; r_type?: any; value?: any } | string | Uint8Array, config: PalletReviveEvmApiRpcTypesDryRunConfig | { timestampOverride?: any; performBalanceChecks?: any; stateOverrides?: any } | string | Uint8Array) => Observable<Result<PalletRevivePrimitivesEthTransactInfo, PalletRevivePrimitivesEthTransactError>>>;
/**
* Returns the gas price.
**/
gasPrice: AugmentedCall<ApiType, () => Observable<U256>>;
/**
* Query a given storage key in a given contract.,, Returns `Ok(Some(Vec<u8>))` if the storage value exists under the given key in the, specified account and `Ok(None)` if it doesn't. If the account specified by the address, doesn't exist, or doesn't have a contract then `Err` is returned.
**/
getStorage: AugmentedCall<ApiType, (address: H160 | string | Uint8Array, key: U8aFixed | string | Uint8Array) => Observable<Result<Option<Bytes>, PalletRevivePrimitivesContractAccessError>>>;
/**
* Query a given variable-sized storage key in a given contract.,, Returns `Ok(Some(Vec<u8>))` if the storage value exists under the given key in the, specified account and `Ok(None)` if it doesn't. If the account specified by the address, doesn't exist, or doesn't have a contract then `Err` is returned.
**/
getStorageVarKey: AugmentedCall<ApiType, (address: H160 | string | Uint8Array, key: Bytes | string | Uint8Array) => Observable<Result<Option<Bytes>, PalletRevivePrimitivesContractAccessError>>>;
/**
* Instantiate a new contract.,, See `[crate::Pallet::bare_instantiate]`.
**/
instantiate: AugmentedCall<ApiType, (origin: AccountId32 | string | Uint8Array, value: u128 | AnyNumber | Uint8Array, gas_limit: Option<SpWeightsWeightV2Weight> | null | Uint8Array | SpWeightsWeightV2Weight | { refTime?: any; proofSize?: any } | string, storage_deposit_limit: Option<u128> | null | Uint8Array | u128 | AnyNumber, code: PalletRevivePrimitivesCode | { Upload: any } | { Existing: any } | string | Uint8Array, data: Bytes | string | Uint8Array, salt: Option<U8aFixed> | null | Uint8Array | U8aFixed | string) => Observable<PalletRevivePrimitivesContractResultInstantiateReturnValue>>;
/**
* Returns the block gas limit as calculated from the weights.
**/
maxExtrinsicWeightInGas: AugmentedCall<ApiType, () => Observable<U256>>;
/**
* Construct the new balance and dust components of this EVM balance.
**/
newBalanceWithDust: AugmentedCall<ApiType, (balance: U256 | AnyNumber | Uint8Array) => Observable<Result<ITuple<[u128, u32]>, PalletRevivePrimitivesBalanceConversionError>>>;
/**
* Returns the nonce of the given `[H160]` address.
**/
nonce: AugmentedCall<ApiType, (address: H160 | string | Uint8Array) => Observable<u32>>;
/**
* The address used to call the runtime's pallets dispatchables
**/
runtimePalletsAddress: AugmentedCall<ApiType, () => Observable<H160>>;
/**
* Traces the execution of an entire block and returns call traces.,, This is intended to be called through `state_call` to replay the block from the, parent block.,, See eth-rpc `debug_traceBlockByNumber` for usage.
**/
traceBlock: AugmentedCall<ApiType, (block: SpRuntimeBlock | { header?: any; extrinsics?: any } | string | Uint8Array, config: PalletReviveEvmApiDebugRpcTypesTracerType | { CallTracer: any } | { PrestateTracer: any } | { ExecutionTracer: any } | string | Uint8Array) => Observable<Vec<ITuple<[u32, PalletReviveEvmApiDebugRpcTypesTrace]>>>>;
/**
* Dry run and return the trace of the given call.,, See eth-rpc `debug_traceCall` for usage.
**/
traceCall: AugmentedCall<ApiType, (tx: PalletReviveEvmApiRpcTypesGenGenericTransaction | { accessList?: any; authorizationList?: any; blobVersionedHashes?: any; blobs?: any; chainId?: any; from?: any; gas?: any; gasPrice?: any; input?: any; maxFeePerBlobGas?: any; maxFeePerGas?: any; maxPriorityFeePerGas?: any; nonce?: any; to?: any; r_type?: any; value?: any } | string | Uint8Array, config: PalletReviveEvmApiDebugRpcTypesTracerType | { CallTracer: any } | { PrestateTracer: any } | { ExecutionTracer: any } | string | Uint8Array) => Observable<Result<PalletReviveEvmApiDebugRpcTypesTrace, PalletRevivePrimitivesEthTransactError>>>;
/**
* Dry run and return the trace of the given call with additional configuration.,, Like [`Self::trace_call`], but accepts a [`TracingConfig`] that can carry state, overrides and future extensibility. The config must be the **last argument** for, backwards compatibility see [`TracingConfig`] documentation.
**/
traceCallWithConfig: AugmentedCall<ApiType, (tx: PalletReviveEvmApiRpcTypesGenGenericTransaction | { accessList?: any; authorizationList?: any; blobVersionedHashes?: any; blobs?: any; chainId?: any; from?: any; gas?: any; gasPrice?: any; input?: any; maxFeePerBlobGas?: any; maxFeePerGas?: any; maxPriorityFeePerGas?: any; nonce?: any; to?: any; r_type?: any; value?: any } | string | Uint8Array, tracer_type: PalletReviveEvmApiDebugRpcTypesTracerType | { CallTracer: any } | { PrestateTracer: any } | { ExecutionTracer: any } | string | Uint8Array, config: PalletReviveEvmApiRpcTypesTracingConfig | { stateOverrides?: any } | string | Uint8Array) => Observable<Result<PalletReviveEvmApiDebugRpcTypesTrace, PalletRevivePrimitivesEthTransactError>>>;
/**
* Traces the execution of a specific transaction within a block.,, This is intended to be called through `state_call` to replay the block from the, parent hash up to the transaction.,, See eth-rpc `debug_traceTransaction` for usage.
**/
traceTx: AugmentedCall<ApiType, (block: SpRuntimeBlock | { header?: any; extrinsics?: any } | string | Uint8Array, tx_index: u32 | AnyNumber | Uint8Array, config: PalletReviveEvmApiDebugRpcTypesTracerType | { CallTracer: any } | { PrestateTracer: any } | { ExecutionTracer: any } | string | Uint8Array) => Observable<Option<PalletReviveEvmApiDebugRpcTypesTrace>>>;
/**
* Upload new code without instantiating a contract from it.,, See [`crate::Pallet::bare_upload_code`].
**/
uploadCode: AugmentedCall<ApiType, (origin: AccountId32 | string | Uint8Array, code: Bytes | string | Uint8Array, storage_deposit_limit: Option<u128> | null | Uint8Array | u128 | AnyNumber) => Observable<Result<PalletRevivePrimitivesCodeUploadReturnValue, SpRuntimeDispatchError>>>;
/**
* Generic call
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0xccd9de6396c899ca/ */
runtimeViewFunction: {
/**
* Execute a view function query.
**/
executeViewFunction: AugmentedCall<ApiType, (query_id: FrameSupportViewFunctionsViewFunctionId | { prefix?: any; suffix?: any } | string | Uint8Array, input: Bytes | string | Uint8Array) => Observable<Result<Bytes, FrameSupportViewFunctionsViewFunctionDispatchError>>>;
/**
* Generic call
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0xab3c0572291feb8b/ */
sessionKeys: {
/**
* Decode the given public session keys.,, Returns the list of public raw public keys + key type.
**/
decodeSessionKeys: AugmentedCall<ApiType, (encoded: Bytes | string | Uint8Array) => Observable<Option<Vec<ITuple<[Bytes, SpCoreCryptoKeyTypeId]>>>>>;
/**
* Generate a set of session keys with optionally using the given seed., The keys should be stored within the keystore exposed via runtime, externalities.,, The seed needs to be a valid `utf8` string.,, Returns the concatenated SCALE encoded public keys.
**/
generateSessionKeys: AugmentedCall<ApiType, (owner: Bytes | string | Uint8Array, seed: Option<Bytes> | null | Uint8Array | Bytes | string) => Observable<SpSessionRuntimeApiOpaqueGeneratedSessionKeys>>;
/**
* Generic call
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0x18ef58a3b67ba770/ */
stakingApi: {
/**
* Returns the page count of exposures for a validator `account` in a given era.
**/
erasStakersPageCount: AugmentedCall<ApiType, (era: u32 | AnyNumber | Uint8Array, account: AccountId32 | string | Uint8Array) => Observable<u32>>;
/**
* Returns the nominations quota for a nominator with a given balance.
**/
nominationsQuota: AugmentedCall<ApiType, (balance: u128 | AnyNumber | Uint8Array) => Observable<u32>>;
/**
* Returns true if a validator `account` has pages to be claimed for the given era.
**/
pendingRewards: AugmentedCall<ApiType, (era: u32 | AnyNumber | Uint8Array, account: AccountId32 | string | Uint8Array) => Observable<bool>>;
/**
* Generic call
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0xd2bc9897eed08f15/ */
taggedTransactionQueue: {
/**
* Validate the transaction.,, This method is invoked by the transaction pool to learn details about given transaction., The implementation should make sure to verify the correctness of the transaction, against current state. The given `block_hash` corresponds to the hash of the block, that is used as current state.,, Note that this call may be performed by the pool multiple times and transactions, might be verified in any possible order.
**/
validateTransaction: AugmentedCall<ApiType, (source: SpRuntimeTransactionValidityTransactionSource | 'InBlock' | 'Local' | 'External' | number | Uint8Array, tx: Extrinsic | IExtrinsic | string | Uint8Array, block_hash: H256 | string | Uint8Array) => Observable<Result<SpRuntimeTransactionValidityValidTransaction, SpRuntimeTransactionValidityTransactionValidityError>>>;
/**
* Generic call
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0x37c8bb1350a9a2a8/ */
transactionPaymentApi: {
/**
*
**/
queryFeeDetails: AugmentedCall<ApiType, (uxt: Extrinsic | IExtrinsic | string | Uint8Array, len: u32 | AnyNumber | Uint8Array) => Observable<PalletTransactionPaymentFeeDetails>>;
/**
*
**/
queryInfo: AugmentedCall<ApiType, (uxt: Extrinsic | IExtrinsic | string | Uint8Array, len: u32 | AnyNumber | Uint8Array) => Observable<PalletTransactionPaymentRuntimeDispatchInfo>>;
/**
*
**/
queryLengthToFee: AugmentedCall<ApiType, (length: u32 | AnyNumber | Uint8Array) => Observable<u128>>;
/**
*
**/
queryWeightToFee: AugmentedCall<ApiType, (weight: SpWeightsWeightV2Weight | { refTime?: any; proofSize?: any } | string | Uint8Array) => Observable<u128>>;
/**
* Generic call
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0xf3ff14d5ab527059/ */
transactionPaymentCallApi: {
/**
* Query fee details of a given encoded `Call`.
**/
queryCallFeeDetails: AugmentedCall<ApiType, (call: RuntimeCall | IMethod | string | Uint8Array, len: u32 | AnyNumber | Uint8Array) => Observable<PalletTransactionPaymentFeeDetails>>;
/**
* Query information of a dispatch class, weight, and fee of a given encoded `Call`.
**/
queryCallInfo: AugmentedCall<ApiType, (call: RuntimeCall | IMethod | string | Uint8Array, len: u32 | AnyNumber | Uint8Array) => Observable<PalletTransactionPaymentRuntimeDispatchInfo>>;
/**
* Query the output of the current `LengthToFee` given some input.
**/
queryLengthToFee: AugmentedCall<ApiType, (length: u32 | AnyNumber | Uint8Array) => Observable<u128>>;
/**
* Query the output of the current `WeightToFee` given some input.
**/
queryWeightToFee: AugmentedCall<ApiType, (weight: SpWeightsWeightV2Weight | { refTime?: any; proofSize?: any } | string | Uint8Array) => Observable<u128>>;
/**
* Generic call
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0x2609be83ac4468dc/ */
trustedQueryApi: {
/**
* Returns if the location is a trusted reserve for the asset.,, # Arguments, * `asset`: `VersionedAsset`., * `location`: `VersionedLocation`.
**/
isTrustedReserve: AugmentedCall<ApiType, (asset: XcmVersionedAsset | { V3: any } | { V4: any } | { V5: any } | string | Uint8Array, location: XcmVersionedLocation | { V3: any } | { V4: any } | { V5: any } | string | Uint8Array) => Observable<Result<bool, XcmRuntimeApisTrustedQueryError>>>;
/**
* Returns if the asset can be teleported to the location.,, # Arguments, * `asset`: `VersionedAsset`., * `location`: `VersionedLocation`.
**/
isTrustedTeleporter: AugmentedCall<ApiType, (asset: XcmVersionedAsset | { V3: any } | { V4: any } | { V5: any } | string | Uint8Array, location: XcmVersionedLocation | { V3: any } | { V4: any } | { V5: any } | string | Uint8Array) => Observable<Result<bool, XcmRuntimeApisTrustedQueryError>>>;
/**
* Generic call
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0x6ff52ee858e6c5bd/ */
xcmPaymentApi: {
/**
* Returns a list of acceptable payment assets.,, # Arguments,, * `xcm_version`: Version.
**/
queryAcceptablePaymentAssets: AugmentedCall<ApiType, (xcm_version: u32 | AnyNumber | Uint8Array) => Observable<Result<Vec<XcmVersionedAssetId>, XcmRuntimeApisFeesError>>>;
/**
* Query delivery fees V2.,, Get delivery fees for sending a specific `message` to a `destination`., These always come in a specific asset, defined by the chain.,, # Arguments, * `message`: The message that'll be sent, necessary because most delivery fees are based on the, size of the message., * `destination`: The destination to send the message to. Different destinations may use, different senders that charge different fees.
**/
queryDeliveryFees: AugmentedCall<ApiType, (destination: XcmVersionedLocation | { V3: any } | { V4: any } | { V5: any } | string | Uint8Array, message: XcmVersionedXcm | { V3: any } | { V4: any } | { V5: any } | string | Uint8Array, asset_id: XcmVersionedAssetId | { V3: any } | { V4: any } | { V5: any } | string | Uint8Array) => Observable<Result<XcmVersionedAssets, XcmRuntimeApisFeesError>>>;
/**
* Converts a weight into a fee for the specified `AssetId`.,, # Arguments,, * `weight`: convertible `Weight`., * `asset`: `VersionedAssetId`.
**/
queryWeightToAssetFee: AugmentedCall<ApiType, (weight: SpWeightsWeightV2Weight | { refTime?: any; proofSize?: any } | string | Uint8Array, asset: XcmVersionedAssetId | { V3: any } | { V4: any } | { V5: any } | string | Uint8Array) => Observable<Result<u128, XcmRuntimeApisFeesError>>>;
/**
* Returns a weight needed to execute a XCM.,, # Arguments,, * `message`: `VersionedXcm`.
**/
queryXcmWeight: AugmentedCall<ApiType, (message: XcmVersionedXcm | { V3: any } | { V4: any } | { V5: any } | string | Uint8Array) => Observable<Result<SpWeightsWeightV2Weight, XcmRuntimeApisFeesError>>>;
/**
* Generic call
**/
[key: string]: DecoratedCallBase<ApiType>;
};
} // AugmentedCalls
} // declare module

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