Compare commits

...
684 Commits
Author SHA1 Message Date
Github Actions d1a1be49c5 [CI Skip] release/stable 3.11.1
skip-checks: true
2021-02-28 12:49:45 +00:00
Jaco Greeff 4b6ad647a2 3.11 (#3242) 2021-02-28 13:39:57 +01:00
Jaco Greeff 04f656cafa Ensure metadata.toJSON applies type aliasses (#3243) 2021-02-28 13:35:25 +01:00
Github Actions 09bbd5f6c9 [CI Skip] release/beta 3.10.3-19
skip-checks: true
2021-02-28 10:51:08 +00:00
Jaco Greeff dbc3df6d09 Bump common (#3241) 2021-02-28 11:42:16 +01:00
Github Actions 26865f92e3 [CI Skip] release/beta 3.10.3-18
skip-checks: true
2021-02-28 09:40:56 +00:00
Jaco Greeff 73045de73d Fix election candidate derive (#3239) 2021-02-28 10:33:16 +01:00
Github Actions 6d3491b9f1 [CI Skip] release/beta 3.10.3-17
skip-checks: true
2021-02-28 09:21:56 +00:00
Jaco Greeff 886f3a3c08 Revert "modified api-derive balances to allow use of custom balance storages … (#3223)" (#3238)
This reverts commit ab8b381d8b.
2021-02-28 10:12:54 +01:00
Github Actions c72f976895 [CI Skip] release/beta 3.10.3-16
skip-checks: true
2021-02-28 09:02:15 +00:00
Alex D ab8b381d8b modified api-derive balances to allow use of custom balance storages … (#3223)
* modified api-derive balances to allow use of custom balance storages via derives; current implementation only works with standard call signatures

* type predicate as filter value
2021-02-28 09:53:35 +01:00
Github Actions 443e29a3be [CI Skip] release/beta 3.10.3-15
skip-checks: true
2021-02-28 08:25:59 +00:00
Jaco Greeff 117bb5717a Bump common (#3236) 2021-02-28 09:16:54 +01:00
Github Actions 5fb76baa16 [CI Skip] release/beta 3.10.3-14
skip-checks: true
2021-02-28 07:32:13 +00:00
Jaco Greeff 274b3498d4 Gilt types (#3229) 2021-02-28 08:23:16 +01:00
Github Actions fa9e1c53e1 [CI Skip] release/beta 3.10.3-13
skip-checks: true
2021-02-27 14:34:11 +00:00
Jaco Greeff 3ebf7eb424 Adjust detectPackage for direct dependencies (#3227)
* Dependency detection

* packageInfo imports

* Dependency array

* Bump common

* Remove detectPackage comments (available in util)

* Bump
2021-02-27 15:25:05 +01:00
Github Actions 7d11e6f9a5 [CI Skip] release/beta 3.10.3-12
skip-checks: true
2021-02-27 12:24:59 +00:00
Jaco Greeff a0d6384b01 Cleanup exports (less indirection) (#3226)
* Cleanup exports (less indirection)

* packageInfo import
2021-02-27 13:17:07 +01:00
Github Actions 47afe2cfc6 [CI Skip] release/beta 3.10.3-11
skip-checks: true
2021-02-26 16:49:27 +00:00
Jaco Greeff c37a2fc756 Bump deps (#3224) 2021-02-26 17:39:59 +01:00
Github Actions e2545276bb [CI Skip] release/beta 3.10.3-10
skip-checks: true
2021-02-26 11:59:32 +00:00
Jaco Greeff 4219409ef8 Update to latest substrate metadata (#3220)
* Update to latest substrate metadata

* ExtendedBalance type
2021-02-26 12:49:19 +01:00
Github Actions c9e64d2a32 [CI Skip] release/beta 3.10.3-9
skip-checks: true
2021-02-26 07:50:31 +00:00
Jaco Greeff 41db3b2e35 Bump deps (#3219) 2021-02-26 08:40:39 +01:00
Github Actions ebe15dada6 [CI Skip] release/beta 3.10.3-8
skip-checks: true
2021-02-25 14:40:29 +00:00
Jaco Greeff c2cb5dc574 Bump deps (#3218) 2021-02-25 15:31:52 +01:00
Github Actions ba451348c0 [CI Skip] release/beta 3.10.3-7
skip-checks: true
2021-02-25 14:08:25 +00:00
Jaco Greeff ec76b11666 Only inject tx version from metadata (metadata 4+) (#3217)
* Only inject tx version from metadata (metadata 4+)

* No need for extra var
2021-02-25 14:58:32 +01:00
Jaco Greeff 7603f9e6c1 Fix MultiAddress decoding from raw publicKey (#3215)
* Fix Multiddress decoding from raw publicKey

* Full decoding on empty

* Update
2021-02-25 12:14:00 +01:00
Github Actions b50eab11c0 [CI Skip] release/beta 3.10.3-6
skip-checks: true
2021-02-25 10:02:34 +00:00
Jaco Greeff 66d05c1771 Bump common (elliptic imports fix for Node) (#3214) 2021-02-25 10:53:42 +01:00
Github Actions fd7c3d7e10 [CI Skip] release/beta 3.10.3-5
skip-checks: true
2021-02-24 17:11:53 +00:00
Jaco Greeff 28d4c7d808 Update .123trigger 2021-02-24 18:02:57 +01:00
Github Actions 43d36fbcf6 [CI Skip] release/beta 3.10.3-4
skip-checks: true
2021-02-24 16:59:57 +00:00
Jaco Greeff e54eef2369 Bump deps (#3212)
* Bump deps

* autolint
2021-02-24 17:51:51 +01:00
Github Actions 296842858f [CI Skip] release/beta 3.10.3-3
skip-checks: true
2021-02-24 09:26:06 +00:00
Jaco Greeff ba8849a3e9 Allow for CodecHash override & hasher option (#3206)
* Allow for CodecHash override & hasher option

* Adjust

* CodecHash maps to Hash
2021-02-24 10:17:29 +01:00
Github Actions e333c3d8d9 [CI Skip] release/beta 3.10.3-2
skip-checks: true
2021-02-23 15:19:38 +00:00
Jaco Greeff 0fe6a21624 Indexed enums (#3194)
* Indexed enums

* Type generation updates

* Cleanup createType

* Empty bytes default

* output tests

* Explicit entryIndex
2021-02-23 16:09:47 +01:00
Github Actions 0abedb81c6 [CI Skip] release/beta 3.10.3-1
skip-checks: true
2021-02-23 14:46:56 +00:00
Ian He 08eda72d4b clean ws-provider's states on disconnected (#3197)
* clean ws-provider's states on disconnected

* per comments
2021-02-23 15:36:10 +01:00
Github Actions 70d4126c84 [CI Skip] release/beta 3.10.3-0
skip-checks: true
2021-02-23 14:34:49 +00:00
Jaco Greeff dcccab705c Additional MultiAddress testing paths (#3205)
* Additional MultiAddress testing paths

* Update packages/types/src/generic/MultiAddress.ts
2021-02-23 15:25:48 +01:00
Github Actions e45ff6d026 [CI Skip] release/stable 3.10.2
skip-checks: true
2021-02-23 08:23:24 +00:00
Jaco Greeff b49c2314e7 Fix variable-length MultiAddress decoding (only detect 32 & 20) (#3204)
* Fix variable-length MultiAddress decoding (only detect 32 & 20)

* Decoding tests

* Fix Call test

* patch-only

* Update CHANGELOG.md
2021-02-23 09:13:47 +01:00
Github Actions 0ac085756a [CI Skip] release/beta 3.10.2-0
skip-checks: true
2021-02-22 16:00:25 +00:00
Jaco Greeff 542a690c89 Update contracts host weights (#3199)
* Update contracts host weights

* Update Limits
2021-02-22 16:50:16 +01:00
Github Actions ff23ead797 [CI Skip] release/stable 3.10.1
skip-checks: true
2021-02-22 08:45:21 +00:00
Jaco Greeff ae55e4fbf7 3.10 (#3198) 2021-02-22 09:36:29 +01:00
Github Actions b17412163d [CI Skip] release/beta 3.9.4-4
skip-checks: true
2021-02-21 12:18:23 +00:00
Jaco Greeff 46dcbf9a42 Bump common (#3196) 2021-02-21 13:09:51 +01:00
Github Actions 193dfcc32f [CI Skip] release/beta 3.9.4-3
skip-checks: true
2021-02-21 09:42:58 +00:00
Jaco Greeff a81011cf94 Adjust ConsumedWeight (#3195) 2021-02-21 10:34:07 +01:00
Github Actions d43a8b2e11 [CI Skip] release/beta 3.9.4-2
skip-checks: true
2021-02-20 11:47:18 +00:00
Jaco Greeff dff859ba68 Don't send unsubscribe when already disconnected (#3192)
* Don't send unsubscribe when already disconnected

* Small cleanups
2021-02-20 12:37:05 +01:00
Github Actions 5169b6ee69 [CI Skip] release/beta 3.9.4-1
skip-checks: true
2021-02-20 10:59:13 +00:00
Jaco Greeff f4405667fe Adjust use of staking derive multi (#3173)
* Adjust use of staking derive multi

* Remove migrateEra

* Flatten rewards
2021-02-20 11:51:48 +01:00
Github Actions 49ff636305 [CI Skip] release/beta 3.9.4-0
skip-checks: true
2021-02-16 12:00:27 +00:00
Jaco Greeff d77d686c76 Update detectPackage to use packgeInfo.ts (#3182) 2021-02-16 12:50:45 +01:00
Github Actions 502c6a3451 [CI Skip] release/stable 3.9.3
skip-checks: true
2021-02-16 06:47:07 +00:00
Jaco Greeff b58c77683d 3.9.3 PersistedValidationData (#3180) 2021-02-16 07:39:29 +01:00
Github Actions b9f82fc549 [CI Skip] release/stable 3.9.2
skip-checks: true
2021-02-15 09:05:52 +00:00
Jaco Greeff 25b8dba607 3.9.2 (#3176)
* 3.9.2

* Update CHANGELOG.md
2021-02-15 09:56:14 +01:00
Github Actions 1bc4f2c334 [CI Skip] release/beta 3.9.2-0
skip-checks: true
2021-02-15 06:47:13 +00:00
Nikos Kontakis aee8ac6b0a Update README.md (#3175)
Minor url link fixes (documentation portal and JSON-RPC methods link)
2021-02-15 07:37:11 +01:00
Github Actions aa7e30070f [CI Skip] release/stable 3.9.1
skip-checks: true
2021-02-14 17:46:51 +00:00
Jaco Greeff 64b5855f65 3.8 (#3174) 2021-02-14 18:39:44 +01:00
Github Actions d7ff9e706e [CI Skip] release/beta 3.8.2-5
skip-checks: true
2021-02-14 08:53:37 +00:00
Jaco Greeff 15ba6f6261 Adjust Result for Rust-compatible Err (w/ deprecation of is/asError) (#3172)
* Adjust Result for Rust-compatible Err (w/ deprecation of is/asError)

* Jsdoc comments

* test updates
2021-02-14 09:43:37 +01:00
Github Actions 8c88a880c6 [CI Skip] release/beta 3.8.2-4
skip-checks: true
2021-02-11 17:27:04 +00:00
Jaco Greeff 74566cce7b Update Rococo types (drop v0) (#3167) 2021-02-11 18:17:05 +01:00
Github Actions 16f6deed5e [CI Skip] release/beta 3.8.2-3
skip-checks: true
2021-02-10 12:14:16 +00:00
Jaco Greeff 40edc131fe Allow geneic args for keys/entries (#3165) 2021-02-10 13:04:23 +01:00
Github Actions 3e014b38e6 [CI Skip] release/beta 3.8.2-2
skip-checks: true
2021-02-10 08:49:29 +00:00
Jaco Greeff b4cfdbffab Fix council derives for seatholders (#3163)
* Fix council derives for setholders

* Fix vote retreival
2021-02-10 09:41:47 +01:00
Github Actions cbfb6f8f59 [CI Skip] release/beta 3.8.2-1
skip-checks: true
2021-02-09 19:00:05 +00:00
Jaco Greeff b5bc15ab8b Last Kusama upgrade block (#3160) 2021-02-09 19:50:24 +01:00
Github Actions 0b343fc0f8 [CI Skip] release/beta 3.8.2-0
skip-checks: true
2021-02-08 15:55:08 +00:00
Jaco Greeff e7f9693873 Add ParaLifecycle type (#3159) 2021-02-08 16:47:02 +01:00
Github Actions a0a5c3185d [CI Skip] release/stable 3.8.1
skip-checks: true
2021-02-07 13:05:43 +00:00
Jaco Greeff 151d4693a9 3.8 (#3158) 2021-02-07 13:56:10 +01:00
Github Actions cdb27d8ec2 [CI Skip] release/beta 3.7.4-8
skip-checks: true
2021-02-07 12:14:25 +00:00
Jaco Greeff 055e4d1261 Bump to common stable (#3157) 2021-02-07 13:06:46 +01:00
Github Actions bf753255ab [CI Skip] release/beta 3.7.4-7
skip-checks: true
2021-02-07 08:59:19 +00:00
Jaco Greeff e2230ef454 Bump common (#3155)
* Bump common

* Adjust (some) tests

* Adjust tests
2021-02-07 09:49:48 +01:00
Github Actions 0f5b01b856 [CI Skip] release/beta 3.7.4-6
skip-checks: true
2021-02-06 13:45:59 +00:00
Jaco Greeff 82787c96c6 Single put_code/deploy (new & backwards compat.) (#3143)
* Single put_code/deploy (new & backwards compat.)

* new-style

* old-style deploy?

* notice

* Cleanups

* linting

* grrr... Mac case-sensistivity

* Add createContract on BluePrint

* Adjust contracts check

* Adjust

* Adjust tests
2021-02-06 14:36:42 +01:00
Github Actions f89028d5fe [CI Skip] release/beta 3.7.4-5
skip-checks: true
2021-02-06 12:09:28 +00:00
Jaco Greeff ba24a2e917 Bump latest Substrate meta (#3154) 2021-02-06 13:00:26 +01:00
Github Actions b549bbf46b [CI Skip] release/beta 3.7.4-4
skip-checks: true
2021-02-06 07:58:57 +00:00
Jaco Greeff 1e87f58f36 Allow extensions on typesBundle (#3142)
* Allow extensions on typesBundle

* User extension take precedence
2021-02-06 08:49:11 +01:00
Github Actions f643426067 [CI Skip] release/beta 3.7.4-3
skip-checks: true
2021-02-05 21:12:04 +00:00
Jaco Greeff 94d26c76ec Check for autoConnectMs on reconnect (#3151)
* Check for autoConnectMs on reconnect

* Update packages/rpc-provider/src/ws/index.ts
2021-02-05 22:03:31 +01:00
Github Actions 8fe262a712 [CI Skip] release/beta 3.7.4-2
skip-checks: true
2021-02-05 15:55:13 +00:00
Jake Naviasky 122ee968cb Add eth filter RPC endpoints and FilterChanges type. (#3150) 2021-02-05 16:45:31 +01:00
Github Actions d2ff350db9 [CI Skip] release/beta 3.7.4-1
skip-checks: true
2021-02-05 07:34:46 +00:00
Nantian 9100aabbac fix signedExtensions type (#3148) 2021-02-05 08:25:17 +01:00
Github Actions 1e73f69253 [CI Skip] release/beta 3.7.4-0
skip-checks: true
2021-02-04 16:16:08 +00:00
Jaco Greeff 7153cb4158 Extend ProxyType with CancelProxy (#3147) 2021-02-04 17:05:56 +01:00
Github Actions 999dc6f8a5 [CI Skip] release/stable 3.7.3
skip-checks: true
2021-02-02 16:37:56 +00:00
Jaco Greeff 724574afe7 3.7.3 (w/ Polkadot 27 upgrade blocks) (#3139) 2021-02-02 17:29:43 +01:00
Github Actions 0352a30b6b [CI Skip] release/beta 3.7.3-1
skip-checks: true
2021-02-02 10:14:04 +00:00
Jaco Greeff 41b4cd5c55 Adjust known-types to use @polkadot/networks (#3138) 2021-02-02 11:06:52 +01:00
Github Actions 89f16f3123 [CI Skip] release/beta 3.7.3-0
skip-checks: true
2021-02-02 09:22:19 +00:00
Jaco Greeff 261a4eede3 Add 26 checkpoint for Polkadot (#3137) 2021-02-02 10:15:17 +01:00
Github Actions f623b382f7 [CI Skip] release/stable 3.7.2
skip-checks: true
2021-02-02 07:50:56 +00:00
Jaco Greeff 51537c619a Adjust Keys fro 28 (#3135)
* Adjust Keys fro 28

* 3.7.2
2021-02-02 08:41:24 +01:00
Github Actions 3df943572f [CI Skip] release/beta 3.7.2-0
skip-checks: true
2021-02-01 20:22:53 +00:00
Jaco Greeff aa10804f6f Westend upgrade block for 48 (#3134) 2021-02-01 21:13:58 +01:00
Github Actions 981407f00f [CI Skip] release/stable 3.7.1
skip-checks: true
2021-02-01 08:07:42 +00:00
Jaco Greeff 74f7098e0a 3.7 (#3131)
* 3.7

* Update CHANGELOG.md
2021-02-01 08:58:59 +01:00
Github Actions c2e46bf16d [CI Skip] release/beta 3.6.5-12
skip-checks: true
2021-01-31 11:55:30 +00:00
Jaco Greeff 78b26d2d40 Allow .slice on Vec types (#3130)
* Allow .slice on Vec types

* Apply suggestions from code review

* Update packages/types/src/codec/AbstractArray.ts
2021-01-31 12:48:05 +01:00
Github Actions e4d5be85f6 [CI Skip] release/beta 3.6.5-11
skip-checks: true
2021-01-31 10:12:00 +00:00
Jaco Greeff 23b5601eeb Use MultiAddress as the default type (#3123)
* Use MultiAddress as the default type

* Update tests

* Update tests
2021-01-31 11:02:54 +01:00
Github Actions 859679ce09 [CI Skip] release/beta 3.6.5-10
skip-checks: true
2021-01-31 08:38:26 +00:00
Jaco Greeff 71543c2351 Bump common (#3129) 2021-01-31 09:31:29 +01:00
Github Actions edae5057c8 [CI Skip] release/beta 3.6.5-9
skip-checks: true
2021-01-29 14:07:58 +00:00
Thibaut Sardan 8dd450ded4 no subscription for http (#3127) 2021-01-29 14:59:09 +01:00
Github Actions bc2061723e [CI Skip] release/beta 3.6.5-8
skip-checks: true
2021-01-29 10:58:08 +00:00
Jaco Greeff 5753e37307 Correctly use RelayChainBlockNumber in PersistedValidationData (#3126) 2021-01-29 11:48:46 +01:00
Github Actions e74da70a9d [CI Skip] release/beta 3.6.5-7
skip-checks: true
2021-01-28 18:35:59 +00:00
Jaco Greeff 737bbc225a Add Slot type (#3120) 2021-01-28 19:26:27 +01:00
Github Actions 9313551559 [CI Skip] release/beta 3.6.5-6
skip-checks: true
2021-01-28 15:41:03 +00:00
Jaco Greeff 5b8f53f050 Fix Kusama types order 2021-01-28 16:33:11 +01:00
Github Actions 7358e4715b [CI Skip] release/beta 3.6.5-5
skip-checks: true
2021-01-28 15:05:20 +00:00
Jaco Greeff a9005d86d6 Types for Polkadot 28+ (#3119)
* Types for Polkadot 28+

* Linting
2021-01-28 15:57:32 +01:00
Github Actions 788c05d86e [CI Skip] release/beta 3.6.5-4
skip-checks: true
2021-01-28 08:57:47 +00:00
Jaco Greeff de6ba69631 Add Kusama 2027 upgrade block (#3116) 2021-01-28 09:50:12 +01:00
Github Actions 4153fed250 [CI Skip] release/beta 3.6.5-3
skip-checks: true
2021-01-27 16:41:40 +00:00
Jaco Greeff c68b89831e Rococo MultiAddress for master (#3114) 2021-01-27 17:34:35 +01:00
Github Actions 01c9c5ed53 [CI Skip] release/beta 3.6.5-2
skip-checks: true
2021-01-27 09:30:20 +00:00
Jaco Greeff 573fb135a7 Updata parachain proposal type (#3111) 2021-01-27 10:22:25 +01:00
Github Actions 0ee7256e37 [CI Skip] release/beta 3.6.5-1
skip-checks: true
2021-01-26 20:00:28 +00:00
Jaco Greeff 9829ee558c Update CandidateDescriptor type (#3110)
* Update CandidateDescriptor type

* Add additional Cumulus missing types

* Add missing StorageProof

* trailing , :(
2021-01-26 20:51:23 +01:00
Github Actions 34b563dd48 [CI Skip] release/beta 3.6.5-0
skip-checks: true
2021-01-25 17:24:21 +00:00
Antoine Estienne f6bb200146 Adapted to display moonbeam author (#3108)
* adapted to display moonbeam author

* refactor and lint

* removed comments
2021-01-25 18:16:41 +01:00
Github Actions af36e3a52c [CI Skip] release/stable 3.6.4
skip-checks: true
2021-01-25 16:06:53 +00:00
Jaco Greeff c50c7ae6ef Remove capabilities detection log (#3107) 2021-01-25 16:59:14 +01:00
Github Actions 61739d5ba1 [CI Skip] release/stable 3.6.3
skip-checks: true
2021-01-24 16:09:21 +00:00
Jaco Greeff 34c4a6055e Jg refs (#3103)
* Remove global ref, use x-global

* Bump common
2021-01-24 17:00:49 +01:00
Github Actions 27dabdaf52 [CI Skip] release/stable 3.6.2
skip-checks: true
2021-01-24 15:18:34 +00:00
Jaco Greeff 2ee3242f41 Remove global ref, use x-global (#3102) 2021-01-24 16:11:43 +01:00
Github Actions 67ae9627af [CI Skip] release/stable 3.6.1
skip-checks: true
2021-01-24 13:00:12 +00:00
Jaco Greeff 29f7e12df6 3.6 (#3101) 2021-01-24 13:52:53 +01:00
Github Actions a4bb2c8268 [CI Skip] release/beta 3.5.2-16
skip-checks: true
2021-01-24 11:40:20 +00:00
Jaco Greeff 6521c5f533 Bump common (#3100) 2021-01-24 12:33:04 +01:00
Github Actions 6925c18821 [CI Skip] release/beta 3.5.2-15
skip-checks: true
2021-01-24 10:31:50 +00:00
Jaco Greeff 9269d94677 Bump common (#3099)
* Bump common

* Undefined value

* Test for undefined
2021-01-24 11:23:23 +01:00
Github Actions d438814ad6 [CI Skip] release/beta 3.5.2-14
skip-checks: true
2021-01-23 15:56:13 +00:00
Jaco Greeff bc205a350b Fix ChainProperties JSON decoding 2021-01-23 16:47:22 +01:00
Github Actions 6bf6fddd28 [CI Skip] release/beta 3.5.2-13
skip-checks: true
2021-01-23 13:53:50 +00:00
Jaco Greeff 23f8eb9713 Return locks for extended balance instances (#3097) 2021-01-23 14:45:17 +01:00
Github Actions 8ab3097328 [CI Skip] release/beta 3.5.2-12
skip-checks: true
2021-01-23 12:44:02 +00:00
Jaco Greeff 644d0e6c2e Change registry.chainToekn to registry.chainTokens (#3096) 2021-01-23 13:36:30 +01:00
Github Actions 6a69fdfbbf [CI Skip] release/beta 3.5.2-11
skip-checks: true
2021-01-23 11:24:22 +00:00
Jaco Greeff 16e9a64941 Allow multiples in system.properties (decimals, tokens) (#3093)
* Allow multiples in syste.propertis (decimals, tokens)

* registry.chain{Decimals, Token} returns array values

* Bump common

* AbstractInt format with first decimal/token

* Adjust ss58Format consistency

* u8 decimals/format

* cleanups

* More slight weidness

* Adjust all t u32

* Cleanup properties format from Codec
2021-01-23 12:16:10 +01:00
Github Actions f3cbc070ea [CI Skip] release/beta 3.5.2-10
skip-checks: true
2021-01-22 23:07:31 +00:00
Jaco Greeff df22526229 Bump deps (#3095) 2021-01-22 23:58:53 +01:00
Github Actions 3739bdaa89 [CI Skip] release/beta 3.5.2-9
skip-checks: true
2021-01-22 21:31:40 +00:00
Jaco Greeff 1f55f38bd2 Introduce instances, apply to balance derives (multi-result) (#3094)
* Introducce instances, apply to balance derives (multi-result)

* Nonce extraction

* Optimize
2021-01-22 22:24:10 +01:00
Github Actions c9deb0d88f [CI Skip] release/beta 3.5.2-8
skip-checks: true
2021-01-22 16:29:02 +00:00
Jaco Greeff eecfb39463 Bump common (#3092) 2021-01-22 17:21:33 +01:00
Github Actions 51bb27da42 [CI Skip] release/beta 3.5.2-7
skip-checks: true
2021-01-22 08:21:12 +00:00
Jaco Greeff 9c0d296e87 typegen dedup (#3089) 2021-01-22 09:12:29 +01:00
Github Actions 0793e0bf8c [CI Skip] release/beta 3.5.2-6
skip-checks: true
2021-01-21 21:45:15 +00:00
Jaco Greeff e9ad88d50e Register all types for error generation (#3088)
* Register all types for error generation

* type for ExtraTypes
2021-01-21 22:37:37 +01:00
Github Actions fbe24c04b8 [CI Skip] release/beta 3.5.2-5
skip-checks: true
2021-01-21 10:08:55 +00:00
Jaco Greeff 8a7d4d3be3 Bump metadata (#3085)
* Bump metadata

* linting
2021-01-21 11:01:31 +01:00
Github Actions 61c9a3bb93 [CI Skip] release/beta 3.5.2-4
skip-checks: true
2021-01-21 08:39:46 +00:00
Jaco Greeff 3721a11f34 Add errors/events Md interface endpoints (#3084) 2021-01-21 09:31:40 +01:00
Github Actions 21039dec1f [CI Skip] release/beta 3.5.2-3
skip-checks: true
2021-01-19 21:54:16 +00:00
Jaco Greeff 1393f565d8 Paras validator index alias (#3079) 2021-01-19 22:46:49 +01:00
Jaco Greeff 1530e55f9d Disallow primitive singular registration (#3077) 2021-01-19 22:46:29 +01:00
Github Actions c982505f73 [CI Skip] release/beta 3.5.2-2
skip-checks: true
2021-01-19 21:15:33 +00:00
Jaco Greeff ec8c0d3e8b Move x-rxjs into common (#3078)
* Moe x-rxjs into common

* yarn

* jest config

* Pull in new pubslished x-rxjs
2021-01-19 22:08:03 +01:00
Github Actions 8cb0269676 [CI Skip] release/beta 3.5.2-1
skip-checks: true
2021-01-19 12:27:07 +00:00
Jaco Greeff 27f460cfe3 Add payment_queryFeeDetails (#3076) 2021-01-19 13:18:23 +01:00
Jaco Greeff e98e8d6a0d Type capability detection (#3075)
* Type capability detection

* re-add Observable export

* Remove unused exports

* Decorate capabilities

* log capabilities

* Detect capabilities for historic

* Re-add logging

* Log

* Rework ValidatorPrefs types
2021-01-19 13:15:18 +01:00
Github Actions 2f94662837 [CI Skip] release/beta 3.5.2-0
skip-checks: true
2021-01-19 10:49:10 +00:00
Jaco Greeff d46d6a9acd Add ValidatorPrefs w/ blocked flag (#3073) 2021-01-19 11:41:23 +01:00
Github Actions 093d2cfa7c [CI Skip] release/stable 3.5.1
skip-checks: true
2021-01-18 11:37:28 +00:00
Jaco Greeff 35b31a21dc 3.5 (#3071) 2021-01-18 12:29:58 +01:00
Github Actions 8b9741a722 [CI Skip] release/beta 3.4.2-18
skip-checks: true
2021-01-18 08:42:18 +00:00
Ewa Kowalska d5cfa9b0e9 Handle no council for bounties proposals (#3062)
* Handle no council for bounties proposals

* Fix code climate

* Handle no council present with api derive
2021-01-18 09:33:20 +01:00
Github Actions 129d1214fe [CI Skip] release/beta 3.4.2-17
skip-checks: true
2021-01-17 15:11:37 +00:00
Jaco Greeff abb3375c3a Bump common (& Substrate node references) (#3069) 2021-01-17 16:04:26 +01:00
Github Actions 4cfa06b43f [CI Skip] release/beta 3.4.2-16
skip-checks: true
2021-01-17 13:30:25 +00:00
Jaco Greeff 8fa80ac0f6 Adjust node-template for MultiAddress (>= 100) (#3068)
* Adjust node-template for MultiAddress (>= 100)

* Bump deps
2021-01-17 14:22:09 +01:00
Github Actions 2d011c68df [CI Skip] release/beta 3.4.2-15
skip-checks: true
2021-01-17 12:48:44 +00:00
Jaco Greeff 640ef4bdab Adjust Rococo types (#3067) 2021-01-17 13:39:29 +01:00
Github Actions cdd20c0b99 [CI Skip] release/beta 3.4.2-14
skip-checks: true
2021-01-15 21:41:55 +00:00
Jaco Greeff 3a12123bf9 Remove recursion on decodeU8a (#3063)
* Remove recursion on decodeU8a

* Remove skipped tests

* Remove extra allocation
2021-01-15 22:34:30 +01:00
Github Actions 5657d5395b [CI Skip] release/beta 3.4.2-13
skip-checks: true
2021-01-15 15:14:00 +00:00
Jeremías Díaz 66b1108c5c feat(types): add correct tuple type to storage key (#3054)
* feat(types): add correct tuple type to storage key

* refactor(types): remove unneeded type assertions
2021-01-15 16:06:23 +01:00
Github Actions 7bf7e207c2 [CI Skip] release/beta 3.4.2-12
skip-checks: true
2021-01-15 13:38:01 +00:00
Jaco Greeff 01098395ec Add crowdloan types (#3060)
* Add crowdloan types

* Update
2021-01-15 14:28:57 +01:00
Github Actions 3e21dfdc03 [CI Skip] release/beta 3.4.2-11
skip-checks: true
2021-01-15 12:56:17 +00:00
Jaco Greeff a400fb2362 Sort registry (#3061) 2021-01-15 13:49:12 +01:00
Github Actions 44172aa359 [CI Skip] release/beta 3.4.2-10
skip-checks: true
2021-01-15 11:32:08 +00:00
Jaco Greeff 82cab2827a Add lottery types (#3059) 2021-01-15 12:23:19 +01:00
Github Actions a198eb1515 [CI Skip] release/beta 3.4.2-9
skip-checks: true
2021-01-15 10:57:12 +00:00
Jaco Greeff 6e67cd6c97 Bump common (#3058) 2021-01-15 11:48:25 +01:00
Github Actions e51e89df56 [CI Skip] release/beta 3.4.2-8
skip-checks: true
2021-01-13 23:12:15 +00:00
Jaco Greeff e46fd07d39 align aura/babe without staking 2021-01-14 00:03:28 +01:00
Jaco Greeff b2cf9aed83 Info changes for no staking (but with babe) 2021-01-14 00:01:42 +01:00
Jaco Greeff c632030437 Fix derive session.info with no staking 2021-01-13 23:59:59 +01:00
Github Actions 9dc683d289 [CI Skip] release/beta 3.4.2-7
skip-checks: true
2021-01-13 22:53:45 +00:00
Jaco Greeff 6cef6190b1 Optional staking in session progress calcs (#3051)
* Optional staking in session progress calcs

* No extra pipe
2021-01-13 23:46:15 +01:00
Github Actions 75dd443d79 [CI Skip] release/beta 3.4.2-6
skip-checks: true
2021-01-13 12:14:07 +00:00
Jaco Greeff 13dacb591d Updata parachain types (#3050) 2021-01-13 13:07:07 +01:00
Jaco Greeff 429bf5456e Add tests for toBigInt usage (#3049)
* Add tests for toBigInt usage

* Update packages/types/src/codec/UInt.spec.ts
2021-01-13 13:00:10 +01:00
Github Actions 527c0f5015 [CI Skip] release/beta 3.4.2-5
skip-checks: true
2021-01-13 10:19:11 +00:00
Jaco Greeff 527ab27bee Westend 46, 47 blocks (#3044) 2021-01-13 11:09:33 +01:00
Github Actions 7991403022 [CI Skip] release/beta 3.4.2-4
skip-checks: true
2021-01-13 08:07:59 +00:00
Ian He 61d2e6c5e5 toBigInt() uses primitive type bigint (#3047) 2021-01-13 09:01:11 +01:00
Github Actions e005a3fc0c [CI Skip] release/beta 3.4.2-3
skip-checks: true
2021-01-12 13:54:07 +00:00
Jaco Greeff 2dfb0fb59a Dedupe parachain types (#3043)
* Updata parachain types

* Remove duplication

* hrmp update
2021-01-12 14:46:57 +01:00
Github Actions 70c011e7e2 [CI Skip] release/beta 3.4.2-2
skip-checks: true
2021-01-12 13:23:32 +00:00
Jaco Greeff 8134322626 Updata parachain types (#3042) 2021-01-12 14:14:54 +01:00
Github Actions 60152749bb [CI Skip] release/beta 3.4.2-1
skip-checks: true
2021-01-11 23:27:12 +00:00
Jaco Greeff b257e120d4 Update parachain types (#3041) 2021-01-12 00:20:20 +01:00
Github Actions 6dc75acd21 [CI Skip] release/beta 3.4.2-0
skip-checks: true
2021-01-11 15:44:17 +00:00
Jaco Greeff a04400170c Set Rococo Keys to 6 (#3040) 2021-01-11 16:36:32 +01:00
Github Actions e3f16e6066 [CI Skip] release/stable 3.4.1
skip-checks: true
2021-01-11 08:13:52 +00:00
Jaco Greeff c3b697d52d 3.4 (#3037) 2021-01-11 09:04:19 +01:00
Github Actions 645fb58e82 [CI Skip] release/beta 3.3.3-5
skip-checks: true
2021-01-10 09:27:13 +00:00
icodezjb 474e509507 Update SessionKeys (#3035)
SessionKeys6, SessionKeys7, SessionKeys8, SessionKeys9
2021-01-10 10:19:55 +01:00
Github Actions df9aff3bac [CI Skip] release/beta 3.3.3-4
skip-checks: true
2021-01-08 16:15:40 +00:00
Jaco Greeff caface921e Adjust max signed check (#3034) 2021-01-08 17:08:04 +01:00
Github Actions ba9cc785c1 [CI Skip] release/beta 3.3.3-3
skip-checks: true
2021-01-08 13:51:18 +00:00
Jaco Greeff 4ff9b51af2 Add API option for chain-specific signedExtensions (#3033)
* Add API option for chain-specific signedExtensions

* typo
2021-01-08 14:42:26 +01:00
Github Actions 2c20a9f395 [CI Skip] release/beta 3.3.3-2
skip-checks: true
2021-01-08 10:28:58 +00:00
Jaco Greeff ee17aa7464 Fix v12 static json 2021-01-08 11:20:18 +01:00
Jaco Greeff 2d01a7b593 Update alias mapping (asset Balance in events) 2021-01-08 11:01:48 +01:00
Github Actions 000e8089d9 [CI Skip] release/beta 3.3.3-1
skip-checks: true
2021-01-08 09:53:41 +00:00
Jaco Greeff 43000b6aaf Update contract types (#3032)
* Update contract types

* Add registry lookup name compat

* cleanup

* Rebuild ts defs
2021-01-08 10:46:12 +01:00
Github Actions 0f8b204db8 [CI Skip] release/beta 3.3.3-0
skip-checks: true
2021-01-07 18:53:56 +00:00
Jaco Greeff 679f4103e1 Fix EthTransaction to ethereum crate (#3030)
* Fix (alhabetically sorted??) EthTransaction

* EthTransaction from ethereum crate
2021-01-07 19:45:37 +01:00
Github Actions 6c61708eff [CI Skip] release/stable 3.3.2
skip-checks: true
2021-01-06 17:30:18 +00:00
Jaco Greeff f0ce53f5a5 dispatchInfo on failed 2021-01-06 18:20:52 +01:00
Jaco Greeff d826ac85fa Event check index (#3028)
* Event check index

* patch
2021-01-06 18:18:08 +01:00
Github Actions 18a81fbbcb [CI Skip] release/beta 3.3.2-4
skip-checks: true
2021-01-06 10:56:45 +00:00
Jeremías Díaz 9ab59c9241 fix(typegen): support vecs of tuples in enums (#3022) 2021-01-06 11:48:32 +01:00
Github Actions 0161996cf6 [CI Skip] release/beta 3.3.2-3
skip-checks: true
2021-01-06 09:51:22 +00:00
Jaco Greeff 99463a3f1d Return result with entries with 0 keys (#3025)
* Return result with entries with 0 keys

* Cleanup
2021-01-06 10:42:53 +01:00
Github Actions cec4c69374 [CI Skip] release/beta 3.3.2-2
skip-checks: true
2021-01-05 13:13:44 +00:00
Jaco Greeff 44077c7cf6 Add ParaGenesisArgs type (#3021) 2021-01-05 14:04:50 +01:00
Github Actions ac7b1bdeeb [CI Skip] release/beta 3.3.2-1
skip-checks: true
2021-01-05 11:30:57 +00:00
Jaco Greeff 1c86333b5f derive.chain.getBlock() now maps events to extrinsics (#3020)
* derive.chain.getBlock() now maps events to extrinsics

* Also apply to subscribeNewBlocks

* Cleanup

* breaking
2021-01-05 12:21:58 +01:00
Github Actions da4108ff9b [CI Skip] release/beta 3.3.2-0
skip-checks: true
2021-01-05 09:46:04 +00:00
Ewa Kowalska 0c5fc15935 Add motions to bounty derive (#3016)
* Add proposals to BountyDerive

* Extract filterBountiesProposals method

* Apply review suggestions
2021-01-05 10:37:45 +01:00
Github Actions 970039775d [CI Skip] release/stable 3.3.1
skip-checks: true
2021-01-04 10:08:22 +00:00
Jaco Greeff 2ddcd59ed0 3.3 (#3017) 2021-01-04 11:01:09 +01:00
Github Actions a4519495ad [CI Skip] release/beta 3.2.4-13
skip-checks: true
2021-01-03 10:35:48 +00:00
Jaco Greeff a9c9fb5769 2021 (#3015) 2021-01-03 11:26:46 +01:00
Github Actions 0e928a2a11 [CI Skip] release/beta 3.2.4-12
skip-checks: true
2021-01-02 09:46:10 +00:00
Jaco Greeff 756b24f10a Bum dev (#3014) 2021-01-02 10:37:47 +01:00
Github Actions 85a37b2604 [CI Skip] release/beta 3.2.4-11
skip-checks: true
2021-01-02 09:22:17 +00:00
Jaco Greeff e0e8d37a64 Extract ss58 from system constants (as available) (#3006)
* Extract ss58 from system constants (as available)

* merge

* optional
2021-01-02 10:12:53 +01:00
Github Actions 4c4fd2afd1 [CI Skip] release/beta 3.2.4-10
skip-checks: true
2021-01-02 08:53:19 +00:00
Jaco Greeff 926d1e55d1 Parallel RPC calls (metadata/methods alongside chain details) (#3011)
* Parallel metadata retrieval

* Update

* Parallel genesisHash

* Checks

* rpc_methods in mock provider (now required)
2021-01-02 09:44:08 +01:00
Github Actions 491e7cd155 [CI Skip] release/beta 3.2.4-9
skip-checks: true
2021-01-01 11:18:39 +00:00
Jaco Greeff ed2d6e8d0e Build metadata with rpc aliasses (#3013)
* Build metadata with rpc aliasses

* links
2021-01-01 12:11:30 +01:00
Github Actions 714f72d6c3 [CI Skip] release/beta 3.2.4-8
skip-checks: true
2021-01-01 09:42:31 +00:00
Jaco Greeff 8671171061 Bump metadata (#3012) 2021-01-01 10:34:07 +01:00
Github Actions 45b176de7d [CI Skip] release/beta 3.2.4-7
skip-checks: true
2020-12-31 12:50:25 +00:00
Jaco Greeff 1901b8899d Bump dev/util (#3010) 2020-12-31 13:41:57 +01:00
Github Actions 9ead0103a9 [CI Skip] release/beta 3.2.4-6
skip-checks: true
2020-12-30 17:28:11 +00:00
Miguel Hervas af0bcc80e8 Adding RT4 Types (#3007)
* update to rc6 types

* Adding RT4 Types
2020-12-30 18:20:54 +01:00
Github Actions e0b7dd13e0 [CI Skip] release/beta 3.2.4-5
skip-checks: true
2020-12-29 21:38:22 +00:00
Jaco Greeff 9e13b6f54e blockWeights.maxBlock for estimation (#3004) 2020-12-29 22:29:13 +01:00
Github Actions 6aa5a2dd0c [CI Skip] release/beta 3.2.4-4
skip-checks: true
2020-12-29 21:26:50 +00:00
Jaco Greeff 361f9e4419 Apply aliases for constants (#3003)
* Apply aliasses for constants

* Remove todo

* shortcut

* Re-add metaVersion
2020-12-29 22:17:31 +01:00
Github Actions 1ca00c7633 [CI Skip] release/beta 3.2.4-3
skip-checks: true
2020-12-29 20:50:46 +00:00
Jaco Greeff 83f36e466f Check metadata.version instead of isIndexed (#3002)
* Check metadata.version instead of isIndexed

* Bump
2020-12-29 21:42:06 +01:00
Jaco Greeff e685923102 Add ExitReason types (evm) (#3001)
* Add ExitReason types (evm)

* Log, Account, Vicinity
2020-12-29 21:28:04 +01:00
Github Actions 3aaa6db190 [CI Skip] release/beta 3.2.4-2
skip-checks: true
2020-12-29 14:54:38 +00:00
Ewa Kowalska a98b6b9bf8 Add bounty index to DeriveBounty (#3000)
* Add bounty index to DeriveBounty

* Apply review suggestions
2020-12-29 15:46:03 +01:00
Github Actions fc0148fd41 [CI Skip] release/beta 3.2.4-1
skip-checks: true
2020-12-29 14:38:29 +00:00
Jaco Greeff 1dc04ec8bd pre (#2999) 2020-12-29 15:31:12 +01:00
Github Actions 3c2617fe5c [CI Skip] release/stable 3.2.3
skip-checks: true
2020-12-29 10:13:45 +00:00
Jaco Greeff 9e20006d24 3.2.3 2020-12-29 11:03:57 +01:00
Github Actions dcd5a0b620 [CI Skip] release/beta 3.2.3-5
skip-checks: true
2020-12-29 10:01:17 +00:00
Jaco Greeff 6f5b852bf7 Work around incorrect contracts.call RPC handler (#2998) 2020-12-29 10:53:11 +01:00
Github Actions 22e4abc903 [CI Skip] release/beta 3.2.3-4
skip-checks: true
2020-12-28 14:11:29 +00:00
Jaco Greeff b5e37c020d Call return is CallBase (w/ method, section) (#2996)
* Call return is CallBase (w/ method, section)

* Remove {section, method}Name

* mthod/section

* compare via .is
2020-12-28 15:02:27 +01:00
Github Actions a806e4a2ee [CI Skip] release/beta 3.2.3-3
skip-checks: true
2020-12-28 12:30:05 +00:00
Jaco Greeff 9164637c44 Fix augmented generation for RPC w/ alias (#2994)
* Fix augmented generation for RPC w/ alias

* Fix

* Rebuild
2020-12-28 13:21:43 +01:00
Antoine EstienneandJaco Greeff 1ba8f71da1 add client version and sh3 decorators for web3 (#2993)
* add client version and sh3 decorators for web3

* add web3 to rpcCore

* refactored with correct file

* Apply suggestions from code review

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

Co-authored-by: Jaco Greeff <jacogr@gmail.com>
2020-12-28 13:12:12 +01:00
Github Actions 91693bf587 [CI Skip] release/beta 3.2.3-2
skip-checks: true
2020-12-28 11:01:04 +00:00
Jaco Greeff e6a99b9f07 metadataMd section aliasses (#2992) 2020-12-28 11:54:18 +01:00
Github Actions f6d9ba2471 [CI Skip] release/beta 3.2.3-1
skip-checks: true
2020-12-28 10:46:54 +00:00
Jaco Greeff af24955bc7 3.2.3-0 (#2990) 2020-12-28 11:39:58 +01:00
Github Actions 3e66807716 [CI Skip] release/stable 3.2.2
skip-checks: true
2020-12-28 09:16:19 +00:00
Jaco Greeff f34d48ad09 3.2.2 (#2988)
* 3.2.2

* Patch correctly
2020-12-28 10:07:58 +01:00
Github Actions 0d7be67499 [CI Skip] release/stable 3.2.1
skip-checks: true
2020-12-27 19:24:36 +00:00
Jaco Greeff 7804794233 3.2 (#2987) 2020-12-27 20:15:08 +01:00
Github Actions c7a68a4e05 [CI Skip] release/beta 3.1.2-11
skip-checks: true
2020-12-27 12:06:46 +00:00
Jaco Greeff 811f9f7868 Support for eth_getProof RPC (#2986) 2020-12-27 12:59:29 +01:00
Github Actions d9acf1cfea [CI Skip] release/beta 3.1.2-10
skip-checks: true
2020-12-27 10:23:11 +00:00
Jaco Greeff 0967dbba6b Add api.{errors, events, query, tx}.<method>.<section>.is(...) (#2984)
* api.{event, error}.<section>.is<Type>

* Full generation, with checkTypes

* .is

* Extrinsic with arg type definition

* decorate is

* Call is

* Remove hasOrigin

* Renames

* Query is

* Fix extrinsic is

* Backwards compatibility for generated types

* event with optional AnyTuple

* Cleanups

* Cleanups

* Adjust

* Cleanup
2020-12-27 11:15:02 +01:00
Github Actions 025a745258 [CI Skip] release/beta 3.1.2-9
skip-checks: true
2020-12-27 08:19:59 +00:00
Jaco Greeff 88eb4fd6e5 Bump util (#2985) 2020-12-27 09:11:36 +01:00
Github Actions 0dcdffd59c [CI Skip] release/beta 3.1.2-8
skip-checks: true
2020-12-25 08:07:54 +00:00
yjh 1f39ad264a fix MetadataVersioned.asV12 (#2983) 2020-12-25 09:00:51 +01:00
Github Actions e357a08118 [CI Skip] release/beta 3.1.2-7
skip-checks: true
2020-12-24 07:38:46 +00:00
Jaco Greeff d6b2b4a1a3 Remove support for pre-v2 staking (#2980)
* Remove support for pre-v2 staking

* Adjust with util array functions

* Remove old enumset support

* Empty controller

* withController flag
2020-12-24 08:32:03 +01:00
Github Actions 47f2ee725f [CI Skip] release/beta 3.1.2-6
skip-checks: true
2020-12-22 16:28:53 +00:00
Jaco Greeff 1028e14761 Format <= 32 as number, > as hex (not used size) (#2978) 2020-12-22 17:21:42 +01:00
Github Actions 5fdefa9e58 [CI Skip] release/beta 3.1.2-5
skip-checks: true
2020-12-22 14:39:16 +00:00
Jaco Greeff 80209da5c5 Add frontier RPCs (& types for them) (#2976)
* Add frontier RPCs (& types for them)

* Add filters

* Cleanup optional params

* Add ethereum module aliasses

* Split rpc

* Split net RPC

* full block details

* onlyHex

* Revert onlyHex change
2020-12-22 15:30:48 +01:00
Github Actions bbdf0e3192 [CI Skip] release/beta 3.1.2-4
skip-checks: true
2020-12-22 10:51:07 +00:00
Jaco Greeff 9ee1c0bf13 AccountInfo with provider/consumers (#2975) 2020-12-22 11:42:47 +01:00
Github Actions 5490947384 [CI Skip] release/beta 3.1.2-3
skip-checks: true
2020-12-22 09:34:59 +00:00
Jaco Greeff b1788be796 Bump deps (#2974) 2020-12-22 10:26:17 +01:00
Github Actions f4ec312656 [CI Skip] release/beta 3.1.2-2
skip-checks: true
2020-12-21 18:46:36 +00:00
Jaco Greeff e1057603fc MessageIngestionType (parachains) (#2973)
* MessageIngestionType (parachains)

* _'s
2020-12-21 19:39:46 +01:00
Github Actions 0268e398c1 [CI Skip] release/beta 3.1.2-1
skip-checks: true
2020-12-21 18:37:49 +00:00
Jaco Greeff 757d45b39e Few missing type imports (#2972) 2020-12-21 19:29:22 +01:00
Github Actions 4f57a5a611 [CI Skip] release/beta 3.1.2-0
skip-checks: true
2020-12-21 16:26:14 +00:00
Jaco Greeff 987896e323 Adjust for last remaining circular deps (#2971)
* Adjust for last remaining circular deps

* Remove RegistryMetadata duplication

* Update packages/typegen/scripts/polkadot-types-internal-interfaces.js

* typo

* Direct decorateExtrinsics import
2020-12-21 17:17:20 +01:00
Github Actions 1b9d3bf38e [CI Skip] release/stable 3.1.1
skip-checks: true
2020-12-20 15:51:02 +00:00
Jaco Greeff b8a0f39da4 3.1 (#2969) 2020-12-20 16:44:07 +01:00
Github Actions e4e20f8a88 [CI Skip] release/beta 3.0.2-14
skip-checks: true
2020-12-20 11:18:17 +00:00
Jaco Greeff 131729e438 Adjust bountyBase for keys (#2968) 2020-12-20 12:08:56 +01:00
Github Actions 4672439bce [CI Skip] release/beta 3.0.2-13
skip-checks: true
2020-12-20 09:45:36 +00:00
Jaco Greeff 0b11fc98b9 Update to latest Substrate metadata (#2967)
* Update to latest Substrate metadata

* Update bounties derive

* Cleanups

* Update bounty location
2020-12-20 10:36:38 +01:00
Github Actions ece0a4b19a [CI Skip] release/beta 3.0.2-12
skip-checks: true
2020-12-19 15:33:16 +00:00
Jaco Greeff 1dac7e3f1b Bump util (#2966)
* Bump util

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md
2020-12-19 16:24:17 +01:00
Github Actions 3e1c93d4a8 [CI Skip] release/beta 3.0.2-11
skip-checks: true
2020-12-19 10:57:24 +00:00
Jaco Greeff 19e9af02d8 Bump deps 2020-12-19 11:47:32 +01:00
Github Actions 2200cc2fab [CI Skip] release/beta 3.0.2-10
skip-checks: true
2020-12-18 15:34:09 +00:00
Jaco Greeff 33990b6d02 Update types for parachains (#2964)
* Update types for parachains

* alias VecDeque
2020-12-18 16:25:53 +01:00
Github Actions 333313fd6a [CI Skip] release/beta 3.0.2-9
skip-checks: true
2020-12-18 10:42:33 +00:00
Jaco Greeff 33fd09c053 Bump dev 2020-12-18 11:33:28 +01:00
Github Actions 7dadac7344 [CI Skip] release/beta 3.0.2-8
skip-checks: true
2020-12-17 13:05:48 +00:00
Jaco Greeff 340554a659 Mark detectPackage as sideEffect 2020-12-17 13:57:48 +01:00
Github Actions 236ad16406 [CI Skip] release/beta 3.0.2-7
skip-checks: true
2020-12-17 11:57:14 +00:00
Jaco Greeff aae4671db5 Bump common, detectPackage with callback 2020-12-17 12:49:05 +01:00
Github Actions d0f9eb7d03 [CI Skip] release/beta 3.0.2-6
skip-checks: true
2020-12-16 14:53:01 +00:00
Jaco Greeff d6106b3253 Allow detectPackage with import.meta.url (#2962)
* Allow detectPackage with import.meta.url

* Fix detectPackage import

* header naming
2020-12-16 15:46:02 +01:00
Github Actions 9740c282d8 [CI Skip] release/beta 3.0.2-5
skip-checks: true
2020-12-16 14:01:09 +00:00
Jaco Greeff f65b5c77ec RxJs esm for non-node (#2961) 2020-12-16 14:54:16 +01:00
Github Actions 0f920ee77d [CI Skip] release/beta 3.0.2-4
skip-checks: true
2020-12-16 12:19:27 +00:00
DavidandJaco Greeff 62d1415d1b Don't log full error (#2952)
* Don't log full error

In `txwrapper` we can't always know if a payload is a signing payload or a signed tx so we first try one and then the other. When the former fails users get a scary-looking error. If upstream logs the error there's little we can do about it lest we [monkey patch `console.error`](https://github.com/paritytech/txwrapper-core/pull/22/files#diff-ea2d1c5845dd0e2fb9814e98a3464c2c63a43922983391e98fe9c20c328e979cR55) which is nasty af.

Hence this PR that removes the log here so that downstream can choose what to do with the error message.

* Add UnsafeOptions to let callers decide if they want errors logged or not

* Update packages/api-contract/src/util.ts

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

* Update packages/rpc-core/src/index.ts

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

* Update packages/rpc-core/src/index.ts

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

* Update packages/types/src/create/createType.ts

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

Co-authored-by: Jaco Greeff <jacogr@gmail.com>
2020-12-16 13:12:50 +01:00
Github Actions f8792e09c9 [CI Skip] release/beta 3.0.2-3
skip-checks: true
2020-12-16 11:42:45 +00:00
Jaco Greeff 8d4b03d066 Thin rxjs wrapper for esm (#2960)
* Thin rxjs wrapper for esm

* Comprehensive exports
2020-12-16 12:35:44 +01:00
Github Actions 5d3c728cf0 [CI Skip] release/beta 3.0.2-2
skip-checks: true
2020-12-15 22:40:49 +00:00
Ian HeandIan He 04340de6ae Http provider support multi (#2950)
* use queryStorageAt for multi storage queries

* fix lint

* e2e tests

* skip lints for api.spec.ts

* remove e2e test from PR

* do not decorate multi() if can not supported

* empty line

* update

Co-authored-by: Ian He <ian.he@centrality.ai>
2020-12-15 23:32:45 +01:00
Github Actions d709a5b3be [CI Skip] release/beta 3.0.2-1
skip-checks: true
2020-12-15 14:00:58 +00:00
Jaco Greeff 1d3dfc77a3 Use package-info (name/version only) for detectPackage (#2955)
* Use package-info (name/version only) for detectPackage

* Fixed @polkadot/dev?
2020-12-15 14:52:27 +01:00
Antoine EstienneandJaco Greeff a72d33ad24 Add missing parachain types (#2954)
* adde dmissing types

* replaced id with u32

* Apply suggestions from code review

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

* camelCase

* lint

Co-authored-by: Jaco Greeff <jacogr@gmail.com>
2020-12-15 14:51:55 +01:00
Github Actions e4948ef579 [CI Skip] release/beta 3.0.2-0
skip-checks: true
2020-12-14 15:53:52 +00:00
Jaco Greeff f9812585b8 Remove core single-type create duplication (#2888)
* Remove coe single-type create duplication

* Re-add entry index
2020-12-14 16:45:30 +01:00
Github Actions e2654dd2f8 [CI Skip] release/stable 3.0.1
skip-checks: true
2020-12-14 09:21:39 +00:00
Jaco Greeff 5f0ea88a42 3.0 (#2948)
* 3.0

* CHANGELOG typos
2020-12-14 10:13:17 +01:00
Github Actions 69be690be6 [CI Skip] release/beta 2.10.2-18
skip-checks: true
2020-12-13 16:02:40 +00:00
Jaco Greeff 67d4637786 Bump common (#2947) 2020-12-13 16:55:38 +01:00
Github Actions d2557a3cac [CI Skip] release/beta 2.10.2-17
skip-checks: true
2020-12-13 13:22:02 +00:00
Jaco Greeff e2911a33c4 Replace memoizee with memoize from @polkadot/util (#2946) 2020-12-13 14:15:13 +01:00
Github Actions 9b45901760 [CI Skip] release/beta 2.10.2-16
skip-checks: true
2020-12-13 10:22:49 +00:00
Jaco Greeff 450f53d563 Bump common (#2945)
* Bump common

* Expand CHANGELOG
2020-12-13 11:15:47 +01:00
Github Actions 5374c863ad [CI Skip] release/beta 2.10.2-15
skip-checks: true
2020-12-12 13:12:08 +00:00
Jaco Greeff ce29ae6e0e Bump common (#2944) 2020-12-12 14:05:13 +01:00
Github Actions d420c65c2b [CI Skip] release/beta 2.10.2-14
skip-checks: true
2020-12-11 23:14:23 +00:00
Jaco Greeff 427ae64fab Bump dev (#2943) 2020-12-12 00:06:32 +01:00
Github Actions 173c40b0e5 [CI Skip] release/beta 2.10.2-13
skip-checks: true
2020-12-11 17:51:07 +00:00
Jaco Greeff 208fbb24d5 Build esm (& add x-rxjs package) (#2942) 2020-12-11 18:44:23 +01:00
Github Actions 9ee563e3f6 [CI Skip] release/beta 2.10.2-12
skip-checks: true
2020-12-11 09:28:01 +00:00
Jaco Greeff 70acb27218 Bump dev 2020-12-11 10:19:39 +01:00
Github Actions dd29ebbeae [CI Skip] release/beta 2.10.2-11
skip-checks: true
2020-12-10 16:51:46 +00:00
Jaco Greeff b01935122f Build esm alongside (don't use) (#2940) 2020-12-10 17:43:33 +01:00
Github Actions 71d54821e0 [CI Skip] release/beta 2.10.2-10
skip-checks: true
2020-12-10 14:50:44 +00:00
Jaco Greeff 5df3e1605a Bump deps (#2938) 2020-12-10 15:43:29 +01:00
Github Actions 50737b7ef7 [CI Skip] release/beta 2.10.2-9
skip-checks: true
2020-12-09 19:08:39 +00:00
Jaco Greeff ecc86f797c Bump dev (prefer esm in esm mode) (#2937) 2020-12-09 20:01:36 +01:00
Github Actions ff020d14e4 [CI Skip] release/beta 2.10.2-8
skip-checks: true
2020-12-09 17:08:37 +00:00
Jaco Greeff ff36cb97c2 Bump common, allow esm alongside cjs (#2936)
* Bump common, allow esm alongside cjs

* Bumps
2020-12-09 18:00:01 +01:00
Github Actions 01f2fe7c86 [CI Skip] release/beta 2.10.2-7
skip-checks: true
2020-12-09 11:17:31 +00:00
Jaco Greeff 948d8cccc1 Swap to Metadata <-> registry path imports (#2934)
* Swap to Metadata <-> registry path imports

* Call circulars
2020-12-09 12:09:20 +01:00
Github Actions da2e2f89c9 [CI Skip] release/beta 2.10.2-6
skip-checks: true
2020-12-09 10:10:27 +00:00
Alex D 6b4fd110a1 Types bundle derive (#2932)
* added derives typesBundle overrides

* fix lint
2020-12-09 11:01:33 +01:00
Jaco Greeff a48eba101c Adjust Type dependency on Text (#2933) 2020-12-09 11:01:11 +01:00
Github Actions 78b9d29fa0 [CI Skip] release/beta 2.10.2-5
skip-checks: true
2020-12-08 16:52:37 +00:00
Jaco Greeff 92c9ce15d6 Expand SessionKeys[n] definitions (#2929)
* Expand SessionKeys[n] definitions

* Update packages/types/src/interfaces/session/definitions.ts
2020-12-08 17:44:35 +01:00
Github Actions 11c4239614 [CI Skip] release/beta 2.10.2-4
skip-checks: true
2020-12-08 16:33:06 +00:00
Jaco Greeff 0cb7b34ff0 Update with new consumed Weight structures (#2928)
* Update with new consumed Weight structures

* dispatch(Info, Error} optional in result

* Update for maximumBlockWeight
2020-12-08 17:26:13 +01:00
Github Actions a74382c539 [CI Skip] release/beta 2.10.2-3
skip-checks: true
2020-12-08 12:33:19 +00:00
Krzysztof Jelski beccc2ed9b Derive for bounties and descriptions (#2925)
* WIP on bounties derive.

* wip

* Some basic tests for derive bounties

* Simplify bounties derive and mocks

* Get bounties and descriptions

* Allow for empty bounties. Refactor tests.

* Move tests to test directory

* Attempt to remove duplication

* Sort imports

* Reorganize tests

* Change returned type
2020-12-08 13:25:30 +01:00
Jaco Greeff c29f66c7c5 Inject RPC definitions from typesBundle (#2927)
* Inject RPC definitions from typesBundle

* Augment RPC only, don't clobber
2020-12-08 13:23:41 +01:00
Github Actions dba23e3923 [CI Skip] release/beta 2.10.2-2
skip-checks: true
2020-12-08 10:34:37 +00:00
Jaco Greeff f633b3d6c1 Remove --fix on CI (#2926) 2020-12-08 11:27:07 +01:00
Github Actions b1c7409c59 [CI Skip] release/beta 2.10.2-1
skip-checks: true
2020-12-07 16:34:27 +00:00
Jaco Greeff a2423b1004 Add query sizeAt (#2922)
* Add query sizeAt

* @deprecated for .range
2020-12-07 17:27:33 +01:00
Github Actions c0f1bf7f1e [CI Skip] release/beta 2.10.2-0
skip-checks: true
2020-12-07 15:34:13 +00:00
Jaco Greeff 8e6a1c8fb1 Bump dev (sort imports) (#2923)
* Bump dev (sort imports)

* Resort

* Adjust ApiInterfaceRx
2020-12-07 16:26:19 +01:00
Github Actions 92ee9ab339 [CI Skip] release/stable 2.10.1
skip-checks: true
2020-12-07 10:18:58 +00:00
Jaco Greeff 70f1fa5514 2.10 (#2920)
* 2.10

* Use system.blockHashCount
2020-12-07 11:11:39 +01:00
Github Actions 37f49b30de [CI Skip] release/beta 2.9.2-13
skip-checks: true
2020-12-06 10:39:11 +00:00
Jaco Greeff 8b4d3872d7 Bump metadata (w/ AssetBalance, AssetDetails) (#2917)
* Bump metadata (w/ AssetBalance, AssetDetails)

* Bluperint for new-style with salt as default

* Use TBalance

* Easier overrides

* Balance

* Build types
2020-12-06 11:31:54 +01:00
Github Actions 4e2ab3d11c [CI Skip] release/beta 2.9.2-12
skip-checks: true
2020-12-06 09:58:41 +00:00
Jaco Greeff b1291bfbe3 system_{addLogFilter, resetLogFilter} RPCs (#2916) 2020-12-06 10:51:05 +01:00
Github Actions 026ef3c4ed [CI Skip] release/beta 2.9.2-11
skip-checks: true
2020-12-05 10:06:04 +00:00
Jaco Greeff 158fe79c43 Bump deps (minor) (#2914) 2020-12-05 10:58:25 +01:00
Github Actions c467efdb3b [CI Skip] release/beta 2.9.2-10
skip-checks: true
2020-12-04 12:01:42 +00:00
Jaco Greeff b1d0eb9597 Revert "Add signExtrinsic on the Signer interface (#2912)"
This reverts commit a9e8388cc8.
2020-12-04 12:54:14 +01:00
Github Actions 3b9149d3ac [CI Skip] release/beta 2.9.2-9
skip-checks: true
2020-12-04 11:31:06 +00:00
Jaco Greeff a9e8388cc8 Add signExtrinsic on the Signer interface (#2912)
* Add signExtrinsic on the Signer interface

* Unused registry
2020-12-04 12:22:40 +01:00
Github Actions a33265e5ed [CI Skip] release/beta 2.9.2-8
skip-checks: true
2020-12-03 08:53:55 +00:00
Jaco Greeff 1d6bfb69ff Limit to maximum hashes (250) in era length calcs (#2910) 2020-12-03 09:45:23 +01:00
Github Actions 96f32c63fd [CI Skip] release/beta 2.9.2-7
skip-checks: true
2020-12-03 07:23:50 +00:00
Jaco Greeff 07b69fe635 .multi with no params (#2908)
* .multi with no params

* Adjust batch size
2020-12-03 08:16:24 +01:00
Github Actions a579f3e09c [CI Skip] release/beta 2.9.2-6
skip-checks: true
2020-12-02 19:38:40 +00:00
Jaco Greeff 6559b1ad11 Retrieve ledger for payouts (#2901) 2020-12-02 20:30:40 +01:00
Github Actions f7da1d0fb2 [CI Skip] release/beta 2.9.2-5
skip-checks: true
2020-12-02 18:31:04 +00:00
Jaco Greeff 94e57f6dcf hasIndentities extract base (#2900) 2020-12-02 19:23:30 +01:00
Github Actions 1364c45d16 [CI Skip] release/beta 2.9.2-4
skip-checks: true
2020-12-02 15:54:07 +00:00
Jaco Greeff 54b5b38ba6 Additional query opts (flags) (#2899) 2020-12-02 16:47:47 +01:00
Github Actions 944f4ddf1d [CI Skip] release/beta 2.9.2-3
skip-checks: true
2020-12-02 13:56:41 +00:00
Jaco Greeff 895d44fe9f Optimize use of derive staking.query (with full results) (#2897) 2020-12-02 14:49:14 +01:00
Github Actions eccc6cc2c9 [CI Skip] release/beta 2.9.2-2
skip-checks: true
2020-12-02 11:17:38 +00:00
Jaco Greeff a7c2d11a56 Update parachain types (#2895) 2020-12-02 12:09:47 +01:00
Github Actions a71744bd16 [CI Skip] release/beta 2.9.2-1
skip-checks: true
2020-12-02 09:18:47 +00:00
Jaco Greeff 0e52e8fe23 Some type imports (interfaces) (#2887)
* Some type imports (interfaces)

* Additional

* Additional

* Small movements/fixes

* Additional

* Additional

* Unsaved...
2020-12-02 10:12:19 +01:00
Github Actions 2769336344 [CI Skip] release/beta 2.9.2-0
skip-checks: true
2020-12-01 20:41:29 +00:00
Jaco Greeff 522906695f Bump berry (#2893)
* Bump berry

* rewrite
2020-12-01 21:33:46 +01:00
Github Actions f7c968b7a6 [CI Skip] release/stable 2.9.1
skip-checks: true
2020-11-30 11:25:01 +00:00
Jaco Greeff c1b7660122 2.9 (#2891) 2020-11-30 12:16:29 +01:00
Github Actions 811a2291ed [CI Skip] release/beta 2.8.3-5
skip-checks: true
2020-11-29 15:16:18 +00:00
Jaco Greeff 90cc148383 Correct hasIdentity parentId extraction (#2884) 2020-11-29 16:08:39 +01:00
Github Actions b652bdc2de [CI Skip] release/beta 2.8.3-4
skip-checks: true
2020-11-29 14:24:26 +00:00
Jaco Greeff f6942cc0f0 Extract identity-only derive from accounts.info (#2882)
* Extract identity-only derive from accounts.info

* Add hasIdentity

* hasIdentityMulti
2020-11-29 15:16:54 +01:00
Github Actions 8e852db87c [CI Skip] release/beta 2.8.3-3
skip-checks: true
2020-11-29 11:49:15 +00:00
Jordan 75f97bb1ff Allow typegen for custom RPCs (#2876)
* Allow typegen for custom RPCs

* It runs

* fix lint

* Remove unused metadata arg
2020-11-29 12:42:42 +01:00
Github Actions c8d7e971bc [CI Skip] release/beta 2.8.3-2
skip-checks: true
2020-11-28 12:05:18 +00:00
Jaco Greeff 09aa046ab4 Remove send queue, always require connection (#2881)
* Remove send queue, always require connection

* Adjust tests for non-queued
2020-11-28 12:57:24 +01:00
Github Actions 25e29d9565 [CI Skip] release/beta 2.8.3-1
skip-checks: true
2020-11-28 11:32:57 +00:00
Jaco Greeff c396b963ee Version bump (pre) (#2880) 2020-11-28 12:25:56 +01:00
Github Actions 46be42705b [CI Skip] release/stable 2.8.2
skip-checks: true
2020-11-28 11:09:03 +00:00
Jaco Greeff d65eb7a27f Raw slice with from (like subarray) (#2879)
* Raw slice with from (like subarray)

* Dep bumps

* 2.8.2

* re-use toU8a()

* Uint8Array.from

* slice on derived comment
2020-11-28 12:00:29 +01:00
Github Actions a1a73cbf01 [CI Skip] release/beta 2.8.2-3
skip-checks: true
2020-11-26 10:41:05 +00:00
Jaco Greeff 72e03138e8 Fix 0-259 for node 2020-11-26 11:33:32 +01:00
Github Actions b0e7440ca6 [CI Skip] release/beta 2.8.2-2
skip-checks: true
2020-11-26 10:09:35 +00:00
Jaco Greeff 4847988a94 Types for Substrate node (MultiAddress) (#2875) 2020-11-26 11:02:31 +01:00
Github Actions a58be22764 [CI Skip] release/beta 2.8.2-1
skip-checks: true
2020-11-25 12:15:04 +00:00
Jaco Greeff f6af257051 derive.staking.electedInfo also contains current (#2874) 2020-11-25 13:08:17 +01:00
Github Actions 790e0ebdcf [CI Skip] release/beta 2.8.2-0
skip-checks: true
2020-11-24 12:22:26 +00:00
Jaco Greeff 1db2cfbedf Bump deps (#2872) 2020-11-24 13:13:12 +01:00
Github Actions 8a75c9bac0 [CI Skip] release/stable 2.8.1
skip-checks: true
2020-11-23 12:23:26 +00:00
Jaco Greeff ab05224c71 2.8 (#2869) 2020-11-23 13:15:10 +01:00
Github Actions 986e8fbb20 [CI Skip] release/beta 2.7.2-6
skip-checks: true
2020-11-22 13:57:53 +00:00
Jaco Greeff 2906b02e41 IndicesLookupSource (#2867) 2020-11-22 14:51:22 +01:00
Github Actions 683c37b171 [CI Skip] release/beta 2.7.2-5
skip-checks: true
2020-11-22 12:42:30 +00:00
Jaco Greeff 20bdc6e63d Additional type detection in MultiAddress (#2866)
* Additional type detection in MultiAddress

* instanceof self
2020-11-22 13:35:48 +01:00
Github Actions b200b20972 [CI Skip] release/beta 2.7.2-4
skip-checks: true
2020-11-19 11:20:41 +00:00
Jaco Greeff 7a4fe4fe5f Return Raw results on storage decode failures (#2862) 2020-11-19 12:12:00 +01:00
Github Actions aa6ec6c9dc [CI Skip] release/beta 2.7.2-3
skip-checks: true
2020-11-18 14:01:46 +00:00
Jaco Greeff 0871e074c7 RegistryMetadata exposes version (#2860) 2020-11-18 14:54:10 +01:00
Github Actions aa7d34dca1 [CI Skip] release/beta 2.7.2-2
skip-checks: true
2020-11-18 12:34:19 +00:00
Jaco Greeff 65b4d5bb43 Update README.md 2020-11-18 13:27:12 +01:00
Github Actions acc1edaddc [CI Skip] release/beta 2.7.2-1
skip-checks: true
2020-11-18 11:57:41 +00:00
Jaco Greeff ba9b9c6fa2 Debump bn.js (#2859) 2020-11-18 12:49:41 +01:00
Github Actions aa4f593d79 [CI Skip] release/beta 2.7.2-0
skip-checks: true
2020-11-17 14:38:42 +00:00
Lovesh Harchandani dd2dde5701 Fix name of "getBlock" in package "api-derive" and export it in "index.ts" (#2857)
Signed-off-by: lovesh <lovesh.bond@gmail.com>
2020-11-17 15:31:01 +01:00
Github Actions 033cba718d [CI Skip] release/stable 2.7.1
skip-checks: true
2020-11-16 09:39:20 +00:00
Jaco Greeff c4470eba14 2.7 (#2854) 2020-11-16 10:30:33 +01:00
Github Actions fb2bc42fe0 [CI Skip] release/beta 2.6.2-16
skip-checks: true
2020-11-16 06:42:42 +00:00
Jaco Greeff d3b13bceb0 Allow salt in contract deploy (#2849)
* Allow salt in contract deploy

* Mark deprecated

* Shorten

* Cleanups

* Additional cleanups

* Cleanups

* Explicit Bytes to decodeEvent

* Adjust method creation

* Allow null salt
2020-11-16 07:35:02 +01:00
Github Actions 0fc5e1d387 [CI Skip] release/beta 2.6.2-15
skip-checks: true
2020-11-16 05:48:24 +00:00
Jaco Greeff ce6c25e4e2 Tests & adjustments for encodeTypes (#2853)
* Tests & adjustments for encodeTypes

* explicit wrap types

* Remove params

* cleanups
2020-11-16 06:40:49 +01:00
Github Actions 165381d79a [CI Skip] release/beta 2.6.2-14
skip-checks: true
2020-11-15 16:15:39 +00:00
Jaco Greeff 2da3f16bda Bumps (#2852) 2020-11-15 17:07:30 +01:00
Github Actions 02c349093b [CI Skip] release/beta 2.6.2-13
skip-checks: true
2020-11-14 15:50:17 +00:00
Jaco Greeff 82873c44f8 Pass raw data for contract event decoding (#2851) 2020-11-14 16:42:47 +01:00
Github Actions 7afc696da3 [CI Skip] release/beta 2.6.2-12
skip-checks: true
2020-11-13 09:53:49 +00:00
Jaco Greeff 4e0d430504 Adjust generated @polkadot/types imports (#2848)
* Adjust generated @polkadot/types imports

* import type

* Only export types from codec/types
2020-11-13 10:46:16 +01:00
Github Actions 0b091fa935 [CI Skip] release/beta 2.6.2-11
skip-checks: true
2020-11-12 18:39:33 +00:00
Jaco Greeff 4db33b6caf Configurable extrinsic signature (#2845)
* Configurable extrinsic signature

* With Address override as well
2020-11-12 19:31:55 +01:00
Github Actions 4dd0372702 [CI Skip] release/beta 2.6.2-10
skip-checks: true
2020-11-12 15:41:37 +00:00
Jaco Greeff 98b01a462d Mark Polkadot 26 upgrade (#2843) 2020-11-12 16:33:26 +01:00
Github Actions 03570f2f11 [CI Skip] release/beta 2.6.2-9
skip-checks: true
2020-11-12 13:52:19 +00:00
Jaco Greeff f810e65ea2 Additional enum tests (#2842)
* Additional enum tests

* Adjust compare files

* Remove debug log
2020-11-12 14:45:32 +01:00
Github Actions c04b63e4af [CI Skip] release/beta 2.6.2-8
skip-checks: true
2020-11-12 11:31:15 +00:00
Jaco Greeff 98a2ef9d72 Support ABI files with wasm (.contract output) (#2841)
* Support ABI files with wasm (.contract output)

* AbiBase exports

* Additional default exports

* Remove any

* Fix build
2020-11-12 12:23:28 +01:00
Github Actions 999e69b031 [CI Skip] release/beta 2.6.2-7
skip-checks: true
2020-11-11 12:05:51 +00:00
Jaco Greeff 79e99fd6e3 Dev bump (#2839)
* Adjust internal generic imports

* Update dev

* Adjust primitive imports

* Class exports has uppercase variant

* common

* to* chenges

* Adjust EventData for registry creation
2020-11-11 12:58:35 +01:00
Jaco Greeff d91460b79d New contracts Schedule types (#2792) 2020-11-11 11:32:04 +01:00
Github Actions b1f7b72043 [CI Skip] release/beta 2.6.2-6
skip-checks: true
2020-11-11 08:47:40 +00:00
Jaco Greeff 5a1fd4a1bb Adjust internal generic imports (#2838) 2020-11-11 09:40:35 +01:00
Github Actions 3ec469bbaf [CI Skip] release/beta 2.6.2-5
skip-checks: true
2020-11-10 16:52:17 +00:00
Jaco Greeff 091ee7624a Bumps 2020-11-10 17:45:08 +01:00
Github Actions 1918547fdc [CI Skip] release/beta 2.6.2-4
skip-checks: true
2020-11-10 13:06:53 +00:00
Jaco Greeff a8a956c85d Re-enable esnext (with mjs) (#2836)
* Re-enable esnext (with mjs)

* Updates

* Adjust
2020-11-10 13:58:11 +01:00
Github Actions 143febf807 [CI Skip] release/beta 2.6.2-3
skip-checks: true
2020-11-10 10:22:15 +00:00
Jaco Greeff af9437f80a Adjust create imports (#2834)
* Adjust create imports

* Restore create root exports

* Adjust unsafe creation
2020-11-10 11:14:38 +01:00
Github Actions 5cf585c8dd [CI Skip] release/beta 2.6.2-2
skip-checks: true
2020-11-09 22:24:21 +00:00
Jaco Greeff e6dbbfae34 Adjust interfaces for cleaner esnext usage (#2833)
* Adjust interfaces for cleaner esnext usage

* Swap out esnext
2020-11-09 23:17:52 +01:00
Github Actions 8993844739 [CI Skip] release/beta 2.6.2-1
skip-checks: true
2020-11-09 18:49:06 +00:00
Jaco Greeff 21d0622f84 Bump common (#2832)
* Bump common

* Update for new common non-default exports

* Don't export createSubmittable

* Adjust exports

* default export adjustments

* Some additional non-default exports
2020-11-09 19:41:29 +01:00
Github Actions e787c08bd9 [CI Skip] release/beta 2.6.2-0
skip-checks: true
2020-11-09 16:48:15 +00:00
Jaco Greeff ce6d9424e6 Build esnext modules (#2831) 2020-11-09 17:40:52 +01:00
Github Actions 930252e3bc [CI Skip] release/stable 2.6.1
skip-checks: true
2020-11-09 10:48:02 +00:00
Jaco Greeff 613aebd26d 2.6 (#2829) 2020-11-09 11:40:26 +01:00
Github Actions 79e0d807ab [CI Skip] release/beta 2.5.2-6
skip-checks: true
2020-11-09 10:23:02 +00:00
Jaco Greeff 0cbd702c93 Remove peerDeps (explicit) (#2828) 2020-11-09 11:14:22 +01:00
Github Actions e7ee68d138 [CI Skip] release/beta 2.5.2-5
skip-checks: true
2020-11-09 09:19:58 +00:00
Jaco Greeff 46fb44d3d8 Bump metadata (#2826) 2020-11-09 10:12:26 +01:00
Github Actions 2085a0662c [CI Skip] release/beta 2.5.2-4
skip-checks: true
2020-11-08 13:27:05 +00:00
Jaco Greeff 4476f2838a Bump common (#2824) 2020-11-08 14:20:37 +01:00
Github Actions ddd994ea4a [CI Skip] release/beta 2.5.2-3
skip-checks: true
2020-11-06 12:47:40 +00:00
Jaco Greeff 06a325795b Adjust max allowed call gas (5 * 10 ^ 12) (#2821)
* Adjust max allowed call gas (5 * 10 ^ 12)

* Update packages/api-contract/src/base/Contract.ts

* Update dev
2020-11-06 13:40:17 +01:00
Github Actions 67d7df82d3 [CI Skip] release/beta 2.5.2-2
skip-checks: true
2020-11-05 16:28:20 +00:00
Jaco Greeff ca1bd8fa19 Hack for invalid chain-data on proposals (due to mismatched upgrade) (#2820) 2020-11-05 17:19:35 +01:00
Github Actions 33978d5007 [CI Skip] release/beta 2.5.2-1
skip-checks: true
2020-11-03 18:34:53 +00:00
Jaco Greeff b6ff8a400e Swap accountId check (Ethereum-addr chains have === 20) (#2816) 2020-11-03 19:27:39 +01:00
Github Actions 2bc3b711b2 [CI Skip] release/beta 2.5.2-0
skip-checks: true
2020-11-03 17:54:42 +00:00
Jaco Greeff 09348d1197 Bump deps (#2815) 2020-11-03 18:45:31 +01:00
Github Actions cb791d3963 [CI Skip] release/stable 2.5.1
skip-checks: true
2020-11-02 11:30:30 +00:00
Jaco Greeff bc49e75e61 CHANGELOG for 2.5.1 2020-11-02 12:22:24 +01:00
Jaco Greeff 67f8dcafdb 2.5 (#2813) 2020-11-02 11:45:57 +01:00
Github Actions e95117839b [CI Skip] release/beta 2.4.2-20
skip-checks: true
2020-10-31 12:27:54 +00:00
Jaco Greeff 9f60a8cd5f Add decoded contract events to execution (#2812)
* Cleanup assignments

* Small adjustments

* Add decoded contract events to execution

* Adjust all applyOnEvent
2020-10-31 13:19:57 +01:00
Github Actions e23fae86d5 [CI Skip] release/beta 2.4.2-19
skip-checks: true
2020-10-31 11:58:34 +00:00
Jaco Greeff 94a4594d32 Cleanup assignments (#2811)
* Cleanup assignments

* Small adjustments

* Cleanup AnyJson results

* Event toHuman
2020-10-31 12:50:44 +01:00
Github Actions 5be8ef8f0d [CI Skip] release/beta 2.4.2-18
skip-checks: true
2020-10-31 10:25:53 +00:00
Jaco Greeff e855d5a9d4 Cater for new/old contracts_call results (#2810)
* Cater for new/old contracts_call results

* Update packages/types/src/interfaces/contracts/definitions.ts

* Allow RPC layer to output JSON

* Typing for json outputs

* Convert results

* RPC compat mapping

* Ensure RPC .json is exposed

* Remove compat layer

* Old error detection

* Map to unknown

* Update packages/rpc-core/src/index.ts

* linting
2020-10-31 11:18:58 +01:00
Github Actions 2a0e481710 [CI Skip] release/beta 2.4.2-17
skip-checks: true
2020-10-30 13:37:09 +00:00
Jaco Greeff 161c121cb2 Cleanups for maintainability (#2809)
* Cleanups for maintainability

* Split referendumsInfo

* Extract didUpdate -> bool

* Era filtering

* Default to council

* Points cache

* Remove cache

* Move map arg
2020-10-30 14:28:38 +01:00
Github Actions de38735498 [CI Skip] release/beta 2.4.2-16
skip-checks: true
2020-10-30 11:17:23 +00:00
Jaco Greeff ce1e6615e3 Add derive for single council proposal (#2808) 2020-10-30 12:09:12 +01:00
Github Actions 3ebe9f5243 [CI Skip] release/beta 2.4.2-15
skip-checks: true
2020-10-30 09:54:52 +00:00
Jaco Greeff f686cfcce7 Cleanup always primitive (caters for solang) (#2807)
* Cleanup always primitive (caters for solang)

* Compare (with primitive)
2020-10-30 10:47:18 +01:00
Github Actions c27e49c6f5 [CI Skip] release/beta 2.4.2-14
skip-checks: true
2020-10-30 09:25:37 +00:00
Jaco Greeff 5c69f78676 Expand Call errors with actual callIndex info (#2806)
* Expand Call errors with actutl callIndex info

* Update test expectation

* casing
2020-10-30 10:17:19 +01:00
Github Actions 8f00351405 [CI Skip] release/beta 2.4.2-13
skip-checks: true
2020-10-29 16:25:25 +00:00
Jaco Greeff 1f6c8c2eb8 Use assertReturn to cleanup (#2804)
* Use assertReturn to cleanup

* Remove Uint/Int duplication

* Adjust

* ws errors, part 2

* .

* Adj. manual

* adj

* switchMap

* Revert "switchMap"

This reverts commit edfa4a2258f09042b61a27fd3812f0c53039fe4f.

* Revert.

* Revert.

* protected constructor

* Correct isHexJson flag

* Remove isHexJson (always detect)

* Adjust

* Flags
2020-10-29 17:17:22 +01:00
Github Actions 9bb1343255 [CI Skip] release/beta 2.4.2-12
skip-checks: true
2020-10-29 13:27:28 +00:00
Jaco Greeff 94ebb321f1 Complexity adjustments (#2803)
* Complexity adjustments

* cleanups

* Small cleanups

* Additional

* revert era

* ExtrinsicEra
2020-10-29 14:20:10 +01:00
Github Actions 63fd5baa8f [CI Skip] release/beta 2.4.2-11
skip-checks: true
2020-10-29 11:08:09 +00:00
Jaco Greeff ea3ee428d8 Rework asLatest update (#2802)
* Revert "[CI Skip] release/beta 2.4.2-10"

This reverts commit 5cb1c2d33a.

* Revert "Use asLatest in metadata extraction (#2800)"

This reverts commit 600666de1c.

* Bumps

* Expansion

* Flatten

* Metadata class imports

* Cleanup Decorate exports

* Move Metadata to top-level

* Swap logger on ABI

* Adjust imports

* Cleanups

* Updates
2020-10-29 11:59:37 +01:00
Github Actions 5cb1c2d33a [CI Skip] release/beta 2.4.2-10
skip-checks: true
2020-10-29 08:13:14 +00:00
Jaco Greeff 600666de1c Use asLatest in metadata extraction (#2800)
* User asLatest in metadata extraction

* Cleanup Decorated, bump

* linting

* cleanup decorate

* Remove registry arg from Decorated
2020-10-29 09:05:53 +01:00
Github Actions 524885e8de [CI Skip] release/beta 2.4.2-9
skip-checks: true
2020-10-28 13:37:25 +00:00
Jaco Greeff 1476e5e5e9 Bump common, string* with String (#2799)
* Bump common, string* with String

* Linting, TS 4.0.5
2020-10-28 14:28:49 +01:00
Github Actions 3f48b3c29f [CI Skip] release/beta 2.4.2-8
skip-checks: true
2020-10-28 12:34:15 +00:00
Jaco Greeff 9debb854f9 syncState RPCs (#2797)
* syncState RPCs

* Use endpoint override as available

* Allow Json construction, update syncstate_get def
2020-10-28 13:26:37 +01:00
Github Actions db3fe7d103 [CI Skip] release/beta 2.4.2-7
skip-checks: true
2020-10-28 09:40:45 +00:00
Jaco Greeff a93063c6fb Know-types for Rococo v1 (#2795) 2020-10-28 10:31:32 +01:00
Github Actions 8e4bbd2b23 [CI Skip] release/beta 2.4.2-6
skip-checks: true
2020-10-27 14:27:45 +00:00
Jaco Greeff cf1c2ea58a Add dryRun capability on Submittable (#2793)
* Add dryRun capability on Submittable

* Ordering, add to interface

* Dry run with signing

* Revert paymentInfo changes
2020-10-27 15:19:00 +01:00
Github Actions ca2909e4ba [CI Skip] release/beta 2.4.2-5
skip-checks: true
2020-10-27 12:55:21 +00:00
Jaco Greeff cc9ea53e1a Registry hash returns H256 object (#2791)
* Use logger in error/warning messages

* Update packages/types/src/codec/BTreeSet.ts

* Update expectation

* Some additional type tests

* resgirty.hash returns H256

* Additional override test
2020-10-27 13:47:18 +01:00
Github Actions d876e19fa1 [CI Skip] release/beta 2.4.2-4
skip-checks: true
2020-10-27 12:22:14 +00:00
Jaco Greeff bb7b94dc35 Use logger in error/warning messages (#2790)
* Use logger in error/warning messages

* Update packages/types/src/codec/BTreeSet.ts

* Update expectation

* Some additional type tests
2020-10-27 13:14:03 +01:00
Github Actions be1deb1a75 [CI Skip] release/beta 2.4.2-3
skip-checks: true
2020-10-27 11:30:53 +00:00
Jaco Greeff 14026fef42 Format similar types transparently (#2788)
* Format similar types transparently

* Adjust test expectations

* Remove console.error

* Adjust getTypeDef for check-only
2020-10-27 12:23:18 +01:00
Github Actions b2ea2da6aa [CI Skip] release/beta 2.4.2-2
skip-checks: true
2020-10-27 09:07:26 +00:00
Jaco Greeff f1d21847db Bump deps (util) (#2787) 2020-10-27 09:59:27 +01:00
Github Actions b1fcfd11f4 [CI Skip] release/beta 2.4.2-1
skip-checks: true
2020-10-26 21:44:52 +00:00
Jeremías Díaz 7d1f0e2900 fix(typegen): dedupe similar types (#2786) 2020-10-26 22:37:09 +01:00
Jaco Greeff fb377fb0d4 Adjust index WS imports (#2785) 2020-10-26 22:36:03 +01:00
Github Actions 26de59ed79 [CI Skip] release/beta 2.4.2-0
skip-checks: true
2020-10-26 14:51:50 +00:00
Jaco Greeff 964bd33bb1 Bump GH actions, root cleanups (#2783)
* Bump GH actions, root cleanups

* Remove copy scripts
2020-10-26 15:42:51 +01:00
Github Actions f068ef76a5 [CI Skip] release/stable 2.4.1
skip-checks: true
2020-10-26 08:45:33 +00:00
Jaco Greeff e6e60ec6d0 2.4 (#2782) 2020-10-26 09:36:34 +01:00
Github Actions 9f9680ba92 [CI Skip] release/beta 2.3.2-17
skip-checks: true
2020-10-26 07:24:04 +00:00
Jaco Greeff bb63de1653 Add to/fromU8a on contract events and messages (#2778)
* Add to/fromU8a on contract events and messages

* Add constructor decoding
2020-10-26 08:14:51 +01:00
Github Actions a2c2b24198 [CI Skip] release/beta 2.3.2-16
skip-checks: true
2020-10-25 13:53:59 +00:00
Jaco Greeff 1944ffe017 Remove specName-specific warnings (#2781) 2020-10-25 14:45:13 +01:00
Github Actions d4aa36981d [CI Skip] release/beta 2.3.2-15
skip-checks: true
2020-10-25 13:42:52 +00:00
Jaco Greeff 2c735fbc53 Add node-template to known types (#2780) 2020-10-25 14:34:43 +01:00
Github Actions 7038045bc8 [CI Skip] release/beta 2.3.2-14
skip-checks: true
2020-10-25 08:44:22 +00:00
Jaco Greeff 0be5c969aa Bump dev & berry (#2779) 2020-10-25 09:37:41 +01:00
Github Actions 9ead2bdc41 [CI Skip] release/beta 2.3.2-13
skip-checks: true
2020-10-24 08:01:51 +00:00
Jaco Greeff 1ae37ed2d3 Add initial MultiAddress impl. (#2776)
* Add intitial MultiAddress impl.

* Allow invalid ss58 to be handled upstream
2020-10-24 09:52:36 +02:00
Github Actions 7ca78c5679 [CI Skip] release/beta 2.3.2-12
skip-checks: true
2020-10-23 11:02:34 +00:00
Jaco Greeff cd94d01b06 Bump deps (#2774)
* Bump deps

* Fix linting
2020-10-23 12:53:56 +02:00
Github Actions dafc92809d [CI Skip] release/beta 2.3.2-11
skip-checks: true
2020-10-23 10:13:36 +00:00
Jaco Greeff 298884d885 Adjust type ordering injection (#2771) 2020-10-23 12:04:42 +02:00
Github Actions 2a64c7c29a [CI Skip] release/beta 2.3.2-10
skip-checks: true
2020-10-23 08:25:02 +00:00
Jaco Greeff d2b7dc550a Add docs root redirects (#2769) 2020-10-23 10:16:21 +02:00
Github Actions 25f18d5455 [CI Skip] release/beta 2.3.2-9
skip-checks: true
2020-10-22 22:25:43 +00:00
Jaco Greeff c9c872c736 Expand metadata typeDefs for contracts (#2767)
* Expand metada typeDefs for contracts

* Adjust with actual displayName
2020-10-23 00:17:41 +02:00
Github Actions 8394b7fb5a [CI Skip] release/beta 2.3.2-8
skip-checks: true
2020-10-22 18:02:12 +00:00
Jaco Greeff fb82db382e Add derive.chain.subscribeNewBlocks (#2765)
* Add derive.chain.subscribeNewBlocks

* Expand
2020-10-22 19:52:03 +02:00
Github Actions 9f83f5cac3 [CI Skip] release/beta 2.3.2-7
skip-checks: true
2020-10-22 13:11:03 +00:00
Jaco Greeff 45a895b64f Decode contract events (#2763)
* Decode contract events

* Untable marker
2020-10-22 15:01:09 +02:00
Github Actions 93fbd6e13f [CI Skip] release/beta 2.3.2-6
skip-checks: true
2020-10-22 09:49:44 +00:00
Jaco Greeff b53490bd26 Add solang tests, re-organize sample layouts (#2760)
* Add solang tests, re-organize sample layouts

* Extra lines
2020-10-22 11:39:55 +02:00
Github Actions 594376367a [CI Skip] release/beta 2.3.2-5
skip-checks: true
2020-10-22 08:14:07 +00:00
Jaco Greeff 180fe57531 Register external types before using (#2759) 2020-10-22 10:04:29 +02:00
Github Actions bddb4465fb [CI Skip] release/beta 2.3.2-4
skip-checks: true
2020-10-22 07:11:52 +00:00
Jaco Greeff 3cdc647506 Format tuples (and others) in rpc args (#2758) 2020-10-22 09:02:31 +02:00
Github Actions 82ee7cc4f1 [CI Skip] release/beta 2.3.2-3
skip-checks: true
2020-10-21 09:59:22 +00:00
Jaco Greeff 9f9658d6a0 Format generated consts values (allow eg. tuple) (#2754) 2020-10-21 11:51:23 +02:00
Github Actions 1abc519297 [CI Skip] release/beta 2.3.2-2
skip-checks: true
2020-10-20 14:12:49 +00:00
Sean Young b939bcd57d Solang requires u256 and i256 types (#2752)
Tested with latest solang (current master).

Signed-off-by: Sean Young <sean@mess.org>
2020-10-20 16:03:55 +02:00
Github Actions d487a27676 [CI Skip] release/beta 2.3.2-1
skip-checks: true
2020-10-19 18:23:55 +00:00
Jaco Greeff 0525feb6f2 Match contract ids on camelCase (in addition to original) (#2747) 2020-10-19 20:15:19 +02:00
Github Actions 4ea343e369 [CI Skip] release/beta 2.3.2-0
skip-checks: true
2020-10-19 17:54:54 +00:00
Jaco Greeff 6f2173778e Add keysAt & entriesAt (#2746)
* At keysAt & entriesAt

* Update packages/api/src/base/Decorate.ts
2020-10-19 19:43:58 +02:00
Github Actions bb6166e65f [CI Skip] release/stable 2.3.1
skip-checks: true
2020-10-18 14:45:15 +00:00
Jaco Greeff dec82380c3 2.3 (#2743)
* 2.3

* Apply suggestions from code review
2020-10-18 16:36:35 +02:00
Jaco Greeff a980d4ae11 Allow for max block limit on gas (#2744) 2020-10-18 15:57:08 +02:00
Github Actions 5c194b6f5f [CI Skip] release/beta 2.2.2-11
skip-checks: true
2020-10-17 15:43:30 +00:00
Jaco Greeff c4662e6fd8 Adjust types based on use (#2742)
* Adjust types based on use

* MetaRegistry

* Remove FIXME

* Split path extraction

* casing

* Rewrite

* Rewrite interfaces

* Remove unused vuepress
2020-10-17 17:34:45 +02:00
Github Actions 995de2012e [CI Skip] release/beta 2.2.2-10
skip-checks: true
2020-10-17 13:04:16 +00:00
Jaco Greeff b1a8c011f4 Cleanup with meta registry (#2741)
* Cleanup with meta registry

* Update packages/api-contract/src/MetaRegistry.ts

* Allow for Str type

* No .only

* Cleanups

* Registry references

* Cleanups, real registry

* Ordering

* Future-proof
2020-10-17 14:54:50 +02:00
Github Actions 86cd550ad3 [CI Skip] release/beta 2.2.2-9
skip-checks: true
2020-10-17 08:53:12 +00:00
Jaco Greeff 57529998f9 Remove (unused) typedoc (#2739)
* Remove (unused) typedoc

* rm typedoc package
2020-10-17 10:45:27 +02:00
Github Actions 0e0d733e65 [CI Skip] release/beta 2.2.2-8
skip-checks: true
2020-10-16 20:06:14 +00:00
Mokhtar NaamaniandJaco Greeff 773618acfb Disable websocket outgoing message fragmentation for w3cwebsocket (#2738)
* Disable websocket outgoing message fragmentation for w3cwebsocket

* Message fragmentation with 256K fragment size

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

Co-authored-by: Jaco Greeff <jacogr@gmail.com>
2020-10-16 21:57:26 +02:00
Github Actions c5fcb0d06b [CI Skip] release/beta 2.2.2-7
skip-checks: true
2020-10-15 15:17:18 +00:00
Jaco Greeff e25272c986 Expose dispatch{Error, Info} on SubmittableResult (#2735)
* Expose dispatch{Error, Info} on SubmittableResult

* Cleanups

* De-dup
2020-10-15 17:07:14 +02:00
Jaco Greeff d389c6737e Cleanup README (& Call) (#2736) 2020-10-15 17:06:51 +02:00
Github Actions 9e1313f140 [CI Skip] release/beta 2.2.2-6
skip-checks: true
2020-10-15 07:32:02 +00:00
Jaco Greeff d2a2887d32 Add explicit normalizer test (#2730)
* Add explicit normalizer test

* More expansive

* nested
2020-10-15 09:22:04 +02:00
Github Actions b3d9549c0b [CI Skip] release/beta 2.2.2-5
skip-checks: true
2020-10-15 07:10:03 +00:00
Jaco Greeff 240cadd045 Bump deps (#2729) 2020-10-15 09:00:18 +02:00
Jaco Greeff d47faa4687 Fix memomization on BigInt values (#2728) 2020-10-15 08:59:48 +02:00
Github Actions 393c677a16 [CI Skip] release/beta 2.2.2-4
skip-checks: true
2020-10-14 23:40:43 +00:00
Jaco Greeff 074ddd8632 Add Polkadot update blocks for runtime 25 (#2725)
* Add Polkadot update blocks for runtime 25

* Update manual linting

* Bump deps
2020-10-15 01:32:04 +02:00
Jaco Greeff a8a10aec0c Manual testcase for Tuples (#2201)
* Manual testcase for Tuples

* Unused import

* Length check
2020-10-14 19:38:06 +02:00
Github Actions fed93e2459 [CI Skip] release/beta 2.2.2-3
skip-checks: true
2020-10-13 17:09:07 +00:00
Mark Robert Henderson 374df23011 Update warnings.ts to have the latest URLs (#2720)
Previously, 404s:

- https://polkadot.js.org/api/start/FAQ.html#i-cannot-send-transactions-from-my-node-template-based-chain
- https://polkadot.js.org/api/start/FAQ.html#using-a-non-current-master-node-i-have-issues-parsing-events

Changed to: 

- https://polkadot.js.org/docs/api/FAQ#i-cannot-send-transactions-from-my-node-template-based-chain
- https://polkadot.js.org/docs/api/FAQ#using-a-non-current-master-node-i-have-issues-parsing-events
2020-10-13 18:59:16 +02:00
Github Actions 9c098c3fbf [CI Skip] release/beta 2.2.2-2
skip-checks: true
2020-10-13 12:03:50 +00:00
Jaco Greeff 4e799858ad Cleanup type extraction overrides (#2719)
* Combine contract type get/init

* Cleanup type overrides
2020-10-13 13:54:14 +02:00
Github Actions ee6924324f [CI Skip] release/beta 2.2.2-1
skip-checks: true
2020-10-13 08:55:18 +00:00
Jaco Greeff 75f86bb43e Combine contract type get/init (#2718) 2020-10-13 10:44:50 +02:00
Github Actions bfd3113a55 [CI Skip] release/beta 2.2.2-0
skip-checks: true
2020-10-12 16:37:13 +00:00
Jaco Greeff 8d8d5bd7d7 Expose ABI messages on Contract/Blueprint (#2715)
* Expose ABI messages on Contract/Blueprint

* Rename actual files & exports

* Adjust .query signature (origin)

* Assert contracts.call
2020-10-12 18:27:47 +02:00
Github Actions e64b5483ba [CI Skip] release/stable 2.2.1
skip-checks: true
2020-10-12 14:11:29 +00:00
Jaco Greeff 6020ffcada 2.2 (#2713) 2020-10-12 16:01:52 +02:00
Jaco Greeff 1643ec7ddf Provide chain properties for contract registry (#2714) 2020-10-12 15:53:45 +02:00
Github Actions 76c206d60d [CI Skip] release/beta 2.1.2-23
skip-checks: true
2020-10-12 12:45:58 +00:00
Jaco Greeff 8a8b6f7ac8 s/contract/contracts/ on applyOnEvent (#2712)
* s/contract/contracts/ on applyOnEvent

* Expose result classes
2020-10-12 14:36:47 +02:00
Github Actions 3ba0b2e0d8 [CI Skip] release/beta 2.1.2-22
skip-checks: true
2020-10-12 11:31:50 +00:00
Jaco Greeff 1101826a05 Rename contract helpers (#2708)
* Rename contract helpers

* Allow Buffer input for code

* Parse json strings

* Revert #typeDefs

* Allow lookup on name

* constsitent string ids

* Read only via address

* Move .json

* Extract findMessage

* Naming
2020-10-12 13:21:52 +02:00
Github Actions fda1924577 [CI Skip] release/beta 2.1.2-21
skip-checks: true
2020-10-12 08:17:47 +00:00
Jaco Greeff 2b1438030b Add withResultTransform to Submittables (use in api-contracts) (#2707)
* Allow SubmittableResult transforms (use in contracts)

* withResultTransform
2020-10-12 10:07:45 +02:00
Github Actions d816859840 [CI Skip] release/beta 2.1.2-20
skip-checks: true
2020-10-11 16:59:36 +00:00
Jaco Greeff af0b4362c9 Expose instantiate on contract Blueprint (#2706)
* Expose instantiate on contract Blueprint

* Allow BigInt & string types

* CodecArg

* Selector

* Cleanup selectors

* Remove Bytes override
2020-10-11 18:51:21 +02:00
Github Actions 4cb563ba89 [CI Skip] release/beta 2.1.2-19
skip-checks: true
2020-10-11 11:58:01 +00:00
Jaco Greeff c098036ca5 ContractRegistry always has own registry instance (#2705)
* ContractRegistry always has own registry instance

* Hacky Bytes notation

* Revert Bytes (for now, keep it simple)

* Apply suggestions from code review

* Expand on found error
2020-10-11 13:49:41 +02:00
Github Actions c38afd4b5d [CI Skip] release/beta 2.1.2-18
skip-checks: true
2020-10-11 09:35:48 +00:00
Jaco Greeff 4b8634b88e Remove non-API specific contract call results (#2704) 2020-10-11 11:26:23 +02:00
Github Actions a1bab9edcf [CI Skip] release/beta 2.1.2-17
skip-checks: true
2020-10-11 07:46:26 +00:00
503286f7aa Update ink type spec for 3.0-rc1 (#2702)
* Updated ABI definitions & parsing

* Run type generation

* Definitions (should be ok-ish)

* Cleanup names

* Allow aliasses on structs (JSON parsing)

* Cleanup json mapping passing

* s/types/lookup/

* Parsing as per current output

* InkSelector

* MtRegistryIndex

* String lookup tests

* Remove serd ovverride comments (it works as-is)

* inkRegistry tests

* Extract primitive types

* s/ty/id/

* Start of parsing into types (actually to be TypeDef)

* Parsing

* stringify struct fields

* Small cleanups

* Add type index to project lookup

* Prefix with index

* Fix interface generation

* Latest contract metadata (#2118)

* Add new (provisional) incrementer contract metadata

* Update and regenerate type definitions

* WIP: generate new format scale-info types

* WIP: implementing variants

* Implement variants

* Fix up type resolution

* Fix registry spec tests

* Fix lints and some tests

* Fix inkTypes tests

* Fix some lints

* Make imports same line like original

* Comment out (temporarily) sanitize import to make CI pass

* Sanitize

* Remove indices

* Remove index

* api-contract rewrite

* lint

* cleanup

* latest

* latest

* fix definition

* fiz definitions

* rv ink storage

* Update packages/api-contract/src/base/Contract.ts

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

* fixes

* rv scripts

* restore api-contract

* reorder definitions, fix ink storage

* fixes

* def order

* fixes

* encodeTypeDef asRaw

* update ink typ spec

* latest built contracts

* compare files

* Apply suggestions from code review

Co-authored-by: Jaco Greeff <jacogr@gmail.com>
Co-authored-by: Andrew Jones <ascjones@gmail.com>
2020-10-11 09:37:39 +02:00
Github Actions 64e209783a [CI Skip] release/beta 2.1.2-16
skip-checks: true
2020-10-11 07:34:44 +00:00
Jaco Greeff 43791bcc71 Fix c-like enums type encoding (#2703)
* Fix c-like enums type encoding

* Update packages/api-contract/src/ContractRegistry.ts

* Update packages/types/src/codec/utils/encodeTypes.ts
2020-10-11 09:25:44 +02:00
Github Actions 5b42bc9a22 [CI Skip] release/beta 2.1.2-15
skip-checks: true
2020-10-10 12:34:29 +00:00
Jaco Greeff b65b2d7720 Adjust exec with SubmittableExtrinsic (#2701)
* Adjust exec with SubmittableExtrinsic

* inputData
2020-10-10 14:25:31 +02:00
Github Actions 6f99f0fc26 [CI Skip] release/beta 2.1.2-14
skip-checks: true
2020-10-10 11:04:32 +00:00
Jaco Greeff c6f4e64c1a Update ContractInfo struct (#2700) 2020-10-10 12:55:03 +02:00
Github Actions d963cdf5ae [CI Skip] release/beta 2.1.2-13
skip-checks: true
2020-10-09 16:43:26 +00:00
Jaco GreeffandAndrew Jones 453dd9e49a Updated ABI definitions & parsing (#1662)
* Updated ABI definitions & parsing

* Run type generation

* Definitions (should be ok-ish)

* Cleanup names

* Allow aliasses on structs (JSON parsing)

* Cleanup json mapping passing

* s/types/lookup/

* Parsing as per current output

* InkSelector

* MtRegistryIndex

* String lookup tests

* Remove serd ovverride comments (it works as-is)

* inkRegistry tests

* Extract primitive types

* s/ty/id/

* Start of parsing into types (actually to be TypeDef)

* Parsing

* stringify struct fields

* Small cleanups

* Add type index to project lookup

* Prefix with index

* Fix interface generation

* Latest contract metadata (#2118)

* Add new (provisional) incrementer contract metadata

* Update and regenerate type definitions

* WIP: generate new format scale-info types

* WIP: implementing variants

* Implement variants

* Fix up type resolution

* Fix registry spec tests

* Fix lints and some tests

* Fix inkTypes tests

* Fix some lints

* Make imports same line like original

* Comment out (temporarily) sanitize import to make CI pass

* Sanitize

* Remove indices

* Remove index

* Adjust ContractAbi interface (empty rpc)

* linting

* Pull in Andrew's changes

* Cleanups

* Some more cleanups

* Update with v3 contracts

* Adjust with actual types

* Regenerate

* Update ABI parsing (#2695)

* Adjust ABI code

* Cleanup

* Merge non-code

* Type naming

* Simplify Base

* Rename 1

* rename 2

* Rename 3

* Simplify

* Add index to AbiMessage

* Pass actual message or index for call

* Rename param

* Simplify

* Expose call & exec

* s/call/read/

* Cleanup asserts

* AccountId as per spec

* displayName is path

* Update definitions

* Flatten ABIType into TypeDef

* Rewrite

* Fix tests

* Updates

Co-authored-by: Andrew Jones <ascjones@gmail.com>
2020-10-09 18:33:31 +02:00
Github Actions 89e0548092 [CI Skip] release/beta 2.1.2-12
skip-checks: true
2020-10-09 14:48:20 +00:00
cd5a5da45c Definition ordering (#2699)
* Updated ABI definitions & parsing

* Run type generation

* Definitions (should be ok-ish)

* Cleanup names

* Allow aliasses on structs (JSON parsing)

* Cleanup json mapping passing

* s/types/lookup/

* Parsing as per current output

* InkSelector

* MtRegistryIndex

* String lookup tests

* Remove serd ovverride comments (it works as-is)

* inkRegistry tests

* Extract primitive types

* s/ty/id/

* Start of parsing into types (actually to be TypeDef)

* Parsing

* stringify struct fields

* Small cleanups

* Add type index to project lookup

* Prefix with index

* Fix interface generation

* Latest contract metadata (#2118)

* Add new (provisional) incrementer contract metadata

* Update and regenerate type definitions

* WIP: generate new format scale-info types

* WIP: implementing variants

* Implement variants

* Fix up type resolution

* Fix registry spec tests

* Fix lints and some tests

* Fix inkTypes tests

* Fix some lints

* Make imports same line like original

* Comment out (temporarily) sanitize import to make CI pass

* Sanitize

* Remove indices

* Remove index

* api-contract rewrite

* lint

* cleanup

* latest

* latest

* fix definition

* fiz definitions

* rv ink storage

* Update packages/api-contract/src/base/Contract.ts

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

* fixes

* rv scripts

* restore api-contract

* reorder definitions, fix ink storage

* fixes

* def order

* fixes

Co-authored-by: Jaco Greeff <jacogr@gmail.com>
Co-authored-by: Andrew Jones <ascjones@gmail.com>
2020-10-09 16:40:24 +02:00
Github Actions d7dc36c65b [CI Skip] release/beta 2.1.2-11
skip-checks: true
2020-10-09 14:16:27 +00:00
87985f1f1f Types for ink! 3.0 (#2693)
* Updated ABI definitions & parsing

* Run type generation

* Definitions (should be ok-ish)

* Cleanup names

* Allow aliasses on structs (JSON parsing)

* Cleanup json mapping passing

* s/types/lookup/

* Parsing as per current output

* InkSelector

* MtRegistryIndex

* String lookup tests

* Remove serd ovverride comments (it works as-is)

* inkRegistry tests

* Extract primitive types

* s/ty/id/

* Start of parsing into types (actually to be TypeDef)

* Parsing

* stringify struct fields

* Small cleanups

* Add type index to project lookup

* Prefix with index

* Fix interface generation

* Latest contract metadata (#2118)

* Add new (provisional) incrementer contract metadata

* Update and regenerate type definitions

* WIP: generate new format scale-info types

* WIP: implementing variants

* Implement variants

* Fix up type resolution

* Fix registry spec tests

* Fix lints and some tests

* Fix inkTypes tests

* Fix some lints

* Make imports same line like original

* Comment out (temporarily) sanitize import to make CI pass

* Sanitize

* Remove indices

* Remove index

* api-contract rewrite

* lint

* cleanup

* latest

* latest

* fix definition

* fiz definitions

* rv ink storage

* Update packages/api-contract/src/base/Contract.ts

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

* fixes

* rv scripts

* restore api-contract

* reorder definitions, fix ink storage

* fixes

Co-authored-by: Jaco Greeff <jacogr@gmail.com>
Co-authored-by: Andrew Jones <ascjones@gmail.com>
2020-10-09 16:07:08 +02:00
Github Actions e53c229ac5 [CI Skip] release/beta 2.1.2-10
skip-checks: true
2020-10-09 13:23:38 +00:00
Jaco Greeff 6a0063addd Flatten displayType & encodeType into encodeTypeDef (#2698)
* Flatten displayType & encodeType into encodeTypeDef

* Remove to-be-replaced MetaRegistry tests (hardcoded results)
2020-10-09 15:13:52 +02:00
Github Actions 3b1845f0a0 [CI Skip] release/beta 2.1.2-9
skip-checks: true
2020-10-09 11:27:49 +00:00
Jaco Greeff 10880cf038 Update Scheduler (#2696) 2020-10-09 13:19:09 +02:00
Github Actions 289782b3a0 [CI Skip] release/beta 2.1.2-8
skip-checks: true
2020-10-08 16:00:31 +00:00
Jaco Greeff c3b7302dce Support new contracts Schedule (#2582) 2020-10-08 17:51:47 +02:00
Github Actions a5800b196c [CI Skip] release/beta 2.1.2-7
skip-checks: true
2020-10-08 11:49:41 +00:00
Jaco Greeff 28da228479 Handle Struct decoding from snake_case (#2694)
* Handle Struct decoding from snake_case

* Update packages/types/src/codec/Struct.spec.ts
2020-10-08 13:40:31 +02:00
Github Actions adf3d15c86 [CI Skip] release/beta 2.1.2-6
skip-checks: true
2020-10-08 11:36:50 +00:00
Jaco Greeff 8b54a22914 Introduce OriginCaller (& apply to Scheduler) (#2692)
* Introduce OriginCaller (& apply to Scheduler)

* RawOrigin

* Create OriginCaller type dynamically

* Update packages/metadata/src/Metadata/v12/toLatest.ts
2020-10-08 13:27:50 +02:00
Github Actions 2faf68c4d2 [CI Skip] release/beta 2.1.2-5
skip-checks: true
2020-10-07 11:35:18 +00:00
Jaco Greeff 363654dfba Bump dev (#2690) 2020-10-07 13:25:18 +02:00
Github Actions 5c481d47bb [CI Skip] release/beta 2.1.2-4
skip-checks: true
2020-10-07 06:31:03 +00:00
Jaco Greeff ce00d167ee Update README.md (#2688) 2020-10-07 08:21:36 +02:00
Github Actions fa1be60880 [CI Skip] release/beta 2.1.2-3
skip-checks: true
2020-10-06 12:50:16 +00:00
Jaco Greeff a28ce768bd Update examples link 2020-10-06 14:40:11 +02:00
Github Actions 5bf71c46dd [CI Skip] release/beta 2.1.2-2
skip-checks: true
2020-10-06 12:00:17 +00:00
Jaco Greeff 344af018f9 Remove docs (moving to docs repo) (#2685)
* Remove docs (moving to docs repo)

* Remove token
2020-10-06 13:50:20 +02:00
Github Actions 8de85c3a6b [CI Skip] release/beta 2.1.2-1
skip-checks: true
2020-10-06 09:26:04 +00:00
Jaco Greeff 014fa123b9 Cleanup metadata doc generation (#2684)
* Cleanup metadata doc generation

* Remove tmp
2020-10-06 11:16:43 +02:00
Github Actions 6bb43d4cfa [CI Skip] release/beta 2.1.2-0
skip-checks: true
2020-10-05 11:04:20 +00:00
Jaco Greeff acb565d46e Allow null input on Text values (#2682)
* Allow `null` input on `Text` values

* Update test

* Add to decode section

* Revert result
2020-10-05 12:54:04 +02:00
926 changed files with 35534 additions and 38334 deletions
+14 -2
View File
@@ -1,7 +1,19 @@
25
26
1.4.2
1.6.2
1.11.2
1.12.2
1.17.2
1.31.2
1.31.2
2.8.2
3.2.2
3.2.3
3.3.2
3.6.2
3.6.3
3.6.4
3.7.2
3.7.3
3.9.2
3.9.3
3.10.2
-4
View File
@@ -1,4 +0,0 @@
// Copyright 2017-2020 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0
module.exports = require('./babel.config.js');
-5
View File
@@ -1,5 +0,0 @@
.eslintrc.js
**/build/*
**/coverage/*
**/node_modules/*
docs/examples/promise/90_typegen/*
+11 -4
View File
@@ -1,10 +1,19 @@
// Copyright 2017-2020 @polkadot/api authors & contributors
// Copyright 2017-2021 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0
const base = require('@polkadot/dev/config/eslint');
const base = require('@polkadot/dev/config/eslint.cjs');
module.exports = {
...base,
ignorePatterns: [
'.eslintrc.js',
'.github/**',
'.vscode/**',
'.yarn/**',
'**/build/*',
'**/coverage/*',
'**/node_modules/*'
],
parserOptions: {
...base.parserOptions,
project: [
@@ -15,8 +24,6 @@ module.exports = {
...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',
// this seems very broken atm, false positives
'@typescript-eslint/unbound-method': 'off'
}
+2 -2
View File
@@ -5,11 +5,11 @@ jobs:
pr:
strategy:
matrix:
step: ['lint', 'test', 'build', 'docs']
step: ['lint', 'test', 'build']
name: ${{ matrix.step }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: ${{ matrix.step }}
run: |
yarn install --immutable | grep -v 'YN0013'
+2 -3
View File
@@ -8,18 +8,17 @@ jobs:
master:
strategy:
matrix:
step: ['build:release', 'docs:release']
step: ['build:release']
name: ${{ matrix.step }}
if: "! startsWith(github.event.head_commit.message, '[CI Skip]') && github.repository == 'polkadot-js/api'"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
with:
token: ${{ secrets.GH_PAT }}
- name: ${{ matrix.step }}
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
GH_PAGES_SRC: build-docs
GH_PAT: ${{ secrets.GH_PAT }}
GH_RELEASE_GITHUB_API_TOKEN: ${{ secrets.GH_PAT }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
+1 -1
View File
@@ -1 +1 @@
10
12
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-55
View File
File diff suppressed because one or more lines are too long
+55
View File
File diff suppressed because one or more lines are too long
+1 -3
View File
@@ -9,7 +9,5 @@ plugins:
spec: "@yarnpkg/plugin-interactive-tools"
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: "@yarnpkg/plugin-version"
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"
yarnPath: .yarn/releases/yarn-2.2.2.cjs
yarnPath: .yarn/releases/yarn-2.4.0.cjs
+472
View File
@@ -1,5 +1,477 @@
# CHANGELOG
## 3.11.1 Feb 28, 2021
Upgrade priority: Low. Recommended for users wanting to keep updated with chain changes.
Contributed:
- Clean Websocket states on disconnects (Thanks to https://github.com/ianhe8x)
- Support for C-like indexed enums (Thanks to https://github.com/xlc)
Changes:
- Adjust council derives to cater for current-generation candidate mapping
- Allow for override of codec hasher (& output type)
- Adjust submittables to submit hex-encoded addresses to queries
- Adjust initialization to always retrieve tx version from Metadata only
- Update election types as per latest Substrate
- Add types for the new gilt module
- Upgrade to the latest Substrate metadata
- Adjust package detection to check for local monorepo dependencies
- Ensure that metadata `.toJSON()` does apply type aliasses
## 3.10.2 Feb 23, 2021
Upgrade priority: Medium. Recommended for users of chains where `MultiAddress` is in-use and blocks are decoded.
Changes:
- Fix decoding for `MultiAddress` enum where non-`AccountId` variable-lengths are provided as part of a stream
- Added known Polkadot 28 upgrade block
- Update for latest Substrate contracts `Schedule` types
## 3.10.1 Feb 22, 2021
Upgrade priority: Low.
Changes:
- Adjust ConsumedWeight types to align with Rust module code
- Check for connection status in subscription unsubscribe
- Adjust staking reward derives ordering for better performance
- Adapt detection imports to remove `.json` dependencies (Better behavior using Node.js with ESM)
## 3.9.3 Feb 16, 2021
Upgrade priority: Low. Recommended for parachain builders since it contains the updated parachain types.
Changes:
- Adjusted parachain `PersistedValidationData` structure
## 3.9.2 Feb 15, 2021
Upgrade priority: Low. Recommended for parachain builders since it contains the latest parachain types.
Contributed:
- Update README links (Thanks to https://github.com/wirednkod)
Changes:
- Added missing Culmulus `ParachainInherentData` & `MessageQueueChain` types
- Add alias for `system_unstable_networkState` RPC
## 3.9.1 Feb 14, 2021
Upgrade priority: Low.
- **Important** The `Result<T, E>` has been updated in the generation and the base types to follow the Rust version 100%. This means `{as, is}Error` is now available as `{as, is}Err` on the `Result` type. The older versions can still be used, but the `*Error` interfaces are now marked as deprecated.
Changes:
- Adjust `Result<T, E>` interface to be 100% compatible with the Rust version
- Add the `2028` upgrade to the known upgrades (optimizing certain `.at` queries)
- Adjust council derives to cater for latest Substrate & Polkadot
- Adjust Rococo know type definitions to cater for the latest update
- Update types for latest Polkadot/Substrate
- Add generic arguments for TypeScript users to `.entries/.keys` to deal with the key typings
## 3.8.1 Feb 7, 2021
Upgrade priority: Low. Recommended for users of the latest Substrate master, especially using contracts.
- **Important** The `api-contract` `Code` now supports deploying the code and a contract in on operation. This aligns with the latest Substrate where code cannot be uploaded with a contract. The `createBlueprint` is therefore deprecated, use `code.tx.<constructor>(...)` to deploy code. (Compatible with both old and new versions of Substrate)
Contributed:
- Add support for latest Frontier RPCs (Thanks to https://github.com/jnaviask)
- Fix user-supplied signed extensions type signature (Thanks to https://github.com/ntduan)
Changes:
- Expand `api-contract` to allow for `Code` to deploy contract alongside code. `createBlueprint` is now deprecated, replaced by `createContract` or the preferred `code.tx.<constructor>`, which uploads and deploys the code in one operation. This aligns with the current Substrate master contracts implementation.
- Allow for signed extensions to be supplied inside type bundles
- Ensure that the auto-connect state is checked on auto-connections (respecting disconnect)
- Added `CancelProxy` to `ProxyTypes on Polkadot, Kusama & Westend
- Updated to latest Substrate metadata
## 3.7.3 Feb 2, 2021
Changes:
- Added Polkadot upgrade block for runtime 27 (known checkpoint optimization)
## 3.7.2 Feb 2, 2021
Changes:
- Adjusted the `Keys` type for the 28 runtime on Kusama, Polkadot & Westend
## 3.7.1 Feb 1, 2021
Upgrade priority: Low. However recommended for current Substrate master, Polkadot and Rococo users and those wishing to support the upcoming Polkadot 28 runtime with the new `MultiAddress`.
- **Breaking change** As indicated in the 3.5.1 release notes, the `Address`/`LookupSource` defaults have now been adjusted for `MultiAddress`. If your chain does not use these types, explicitly add the correct `Address`/`LookupSource` types. This new extensible format is mean to cater for all address types into the future, removing a lot of discrepancies between chains.
Contributed:
- Extraction of the block author on Moonbeam (Thanks to https://github.com/joelamouche)
- Cleanup logs with HTTP providers, no subs (Thanks to https://github.com/Tbaut)
Changes:
- Allow `.slice` operator on the `Vec` type
- Apply `MultiAddress` as a default
- Adds support for the upcoming Polkadot 28 and Kusama 2028 runtimes
- Add checkpoint for Kusama 2027 upgrade
- Update all parachain types (as per latest Rococo)
- Correctly use relay blockNumber in parachain validation data
- remove information log for capabilities detection (creates confusion)
- Remove explicit references to `global`, use the `x-global` detection
- Remove explicit `module` in `package.json` (exports map available)
## 3.6.1 Jan 24, 2020
Upgrade priority: Medium if not already on at least 3.3.1. The next upgrade of Kusama/Polkadot requires it.
- **Breaking change** To support chains with multiple tokens, such as bridges, the `ChainProperties` type now returns an array of tokens and decimals (instead of singular values) in the `token{Decimals, Symbol}` getters. Additionally, this means that the `registry` interfaces has been changes, to `registry.chainDecimals: number[]` and `registry.chainTokens: string[]`. Where used the `[0]` index will return the first value if only interested in a single, for a straight conversion.
Changes:
- Allow for the detection of on-chain capabilities as available (e.g. `AccountData`, `ValidatorPrefs`)
- Cater for multiple tokens and decimals in the chain the chain `system.properties` (as per the chain specification)
- Add a `instances: { [key]: [module1, module2] }` definition in teh bundle types, allowing for multiple instances (e.g. Balances)
- Adjust the `api-derive` for balances to retrieve values via `instances` as well as across multiple modules
- Ensure all types are registered for all metadata typegen steps
- Add `rpc.payment.queryFeeDetails` RPC endpoint
- Update types & metadata to latest Substrate
- Move the `@polkadot/x-rxjs` package into the common repo
- Allow doc generation for errors/events (markdown outputs)
## 3.5.1 Jan 18, 2020
Upgrade priority: Low. Recommended for parachain developers.
- **Important** The default for Substrate on the Address types are `MultiAddress`. It is recommended that chains add explicit definitions for `Address` and `LookupSource` in their types, instead of relying on the API-defaults. A future update will swap the API defaults to align with Substrate.
- **Important** Like the above changes in Substrate, the `AccountInfo` structure has also changed. It is recommended that chain developers explicitly add `AccountInfo: 'AccountInfoWithRefCount'` for the version with `refCount` on and `AccountInfoWithProviders` for the latest Substrate version. As per the above, the API defaults will be changed to align with Substrate.
Contributed:
- Apply correct TypeScript type for `toBigInt()` (Thanks to https://github.com/ianhe8x)
- Expand type definitions for storage key tuples (Thanks to https://github.com/monitz87)
- Adjust bounty derive to cater for non-council chains (Thanks to https://github.com/ekowalsk)
Changes:
- Remove recursion in vector/struct U8a stream decoding
- Availability of staking made optional in session length calcs (era does require it)
- Updates to parachain types, ensuring it has coverage for all the latest
- Update all Rococo types to the latest (session keys, session reports, parachain indexes)
- Update known upgrade checkpoints fo WestEnd
- Add types of the lottery module in Substrate
- Add and extend types for the crowdloan module in Polkadot
- Adjust node-template to default to `MultiAddress` on specVersion >= 100
## 3.4.1 Jan 11, 2020
Upgrade priority: Low. Fixes for parachain types, `.entries()` (with no values) and `event.is(...)` checks, users of these interfaces will have benefit.
- **Breaking change** The `derive.chain.{getBlock, subscribeNewBlocks}` now return `SignedBlockExtended`, all with the actual extrinsics and events mapped. Users of the latter interface should take note.
Contributed:
- Fix `SessionKeys{6-9}` definitions (Thanks to https://github.com/icodezjb)
- Support `Vec<(a, b)>` in enums (Thanks to https://github.com/monitz87)
- Add motions to bounty derive (Thanks to https://github.com/ekowalsk)
Changes:
- `derive.chain.getBlock()` now maps events to extrinsics via `.extrinsics` getter
- Ensure dispatchInfo is extracted on failed extrinsics (`getBlock` derive)
- Allow specification of additional signed extrinsic via API options
- Add missing parachain types, `ParaGenesisArgs`
- Correct `EthTransaction` type (as per the correct cargo crate)
- Update with latest contract types for Substrate master
- Update alias mapping for asset palette (including Substrate starting defaults)
- Allow `.entries()` call where 0 keys are present
- Fix `.is` on events not checking the correct index
- Construction of `i*` types ow correctly checks for max positive/negative
## 3.3.1 Jan 4, 2021
Upgrade priority: Low. Recommended for users of frontier evm module with additional types.
Contributed:
- Expand bounty derives (Thanks to https://github.com/ekowalsk)
- Adjust known-types (Thanks to https://github.com/mikiquantum)
Changes:
- Parallelize the API-init RPC calls for faster overall startup
- Add `ExitReason` types for the frontier evm module
- Adjust checks for indexed/non-indexed module checks (metadata decoration)
- Apply module aliases on constants (aligning with events, extrinsics)
- Allow for use of `system.ss58Prefix` as exposed (current Substrate master)
- Correct use of api-contract `blockWeights.maxBlock` in estimation
- Build metadata docs & interfaces with section aliases
- Update to latest Substrate master metadata in tests
## 3.2.1 Dec 27, 2020
Upgrade priority: Low. Recommended for users of parachains.
Contributed:
- Adjust metadata `.asV12` type signature (Thanks to https://github.com/yjhmelody)
Changes:
- Add `api.{errors, events, query, tx}.<section>.<name>.is(...)`
- Remove support for staking pre Substrate 2.0
- Add all frontier types & RPCs
- Support `AccountInfo` with new provider/consumer refCount structure
- Additional Cumulus parachain types
- Consistently format number JSON based on bitLength
- Cleanup metadata -> api dependencies
- Update `@polkadot/util` to 5.2.1
## 3.1.1 Dec 20, 2020
Upgrade priority: Low. Recommended for users of parachains.
Contributed:
- Additional parachain types (Thanks to https://github.com/joelamouche)
- Support for multi queries with `HttpProvider` (Thanks to https://github.com/ianhe8x)
- Configurable error logging with `createTypeUnsafe` (Thanks to https://github.com/dvdplm)
Changes:
- Adjust core type creation, removing storage duplication
- Update parachain types to support Rococo v1
- Adjust bounties derive to cater for new Substrate namespaces (& move to bounties)
- Mark `detectPackage` as known side-effect
- Add `detectPackage` to `@polkadot/metadata` (a number of requests on this)
- Adjust x-rxjs wrapper to expose all methods, incl. Node.js esm fixes
- Update to latest Substrate static metadata
- Update `@polkadot/util` to 5.1.1
## 3.0.1 Dec 14, 2020
Upgrade priority: Low. Recommended for the next Kusama/Polkadot upgrades due to additional types and those following chains following Substrate master closely.
**Important** While this package contains no external interface changes, it now compiles and ships both cjs and esm modules. This means that modern bundlers will have more information for tree-shaking available. Additionally when using Node with `.mjs` extensions, the esm version imports will be used on recent Node versions. Adding an export map, as here, may have some impacts so a major semver bump is advised. There may be (small) dragons hiding in the dark corners...
Contributed:
- Injection of derives via typesBundle (Thanks to https://github.com/pr0fedt)
- Added derives for bounties (Thanks to https://github.com/krzysztof-jelski)
Changes:
- Build and expose both cjs and esm via exports map
- Inject RPC definitions for typesBundle, allowing per-spec configuration
- Added `query.<section>.<method>.sizeAt(hash, [...params])` for all storage
- Add new Substrate consumed Weight types
- Expand `SessionKeys<n>` definitions (up to 9)
- Cleanup circular `Type` <-> `Text` definitions
- Cleanup circular `Metadata` <-> `TypeRegistry` imports
- Update `@polkadot/util` to 5.0.1
## 2.10.1 Dec 7, 2020
Upgrade priority: Low. Recommended when following Substrate master and/or parachains development, contains the latest types for both.
- **Breaking change** If using the `staking.query` derive, you now need to pass flags as to which values to retrieve
Changes:
- Ensure that maximum era is limited to `consts.system.blockHashCount` (don't overflow on very low blocktimes)
- Apply current Polkadot master parachain types
- Apply current Substrate master asset types
- Add `system_{addLogFilter, resetLogFilter}` RPCs
- Adjust tests for latest Substrate metadata
- Adjust staking derives to be more performant (flags indicate which query values to retrieve)
- Add account derive to cater for the availability of identities
- Use `import type` in all cases
## 2.9.1 Nov 30, 2020
Upgrade priority: Low. No major changes when on at least 2.8.2. Users encouraged to upgrade to at least that patch.
- **Breaking change** The API will now not attempt to queue calls made while not connected and send on connection. Rather when making a call and the RPC node is not connected, an error will be thrown.
Contributed:
- Add typegen capability for custom RPCs (Thanks to https://github.com/holygits)
Changes:
- Remove rpc-core send queue, only allow sends while connected
- Adjust staking derive for `electedInfo` to contain details of current validators
- Extract identity-only derive from `accounts.info` for simpler reusability
- Add types for Substrate master node (to allow for consistent swapping to `MultiAddress`)
- Adjust `Bytes` with `.slice` to be consistent for `Uint8array` extensions (already released in 2.8.2 as a bugfix)
## 2.8.1 Nov 23, 2020
Upgrade priority: Low. Recommended if using Substrate master with new `MultiAddress`.
Contributed:
- Export `derive.chain.getBlock` (Thanks to https://github.com/lovesh)
Changes:
- Expand `MultiAddress` construction with multi type detection
- Rename `GenericLookupSource` to `IndicesLookupSource` (internal use)
- Cleanup list retrievals with `Raw` data results for undecodable entries
- Export actual version via `RegistryMetadata`
- Dedupe bn.js (one version shared between dependencies)
## 2.7.1 Nov 16, 2020
Upgrade priority: Medium. Recommended for users of Polkadot/Kusama and api-contract users.
Changes:
- Allow for `ExtrinsicSignature` overrides (defaults to `MultiSignature`)
- Update api-contract `Blueprint` to allow for optional salt (auto if not provided)
- Support for ink! `.contract` files (in addition to ABI `.json`)
- Fix contract event decoding with pass-through of raw `Bytes`
- Fix support for enum encoding in api-contract
- Support new contract `Schedule` type as per Substrate
- Update Kusama/Polkadot known upgrade blocks
- Adjust typegen generated `@polkadot/types` imports
- Adjust internal `@polkadot/types` imports/exports (overall bundle sizes)
## 2.6.1 Nov 9, 2020
Upgrade priority: Low. Should be done alongside an update to `@polkadot/util` to 4.0
Changes:
- Adjust auto-gas to contract RPC call to 5 * 10 ^ 12 (align with Rust)
- Adjust derive `AccountId` check to take Ethereum-compatible chains into account
- Fallback for chains with invalid council proposal data in derives
- Bump static v12 Metadata (tests) to latest Substrate version
- Bump `@polkadot/{util,util-crypto}` to 4.0 (optimized WASM layers)
## 2.5.1 Nov 2, 2020
Upgrade priority: Low. Recommended for `api-contract` developers.
- **Breaking change** Substrate changed the `ContractExecResult` from `api.rpc.contracts.call`. The API does have pass-through support for both old and new variants via the `Contract` interface, however it means the structure has changed to accommodate the new Substrate structure. Refer to the [docs for the latest interface](https://polkadot.js.org/docs/api-contract/start/contract.read) (including `isSuccess/isError` -> `isOk/isErr`, and the availability of the `gasConsumed`)
Contributed:
- Dedup similar types on generation (Thanks to https://github.com/monitz87)
Changes:
- `Contract` execution will now return contract events decoded in the result
- Add `.dryRun` on extrinsics (alongside `.paymentInfo` usage)
- Add `system_syncState` and `syncstate_genSyncSpec` RPCs
- Enhance error reporting, `Call` indicates explicit call as found
- Adjust internal metadata decoration and use as exposed from `@types/metadata`
- Expand Rococo known types to cater for v1 (specVersion 10)
- `registry.hash` now returns an `H256` object (as opposed to raw Uint8Array)
- Use utility logger in all relevant error messages (consistency in logging)
- Add `derive.council.proposal(<hash>)` for retrieval of a single (expanded) proposal
- Correctly and transparently format type generation types (allowing for nested variants)
## 2.4.1 Oct 26, 2020
Upgrade priority: Low. No breaking changes, however it does move `api-contract` forward with additional features.
Contributed:
- Add support for both `{i,u}256` types on contracts (Thanks to https://github.com/seanyoung)
Changes:
- Add `.keysAt` & `.entriesAt` to query maps at a specific blockHash
- Adjust ordering of type injection, any `types: { ... }` definitions not have precedence
- Correctly format Tuples in both RPC and const definitions as part of type generation
- Add node-template to known types (tracking inside API), remove warnings for the spec
- Add initial implementation for new Substrate `MultiAddress` type
- Add `api.derive.chain.subscribeNewBlocks` for full block retrievals
- Contracts identifiers to `.{exec, read}('name', ...)` now matches on both snake_case and camelCase (consistency)
- Cleanup contracts serialization for messages to allow both to and from
- Add deserialization of contract events against the ABI
- Adjust contracts metadata parsing to be future-proof with type retrievals
- Add tests for Solang into contracts, re-organize layout per type
## 2.3.1 Oct 19, 2020
Upgrade priority: Low. Recommended for `api-contract` developers and those using large messages via Node.js WS.
Contributed:
- Adjust frame size for Node.js WebSockets (Thanks to https://github.com/mnaamani)
- Update warnings to reflect new docs URLs (Thanks to https://github.com/aphelionz)
Changes:
- Expose `dispatch{Error, Info}` on all `.tx` results (less boilerplate on info checks)
- Add missing primitive types inside contracts type parsing
- Adjust api-contract to expose `Contract.{query, tx}.<message>` and `Blueprint.tx.<constructor>`
- Rework contracts registry to be generic to all scale-info definitions
- Allow for auto-max weight on contract read/exec (useful in estimation)
- Fix memoization where `BigInt` params are passed
## 2.2.1 Oct 12, 2020
Upgrade priority: Low.
- **Breaking change** `@polkadot/api-contract` now only supports ink! 3.0-rc1 and later formats. Users of ink! 2.1 are recommended to stay on an older version until upgraded.
Contributed:
- Add latest Ink! types (Thanks to https://github.com/ascjones & https://github.com/kwingram25)
- Add base for new contract metadata parsing (Thanks to https://github.com/ascjones & https://github.com/kwingram25)
Changes:
- Introduce `OriginCaller` type (& apply to scheduler types)
- Adjust `ContractInfo` type for latest Substrate (contracts)
- Adjust `Schedule` type for latest Substrate (contracts)
- Allow snake_case to be handled transparently in structs
- Full new api-contract developer interfaces (Code, Blueprint, Contract)
- Rework Abi & Abi Registry use & parse (based on contributed) for efficiency & non-global clobber
- Allow `null` input on `Text` values in addition to existing `undefined`
- Remove all documentation after move to https://github.com/polkadot-js/docs repo
- Adjust type encoding from TypeDef, s/encodeType/encodeTypeDef/
## 2.1.1 Oct 5, 2020
Upgrade priority: Low.
+3 -19
View File
@@ -7,13 +7,13 @@
# @polkadot/api
This library provides a clean wrapper around all the methods exposed by a Polkadot/Substrate network client and defines all the types exposed by a node. For complete documentation around the classes, interfaces and their use, visit the [documentation portal](https://polkadot.js.org/api/).
This library provides a clean wrapper around all the methods exposed by a Polkadot/Substrate network client and defines all the types exposed by a node. For complete documentation around the classes, interfaces and their use, visit the [documentation portal](https://polkadot.js.org/docs/api/).
If you are an existing user, please be sure to track the [CHANGELOG](CHANGELOG.md) and [UPGRADING](UPGRADING.md) guides when changing versions.
## 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://polkadot.js.org/docs/api/examples/promise/) for guides on how to use the API to make queries and submit transactions.
## overview
@@ -22,25 +22,9 @@ 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/substrate/rpc.html) exposed by a Polkadot network client
- [@polkadot/rpc-core](packages/rpc-core/) Wrapper around all [JSON-RPC methods](https://polkadot.js.org/docs/substrate/rpc) exposed by a Polkadot network client
- [@polkadot/rpc-provider](packages/rpc-provider/) Providers for connecting to nodes, including WebSockets and Http
Type definitions for interfaces as exposed by Polkadot & Substrate clients -
- [@polkadot/types](packages/types/) Codecs for all Polkadot and Substrate 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 get started -
1. Clone the repo locally, via `git clone https://github.com/polkadot-js/api <optional local path>`
2. Ensure that you have a recent version of Node.js, for development purposes [Node 10](https://nodejs.org/en/) is recommended.
3. Ensure that you have a recent version of Yarn, for development purposes [Yarn >=1.10.1](https://yarnpkg.com/docs/install) is required.
4. Install the dependencies by running `yarn`
5. Build the everything via `yarn run build`
6. You can also launch the API Docs, via `yarn vuepress dev docs`
7. Access the docs via [http://localhost:8080](http://localhost:8080)
+2 -2
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2020 @polkadot/api authors & contributors
// Copyright 2017-2021 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0
module.exports = require('@polkadot/dev/config/babel');
module.exports = require('@polkadot/dev/config/babel-config-cjs.cjs');
-25
View File
@@ -1,25 +0,0 @@
#!/usr/bin/env bash
# Copyright 2017-2020 @polkadot/api authors & contributors
# SPDX-License-Identifier: Apache-2.0
function copy_folder () {
SRC="packages/$1/build"
DST="../apps/node_modules/@polkadot/$1"
echo "** Copying $SRC to $DST"
rm -rf $DST
cp -r $SRC $DST
}
yarn polkadot-dev-build-ts
copy_folder "api"
copy_folder "api-contract"
copy_folder "api-derive"
copy_folder "metadata"
copy_folder "rpc-core"
copy_folder "rpc-provider"
copy_folder "types"
copy_folder "types-known"
copy_folder "typegen"
-25
View File
@@ -1,25 +0,0 @@
#!/usr/bin/env bash
# Copyright 2017-2020 @polkadot/api authors & contributors
# SPDX-License-Identifier: Apache-2.0
function copy_folder () {
SRC="packages/$1/build"
DST="../test/js-test/node_modules/@polkadot/$1"
echo "** Copying $SRC to $DST"
rm -rf $DST
cp -r $SRC $DST
}
yarn polkadot-dev-build-ts
copy_folder "api"
copy_folder "api-contract"
copy_folder "api-derive"
copy_folder "metadata"
copy_folder "rpc-core"
copy_folder "rpc-provider"
copy_folder "types"
copy_folder "types-known"
copy_folder "typegen"
-102
View File
@@ -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:
-107
View File
@@ -1,107 +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: true,
searchMaxSuggestions: 10,
sidebar: [
{
title: 'Getting started',
path: '/start/',
collapsable: false,
sidebarDepth: 0,
children: [
['start/install.md', 'Installation'],
['start/basics.md', 'Basics & Metadata'],
['start/create.md', 'Creating an instance'],
['start/api.consts.md', 'Runtime Constants'],
['start/api.query.md', 'State queries'],
['start/api.rpc.md', 'RPC calls'],
['start/api.query.subs.md', 'Query subscriptions'],
['start/api.query.multi.md', 'Multi queries'],
['start/api.query.other.md', 'Query extras'],
['start/api.tx.md', 'Transactions'],
['start/keyring.md', 'Keyring'],
['start/api.tx.subs.md', 'Transaction subscriptions'],
['start/api.tx.wrap.md', 'Complex transactions'],
['start/types.basics.md', 'Type basics'],
['start/types.extend.md', 'Extending types'],
['start/rpc.custom.md', 'Custom RPC'],
['start/types.create.md', 'Creating types'],
['start/typescript.md', 'TypeScript interfaces'],
['start/typescript.user.md', 'TypeScript user generated'],
['start/FAQ.md', 'FAQ']
]
},
{
title: 'Cookbook',
path: '/cookbook/',
collapsable: false,
sidebarDepth: 0,
children: [
['cookbook/blocks.md', 'Blocks'],
['cookbook/storage.md', 'Storage'],
['cookbook/tx.md', 'Transactions']
]
},
{
title: 'Examples (Promise API)',
path: '/examples/promise/',
collapsable: false,
sidebarDepth: 0,
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'],
['examples/promise/90_typegen/', 'TypeScript augmentation']
]
},
{
title: 'Substrate defaults',
path: '/substrate/',
collapsable: false,
sidebarDepth: 0,
children: [
['substrate/rpc.md', 'Substrate RPC'],
['substrate/constants.md', 'Constants'],
['substrate/storage.md', 'State storage'],
['substrate/extrinsics.md', 'Extrinsics'],
['substrate/events.md', 'System events'],
['substrate/errors.md', 'Errors']
]
},
['/api/', '@polkadot/api'],
['/types/', '@polkadot/types'],
'/CONTRIBUTING.md'
]
},
plugins: [
['@vuepress/search', {
searchMaxSuggestions: 10
}]
]
};
-12
View File
@@ -1,12 +0,0 @@
$accentColor = #fd8824
$textColor = #2c3e50
$borderColor = #eaecef
$codeBgColor = #282c34
$arrowBgColor = #ccc
.home .hero .description,
.home .feature h2,
.home .feature p {
color: $textColor
opacity: 0.75
}
+12
View File
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="initial-scale=0.5, maximum-scale=1">
<meta http-equiv="refresh" content="0;URL='https://polkadot.js.org/docs/api/'" />
<title>Redirecting to https://polkadot.js.org/docs/api/</title>
</head>
<body>
Redirecting to <a href="https://polkadot.js.org/docs/api/">https://polkadot.js.org/docs/api/</a>
</body>
</html>
-43
View File
@@ -1,43 +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-2020 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 Getting started & Examples
[Jump right in](/start/) and get an overview on using the API in your projects, from installation all the way through to making it do magic. Have things working and want tips? The [cookbook](/cookbook/) provides some tips and tricks. Getting started and want some full examples? [The ApiPromise examples](/examples/promise/) provide some basic examples.
:::
## 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).
-62
View File
@@ -1,62 +0,0 @@
## Getting started
- [Introduction](start/README.md)
- [Installation](start/install.md)
- [Basics](start/basics.md)
- [Creating](start/create.md)
- [Constant queries](start/api.consts.md)
- [State queries](start/api.query.md)
- [RPC queries](start/api.rpc.md)
- [State subscriptions](start/api.query.subs.md)
- [Multi state retrieval](start/api.query.multi.md)
- [State query utilities](start/api.query.other.md)
- [Transactions](start/api.tx.md)
- [Keyring](start/keyring.md)
- [Transaction subscriptions](start/api.tx.subs.md)
- [Complex transactions](start/api.tx.wrap.md)
- [Type basics](start/types.basics.md)
- [Type extension](start/types.extend.md)
- [TypeScript interfaces](start/typescript.md)
- [TypeScript user generated](start/typescript.user.md)
## 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
- [Substrate](substrate/README.md)
- [RPC](substrate/rpc.md)
- [Constants (runtime)](substrate/constants.md)
- [Chain state (runtime)](substrate/storage.md)
- [Extrinsics (runtime)](substrate/extrinsics.md)
- [Events (runtime)](substrate/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)
-19
View File
@@ -1,19 +0,0 @@
# Cookbook
The cookbook hosts small code snippets in a question-answer format. It does not walk you through the whole setup, like the [basic examples](../examples/), but rather aims to answer some questions around specific uses. It also does not replace the [getting started FAQ](../start/FAQ.md), rather this is focussed explicitly on code samples, instead of general trouble-shooting for common mishaps.
These questions are added as they do come up and the hope is that the snippets here is will be useful to others, instead of just the original person who asked on a specific use-case. As of today, it is only making a start and not fully comprehensive yet - check back early, check back often.
## Sections
The following cookbook sections are available -
- [Blocks](blocks.md) - Snippets around working with blocks and headers
- [Storage](storage.md) - Snippets for working with storage
- [Transactions](tx.md) - Snippets for working with transactions
... more to come.
## Contribute
And as always, if you have an addition to make, or a question to ask any [any PRs](https://github.com/polkadot-js/api/tree/master/docs) or [issues](https://github.com/polkadot-js/api/issues) are appreciated. The initial content was generate from exactly such questions, either in Riot chat or as submitted as issues.
-72
View File
@@ -1,72 +0,0 @@
# Blocks
The building blocks for each blockchain. As such there are a number of examples for working with blocks and headers, that could be useful.
## How do I retrieve the header/extrinsic hash from blocks?
A block hash refers to the hash over the header, the extrinsic hash refers to the hash of the encoded extrinsic. Since all objects returned by the API implements the `.hash => Hash` getter, we can simply use this to view the actual hash.
```js
// returns Hash
const blockHash = await this.api.rpc.chain.getBlockHash(blockNumber);
// returns SignedBlock
const signedBlock = await this.api.rpc.chain.getBlock(blockHash);
// the hash for the block, always via header (Hash -> toHex()) - will be
// the same as blockHash above (also available on any header retrieved,
// subscription or once-off)
console.log(signedBlock.header.hash.toHex());
// the hash for each extrinsic in the block
signedBlock.block.extrinsics.forEach((ex, index) => {
console.log(index, ex.hash.toHex());
});
```
## How do I extract the block author?
The block author is encoded inside the consensus logs for the block. To extract, you need to decode the log (which the API does do) and then map the index of the validator to the list of session validators. This extraction is however available on the api derive for new head subscriptions, which returns an extended header with the author populated (assuming that the digest logs are known).
```js
// subscribe to all new headers (with extended info)
api.derive.chain.subscribeNewHeads((header) => {
console.log(`#${header.number}: ${header.author}`);
});
```
For a single header only, the derives also contain a `getHeader`, which once again returns a header extended with the author -
```js
// retrieve the last header (hash optional)
const header = await api.derive.chain.getHeader();
console.log(`#${header.number}: ${header.author}`);
```
## How do I view block extrinsic information?
The transactions are included in a signed block as part of the extrinsics - some of these will be unsigned and generated by the block author and some of these may be submitted from external sources and be signed. (Some palettes do use unsigned transactions, so signed/unsigned is not an indication of origin). To retrieve the block and display the transaction information, we can do the following -
```js
// no blockHash is specified, so we retrieve the latest
const signedBlock = await this.api.rpc.chain.getBlock();
// the information for each of the contained extrinsics
signedBlock.block.extrinsics.forEach((ex, index) => {
// the extrinsics are decoded by the API, human-like view
console.log(index, ex.toHuman());
const { isSigned, meta, method: { args, method, section } } = ex;
// explicit display of name, args & documentation
console.log(`${section}.${method}(${args.map((a) => a.toString()).join(', ')})`);
console.log(meta.documentation.map((d) => d.toString()).join('\n'));
// signer/nonce info
if (isSigned) {
console.log(`signer=${ex.signer.toString()}, nonce=${ex.nonce.toString()}`);
}
});
```
In the above `.toHuman()` is used to format into a human-readable representation. You can inspect/extract specific fields from the decoded extrinsic as required, for instance `ex.method.section` would return the pallete that executed this transaction.
-55
View File
@@ -1,55 +0,0 @@
# Storage
Here you will find snippets for working with storage.
## How do I check for storage existence?
In the metadata, for each storage item a fallback is provided. This means that when an entry does not exist, the fallback (which is the default value for the type) will be provided. This means, that querying for a non-existent key (unless an option), will yield a value -
```js
// retrieve Option<StakingLedger>
const ledger = await api.query.staking.ledger('EoukLS2Rzh6dZvMQSkqFy4zGvqeo14ron28Ue3yopVc8e3Q');
// retrieve ValidatorPrefs (will yield the default value)
const prefs = await api.query.staking.validators('EoukLS2Rzh6dZvMQSkqFy4zGvqeo14ron28Ue3yopVc8e3Q');
console.log(ledger.isNone, ledger.isSome); // true, false
console.log(JSON.stringify(prefs.toHuman())); // {"commission":"0"}
```
In the second case, the non-existent prefs returns the default/fallback value for the storage item. So in this case we don't know if the value is set to 0 or unset. Existence can be checked by using the storage size, which would be zero if nothing is stored.
```js
// exists
const sizeY = await api.query.staking.validators.size('DB2mp5nNhbFN86J9hxoAog8JALMhDXgwvWMxrRMLNUFMEY4');
// non existent
const sizeN = await api.query.staking.validators.size('EoukLS2Rzh6dZvMQSkqFy4zGvqeo14ron28Ue3yopVc8e3Q');
console.log(sizeY.isZero(), sizeY.toNumber()); // false 4
console.log(sizeN.isZero(), sizeY.toNumber()); // true 0
```
## How do I use .entries()/.keys() on double maps?
As [explained elsewhere](../start/api.query.other.md#map-keys-entries) each map-type storage entry exposes the entries/keys helpers to retrieve the whole list. In the case of double maps, with the addition of a single argument, you can retrieve either all entries or a subset based on the first map key.
In both these cases, entries/keys operate the same way, `.entries()` retrieving `(StorageKey, Codec)[]` and `.keys()` retrieving `StorageKey[]`
```js
// Retrieves the entries for all slashes, in all eras (no arg)
const allEntries = await api.query.staking.nominatorSlashInEra.entries();
// nominatorSlashInEra(EraIndex, AccountId) for the types of the key args
allEntries.forEach(([{ args: [era, nominatorId] }, value]) => {
console.log(`${era}: ${nominatorId} slashed ${value.toHuman()}`);
});
```
While we can retrieve only the keys for a specific era, using a argument for the first part of the doublemap (as defined here, an `EraIndex`) -
```js
// Retrieves the keys for the slashed validators in era 652
const slashedKeys = await api.query.staking.nominatorSlashInEra.keys(652);
// key args still contains [EraIndex, AccountId] decoded
console.log(`slashed: ${slashedKeys.map(({ args: [era, nominatorId] }) => nominatorId)`);
```
-112
View File
@@ -1,112 +0,0 @@
# Transactions
A blockchain is no fun if you are not submitting transactions. Or at least if somebody is not submitting any. Here you will find some snippets for dealing with some common issues.
## How do I estimate the transaction fees?
In addition to the `signAndSend` helper on transactions, `.paymentInfo` (with the exact same parameters) are also exposed. Using the same sender, it applies a dummy signature to the transaction and then gets the fee estimation via RPC.
```js
// estimate the fees as RuntimeDispatchInfo, using the signer (either
// address or locked/unlocked keypair) (When overrides are applied, e.g
// nonce, the format would be `paymentInfo(sender, { nonce })`)
const info = await api.tx.balances
.transfer(recipient, 123)
.paymentInfo(sender);
// log relevant info, partialFee is Balance, estimated for current
console.log(`
class=${info.class.toString()},
weight=${info.weight.toString()},
partialFee=${info.partialFee.toHuman()}
`);
```
## How do I get the decoded enum for an ExtrinsicFailed event?
Assuming you are sending a tx via `.signAndSend`, the callback yields information around the tx pool status as well as any events when `isInBlock` or `isFinalized`. If an extrinsic fails via `system.ExtrinsicFailed` event, you can retrieve the error, if defined as an enum on a module.
```js
api.tx.balances
.transfer(recipient, 123)
.signAndSend(sender, ({ status, events }) => {
if (status.isInBlock || status.isFinalized) {
events
// find/filter for failed events
.filter(({ section, method }) =>
section === 'system' &&
method === 'ExtrinsicFailed'
)
// we know that data for system.ExtrinsicFailed is
// (DispatchError, DispatchInfo)
.forEach(({ data: [error, info] }) => {
if (error.isModule) {
// for module errors, we have the section indexed, lookup
const decoded = api.registry.findMetaError(error.asModule);
const { documentation, method, section } = decoded;
console.log(`${section}.${method}: ${documentation.join(' ')}`);
} else {
// Other, CannotLookup, BadOrigin, no extra info
console.log(error.toString());
}
});
}
});
```
## How do I send an unsigned extrinsic?
For most runtime modules, transactions need to be signed and validation for this happens node-side. There are however modules that accepts unsigned extrinsics, an example would be the Polkadot/Kusama token claims (which is here used as an example).
```js
// construct the transaction, exactly as per normal
const utx = api.tx.claims.claim(beneficiary, ethSignature);
// send it without calling sign, pass callback with status/events
tx.send(({ status }) => {
if (status.isInBlock) {
console.log(`included in ${status.asInBlock}`);
}
});
```
The signing is indicated by the first byte in the transaction, so in this case we have called `.send` on it (no `.sign` or `.signAndSend`), so it will be sent using the unsigned state, without signature attached.
## How can I batch transactions?
Polkadot/Substrate provides a `utility.batch` method that can be used to send a number of transactions at once. These are then executed from a single sender (single nonce specified) in sequence. This is very useful in a number of cases, for instance if you wish to create a payout for a validator for multiple eras, you can use this method. Likewise, you can send a number of transfers at once. Or even batch different types of transactions.
```js
// construct a list of transactions we want to batch
const txs = [
api.tx.balances.transfer(addrBob, 12345),
api.tx.balances.transfer(addrEve, 12345),
api.tx.staking.unbond(12345)
];
// construct the batch and send the transactions
api.tx.utility
.batch(txs)
.signAndSend(sender, ({ status }) => {
if (status.isInBlock) {
console.log(`included in ${status.asInBlock}`);
}
});
```
## How do I take the pending tx pool into account in my nonce?
The `system.account` query will always contain the current state, i.e. it will reflect the nonce for the last known block. As such when sending multiple transactions in quick succession (see batching above), there may be transactions in the pool that has the same nonce that `signAndSend` would apply - this call doesn't do any magic, it simply reads the state for the nonce. Since we can specify options to the `signAndSend` operation, we can override the nonce, either by manually incrementing it or querying it via `rpc.system.accountNextIndex`.
```js
for (let i = 0; i < 10; i++) {
// retrieve sender's next index/nonce, taking txs in the pool into account
const nonce = await api.rpc.system.accountNextIndex(sender);
// send, just retrieving the hash, not waiting on status
const txhash = await api.tx.balances
.transfer(recipient, 123)
.signAndSend(sender, { nonce });
}
```
-1
View File
@@ -1 +0,0 @@
yarn.lock
@@ -1,5 +0,0 @@
# Simple Connect
The following example shows how to instantiate a Polkadot API object and use it to connect to a node using ApiPromise.
<<< @/docs/examples/promise/01_simple_connect/index.js
@@ -1,25 +0,0 @@
/* eslint-disable header/header */
/* eslint-disable @typescript-eslint/require-await */
/* eslint-disable @typescript-eslint/unbound-method */
// Required imports
const { ApiPromise, WsProvider } = require('@polkadot/api');
async function main () {
// Initialise the provider to connect to the local node
const provider = new WsProvider('ws://127.0.0.1:9944');
// Create the API and wait until ready
const api = await ApiPromise.create({ provider });
// Retrieve the chain & node information information via rpc calls
const [chain, nodeName, nodeVersion] = await Promise.all([
api.rpc.system.chain(),
api.rpc.system.name(),
api.rpc.system.version()
]);
console.log(`You are connected to chain ${chain} using ${nodeName} v${nodeVersion}`);
}
main().catch(console.error).finally(() => process.exit());
@@ -1,19 +0,0 @@
{
"name": "01_simple_connect",
"version": "0.2.0",
"description": "Example showing how to connect using a WebSocket",
"main": "index.js",
"author": "chevdor",
"license": "MIT",
"scripts": {
"clean": "rimraf node_modules",
"start": "node index.js"
},
"dependencies": {
"@polkadot/api": "*"
},
"devDependencies": {
"rimraf": "^2.6.2"
}
}
@@ -1,8 +0,0 @@
# Listen to new blocks
This example shows how to subscribe to new blocks.
It displays the block number every time a new block is seen by the node you are connected to.
NOTE: The example runs until you stop it with CTRL+C
<<< @/docs/examples/promise/02_listen_to_blocks/index.js
@@ -1,30 +0,0 @@
/* eslint-disable header/header */
/* eslint-disable @typescript-eslint/require-await */
/* eslint-disable @typescript-eslint/unbound-method */
// Import the API
const { ApiPromise } = require('@polkadot/api');
async function main () {
// Here we don't pass the (optional) provider, connecting directly to the default
// node/port, i.e. `ws://127.0.0.1:9944`. Await for the isReady promise to ensure
// the API has connected to the node and completed the initialisation process
const api = await ApiPromise.create();
// 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.subscribeNewHeads((header) => {
console.log(`Chain is at block: #${header.number}`);
if (++count === 256) {
unsubscribe();
process.exit(0);
}
});
}
main().catch(console.error);
@@ -1,18 +0,0 @@
{
"name": "02_listen_to_blocks",
"version": "0.2.0",
"description": "Example showing how to use subscriptions",
"main": "index.js",
"author": "chevdor",
"license": "MIT",
"scripts": {
"clean": "rimraf node_modules",
"start": "node index.js"
},
"dependencies": {
"@polkadot/api": "*"
},
"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,39 +0,0 @@
/* eslint-disable header/header */
/* eslint-disable @typescript-eslint/require-await */
/* eslint-disable @typescript-eslint/unbound-method */
/* eslint-disable @typescript-eslint/no-floating-promises */
// Import the API
const { ApiPromise } = require('@polkadot/api');
// Known account we want to use (available on dev chain, with funds)
const Alice = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
async function main () {
// Create an await for the API
const api = await ApiPromise.create();
// Retrieve the initial balance. Since the call has no callback, it is simply a promise
// that resolves to the current on-chain value
let { data: { free: previousFree }, nonce: previousNonce } = await api.query.system.account(Alice);
console.log(`${Alice} has a balance of ${previousFree}, nonce ${previousNonce}`);
console.log(`You may leave this example running and start example 06 or transfer any value to ${Alice}`);
// Here we subscribe to any balance changes and update the on-screen value
api.query.system.account(Alice, ({ data: { free: currentFree }, nonce: currentNonce }) => {
// Calculate the delta
const change = currentFree.sub(previousFree);
// Only display positive value changes (Since we are pulling `previous` above already,
// the initial balance change will also be zero)
if (!change.isZero()) {
console.log(`New balance change of ${change}, nonce ${currentNonce}`);
previousFree = currentFree;
previousNonce = currentNonce;
}
});
}
main().catch(console.error);
@@ -1,18 +0,0 @@
{
"name": "03_listen_to_balance_change",
"version": "0.2.0",
"description": "Example showing how to subscribe to balance change",
"main": "index.js",
"author": "chevdor",
"license": "MIT",
"scripts": {
"clean": "rimraf node_modules",
"start": "node index.js"
},
"dependencies": {
"@polkadot/api": "*"
},
"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,25 +0,0 @@
/* eslint-disable header/header */
/* eslint-disable @typescript-eslint/require-await */
/* eslint-disable @typescript-eslint/unbound-method */
/* eslint-disable @typescript-eslint/no-floating-promises */
// 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.system.account.multi([ALICE, BOB], (balances) => {
console.log('Change detected, new balances: ', balances.map(({ data: { free } }) => free));
});
}
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,7 +0,0 @@
# Unsubscribe from listening to updates
This example shows how to subscribe to and later unsubscribe from listening to block updates.
In this example we're calling the built-in unsubscribe() function after a timeOut of 20s to cleanup and unsubscribe from listening to updates.
<<< @/docs/examples/promise/04_unsubscribe/index.js
@@ -1,25 +0,0 @@
/* eslint-disable header/header */
/* eslint-disable @typescript-eslint/require-await */
/* eslint-disable @typescript-eslint/unbound-method */
// Import the API
const { ApiPromise } = require('@polkadot/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.subscribeNewHeads((header) => {
console.log(`Chain is at block: #${header.number}`);
});
// In this example we're calling the unsubscribe() function that is being
// returned by the api call function after 20s.
setTimeout(() => {
unsubscribe();
console.log('Unsubscribed');
}, 20000);
}
main().catch(console.error);
@@ -1,18 +0,0 @@
{
"name": "04_unsubscribe",
"version": "0.2.0",
"description": "Example showing how to unsubscribe from a subscription",
"main": "index.js",
"author": "Stefie",
"license": "MIT",
"scripts": {
"clean": "rimraf node_modules",
"start": "node index.js"
},
"dependencies": {
"@polkadot/api": "*"
},
"devDependencies": {
"rimraf": "^2.6.2"
}
}
@@ -1,5 +0,0 @@
# Read storage
Many important variables are available through the storage API. This example shows how to call a few of those APIs.
<<< @/docs/examples/promise/05_read_storage/index.js
@@ -1,42 +0,0 @@
/* eslint-disable header/header */
/* eslint-disable @typescript-eslint/require-await */
/* eslint-disable @typescript-eslint/unbound-method */
// Import the API
const { ApiPromise } = require('@polkadot/api');
// Our address for Alice on the dev chain
const ALICE = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
async function main () {
// Create our API with a default connection to the local node
const api = await ApiPromise.create();
// Make our basic chain state/storage queries, all in one go
const [{ nonce: accountNonce }, now, validators] = await Promise.all([
api.query.system.account(ALICE),
api.query.timestamp.now(),
api.query.session.validators()
]);
console.log(`accountNonce(${ALICE}) ${accountNonce}`);
console.log(`last block timestamp ${now.toNumber()}`);
if (validators && validators.length > 0) {
// Retrieve the balances for all validators
const validatorBalances = await Promise.all(
validators.map((authorityId) =>
api.query.system.account(authorityId)
)
);
// Print out the authorityIds and balances of all validators
console.log('validators', validators.map((authorityId, index) => ({
address: authorityId.toString(),
balance: validatorBalances[index].data.free.toHuman(),
nonce: validatorBalances[index].nonce.toHuman()
})));
}
}
main().catch(console.error).finally(() => process.exit());
@@ -1,18 +0,0 @@
{
"name": "05_read_storage",
"version": "0.2.0",
"description": "Example showing how to query storage",
"main": "index.js",
"author": "chevdor",
"license": "MIT",
"scripts": {
"clean": "rimraf node_modules",
"start": "node index.js"
},
"dependencies": {
"@polkadot/api": "*"
},
"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/05_read_storage_at/index.js
@@ -1,33 +0,0 @@
/* eslint-disable header/header */
/* eslint-disable @typescript-eslint/require-await */
/* eslint-disable @typescript-eslint/unbound-method */
// 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.system.account.at(parentHash, ALICE);
console.log(`Alice's balance at ${parentHash.toHex()} was ${balance.data.free}`);
// Now perform a multi query, returning multiple balances at once
const balances = await api.query.system.account.multi([ALICE, BOB]);
console.log(`Current balances for Alice and Bob are ${balances[0].data.free} and ${balances[1].data.free}`);
}
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,5 +0,0 @@
# Make a simple transfer
This sample shows how to create a transaction to make a transfer from one an account to another.
<<< @/docs/examples/promise/06_make_transfer/index.js
@@ -1,30 +0,0 @@
/* eslint-disable header/header */
/* eslint-disable @typescript-eslint/require-await */
/* eslint-disable @typescript-eslint/unbound-method */
// Import the API, Keyring and some utility functions
const { ApiPromise } = require('@polkadot/api');
const { Keyring } = require('@polkadot/keyring');
const BOB = '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty';
async function main () {
// Instantiate the API
const api = await ApiPromise.create();
// Constuct the keying after the API (crypto has an async init)
const keyring = new Keyring({ type: 'sr25519' });
// Add Alice to our keyring with a hard-deived path (empty phrase, so uses dev)
const alice = keyring.addFromUri('//Alice');
// Create a extrinsic, transferring 12345 units to Bob
const transfer = api.tx.balances.transfer(BOB, 12345);
// Sign and send the transaction using our account
const hash = await transfer.signAndSend(alice);
console.log('Transfer sent with hash', hash.toHex());
}
main().catch(console.error).finally(() => process.exit());
@@ -1,18 +0,0 @@
{
"name": "06_make_transfer",
"version": "0.2.0",
"description": "Example showing how to make a transfer",
"main": "index.js",
"author": "chevdor",
"license": "MIT",
"scripts": {
"clean": "rimraf node_modules",
"start": "node index.js"
},
"dependencies": {
"@polkadot/api": "*"
},
"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,46 +0,0 @@
/* eslint-disable header/header */
/* eslint-disable @typescript-eslint/require-await */
/* eslint-disable @typescript-eslint/unbound-method */
// 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.account(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());
@@ -1,18 +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": "*"
},
"devDependencies": {
"rimraf": "^2.6.2"
}
}
@@ -1,5 +0,0 @@
# Traverse events
Query the system events and extract information from them. This example runs until exited via Ctrl-C
<<< @/docs/examples/promise/08_system_events/index.js
@@ -1,38 +0,0 @@
/* eslint-disable header/header */
/* eslint-disable @typescript-eslint/require-await */
/* eslint-disable @typescript-eslint/unbound-method */
/* eslint-disable @typescript-eslint/no-floating-promises */
// Import the API
const { ApiPromise } = require('@polkadot/api');
async function main () {
// Create our API with a default connection to the local node
const api = await ApiPromise.create();
// Subscribe to system events via storage
api.query.system.events((events) => {
console.log(`\nReceived ${events.length} events:`);
// Loop through the Vec<EventRecord>
events.forEach((record) => {
// Extract the phase, event and the event types
const { event, phase } = record;
const types = event.typeDef;
// Show what we are busy with
console.log(`\t${event.section}:${event.method}:: (phase=${phase.toString()})`);
console.log(`\t\t${event.meta.documentation.toString()}`);
// Loop through each of the parameters, displaying the type and data
event.data.forEach((data, index) => {
console.log(`\t\t\t${types[index].type}: ${data.toString()}`);
});
});
});
}
main().catch((error) => {
console.error(error);
process.exit(-1);
});
@@ -1,18 +0,0 @@
{
"name": "08_system_events",
"version": "0.1.0",
"description": "Example showing how to query and parse events",
"main": "index.js",
"author": "Jaco Greeff <jacogr@gmail.com>",
"license": "MIT",
"scripts": {
"clean": "rimraf node_modules",
"start": "node index.js"
},
"dependencies": {
"@polkadot/api": "*"
},
"devDependencies": {
"rimraf": "^2.6.2"
}
}
@@ -1,5 +0,0 @@
# Transfer events
Display the events that occur during a transfer by sending a value to a random account
<<< @/docs/examples/promise/09_transfer_events/index.js
@@ -1,60 +0,0 @@
/* eslint-disable header/header */
/* eslint-disable @typescript-eslint/require-await */
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable @typescript-eslint/no-floating-promises */
// Import the API & Provider and some utility functions
const { ApiPromise } = require('@polkadot/api');
// Import the test keyring (already has dev keys for Alice, Bob, Charlie, Eve & Ferdie)
const testKeyring = require('@polkadot/keyring/testing');
// Utility function for random values
const { randomAsU8a } = require('@polkadot/util-crypto');
// Some constants we are using in this sample
const ALICE = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
const AMOUNT = 10000;
async function main () {
// Create the API and wait until ready
const api = await ApiPromise.create();
// Create an instance of our testing keyring
// If you're using ES6 module imports instead of require, just change this line to:
// const keyring = testKeyring();
const keyring = testKeyring.default();
// Get the nonce for the admin key
const { nonce } = await api.query.system.account(ALICE);
// Find the actual keypair in the keyring
const alicePair = keyring.getPair(ALICE);
// Create a new random recipient
const recipient = keyring.addFromSeed(randomAsU8a(32)).address;
console.log('Sending', AMOUNT, 'from', alicePair.address, 'to', recipient, 'with nonce', nonce.toString());
// Do the transfer and track the actual status
api.tx.balances
.transfer(recipient, AMOUNT)
.signAndSend(alicePair, { nonce }, ({ events = [], status }) => {
console.log('Transaction status:', status.type);
if (status.isInBlock) {
console.log('Included at block hash', status.asInBlock.toHex());
console.log('Events:');
events.forEach(({ event: { data, method, section }, phase }) => {
console.log('\t', phase.toString(), `: ${section}.${method}`, data.toString());
});
} else if (status.isFinalized) {
console.log('Finalized block hash', status.asFinalized.toHex());
process.exit(0);
}
});
}
main().catch(console.error);
@@ -1,18 +0,0 @@
{
"name": "09_transfer_events",
"version": "0.1.0",
"description": "Example showing how to transfer DOTs (with events)",
"main": "index.js",
"author": "Jaco Greeff <jacogr@gmail.com>",
"license": "MIT",
"scripts": {
"clean": "rimraf node_modules",
"start": "node index.js"
},
"dependencies": {
"@polkadot/api": "*"
},
"devDependencies": {
"rimraf": "^2.6.2"
}
}
@@ -1,5 +0,0 @@
# Chain upgrade
Performs a chain upgrade using the `sudo` module. This may brick your chain, so use it as an educational sample. (use `substrate purge-chain --dev` to remove DB and recover).
<<< @/docs/examples/promise/10_upgrade_chain/index.js
@@ -1,62 +0,0 @@
/* eslint-disable header/header */
/* eslint-disable @typescript-eslint/require-await */
/* eslint-disable @typescript-eslint/unbound-method */
/* eslint-disable @typescript-eslint/no-floating-promises */
// Import the API & Provider and some utility functions
const { ApiPromise, WsProvider } = require('@polkadot/api');
// import the test keyring (already has dev keys for Alice, Bob, Charlie, Eve & Ferdie)
const testKeyring = require('@polkadot/keyring/testing');
const fs = require('fs');
async function main () {
// Initialise the provider to connect to the local node
const provider = new WsProvider('ws://127.0.0.1:9944');
// Create the API and wait until ready (optional provider passed through)
const api = await ApiPromise.create({ provider });
// Retrieve the upgrade key from the chain state
const adminId = await api.query.sudo.key();
// Find the actual keypair in the keyring (if this is a changed value, the key
// needs to be added to the keyring before - this assumes we have defaults, i.e.
// Alice as the key - and this already exists on the test keyring)
const keyring = testKeyring.default();
const adminPair = keyring.getPair(adminId.toString());
// Retrieve the runtime to upgrade
const code = fs.readFileSync('./test.wasm').toString('hex');
const proposal = api.tx.system && api.tx.system.setCode
? api.tx.system.setCode(`0x${code}`) // For newer versions of Substrate
: api.tx.consensus.setCode(`0x${code}`); // For previous versions
console.log(`Upgrading from ${adminId}, ${code.length / 2} bytes`);
// Perform the actual chain upgrade via the sudo module
api.tx.sudo
.sudo(proposal)
.signAndSend(adminPair, ({ events = [], status }) => {
console.log('Proposal status:', status.type);
if (status.isInBlock) {
console.error('You have just upgraded your chain');
console.log('Included at block hash', status.asInBlock.toHex());
console.log('Events:');
console.log(JSON.stringify(events.toHuman(), null, 2));
} else if (status.isFinalized) {
console.log('Finalized block hash', status.asFinalized.toHex());
process.exit(0);
}
});
}
main().catch((error) => {
console.error(error);
process.exit(-1);
});
@@ -1,18 +0,0 @@
{
"name": "10_upgrade_chain",
"version": "0.2.0",
"description": "Example showing how to upgrade via upgradeKey",
"main": "index.js",
"author": "Jaco Greeff <jacogr@gmail.com>",
"license": "MIT",
"scripts": {
"clean": "rimraf node_modules",
"start": "node index.js"
},
"dependencies": {
"@polkadot/api": "*"
},
"devDependencies": {
"rimraf": "^2.6.2"
}
}
Binary file not shown.
-248
View File
@@ -1,248 +0,0 @@
# typegen
This is a sample TypeScript project [with full source & config on GithHub](https://github.com/polkadot-js/api/tree/master/docs/examples/promise/90_typegen), that uses `@polkadot/typegen` to generate type definitions that can be used to decorate the `@polkadot/api`. It uses both types defined for the specific chain as well as the chain metadata to generate TypeScript interfaces. This means that interfaces such as `api.query.*`, `api.tx.*` and `api.consts.*` will be decorated based on chain-specific information, instead of an un-augmented catch-all definition.
**NOTE** This is built using the updates in the `1.4.0` api track and as such it uses the latest (at the time of writing) `@polkadot/api 1.4.0`. If you want to play on your own, it is also suggested that you use the `1.4+` series since some generation types have moved around internally, making it easier to augment.
## Packages
For the packages we need from the `@polkadot/*` we have added `@polkadot/api` (we want to do API stuff) and `@polkadot/typegen` (to generate the actual interfaces). So our scripts and dependencies inside `package.json` contain the following -
```json
{
"scripts": {
"build": "yarn generate:defs && yarn generate:meta",
"generate:defs": "ts-node --skip-project node_modules/.bin/polkadot-types-from-defs --package sample-polkadotjs-typegen/interfaces --input ./src/interfaces",
"generate:meta": "ts-node --skip-project node_modules/.bin/polkadot-types-from-chain --package sample-polkadotjs-typegen/interfaces --endpoint ./edgeware.json --output ./src/interfaces",
"lint": "tsc --noEmit --pretty"
},
"dependencies": {
"@polkadot/api": "^1.4.0"
},
"devDependencies": {
"@polkadot/typegen": "^1.4.0",
"ts-node": "^8.6.2",
"typescript": "^3.8.2"
}
}
```
We will delve into the setup and running the scripts and what they do in a short bit, but as of now just notice that we are running the scripts via `ts-node`. Since we supply our definitions as `*.ts` files, this is important otherwise they will not be parsable. `build` will just run both the types and meta generators (in that order, so metadata can use the types) and we have a `lint` that can just check that everything is as it is meant to be.
## Metadata setup
The idea here is to use the actual chain metadata to generate the actual api augmented endpoints. The metadata we are adding here (in addition to the user types), is from the Edgeware Berlin testnet. So this is a real-world example of configuring the API for a specific substrate chain. For the metadata retrieval, we just ran a simple curl command to get it from the node -
`curl -H "Content-Type: application/json" -d '{"id":"1", "jsonrpc":"2.0", "method": "state_getMetadata", "params":[]}' http://localhost:9933`
And then add the full JSONPC output as received to the `edgeware.json` file as specified by the generation command. A trimmed version would look like -
```json
{"jsonrpc":"2.0","result":"0x6d6574610b6c185379737....","id":29}
```
The generator can also use a `wss://` as an `--endpoint` param as part of the generation, but in most cases you would want a static metadata to work from in development, hence we are actually adding it here.
## Types setup
The types are defined in the `src/interfaces` folder. While this repo contains a number of generated files in there as well, you basically only need to manually add the following -
- `src/interfaces/definitions.ts` - this just exports all the sub-folder definitions in one go
- `src/interfaces/<module>/definitions.ts` - type definitions for a specific module
This structure fully matches what is available in the `@polkadot/type/interfaces` folder, so the structure is setup based on the convention used in the `@polkadot/types` library. The generating scripts will expect something matching this since the same underlying code is actually used inside `@polkadot/types` as well. The top-level `interfaces/` folder can be name anything, however the internal content structure need to match what is defined above.
For the top-level the definition file has the following contents -
```js
export { default as signaling } from './signaling/definitions';
export { default as treasuryRewards } from './treasuryRewards/definitions';
export { default as voting } from './voting/definitions';
```
As explained above, it really is just a re-export of the definitions, so they are all easily accessible to the outside, i.e. we will use this import inside our own code to use the definitions in API initialization. The generation scripts will load this file to determine which types it needs to import. By the `@polkadot/types` convention, match the export names with the folders (preferably your runtime module names), the generation scripts will use these names to find the correct folders to output the generated `types.ts` to.
For each of the folders, `signaling`, `treasuryRewards` and `voting` another `definitions.ts` file is contained within. Looking at the one from `signaling`, it contains this -
```js
export default {
types: {
ProposalRecord: {
index: 'u32',
author: 'AccountId',
stage: 'VoteStage',
transition_time: 'u32',
title: 'Text',
contents: 'Text',
vote_id: 'u64'
},
ProposalContents: 'Vec<u8>',
ProposalTitle: 'Vec<u8>'
}
}
```
Just the type definitions (the structure of which you should be familiar with), nested inside a `types: {...}` container. This allows us future extension points, i.e. there is some work to expose the custom RPC types alongside, so that would become another key on a per-module basis.
In the above, you will note that the `ProposalRecord` references a type for `voting`, i.e. `VoteStage`. The type generation and resolution will determine where the type comes from, and provide the required imports on generation.
Looking at the example in this repo, it also has `augment*`, `index.ts` and `types.ts` files in the interfaces folder. These are all generated, and will be re-generated when the generator is run - so all edits to these files will be lost. The only requirement for user-edits are the `definitions.ts` files.
## Generating
Now that both the metadata and types setup is completed, we just run the build command via `yarn build` and magically (assuming you didn't have the `augment*` and other generated files), these files will be added. When running this command, the console should display something like -
```
> yarn build
$ yarn generate:defs && yarn generate:meta
$ ts-node --skip-project \
node_modules/.bin/polkadot-types-from-defs \
--package sample-polkadotjs-typegen/interfaces \
--input ./src/interfaces
sample-polkadotjs-typegen/src/interfaces/types.ts
Generating
Extracting interfaces for signaling
...
Writing
sample-polkadotjs-typegen/src/interfaces/augment-types.ts
Generating
Writing
$ ts-node --skip-project \
node_modules/.bin/polkadot-types-from-chain \
--package sample-polkadotjs-typegen/interfaces \
--endpoint ./edgeware.json \
--output ./src/interfaces
Generating from metadata, 81,267 bytes
...
sample-polkadotjs-typegen/src/interfaces/augment-api.ts
Generating
Writing
✨ Done in 4.04s.
```
Now if we check the actual output against the source via `yarn lint`, we would see that valid output has been generated -
```
> yarn lint
$ tsc --noEmit --pretty
✨ Done in 2.28s.
```
## Peering at the output
We are ready to use all these generated types this after some TS config. If you take a look at the generated `src/signaling/types.ts`, you would see generated TS interfaces, such as -
```js
import { Struct } from '@polkadot/types/codec';
import { Bytes, Text, u32, u64 } from '@polkadot/types/primitive';
import { AccountId } from '@polkadot/types/interfaces/runtime';
import { VoteStage } from 'sample-polkadotjs-typegen/interfaces/voting';
/** @name ProposalContents */
export interface ProposalContents extends Bytes {}
/** @name ProposalRecord */
export interface ProposalRecord extends Struct {
readonly index: u32;
readonly author: AccountId;
readonly stage: VoteStage;
readonly transition_time: u32;
readonly title: Text;
readonly contents: Text;
readonly vote_id: u64;
}
/** @name ProposalTitle */
export interface ProposalTitle extends Bytes {}
```
As mentioned earlier, here you will notice the `import { VoteStage }`, the generator has determined that `voting` exports that interface and has added the required imports.
## TypeScript config
Now that we have files generated, it is time to make TypeScript aware of the types and add an explicit override into out `tsconfig.json`. After some changes, the paths in the config looks as follow (comments are in the actual config file here) -
```json
{
"compilerOptions": {
"paths": {
"sample-polkadotjs-typegen/*": ["src/*"],
"@polkadot/api/augment": ["src/interfaces/augment-api.ts"],
"@polkadot/types/augment": ["src/interfaces/augment-types.ts"]
}
}
}
```
Effectively what we do above is tell the TypeScript compiler to not use the built-in API augmentation, but rather to replace it with our version. This means that all types from these are injected not by the substrate-latest-master version, but rather with what we have defined above.
## Usage
For simple usage, we have added the `src/index.ts` file that show how the metadata and types actually decorate the API. In addition, we also have setup instructions included here.
```js
// We need to import the augmented definitions "somewhere" in our project, however since we have
// it in tsconfig as an override and the api/types has imports, it is not strictly required here.
// Because of the tsconfig override, we could import from '@polkadot/{api, types}/augment'
import './interfaces/augment-api';
import './interfaces/augment-types';
// all type stuff, the only one we are using here
import type { VoteRecord } from './interfaces';
// external imports
import { ApiPromise } from '@polkadot/api';
import { createType } from '@polkadot/types';
// our local stuff
import * as definitions from './interfaces/definitions';
async function main (): Promise<void> {
// extract all types from definitions - fast and dirty approach, flatted on 'types'
const types = Object.values(definitions).reduce((res, { types }): object => ({ ...res, ...types }), {});
const api = await ApiPromise.create({
types: {
...types,
// aliases that don't do well as part of interfaces
'voting::VoteType': 'VoteType',
'voting::TallyType': 'TallyType',
// chain-specific overrides
Keys: 'SessionKeys4'
}
});
// get a query
const recordOpt = await api.query.voting.voteRecords(123);
// the types match with what we expect here
let firstRecord: VoteRecord | null = recordOpt.unwrapOr(null);
console.log(firstRecord?.toHuman());
// it even does work for arrays & subscriptions
api.query.signaling.activeProposals((results): void => {
results.forEach(([hash, blockNumber]): void => {
console.log(hash.toHex(), ':', blockNumber.toNumber());
});
});
// even createType works, allowing for our types to be used
console.log(`Balance2 bitLength:`, [
api.createType('Balance2').bitLength(),
api.registry.createType('Balance2').bitLength(),
createType(api.registry, 'Balance2').bitLength()
]);
}
await main();
```
## And that is a ...
... wrap. Just a really simple walk-through to customizing the API TypeScript definitions for your chain.
File diff suppressed because one or more lines are too long
@@ -1,24 +0,0 @@
{
"name": "sample-polkadotjs-typegen",
"version": "0.0.1",
"description": "A sample using @polkadot/typegen to generate type definitions",
"main": "index.js",
"repository": "https://github.com/jacogr/sample-polkadotjs-typegen",
"author": "Jaco Greeff <jacogr@gmail.com>",
"license": "The Unlicense",
"private": true,
"scripts": {
"build": "yarn generate:defs && yarn generate:meta",
"generate:defs": "ts-node --skip-project node_modules/.bin/polkadot-types-from-defs --package sample-polkadotjs-typegen/interfaces --input ./src/interfaces",
"generate:meta": "ts-node --skip-project node_modules/.bin/polkadot-types-from-chain --package sample-polkadotjs-typegen/interfaces --endpoint ./edgeware.json --output ./src/interfaces --strict",
"lint": "tsc --noEmit --pretty"
},
"dependencies": {
"@polkadot/api": "^1.4.0"
},
"devDependencies": {
"@polkadot/typegen": "^1.4.0",
"ts-node": "^8.6.2",
"typescript": "^3.8.2"
}
}
@@ -1,54 +0,0 @@
// We need to import the augmented definitions "somewhere" in our project, however since we have
// it in tsconfig as an override and the api/types has imports, it is not strictly required here.
// Because of the tsconfig override, we could import from '@polkadot/{api, types}/augment'
import './interfaces/augment-api';
import './interfaces/augment-types';
// all type stuff, the only one we are using here
import type { VoteRecord } from './interfaces';
// external imports
import { ApiPromise } from '@polkadot/api';
import { createType } from '@polkadot/types';
// our local stuff
import * as definitions from './interfaces/definitions';
async function main (): Promise<void> {
// extract all types from definitions - fast and dirty approach, flatted on 'types'
const types = Object.values(definitions).reduce((res, { types }): object => ({ ...res, ...types }), {});
const api = await ApiPromise.create({
types: {
...types,
// aliasses that don't do well as part of interfaces
'voting::VoteType': 'VoteType',
'voting::TallyType': 'TallyType',
// chain-specific overrides
Keys: 'SessionKeys4'
}
});
// get a query
const recordOpt = await api.query.voting.voteRecords(123);
// the types match with what we expect here
let firstRecord: VoteRecord | null = recordOpt.unwrapOr(null);
console.log(firstRecord?.toHuman());
// it even does work for arrays & subscriptions
api.query.signaling.activeProposals((results): void => {
results.forEach(([hash, blockNumber]): void => {
console.log(hash.toHex(), ':', blockNumber.toNumber());
});
});
// even createType works, allowing for our types to be used
console.log(`Balance2 bitLength:`, [
api.createType('Balance2').bitLength(),
api.registry.createType('Balance2').bitLength(),
createType(api.registry, 'Balance2').bitLength()
]);
}
await main();
@@ -1,253 +0,0 @@
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit
/* eslint-disable @typescript-eslint/no-empty-interface */
import { Bytes, u32 } from '@polkadot/types/primitive';
import { Gas } from '@polkadot/types/interfaces/contracts';
import { Balance, BalanceOf, BlockNumber, Moment, Percent, Permill } from '@polkadot/types/interfaces/runtime';
import { SessionIndex } from '@polkadot/types/interfaces/session';
import { EraIndex } from '@polkadot/types/interfaces/staking';
declare module '@polkadot/metadata/Decorated/consts/types' {
export interface Constants {
timestamp: {
/**
* The minimum period between blocks. Beware that this is different to the *expected* period
* that the block production apparatus provides. Your chosen consensus system will generally
* work with this to determine a sensible block time. e.g. For Aura, it will be double this
* period on default settings.
**/
minimumPeriod: AugmentedConst<Moment>;
};
balances: {
/**
* The minimum amount required to keep an account open.
**/
existentialDeposit: AugmentedConst<Balance>;
/**
* The fee required to make a transfer.
**/
transferFee: AugmentedConst<Balance>;
/**
* The fee required to create an account.
**/
creationFee: AugmentedConst<Balance>;
};
transactionPayment: {
/**
* The fee to be paid for making a transaction; the base.
**/
transactionBaseFee: AugmentedConst<BalanceOf>;
/**
* The fee to be paid for making a transaction; the per-byte portion.
**/
transactionByteFee: AugmentedConst<BalanceOf>;
};
staking: {
/**
* Number of sessions per era.
**/
sessionsPerEra: AugmentedConst<SessionIndex>;
/**
* Number of eras that staked funds must remain bonded for.
**/
bondingDuration: AugmentedConst<EraIndex>;
};
session: {
/**
* Used as first key for `NextKeys` and `KeyOwner` to put all the data into the same branch
* of the trie.
**/
dedupKeyPrefix: AugmentedConst<Bytes>;
};
democracy: {
/**
* 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.
**/
enactmentPeriod: AugmentedConst<BlockNumber>;
/**
* How often (in blocks) new public referenda are launched.
**/
launchPeriod: AugmentedConst<BlockNumber>;
/**
* How often (in blocks) to check for new votes.
**/
votingPeriod: AugmentedConst<BlockNumber>;
/**
* The minimum amount to be used as a deposit for a public referendum proposal.
**/
minimumDeposit: AugmentedConst<BalanceOf>;
/**
* Minimum voting period allowed for an emergency referendum.
**/
emergencyVotingPeriod: AugmentedConst<BlockNumber>;
/**
* Period in blocks where an external proposal may not be re-submitted after being vetoed.
**/
cooloffPeriod: AugmentedConst<BlockNumber>;
/**
* The amount of balance that must be deposited per byte of preimage stored.
**/
preimageByteDeposit: AugmentedConst<BalanceOf>;
};
elections: {
candidacyBond: AugmentedConst<BalanceOf>;
votingBond: AugmentedConst<BalanceOf>;
desiredMembers: AugmentedConst<u32>;
desiredRunnersUp: AugmentedConst<u32>;
termDuration: AugmentedConst<BlockNumber>;
};
finalityTracker: {
/**
* The number of recent samples to keep from this chain. Default is 101.
**/
windowSize: AugmentedConst<BlockNumber>;
/**
* The delay after which point things become suspicious. Default is 1000.
**/
reportLatency: AugmentedConst<BlockNumber>;
};
treasury: {
/**
* 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.
**/
proposalBond: AugmentedConst<Permill>;
/**
* Minimum amount of funds that should be placed in a deposit for making a proposal.
**/
proposalBondMinimum: AugmentedConst<BalanceOf>;
/**
* Period between successive spends.
**/
spendPeriod: AugmentedConst<BlockNumber>;
/**
* Percentage of spare funds (if any) that are burnt per spend period.
**/
burn: AugmentedConst<Permill>;
/**
* The period for which a tip remains open after is has achieved threshold tippers.
**/
tipCountdown: AugmentedConst<BlockNumber>;
/**
* The amount of the final tip which goes to the original reporter of the tip.
**/
tipFindersFee: AugmentedConst<Percent>;
/**
* The amount held on deposit for placing a tip report.
**/
tipReportDepositBase: AugmentedConst<BalanceOf>;
/**
* The amount held on deposit per byte within the tip report reason.
**/
tipReportDepositPerByte: AugmentedConst<BalanceOf>;
};
contracts: {
/**
* 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
**/
signedClaimHandicap: AugmentedConst<BlockNumber>;
/**
* The minimum amount required to generate a tombstone.
**/
tombstoneDeposit: AugmentedConst<BalanceOf>;
/**
* Size of a contract at the time of instantiaion. This is a simple way to ensure that
* empty contracts eventually gets deleted.
**/
storageSizeOffset: AugmentedConst<u32>;
/**
* Price of a byte of storage per one block interval. Should be greater than 0.
**/
rentByteFee: AugmentedConst<BalanceOf>;
/**
* 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.
**/
rentDepositOffset: AugmentedConst<BalanceOf>;
/**
* Reward that is received by the party whose touch has led
* to removal of a contract.
**/
surchargeReward: AugmentedConst<BalanceOf>;
/**
* The fee required to make a transfer.
**/
transferFee: AugmentedConst<BalanceOf>;
/**
* The fee required to create an account.
**/
creationFee: AugmentedConst<BalanceOf>;
/**
* The fee to be paid for making a transaction; the base.
**/
transactionBaseFee: AugmentedConst<BalanceOf>;
/**
* The fee to be paid for making a transaction; the per-byte portion.
**/
transactionByteFee: AugmentedConst<BalanceOf>;
/**
* The fee required to instantiate a contract instance. A reasonable default value
* is 21.
**/
contractFee: AugmentedConst<BalanceOf>;
/**
* The base fee charged for calling into a contract. A reasonable default
* value is 135.
**/
callBaseFee: AugmentedConst<Gas>;
/**
* The base fee charged for instantiating a contract. A reasonable default value
* is 175.
**/
instantiateBaseFee: AugmentedConst<Gas>;
/**
* The maximum nesting level of a call/instantiate stack. A reasonable default
* value is 100.
**/
maxDepth: AugmentedConst<u32>;
/**
* The maximum size of a storage value in bytes. A reasonable default is 16 KiB.
**/
maxValueSize: AugmentedConst<u32>;
/**
* The maximum amount of gas that could be expended per block. A reasonable
* default value is 10_000_000.
**/
blockGasLimit: AugmentedConst<Gas>;
};
nicks: {
/**
* Reservation fee.
**/
reservationFee: AugmentedConst<BalanceOf>;
/**
* The minimum length a name may be.
**/
minLength: AugmentedConst<u32>;
/**
* The maximum length a name may be.
**/
maxLength: AugmentedConst<u32>;
};
}
}
@@ -1,706 +0,0 @@
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit
/* eslint-disable @typescript-eslint/no-empty-interface */
import { AnyNumber, ITuple } from '@polkadot/types/types';
import { Option, U8aFixed, Vec } from '@polkadot/types/codec';
import { Bytes, Data, bool, u32, u64 } from '@polkadot/types/primitive';
import { UncleEntryItem } from '@polkadot/types/interfaces/authorship';
import { BalanceLock, VestingSchedule } from '@polkadot/types/interfaces/balances';
import { ProposalIndex, Votes } from '@polkadot/types/interfaces/collective';
import { AuthorityId } from '@polkadot/types/interfaces/consensus';
import { CodeHash, ContractInfo, Gas, PrefabWasmModule, Schedule } from '@polkadot/types/interfaces/contracts';
import { Conviction, PropIndex, Proposal, ReferendumIndex, ReferendumInfo } from '@polkadot/types/interfaces/democracy';
import { Vote, VoteThreshold } from '@polkadot/types/interfaces/elections';
import { AuthorityList, SetId, StoredPendingChange, StoredState } from '@polkadot/types/interfaces/grandpa';
import { RegistrarInfo, Registration } from '@polkadot/types/interfaces/identity';
import { AuthIndex } from '@polkadot/types/interfaces/imOnline';
import { Kind, OffenceDetails, OpaqueTimeSlot, ReportIdOf } from '@polkadot/types/interfaces/offences';
import { AccountId, AccountIndex, Balance, BalanceOf, BlockNumber, Hash, Index, KeyTypeId, Moment, Perbill, ValidatorId, Weight } from '@polkadot/types/interfaces/runtime';
import { Keys, SessionIndex } from '@polkadot/types/interfaces/session';
import { ProposalRecord } from 'sample-polkadotjs-typegen/interfaces/signaling';
import { EraIndex, EraPoints, Exposure, Forcing, MomentOf, Nominations, RewardDestination, SlashingSpans, SpanIndex, SpanRecord, StakingLedger, UnappliedSlash, ValidatorPrefs } from '@polkadot/types/interfaces/staking';
import { DigestOf, EventIndex, EventRecord } from '@polkadot/types/interfaces/system';
import { OpenTip, TreasuryProposal } from '@polkadot/types/interfaces/treasury';
import { Multiplier } from '@polkadot/types/interfaces/txpayment';
import { Multisig } from '@polkadot/types/interfaces/utility';
import { VoteRecord } from 'sample-polkadotjs-typegen/interfaces/voting';
import { Observable } from 'rxjs';
import { ApiTypes } from '@polkadot/api/types';
declare module '@polkadot/api/types/storage' {
export interface AugmentedQueries<ApiType> {
system: {
/**
* Extrinsics nonce for accounts.
**/
accountNonce: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Index>>;
/**
* Total extrinsics count for the current block.
**/
extrinsicCount: AugmentedQuery<ApiType, () => Observable<Option<u32>>>;
/**
* Total weight for all extrinsics put together, for the current block.
**/
allExtrinsicsWeight: AugmentedQuery<ApiType, () => Observable<Option<Weight>>>;
/**
* Total length (in bytes) for all extrinsics put together, for the current block.
**/
allExtrinsicsLen: AugmentedQuery<ApiType, () => Observable<Option<u32>>>;
/**
* Map of block numbers to block hashes.
**/
blockHash: AugmentedQuery<ApiType, (arg: BlockNumber | AnyNumber | Uint8Array) => Observable<Hash>>;
/**
* Extrinsics data for the current block (maps an extrinsic's index to its data).
**/
extrinsicData: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Bytes>>;
/**
* The current block number being processed. Set by `execute_block`.
**/
number: AugmentedQuery<ApiType, () => Observable<BlockNumber>>;
/**
* Hash of the previous block.
**/
parentHash: AugmentedQuery<ApiType, () => Observable<Hash>>;
/**
* Extrinsics root of the current block, also part of the block header.
**/
extrinsicsRoot: AugmentedQuery<ApiType, () => Observable<Hash>>;
/**
* Digest of the current block, also part of the block header.
**/
digest: AugmentedQuery<ApiType, () => Observable<DigestOf>>;
/**
* Events deposited for the current block.
**/
events: AugmentedQuery<ApiType, () => Observable<Vec<EventRecord>>>;
/**
* The number of events in the `Events<T>` list.
**/
eventCount: AugmentedQuery<ApiType, () => Observable<EventIndex>>;
/**
* Mapping between a topic (represented by T::Hash) and a vector of indexes
* of events in the `<Events<T>>` list.
* 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.
**/
eventTopics: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<Vec<ITuple<[BlockNumber, EventIndex]>>>>;
};
utility: {
/**
* The set of open multisig operations.
**/
multisigs: AugmentedQueryDoubleMap<ApiType, (key1: AccountId | string | Uint8Array, key2: U8aFixed | string | Uint8Array) => Observable<Option<Multisig>>>;
};
timestamp: {
/**
* Current time for the current block.
**/
now: AugmentedQuery<ApiType, () => Observable<Moment>>;
/**
* Did the timestamp get updated in this block?
**/
didUpdate: AugmentedQuery<ApiType, () => Observable<bool>>;
};
authorship: {
/**
* Uncles
**/
uncles: AugmentedQuery<ApiType, () => Observable<Vec<UncleEntryItem>>>;
/**
* Author of current block.
**/
author: AugmentedQuery<ApiType, () => Observable<Option<AccountId>>>;
/**
* Whether uncles were already set in this block.
**/
didSetUncles: AugmentedQuery<ApiType, () => Observable<bool>>;
};
indices: {
/**
* The next free enumeration set.
**/
nextEnumSet: AugmentedQuery<ApiType, () => Observable<AccountIndex>>;
/**
* The enumeration sets.
**/
enumSet: AugmentedQuery<ApiType, (arg: AccountIndex | AnyNumber | Uint8Array) => Observable<Vec<AccountId>>>;
};
balances: {
/**
* The total units issued in the system.
**/
totalIssuance: AugmentedQuery<ApiType, () => Observable<Balance>>;
/**
* Information regarding the vesting of a given account.
**/
vesting: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<VestingSchedule>>>;
/**
* 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.
* `frame_system::AccountNonce` is also deleted if `ReservedBalance` is also zero (it also gets
* collapsed to zero if it ever becomes less than `ExistentialDeposit`.
**/
freeBalance: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Balance>>;
/**
* The amount of the balance of a given account that is externally reserved; this can still get
* slashed, but gets slashed last of all.
* This balance is a 'reserve' balance that other subsystems use in order to set aside tokens
* that are still 'owned' by the account holder, but which are suspendable.
* When this balance falls below the value of `ExistentialDeposit`, then this 'reserve account'
* is deleted: specifically, `ReservedBalance`.
* `frame_system::AccountNonce` is also deleted if `FreeBalance` is also zero (it also gets
* collapsed to zero if it ever becomes less than `ExistentialDeposit`.)
**/
reservedBalance: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Balance>>;
/**
* Any liquidity locks on some account balances.
**/
locks: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Vec<BalanceLock>>>;
};
transactionPayment: {
nextFeeMultiplier: AugmentedQuery<ApiType, () => Observable<Multiplier>>;
};
staking: {
/**
* The ideal number of staking participants.
**/
validatorCount: AugmentedQuery<ApiType, () => Observable<u32>>;
/**
* Minimum number of staking participants before emergency conditions are imposed.
**/
minimumValidatorCount: AugmentedQuery<ApiType, () => Observable<u32>>;
/**
* 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.
**/
invulnerables: AugmentedQuery<ApiType, () => Observable<Vec<AccountId>>>;
/**
* Map from all locked "stash" accounts to the controller account.
**/
bonded: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<AccountId>>>;
/**
* Map from all (unlocked) "controller" accounts to the info regarding the staking.
**/
ledger: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<StakingLedger>>>;
/**
* Where the reward payment should be made. Keyed by stash.
**/
payee: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<RewardDestination>>;
/**
* The map from (wannabe) validator stash key to the preferences of that validator.
**/
validators: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<ValidatorPrefs>>;
/**
* The map from nominator stash key to the set of stash keys of all validators to nominate.
* NOTE: is private so that we can ensure upgraded before all typical accesses.
* Direct storage APIs can still bypass this protection.
**/
nominators: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<Nominations>>>;
/**
* 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.
**/
stakers: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Exposure>>;
/**
* The currently elected validator set keyed by stash account ID.
**/
currentElected: AugmentedQuery<ApiType, () => Observable<Vec<AccountId>>>;
/**
* The current era index.
**/
currentEra: AugmentedQuery<ApiType, () => Observable<EraIndex>>;
/**
* The start of the current era.
**/
currentEraStart: AugmentedQuery<ApiType, () => Observable<MomentOf>>;
/**
* The session index at which the current era started.
**/
currentEraStartSessionIndex: AugmentedQuery<ApiType, () => Observable<SessionIndex>>;
/**
* Rewards for the current era. Using indices of current elected set.
**/
currentEraPointsEarned: AugmentedQuery<ApiType, () => Observable<EraPoints>>;
/**
* The amount of balance actively at stake for each validator slot, currently.
* This is used to derive rewards and punishments.
**/
slotStake: AugmentedQuery<ApiType, () => Observable<BalanceOf>>;
/**
* True if the next session change will be a new era regardless of index.
**/
forceEra: AugmentedQuery<ApiType, () => Observable<Forcing>>;
/**
* The percentage of the slash that is distributed to reporters.
* The rest of the slashed value is handled by the `Slash`.
**/
slashRewardFraction: AugmentedQuery<ApiType, () => Observable<Perbill>>;
/**
* The amount of currency given to reporters of a slash event which was
* canceled by extraordinary circumstances (e.g. governance).
**/
canceledSlashPayout: AugmentedQuery<ApiType, () => Observable<BalanceOf>>;
/**
* All unapplied slashes that are queued for later.
**/
unappliedSlashes: AugmentedQuery<ApiType, (arg: EraIndex | AnyNumber | Uint8Array) => Observable<Vec<UnappliedSlash>>>;
/**
* A mapping from still-bonded eras to the first session index of that era.
**/
bondedEras: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[EraIndex, SessionIndex]>>>>;
/**
* All slashing events on validators, mapped by era to the highest slash proportion
* and slash value of the era.
**/
validatorSlashInEra: AugmentedQueryDoubleMap<ApiType, (key1: EraIndex | AnyNumber | Uint8Array, key2: AccountId | string | Uint8Array) => Observable<Option<ITuple<[Perbill, BalanceOf]>>>>;
/**
* All slashing events on nominators, mapped by era to the highest slash value of the era.
**/
nominatorSlashInEra: AugmentedQueryDoubleMap<ApiType, (key1: EraIndex | AnyNumber | Uint8Array, key2: AccountId | string | Uint8Array) => Observable<Option<BalanceOf>>>;
/**
* Slashing spans for stash accounts.
**/
slashingSpans: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<SlashingSpans>>>;
/**
* Records information about the maximum slash of a stash within a slashing span,
* as well as how much reward has been paid out.
**/
spanSlash: AugmentedQuery<ApiType, (arg: ITuple<[AccountId, SpanIndex]> | [AccountId | string | Uint8Array, SpanIndex | AnyNumber | Uint8Array]) => Observable<SpanRecord>>;
/**
* The earliest era for which we have a pending, unapplied slash.
**/
earliestUnappliedSlash: AugmentedQuery<ApiType, () => Observable<Option<EraIndex>>>;
/**
* The version of storage for upgrade.
**/
storageVersion: AugmentedQuery<ApiType, () => Observable<u32>>;
};
session: {
/**
* The current set of validators.
**/
validators: AugmentedQuery<ApiType, () => Observable<Vec<ValidatorId>>>;
/**
* Current index of the session.
**/
currentIndex: AugmentedQuery<ApiType, () => Observable<SessionIndex>>;
/**
* True if the underlying economic identities or weighting behind the validators
* has changed in the queued validator set.
**/
queuedChanged: AugmentedQuery<ApiType, () => Observable<bool>>;
/**
* The queued keys for the next session. When the next session begins, these keys
* will be used to determine the validator's session keys.
**/
queuedKeys: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[ValidatorId, Keys]>>>>;
/**
* Indices of disabled validators.
* The set is cleared when `on_session_ending` returns a new set of identities.
**/
disabledValidators: AugmentedQuery<ApiType, () => Observable<Vec<u32>>>;
/**
* 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.
**/
nextKeys: AugmentedQueryDoubleMap<ApiType, (key1: Bytes | string | Uint8Array, key2: ValidatorId | string | Uint8Array) => Observable<Option<Keys>>>;
/**
* 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.
**/
keyOwner: AugmentedQueryDoubleMap<ApiType, (key1: Bytes | string | Uint8Array, key2: ITuple<[KeyTypeId, Bytes]> | [KeyTypeId | AnyNumber | Uint8Array, Bytes | string | Uint8Array]) => Observable<Option<ValidatorId>>>;
};
democracy: {
/**
* The number of (public) proposals that have been made so far.
**/
publicPropCount: AugmentedQuery<ApiType, () => Observable<PropIndex>>;
/**
* The public proposals. Unsorted. The second item is the proposal's hash.
**/
publicProps: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[PropIndex, Hash, AccountId]>>>>;
/**
* Map of hashes to the proposal preimage, along with who registered it and their deposit.
* The block number is the block at which it was deposited.
**/
preimages: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<Option<ITuple<[Bytes, AccountId, BalanceOf, BlockNumber]>>>>;
/**
* Those who have locked a deposit.
**/
depositOf: AugmentedQuery<ApiType, (arg: PropIndex | AnyNumber | Uint8Array) => Observable<Option<ITuple<[BalanceOf, Vec<AccountId>]>>>>;
/**
* The next free referendum index, aka the number of referenda started so far.
**/
referendumCount: AugmentedQuery<ApiType, () => Observable<ReferendumIndex>>;
/**
* The lowest referendum index representing an unbaked referendum. Equal to
* `ReferendumCount` if there isn't a unbaked referendum.
**/
lowestUnbaked: AugmentedQuery<ApiType, () => Observable<ReferendumIndex>>;
/**
* Information concerning any given referendum.
**/
referendumInfoOf: AugmentedQuery<ApiType, (arg: ReferendumIndex | AnyNumber | Uint8Array) => Observable<Option<ReferendumInfo>>>;
/**
* Queue of successful referenda to be dispatched. Stored ordered by block number.
**/
dispatchQueue: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[BlockNumber, Hash, ReferendumIndex]>>>>;
/**
* Get the voters for the current proposal.
**/
votersFor: AugmentedQuery<ApiType, (arg: ReferendumIndex | AnyNumber | Uint8Array) => Observable<Vec<AccountId>>>;
/**
* 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.
**/
voteOf: AugmentedQuery<ApiType, (arg: ITuple<[ReferendumIndex, AccountId]> | [ReferendumIndex | AnyNumber | Uint8Array, AccountId | string | Uint8Array]) => Observable<Vote>>;
/**
* Who is able to vote for whom. Value is the fund-holding account, key is the
* vote-transaction-sending account.
**/
proxy: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<AccountId>>>;
/**
* Get the account (and lock periods) to which another account is delegating vote.
**/
delegations: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<ITuple<[AccountId, Conviction]>>>;
/**
* True if the last referendum tabled was submitted externally. False if it was a public
* proposal.
**/
lastTabledWasExternal: AugmentedQuery<ApiType, () => Observable<bool>>;
/**
* 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.
**/
nextExternal: AugmentedQuery<ApiType, () => Observable<Option<ITuple<[Hash, VoteThreshold]>>>>;
/**
* 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.
**/
blacklist: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<Option<ITuple<[BlockNumber, Vec<AccountId>]>>>>;
/**
* Record of all proposals that have been subject to emergency cancellation.
**/
cancellations: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<bool>>;
};
council: {
/**
* The hashes of the active proposals.
**/
proposals: AugmentedQuery<ApiType, () => Observable<Vec<Hash>>>;
/**
* Actual proposal for a given hash, if it's current.
**/
proposalOf: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<Option<Proposal>>>;
/**
* Votes on a given proposal, if it is ongoing.
**/
voting: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<Option<Votes>>>;
/**
* Proposals so far.
**/
proposalCount: AugmentedQuery<ApiType, () => Observable<u32>>;
/**
* The current members of the collective. This is stored sorted (just by value).
**/
members: AugmentedQuery<ApiType, () => Observable<Vec<AccountId>>>;
};
elections: {
/**
* The current elected membership. Sorted based on account id.
**/
members: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[AccountId, BalanceOf]>>>>;
/**
* The current runners_up. Sorted based on low to high merit (worse to best runner).
**/
runnersUp: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[AccountId, BalanceOf]>>>>;
/**
* The total number of vote rounds that have happened, excluding the upcoming one.
**/
electionRounds: AugmentedQuery<ApiType, () => Observable<u32>>;
/**
* Votes of a particular voter, with the round index of the votes.
**/
votesOf: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Vec<AccountId>>>;
/**
* Locked stake of a voter.
**/
stakeOf: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<BalanceOf>>;
/**
* The present candidate list. Sorted based on account-id. A current member or a runner can
* never enter this vector and is always implicitly assumed to be a candidate.
**/
candidates: AugmentedQuery<ApiType, () => Observable<Vec<AccountId>>>;
};
grandpa: {
/**
* DEPRECATED
* This used to store the current authority set, which has been migrated to the well-known
* GRANDPA_AUTHORITES_KEY unhashed key.
**/
authorities: AugmentedQuery<ApiType, () => Observable<AuthorityList>>;
/**
* State of the current authority set.
**/
state: AugmentedQuery<ApiType, () => Observable<StoredState>>;
/**
* Pending change: (signaled at, scheduled change).
**/
pendingChange: AugmentedQuery<ApiType, () => Observable<Option<StoredPendingChange>>>;
/**
* next block number where we can force a change.
**/
nextForced: AugmentedQuery<ApiType, () => Observable<Option<BlockNumber>>>;
/**
* `true` if we are currently stalled.
**/
stalled: AugmentedQuery<ApiType, () => Observable<Option<ITuple<[BlockNumber, BlockNumber]>>>>;
/**
* The number of changes (both in terms of keys and underlying economic responsibilities)
* in the "set" of Grandpa validators from genesis.
**/
currentSetId: AugmentedQuery<ApiType, () => Observable<SetId>>;
/**
* A mapping from grandpa set ID to the index of the *most recent* session for which its members were responsible.
**/
setIdSession: AugmentedQuery<ApiType, (arg: SetId | AnyNumber | Uint8Array) => Observable<Option<SessionIndex>>>;
};
treasury: {
/**
* Number of proposals that have been made.
**/
proposalCount: AugmentedQuery<ApiType, () => Observable<ProposalIndex>>;
/**
* Proposals that have been made.
**/
proposals: AugmentedQuery<ApiType, (arg: ProposalIndex | AnyNumber | Uint8Array) => Observable<Option<TreasuryProposal>>>;
/**
* Proposal indices that have been approved but not yet awarded.
**/
approvals: AugmentedQuery<ApiType, () => Observable<Vec<ProposalIndex>>>;
/**
* Tips that are not yet completed. Keyed by the hash of `(reason, who)` from the value.
* This has the insecure enumerable hash function since the key itself is already
* guaranteed to be a secure hash.
**/
tips: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<Option<OpenTip>>>;
/**
* Simple preimage lookup from the reason's hash to the original data. Again, has an
* insecure enumerable hash since the key is guaranteed to be the result of a secure hash.
**/
reasons: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<Option<Bytes>>>;
};
contracts: {
/**
* Gas spent so far in this block.
**/
gasSpent: AugmentedQuery<ApiType, () => Observable<Gas>>;
/**
* Current cost schedule for contracts.
**/
currentSchedule: AugmentedQuery<ApiType, () => Observable<Schedule>>;
/**
* A mapping from an original code hash to the original code, untouched by instrumentation.
**/
pristineCode: AugmentedQuery<ApiType, (arg: CodeHash | string | Uint8Array) => Observable<Option<Bytes>>>;
/**
* A mapping between an original code hash and instrumented wasm code, ready for execution.
**/
codeStorage: AugmentedQuery<ApiType, (arg: CodeHash | string | Uint8Array) => Observable<Option<PrefabWasmModule>>>;
/**
* The subtrie counter.
**/
accountCounter: AugmentedQuery<ApiType, () => Observable<u64>>;
/**
* The code associated with a given account.
**/
contractInfoOf: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<ContractInfo>>>;
/**
* The price of one unit of gas.
**/
gasPrice: AugmentedQuery<ApiType, () => Observable<BalanceOf>>;
};
identity: {
/**
* Information that is pertinent to identify the entity behind an account.
**/
identityOf: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<Registration>>>;
/**
* The super-identity of an alternative "sub" identity together with its name, within that
* context. If the account is not some other account's sub-identity, then just `None`.
**/
superOf: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<ITuple<[AccountId, Data]>>>>;
/**
* Alternative "sub" identities of this account.
* The first item is the deposit, the second is a vector of the accounts.
**/
subsOf: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<ITuple<[BalanceOf, Vec<AccountId>]>>>;
/**
* The set of registrars. Not expected to get very big as can only be added through a
* special origin (likely a council motion).
* The index into this can be cast to `RegistrarIndex` to get a valid value.
**/
registrars: AugmentedQuery<ApiType, () => Observable<Vec<Option<RegistrarInfo>>>>;
};
imOnline: {
/**
* The block number after which it's ok to send heartbeats in current session.
* At the beginning of each session we set this to a value that should
* fall roughly in the middle of the session duration.
* The idea is to first wait for the validators to produce a block
* in the current session, so that the heartbeat later on will not be necessary.
**/
heartbeatAfter: AugmentedQuery<ApiType, () => Observable<BlockNumber>>;
/**
* The current set of keys that may issue a heartbeat.
**/
keys: AugmentedQuery<ApiType, () => Observable<Vec<AuthorityId>>>;
/**
* For each session index, we keep a mapping of `AuthIndex`
* to `offchain::OpaqueNetworkState`.
**/
receivedHeartbeats: AugmentedQueryDoubleMap<ApiType, (key1: SessionIndex | AnyNumber | Uint8Array, key2: AuthIndex | AnyNumber | Uint8Array) => Observable<Option<Bytes>>>;
/**
* For each session index, we keep a mapping of `T::ValidatorId` to the
* number of blocks authored by the given authority.
**/
authoredBlocks: AugmentedQueryDoubleMap<ApiType, (key1: SessionIndex | AnyNumber | Uint8Array, key2: ValidatorId | string | Uint8Array) => Observable<u32>>;
};
offences: {
/**
* The primary structure that holds all offence records keyed by report identifiers.
**/
reports: AugmentedQuery<ApiType, (arg: ReportIdOf | string | Uint8Array) => Observable<Option<OffenceDetails>>>;
/**
* A vector of reports of the same kind that happened at the same time slot.
**/
concurrentReportsIndex: AugmentedQueryDoubleMap<ApiType, (key1: Kind | string | Uint8Array, key2: OpaqueTimeSlot | string | Uint8Array) => Observable<Vec<ReportIdOf>>>;
/**
* 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.
**/
reportsByKindIndex: AugmentedQuery<ApiType, (arg: Kind | string | Uint8Array) => Observable<Bytes>>;
};
randomnessCollectiveFlip: {
/**
* Series of block headers from the last 81 blocks that acts as random seed material. This
* is arranged as a ring buffer with `block_number % 81` being the index into the `Vec` of
* the oldest hash.
**/
randomMaterial: AugmentedQuery<ApiType, () => Observable<Vec<Hash>>>;
};
nicks: {
/**
* The lookup table for names.
**/
nameOf: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<ITuple<[Bytes, BalanceOf]>>>>;
};
sudo: {
/**
* The `AccountId` of the sudo key.
**/
key: AugmentedQuery<ApiType, () => Observable<AccountId>>;
};
signaling: {
/**
* The total number of proposals created thus far.
**/
proposalCount: AugmentedQuery<ApiType, () => Observable<u32>>;
/**
* A list of all extant proposals.
**/
inactiveProposals: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[Hash, BlockNumber]>>>>;
/**
* A list of active proposals along with the time at which they complete.
**/
activeProposals: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[Hash, BlockNumber]>>>>;
/**
* A list of completed proposals, pending deletion
**/
completedProposals: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[Hash, BlockNumber]>>>>;
/**
* Amount of time a proposal remains in "Voting" stage.
**/
votingLength: AugmentedQuery<ApiType, () => Observable<BlockNumber>>;
/**
* Map for retrieving the information about any proposal from its hash.
**/
proposalOf: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<Option<ProposalRecord>>>;
/**
* Registration bond
**/
proposalCreationBond: AugmentedQuery<ApiType, () => Observable<BalanceOf>>;
};
voting: {
/**
* The map of all vote records indexed by id
**/
voteRecords: AugmentedQuery<ApiType, (arg: u64 | AnyNumber | Uint8Array) => Observable<Option<VoteRecord>>>;
/**
* The number of vote records that have been created
**/
voteRecordCount: AugmentedQuery<ApiType, () => Observable<u64>>;
};
treasuryReward: {
/**
* Interval in number of blocks to reward treasury
**/
mintingInterval: AugmentedQuery<ApiType, () => Observable<BlockNumber>>;
/**
* Current payout of module
**/
currentPayout: AugmentedQuery<ApiType, () => Observable<BalanceOf>>;
/**
* Current pot
**/
pot: AugmentedQuery<ApiType, () => Observable<Balance>>;
};
}
export interface QueryableStorage<ApiType extends ApiTypes> extends AugmentedQueries<ApiType> {
}
}
File diff suppressed because it is too large Load Diff
@@ -1,7 +0,0 @@
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit
/* eslint-disable @typescript-eslint/no-empty-interface */
import '@polkadot/api/augment/rpc';
import './augment-api-consts';
import './augment-api-query';
import './augment-api-tx';
File diff suppressed because it is too large Load Diff
@@ -1,7 +0,0 @@
// order here matches with what is found in (unused removed)
// https://www.npmjs.com/package/edgeware-node-types
// https://github.com/hicommonwealth/edgeware-node-types/tree/master/types
export { default as signaling } from './signaling/definitions';
export { default as treasuryRewards } from './treasuryRewards/definitions';
export { default as voting } from './voting/definitions';
@@ -1,17 +0,0 @@
/* eslint-disable @typescript-eslint/camelcase */
export default {
types: {
ProposalRecord: {
index: 'u32',
author: 'AccountId',
stage: 'VoteStage',
transition_time: 'u32',
title: 'Text',
contents: 'Text',
vote_id: 'u64'
},
ProposalContents: 'Vec<u8>',
ProposalTitle: 'Vec<u8>'
}
};
@@ -1,24 +0,0 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable @typescript-eslint/no-empty-interface */
import { Struct } from '@polkadot/types/codec';
import { Bytes, Text, u32, u64 } from '@polkadot/types/primitive';
import { AccountId } from '@polkadot/types/interfaces/runtime';
import { VoteStage } from 'sample-polkadotjs-typegen/interfaces/voting';
/** @name ProposalContents */
export interface ProposalContents extends Bytes {}
/** @name ProposalRecord */
export interface ProposalRecord extends Struct {
readonly index: u32;
readonly author: AccountId;
readonly stage: VoteStage;
readonly transition_time: u32;
readonly title: Text;
readonly contents: Text;
readonly vote_id: u64;
}
/** @name ProposalTitle */
export interface ProposalTitle extends Bytes {}
@@ -1,7 +0,0 @@
/* eslint-disable @typescript-eslint/camelcase */
export default {
types: {
Balance2: 'u128'
}
};
@@ -1,7 +0,0 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable @typescript-eslint/no-empty-interface */
import { u128 } from '@polkadot/types/primitive';
/** @name Balance2 */
export interface Balance2 extends u128 {}
@@ -1,6 +0,0 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable @typescript-eslint/no-empty-interface */
export * from './signaling/types';
export * from './treasuryRewards/types';
export * from './voting/types';
@@ -1,33 +0,0 @@
/* eslint-disable @typescript-eslint/camelcase */
export default {
types: {
VoteStage: {
_enum: ['PreVoting', 'Commit', 'Voting', 'Completed']
},
VoteType: {
_enum: ['Binary', 'MultiOption', 'RankedChoice']
},
TallyType: {
_enum: ['OnePerson', 'OneCoin']
},
VoteOutcome: '[u8; 32]',
Tally: 'Option<Vec<(VoteOutcome, u128)>>',
VoteData: {
initiator: 'AccountId',
stage: 'VoteStage',
vote_type: 'VoteType',
tally_type: 'TallyType',
is_commit_reveal: 'bool'
},
Commitments: 'Vec<(AccountId, VoteOutcome)>',
Reveals: 'Vec<(AccountId, Vec<VoteOutcome>)>',
VoteRecord: {
id: 'u64',
commitments: 'Commitments',
reveals: 'Reveals',
data: 'VoteData',
outcomes: 'Vec<VoteOutcome>'
}
}
};
@@ -1,58 +0,0 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable @typescript-eslint/no-empty-interface */
import { ITuple } from '@polkadot/types/types';
import { Enum, Option, Struct, U8aFixed, Vec } from '@polkadot/types/codec';
import { bool, u128, u64 } from '@polkadot/types/primitive';
import { AccountId } from '@polkadot/types/interfaces/runtime';
/** @name Commitments */
export interface Commitments extends Vec<ITuple<[AccountId, VoteOutcome]>> {}
/** @name Reveals */
export interface Reveals extends Vec<ITuple<[AccountId, Vec<VoteOutcome>]>> {}
/** @name Tally */
export interface Tally extends Option<Vec<ITuple<[VoteOutcome, u128]>>> {}
/** @name TallyType */
export interface TallyType extends Enum {
readonly isOnePerson: boolean;
readonly isOneCoin: boolean;
}
/** @name VoteData */
export interface VoteData extends Struct {
readonly initiator: AccountId;
readonly stage: VoteStage;
readonly vote_type: VoteType;
readonly tally_type: TallyType;
readonly is_commit_reveal: bool;
}
/** @name VoteOutcome */
export interface VoteOutcome extends U8aFixed {}
/** @name VoteRecord */
export interface VoteRecord extends Struct {
readonly id: u64;
readonly commitments: Commitments;
readonly reveals: Reveals;
readonly data: VoteData;
readonly outcomes: Vec<VoteOutcome>;
}
/** @name VoteStage */
export interface VoteStage extends Enum {
readonly isPreVoting: boolean;
readonly isCommit: boolean;
readonly isVoting: boolean;
readonly isCompleted: boolean;
}
/** @name VoteType */
export interface VoteType extends Enum {
readonly isBinary: boolean;
readonly isMultiOption: boolean;
readonly isRankedChoice: boolean;
}
@@ -1,34 +0,0 @@
{
"compilerOptions": {
// this is specific with augmented overrides
"paths": {
// this is the package name we use (in the interface imports, --package for generators)
"sample-polkadotjs-typegen/*": ["src/*"],
// here we replace the @polkadot/api augmentation with our own, generated from chain
"@polkadot/api/augment": ["src/interfaces/augment-api.ts"],
// replace the augmented types with our own, as generated from definitions
"@polkadot/types/augment": ["src/interfaces/augment-types.ts"]
},
// some other options, whatever you want for your environment
"target": "esnext",
"module": "esnext",
"jsx": "preserve",
"declaration": true,
"strict": true,
"noImplicitAny": true,
"noUnusedLocals": true,
"noImplicitReturns": true,
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"baseUrl": ".",
"skipLibCheck": true,
"typeRoots": [
"./node_modules/@types"
]
},
"exclude": [
"build/**/*",
"node_modules"
]
}
-24
View File
@@ -1,24 +0,0 @@
# ApiPromise Examples
Here you will find a list of examples that takes you through the basics of connecting to a local node, retrieving data from the Node and chain and execute transactions on the chain. It uses the [[ApiPromise]] interface.
## Prerequisites
For the following examples, you need a local node. It is usually convenient testing with:
```
substrate --dev
```
## Running the examples
From each folder, run `yarn` to install the required dependencies and then run `yarn start` to execute the example against the running node.
## Development accounts
Some of the examples use the following accounts:
- Alice: `5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY`
- Bob: `5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty`
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...
@@ -1,5 +0,0 @@
# Simple Connect
The following example shows how to instantiate a Polkadot API object and use it to connect to a node using ApiRx.
<<< @/docs/examples/rx/01_simple_connect/index.js
@@ -1,28 +0,0 @@
/* eslint-disable header/header */
/* eslint-disable @typescript-eslint/require-await */
/* eslint-disable @typescript-eslint/unbound-method */
// Required imports
const { zip } = require('rxjs');
const { ApiRx } = require('@polkadot/api');
const { WsProvider } = require('@polkadot/rpc-provider');
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 ApiRx.create({ provider }).toPromise();
// We're using RxJs 'zip()' combination operator to get the emitted values
// of multiple observables as an array
zip(
api.rpc.system.chain(),
api.rpc.system.name(),
api.rpc.system.version()
).subscribe(([chain, nodeName, nodeVersion]) => {
console.log(`You are connected to chain ${chain} using ${nodeName} v${nodeVersion}`);
});
}
main().catch(console.error).finally(() => process.exit());
@@ -1,19 +0,0 @@
{
"name": "rx_01_simple_connect",
"version": "0.2.0",
"description": "Example showing how to connect using a WebSocket",
"main": "index.js",
"author": "Stefie",
"license": "MIT",
"scripts": {
"clean": "rimraf node_modules",
"start": "node index.js"
},
"dependencies": {
"@polkadot/api": "*"
},
"devDependencies": {
"rimraf": "^2.6.2"
}
}
@@ -1,9 +0,0 @@
# Listen to new blocks
This example shows how to subscribe to new blocks.
It displays the block number every time a new block is seen by the node you are connected to.
NOTE: The example runs until you stop it with CTRL+C
<<< @/docs/examples/rx/02_listen_to_blocks/index.js
@@ -1,23 +0,0 @@
/* eslint-disable header/header */
/* eslint-disable @typescript-eslint/require-await */
/* eslint-disable @typescript-eslint/unbound-method */
// Import the API
const { ApiRx } = require('@polkadot/api');
const { switchMap } = require('rxjs/operators');
async function main () {
// Here we don't pass the (optional) provider, connecting directly to the default
// node/port, i.e. `ws://127.0.0.1:9944`. Await for the isReady promise to ensure
// the API has connected to the node and completed the initialisation process
new ApiRx().isReady
.pipe(
switchMap((api) =>
api.rpc.chain.subscribeNewHeads()
))
.subscribe((header) => {
console.log(`Chain is at block: #${header.number}`);
});
}
main().catch(console.error);
@@ -1,18 +0,0 @@
{
"name": "rx_02_listen_to_blocks",
"version": "0.2.0",
"description": "Example showing how to use subscriptions",
"main": "index.js",
"author": "Stefie",
"license": "MIT",
"scripts": {
"clean": "rimraf node_modules",
"start": "node index.js"
},
"dependencies": {
"@polkadot/api": "*"
},
"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/rx/03_listen_to_balance_change/index.js
@@ -1,44 +0,0 @@
/* eslint-disable header/header */
/* eslint-disable @typescript-eslint/require-await */
/* eslint-disable @typescript-eslint/unbound-method */
// Import the API and operators from RxJs
const { ApiRx } = require('@polkadot/api');
const { pairwise, startWith } = require('rxjs/operators');
// Known account we want to use (available on dev chain, with funds)
const Alice = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
async function main () {
// Create an await for the API
const api = await ApiRx.create().toPromise();
// Here we subscribe to any balance changes and update the on-screen value.
// We're using RxJs pairwise() operator to get the previous and current values as an array.
api.query.system.account(Alice)
.pipe(
// since pairwise only starts emitting values on the second emission, we prepend an
// initial value with the startWith() operator to be able to also receive the first value
startWith('first'),
pairwise()
)
.subscribe((balance) => {
if (balance[0] === 'first') {
// Now we know that if the previous value emitted as balance[0] is `first`,
// then balance[1] is the initial value of Alice account.
console.log(`Alice ${Alice} has a balance of ${balance[1].data.free}`);
console.log('You may leave this example running and start the "Make a transfer" example or transfer any value to Alice address');
return;
}
const change = balance[1].data.free.sub(balance[0].date.free);
// Only display value changes
if (!change.isZero()) {
console.log(`New balance change of: ${change}`);
}
});
}
main().catch(console.error);
@@ -1,18 +0,0 @@
{
"name": "rx_03_listen_to_balance_change",
"version": "0.2.0",
"description": "Example showing how to subscribe to balance change",
"main": "index.js",
"author": "Stefie",
"license": "MIT",
"scripts": {
"clean": "rimraf node_modules",
"start": "node index.js"
},
"dependencies": {
"@polkadot/api": "*"
},
"devDependencies": {
"rimraf": "^2.6.2"
}
}
@@ -1,7 +0,0 @@
# Unsubscribe from listening to updates
This example shows how to subscribe to and later unsubscribe from listening to block updates.
In this example we're calling the built-in unsubscribe() function after a timeOut of 20s to cleanup and unsubscribe from listening to updates.
<<< @/docs/examples/rx/04_unsubscribe/index.js
-29
View File
@@ -1,29 +0,0 @@
/* eslint-disable header/header */
/* eslint-disable @typescript-eslint/require-await */
/* eslint-disable @typescript-eslint/unbound-method */
// Import the API
const { ApiRx } = require('@polkadot/api');
const { switchMap } = require('rxjs/operators');
async function main () {
// Create a new instance of the api
// Subscribe to chain updates and log the current block number on update.
const subscription = new ApiRx().isReady
.pipe(
switchMap((api) =>
api.rpc.chain.subscribeNewHeads()
))
.subscribe((header) => {
console.log(`Chain is at block: #${header.number}`);
});
// In this example we're calling the Overvables unsubscribe() //
// function after 20s.
setTimeout(() => {
subscription.unsubscribe();
console.log('Unsubscribed');
}, 20000);
}
main().catch(console.error);
@@ -1,18 +0,0 @@
{
"name": "rx_04_unsubscribe",
"version": "0.2.0",
"description": "Example showing how to unsubscribe from a subscription",
"main": "index.js",
"author": "Stefie",
"license": "MIT",
"scripts": {
"clean": "rimraf node_modules",
"start": "node index.js"
},
"dependencies": {
"@polkadot/api": "*"
},
"devDependencies": {
"rimraf": "^2.6.2"
}
}
@@ -1,5 +0,0 @@
# Read storage
Many important variables are available through the storage API. This example shows how to call a few of those APIs.
<<< @/docs/examples/rx/05_read_storage/index.js
-55
View File
@@ -1,55 +0,0 @@
/* eslint-disable header/header */
/* eslint-disable @typescript-eslint/require-await */
/* eslint-disable @typescript-eslint/unbound-method */
// Import the API
const { ApiRx } = require('@polkadot/api');
const { combineLatest, of } = require('rxjs');
const { first, switchMap } = require('rxjs/operators');
// Our address for Alice on the dev chain
const Alice = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
function main () {
// Create our API with a default connection to the local node
new ApiRx().isReady
.pipe(
// Here we ake our basic chain state/storage queries
switchMap((api) => combineLatest(
of(api),
api.query.session.validators().pipe(first())
)),
switchMap(([api, validators]) => {
// In the next step, we're checking if the node has active validators.
// If it does, we're making another call to the api to get the balances for all validators
const balances = (validators && validators.length > 0)
? combineLatest(validators.map((authorityId) => api.query.system.account(authorityId).pipe(first())))
: of(null);
// We're combining the results together with the emitted value 'validators',
// which we're turning back into an observable using of()
return combineLatest(
api.query.system.account(Alice).pipe(first()),
api.query.timestamp.blockPeriod().pipe(first()),
of(validators),
balances
);
})
)
// Then we're subscribing to the emitted results
.subscribe(([{ nonce }, blockPeriod, validators, validatorBalances]) => {
console.log(`accountNonce(${Alice}) ${nonce}`);
console.log(`blockPeriod ${blockPeriod.toNumber()} seconds`);
if (validatorBalances) {
// And lastly we print out the authorityIds and balances of all validators
console.log('validators', validators.map((authorityId, index) => ({
address: authorityId.toString(),
balance: validatorBalances[index].data.free.toString(),
nonce: validatorBalances[index].data.toString()
})));
}
});
}
main().catch(console.error).finally(() => process.exit());
@@ -1,18 +0,0 @@
{
"name": "rx_05_read_storage",
"version": "0.2.0",
"description": "Example showing how to query storage",
"main": "index.js",
"author": "Stefie",
"license": "MIT",
"scripts": {
"clean": "rimraf node_modules",
"start": "node index.js"
},
"dependencies": {
"@polkadot/api": "*"
},
"devDependencies": {
"rimraf": "^2.6.2"
}
}

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