Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e6b533539 | ||
|
|
224803f4c4 | ||
|
|
9fbf4bf478 | ||
|
|
385150bd81 | ||
|
|
14216a42a3 | ||
|
|
0055cb594f | ||
|
|
63e08d8357 | ||
|
|
c9f9e2ec8a | ||
|
|
019f1f761f | ||
|
|
c91e72b60b | ||
|
|
e4cf97d71e | ||
|
|
dcdbd2ca40 | ||
|
|
13ae360c7a | ||
|
|
6c0d683235 | ||
|
|
6fc35d641a | ||
|
|
d79c0ea28d | ||
|
|
486412d051 | ||
|
|
f3f1807013 | ||
|
|
d9e581fbdc | ||
|
|
89ebae9d78 | ||
|
|
071d872adf | ||
|
|
1b6d6d970c | ||
|
|
9f5be747e7 | ||
|
|
86cb0962bc | ||
|
|
75884d22a3 | ||
|
|
a4d09f799d | ||
|
|
85a29de479 | ||
|
|
ed2e44ac93 | ||
|
|
c88d284a5c | ||
|
|
daaa16523d | ||
|
|
116714a8f9 | ||
|
|
5c1f7fb527 | ||
|
|
8a69bc4458 | ||
|
|
a8dd059097 | ||
|
|
1204ac37f6 | ||
|
|
b2f03e500e | ||
|
|
de90242456 | ||
|
|
a7ffe44ae6 | ||
|
|
ac5bfeda39 | ||
|
|
73a184ec7d | ||
|
|
e4371684b6 | ||
|
|
382e903b8f | ||
|
|
6b6b7fe145 | ||
|
|
1f4e7638d5 | ||
|
|
4d95d622a9 | ||
|
|
327c20ddea | ||
|
|
04f6d352d9 | ||
|
|
c14a071b74 | ||
|
|
f103863fdd | ||
|
|
3c7c79f18f | ||
|
|
4e30fab9d6 |
+1
-1
@@ -1 +1 @@
|
||||
6
|
||||
5
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
version: 2
|
||||
jobs:
|
||||
build:
|
||||
branches:
|
||||
ignore:
|
||||
- gh-pages
|
||||
working_directory: ~/polkadot-js
|
||||
docker:
|
||||
- image: circleci/node:10
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: dependency-cache-{{ checksum "yarn.lock" }}
|
||||
- run:
|
||||
name: install-deps
|
||||
command: yarn install --frozen-lockfile
|
||||
- save_cache:
|
||||
key: dependency-cache-{{ checksum "yarn.lock" }}
|
||||
paths:
|
||||
- ./node_modules
|
||||
- ~/.cache/yarn
|
||||
- run:
|
||||
name: build
|
||||
command: yarn polkadot-dev-circleci-build
|
||||
@@ -1,8 +0,0 @@
|
||||
exclude_patterns:
|
||||
- "**/*.spec.js"
|
||||
- "**/*.spec.ts"
|
||||
- "**/*.test.js"
|
||||
- "**/*.test.ts"
|
||||
- "docs/**/*.js"
|
||||
- "packages/types/src/interfaces/"
|
||||
- "packages/types/src/scripts/"
|
||||
@@ -1,3 +0,0 @@
|
||||
**/build/*
|
||||
**/coverage/*
|
||||
**/node_modules/*
|
||||
@@ -1,12 +0,0 @@
|
||||
const base = require('@polkadot/dev/config/eslint');
|
||||
|
||||
module.exports = {
|
||||
...base,
|
||||
rules: {
|
||||
...base.rules,
|
||||
// add override for any (a metric ton of them, initial conversion)
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
// these should be removed, there are 8 of them as errors
|
||||
'@typescript-eslint/no-non-null-assertion': 'off'
|
||||
}
|
||||
};
|
||||
@@ -11,7 +11,6 @@ tmp/
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
.npmrc
|
||||
.rpt2_cache
|
||||
cc-test-reporter
|
||||
lerna-debug.log*
|
||||
npm-debug.log*
|
||||
|
||||
-28
@@ -1,28 +0,0 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "10"
|
||||
env:
|
||||
global:
|
||||
- CC_TEST_REPORTER_ID=b8983d04997f43ff9b9df9aa92904967547680e2a229af812b3cf14985713e84
|
||||
- GH_PAGES_SRC="build-docs"
|
||||
cache:
|
||||
yarn: true
|
||||
directories:
|
||||
- node_modules
|
||||
before_install:
|
||||
- curl -o- -L https://yarnpkg.com/install.sh | bash
|
||||
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
||||
- chmod +x ./cc-test-reporter
|
||||
- export PATH=$HOME/.yarn/bin::$(yarn global bin):$PATH
|
||||
before_script:
|
||||
- ./cc-test-reporter before-build
|
||||
script:
|
||||
- yarn polkadot-dev-travis-build
|
||||
after_script:
|
||||
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
||||
deploy:
|
||||
skip_cleanup: true
|
||||
provider: script
|
||||
script: yarn polkadot-dev-travis-deploy
|
||||
on:
|
||||
branch: master
|
||||
+3
-107
@@ -1,82 +1,3 @@
|
||||
# 0.90.1
|
||||
|
||||
If you are upgrading form an older version, use the CHANGELOG hand-in-hand with the [migration guide](UPGRADING.md).
|
||||
|
||||
- **Breaking change** `api.rpc.chain.subscribeNewHeads` is now available as opposed to the old `subscribeNewHead`. This aligns with the Substrate implementation.
|
||||
- **Breaking change** Substrate 2.x & Polkadot master has moved both `BlockNumber` & `Index` to `u32`. The API tracks these closely. If you are running a chain with `u64` values (for either), pass the type override to the API on creation, e.g. `ApiPromise.create({ types: { BlockNumber: 'u64', Index: 'u64' } })` to avoid getting warnings about mismatched types.
|
||||
- **Breaking change** `Api.create(...)` and `new Api(...)` now only takes an options Object, so if you passed the provider directly previously, you need to swap the use to `Api.create({ provider: ... })`
|
||||
- **Breaking change** Runtime types have been extended and moved to definitions instead of classes
|
||||
- Primitive types for `i*` and `u*` (e.g. `u32`) are now only available in their lowercase versions. Additionally `Vector` is now only available as `Vec`, and `Method` has been renamed to `Call`, in both cases aligning with Rust.
|
||||
- `Moment` now implements as `u64` as per the Substrate codebase. (It it up to the user to interpret, for substrate 2.x it is not mili-second resolution)
|
||||
- For creation of types, it is recommended to use `createType(<TypeName>, <value>)` instead of e.g. `new Proposal(...)`. When passing these to methods/queries, construction should not be needed, the raw value can be passed.
|
||||
- For moved types, a previous import would have been from `@polkadot/types`, i.e. `import { SetIndex } from '@polkadot/types`, now just the interfaces (TypeScript) are available via `import { SetIndex } from '@polkadot/types/interfaces`
|
||||
- `usize` is now a blacklisted type that will throw on construction. Since it is platform-specific, it creates incompatibilities between native (generally `u64`) and WASM (always `u32`) code. Use one of the `u32` or `u64` types explicitly.
|
||||
- Support substrate v7 metadata
|
||||
- The `Method.findFunction(callIndex)` (allowing decoding of raw data), is now available on `api.findCall(callIndex)`. To keep backwards compatibility, it is still available on `GenericCall.findMethod` but the `api.findCall` is recommended and suggested.
|
||||
- The `types/codec/createType` has been moved to `types/codec/create` with the same exports. If you explicitly imported from here (and not doing the suggested `import { createType } from '@polkadot/types`), the reference needs to be updated
|
||||
|
||||
|
||||
# 0.82.0-beta.x
|
||||
|
||||
- Support for substrate 2.x (master) has been extended,
|
||||
- Additional types have been addedd for the modules
|
||||
- `api.derive.contract` is now `api.derive.contracts` to align with the substrate 2.x rename. (Feture detection is used so it supports both 1.x and 2.x chains)
|
||||
- Addition of `api.derive.elections`
|
||||
|
||||
- Support latest substrate 2 v6 metadata with module constants using `api.consts`.
|
||||
- The api now uses the module name for the storage methods, aligning module names for consistency with transactions. The methods of the grandpa module moved from `api.query.grandpaFinality` to `api.query.grandpa`.
|
||||
- Internally the `@polkadot/extrinsics` and `@polkadot/storage` have been moved to `@polkadot/api-metadata` and are now accessible as `@polkadot/api-metadata/extrinsics` and `@polkadot/api-metadata/storage`, respectively.
|
||||
- **Breaking Change** Vote interface extends U8a instead of i8. Vote properties can be accessed via the `isAye`, `isNay`, and `conviction` getters. Votes can still be constructed as before with a raw JS boolean, a SCALE encoded Boolean, an i8 number, or a JS object with properties `aye` and `conviction` defined.
|
||||
|
||||
- Support V2 Extrinsics in addition to V1, v2 includes an optional `tip`
|
||||
- In addition to this support, the `Signer` interface has deprecated the `sign` method and replaced it with `signPayload`
|
||||
- Support for the `sign` interfaces (API detection and calling when `signPayload` is not available) will be removed in subsequent versions.
|
||||
|
||||
- The `ContractsAbi` type has been moved from `@polkadot/types` to `import { Abi } from '@polkadot/api-contract`. This paves the way for an enhanced contracts interface, instead of dealing with low-level API calls.
|
||||
|
||||
|
||||
# 0.81.1
|
||||
|
||||
- The dependency on `@polkadot/keyring` has been removed - if you relied on the API to provide this, you would now need to manually add it
|
||||
- `createType` allows for the creation of `[u8; <length>]` types (opening the door for contract support)
|
||||
- `api.derive.staking.info` now returns the `rewardDestination`
|
||||
- Fix for disconnection when default providers (non-specified) are used
|
||||
- Don't console.log type decoding errors and then throw, only re-throw with additional info
|
||||
- Support latest substrate 2.x v5 metadata
|
||||
- Add `ApprovalFlag`, `SetIndex`, `VoterInfo` types for council as per substrate
|
||||
- Update `ContractInfo` to match substrate master
|
||||
|
||||
- Add support for new inherent digests from substrate.
|
||||
- **Breaking change** Because of the new `Seal`, the old/new Seals are not compatible. If you were using the old `Seal` from the `Digest`s, you would now use `isSealV0` for the pre-substrate 1.0 version and the new `isSeal` for the current version
|
||||
- Update `HeaderExtended` to retrieve author information from substrate 2.x (new `PreRuntime` digests)
|
||||
|
||||
- Cater for `Vec`, `Option`, `Result`, tuples and fixed vectors for contracts ABIs
|
||||
- Additional examples for subscriptions using multi
|
||||
- Add `off` method to `Api` (Base, for both `ApiPromise` & `ApiRx`) to remove an event listener
|
||||
|
||||
|
||||
# 0.80.1
|
||||
|
||||
- Support for mortal transactions
|
||||
- Better DoubleMap storage support
|
||||
- api-derive cleanups, including additional info for balances.all and taking.info returning redeemable and locked balances
|
||||
- Added SignaturePayloadRaw for better offline signing support
|
||||
- Updated metadata for current substrate master
|
||||
- Misc. cleanups and fixes
|
||||
|
||||
|
||||
# 0.79.1
|
||||
|
||||
- DoubleMap query support
|
||||
- Support latest EventRecord metadata (substrate master)
|
||||
- Introduce RuntimeVersion type overrides in api/nodeCompat.ts
|
||||
- Add `api.queryMulti` and `api.query.<module>.<method>.multi`
|
||||
- Convert `api.derive.*` to use multi queries
|
||||
- `types/codec/Set` now extends the base JS `Set` (**breaking change**: `set.values` -> `set.strings`)
|
||||
- Breaking: rename `meta.arguments` to `meta.args` in function metadata (`arguments` is a JS reserved word)
|
||||
- Add `toRawType` on all type classes (breakdown into primitive types)
|
||||
|
||||
|
||||
# 0.78.1
|
||||
|
||||
- Fix linked-maps (not working since 0.77.1)
|
||||
@@ -87,13 +8,11 @@ If you are upgrading form an older version, use the CHANGELOG hand-in-hand with
|
||||
- Do type assertion on all exposed asXXX getters
|
||||
- Metadata updates for substrate (WithdrawReasons, ContractInfo)
|
||||
|
||||
|
||||
# 0.77.1
|
||||
|
||||
- Support Metadata v4, which introduces the use of a custom hasher to hash storage map keys.
|
||||
- Add TresuryProposal (not the same as democracy, type aliassed)
|
||||
|
||||
|
||||
# 0.76.1
|
||||
|
||||
- Caching improvements (duplicate queries, no duplicate subscriptions)
|
||||
@@ -101,22 +20,17 @@ If you are upgrading form an older version, use the CHANGELOG hand-in-hand with
|
||||
- Update @polkadot/keyring to enable Alice's stash account on dev chains
|
||||
- Update @polkadot/util-crypto with smaller footprint
|
||||
|
||||
|
||||
# 0.75.1
|
||||
|
||||
- Start journey to 1.0
|
||||
|
||||
|
||||
# 0.53.1
|
||||
|
||||
- Change spelling to US English as per substrate master (1.0-rc1). Breaking changes as a result:
|
||||
- For extrinsic status results, if you have checked the type returns, i.e. `result.type === 'Finalised'` now check on the status for `result.status.isFinalized` or `result.status.isBroadcast`, ... (the `type` property is now accessible only on `result.status.type`)
|
||||
- If using `subscribeFinalisedHeads` update this to `subscribeFinalizedHeads` (likewise `getFinalisedHead` should be updated to `getFinalizedHead` and `derive.bestNumberFinalized`)
|
||||
|
||||
- The underlying ss58 addess checksums have changed
|
||||
- The updated keyring with support for this has been made available
|
||||
- All examples have been updated with sr25519 addresses (with the new checksums)
|
||||
|
||||
- The underlying ss58 addess checksums have changed in the keyring along with the latest specs
|
||||
- All examples have been updated with sr25519 addresses (with the new checksums)
|
||||
|
||||
# 0.52.1
|
||||
|
||||
@@ -127,42 +41,35 @@ If you are upgrading form an older version, use the CHANGELOG hand-in-hand with
|
||||
- Allow parsing of V3 metadata with DoubleMap support
|
||||
- Check for single instances for api and types as they are loaded (assertSingletonPackage)
|
||||
|
||||
|
||||
# 0.51.1
|
||||
|
||||
- Support metadata V2 as per latest substrate master
|
||||
- Update metadata with new types as per lastest substrate master
|
||||
|
||||
|
||||
# 0.50.1
|
||||
|
||||
- Lastest util-crypto (usage of WASM with JS fallbacks if not available)
|
||||
- Update upstream @polkadot dependencies (for new crypto)
|
||||
|
||||
|
||||
# 0.49.1
|
||||
|
||||
- Fix large message signing on non-known nodes (default is now hashing, there has been enough time between upgrades)
|
||||
|
||||
|
||||
# 0.48.1
|
||||
|
||||
- Pull in new sr25519 capable keyring for dev nodes
|
||||
- When using dev mode, it assumes that the node is the latest with derived sr25519 keys
|
||||
|
||||
|
||||
# 0.47.1
|
||||
|
||||
- Swap to publishing -beta.x on merge (non-breaking testing)
|
||||
|
||||
|
||||
# 0.46.1
|
||||
|
||||
- Extended type registration to now handle internal types as well. Additionally the built-in Extrinsic type can now we overridden with a custom version.
|
||||
- Where `Extrinsic` and `Method` is used as types, considder importing `{ IMethod, IExtrinsic }` from `@polkadot/types/types`, especially in the cases where this is uased from a `SubmittableExtrinsic`
|
||||
- The `typeRegistry` constant is now `getTypeRegistry()` as a function
|
||||
|
||||
|
||||
# 0.45.1
|
||||
|
||||
- Storage with option values now correctly return `Option<Type>` and is indicated as such in the documentation
|
||||
@@ -179,7 +86,6 @@ const llo = await api.query.session.lastLengthChange();
|
||||
console.log('llo', llo.unwrapOr('not set') /* Option<BlockNumber> */)
|
||||
```
|
||||
|
||||
|
||||
# 0.44.1
|
||||
|
||||
- Split primitives and types into seperate folders. This should not affect external use since the exports remain the same, however does have an impact where classes are referenced directly. e.g.
|
||||
@@ -197,45 +103,37 @@ import Signature from '@polkadot/types/type/Signature';
|
||||
import { Method, Signature } from '@polkadot/types';
|
||||
```
|
||||
|
||||
|
||||
# 0.43.1
|
||||
|
||||
- Intrduces support for the new keyring with sr25519 support in addition to ed25519. While this does not change the exposed API, it is considerred breaking since @polkadot/keyring has interface changes. (Unless needed, don't rush the upgrade)
|
||||
|
||||
- Intrduces support for the new keyring with sr25519 support in addition to ed25519. While this does not change the exposed API, it is considerred breaking since @polkadot/keuyring has interface changes. (Unless needed, don't rush the upgrade)
|
||||
|
||||
# 0.42.1
|
||||
|
||||
- Support for substrate hash signing with implVersion >= 18
|
||||
- Changed signatures for Extrinsic signing, this should not have (much) of an impact since it is generally not used directly. SubmittableExtrinsic (as exposed by the API), supports the old-style use.
|
||||
|
||||
|
||||
# 0.41.1
|
||||
|
||||
- Support the V1 metadata specification from Substrate in addition to the currently testnet-active V0 version
|
||||
|
||||
|
||||
# 0.40.1
|
||||
|
||||
- The API interfaces now require a WS-compatible provider, e.g. subscription support is a must. Previously the HTTPProvider could be use (although it was very limited in the interactions).
|
||||
|
||||
|
||||
# 0.39.1
|
||||
|
||||
- The Promise API now returns a `Promise<UnsubFunction>` instead of `UnsubFunction` when making subscriptions.
|
||||
|
||||
|
||||
# 0.38.1
|
||||
|
||||
Substrate has been updated with a breaking new transaction format where the Index/Nonce is now encoded as a Compact. This change is being rolled out to both Alexander (Polkadot testnet) as well as Charred Cherry (Substrate testnet) - transactions between old and new are not compatible.
|
||||
|
||||
|
||||
# 0.37.1
|
||||
|
||||
api-observable has been removed. This was only used in /apps and inconsistent with the api/rx and api/promise APIs. Future work will include derivates like was included in api-observable into the base.
|
||||
|
||||
Tuples now return single types when only one type is available, i.e. `(AccountId)` would now resolve as `AccountId`. The extra type wrapper adds no benefit to users here.
|
||||
|
||||
|
||||
# 0.36.1
|
||||
|
||||
Api Promise has been updated in the way we deal with subscriptions. Previously a subscription returned `Promise<number>` where the caller was to keep track of the id and use it in subsequent unsubscribes. Now any subscriptions return an unsubscribe/destroy function `(): void`, that is use for removing the subscriptions, e.g.
|
||||
@@ -246,12 +144,10 @@ const unsubscribe = api.query.balance.freeBalance(Alice, (balance) => {...});
|
||||
unsubscribe(); // here we destroy the subscription
|
||||
```
|
||||
|
||||
|
||||
# 0.35.1
|
||||
|
||||
Swapped to new metadata structures from Substrate. If the API is not working with your node, update Substrate to latest master branch. (Or 0.9.1 for Charred Cherry). Dropped support for old metadata as found as far back as BBQ Birch.
|
||||
|
||||
|
||||
# 0.34.1
|
||||
|
||||
Changed the send signature (for future expansion of eg. events) to return `result: { status: ExtrinsicStatus }` instead of `status: ExtrinsicStatus`. For most cases where only status `type` checks are used, i.e. `status.type === 'Finalised'` this should not be a breaking change. Deep inspection of the status object however will need to adapt.
|
||||
|
||||
@@ -1,44 +1,39 @@
|
||||
[](https://polkadot.js.org)
|
||||

|
||||
[](https://www.npmjs.com/package/@polkadot/api)
|
||||
[](https://www.npmjs.com/package/@polkadot/api)
|
||||
[](https://codeclimate.com/github/polkadot-js/api)
|
||||
[](https://codeclimate.com/github/polkadot-js/api)
|
||||
# @plugnet/api
|
||||
|
||||
# @polkadot/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_
|
||||
|
||||
This library provides a clean wrapper around all the methods exposed by a Polkadot/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://polkadot.js.org/api/).
|
||||
|
||||
If you are an existing user, please be sure to track the [CHANGELOG](CHANGELOG.md) and [UPGRADING](UPGRADING.md) guides 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/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 -
|
||||
|
||||
- [@polkadot/api](packages/api/) The API library, providing both Promise and RxJS Observable-based interfaces. This is the main user-facing entry point.
|
||||
- [@polkadot/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.*`)
|
||||
- [@polkadot/api-metadata](packages/api-metadata/) Base extrinsic, storage and constant injectors for injection
|
||||
- [@polkadot/rpc-core](packages/rpc-core/) Wrapper around all [JSON-RPC methods](https://polkadot.js.org/api/METHODS_RPC.html) exposed by a Polkadot network client
|
||||
- [@polkadot/rpc-provider](packages/rpc-provider/) Providers for connecting to nodes, including WebSockets and Http
|
||||
- [@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 Polkadot & Substrate clients -
|
||||
Type definitions for interfaces as exposed by Plugnet & Substrate clients -
|
||||
|
||||
- [@polkadot/jsonrpc](packages/type-jsonrpc/) Definitions for JSONRPC endpoints
|
||||
- [@polkadot/types](packages/types/) Codecs for all Polkadot and Substrate primitives
|
||||
- [@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 [@polkadot](https://github.com/polkadot-js/) 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 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/polkadot-js/api <optional local path>`
|
||||
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`
|
||||
|
||||
-117
@@ -1,117 +0,0 @@
|
||||
# Upgrade guide
|
||||
|
||||
This is an upgrade guide for users of the API. It does not attempt to detail each version (the [CHANGELOG](CHANGELOG.md) has all the changes between versions), but rather tries to explain the rationale behind major breaking changes and how users of the API should handle this.
|
||||
|
||||
While we try to keep the user-facing interfaces as stable as possible, sometimes you just need to make additions to move forward and improve things down the road, as painful as they may be. Like you, we are also users of the API, and eat our own dogfood - and as such, feel any pains introduced first.
|
||||
|
||||
## 0.90.1 (and newer), from 0.81.1 (and older)
|
||||
|
||||
The 0.90.1 release caters for the [Kusama network](https://kusama.network/) and pulls in all the changes to support [Substrate 2.x](https://github.com/paritytech/substrate), all while maintaining backwards compatibility to allow operation on networks such as [Polkadot's Alexander](https://polkadot.network/).
|
||||
|
||||
To support the network and the new transaction formats, a number of changes were made to how extrinsics are handled and signed. In addition, as support for ongoing work where type definitions are to be supplied by the actual node metadata, the foundation has been laid to move to type definitions as opposed to classes for runtime types.
|
||||
|
||||
### Modules
|
||||
|
||||
The first thing to be aware of is breakages when connecting to any new network, here older networks such as Alex are unaffected - the node metadata defines exactly what is available to the chain, so endpoints that worked yesterday still works today.
|
||||
|
||||
There will no doubt be breakages in using calls to now non-existent endpoints (as populated by the metadata) if you are upgrading your nodes to Substrate 2.x. Substrate 2.x has had a number of internal changes, where new modules and features are introduced (such as `babe` and `technicalCommittee`), some modules have been renamed (such as `contract` -> `contracts`) and modules such as `session` has been reworked to a large degree.
|
||||
|
||||
To cater for both 1.x and 2.x support, the [@polkadot/api-derive](packages/api-derive) endpoints, do feature detection for the node type and should continue working as-is. Additionally, a number of new derives have been added, specifically around elections.
|
||||
|
||||
### Type renames
|
||||
|
||||
To better align with the actual types from the metadata, and avoid (too much) context switching, some types from the `@polkadot/types` have been renamed. These include -
|
||||
|
||||
- `Vector` -> `Vec`
|
||||
- `U{8|16|32|64|128|256}` have been removed, only the lowercase version of these remain, i.e. `u32`.
|
||||
|
||||
### Type usage
|
||||
|
||||
The [@polkadot/api](packages/api) has always handled the conversion of types for parameters when making calls or queries. For example, when making a transfer to `BOB` (address), any of the following is valid -
|
||||
|
||||
- `api.tx.balances.transfer(BOB, 12345)` - value specied as a number
|
||||
- `api.tx.balances.transfer(BOB, '12345')` - value specied as a string
|
||||
- `api.tx.balances.transfer(BOB, '0x3039')` - value specied as a hex
|
||||
- `api.tx.balances.transfer(BOB, new BN(12345))` - value specied as a [BN](https://github.com/indutny/bn.js/)
|
||||
|
||||
Internally the API will take the input and convert the value into a `Balance`, serialize it using the SCALE codec and transfer it to the node. In some cases users would construct the `Balance` type manually, by importing the class and calling `new` on it. This last approach has now been removed, and where classes are still available (limited reach), discouraged.
|
||||
|
||||
First the rationale behind this - in all cases Substrate is very flexible, so while Polkadot (and the Substrate base), define `type Balance = u128`, this can be different between chains. (This also applies to the majority of built-in supported types). As such, type construction should be done via the actual registered types.
|
||||
|
||||
```js
|
||||
// this is applicable everywhere, import the type creator, using the registry
|
||||
import { createType } from '@polkadot/types';
|
||||
|
||||
// construct the Balance, of type Balance (type is inferred and available with TS)
|
||||
const value = createType('Balance', 12345);
|
||||
|
||||
// use value here as you normally would
|
||||
...
|
||||
```
|
||||
|
||||
The impact of this will be noticeable, if you have been importing the old-style type classes from `@polkadot/types`, those imports are not available anymore. For creation, just pass everything through the `createType`.
|
||||
|
||||
If a TypeScript user, you can find the updated type (it is a type definition only, not a class), under `@polkadot/types/interfaces`. To do type casting, using interfaces -
|
||||
|
||||
```js
|
||||
// import the TypeScript runtime interfaces we wish to use
|
||||
import { Balance, Hash } from '@polkadot/types/interfaces';
|
||||
|
||||
// import the primitives we wish to use
|
||||
import { createType, Compact, Vec, u32 } from '@polkadot/types';
|
||||
|
||||
// define an interface we want to use inside our code
|
||||
interface MyProps {
|
||||
balance: Compact<Balance>;
|
||||
changes: Vec<Hash>;
|
||||
counter?: u32;
|
||||
}
|
||||
|
||||
// assign something to this structure
|
||||
const props = {
|
||||
balance: createType('Compact<Balance>', 12345),
|
||||
changes: createType('Vec<Hash>', []) // empty for now
|
||||
};
|
||||
```
|
||||
|
||||
### Type definitions
|
||||
|
||||
One of the major pain points in working with a custom Substrate node is the definition of types to cater for chains. There are 2 approaches: defining types via a JSON format or extending your own classes in TypeScript (or JS) and injecting these. For the latter category, there are some impacts in the way you define these.
|
||||
|
||||
If using JSON definitions, nothing changes, your types are still defined as -
|
||||
|
||||
```json
|
||||
{
|
||||
"MyStruct": {
|
||||
"balance": "Compact<Balance>",
|
||||
"values": "Vec<AccountId>",
|
||||
"counter": "u32"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
For the definition of any structures using the Substrate specific types as classes, some adjustments are needed. Since the base modules types are now not available in classes, however it is needed for definitions, the following approach is encouraged -
|
||||
|
||||
```js
|
||||
// import the ClassOf, it works the same as `createType` (along with type detection)
|
||||
// and acts as a replacement for the direct import and use of specific classes
|
||||
import { ClassOf, Struct, u32 } from '@polkadot/types';
|
||||
|
||||
export class MyStruct extends Struct {
|
||||
constructor (value?: any) {
|
||||
super({
|
||||
balance: ClassOf('Compact<Balance>'),
|
||||
values: ClassOf('Vec<AccountId>'),
|
||||
counter: u32
|
||||
}, value);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Internally the [@polkadot/types](packages/types) package now only defines classes where there are specific encoding logic applied. For all other types, the definitions are done via a JSON-like format and then the TypeScript definitions are generated from these. (In a world where nodes inject types and the type definitions are not needed, this functionality will be useful to allow TS devs to auto-generate type definitions based on what the node defines.)
|
||||
|
||||
### Signing transactions (Signer interface)
|
||||
|
||||
For users of the API signer interfaces (such as extensions and mobile signers), the interfaces have undergone some changes to cater for the extrinsic v2 format as defined by Substrate. If you are only supporting current chains (e.g. Alexander), no changes are required, however the old `sign` interface does not support chains such as Kusama, so all users are encouraged to upgrade to the new `signPayload` interface.
|
||||
|
||||
This has already been implemented in both the [polkadot-js extension](https://github.com/polkadot-js/extension/blob/5f22f67d558655c605eb6f6beecef6826ed6c159/packages/extension/src/page/Signer.ts#L16v) as well as the [simple single signer](https://github.com/polkadot-js/api/blob/d56905d1b566be6f17eb570ac01448378fc91b67/packages/api/test/util/SingleAccountSigner.ts#L37).
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
module.exports = {
|
||||
extends: '@polkadot/dev/config/babel'
|
||||
extends: '@plugnet/dev/config/babel'
|
||||
};
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
function copy_folder () {
|
||||
SRC="packages/$1/build"
|
||||
DST="apps/node_modules/@polkadot/$2"
|
||||
|
||||
echo "** Copying $SRC to apps/$DST"
|
||||
|
||||
rm -rf ../$DST
|
||||
cp -r $SRC ../$DST
|
||||
}
|
||||
|
||||
yarn polkadot-dev-build-ts
|
||||
|
||||
copy_folder "api" "api"
|
||||
copy_folder "api-contract" "api-contract"
|
||||
copy_folder "api-derive" "api-derive"
|
||||
copy_folder "api-metadata" "api-metadata"
|
||||
copy_folder "rpc-core" "rpc-core"
|
||||
copy_folder "rpc-provider" "rpc-provider"
|
||||
copy_folder "type-jsonrpc" "jsonrpc"
|
||||
copy_folder "types" "types"
|
||||
@@ -1,102 +0,0 @@
|
||||
# Docker compose file to run Polkadot-JS API e2e test files on supported versions of Polkadot and Substrate
|
||||
#
|
||||
# Setup:
|
||||
# Builds 5 containers with different supported versions of Substrate and Polkadot.
|
||||
# Runs Polkadot-JS API Tests
|
||||
#
|
||||
# Before you can run this script, you need to install Docker and 'Docker Compose' on your machine.
|
||||
# Please follow the steps described here (including the prerequisites): https://docs.docker.com/compose/install/
|
||||
#
|
||||
# Usage:
|
||||
# 1. BUILD: Run `docker-compose pull && docker-compose up -d` to pull the latest docker imaged and run docker-compose in detached mode. This will run the substrate and polkadot containers in the background.
|
||||
# 2. INFO: Run `docker ps` to get a list of Docker containers running in the background including their mapped ports on localhost
|
||||
# 3. TEST: Run `docker-compose logs -f js-api-tests` to run the API tests and print the logs
|
||||
# 4. QUIT: Run `docker-compose down` to stop and remove all running containers.
|
||||
#
|
||||
# Provided Endpoints for localhost:
|
||||
# - Substrate Master: ws://127.0.0.1:9945/
|
||||
# - Substrate 1.0: ws://127.0.0.1:9946/
|
||||
# - Substrate 2.0: ws://127.0.0.1:9947/
|
||||
# - Polkadot Master: ws://127.0.0.1:9948/
|
||||
# - Polkadot Alexander: ws://127.0.0.1:9949/
|
||||
#
|
||||
# Find more Docker images of Substrate https://hub.docker.com/r/parity/substrate/tags
|
||||
# Find more Docker images of Polkadot https://hub.docker.com/r/parity/polkadot/tags
|
||||
|
||||
|
||||
version: "3.7"
|
||||
services:
|
||||
substrate-master:
|
||||
image: parity/substrate:latest
|
||||
ports:
|
||||
- "9945:9944"
|
||||
- "9935:9933"
|
||||
networks:
|
||||
- internet
|
||||
command:
|
||||
- "--dev"
|
||||
- "--ws-external"
|
||||
- "--rpc-external"
|
||||
|
||||
substrate-1.0:
|
||||
image: parity/substrate:v1.0.0
|
||||
ports:
|
||||
- "9946:9944"
|
||||
- "9936:9933"
|
||||
networks:
|
||||
- internet
|
||||
command:
|
||||
- "--dev"
|
||||
- "--ws-external"
|
||||
- "--rpc-external"
|
||||
|
||||
substrate-2.0:
|
||||
image: parity/substrate:2.0.0-b65c315a1
|
||||
ports:
|
||||
- "9947:9944"
|
||||
- "9937:9933"
|
||||
networks:
|
||||
- internet
|
||||
command:
|
||||
- "--dev"
|
||||
- "--ws-external"
|
||||
- "--rpc-external"
|
||||
|
||||
polkadot-master:
|
||||
image: parity/polkadot:latest
|
||||
ports:
|
||||
- "9948:9944"
|
||||
- "9938:9933"
|
||||
networks:
|
||||
- internet
|
||||
command:
|
||||
- "--dev"
|
||||
- "--ws-external"
|
||||
- "--rpc-external"
|
||||
|
||||
polkadot-alexander:
|
||||
image: parity/polkadot:v0.4.4
|
||||
ports:
|
||||
- "9949:9944"
|
||||
- "9939:9933"
|
||||
networks:
|
||||
- internet
|
||||
command:
|
||||
- "--dev"
|
||||
- "--ws-external"
|
||||
- "--rpc-external"
|
||||
|
||||
# This is the container running the API tests
|
||||
js-api-tests:
|
||||
image: node:11
|
||||
volumes:
|
||||
- ./:/polkadot-js/api
|
||||
working_dir: /polkadot-js/api
|
||||
network_mode: host
|
||||
tty: true
|
||||
environment:
|
||||
- TERM=xterm-256color`
|
||||
command: bash -c "NODE_ENV=abc /usr/local/bin/yarn && /usr/local/bin/yarn test:all"
|
||||
|
||||
networks:
|
||||
internet:
|
||||
@@ -1,59 +0,0 @@
|
||||
module.exports = {
|
||||
base: '/api/',
|
||||
title: 'polkadot-js/api',
|
||||
description: 'API libraries and interfaces for communicating with Polkadot and Substrate nodes',
|
||||
markdown: {
|
||||
lineNumbers: true
|
||||
},
|
||||
themeConfig: {
|
||||
displayAllHeaders: true,
|
||||
nav: [
|
||||
{ text: 'Polkadot/Substrate Apps', link: 'https://polkadot.js.org/apps/' },
|
||||
{ text: 'Project family', link: 'https://polkadot.js.org/' },
|
||||
{
|
||||
text: 'Documentation',
|
||||
items: [
|
||||
{ text: 'API Reference (this)', link: 'https://polkadot.js.org/api/' },
|
||||
{ text: 'Utility Reference', link: 'https://polkadot.js.org/common/' },
|
||||
{ text: 'UI Libs Reference', link: 'https://polkadot.js.org/ui/' },
|
||||
]
|
||||
},
|
||||
{ text: 'GitHub', link: 'https://github.com/polkadot-js/api' }
|
||||
],
|
||||
search: false,
|
||||
sidebar: [
|
||||
{
|
||||
title: 'Examples (Promise API)',
|
||||
path: '/examples/promise/',
|
||||
collapsable: false,
|
||||
sidebarDepth: 1,
|
||||
children: [
|
||||
['examples/promise/01_simple_connect/', 'Simple connect'],
|
||||
['examples/promise/02_listen_to_blocks/', 'Listen to blocks'],
|
||||
['examples/promise/03_listen_to_balance_change/', 'Listen to balance change'],
|
||||
['examples/promise/04_unsubscribe/', 'Unsubscribe from listening'],
|
||||
['examples/promise/05_read_storage/', 'Read chain state'],
|
||||
['examples/promise/06_make_transfer/', 'Make a transfer'],
|
||||
['examples/promise/08_system_events/', 'Display system events'],
|
||||
['examples/promise/09_transfer_events/', 'Transaction with events'],
|
||||
['examples/promise/10_upgrade_chain/', 'Upgrade via sudo']
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'Substrate interfaces',
|
||||
collapsable: false,
|
||||
sidebarDepth: 0,
|
||||
children: [
|
||||
['/METHODS_RPC.md', 'Substrate RPC'],
|
||||
['/METHODS_CONSTANTS.md', 'Constants (defaults)'],
|
||||
['/METHODS_STORAGE.md', 'State storage (defaults)'],
|
||||
['/METHODS_EXTRINSICS.md', 'Extrinsics (defaults)'],
|
||||
['/METHODS_EVENTS.md', 'System events (defaults)']
|
||||
]
|
||||
},
|
||||
['/api/', '@polkadot/api'],
|
||||
['/types/', '@polkadot/types'],
|
||||
'/CONTRIBUTING.md'
|
||||
]
|
||||
}
|
||||
};
|
||||
@@ -1,9 +0,0 @@
|
||||
$accentColor = #fd8824
|
||||
$textColor = #2c3e50
|
||||
|
||||
.home .hero .description,
|
||||
.home .feature h2,
|
||||
.home .feature p {
|
||||
color: $textColor
|
||||
opacity: 0.75
|
||||
}
|
||||
@@ -1,220 +0,0 @@
|
||||
## Constants
|
||||
|
||||
_The following sections contain the module constants, also known as parameter types.
|
||||
- **[babe](#babe)**
|
||||
|
||||
- **[balances](#balances)**
|
||||
|
||||
- **[contracts](#contracts)**
|
||||
|
||||
- **[democracy](#democracy)**
|
||||
|
||||
- **[elections](#elections)**
|
||||
|
||||
- **[finalityTracker](#finalityTracker)**
|
||||
|
||||
- **[session](#session)**
|
||||
|
||||
- **[staking](#staking)**
|
||||
|
||||
- **[timestamp](#timestamp)**
|
||||
|
||||
- **[treasury](#treasury)**
|
||||
|
||||
|
||||
___
|
||||
|
||||
|
||||
### babe
|
||||
|
||||
▸ **epochDuration**: `u64`
|
||||
- **summary**: The number of **slots** that an epoch takes. We couple sessions to epochs, i.e. we start a new session once the new epoch begins.
|
||||
|
||||
▸ **expectedBlockTime**: `Moment`
|
||||
- **summary**: The expected average block time at which BABE should be creating blocks. Since BABE is probabilistic it is not trivial to figure out what the expected average block time should be based on the slot duration and the security parameter `c` (where `1 - c` represents the probability of a slot being empty).
|
||||
|
||||
___
|
||||
|
||||
|
||||
### balances
|
||||
|
||||
▸ **creationFee**: `Balance`
|
||||
- **summary**: The fee required to create an account.
|
||||
|
||||
▸ **existentialDeposit**: `Balance`
|
||||
- **summary**: The minimum amount required to keep an account open.
|
||||
|
||||
▸ **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.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### contracts
|
||||
|
||||
▸ **blockGasLimit**: `Gas`
|
||||
- **summary**: The maximum amount of gas that could be expended per block. A reasonable default value is 10_000_000.
|
||||
|
||||
▸ **callBaseFee**: `Gas`
|
||||
- **summary**: The base fee charged for calling into a contract. A reasonable default value is 135.
|
||||
|
||||
▸ **contractFee**: `BalanceOf`
|
||||
- **summary**: The fee required to create a contract instance. A reasonable default value is 21.
|
||||
|
||||
▸ **createBaseFee**: `Gas`
|
||||
- **summary**: The base fee charged for creating a contract. A reasonable default value is 175.
|
||||
|
||||
▸ **creationFee**: `BalanceOf`
|
||||
- **summary**: The fee required to create an account.
|
||||
|
||||
▸ **maxDepth**: `u32`
|
||||
- **summary**: The maximum nesting level of a call/create stack. A reasonable default value is 100.
|
||||
|
||||
▸ **maxValueSize**: `u32`
|
||||
- **summary**: The maximum size of a storage value in bytes. A reasonable default is 16 KiB.
|
||||
|
||||
▸ **rentByteFee**: `BalanceOf`
|
||||
- **summary**: Price of a byte of storage per one block interval. Should be greater than 0.
|
||||
|
||||
▸ **rentDepositOffset**: `BalanceOf`
|
||||
- **summary**: The amount of funds a contract should deposit in order to offset the cost of one byte. Let's suppose the deposit is 1,000 BU (balance units)/byte and the rent is 1 BU/byte/day, then a contract with 1,000,000 BU that uses 1,000 bytes of storage would pay no rent. But if the balance reduced to 500,000 BU and the storage stayed the same at 1,000, then it would pay 500 BU/day.
|
||||
|
||||
▸ **signedClaimHandicap**: `BlockNumber`
|
||||
- **summary**: Number of block delay an extrinsic claim surcharge has. When claim surcharge is called by an extrinsic the rent is checked for current_block - delay
|
||||
|
||||
▸ **storageSizeOffset**: `u32`
|
||||
- **summary**: Size of a contract at the time of creation. This is a simple way to ensure that empty contracts eventually gets deleted.
|
||||
|
||||
▸ **surchargeReward**: `BalanceOf`
|
||||
- **summary**: Reward that is received by the party whose touch has led to removal of a contract.
|
||||
|
||||
▸ **tombstoneDeposit**: `BalanceOf`
|
||||
- **summary**: The minimum amount required to generate a tombstone.
|
||||
|
||||
▸ **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.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### democracy
|
||||
|
||||
▸ **cooloffPeriod**: `BlockNumber`
|
||||
- **summary**: Period in blocks where an external proposal may not be re-submitted after being vetoed.
|
||||
|
||||
▸ **emergencyVotingPeriod**: `BlockNumber`
|
||||
- **summary**: Minimum voting period allowed for an emergency referendum.
|
||||
|
||||
▸ **enactmentPeriod**: `BlockNumber`
|
||||
- **summary**: The minimum period of locking and the period between a proposal being approved and enacted. It should generally be a little more than the unstake period to ensure that voting stakers have an opportunity to remove themselves from the system in the case where they are on the losing side of a vote.
|
||||
|
||||
▸ **launchPeriod**: `BlockNumber`
|
||||
- **summary**: How often (in blocks) new public referenda are launched.
|
||||
|
||||
▸ **minimumDeposit**: `BalanceOf`
|
||||
- **summary**: The minimum amount to be used as a deposit for a public referendum proposal.
|
||||
|
||||
▸ **votingPeriod**: `BlockNumber`
|
||||
- **summary**: How often (in blocks) to check for new votes.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### elections
|
||||
|
||||
▸ **approvalSetSize**: `u32`
|
||||
- **summary**: The chunk size of the approval vector.
|
||||
|
||||
▸ **candidacyBond**: `BalanceOf`
|
||||
- **summary**: How much should be locked up in order to submit one's candidacy. A reasonable default value is 9.
|
||||
|
||||
▸ **carryCount**: `u32`
|
||||
- **summary**: How many runners-up should have their approvals persist until the next vote. A reasonable default value is 2.
|
||||
|
||||
▸ **decayRatio**: `u32`
|
||||
- **summary**: Decay factor of weight when being accumulated. It should typically be set to __at least__ `membership_size -1` to keep the collective secure. When set to `N`, it indicates `(1/N)^t` of staked is decayed at weight increment step `t`. 0 will result in no weight being added at all (normal approval voting). A reasonable default value is 24.
|
||||
|
||||
▸ **inactiveGracePeriod**: `VoteIndex`
|
||||
- **summary**: How many vote indices need to go by after a target voter's last vote before they can be reaped if their approvals are moot. A reasonable default value is 1.
|
||||
|
||||
▸ **presentSlashPerVoter**: `BalanceOf`
|
||||
- **summary**: The punishment, per voter, if you provide an invalid presentation. A reasonable default value is 1.
|
||||
|
||||
▸ **voterSetSize**: `u32`
|
||||
- **summary**: The chunk size of the voter vector.
|
||||
|
||||
▸ **votingBond**: `BalanceOf`
|
||||
- **summary**: How much should be locked up in order to be able to submit votes.
|
||||
|
||||
▸ **votingFee**: `BalanceOf`
|
||||
- **summary**: The amount of fee paid upon each vote submission, unless if they submit a _hole_ index and replace it.
|
||||
|
||||
▸ **votingPeriod**: `BlockNumber`
|
||||
- **summary**: How often (in blocks) to check for new votes. A reasonable default value is 1000.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### finalityTracker
|
||||
|
||||
▸ **reportLatency**: `BlockNumber`
|
||||
- **summary**: The delay after which point things become suspicious. Default is 1000.
|
||||
|
||||
▸ **windowSize**: `BlockNumber`
|
||||
- **summary**: The number of recent samples to keep from this chain. Default is 101.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### session
|
||||
|
||||
▸ **dedupKeyPrefix**: `Bytes`
|
||||
- **summary**: Used as first key for `NextKeys` and `KeyOwner` to put all the data into the same branch of the trie.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### staking
|
||||
|
||||
▸ **bondingDuration**: `EraIndex`
|
||||
- **summary**: Number of eras that staked funds must remain bonded for.
|
||||
|
||||
▸ **sessionsPerEra**: `SessionIndex`
|
||||
- **summary**: Number of sessions per era.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### timestamp
|
||||
|
||||
▸ **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.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### treasury
|
||||
|
||||
▸ **burn**: `Permill`
|
||||
- **summary**: Percentage of spare funds (if any) that are burnt per spend period.
|
||||
|
||||
▸ **proposalBond**: `Permill`
|
||||
- **summary**: Fraction of a proposal's value that should be bonded in order to place the proposal. An accepted proposal gets these back. A rejected proposal does not.
|
||||
|
||||
▸ **proposalBondMinimum**: `BalanceOf`
|
||||
- **summary**: Minimum amount of funds that should be placed in a deposit for making a proposal.
|
||||
|
||||
▸ **spendPeriod**: `BlockNumber`
|
||||
- **summary**: Period between successive spends.
|
||||
+44
-114
@@ -3,22 +3,20 @@
|
||||
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)**
|
||||
|
||||
- **[contracts](#contracts)**
|
||||
- **[contract](#contract)**
|
||||
|
||||
- **[council](#council)**
|
||||
|
||||
- **[democracy](#democracy)**
|
||||
- **[councilMotions](#councilMotions)**
|
||||
|
||||
- **[elections](#elections)**
|
||||
- **[councilVoting](#councilVoting)**
|
||||
|
||||
- **[democracy](#democracy)**
|
||||
|
||||
- **[grandpa](#grandpa)**
|
||||
|
||||
- **[imOnline](#imOnline)**
|
||||
|
||||
- **[indices](#indices)**
|
||||
|
||||
- **[offences](#offences)**
|
||||
|
||||
- **[session](#session)**
|
||||
|
||||
- **[staking](#staking)**
|
||||
@@ -27,10 +25,6 @@ Events are emitted for certain operations on the runtime. The following sections
|
||||
|
||||
- **[system](#system)**
|
||||
|
||||
- **[technicalCommittee](#technicalCommittee)**
|
||||
|
||||
- **[technicalMembership](#technicalMembership)**
|
||||
|
||||
- **[treasury](#treasury)**
|
||||
|
||||
|
||||
@@ -51,14 +45,11 @@ ___
|
||||
___
|
||||
|
||||
|
||||
### contracts
|
||||
### contract
|
||||
|
||||
▸ **CodeStored**(`Hash`)
|
||||
- **summary**: Code with the specified hash has been stored.
|
||||
|
||||
▸ **Contract**(`AccountId`, `Bytes`)
|
||||
- **summary**: An event from contract of account.
|
||||
|
||||
▸ **Dispatched**(`AccountId`, `bool`)
|
||||
- **summary**: A call was dispatched from the given account. The bool signals whether it was successful execution or not.
|
||||
|
||||
@@ -76,6 +67,23 @@ ___
|
||||
|
||||
### 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.
|
||||
|
||||
@@ -85,14 +93,22 @@ ___
|
||||
▸ **Executed**(`Hash`, `bool`)
|
||||
- **summary**: A motion was executed; `bool` is true if returned without error.
|
||||
|
||||
▸ **MemberExecuted**(`Hash`, `bool`)
|
||||
- **summary**: A single member did some action; `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).
|
||||
|
||||
▸ **Proposed**(`AccountId`, `ProposalIndex`, `Hash`, `MemberCount`)
|
||||
- **summary**: A motion (given hash) has been proposed (by given account) with a threshold (given `MemberCount`).
|
||||
▸ **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).
|
||||
|
||||
▸ **Voted**(`AccountId`, `Hash`, `bool`, `MemberCount`, `MemberCount`)
|
||||
- **summary**: A motion (given hash) has been voted on by given account, leaving a tally (yes votes and no votes given respectively as `MemberCount`).
|
||||
___
|
||||
|
||||
|
||||
### 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.
|
||||
|
||||
___
|
||||
|
||||
@@ -105,8 +121,6 @@ ___
|
||||
|
||||
▸ **Executed**(`ReferendumIndex`, `bool`)
|
||||
|
||||
▸ **ExternalTabled**()
|
||||
|
||||
▸ **NotPassed**(`ReferendumIndex`)
|
||||
|
||||
▸ **Passed**(`ReferendumIndex`)
|
||||
@@ -119,47 +133,14 @@ ___
|
||||
|
||||
▸ **Undelegated**(`AccountId`)
|
||||
|
||||
▸ **Vetoed**(`AccountId`, `Hash`, `BlockNumber`)
|
||||
|
||||
___
|
||||
|
||||
|
||||
### elections
|
||||
|
||||
▸ **BadReaperSlashed**(`AccountId`)
|
||||
- **summary**: slashed reaper
|
||||
|
||||
▸ **TallyFinalized**(`Vec<AccountId>`, `Vec<AccountId>`)
|
||||
- **summary**: A tally (for approval votes of seat(s)) has ended (with one or more new members).
|
||||
|
||||
▸ **TallyStarted**(`u32`)
|
||||
- **summary**: A tally (for approval votes of seat(s)) has started.
|
||||
|
||||
▸ **VoterReaped**(`AccountId`, `AccountId`)
|
||||
- **summary**: reaped voter, reaper
|
||||
|
||||
___
|
||||
|
||||
|
||||
### grandpa
|
||||
|
||||
▸ **NewAuthorities**(`Vec<(AuthorityId,u64)>`)
|
||||
▸ **NewAuthorities**(`Vec<(SessionKey,u64)>`)
|
||||
- **summary**: New authority set has been applied.
|
||||
|
||||
▸ **Paused**()
|
||||
- **summary**: Current authority set has been paused.
|
||||
|
||||
▸ **Resumed**()
|
||||
- **summary**: Current authority set has been resumed.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### imOnline
|
||||
|
||||
▸ **HeartbeatReceived**(`AuthorityId`)
|
||||
- **summary**: A new heartbeat was received from `AuthorityId`
|
||||
|
||||
___
|
||||
|
||||
|
||||
@@ -171,17 +152,9 @@ ___
|
||||
___
|
||||
|
||||
|
||||
### offences
|
||||
|
||||
▸ **Offence**(`Kind`, `OpaqueTimeSlot`)
|
||||
- **summary**: There is an offence reported of the given `kind` happened at the `session_index` and (kind-specific) time slot. This event is not deposited for duplicate slashes.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### session
|
||||
|
||||
▸ **NewSession**(`SessionIndex`)
|
||||
▸ **NewSession**(`BlockNumber`)
|
||||
- **summary**: New session has happened. Note that the argument is the session index, not the block number as the type might suggest.
|
||||
|
||||
___
|
||||
@@ -189,15 +162,15 @@ ___
|
||||
|
||||
### staking
|
||||
|
||||
▸ **OldSlashingReportDiscarded**(`SessionIndex`)
|
||||
- **summary**: An old slashing report from a prior era was discarded because it could not be processed.
|
||||
▸ **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.
|
||||
|
||||
▸ **Slash**(`AccountId`, `Balance`)
|
||||
- **summary**: One validator (and its nominators) has been slashed by the given amount.
|
||||
|
||||
___
|
||||
|
||||
|
||||
@@ -223,49 +196,6 @@ ___
|
||||
___
|
||||
|
||||
|
||||
### technicalCommittee
|
||||
|
||||
▸ **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.
|
||||
|
||||
▸ **MemberExecuted**(`Hash`, `bool`)
|
||||
- **summary**: A single member did some action; `bool` is true if returned without error.
|
||||
|
||||
▸ **Proposed**(`AccountId`, `ProposalIndex`, `Hash`, `MemberCount`)
|
||||
- **summary**: A motion (given hash) has been proposed (by given account) with a threshold (given `MemberCount`).
|
||||
|
||||
▸ **Voted**(`AccountId`, `Hash`, `bool`, `MemberCount`, `MemberCount`)
|
||||
- **summary**: A motion (given hash) has been voted on by given account, leaving a tally (yes votes and no votes given respectively as `MemberCount`).
|
||||
|
||||
___
|
||||
|
||||
|
||||
### technicalMembership
|
||||
|
||||
▸ **Dummy**(`PhantomData`)
|
||||
- **summary**: Phantom member, never used.
|
||||
|
||||
▸ **MemberAdded**()
|
||||
- **summary**: The given member was added; see the transaction for who.
|
||||
|
||||
▸ **MemberRemoved**()
|
||||
- **summary**: The given member was removed; see the transaction for who.
|
||||
|
||||
▸ **MembersReset**()
|
||||
- **summary**: The membership was reset; see the transaction for who the new set is.
|
||||
|
||||
▸ **MembersSwapped**()
|
||||
- **summary**: Two members were swapped; see the transaction for who.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### treasury
|
||||
|
||||
▸ **Awarded**(`ProposalIndex`, `Balance`, `AccountId`)
|
||||
|
||||
+138
-210
@@ -1,38 +1,30 @@
|
||||
## Extrinsics
|
||||
|
||||
_The following sections contain Extrinsics methods are part of the default Substrate runtime._
|
||||
- **[authorship](#authorship)**
|
||||
|
||||
- **[babe](#babe)**
|
||||
|
||||
- **[balances](#balances)**
|
||||
|
||||
- **[contracts](#contracts)**
|
||||
- **[consensus](#consensus)**
|
||||
|
||||
- **[contract](#contract)**
|
||||
|
||||
- **[council](#council)**
|
||||
|
||||
- **[democracy](#democracy)**
|
||||
- **[councilMotions](#councilMotions)**
|
||||
|
||||
- **[elections](#elections)**
|
||||
- **[councilVoting](#councilVoting)**
|
||||
|
||||
- **[democracy](#democracy)**
|
||||
|
||||
- **[finalityTracker](#finalityTracker)**
|
||||
|
||||
- **[grandpa](#grandpa)**
|
||||
|
||||
- **[imOnline](#imOnline)**
|
||||
|
||||
- **[session](#session)**
|
||||
|
||||
- **[staking](#staking)**
|
||||
|
||||
- **[sudo](#sudo)**
|
||||
|
||||
- **[system](#system)**
|
||||
|
||||
- **[technicalCommittee](#technicalCommittee)**
|
||||
|
||||
- **[technicalMembership](#technicalMembership)**
|
||||
|
||||
- **[timestamp](#timestamp)**
|
||||
|
||||
- **[treasury](#treasury)**
|
||||
@@ -41,46 +33,53 @@ _The following sections contain Extrinsics methods are part of the default Subst
|
||||
___
|
||||
|
||||
|
||||
### authorship
|
||||
|
||||
▸ **setUncles**(new_uncles: `Vec<Header>`)
|
||||
- **summary**: Provide a set of uncles.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### babe
|
||||
|
||||
▸ **setPendingSecondarySlotsChange**(change: `Option<bool>`)
|
||||
- **summary**: Sets a pending change to enable / disable secondary slot assignment. The pending change will be set at the end of the current epoch and will be enacted at `current_epoch + 2`.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### balances
|
||||
|
||||
▸ **setBalance**(who: `Address`, new_free: `Compact<Balance>`, new_reserved: `Compact<Balance>`)
|
||||
- **summary**: Set the balances of a given account. This will alter `FreeBalance` and `ReservedBalance` in storage. it will also decrease the total issuance of the system (`TotalIssuance`). If the new free or reserved balance is below the existential deposit, it will reset the account nonce (`system::AccountNonce`). The dispatch origin for this call is `root`. # <weight> - Independent of the arguments. - Contains a limited number of reads and writes. # </weight>
|
||||
▸ **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. # <weight> - Dependent on arguments but not critical, given proper implementations for input config types. See related functions below. - It contains a limited number of reads and writes internally and no complex computation. Related functions: - `ensure_can_withdraw` is always called internally but has a bounded complexity. - Transferring balances to accounts that did not exist before will cause `T::OnNewAccount::on_new_account` to be called. - Removing enough funds from an account will trigger `T::DustRemoval::on_unbalanced` and `T::OnFreeBalanceZero::on_free_balance_zero`. # </weight>
|
||||
- **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.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### contracts
|
||||
### 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.
|
||||
|
||||
▸ **claimSurcharge**(dest: `AccountId`, aux_sender: `Option<AccountId>`)
|
||||
- **summary**: Allows block producers to claim a small reward for evicting a contract. If a block producer fails to do so, a regular users will be allowed to claim the reward. If contract is not evicted as a result of this call, no actions are taken and the sender is not eligible for the reward.
|
||||
|
||||
▸ **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.
|
||||
- **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 chain's storage and returns its `codehash`. You can instantiate contracts only with stored code.
|
||||
- **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.
|
||||
@@ -90,99 +89,23 @@ ___
|
||||
|
||||
### council
|
||||
|
||||
▸ **execute**(proposal: `Proposal`)
|
||||
- **summary**: Dispatch a proposal from a member using the `Member` origin. Origin must be a member of the collective.
|
||||
|
||||
▸ **propose**(threshold: `Compact<MemberCount>`, proposal: `Proposal`)
|
||||
- **summary**: # <weight> - Bounded storage reads and writes. - Argument `threshold` has bearing on weight. # </weight>
|
||||
|
||||
▸ **setMembers**(new_members: `Vec<AccountId>`)
|
||||
- **summary**: Set the collective's membership manually to `new_members`. Be nice to the chain and provide it pre-sorted. Requires root origin.
|
||||
|
||||
▸ **vote**(proposal: `Hash`, index: `Compact<ProposalIndex>`, approve: `bool`)
|
||||
- **summary**: # <weight> - Bounded storage read and writes. - Will be slightly heavier if the proposal is approved / disapproved after the vote. # </weight>
|
||||
|
||||
___
|
||||
|
||||
|
||||
### democracy
|
||||
|
||||
▸ **cancelQueued**(when: `Compact<BlockNumber>`, which: `Compact<u32>`, what: `Compact<ReferendumIndex>`)
|
||||
- **summary**: Cancel a proposal queued for enactment.
|
||||
|
||||
▸ **cancelReferendum**(ref_index: `Compact<ReferendumIndex>`)
|
||||
- **summary**: Remove a referendum.
|
||||
|
||||
▸ **delegate**(to: `AccountId`, conviction: `Conviction`)
|
||||
- **summary**: Delegate vote. # <weight> - One extra DB entry. # </weight>
|
||||
|
||||
▸ **emergencyCancel**(ref_index: `ReferendumIndex`)
|
||||
- **summary**: Schedule an emergency cancellation of a referendum. Cannot happen twice to the same referendum.
|
||||
|
||||
▸ **externalPropose**(proposal: `Proposal`)
|
||||
- **summary**: Schedule a referendum to be tabled once it is legal to schedule an external referendum.
|
||||
|
||||
▸ **externalProposeDefault**(proposal: `Proposal`)
|
||||
- **summary**: Schedule a negative-turnout-bias referendum to be tabled next once it is legal to schedule an external referendum. Unlike `external_propose`, blacklisting has no effect on this and it may replace a pre-scheduled `external_propose` call.
|
||||
|
||||
▸ **externalProposeMajority**(proposal: `Proposal`)
|
||||
- **summary**: Schedule a majority-carries referendum to be tabled next once it is legal to schedule an external referendum. Unlike `external_propose`, blacklisting has no effect on this and it may replace a pre-scheduled `external_propose` call.
|
||||
|
||||
▸ **fastTrack**(proposal_hash: `Hash`, voting_period: `BlockNumber`, delay: `BlockNumber`)
|
||||
- **summary**: Schedule the currently externally-proposed majority-carries referendum to be tabled immediately. If there is no externally-proposed referendum currently, or if there is one but it is not a majority-carries referendum then it fails. - `proposal_hash`: The hash of the current external proposal. - `voting_period`: The period that is allowed for voting on this proposal. - `delay`: The number of block after voting has ended in approval and this should be enacted. Increased to `EmergencyVotingPeriod` if too low.
|
||||
|
||||
▸ **propose**(proposal: `Proposal`, value: `Compact<BalanceOf>`)
|
||||
- **summary**: Propose a sensitive action to be taken. # <weight> - O(1). - Two DB changes, one DB entry. # </weight>
|
||||
|
||||
▸ **proxyVote**(ref_index: `Compact<ReferendumIndex>`, vote: `Vote`)
|
||||
- **summary**: Vote in a referendum on behalf of a stash. If `vote.is_aye()`, the vote is to enact the proposal; otherwise it is a vote to keep the status quo. # <weight> - O(1). - One DB change, one DB entry. # </weight>
|
||||
|
||||
▸ **removeProxy**(proxy: `AccountId`)
|
||||
- **summary**: Clear the proxy. Called by the stash. # <weight> - One DB clear. # </weight>
|
||||
|
||||
▸ **resignProxy**()
|
||||
- **summary**: Clear the proxy. Called by the proxy. # <weight> - One DB clear. # </weight>
|
||||
|
||||
▸ **second**(proposal: `Compact<PropIndex>`)
|
||||
- **summary**: Propose a sensitive action to be taken. # <weight> - O(1). - One DB entry. # </weight>
|
||||
|
||||
▸ **setProxy**(proxy: `AccountId`)
|
||||
- **summary**: Specify a proxy. Called by the stash. # <weight> - One extra DB entry. # </weight>
|
||||
|
||||
▸ **undelegate**()
|
||||
- **summary**: Undelegate vote. # <weight> - O(1). # </weight>
|
||||
|
||||
▸ **vetoExternal**(proposal_hash: `Hash`)
|
||||
- **summary**: Veto and blacklist the external proposal hash.
|
||||
|
||||
▸ **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. # <weight> - O(1). - One DB change, one DB entry. # </weight>
|
||||
|
||||
___
|
||||
|
||||
|
||||
### elections
|
||||
|
||||
▸ **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 # <weight> - O(voters) compute. - One DB change. # </weight>
|
||||
|
||||
▸ **proxySetApprovals**(votes: `Vec<bool>`, index: `Compact<VoteIndex>`, hint: `SetIndex`)
|
||||
- **summary**: Set candidate approvals from a proxy. Approval slots stay valid as long as candidates in those slots are registered. # <weight> - Same as `set_approvals` with one additional storage read. # </weight>
|
||||
- **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. Both indices must be provided as explained in [`voter_at`] function. May be called by anyone. Returns the voter deposit to `signed`. # <weight> - O(1). - Two fewer DB entries, one DB change. # </weight>
|
||||
- **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 from the set. This is effective immediately. Note: A tally should happen instantly (if not already in a presentation period) to fill the seat if removal means that the desired members are not met.
|
||||
- **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. The index must be provided as explained in [`voter_at`] function. Also removes the lock on the balance of the voter. See [`do_set_approvals()`]. # <weight> - O(1). - Two fewer DB entries, one DB change. # </weight>
|
||||
- **summary**: Remove a voter. All votes are cancelled and the voter deposit is returned.
|
||||
|
||||
▸ **setApprovals**(votes: `Vec<bool>`, index: `Compact<VoteIndex>`, hint: `SetIndex`)
|
||||
- **summary**: Set candidate approvals. Approval slots stay valid as long as candidates in those slots are registered. Locks the total balance of caller indefinitely. Only [`retract_voter`] or [`reap_inactive_voter`] can unlock the balance. `hint` argument is interpreted differently based on: - if `origin` is setting approvals for the first time: The index will be checked for being a valid _hole_ in the voter list. - if the hint is correctly pointing to a hole, no fee is deducted from `origin`. - Otherwise, the call will succeed but the index is ignored and simply a push to the last chunk with free space happens. If the new push causes a new chunk to be created, a fee indicated by [`VotingFee`] is deducted. - if `origin` is already a voter: the index __must__ be valid and point to the correct position of the `origin` in the current voters list. Note that any trailing `false` votes in `votes` is ignored; In approval voting, not voting for a candidate and voting false, are equal. # <weight> - O(1). - Two extra DB entries, one DB change. - Argument `votes` is limited in length to number of candidates. # </weight>
|
||||
▸ **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.
|
||||
- **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`.
|
||||
@@ -191,7 +114,60 @@ ___
|
||||
- **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. NOTE: if `origin` has already assigned approvals via [`set_approvals`], it will NOT have any usable funds to pass candidacy bond and must first retract. Note that setting approvals will lock the entire balance of the voter until retraction or being reported. # <weight> - Independent of input. - Three DB changes. # </weight>
|
||||
- **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.
|
||||
|
||||
___
|
||||
|
||||
@@ -212,17 +188,16 @@ ___
|
||||
___
|
||||
|
||||
|
||||
### imOnline
|
||||
|
||||
▸ **heartbeat**(heartbeat: `Heartbeat`, signature: `AuthoritySignature`)
|
||||
|
||||
___
|
||||
|
||||
|
||||
### session
|
||||
|
||||
▸ **setKeys**(keys: `Keys`, proof: `Bytes`)
|
||||
- **summary**: Sets the session key(s) of the function caller to `key`. Allows an account to set its session key prior to becoming a validator. This doesn't take effect until the next session. The dispatch origin of this function must be signed. # <weight> - O(log n) in number of accounts. - One extra DB entry. # </weight>
|
||||
▸ **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).
|
||||
|
||||
___
|
||||
|
||||
@@ -230,43 +205,49 @@ ___
|
||||
### 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. `value` must be more than the `existential_deposit` defined in the Balances module. The dispatch origin for this call must be _Signed_ by the stash account. # <weight> - Independent of the arguments. Moderate complexity. - O(1). - Three extra DB entries. NOTE: Two of the storage writes (`Self::bonded`, `Self::payee`) are _never_ cleaned unless the `origin` falls below _existential deposit_ and gets removed as dust. # </weight>
|
||||
- **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. Unlike [`bond`] or [`unbond`] this function does not impose any limitation on the amount that can be added. The dispatch origin for this call must be _Signed_ by the stash, not the controller. # <weight> - Independent of the arguments. Insignificant complexity. - O(1). - One DB entry. # </weight>
|
||||
- **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. # <weight> - Independent of the arguments. Insignificant complexity. - Contains one read. - Writes are limited to the `origin` account key. # </weight>
|
||||
- **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**()
|
||||
- **summary**: Force there to be a new era at the end of the next session. After this, it will be reset to normal (non-forced) behaviour. # <weight> - No arguments. # </weight>
|
||||
|
||||
▸ **forceNoEras**()
|
||||
- **summary**: Force there to be no new eras indefinitely. # <weight> - No arguments. # </weight>
|
||||
▸ **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. # <weight> - The transaction's complexity is proportional to the size of `targets`, which is capped at `MAX_NOMINATIONS`. - Both the reads and writes follow a similar pattern. # </weight>
|
||||
- **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 controller of a stash. 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. # <weight> - Independent of the arguments. Insignificant complexity. - Contains a limited number of reads. - Writes are limited to the `origin` account key. # </weight>
|
||||
- **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. # <weight> - Independent of the arguments. Insignificant complexity. - Contains a limited number of reads. - Writes are limited to the `origin` account key. # </weight>
|
||||
- **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. No more than a limited number of unlocking chunks (see `MAX_UNLOCKING_CHUNKS`) can co-exists at the same time. In that case, [`Call::withdraw_unbonded`] need to be called first to remove some of the chunks (if possible). The dispatch origin for this call must be _Signed_ by the controller, not the stash. See also [`Call::withdraw_unbonded`]. # <weight> - Independent of the arguments. Limited but potentially exploitable complexity. - Contains a limited number of reads. - Each call (requires the remainder of the bonded balance to be above `minimum_balance`) will cause a new entry to be inserted into a vector (`Ledger.unlocking`) kept in storage. The only way to clean the aforementioned storage item is also user-controlled via `withdraw_unbonded`. - One DB entry. </weight>
|
||||
- **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. # <weight> - Independent of the arguments. Insignificant complexity. - Contains a limited number of reads. - Writes are limited to the `origin` account key. # </weight>
|
||||
- **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`]. # <weight> - Could be dependent on the `origin` argument and how much `unlocking` chunks exist. It implies `consolidate_unlocked` which loops over `Ledger.unlocking`, which is indirectly user-controlled. See [`unbond`] for more detail. - Contains a limited number of reads, yet the size of which could be large based on `ledger`. - Writes are limited to the `origin` account key. # </weight>
|
||||
- **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`].
|
||||
|
||||
___
|
||||
|
||||
@@ -274,67 +255,8 @@ ___
|
||||
### sudo
|
||||
|
||||
▸ **setKey**(new: `Address`)
|
||||
- **summary**: Authenticates the current sudo key and sets the given AccountId (`new`) as the new sudo key. The dispatch origin for this call must be _Signed_. # <weight> - O(1). - Limited storage reads. - One DB change. # </weight>
|
||||
|
||||
▸ **sudo**(proposal: `Proposal`)
|
||||
- **summary**: Authenticates the sudo key and dispatches a function call with `Root` origin. The dispatch origin for this call must be _Signed_. # <weight> - O(1). - Limited storage reads. - No DB writes. # </weight>
|
||||
|
||||
___
|
||||
|
||||
|
||||
### system
|
||||
|
||||
▸ **fillBlock**()
|
||||
- **summary**: A big dispatch that will disallow any other transaction to be included.
|
||||
|
||||
▸ **killStorage**(keys: `Vec<Key>`)
|
||||
- **summary**: Kill some items from storage.
|
||||
|
||||
▸ **remark**(_remark: `Bytes`)
|
||||
- **summary**: Make some on-chain remark.
|
||||
|
||||
▸ **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.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### technicalCommittee
|
||||
|
||||
▸ **execute**(proposal: `Proposal`)
|
||||
- **summary**: Dispatch a proposal from a member using the `Member` origin. Origin must be a member of the collective.
|
||||
|
||||
▸ **propose**(threshold: `Compact<MemberCount>`, proposal: `Proposal`)
|
||||
- **summary**: # <weight> - Bounded storage reads and writes. - Argument `threshold` has bearing on weight. # </weight>
|
||||
|
||||
▸ **setMembers**(new_members: `Vec<AccountId>`)
|
||||
- **summary**: Set the collective's membership manually to `new_members`. Be nice to the chain and provide it pre-sorted. Requires root origin.
|
||||
|
||||
▸ **vote**(proposal: `Hash`, index: `Compact<ProposalIndex>`, approve: `bool`)
|
||||
- **summary**: # <weight> - Bounded storage read and writes. - Will be slightly heavier if the proposal is approved / disapproved after the vote. # </weight>
|
||||
|
||||
___
|
||||
|
||||
|
||||
### technicalMembership
|
||||
|
||||
▸ **addMember**(who: `AccountId`)
|
||||
- **summary**: Add a member `who` to the set. May only be called from `AddOrigin` or root.
|
||||
|
||||
▸ **removeMember**(who: `AccountId`)
|
||||
- **summary**: Remove a member `who` from the set. May only be called from `RemoveOrigin` or root.
|
||||
|
||||
▸ **resetMembers**(members: `Vec<AccountId>`)
|
||||
- **summary**: Change the membership to a new set, disregarding the existing membership. Be nice and pass `members` pre-sorted. May only be called from `ResetOrigin` or root.
|
||||
|
||||
▸ **swapMember**(remove: `AccountId`, add: `AccountId`)
|
||||
- **summary**: Swap out one member `remove` for another `add`. May only be called from `SwapOrigin` or root.
|
||||
|
||||
___
|
||||
|
||||
@@ -342,7 +264,7 @@ ___
|
||||
### 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 `MinimumPeriod`. The dispatch origin for this call must be `Inherent`.
|
||||
- **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`.
|
||||
|
||||
___
|
||||
|
||||
@@ -350,10 +272,16 @@ ___
|
||||
### 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. # <weight> - O(1). - Limited storage reads. - One DB change. # </weight>
|
||||
- **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. # <weight> - O(1). - Limited storage reads. - One DB change, one extra DB entry. # </weight>
|
||||
- **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. # <weight> - O(1). - Limited storage reads. - One DB clear. # </weight>
|
||||
- **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.
|
||||
|
||||
+5
-29
@@ -17,20 +17,11 @@ ___
|
||||
|
||||
_Authoring of network items_
|
||||
|
||||
▸ **insertKey**(keyType: `Text`, suri: `Text`, maybePublic?: `Bytes`): `Bytes`
|
||||
- **summary**: Insert a key into the keystore.
|
||||
|
||||
▸ **pendingExtrinsics**(): `Vec<Extrinsic>`
|
||||
▸ **pendingExtrinsics**(): `PendingExtrinsics`
|
||||
- **summary**: Returns all pending extrinsics, potentially grouped by sender
|
||||
|
||||
▸ **removeExtrinsic**(bytesOrHash: `Vec<ExtrinsicOrHash>`): `Vec<Hash>`
|
||||
- **summary**: Remove given extrinsic from the pool and temporarily ban it to prevent reimporting
|
||||
|
||||
▸ **rotateKeys**(): `Bytes`
|
||||
- **summary**: Generate new session keys and returns the corresponding public keys
|
||||
|
||||
▸ **submitAndWatchExtrinsic**(extrinsic: `Extrinsic`): `ExtrinsicStatus`
|
||||
- **summary**: Submit and subscribe to watch an extrinsic until unsubscribed
|
||||
- **summary**: Subscribe and watch an extrinsic until unsubscribed
|
||||
|
||||
▸ **submitExtrinsic**(extrinsic: `Extrinsic`): `Hash`
|
||||
- **summary**: Submit a fully formatted extrinsic for block inclusion
|
||||
@@ -49,7 +40,7 @@ _Retrieval of chain data_
|
||||
- **summary**: Get the block hash for a specific block
|
||||
|
||||
▸ **getFinalizedHead**(): `Hash`
|
||||
- **summary**: Get hash of the last finalized block in the canon chain
|
||||
- **summary**: Get hash of the last finalised block in the canon chain
|
||||
|
||||
▸ **getHeader**(hash?: `Hash`): `Header`
|
||||
- **summary**: Retrieves the header for a specific block
|
||||
@@ -60,7 +51,7 @@ _Retrieval of chain data_
|
||||
▸ **subscribeFinalizedHeads**(): `Header`
|
||||
- **summary**: Retrieves the best finalized header via subscription
|
||||
|
||||
▸ **subscribeNewHeads**(): `Header`
|
||||
▸ **subscribeNewHead**(): `Header`
|
||||
- **summary**: Retrieves the best header via subscription
|
||||
|
||||
▸ **subscribeRuntimeVersion**(): `RuntimeVersion`
|
||||
@@ -76,21 +67,6 @@ _Query of state_
|
||||
▸ **call**(method: `Text`, data: `Bytes`, block?: `Hash`): `Bytes`
|
||||
- **summary**: Perform a call to a builtin on the chain
|
||||
|
||||
▸ **getChildKeys**(childStorageKey: `StorageKey`, key: `StorageKey`, block?: `Hash`): `Vec<StorageKey>`
|
||||
- **summary**: Retrieves the keys with prefix of a specific child storage
|
||||
|
||||
▸ **getChildStorage**(childStorageKey: `StorageKey`, key: `StorageKey`, block?: `Hash`): `StorageData`
|
||||
- **summary**: Retrieves the child storage for a key
|
||||
|
||||
▸ **getChildStorageHash**(childStorageKey: `StorageKey`, key: `StorageKey`, block?: `Hash`): `Hash`
|
||||
- **summary**: Retrieves the child storage hash
|
||||
|
||||
▸ **getChildStorageSize**(childStorageKey: `StorageKey`, key: `StorageKey`, block?: `Hash`): `u64`
|
||||
- **summary**: Retrieves the child storage size
|
||||
|
||||
▸ **getKeys**(key: `StorageKey`, block?: `Hash`): `Vec<StorageKey>`
|
||||
- **summary**: Retrieves the keys with a certain prefix
|
||||
|
||||
▸ **getMetadata**(block?: `Hash`): `Metadata`
|
||||
- **summary**: Returns the runtime metadata
|
||||
|
||||
@@ -117,7 +93,7 @@ ___
|
||||
|
||||
### system
|
||||
|
||||
_Calls to retrieve system info_
|
||||
_Methods to retrieve system info_
|
||||
|
||||
▸ **chain**(): `Text`
|
||||
- **summary**: Retrieves the chain
|
||||
|
||||
+250
-265
@@ -1,28 +1,24 @@
|
||||
## Storage
|
||||
|
||||
_The following sections contain Storage methods are part of the default Substrate runtime._
|
||||
- **[authorship](#authorship)**
|
||||
|
||||
- **[babe](#babe)**
|
||||
|
||||
- **[balances](#balances)**
|
||||
|
||||
- **[contracts](#contracts)**
|
||||
- **[consensus](#consensus)**
|
||||
|
||||
- **[contract](#contract)**
|
||||
|
||||
- **[council](#council)**
|
||||
|
||||
- **[councilMotions](#councilMotions)**
|
||||
|
||||
- **[councilVoting](#councilVoting)**
|
||||
|
||||
- **[democracy](#democracy)**
|
||||
|
||||
- **[elections](#elections)**
|
||||
|
||||
- **[grandpa](#grandpa)**
|
||||
|
||||
- **[imOnline](#imOnline)**
|
||||
- **[grandpaFinality](#grandpaFinality)**
|
||||
|
||||
- **[indices](#indices)**
|
||||
|
||||
- **[offences](#offences)**
|
||||
|
||||
- **[session](#session)**
|
||||
|
||||
- **[staking](#staking)**
|
||||
@@ -31,10 +27,6 @@ _The following sections contain Storage methods are part of the default Substrat
|
||||
|
||||
- **[system](#system)**
|
||||
|
||||
- **[technicalCommittee](#technicalCommittee)**
|
||||
|
||||
- **[technicalMembership](#technicalMembership)**
|
||||
|
||||
- **[timestamp](#timestamp)**
|
||||
|
||||
- **[treasury](#treasury)**
|
||||
@@ -45,59 +37,14 @@ _The following sections contain Storage methods are part of the default Substrat
|
||||
___
|
||||
|
||||
|
||||
### authorship
|
||||
|
||||
▸ **author**(): `Option<AccountId>`
|
||||
- **summary**: Author of current block.
|
||||
|
||||
▸ **didSetUncles**(): `bool`
|
||||
- **summary**: Whether uncles were already set in this block.
|
||||
|
||||
▸ **uncles**(): `Vec<UncleEntryItem>`
|
||||
- **summary**: Uncles
|
||||
|
||||
___
|
||||
|
||||
|
||||
### babe
|
||||
|
||||
▸ **authorities**(): `Vec<(AuthorityId,BabeAuthorityWeight)>`
|
||||
- **summary**: Current epoch authorities.
|
||||
|
||||
▸ **currentSlot**(): `u64`
|
||||
- **summary**: Current slot number.
|
||||
|
||||
▸ **epochIndex**(): `u64`
|
||||
- **summary**: Current epoch index.
|
||||
|
||||
▸ **epochStartSlot**(): `u64`
|
||||
- **summary**: Slot at which the current epoch started. It is possible that no block was authored at the given slot and the epoch change was signalled later than this.
|
||||
|
||||
▸ **initialized**(): `Option<bool>`
|
||||
- **summary**: Temporary value (cleared at block finalization) which is true if per-block initialization has already been called for current block.
|
||||
|
||||
▸ **nextRandomness**(): `[u8;32]`
|
||||
- **summary**: Next epoch randomness.
|
||||
|
||||
▸ **pendingSecondarySlotsChange**(): `Option<bool>`
|
||||
- **summary**: Pending change to enable/disable secondary slots which will be triggered at `current_epoch + 2`.
|
||||
|
||||
▸ **randomness**(): `[u8;32]`
|
||||
- **summary**: The epoch randomness for the *current* epoch. # Security This MUST NOT be used for gambling, as it can be influenced by a malicious validator in the short term. It MAY be used in many cryptographic protocols, however, so long as one remembers that this (like everything else on-chain) it is public. For example, it can be used where a number is needed that cannot have been chosen by an adversary, for purposes such as public-coin zero-knowledge proofs.
|
||||
|
||||
▸ **secondarySlots**(): `(bool,bool)`
|
||||
- **summary**: Whether secondary slots are enabled in case the VRF-based slot is empty for the current epoch and the next epoch, respectively.
|
||||
|
||||
▸ **segmentIndex**(): `u32`
|
||||
- **summary**: Randomness under construction. We make a tradeoff between storage accesses and list length. We store the under-construction randomness in segments of up to `UNDER_CONSTRUCTION_SEGMENT_LENGTH`. Once a segment reaches this length, we begin the next one. We reset all segments and return to `0` at the beginning of every epoch.
|
||||
|
||||
▸ **underConstruction**(`u32`): `Vec<[u8;32]>`
|
||||
|
||||
___
|
||||
|
||||
|
||||
### 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`.
|
||||
|
||||
@@ -110,22 +57,56 @@ ___
|
||||
▸ **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.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### contracts
|
||||
### consensus
|
||||
|
||||
▸ **originalAuthorities**(): `Option<Vec<SessionKey>>`
|
||||
|
||||
___
|
||||
|
||||
|
||||
### contract
|
||||
|
||||
▸ **accountCounter**(): `u64`
|
||||
- **summary**: The subtrie counter.
|
||||
- **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 execution.
|
||||
- **summary**: A mapping between an original code hash and instrumented wasm code, ready for the execution.
|
||||
|
||||
▸ **contractInfoOf**(`AccountId`): `Option<ContractInfo>`
|
||||
- **summary**: The code associated with a given account.
|
||||
▸ **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.
|
||||
@@ -136,16 +117,89 @@ ___
|
||||
▸ **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
|
||||
|
||||
▸ **members**(): `Vec<AccountId>`
|
||||
- **summary**: The current members of the collective. This is stored sorted (just by value).
|
||||
▸ **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.
|
||||
@@ -154,23 +208,39 @@ ___
|
||||
- **summary**: Actual proposal for a given hash, if it's current.
|
||||
|
||||
▸ **proposals**(): `Vec<Hash>`
|
||||
- **summary**: The hashes of the active proposals.
|
||||
- **summary**: The (hashes of) the active proposals.
|
||||
|
||||
▸ **voting**(`Hash`): `Option<Votes>`
|
||||
- **summary**: Votes on a given proposal, if it is ongoing.
|
||||
▸ **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
|
||||
|
||||
▸ **blacklist**(`Hash`): `Option<(BlockNumber,Vec<AccountId>)>`
|
||||
- **summary**: A record of who vetoed what. Maps proposal hash to a possible existent block number (until when it may not be resubmitted) and who vetoed it.
|
||||
|
||||
▸ **cancellations**(`Hash`): `bool`
|
||||
- **summary**: Record of all proposals that have been subject to emergency cancellation.
|
||||
|
||||
▸ **delegations**(`AccountId`): `((AccountId,Conviction), Linkage<AccountId>)`
|
||||
▸ **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>)>`
|
||||
@@ -179,17 +249,20 @@ ___
|
||||
▸ **dispatchQueue**(`BlockNumber`): `Vec<Option<(Proposal,ReferendumIndex)>>`
|
||||
- **summary**: Queue of successful referenda to be dispatched.
|
||||
|
||||
▸ **lastTabledWasExternal**(): `bool`
|
||||
- **summary**: True if the last referendum tabled was submitted externally. False if it was a public proposal.
|
||||
▸ **launchPeriod**(): `BlockNumber`
|
||||
- **summary**: How often (in blocks) new public referenda are launched.
|
||||
|
||||
▸ **nextExternal**(): `Option<(Proposal,VoteThreshold)>`
|
||||
- **summary**: The referendum to be tabled whenever it would be valid to table an external proposal. This happens when a referendum needs to be tabled and one of two conditions are met: - `LastTabledWasExternal` is `false`; or - `PublicProps` is empty.
|
||||
▸ **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.
|
||||
|
||||
▸ **proxy**(`AccountId`): `Option<AccountId>`
|
||||
- **summary**: Who is able to vote for whom. Value is the fund-holding account, key is the vote-transaction-sending account.
|
||||
▸ **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.
|
||||
@@ -198,103 +271,28 @@ ___
|
||||
- **summary**: The public proposals. Unsorted.
|
||||
|
||||
▸ **referendumCount**(): `ReferendumIndex`
|
||||
- **summary**: The next free referendum index, aka the number of referenda started so far.
|
||||
- **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.
|
||||
- **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.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### elections
|
||||
|
||||
▸ **approvalsOf**(`(AccountId,SetIndex)`): `Vec<ApprovalFlag>`
|
||||
- **summary**: A list of votes for each voter. The votes are stored as numeric values and parsed in a bit-wise manner. In order to get a human-readable representation (`Vec<bool>`), use [`all_approvals_of`]. Furthermore, each vector of scalars is chunked with the cap of `APPROVAL_SET_SIZE`.
|
||||
|
||||
▸ **candidateCount**(): `u32`
|
||||
- **summary**: Current number of active candidates
|
||||
|
||||
▸ **candidates**(): `Vec<AccountId>`
|
||||
- **summary**: The present candidate list.
|
||||
|
||||
▸ **desiredSeats**(): `u32`
|
||||
- **summary**: Number of accounts that should constitute the collective.
|
||||
|
||||
▸ **leaderboard**(): `Option<Vec<(BalanceOf,AccountId)>>`
|
||||
- **summary**: Get the leaderboard if we're in the presentation phase. The first element is the weight of each entry; It may be the direct summed approval stakes, or a weighted version of it.
|
||||
|
||||
▸ **members**(): `Vec<(AccountId,BlockNumber)>`
|
||||
- **summary**: The current membership. 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 member was elected and their term duration).
|
||||
|
||||
▸ **nextFinalize**(): `Option<(BlockNumber,u32,Vec<AccountId>)>`
|
||||
- **summary**: The accounts holding the seats that will become free on the next tally.
|
||||
|
||||
▸ **nextVoterSet**(): `SetIndex`
|
||||
- **summary**: the next free set to store a voter in. This will keep growing.
|
||||
|
||||
▸ **presentationDuration**(): `BlockNumber`
|
||||
- **summary**: How long to give each top candidate to present themselves after the vote ends.
|
||||
|
||||
▸ **proxy**(`AccountId`): `Option<AccountId>`
|
||||
- **summary**: Who is able to vote for whom. Value is the fund-holding account, key is the vote-transaction-sending account.
|
||||
|
||||
▸ **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.
|
||||
|
||||
▸ **termDuration**(): `BlockNumber`
|
||||
- **summary**: How long each position is active for.
|
||||
|
||||
▸ **voteCount**(): `VoteIndex`
|
||||
- **summary**: The total number of vote rounds that have happened or are in progress.
|
||||
|
||||
▸ **voterCount**(): `SetIndex`
|
||||
- **summary**: Current number of Voters.
|
||||
|
||||
▸ **voterInfoOf**(`AccountId`): `Option<VoterInfo>`
|
||||
- **summary**: Basic information about a voter.
|
||||
|
||||
▸ **voters**(`SetIndex`): `Vec<Option<AccountId>>`
|
||||
- **summary**: The present voter list (chunked and capped at [`VOTER_SET_SIZE`]).
|
||||
▸ **votingPeriod**(): `BlockNumber`
|
||||
- **summary**: How often (in blocks) to check for new votes.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### grandpa
|
||||
|
||||
▸ **authorities**(): `Vec<(AuthorityId,AuthorityWeight)>`
|
||||
- **summary**: The current authority set.
|
||||
### grandpaFinality
|
||||
|
||||
▸ **nextForced**(): `Option<BlockNumber>`
|
||||
- **summary**: next block number where we can force a change.
|
||||
|
||||
▸ **pendingChange**(): `Option<StoredPendingChange>`
|
||||
- **summary**: Pending change: (signaled at, scheduled change).
|
||||
|
||||
▸ **stalled**(): `Option<(BlockNumber,BlockNumber)>`
|
||||
- **summary**: `true` if we are currently stalled.
|
||||
|
||||
▸ **state**(): `StoredState`
|
||||
- **summary**: State of the current authority set.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### imOnline
|
||||
|
||||
▸ **gossipAt**(): `BlockNumber`
|
||||
- **summary**: The block number when we should gossip.
|
||||
|
||||
▸ **keys**(): `Vec<AuthorityId>`
|
||||
- **summary**: The current set of keys that may issue a heartbeat.
|
||||
|
||||
▸ **receivedHeartbeats**(`SessionIndex, AuthIndex`): `Bytes`
|
||||
- **summary**: For each session index we keep a mapping of `AuthorityId` to `offchain::OpaqueNetworkState`.
|
||||
|
||||
___
|
||||
|
||||
@@ -310,41 +308,30 @@ ___
|
||||
___
|
||||
|
||||
|
||||
### offences
|
||||
|
||||
▸ **concurrentReportsIndex**(`Kind, OpaqueTimeSlot`): `Vec<ReportIdOf>`
|
||||
- **summary**: A vector of reports of the same kind that happened at the same time slot.
|
||||
|
||||
▸ **reports**(`ReportIdOf`): `Option<OffenceDetails>`
|
||||
- **summary**: The primary structure that holds all offence records keyed by report identifiers.
|
||||
|
||||
▸ **reportsByKindIndex**(`Kind`): `Bytes`
|
||||
- **summary**: Enumerates all reports of a kind along with the time they happened. All reports are sorted by the time of offence. Note that the actual type of this mapping is `Vec<u8>`, this is because values of different types are not supported at the moment so we are doing the manual serialization.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### session
|
||||
|
||||
▸ **changed**(): `bool`
|
||||
- **summary**: True if anything has changed in this session.
|
||||
|
||||
▸ **currentIndex**(): `SessionIndex`
|
||||
▸ **currentIndex**(): `BlockNumber`
|
||||
- **summary**: Current index of the session.
|
||||
|
||||
▸ **keyOwner**(`Bytes, (KeyTypeId,Bytes)`): `Option<ValidatorId>`
|
||||
- **summary**: The owner of a key. The second key is the `KeyTypeId` + the encoded key. The first key is always `DEDUP_KEY_PREFIX` to have all the data in the same branch of the trie. Having all data in the same branch should prevent slowing down other queries.
|
||||
▸ **currentStart**(): `Moment`
|
||||
- **summary**: Timestamp when current session started.
|
||||
|
||||
▸ **nextKeys**(`Bytes, ValidatorId`): `Option<Keys>`
|
||||
- **summary**: The next session keys for a validator. The first key is always `DEDUP_KEY_PREFIX` to have all the data in the same branch of the trie. Having all data in the same branch should prevent slowing down other queries.
|
||||
▸ **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).
|
||||
|
||||
▸ **queuedChanged**(): `bool`
|
||||
- **summary**: Queued keys changed.
|
||||
▸ **lastLengthChange**(): `Option<BlockNumber>`
|
||||
- **summary**: Block at which the session length last changed.
|
||||
|
||||
▸ **queuedKeys**(): `Vec<(ValidatorId,Keys)>`
|
||||
- **summary**: The queued keys for the next session. When the next session begins, these keys will be used to determine the validator's session keys.
|
||||
▸ **nextKeyFor**(`AccountId`): `Option<SessionKey>`
|
||||
- **summary**: The next key for a given validator.
|
||||
|
||||
▸ **validators**(): `Vec<ValidatorId>`
|
||||
▸ **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.
|
||||
|
||||
___
|
||||
@@ -355,32 +342,29 @@ ___
|
||||
▸ **bonded**(`AccountId`): `Option<AccountId>`
|
||||
- **summary**: Map from all locked "stash" accounts to the controller account.
|
||||
|
||||
▸ **bondedEras**(): `Vec<(EraIndex,SessionIndex)>`
|
||||
- **summary**: A mapping from still-bonded eras to the first session index of that era.
|
||||
▸ **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**(): `EraIndex`
|
||||
▸ **currentEra**(): `BlockNumber`
|
||||
- **summary**: The current era index.
|
||||
|
||||
▸ **currentEraRewards**(): `EraRewards`
|
||||
- **summary**: Rewards for the current era. Using indices of current elected set.
|
||||
▸ **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.
|
||||
|
||||
▸ **currentEraStart**(): `MomentOf`
|
||||
- **summary**: The start of the current era.
|
||||
▸ **currentSessionReward**(): `BalanceOf`
|
||||
- **summary**: Maximum reward, per validator, that is provided per acceptable session.
|
||||
|
||||
▸ **currentEraStartSessionIndex**(): `SessionIndex`
|
||||
- **summary**: The session index at which the current era started.
|
||||
|
||||
▸ **eraSlashJournal**(`EraIndex`): `Vec<SlashJournalEntry>`
|
||||
- **summary**: All slashes that have occurred in a given era.
|
||||
|
||||
▸ **forceEra**(): `Forcing`
|
||||
- **summary**: True if the next session change will be a new era regardless of index.
|
||||
▸ **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.
|
||||
- **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.
|
||||
@@ -388,20 +372,38 @@ ___
|
||||
▸ **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.
|
||||
|
||||
▸ **slashRewardFraction**(): `Perbill`
|
||||
- **summary**: The percentage of the slash that is distributed to reporters. The rest of the slashed value is handled by the `Slash`.
|
||||
▸ **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 Session module. This is keyed by the stash account.
|
||||
- **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.
|
||||
@@ -415,7 +417,6 @@ ___
|
||||
### sudo
|
||||
|
||||
▸ **key**(): `AccountId`
|
||||
- **summary**: The `AccountId` of the sudo key.
|
||||
|
||||
___
|
||||
|
||||
@@ -426,83 +427,49 @@ ___
|
||||
- **summary**: Extrinsics nonce for accounts.
|
||||
|
||||
▸ **allExtrinsicsLen**(): `Option<u32>`
|
||||
- **summary**: Total length (in bytes) for all extrinsics put together, for the current block.
|
||||
|
||||
▸ **allExtrinsicsWeight**(): `Option<Weight>`
|
||||
- **summary**: Total weight for all extrinsics put together, for the current block.
|
||||
- **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**(): `DigestOf`
|
||||
▸ **digest**(): `Digest`
|
||||
- **summary**: Digest of the current block, also part of the block header.
|
||||
|
||||
▸ **eventCount**(): `EventIndex`
|
||||
- **summary**: The number of events in the `Events<T>` list.
|
||||
|
||||
▸ **events**(): `Vec<EventRecord>`
|
||||
- **summary**: Events deposited for the current block.
|
||||
|
||||
▸ **eventTopics**(`Null, Hash`): `Vec<(BlockNumber,EventIndex)>`
|
||||
- **summary**: Mapping between a topic (represented by T::Hash) and a vector of indexes of events in the `<Events<T>>` list. The first key serves no purpose. This field is declared as double_map just for convenience of using `remove_prefix`. All topic vectors have deterministic storage locations depending on the topic. This allows light-clients to leverage the changes trie storage tracking mechanism and in case of changes fetch the list of events of interest. The value has the type `(T::BlockNumber, EventIndex)` because if we used only just the `EventIndex` then in case if the topic has the same contents on the next block no notification will be triggered thus the event might be lost.
|
||||
|
||||
▸ **extrinsicCount**(): `Option<u32>`
|
||||
- **summary**: Total extrinsics count for the current block.
|
||||
|
||||
▸ **extrinsicData**(`u32`): `Bytes`
|
||||
- **summary**: Extrinsics data for the current block (maps an extrinsic's index to its data).
|
||||
- **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.
|
||||
|
||||
▸ **nextWeightMultiplier**(): `WeightMultiplier`
|
||||
- **summary**: The next weight multiplier. This should be updated at the end of each block based on the saturation level (weight).
|
||||
|
||||
▸ **number**(): `BlockNumber`
|
||||
- **summary**: The current block number being processed. Set by `execute_block`.
|
||||
|
||||
▸ **parentHash**(): `Hash`
|
||||
- **summary**: Hash of the previous block.
|
||||
|
||||
▸ **randomMaterial**(): `(i8,Vec<Hash>)`
|
||||
- **summary**: Series of block headers from the last 81 blocks that acts as random seed material. This is arranged as a ring buffer with the `i8` prefix being the index into the `Vec` of the oldest hash.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### technicalCommittee
|
||||
|
||||
▸ **members**(): `Vec<AccountId>`
|
||||
- **summary**: The current members of the collective. This is stored sorted (just by value).
|
||||
|
||||
▸ **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<Votes>`
|
||||
- **summary**: Votes on a given proposal, if it is ongoing.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### technicalMembership
|
||||
|
||||
▸ **members**(): `Vec<AccountId>`
|
||||
- **summary**: The current membership, stored as an ordered Vec.
|
||||
▸ **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.
|
||||
|
||||
@@ -514,24 +481,42 @@ ___
|
||||
▸ **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.
|
||||
|
||||
▸ **childStorageKeyPrefix**(): `u32`
|
||||
- **summary**: Prefix of child storage keys.
|
||||
|
||||
▸ **code**(): `Bytes`
|
||||
- **summary**: Wasm code of the runtime.
|
||||
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
---
|
||||
home: true
|
||||
heroText:
|
||||
tagline:
|
||||
# Bringing JavaScript to the Polkadot world.
|
||||
# actionText: Repository Overview
|
||||
# actionLink: /REPOS.md
|
||||
features:
|
||||
- title: API
|
||||
details: A powerful dynamic API that allows chain interactions with transparent encoding and decoding.
|
||||
- title: Substrate defaults
|
||||
details: An overview of the various default methods, state entries and RPCs for Substrate-based chains.
|
||||
- title: Types
|
||||
details: Various type interfaces to make using returned values from API calls transparent in your code.
|
||||
|
||||
footer: Apache-2 Licensed | Copyright © 2017-2019 polkadot-js authors and contributors
|
||||
---
|
||||
|
||||
## Welcome
|
||||
|
||||
The API provides application developers the ability to query a node and interact with the Polkadot or Substrate chains using Javascript. Here you will find documentation and examples to get you started.
|
||||
|
||||
::: tip Examples
|
||||
In a rush and just want examples? [Jump right in](/examples/promise/) and get a handle on using the API in your projects.
|
||||
:::
|
||||
|
||||
## Available packages
|
||||
|
||||
This repository split up into a number of internal packages, namely -
|
||||
|
||||
- [api](api/README.md) Promise and RxJS-based APIs
|
||||
- [types](types/README.md) Type encoding and decoding wrappers
|
||||
|
||||
## The Polkadot Project
|
||||
|
||||
You can read more about the Polkadot Network at [https://polkadot.network/](https://polkadot.network/) and more about the polkadot-js projects at [https://polkadot.js.org](https://polkadot.js.org)
|
||||
|
||||
## Github repositories
|
||||
|
||||
You can find the Polkadot repositories at:
|
||||
|
||||
- [https://github.com/polkadot-js](https://github.com/polkadot-js)
|
||||
- [https://github.com/paritytech/polkadot](https://github.com/paritytech/polkadot)
|
||||
- [https://github.com/paritytech/substrate](https://github.com/paritytech/substrate)
|
||||
|
||||
This documentation is generated from [https://github.com/polkadot-js/api](https://github.com/polkadot-js/api)
|
||||
|
||||
## Contributing
|
||||
|
||||
Contribution to the Polkadot JS API are more than welcome. You can [report issues](https://github.com/polkadot-js/api/issues/new) and [log feature requests](https://github.com/polkadot-js/api/issues/new).
|
||||
@@ -1,39 +0,0 @@
|
||||
## Packages
|
||||
|
||||
- [api](api/README.md)
|
||||
- [ApiPromise](api/classes/_promise_index_.apipromise.md)
|
||||
- [ApiRx](api/classes/_rx_index_.apirx.md)
|
||||
- [rpc-provider](rpc-provider/README.md)
|
||||
- [HttpProvider](rpc-provider/classes/_http_index_.httpprovider.md)
|
||||
- [WsProvider](rpc-provider/classes/_ws_index_.wsprovider.md)
|
||||
- [types (codec implementation)](types/README.md)
|
||||
|
||||
## Interfaces
|
||||
|
||||
- [RPC](METHODS_RPC.md)
|
||||
- [Constants (runtime)](METHODS_CONSTANTS.md)
|
||||
- [Chain state (runtime)](METHODS_STORAGE.md)
|
||||
- [Extrinsics (runtime)](METHODS_EXTRINSICS.md)
|
||||
- [Events (runtime)](METHODS_EVENTS.md)
|
||||
|
||||
## Examples
|
||||
- [ApiPromise](examples/promise/README.md)
|
||||
- [Simple connect](examples/promise/01_simple_connect/README.md)
|
||||
- [Listen to blocks](examples/promise/02_listen_to_blocks/README.md)
|
||||
- [Listen to balance change](examples/promise/03_listen_to_balance_change/README.md)
|
||||
- [Unsubscribe from listening](examples/promise/04_unsubscribe/README.md)
|
||||
- [Read chain state](examples/promise/05_read_storage/README.md)
|
||||
- [Make a transfer](examples/promise/06_make_transfer/README.md)
|
||||
- [Display system events](examples/promise/08_system_events/README.md)(
|
||||
- [Transaction with events](examples/promise/09_transfer_events/README.md)
|
||||
- [Upgrade via sudo](examples/promise/10_upgrade_chain/README.md)
|
||||
- [ApiRx](examples/rx/README.md)
|
||||
- [Simple connect](examples/rx/01_simple_connect/README.md)
|
||||
- [Listen to blocks](examples/rx/02_listen_to_blocks/README.md)
|
||||
- [Listen to balance change](examples/rx/03_listen_to_balance_change/README.md)
|
||||
- [Unsubscribe from listening](examples/rx/04_unsubscribe/README.md)
|
||||
- [Read chain state](examples/rx/05_read_storage/README.md)
|
||||
- [Make a transfer](examples/rx/06_make_transfer/README.md)
|
||||
- [Display system events](examples/rx/08_system_events/README.md)(
|
||||
- [Transaction with events](examples/rx/09_transfer_events/README.md)
|
||||
- [Upgrade via sudo](examples/rx/10_upgrade_chain/README.md)
|
||||
@@ -1,5 +1,5 @@
|
||||
# Simple Connect
|
||||
|
||||
The following example shows how to instantiate a Polkadot API object and use it to connect to a node using ApiPromise.
|
||||
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
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
// @ts-check
|
||||
// Required imports
|
||||
const { ApiPromise, WsProvider } = require('@polkadot/api');
|
||||
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 });
|
||||
const api = await ApiPromise.create(provider);
|
||||
|
||||
// Retrieve the chain & node information information via rpc calls
|
||||
const [chain, nodeName, nodeVersion] = await Promise.all([
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
},
|
||||
|
||||
"dependencies": {
|
||||
"@polkadot/api": "*"
|
||||
"@plugnet/api": "^0.76.102"
|
||||
},
|
||||
"devDependencies": {
|
||||
"rimraf": "^2.6.2"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
// @ts-check
|
||||
// Import the API
|
||||
const { ApiPromise } = require('@polkadot/api');
|
||||
const { ApiPromise } = require('@plugnet/api');
|
||||
|
||||
async function main () {
|
||||
// Here we don't pass the (optional) provider, connecting directly to the default
|
||||
@@ -8,19 +8,11 @@ async function main () {
|
||||
// the API has connected to the node and completed the initialisation process
|
||||
const api = await ApiPromise.create();
|
||||
|
||||
// we only display a couple, then unsubscribe
|
||||
let count = 0;
|
||||
|
||||
// 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.number}`);
|
||||
|
||||
if (++count === 256) {
|
||||
unsubscribe();
|
||||
process.exit(0);
|
||||
}
|
||||
console.log(`Chain is at block: #${header.blockNumber}`);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"start": "node index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@polkadot/api": "*"
|
||||
"@plugnet/api": "^0.76.102"
|
||||
},
|
||||
"devDependencies": {
|
||||
"rimraf": "^2.6.2"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Listen to balance changes
|
||||
|
||||
This example shows how to instantiate a Polkadot API object and use it to connect to a node and retrieve balance updates.
|
||||
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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
// @ts-check
|
||||
// Import the API
|
||||
const { ApiPromise } = require('@polkadot/api');
|
||||
const { ApiPromise } = require('@plugnet/api');
|
||||
|
||||
// Known account we want to use (available on dev chain, with funds)
|
||||
const Alice = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"start": "node index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@polkadot/api": "*"
|
||||
"@plugnet/api": "^0.76.102"
|
||||
},
|
||||
"devDependencies": {
|
||||
"rimraf": "^2.6.2"
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
# Listen to balance changes
|
||||
|
||||
This example shows how to instantiate a Polkadot API object and use it to connect to a node and retrieve balance updates.
|
||||
|
||||
<<< @/docs/examples/promise/03_listen_to_balance_change/index.js
|
||||
@@ -1,21 +0,0 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
// Import the API
|
||||
const { ApiPromise } = require('@polkadot/api');
|
||||
|
||||
// Known account we want to use (available on dev chain, with funds)
|
||||
const ALICE = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
|
||||
const BOB = '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty';
|
||||
|
||||
async function main () {
|
||||
// Create an await for the API
|
||||
const api = await ApiPromise.create();
|
||||
|
||||
console.log('Tracking balances for:', [ALICE, BOB]);
|
||||
|
||||
// Subscribe and listen to several balance changes
|
||||
api.query.balances.freeBalance.multi([ALICE, BOB], (balances) => {
|
||||
console.log('Change detected, new balances: ', balances);
|
||||
});
|
||||
}
|
||||
|
||||
main().catch(console.error);
|
||||
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"name": "03_listen_to_multiple_balances_change",
|
||||
"version": "0.2.0",
|
||||
"description": "Example showing how to subscribe to multiple balances change",
|
||||
"main": "index.js",
|
||||
"author": "chevdor",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"clean": "rimraf node_modules",
|
||||
"start": "node index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@polkadot/api": "*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"rimraf": "^2.6.2"
|
||||
}
|
||||
}
|
||||
@@ -1,21 +1,22 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
// @ts-check
|
||||
// Import the API
|
||||
const { ApiPromise } = require('@polkadot/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.number}`);
|
||||
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');
|
||||
console.log('Unsubscribed')
|
||||
}, 20000);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"start": "node index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@polkadot/api": "*"
|
||||
"@plugnet/api": "^0.76.102"
|
||||
},
|
||||
"devDependencies": {
|
||||
"rimraf": "^2.6.2"
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
// @ts-check
|
||||
// Import the API
|
||||
const { ApiPromise } = require('@polkadot/api');
|
||||
const { ApiPromise } = require('@plugnet/api');
|
||||
|
||||
// Our address for Alice on the dev chain
|
||||
const ALICE = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
|
||||
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, now, validators] = await Promise.all([
|
||||
api.query.system.accountNonce(ALICE),
|
||||
api.query.timestamp.now(),
|
||||
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(`last block timestamp ${now.toNumber()}`);
|
||||
console.log(`accountNonce(${Alice}) ${accountNonce}`);
|
||||
console.log(`blockPeriod ${blockPeriod.toNumber()} seconds`);
|
||||
|
||||
if (validators && validators.length > 0) {
|
||||
// Retrieve the balances for all validators
|
||||
@@ -35,4 +35,4 @@ async function main () {
|
||||
}
|
||||
}
|
||||
|
||||
main().catch(console.error).finally(() => process.exit());
|
||||
main().catch(console.error).finally(_ => process.exit());
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"start": "node index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@polkadot/api": "*"
|
||||
"@plugnet/api": "^0.76.102"
|
||||
},
|
||||
"devDependencies": {
|
||||
"rimraf": "^2.6.2"
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
# Read storage, at a specific blockhash
|
||||
|
||||
In addition to querying the latest storage, you can make storage queries at a specific blockhash. Be aware that the node applies a pruning strategy and typically only keeps the last 256 blocks, unless run in archive mode.
|
||||
|
||||
<<< @/docs/examples/promise/07_read_storage_at/index.js
|
||||
@@ -1,30 +0,0 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
// Import the API
|
||||
const { ApiPromise } = require('@polkadot/api');
|
||||
|
||||
// Our address for Alice on the dev chain
|
||||
const ALICE = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
|
||||
const BOB = '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty';
|
||||
|
||||
async function main () {
|
||||
// Create our API with a default connection to the local node
|
||||
const api = await ApiPromise.create();
|
||||
|
||||
// retrieve the last block header, extracting the hash and parentHash
|
||||
const { hash, parentHash } = await api.rpc.chain.getHeader();
|
||||
|
||||
console.log(`last header hash ${hash.toHex()}`);
|
||||
|
||||
// retrieve the balance at the preceding block for Alice. For at queries
|
||||
// the format is always `.at(<blockhash>, ...params)`
|
||||
const balance = await api.query.balances.freeBalance.at(parentHash, ALICE);
|
||||
|
||||
console.log(`Alice's balance at ${parentHash.toHex()} was ${balance}`);
|
||||
|
||||
// now perform a multi query, returning multiple balances at once
|
||||
const balances = await api.query.balances.freeBalance.multi([ALICE, BOB]);
|
||||
|
||||
console.log(`Current balances for Alice and Bob are ${balances[0]} and ${balances[1]}`);
|
||||
}
|
||||
|
||||
main().catch(console.error).finally(() => process.exit());
|
||||
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"name": "05_read_storage_at",
|
||||
"version": "0.2.0",
|
||||
"description": "Example showing how to query storage at a specific block",
|
||||
"main": "index.js",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"clean": "rimraf node_modules",
|
||||
"start": "node index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@polkadot/api": "*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"rimraf": "^2.6.2"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
// @ts-check
|
||||
// Import the API, Keyring and some utility functions
|
||||
const { ApiPromise } = require('@polkadot/api');
|
||||
const { Keyring } = require('@polkadot/keyring');
|
||||
const { ApiPromise } = require('@plugnet/api');
|
||||
const { Keyring } = require('@plugnet/keyring');
|
||||
|
||||
const BOB = '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty';
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"start": "node index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@polkadot/api": "*"
|
||||
"@plugnet/api": "^0.76.102"
|
||||
},
|
||||
"devDependencies": {
|
||||
"rimraf": "^2.6.2"
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
# Make a Transfer with allowed block permissions
|
||||
|
||||
This transactions shows you how to add a nonce and a valid length of blocks a transaction is valid for.
|
||||
|
||||
This is important because as an account drops below the exsistential limit (0.1 dots) it gets pruned from the state tree. If it is added back its nonce starts at 0 again and is now vulnerable to replay attacks.
|
||||
@@ -1,43 +0,0 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
// Import the API, Keyring and some utility functions
|
||||
const { ApiPromise } = require('@polkadot/api');
|
||||
const { Keyring } = require('@polkadot/keyring');
|
||||
const { createType } = require('@polkadot/types');
|
||||
|
||||
const BOB = '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty';
|
||||
|
||||
async function main () {
|
||||
// Instantiate the API
|
||||
const api = await ApiPromise.create(); // default provider
|
||||
|
||||
// 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-derived path (empty phrase, so uses dev)
|
||||
const alice = keyring.addFromUri('//Alice');
|
||||
|
||||
// Get nonce for account
|
||||
const nonce = await api.query.system.accountNonce(alice.address);
|
||||
|
||||
// get current block
|
||||
const signedBlock = await api.rpc.chain.getBlock();
|
||||
|
||||
// get current block height and hash
|
||||
const currentHeight = signedBlock.block.header.number;
|
||||
const blockHash = signedBlock.block.header.hash;
|
||||
|
||||
// NOTE By default the API will send mortal transactions, only explicitly construct
|
||||
// if you wish to override the defaults
|
||||
// construct a mortal era
|
||||
const era = createType('ExtrinsicEra', { current: currentHeight, period: 10 });
|
||||
|
||||
// Create an extrinsic, transferring 12345 units to Bob
|
||||
const transfer = api.tx.balances.transfer(BOB, 12345);
|
||||
|
||||
// Sign and send the transaction using our account with a nonce and the length of blocks the transaction is valid for
|
||||
const hash = await transfer.signAndSend(alice, { blockHash, era, nonce });
|
||||
|
||||
console.log('Transfer sent with hash', hash.toHex());
|
||||
}
|
||||
|
||||
main().catch(console.error).finally(() => process.exit());
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"name": "07_make_transfer_with_allowed_block_permissions_only",
|
||||
"version": "0.1.0",
|
||||
"description": "Example showing how to make a transfer with allowed block permissions",
|
||||
"main": "index.js",
|
||||
"author": "Jesse",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"clean": "rimraf node_modules",
|
||||
"start": "node index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@polkadot/api": "0.80.1",
|
||||
"@polkadot/keyring": "^0.93.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"rimraf": "^2.6.2"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
// @ts-check
|
||||
// Import the API
|
||||
const { ApiPromise } = require('@polkadot/api');
|
||||
const { ApiPromise } = require('@plugnet/api');
|
||||
|
||||
async function main () {
|
||||
// Create our API with a default connection to the local node
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"start": "node index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@polkadot/api": "*"
|
||||
"@plugnet/api": "^0.76.102"
|
||||
},
|
||||
"devDependencies": {
|
||||
"rimraf": "^2.6.2"
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
// @ts-check
|
||||
// Import the API & Provider and some utility functions
|
||||
const { ApiPromise } = require('@polkadot/api');
|
||||
const { ApiPromise } = require('@plugnet/api');
|
||||
|
||||
// import the test keyring (already has dev keys for Alice, Bob, Charlie, Eve & Ferdie)
|
||||
const testKeyring = require('@polkadot/keyring/testing');
|
||||
const testKeyring = require('@plugnet/keyring/testing');
|
||||
|
||||
// utility function for random values
|
||||
const { randomAsU8a } = require('@polkadot/util-crypto');
|
||||
const { randomAsU8a } = require('@plugnet/util-crypto');
|
||||
|
||||
// some constants we are using in this sample
|
||||
const ALICE = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
|
||||
@@ -28,9 +28,9 @@ async function main () {
|
||||
const alicePair = keyring.getPair(ALICE);
|
||||
|
||||
// create a new random recipient
|
||||
const recipient = keyring.addFromSeed(randomAsU8a(32)).address;
|
||||
const recipient = keyring.addFromSeed(randomAsU8a(32)).address();
|
||||
|
||||
console.log('Sending', AMOUNT, 'from', alicePair.address, 'to', recipient, 'with nonce', nonce.toString());
|
||||
console.log('Sending', AMOUNT, 'from', alicePair.address(), 'to', recipient, 'with nonce', nonce.toString());
|
||||
|
||||
// Do the transfer and track the actual status
|
||||
api.tx.balances
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"start": "node index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@polkadot/api": "*"
|
||||
"@plugnet/api": "^0.76.102"
|
||||
},
|
||||
"devDependencies": {
|
||||
"rimraf": "^2.6.2"
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
// @ts-check
|
||||
// Import the API & Provider and some utility functions
|
||||
const { ApiPromise, WsProvider } = require('@polkadot/api');
|
||||
const { ApiPromise, WsProvider } = require('@plugnet/api');
|
||||
|
||||
// import the test keyring (already has dev keys for Alice, Bob, Charlie, Eve & Ferdie)
|
||||
const testKeyring = require('@polkadot/keyring/testing');
|
||||
const testKeyring = require('@plugnet/keyring/testing');
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
@@ -12,7 +12,7 @@ async function main () {
|
||||
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 });
|
||||
const api = await ApiPromise.create(provider);
|
||||
|
||||
// retrieve the upgrade key from the chain state
|
||||
const adminId = await api.query.sudo.key();
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"start": "node index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@polkadot/api": "*"
|
||||
"@plugnet/api": "^0.76.102"
|
||||
},
|
||||
"devDependencies": {
|
||||
"rimraf": "^2.6.2"
|
||||
|
||||
@@ -18,7 +18,9 @@ From each folder, run `yarn` to install the required dependencies and then run `
|
||||
|
||||
Some of the examples use the following accounts:
|
||||
|
||||
- Alice: `5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY`
|
||||
- Bob: `5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty`
|
||||
- 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` (via `keyring.addUri(...)`, dev seed implied) and the seed of Bob is... well you guess...
|
||||
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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Simple Connect
|
||||
|
||||
The following example shows how to instantiate a Polkadot API object and use it to connect to a node using ApiRx.
|
||||
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
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
// Required imports
|
||||
const { zip } = require('rxjs');
|
||||
const { ApiRx } = require('@polkadot/api');
|
||||
const { WsProvider } = require('@polkadot/rpc-provider');
|
||||
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();
|
||||
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
|
||||
@@ -17,7 +16,9 @@ function main () {
|
||||
api.rpc.system.chain(),
|
||||
api.rpc.system.name(),
|
||||
api.rpc.system.version()
|
||||
).subscribe(([chain, nodeName, nodeVersion]) => {
|
||||
)
|
||||
// Then we subscribe to the result
|
||||
.subscribe(([chain, nodeName, nodeVersion]) => {
|
||||
console.log(`You are connected to chain ${chain} using ${nodeName} v${nodeVersion}`);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
},
|
||||
|
||||
"dependencies": {
|
||||
"@polkadot/api": "*"
|
||||
"@plugnet/api": "^0.76.102"
|
||||
},
|
||||
"devDependencies": {
|
||||
"rimraf": "^2.6.2"
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
// Import the API
|
||||
const { ApiRx } = require('@polkadot/api');
|
||||
const { ApiRx } = require('@plugnet/api');
|
||||
const { switchMap } = require('rxjs/operators');
|
||||
|
||||
async function main () {
|
||||
@@ -13,7 +12,7 @@ async function main () {
|
||||
api.rpc.chain.subscribeNewHead()
|
||||
))
|
||||
.subscribe((header) => {
|
||||
console.log(`Chain is at block: #${header.number}`);
|
||||
console.log(`Chain is at block: #${header.blockNumber}`);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"start": "node index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@polkadot/api": "*"
|
||||
"@plugnet/api": "^0.76.102"
|
||||
},
|
||||
"devDependencies": {
|
||||
"rimraf": "^2.6.2"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Listen to balance changes
|
||||
|
||||
This example shows how to instantiate a Polkadot API object and use it to connect to a node and retrieve balance updates.
|
||||
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
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
// Import the API and operators from RxJs
|
||||
const { ApiRx } = require('@polkadot/api');
|
||||
const { ApiRx } = require('@plugnet/api');
|
||||
const { pairwise, startWith } = require('rxjs/operators');
|
||||
|
||||
// Known account we want to use (available on dev chain, with funds)
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"start": "node index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@polkadot/api": "*"
|
||||
"@plugnet/api": "^0.76.102"
|
||||
},
|
||||
"devDependencies": {
|
||||
"rimraf": "^2.6.2"
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
// Import the API
|
||||
const { ApiRx } = require('@polkadot/api');
|
||||
const { ApiRx } = require('@plugnet/api');
|
||||
const { switchMap } = require('rxjs/operators');
|
||||
|
||||
async function main () {
|
||||
@@ -12,7 +11,7 @@ async function main () {
|
||||
api.rpc.chain.subscribeNewHead()
|
||||
))
|
||||
.subscribe((header) => {
|
||||
console.log(`Chain is at block: #${header.number}`);
|
||||
console.log(`Chain is at block: #${header.blockNumber}`);
|
||||
});
|
||||
|
||||
// In this example we're calling the Overvables unsubscribe() //
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"start": "node index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@polkadot/api": "*"
|
||||
"@plugnet/api": "^0.76.102"
|
||||
},
|
||||
"devDependencies": {
|
||||
"rimraf": "^2.6.2"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
// Import the API
|
||||
const { ApiRx } = require('@polkadot/api');
|
||||
const { ApiRx } = require('@plugnet/api');
|
||||
// Import dependencies from RxJs
|
||||
const { combineLatest, of } = require('rxjs');
|
||||
const { first, switchMap } = require('rxjs/operators');
|
||||
|
||||
@@ -9,7 +9,7 @@ const Alice = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
|
||||
|
||||
function main () {
|
||||
// Create our API with a default connection to the local node
|
||||
new ApiRx().isReady
|
||||
new ApiRx(provider).isReady
|
||||
.pipe(
|
||||
// Here we ake our basic chain state/storage queries
|
||||
switchMap((api) => combineLatest(
|
||||
@@ -48,4 +48,4 @@ function main () {
|
||||
});
|
||||
}
|
||||
|
||||
main().catch(console.error).finally(() => process.exit());
|
||||
main().catch(console.error).finally(_ => process.exit());
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"start": "node index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@polkadot/api": "*"
|
||||
"@plugnet/api": "^0.76.102"
|
||||
},
|
||||
"devDependencies": {
|
||||
"rimraf": "^2.6.2"
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
// Import the API, Keyring and some utility functions
|
||||
const { ApiRx } = require('@polkadot/api');
|
||||
const { Keyring } = require('@polkadot/keyring');
|
||||
const { ApiRx } = require('@plugnet/api');
|
||||
const { Keyring } = require('@plugnet/keyring');
|
||||
|
||||
const BOB = '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty';
|
||||
|
||||
@@ -18,7 +17,7 @@ async function main () {
|
||||
// Create a extrinsic, transferring 12345 units to Bob.
|
||||
api.tx.balances
|
||||
// create transfer
|
||||
.transfer(BOB, 12345)
|
||||
.transfer(BOB, randomAmount)
|
||||
// Sign and send the transcation
|
||||
.signAndSend(alice)
|
||||
// Subscribe to the status updates of the transfer
|
||||
@@ -31,4 +30,4 @@ async function main () {
|
||||
});
|
||||
}
|
||||
|
||||
main().catch(console.error).finally(() => process.exit());
|
||||
main().catch(console.error).finally(_ => process.exit());
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"start": "node index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@polkadot/api": "*"
|
||||
"@plugnet/api": "^0.76.102"
|
||||
},
|
||||
"devDependencies": {
|
||||
"rimraf": "^2.6.2"
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
// Import the API and selected RxJs operators
|
||||
const { switchMap } = require('rxjs/operators');
|
||||
const { ApiRx } = require('@polkadot/api');
|
||||
const { ApiRx } = require('@plugnet/api');
|
||||
|
||||
async function main () {
|
||||
// Create our API with a default connection to the local node
|
||||
@@ -10,9 +9,8 @@ async function main () {
|
||||
switchMap((api) =>
|
||||
// subscribe to system events via storage
|
||||
api.query.system.events()
|
||||
)
|
||||
)
|
||||
// Then we're subscribing to the emitted results
|
||||
))
|
||||
// Then we're subscribing to the emitted results
|
||||
.subscribe((events) => {
|
||||
console.log(`\nReceived ${events.length} events:`);
|
||||
// loop through the Vec<EventRecord>
|
||||
@@ -31,7 +29,7 @@ async function main () {
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
main().catch((error) => {
|
||||
console.error(error);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"start": "node index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@polkadot/api": "*"
|
||||
"@plugnet/api": "^0.76.102"
|
||||
},
|
||||
"devDependencies": {
|
||||
"rimraf": "^2.6.2"
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
// Import the API and some utility functions
|
||||
const { ApiRx } = require('@polkadot/api');
|
||||
const { ApiRx } = require('@plugnet/api');
|
||||
|
||||
// import the test keyring (already has dev keys for Alice, Bob, Charlie, Eve & Ferdie)
|
||||
const testKeyring = require('@polkadot/keyring/testing');
|
||||
const testKeyring = require('@plugnet/keyring/testing');
|
||||
|
||||
// utility function for random values
|
||||
const { randomAsU8a } = require('@polkadot/util-crypto');
|
||||
const { randomAsU8a } = require('@plugnet/util-crypto');
|
||||
|
||||
// some constants we are using in this sample
|
||||
const ALICE = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
|
||||
@@ -25,9 +24,9 @@ async function main () {
|
||||
const alicePair = keyring.getPair(ALICE);
|
||||
|
||||
// create a new random recipient
|
||||
const recipient = keyring.addFromSeed(randomAsU8a(32)).address;
|
||||
const recipient = keyring.addFromSeed(randomAsU8a(32)).address();
|
||||
|
||||
console.log('Sending', AMOUNT, 'from', alicePair.address, 'to', recipient);
|
||||
console.log('Sending', AMOUNT, 'from', alicePair.address(), 'to', recipient);
|
||||
|
||||
// get the nonce for the admin key
|
||||
// Create a extrinsic, transferring 12345 units to Bob.
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"start": "node index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@polkadot/api": "*"
|
||||
"@plugnet/api": "^0.76.102"
|
||||
},
|
||||
"devDependencies": {
|
||||
"rimraf": "^2.6.2"
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
// Import the API & Provider and some utility functions
|
||||
const { ApiRx, WsProvider } = require('@polkadot/api');
|
||||
const { ApiRx, WsPovider } = require('@plugnet/api');
|
||||
// import the test keyring (already has dev keys for Alice, Bob, Charlie, Eve & Ferdie)
|
||||
const testKeyring = require('@polkadot/keyring/testing');
|
||||
const testKeyring = require('@plugnet/keyring/testing');
|
||||
const fs = require('fs');
|
||||
|
||||
async function main () {
|
||||
@@ -10,7 +9,7 @@ async function main () {
|
||||
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();
|
||||
const api = await ApiRx.create(provider).toPromise();
|
||||
|
||||
// retrieve the upgrade key from the chain state
|
||||
const adminId = await api.query.sudo.key().toPromise();
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"start": "node index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@polkadot/api": "*"
|
||||
"@plugnet/api": "^0.76.102"
|
||||
},
|
||||
"devDependencies": {
|
||||
"rimraf": "^2.6.2"
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 7.3 KiB |
+12
-23
@@ -1,35 +1,24 @@
|
||||
/* eslint-disable @typescript-eslint/camelcase */
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
const config = require('@polkadot/dev/config/jest');
|
||||
const config = require('@plugnet/dev/config/jest');
|
||||
|
||||
module.exports = Object.assign({}, config, {
|
||||
moduleNameMapper: {
|
||||
'@polkadot/api-contract(.*)$': '<rootDir>/packages/api-contract/src/$1',
|
||||
'@polkadot/api-derive(.*)$': '<rootDir>/packages/api-derive/src/$1',
|
||||
'@polkadot/api-metadata(.*)$': '<rootDir>/packages/api-metadata/src/$1',
|
||||
'@polkadot/api(.*)$': '<rootDir>/packages/api/src/$1',
|
||||
'@polkadot/rpc-(core|provider)(.*)$': '<rootDir>/packages/rpc-$1/src/$2',
|
||||
'@polkadot/jsonrpc(.*)$': '<rootDir>/packages/type-jsonrpc/src/$1',
|
||||
'@polkadot/types(.*)$': '<rootDir>/packages/types/src/$1'
|
||||
'@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/api-contract/build',
|
||||
'<rootDir>/packages/api-metadata/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'
|
||||
],
|
||||
globals: {
|
||||
ws_local: 'ws://127.0.0.1:9944/',
|
||||
ws_local_substrate_master: 'ws://127.0.0.1:9945/',
|
||||
ws_local_substrate_1: 'ws://127.0.0.1:9946/',
|
||||
ws_local_substrate_2: 'ws://127.0.0.1:9947/',
|
||||
ws_local_polkadot_master: 'ws://127.0.0.1:9948/',
|
||||
ws_local_polkadot_alex: 'ws://127.0.0.1:9949/',
|
||||
ws_substrate_1: 'wss://substrate-rpc.parity.io/',
|
||||
ws_polkadot_alex: 'wss://poc3-rpc.polkadot.io/'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
+1
-1
@@ -9,5 +9,5 @@
|
||||
"packages": [
|
||||
"packages/*"
|
||||
],
|
||||
"version": "0.90.1"
|
||||
"version": "0.78.103"
|
||||
}
|
||||
|
||||
+14
-20
@@ -1,7 +1,8 @@
|
||||
{
|
||||
"version": "0.90.1",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"engines": {
|
||||
"node": ">=10.13.0",
|
||||
"yarn": "^1.10.1"
|
||||
},
|
||||
"workspaces": [
|
||||
@@ -9,31 +10,24 @@
|
||||
],
|
||||
"resolutions": {
|
||||
"babel-core": "^7.0.0-bridge.0",
|
||||
"typescript": "^3.5.3"
|
||||
"typescript": "~3.4.5"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "yarn build:interfaces && polkadot-dev-build-ts && yarn run build:methodsdoc && polkadot-dev-build-docs",
|
||||
"build": "plugnet-dev-build-ts && yarn run build:methodsdoc",
|
||||
"build:htmldoc": "yarn clean && typedoc --theme default --out docs/html",
|
||||
"build:interfaces": "node packages/types/src/scripts/interfacesTsWrapper.js",
|
||||
"build:methodsdoc": "node packages/types/src/scripts/MetadataMdWrapper.js",
|
||||
"check": "yarn lint",
|
||||
"lint": "eslint --ext .js,.jsx,.ts,.tsx . && tsc --noEmit --pretty",
|
||||
"clean": "polkadot-dev-clean-build",
|
||||
"postinstall": "polkadot-dev-yarn-only",
|
||||
"test": "jest --coverage --runInBand --testPathIgnorePatterns e2e",
|
||||
"test:all": "jest",
|
||||
"test:e2e": "jest packages/api/test/e2e",
|
||||
"test:e2e-docker": "TEST_DOCKER=1 jest packages/api/test/e2e",
|
||||
"test:e2e-remote": "TEST_REMOTE=1 jest packages/api/test/e2e",
|
||||
"test:one": "jest",
|
||||
"test:watch": "jest --coverage --watch"
|
||||
"lint": "tslint --project . && tsc --noEmit --pretty",
|
||||
"clean": "plugnet-dev-clean-build",
|
||||
"postinstall": "plugnet-dev-yarn-only",
|
||||
"test": "jest --coverage"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.5.5",
|
||||
"@babel/register": "^7.5.5",
|
||||
"@babel/runtime": "^7.5.5",
|
||||
"@polkadot/dev": "^0.31.0-beta.3",
|
||||
"@polkadot/ts": "^0.1.64",
|
||||
"gh-pages": "^2.1.1"
|
||||
"@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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
# @polkadot/api-contract
|
||||
|
||||
Interfaces to allow for the encoding and decoding of Substrate contract ABIs.
|
||||
|
||||
```js
|
||||
import { Abi } from '@polkadot/api-contract';
|
||||
|
||||
const abi = new Abi(<...JSON ABI...>);
|
||||
|
||||
api.tx.contracts
|
||||
.call(<contract addr>, <value>, <max gas>, abi.messages.<method name>(<...params...>))
|
||||
.signAndSend(<keyring pair>, (result: SubmittableResult) => { ... });
|
||||
```
|
||||
@@ -1,32 +0,0 @@
|
||||
{
|
||||
"name": "@polkadot/api-contract",
|
||||
"version": "0.90.1",
|
||||
"description": "Interfaces for interacting with contracts and contract ABIs",
|
||||
"main": "index.js",
|
||||
"keywords": [
|
||||
"Polkadot",
|
||||
"ABI"
|
||||
],
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [
|
||||
"Jaco Greeff <jacogr@gmail.com>"
|
||||
],
|
||||
"contributors": [],
|
||||
"license": "Apache-2.0",
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"registry": "https://registry.npmjs.org"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/polkadot-js/api.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/polkadot-js/api/issues"
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.5.5",
|
||||
"@polkadot/types": "^0.90.1"
|
||||
}
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/api-contract authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { ContractABIArg } from './types';
|
||||
|
||||
import typesAbi from '../test/abi/types.json';
|
||||
import erc20Abi from '../test/contracts/Erc20.json';
|
||||
|
||||
import { Abi } from '.';
|
||||
|
||||
describe('Abi', (): void => {
|
||||
describe('types encoding', (): void => {
|
||||
let abi: Abi;
|
||||
|
||||
beforeAll((): void => {
|
||||
abi = new Abi(typesAbi);
|
||||
});
|
||||
|
||||
function check (method: string, args: ContractABIArg[], type: string | null): void {
|
||||
const fn = abi.messages[method];
|
||||
|
||||
expect(fn.args).toEqual(args);
|
||||
expect(fn.type).toEqual(type);
|
||||
}
|
||||
|
||||
it('has the primitive method with args & return', (): void => {
|
||||
check(
|
||||
'primitive',
|
||||
[
|
||||
{ name: 'bool', type: 'bool' },
|
||||
{ name: 'u32', type: 'u32' }
|
||||
],
|
||||
'bool'
|
||||
);
|
||||
});
|
||||
|
||||
it('has the vector method with args & return', (): void => {
|
||||
check(
|
||||
'vector',
|
||||
[
|
||||
{ name: 'vecU8', type: 'Vec<u8>' },
|
||||
{ name: 'vecU32', type: 'Vec<u32>' }
|
||||
],
|
||||
'Vec<bool>'
|
||||
);
|
||||
});
|
||||
|
||||
it('has the vector_fixed method with args & return', (): void => {
|
||||
check(
|
||||
'vectorFixed',
|
||||
[
|
||||
{ name: 'vecU8Length32', type: '[u8;32]' }
|
||||
],
|
||||
'[u32;8]'
|
||||
);
|
||||
});
|
||||
|
||||
it('has the option method with args & return', (): void => {
|
||||
check(
|
||||
'option',
|
||||
[
|
||||
{ name: 'optionU32', type: 'Option<u32>' }
|
||||
],
|
||||
'Option<bool>'
|
||||
);
|
||||
});
|
||||
|
||||
it('has the result method with return (empty)', (): void => {
|
||||
check(
|
||||
'result',
|
||||
[],
|
||||
'()'
|
||||
);
|
||||
});
|
||||
|
||||
it('allows for nested args', (): void => {
|
||||
check(
|
||||
'nested',
|
||||
[
|
||||
{ name: 'optionVec', type: 'Option<Vec<u32>>' }
|
||||
],
|
||||
'Vec<(u32,u64)>'
|
||||
);
|
||||
});
|
||||
|
||||
describe('messages', (): void => {
|
||||
it('fails when invalid args are supplied', (): void => {
|
||||
expect(
|
||||
(): Uint8Array => abi.messages.primitive(false)
|
||||
).toThrow(/Expected 2 arguments to contract messages.primitive, found 1/);
|
||||
});
|
||||
|
||||
it('encodes primitives correctly', (): void => {
|
||||
expect(
|
||||
abi.messages.primitive(true, 0x12345678)
|
||||
).toEqual(new Uint8Array([
|
||||
9 << 2, // total length (4 + 1 + 4)
|
||||
0x67, 0x2b, 0, 0, // 11111 -> hex (LE)
|
||||
1, // true
|
||||
0x78, 0x56, 0x34, 0x12 // u32
|
||||
]));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('erc20', (): void => {
|
||||
let abi: Abi;
|
||||
|
||||
beforeEach((): void => {
|
||||
abi = new Abi(erc20Abi);
|
||||
});
|
||||
|
||||
it('has the attached methods', (): void => {
|
||||
expect(Object.keys(abi.messages)).toEqual(
|
||||
['totalSupply', 'balanceOf', 'allowance', 'transfer', 'approve', 'transferFrom']
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,31 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/api-contract authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { ContractABI, ContractABIFn, InterfaceAbi, AbiMessages } from './types';
|
||||
|
||||
import { stringCamelCase } from '@polkadot/util';
|
||||
|
||||
import { createMethod } from './method';
|
||||
import { validateAbi } from './validation';
|
||||
|
||||
export default class ContractAbi implements InterfaceAbi {
|
||||
public readonly abi: ContractABI;
|
||||
|
||||
public readonly deploy: ContractABIFn;
|
||||
|
||||
public readonly messages: AbiMessages = {};
|
||||
|
||||
public constructor (abi: ContractABI) {
|
||||
validateAbi(abi);
|
||||
|
||||
this.abi = abi;
|
||||
this.deploy = createMethod('deploy', abi.deploy);
|
||||
|
||||
abi.messages.forEach((method): void => {
|
||||
const name = stringCamelCase(method.name);
|
||||
|
||||
this.messages[name] = createMethod(`messages.${name}`, method);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/api-contract authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { SubmittableModuleExtrinsics } from '@polkadot/api/types';
|
||||
import { ApiObject, ContractABI, ContractBase } from './types';
|
||||
|
||||
import { assert } from '@polkadot/util';
|
||||
|
||||
import Abi from './Abi';
|
||||
|
||||
// NOTE Experimental, POC, bound to change
|
||||
export default abstract class RxBase implements ContractBase<'rxjs'> {
|
||||
public readonly abi: Abi;
|
||||
|
||||
public readonly api: ApiObject<'rxjs'>;
|
||||
|
||||
public readonly apiContracts: SubmittableModuleExtrinsics<'rxjs'>;
|
||||
|
||||
public constructor (api: ApiObject<'rxjs'>, abi: ContractABI | Abi) {
|
||||
this.abi = abi instanceof Abi
|
||||
? abi
|
||||
: new Abi(abi);
|
||||
this.api = api;
|
||||
|
||||
// cater for substrate 2.x & 1.x (in order)
|
||||
this.apiContracts = api.tx.contracts || api.tx.contract;
|
||||
|
||||
assert(this.apiContracts && this.apiContracts.putCode, `You need to connect to a node with the contracts module, the metadata does not enable api.tx.contracts on this instance`);
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/api-contract authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { ISubmittableResult, SubmittableResult } from '@polkadot/api/SubmittableExtrinsic';
|
||||
import { AccountId, Address, Hash } from '@polkadot/types/interfaces';
|
||||
import { IKeyringPair } from '@polkadot/types/types';
|
||||
import { ContractABI } from './types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { ApiRx } from '@polkadot/api';
|
||||
import { createType } from '@polkadot/types';
|
||||
|
||||
import Abi from './Abi';
|
||||
import RxBase from './RxBase';
|
||||
import RxContract from './RxContract';
|
||||
|
||||
type BlueprintCreateResultSubscription = Observable<BlueprintCreateResult>;
|
||||
|
||||
export interface BlueprintCreate {
|
||||
signAndSend (account: IKeyringPair | string | AccountId | Address): BlueprintCreateResultSubscription;
|
||||
}
|
||||
|
||||
class BlueprintCreateResult extends SubmittableResult {
|
||||
public readonly contract?: RxContract;
|
||||
|
||||
public constructor (result: ISubmittableResult, contract?: RxContract) {
|
||||
super(result);
|
||||
|
||||
this.contract = contract;
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE Experimental, POC, bound to change
|
||||
export default class Blueprint extends RxBase {
|
||||
public readonly codeHash: Hash;
|
||||
|
||||
public constructor (api: ApiRx, abi: ContractABI | Abi, codeHash: string | Hash) {
|
||||
super(api, abi);
|
||||
|
||||
this.codeHash = createType('Hash', codeHash);
|
||||
}
|
||||
|
||||
public deployContract (endowment: number | BN, maxGas: number | BN, ...params: any[]): BlueprintCreate {
|
||||
const signAndSend = (account: IKeyringPair | string | AccountId | Address): BlueprintCreateResultSubscription => {
|
||||
return this.apiContracts
|
||||
.create(endowment, maxGas, this.codeHash, this.abi.deploy(...params))
|
||||
.signAndSend(account)
|
||||
.pipe(map(this.createResult));
|
||||
};
|
||||
|
||||
return { signAndSend };
|
||||
}
|
||||
|
||||
private createResult = (result: SubmittableResult): BlueprintCreateResult => {
|
||||
let contract: RxContract | undefined;
|
||||
|
||||
if (result.isFinalized) {
|
||||
const record = result.findRecord('contract', 'Instantiated');
|
||||
|
||||
if (record) {
|
||||
contract = new RxContract(this.api, this.abi, record.event.data[1] as Address);
|
||||
}
|
||||
}
|
||||
|
||||
return new BlueprintCreateResult(result, contract);
|
||||
}
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/api-contract authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { ISubmittableResult, SubmittableResult } from '@polkadot/api/SubmittableExtrinsic';
|
||||
import { AccountId, Address, Hash } from '@polkadot/types/interfaces';
|
||||
import { IKeyringPair } from '@polkadot/types/types';
|
||||
import { ContractABI } from './types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { ApiRx } from '@polkadot/api';
|
||||
import { compactAddLength, u8aToU8a } from '@polkadot/util';
|
||||
|
||||
import Abi from './Abi';
|
||||
import RxBase from './RxBase';
|
||||
import RxBlueprint from './RxBlueprint';
|
||||
|
||||
// Ok, tried, failed, eventually ... well, we are only trying with RxJs as a
|
||||
// start, so take a big fat shortcut with this version, real intended version
|
||||
// follows this and is commented out
|
||||
type CodePutCodeResultSubscription = Observable<CodePutCodeResult>;
|
||||
// type ICodePutCodeResultSubscription<ApiType> =
|
||||
// ApiType extends 'rxjs'
|
||||
// ? Observable<CodePutCodeResult>
|
||||
// : Promise<() => void>;
|
||||
|
||||
// unlike the ISubmittableExtrinsic, it doesn't extend IExtrinsic and only
|
||||
// implements one var iant of signAndSend - this is purely done to see what
|
||||
// is hanging where, with the bare-mainimum from a simplicity perspective
|
||||
// Very obvious is that it supports only 1 version of signAndSend
|
||||
// (we need to revisit this, but probably ok for initial?)
|
||||
// eslint-disable-next-line @typescript-eslint/interface-name-prefix
|
||||
export interface CodePutCode {
|
||||
signAndSend (account: IKeyringPair | string | AccountId | Address): CodePutCodeResultSubscription;
|
||||
}
|
||||
|
||||
class CodePutCodeResult extends SubmittableResult {
|
||||
public readonly blueprint?: RxBlueprint;
|
||||
|
||||
public constructor (result: ISubmittableResult, blueprint?: RxBlueprint) {
|
||||
super(result);
|
||||
|
||||
this.blueprint = blueprint;
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE Experimental, POC, bound to change
|
||||
export default class RxCode extends RxBase {
|
||||
public readonly code: Uint8Array;
|
||||
|
||||
public constructor (api: ApiRx, abi: ContractABI | Abi, wasm: string | Uint8Array) {
|
||||
super(api, abi);
|
||||
|
||||
this.code = u8aToU8a(wasm);
|
||||
}
|
||||
|
||||
public createBlueprint (maxGas: number | BN): CodePutCode {
|
||||
const signAndSend = (account: IKeyringPair | string | AccountId | Address): CodePutCodeResultSubscription => {
|
||||
return this.apiContracts
|
||||
.putCode(maxGas, compactAddLength(this.code))
|
||||
.signAndSend(account)
|
||||
.pipe(map(this.createResult));
|
||||
};
|
||||
|
||||
return { signAndSend };
|
||||
}
|
||||
|
||||
private createResult = (result: ISubmittableResult): CodePutCodeResult => {
|
||||
let blueprint: RxBlueprint | undefined;
|
||||
|
||||
if (result.isFinalized) {
|
||||
const record = result.findRecord('contract', 'CodeStored');
|
||||
|
||||
if (record) {
|
||||
blueprint = new RxBlueprint(this.api, this.abi, record.event.data[0] as Hash);
|
||||
}
|
||||
}
|
||||
|
||||
return new CodePutCodeResult(result, blueprint);
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/api-contract authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { AccountId, Address } from '@polkadot/types/interfaces';
|
||||
import { IKeyringPair } from '@polkadot/types/types';
|
||||
import { ContractABI, ContractABIFn, InterfaceContract, InterfaceContractCalls } from './types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import { Observable } from 'rxjs';
|
||||
import { ApiRx } from '@polkadot/api';
|
||||
import { SubmittableResult } from '@polkadot/api/SubmittableExtrinsic';
|
||||
import { createType } from '@polkadot/types';
|
||||
import Abi from './Abi';
|
||||
import RxBase from './RxBase';
|
||||
|
||||
export type ContractCallResultSubscription = Observable<SubmittableResult>;
|
||||
|
||||
export interface ContractCall {
|
||||
signAndSend (account: IKeyringPair | string | AccountId | Address): ContractCallResultSubscription;
|
||||
}
|
||||
|
||||
type CallResult = (value: BN | number, maxGas: BN | number, ...params: any[]) => ContractCall;
|
||||
|
||||
// NOTE Experimental, POC, bound to change
|
||||
export default class RxContract extends RxBase implements InterfaceContract {
|
||||
public readonly address: Address;
|
||||
|
||||
public readonly calls: InterfaceContractCalls = {};
|
||||
|
||||
public constructor (api: ApiRx, abi: ContractABI | Abi, address: string | AccountId | Address) {
|
||||
super(api, abi);
|
||||
|
||||
this.address = createType('Address', address);
|
||||
|
||||
Object.entries(abi.messages).forEach(([name]): void => {
|
||||
this.calls[name] = (fn: ContractABIFn): CallResult =>
|
||||
(value: BN | number, maxGas: BN | number, ...params: any[]): ContractCall =>
|
||||
this.apiContracts.call(this.address, value, maxGas, fn(...params));
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/api-contract authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
export { default as Abi } from './Abi';
|
||||
export { default as RxBlueprint } from './RxBlueprint';
|
||||
export { default as RxCode } from './RxCode';
|
||||
export { default as RxContract } from './RxContract';
|
||||
@@ -1,69 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/api-contract authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { CodecArg, Constructor } from '@polkadot/types/types';
|
||||
import { ContractABIFn, ContractABIFnArg, ContractABIMethod, ContractABIMethodBase, ContractABITypes } from './types';
|
||||
|
||||
import { Compact, createClass } from '@polkadot/types';
|
||||
import { assert, isString, isUndefined, stringCamelCase } from '@polkadot/util';
|
||||
|
||||
export function typeToString (type: ContractABITypes): string {
|
||||
if (isString(type)) {
|
||||
return type;
|
||||
} else if (Array.isArray(type)) {
|
||||
return `(${type.map((type): string => typeToString(type)).join(',')})`;
|
||||
} else if (type['Option<T>']) {
|
||||
return `Option<${typeToString(type['Option<T>'].T)}>`;
|
||||
} else if (type['Result<T,E>']) {
|
||||
return `()`; // Result is not supported, but only applicable for returns
|
||||
} else if (type['Vec<T>']) {
|
||||
return `Vec<${typeToString(type['Vec<T>'].T)}>`;
|
||||
} else if (type['[T;n]']) {
|
||||
return `[${typeToString(type['[T;n]'].T)};${type['[T;n]'].n}]`;
|
||||
}
|
||||
|
||||
throw new Error(`Unknown type specified ${JSON.stringify(type)}`);
|
||||
}
|
||||
|
||||
export function createArgClass (args: ContractABIFnArg[], baseDef: Record<string, string>): Constructor {
|
||||
return createClass(
|
||||
JSON.stringify(
|
||||
args.reduce((base: Record<string, any>, { name, type }): Record<string, any> => {
|
||||
base[name] = type;
|
||||
|
||||
return base;
|
||||
}, baseDef)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export function createMethod (name: string, method: Partial<ContractABIMethod> & ContractABIMethodBase): ContractABIFn {
|
||||
const args: ContractABIFnArg[] = method.args.map(({ name, type }): ContractABIFnArg => ({
|
||||
name: stringCamelCase(name),
|
||||
type: typeToString(type)
|
||||
}));
|
||||
const Clazz = createArgClass(args, isUndefined(method.selector) ? {} : { __selector: 'u32' });
|
||||
const baseStruct: { [index: string]: any } = { __selector: method.selector };
|
||||
const encoder = (...params: CodecArg[]): Uint8Array => {
|
||||
assert(params.length === args.length, `Expected ${args.length} arguments to contract ${name}, found ${params.length}`);
|
||||
|
||||
const u8a = new Clazz(
|
||||
args.reduce((mapped, { name }, index): Record<string, CodecArg> => {
|
||||
mapped[name] = params[index];
|
||||
|
||||
return mapped;
|
||||
}, { ...baseStruct })
|
||||
).toU8a();
|
||||
|
||||
return Compact.addLengthPrefix(u8a);
|
||||
};
|
||||
|
||||
const fn = (encoder as ContractABIFn);
|
||||
|
||||
fn.args = args;
|
||||
fn.isConstant = !(method.mutates || false);
|
||||
fn.type = method.return_type ? typeToString(method.return_type) : null;
|
||||
|
||||
return fn;
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/api-contract authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { SubmittableModuleExtrinsics } from '@polkadot/api/types';
|
||||
import { Address } from '@polkadot/types/interfaces';
|
||||
import { CodecArg } from '@polkadot/types/types';
|
||||
|
||||
import { ApiPromise, ApiRx } from '@polkadot/api';
|
||||
|
||||
export type ApiObject<ApiType> = ApiType extends 'rxjs'
|
||||
? ApiRx
|
||||
: ApiPromise;
|
||||
|
||||
export interface ContractABITypesStruct {
|
||||
'Option<T>'?: {
|
||||
T: ContractABITypes;
|
||||
};
|
||||
'Result<T,E>'?: {
|
||||
T: ContractABITypes;
|
||||
E: ContractABITypes;
|
||||
};
|
||||
'Vec<T>'?: {
|
||||
T: ContractABITypes;
|
||||
};
|
||||
'[T;n]'?: {
|
||||
T: ContractABITypes;
|
||||
n: number;
|
||||
};
|
||||
}
|
||||
|
||||
export type ContractABITypes = string | ContractABITypesStruct | (string | ContractABITypesStruct)[];
|
||||
|
||||
export interface ContractABIArg {
|
||||
name: string;
|
||||
type: ContractABITypes;
|
||||
}
|
||||
|
||||
export interface ContractABIMethodBase {
|
||||
args: ContractABIArg[];
|
||||
}
|
||||
|
||||
export interface ContractABIMethod extends ContractABIMethodBase {
|
||||
mutates?: boolean;
|
||||
name: string;
|
||||
selector: number;
|
||||
return_type: ContractABITypes | null;
|
||||
}
|
||||
|
||||
export interface ContractABI {
|
||||
deploy: ContractABIMethodBase;
|
||||
messages: ContractABIMethod[];
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface ContractABIFnArg {
|
||||
name: string;
|
||||
type: string;
|
||||
}
|
||||
|
||||
export interface ContractABIMeta {
|
||||
args: ContractABIFnArg[];
|
||||
isConstant: boolean;
|
||||
type: string | null;
|
||||
}
|
||||
|
||||
export interface ContractABIFn extends ContractABIMeta {
|
||||
(...args: CodecArg[]): Uint8Array;
|
||||
}
|
||||
|
||||
export type AbiMessages = Record<string, ContractABIFn>;
|
||||
|
||||
export interface InterfaceAbi {
|
||||
readonly abi: ContractABI;
|
||||
readonly deploy: ContractABIFn;
|
||||
readonly messages: AbiMessages;
|
||||
}
|
||||
|
||||
export interface ContractBase<ApiType> {
|
||||
readonly abi: InterfaceAbi;
|
||||
readonly api: ApiObject<ApiType>;
|
||||
readonly apiContracts: SubmittableModuleExtrinsics<ApiType>;
|
||||
}
|
||||
|
||||
export interface InterfaceContractCalls {
|
||||
[index: string]: Function;
|
||||
}
|
||||
|
||||
export interface InterfaceContract {
|
||||
readonly address: Address;
|
||||
readonly calls: InterfaceContractCalls;
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/api-contract authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { ContractABI, ContractABIArg } from './types';
|
||||
|
||||
import { assert, isNumber, isNull, isString, isObject } from '@polkadot/util';
|
||||
|
||||
export function validateArgs (name: string, args: ContractABIArg[]): void {
|
||||
assert(Array.isArray(args), `Expected 'args' to exist on ${name}`);
|
||||
|
||||
args.forEach((arg): void => {
|
||||
const unknownKeys = Object.keys(arg).filter((key): boolean => !['name', 'type'].includes(key));
|
||||
|
||||
assert(unknownKeys.length === 0, `Unknown keys ${unknownKeys.join(', ')} found in ABI args for ${name}`);
|
||||
assert(isString(arg.name), `${name} args should have valid name `);
|
||||
assert(isString(arg.type) || isObject(arg.type), `${name} args should have valid type`);
|
||||
});
|
||||
}
|
||||
|
||||
export function validateDeploy ({ deploy }: ContractABI): void {
|
||||
const unknownKeys = Object.keys(deploy).filter((key): boolean => !['args'].includes(key));
|
||||
|
||||
assert(unknownKeys.length === 0, `Unknown keys ${unknownKeys.join(', ')} found in ABI deploy`);
|
||||
|
||||
validateArgs('deploy', deploy.args);
|
||||
}
|
||||
|
||||
export function validateMethods ({ messages }: ContractABI): void {
|
||||
messages.forEach((method): void => {
|
||||
const unknownKeys = Object.keys(method).filter((key): boolean => !['args', 'mutates', 'name', 'selector', 'return_type'].includes(key));
|
||||
|
||||
assert(unknownKeys.length === 0, `Unknown keys ${unknownKeys.join(', ')} found in ABI args for messages.${method.name}`);
|
||||
assert(isString(method.name), `Expected name for messages.${method.name}`);
|
||||
assert(isNumber(method.selector), `Expected selector for messages.${method.name}`);
|
||||
assert(isNull(method.return_type) || isString(method.return_type) || isObject(method.return_type), `Expected return_type for messages.${method.name}`);
|
||||
|
||||
validateArgs(`messages.${method.name}`, method.args);
|
||||
});
|
||||
}
|
||||
|
||||
export function validateAbi (abi: ContractABI): void {
|
||||
const unknownKeys = Object.keys(abi).filter((key): boolean => !['deploy', 'messages', 'name'].includes(key));
|
||||
|
||||
assert(unknownKeys.length === 0, `Unknown fields ${unknownKeys.join(', ')} found in ABI`);
|
||||
assert(abi.deploy && abi.messages && isString(abi.name), 'ABI should have deploy, messages & name sections');
|
||||
|
||||
validateDeploy(abi);
|
||||
validateMethods(abi);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
A breaking change was introduced by substrate runtime spec_version 97. https://github.com/paritytech/substrate/pull/2911/files
|
||||
|
||||
The change had to be implemented in ink! which changed the structure of the Wasm files.
|
||||
|
||||
The Polkadot JS API is only supporting srml-contract and INK! versions after than spec_version 97.
|
||||
|
||||
**Compatibility**
|
||||
If the substrate version is older than this https://github.com/paritytech/substrate/pull/2911 it will only work
|
||||
with contracts generated by an ink! version prior to https://github.com/paritytech/ink/pull/129 and vice versa.
|
||||
@@ -1,142 +0,0 @@
|
||||
{
|
||||
"name": "Types",
|
||||
"deploy": {
|
||||
"args": []
|
||||
},
|
||||
"messages": [
|
||||
{
|
||||
"name": "primitive",
|
||||
"selector": 11111,
|
||||
"mutates": true,
|
||||
"args": [
|
||||
{
|
||||
"name": "bool",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"name": "u32",
|
||||
"type": "u32"
|
||||
}
|
||||
],
|
||||
"return_type": "bool"
|
||||
},
|
||||
{
|
||||
"name": "vector",
|
||||
"selector": 2222,
|
||||
"mutates": false,
|
||||
"args": [
|
||||
{
|
||||
"name": "Vec_u8",
|
||||
"type": {
|
||||
"Vec<T>": {
|
||||
"T": "u8"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Vec_u32",
|
||||
"type": {
|
||||
"Vec<T>": {
|
||||
"T": "u32"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"return_type": {
|
||||
"Vec<T>": {
|
||||
"T": "bool"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "vector_fixed",
|
||||
"selector": 3333,
|
||||
"mutates": false,
|
||||
"args": [
|
||||
{
|
||||
"name": "vec_u8_length_32",
|
||||
"type": {
|
||||
"[T;n]": {
|
||||
"T": "u8",
|
||||
"n": 32
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"return_type": {
|
||||
"[T;n]": {
|
||||
"T": "u32",
|
||||
"n": 8
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "option",
|
||||
"selector": 4444,
|
||||
"mutates": false,
|
||||
"args": [
|
||||
{
|
||||
"name": "Option_u32",
|
||||
"type": {
|
||||
"Option<T>": {
|
||||
"T": "u32"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"return_type": {
|
||||
"Option<T>": {
|
||||
"T": "bool"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "tuple",
|
||||
"selector": 5555,
|
||||
"mutates": false,
|
||||
"args": [
|
||||
{
|
||||
"name": "Tuple_u32_u64",
|
||||
"type": ["u32", "u64"]
|
||||
}
|
||||
],
|
||||
"return_type": ["bool"]
|
||||
},
|
||||
{
|
||||
"name": "result",
|
||||
"selector": 666,
|
||||
"mutates": false,
|
||||
"args": [],
|
||||
"return_type": {
|
||||
"Result<T,E>": {
|
||||
"T": "u32",
|
||||
"E": "u32"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "nested",
|
||||
"selector": 987654321,
|
||||
"mutates": false,
|
||||
"args": [
|
||||
{
|
||||
"name": "option_vec",
|
||||
"type": {
|
||||
"Option<T>": {
|
||||
"T": {
|
||||
"Vec<T>": {
|
||||
"T": "u32"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"return_type": {
|
||||
"Vec<T>": {
|
||||
"T": ["u32", "u64"]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
{"name":"Erc20","deploy":{"args":[{"name":"init_value","type":"Balance"}]},"messages":[{"name":"total_supply","selector":949181842,"mutates":false,"args":[],"return_type":"Balance"},{"name":"balance_of","selector":3827153702,"mutates":false,"args":[{"name":"owner","type":"AccountId"}],"return_type":"Balance"},{"name":"allowance","selector":3057219184,"mutates":false,"args":[{"name":"owner","type":"AccountId"},{"name":"spender","type":"AccountId"}],"return_type":"Balance"},{"name":"transfer","selector":3374842663,"mutates":true,"args":[{"name":"to","type":"AccountId"},{"name":"value","type":"Balance"}],"return_type":"bool"},{"name":"approve","selector":431186122,"mutates":true,"args":[{"name":"spender","type":"AccountId"},{"name":"value","type":"Balance"}],"return_type":"bool"},{"name":"transfer_from","selector":197482595,"mutates":true,"args":[{"name":"from","type":"AccountId"},{"name":"to","type":"AccountId"},{"name":"value","type":"Balance"}],"return_type":"bool"}]}
|
||||
@@ -1 +0,0 @@
|
||||
{"name":"Flipper","deploy":{"args":[]},"messages":[{"name":"flip","selector":970692492,"mutates":true,"args":[],"return_type":null},{"name":"get","selector":4266279973,"mutates":false,"args":[],"return_type":"bool"}]}
|
||||
@@ -1 +0,0 @@
|
||||
{"name":"Incrementer","deploy":{"args":[{"name":"init_value","type":"u32"}]},"messages":[{"name":"inc","selector":257544423,"mutates":true,"args":[{"name":"by","type":"u32"}],"return_type":null},{"name":"get","selector":4266279973,"mutates":false,"args":[],"return_type":"u32"},{"name":"compare","selector":363906316,"mutates":false,"args":[{"name":"with","type":"u32"}],"return_type":"bool"}]}
|
||||
@@ -1 +0,0 @@
|
||||
{"name":"SharedVec","deploy":{"args":[]},"messages":[{"name":"push","selector":865577567,"mutates":true,"args":[{"name":"value","type":"i32"}],"return_type":{"Result<T,E>":{"T":[],"E":"u32"}}},{"name":"register","selector":572030971,"mutates":true,"args":[{"name":"mutator","type":"AccountId"},{"name":"begin","type":{"Option<T>":{"T":"u32"}}},{"name":"end","type":{"Option<T>":{"T":"u32"}}}],"return_type":{"Result<T,E>":{"T":[],"E":"u32"}}},{"name":"set","selector":2028185770,"mutates":true,"args":[{"name":"at","type":"u32"},{"name":"to","type":"i32"}],"return_type":{"Result<T,E>":{"T":"i32","E":"u32"}}},{"name":"get","selector":4266279973,"mutates":false,"args":[{"name":"at","type":"u32"}],"return_type":{"Option<T>":{"T":"i32"}}},{"name":"len","selector":1403873684,"mutates":false,"args":[],"return_type":"u32"}]}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
# @polkadot/api-derive
|
||||
# @plugnet/api-derive
|
||||
|
||||
Common functions used across Polkadot, derived from RPC calls and storage queries.
|
||||
Common functions used across Plugnet, derived from RPC calls and storage queries.
|
||||
|
||||
## Classes
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user