Compare commits

...
699 Commits
Author SHA1 Message Date
Github Actions 0dc121a796 [CI Skip] release/stable 4.8.1
skip-checks: true
2021-05-02 18:21:16 +00:00
Jaco a827131457 4.8 (#3470) 2021-05-02 20:11:35 +02:00
Github Actions 2174537f76 [CI Skip] release/beta 4.7.3-12
skip-checks: true
2021-05-02 07:32:19 +00:00
Jaco 53fca2406a Cleanup WebSocket handlers when close event has been received (#3469) 2021-05-02 09:24:10 +02:00
Github Actions 0eaba284ae [CI Skip] release/beta 4.7.3-11
skip-checks: true
2021-05-02 07:14:56 +00:00
Jaco 378f359a76 add known upgrade block for Polkadot v30 (#3468) 2021-05-02 09:04:48 +02:00
Github Actions 5460d96b5d [CI Skip] release/beta 4.7.3-10
skip-checks: true
2021-05-01 06:40:35 +00:00
Jaco b1353edc84 Expose additional camelCase method on AbiMessage (maps to decorated name) (#3466) 2021-05-01 08:31:16 +02:00
Github Actions 9129fed6e5 [CI Skip] release/beta 4.7.3-9
skip-checks: true
2021-04-30 12:56:27 +00:00
Jaco 7c4abacaca Cater for N-key hashing (#3451)
* Cater for N-key hashing

* Adjust

* Cleanups

* Update packages/types/src/primitive/types.ts

* Update packages/metadata/src/decorate/storage/createFunction.ts

* Update packages/metadata/src/decorate/storage/createFunction.ts

* Adjust

* Adjust

* DoubleMap arg check test

* On-demand create

* Rework
2021-04-30 14:48:19 +02:00
Github Actions 3664c7d81b [CI Skip] release/beta 4.7.3-8
skip-checks: true
2021-04-30 06:58:09 +00:00
Jaco f75b87c5a5 Verification test for 2-byte ss58 (#3464)
* Verification test for 2-byte ss58

* CHANGELOG
2021-04-30 08:50:11 +02:00
Github Actions 1c228216cd [CI Skip] release/beta 4.7.3-7
skip-checks: true
2021-04-30 06:21:25 +00:00
Jaco cec3c12795 Bump metadata (#3463) 2021-04-30 08:13:24 +02:00
Github Actions 0d0d12e85b [CI Skip] release/beta 4.7.3-6
skip-checks: true
2021-04-30 06:05:49 +00:00
Jaco 3a16e69be5 Bump deps (#3462) 2021-04-30 07:56:39 +02:00
Github Actions 4ae8e3909f [CI Skip] release/beta 4.7.3-5
skip-checks: true
2021-04-29 12:15:38 +00:00
Jaco 6e18bb3b1d Allow Metadata instances from JSON or Map (#3459)
* assert isU8a & isHex inputs on Metadata

* Remove _ in param

* Allow hex parsing

* CHANGELOG
2021-04-29 14:07:32 +02:00
Github Actions be153e13a6 [CI Skip] release/beta 4.7.3-4
skip-checks: true
2021-04-29 12:05:39 +00:00
Chevdor 4c01dfd0ab Fix metadata package link (#3458) 2021-04-29 13:55:23 +02:00
Github Actions b57c7a1343 [CI Skip] release/beta 4.7.3-3
skip-checks: true
2021-04-28 16:47:22 +00:00
Jaco da62acdf50 Adjust XcmError with updated WeightLimitReached (#3455) 2021-04-28 18:37:56 +02:00
Github Actions cc95e4fc0a [CI Skip] release/beta 4.7.3-2
skip-checks: true
2021-04-28 08:26:17 +00:00
Jaco 7f5647c6e1 Optimize metadata unknown type validation (#3453) 2021-04-28 10:16:38 +02:00
Github Actions c636d63bc0 [CI Skip] release/beta 4.7.3-1
skip-checks: true
2021-04-27 12:15:39 +00:00
Jaco 30c98ef857 Fix generation of well-known keys (#3452)
* Fix generation of well-known keys

* CHANGELOG

* Linting, unfiy decorate params

* Adjust
2021-04-27 14:05:59 +02:00
Github Actions debecde50f [CI Skip] release/beta 4.7.3-0
skip-checks: true
2021-04-27 05:03:10 +00:00
Jaco cd2cdd1184 De-alias XcmOutcome (#3449) 2021-04-27 06:53:40 +02:00
Github Actions f5c25d75ff [CI Skip] release/stable 4.7.2
skip-checks: true
2021-04-26 18:20:50 +00:00
Jaco 780cc62942 4.7.2 (#3448)
* 4.7.2

* XcmError update
2021-04-26 20:11:39 +02:00
Github Actions 165568c905 [CI Skip] release/beta 4.7.2-5
skip-checks: true
2021-04-26 16:34:59 +00:00
Jaco 976a48d8f9 Update .nvmrc (#3447)
As per https://github.com/polkadot-js/api/issues/3446 (also need one on common before bumping to a patch)
2021-04-26 19:24:44 +03:00
Github Actions 35cbbbe0ed [CI Skip] release/beta 4.7.2-4
skip-checks: true
2021-04-26 12:06:50 +00:00
Jaco 772769c981 Add membership derives (#3442) 2021-04-26 13:57:30 +02:00
Github Actions 1ba2bd1766 [CI Skip] release/beta 4.7.2-3
skip-checks: true
2021-04-26 10:43:48 +00:00
Jaco 4afa345a7d Cleanup encodedLength calculations (#3441)
* Cleanup encodedLength calculations

* Remove array santize

* Test adjustments
2021-04-26 12:33:16 +02:00
Github Actions 5c03359f32 [CI Skip] release/beta 4.7.2-2
skip-checks: true
2021-04-25 15:16:21 +00:00
Jaco Greeff 04120505f0 Fix H32 definition 2021-04-25 18:08:02 +03:00
Github Actions 7bd9dd65f8 [CI Skip] release/beta 4.7.2-1
skip-checks: true
2021-04-25 14:44:02 +00:00
Jaco 5f57ecb2e1 Update ETH types (#3439)
* Update ETH types

* Build
2021-04-25 16:34:42 +02:00
Github Actions 9123f1d805 [CI Skip] release/beta 4.7.2-0
skip-checks: true
2021-04-25 11:28:54 +00:00
Jaco 7050c4a554 Updated Xcm OriginKind enum (#3438) 2021-04-25 13:18:47 +02:00
Github Actions 62afb0b534 [CI Skip] release/stable 4.7.1
skip-checks: true
2021-04-25 05:18:10 +00:00
Jaco Greeff 5157ca5608 CHANGELOG bump 2021-04-25 08:08:28 +03:00
Jaco 315617c027 4.7 (#3435)
* 4.7

* Update CHANGELOG.md
2021-04-25 06:31:42 +02:00
Github Actions 7d33b4dec6 [CI Skip] release/beta 4.6.3-11
skip-checks: true
2021-04-24 08:06:21 +00:00
Jaco 2345f69c71 Add engines field to package.json (#3433) 2021-04-24 09:56:50 +02:00
Github Actions 3cef2fb4d5 [CI Skip] release/beta 4.6.3-10
skip-checks: true
2021-04-23 15:50:43 +00:00
Jaco 2bbf5513b2 Expand DispatchError (#3431) 2021-04-23 17:43:32 +02:00
Github Actions c146f06178 [CI Skip] release/beta 4.6.3-9
skip-checks: true
2021-04-23 05:44:16 +00:00
Jaco 5903704b61 Expand Data (from identity) with all is/as getters (#3429) 2021-04-23 07:34:01 +02:00
Github Actions 90d8db651b [CI Skip] release/beta 4.6.3-8
skip-checks: true
2021-04-22 13:10:53 +00:00
Jaco 557283a3d1 Struct decoding error messaging (#3425)
* Struct decoding error messaging

* Error adjust

* Tests

* Bump common, use stringify

* Linting

* Adjust

* Bumps

* Rebump

* Assert cleanups

* Don't modify original value on encoding

* util bump, fixe compact encoding
2021-04-22 15:02:54 +02:00
Github Actions 88b84dcf75 [CI Skip] release/beta 4.6.3-7
skip-checks: true
2021-04-21 17:13:17 +00:00
Jaco 45d190eaca Revery Westend beefy keys (#3423) 2021-04-21 20:03:43 +03:00
Github Actions 6d32328509 [CI Skip] release/beta 4.6.3-6
skip-checks: true
2021-04-21 10:37:47 +00:00
Jaco ba470e7417 Bump WS reconnect delay from 1s -> 2.5s (#3420) 2021-04-21 12:27:16 +02:00
Github Actions 4a16e46f88 [CI Skip] release/beta 4.6.3-5
skip-checks: true
2021-04-21 09:39:02 +00:00
Jaco Greeff ada0d99a84 Sorting 2021-04-21 12:28:51 +03:00
Github Actions e486fc4316 [CI Skip] release/beta 4.6.3-4
skip-checks: true
2021-04-21 08:58:57 +00:00
Jaco 6e5c6f4e0b Bump deps (#3418)
* Bump deps

* Sorting md
2021-04-21 10:48:52 +02:00
Github Actions 21ddcaf173 [CI Skip] release/beta 4.6.3-3
skip-checks: true
2021-04-21 07:17:45 +00:00
Jaco 6085b994f6 Remove well-known json dependency (#3417) 2021-04-21 09:09:30 +02:00
Github Actions 7c3bf05868 [CI Skip] release/beta 4.6.3-2
skip-checks: true
2021-04-21 07:03:45 +00:00
Jaco 8bce5b4a09 Add support for BoundedVec (#3415)
* Add support for BoundedVec

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

* Cleanup sanitize duplication

* Additional cleanups

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

* Box wrap
2021-04-21 08:52:56 +02:00
Github Actions 7a6077301f [CI Skip] release/beta 4.6.3-1
skip-checks: true
2021-04-20 09:05:25 +00:00
Jaco 3f2767462f Adjust statemint proxy type (#3412) 2021-04-20 10:55:28 +02:00
Github Actions ecc37d11df [CI Skip] release/beta 4.6.3-0
skip-checks: true
2021-04-20 06:02:39 +00:00
Jaco 0589d151da Add Xcm Plurality types (#3411) 2021-04-20 07:53:24 +02:00
Jaco 47cd6c6410 RewardDestination: None types (#3231) 2021-04-20 07:44:42 +02:00
Github Actions 65688f9e0e [CI Skip] release/stable 4.6.2
skip-checks: true
2021-04-19 10:47:57 +00:00
Jaco 5eb2a95ef2 Correct Kusama/Polkadot runtime 30 session key definitions (#3409)
* Correct Kusama/Polkadot runtime 30 session key definitions

* Remove duplicates
2021-04-19 12:38:48 +02:00
Github Actions 282b39d27a [CI Skip] release/stable 4.6.1
skip-checks: true
2021-04-19 06:07:35 +00:00
Jaco f21e3d317a 4.6.1 (#3407) 2021-04-19 07:56:46 +02:00
Github Actions c2af7cf8f2 [CI Skip] release/beta 4.5.2-8
skip-checks: true
2021-04-18 09:29:51 +00:00
Jaco 0958a4c693 Bump common (#3405)
* Bump common

* Bumps
2021-04-18 11:19:47 +02:00
Github Actions c687181130 [CI Skip] release/beta 4.5.2-7
skip-checks: true
2021-04-16 16:03:07 +00:00
Jaco 685f1ec0b6 Update .123trigger 2021-04-16 17:53:22 +02:00
Jaco e0069b6f7d statemint known-types (#3404) 2021-04-16 17:39:21 +02:00
Github Actions cf48762ff2 [CI Skip] release/beta 4.5.2-6
skip-checks: true
2021-04-15 12:27:19 +00:00
Jaco 31a7545a19 Bump common (#3403) 2021-04-15 14:18:06 +02:00
Github Actions 5cd8e8fb97 [CI Skip] release/beta 4.5.2-5
skip-checks: true
2021-04-14 07:15:18 +00:00
Jaco 96e4090174 Simplify/harden session derives (#3401) 2021-04-14 09:05:35 +02:00
Github Actions 0bbebab90b [CI Skip] release/beta 4.5.2-4
skip-checks: true
2021-04-14 06:26:22 +00:00
Jaco 57dac0ef47 Assert keypair validity in signing operations (#3400) 2021-04-14 08:17:10 +02:00
Github Actions 6c3d24551b [CI Skip] release/beta 4.5.2-3
skip-checks: true
2021-04-13 18:44:11 +00:00
Jaco e7dc6d7a5a Expose internalError on submittables (#3399) 2021-04-13 20:33:59 +02:00
Github Actions a63b7f611e [CI Skip] release/beta 4.5.2-2
skip-checks: true
2021-04-13 10:33:28 +00:00
Jaco 82e15dc36d Explicitly handle isReadyOrError (when only using isReady) (#3395) 2021-04-13 12:24:26 +02:00
Github Actions 6f96037cb5 [CI Skip] release/beta 4.5.2-1
skip-checks: true
2021-04-13 09:08:55 +00:00
Jaco b6da84b8b2 Beefy subscribeJustifications (#3393)
* Beefy subscribeJustifications

* Add payload info

* Update RPC description
2021-04-13 10:59:23 +02:00
Github Actions 41209f074c [CI Skip] release/beta 4.5.2-0
skip-checks: true
2021-04-12 13:17:40 +00:00
Jaco Greeff c47964c942 Updated xcm types (#3391)
* Updated xcm types

* Move NetworkId

* Update DoubleEncodedCall

* trigger

* Xcm is an enum
2021-04-12 15:09:33 +02:00
Github Actions 5f13a634e5 [CI Skip] release/stable 4.5.1
skip-checks: true
2021-04-12 06:30:52 +00:00
Jaco Greeff 40af520fe7 4.5.1 (#3390) 2021-04-12 08:21:37 +02:00
Github Actions 1e506e0f8c [CI Skip] release/beta 4.4.2-7
skip-checks: true
2021-04-11 13:29:10 +00:00
Jaco Greeff 96ea5803d4 Adjust Westend known & detection (#3386) 2021-04-11 15:19:05 +02:00
Jaco Greeff 7d99459f50 Bump deps (#3389) 2021-04-11 15:15:01 +02:00
Github Actions 8fa090f435 [CI Skip] release/beta 4.4.2-6
skip-checks: true
2021-04-09 20:11:40 +00:00
Jaco Greeff d3c60d197c PalletId type 2021-04-09 23:01:11 +03:00
Github Actions ad8550f7f5 [CI Skip] release/beta 4.4.2-5
skip-checks: true
2021-04-09 19:51:56 +00:00
Jaco Greeff a899aa439d Adjust slot types based on constants (#3385) 2021-04-09 21:40:24 +02:00
Github Actions e0e075b350 [CI Skip] release/beta 4.4.2-4
skip-checks: true
2021-04-09 04:48:56 +00:00
Jaco Greeff 34ff14547e Westend runtime 50 upgrade block (& v30 session keys) (#3382)
* Westend runtime 50 upgrade block (& v30 session keys)

* Revery beefy keys

* Defer 7B keys to 51
2021-04-09 06:39:40 +02:00
Github Actions 681a80d456 [CI Skip] release/beta 4.4.2-3
skip-checks: true
2021-04-08 12:17:03 +00:00
Jaco Greeff ed5f2673ce Detect Keys, inject SessionKeys (#3380) 2021-04-08 14:07:39 +02:00
Github Actions 43e87603e2 [CI Skip] release/beta 4.4.2-2
skip-checks: true
2021-04-08 09:02:42 +00:00
Jaco Greeff d056416b47 Bump deps (#3379) 2021-04-08 10:52:20 +02:00
Github Actions 1bcf94131d [CI Skip] release/beta 4.4.2-1
skip-checks: true
2021-04-08 05:45:13 +00:00
Jaco Greeff 17b607b6c3 Update Rococo session key (& small para type cleanups) (#3378) 2021-04-08 08:35:24 +03:00
Github Actions 5a16d1dd8b [CI Skip] release/beta 4.4.2-0
skip-checks: true
2021-04-07 14:18:01 +00:00
Jaco Greeff 144b74306a Update parachain types (#3376)
* Update parachain types

* Remove retiring flag
2021-04-07 16:09:38 +02:00
Jaco Greeff 16b9fa956d Adjust ParaInfo types (#3372) 2021-04-07 15:53:57 +02:00
Github Actions b6af4b9877 [CI Skip] release/stable 4.4.1
skip-checks: true
2021-04-05 11:30:23 +00:00
Jaco Greeff 3f368e721d 4.4 (#3371)
* 4.4

* CHANGELOG
2021-04-05 13:20:18 +02:00
Github Actions 22b4257636 [CI Skip] release/beta 4.3.2-2
skip-checks: true
2021-04-03 06:15:11 +00:00
Jaco Greeff ca7a631032 Add cumulus ServiceQuality type (#3368) 2021-04-03 08:04:42 +02:00
Github Actions da5bbd17af [CI Skip] release/beta 4.3.2-1
skip-checks: true
2021-03-30 09:52:02 +00:00
Jaco Greeff b58f3f5c3e Multilocation update (X5-X8) (#3362) 2021-03-30 11:42:27 +02:00
Github Actions 8c30194f59 [CI Skip] release/beta 4.3.2-0
skip-checks: true
2021-03-30 09:03:06 +00:00
Jaco Greeff dc9ec37490 Add Polkadot 29 upgrade block (#3361) 2021-03-30 10:53:30 +02:00
Github Actions 5175e77eec [CI Skip] release/stable 4.3.1
skip-checks: true
2021-03-29 09:40:47 +00:00
Jaco Greeff 9553c5467c 4.3 (#3359) 2021-03-29 12:30:49 +03:00
Github Actions a1f07e3274 [CI Skip] release/beta 4.2.2-4
skip-checks: true
2021-03-24 11:04:59 +00:00
Jaco Greeff 58deb2eb14 Session index without staking (#3352)
* Session index without staking

* Fix ordering
2021-03-24 11:55:36 +01:00
Github Actions 83caad7f1b [CI Skip] release/beta 4.2.2-3
skip-checks: true
2021-03-24 10:08:26 +00:00
Jaco Greeff 26c3cc9126 Make council optional with treasury proposals (#3351) 2021-03-24 10:58:03 +01:00
Github Actions 1a231dfb0d [CI Skip] release/beta 4.2.2-2
skip-checks: true
2021-03-23 09:48:48 +00:00
Jaco Greeff 712d0425d0 Update ParaInfo types (#3348) 2021-03-23 10:38:28 +01:00
Github Actions eaa5db517f [CI Skip] release/beta 4.2.2-1
skip-checks: true
2021-03-22 16:12:29 +00:00
Jaco Greeff 88c3850d1b Warn on deprecated contracts interfaces (#3346) 2021-03-22 17:03:49 +01:00
Github Actions 943df72ae9 [CI Skip] release/beta 4.2.2-0
skip-checks: true
2021-03-22 15:58:36 +00:00
Veliko 67ab11a036 Abi constructor takes different parameters (#3347)
The Abi constructor used to take the registry as a parameter, now it takes registry.getChainProperties() and this change introduced hard to debug behaviour
2021-03-22 16:48:15 +01:00
Github Actions c87ef7526b [CI Skip] release/stable 4.2.1
skip-checks: true
2021-03-22 08:39:17 +00:00
Jaco Greeff bccf2d52ad 4.2 (#3344) 2021-03-22 09:29:38 +01:00
Github Actions be6dbdd3e4 [CI Skip] release/beta 4.1.2-8
skip-checks: true
2021-03-21 16:37:49 +00:00
Jaco Greeff 3c34ee9897 Bump metadata (#3343) 2021-03-21 17:27:41 +01:00
Github Actions 9ad97813e3 [CI Skip] release/beta 4.1.2-7
skip-checks: true
2021-03-20 17:28:19 +00:00
Jaco Greeff 028f04e47f Optimize society multi-derive (#3342)
* Optimize society multi-derive

* isVoting flag

* isDefenderVoter
2021-03-20 18:18:49 +01:00
Github Actions 4974c9247f [CI Skip] release/beta 4.1.2-6
skip-checks: true
2021-03-20 10:22:42 +00:00
Jaco Greeff 1ffe6a11bf SignedBlock (justifications field) (#3340) 2021-03-20 11:13:56 +01:00
Github Actions 19699ea445 [CI Skip] release/beta 4.1.2-5
skip-checks: true
2021-03-20 09:11:02 +00:00
Jaco Greeff d98ccfb12a Ensure metadata private fields are not accessed (#3341) 2021-03-20 10:01:03 +01:00
Github Actions 41cb056b0f [CI Skip] release/beta 4.1.2-4
skip-checks: true
2021-03-20 08:10:05 +00:00
Jaco Greeff 48bda0bdea Rococo types (detected, now explicit) (#3339)
* Rococo types (detected, now explicit)

* Bumps
2021-03-20 08:59:57 +01:00
Github Actions 1b393c7b67 [CI Skip] release/beta 4.1.2-3
skip-checks: true
2021-03-18 16:17:51 +00:00
Jaco Greeff f52e518b7b Adjust extended derives with as-defined instances (#3336) 2021-03-18 17:08:18 +01:00
Github Actions 08970cff88 [CI Skip] release/beta 4.1.2-2
skip-checks: true
2021-03-17 08:06:55 +00:00
Jaco Greeff 6d38ca6453 Update .123trigger 2021-03-17 08:57:36 +01:00
Github Actions 60db4bc66b [CI Skip] release/beta 4.1.2-1
skip-checks: true
2021-03-16 13:48:13 +00:00
Jaco Greeff 0661237b28 Bump deps (#3326) 2021-03-16 14:38:17 +01:00
Github Actions 6ccac712a8 [CI Skip] release/beta 4.1.2-0
skip-checks: true
2021-03-16 07:41:09 +00:00
Jaco Greeff 3d4877940c Update .123trigger 2021-03-16 08:31:40 +01:00
VelikoandJaco Greeff 70fc95ef27 Fix contractEvents in ContractSubmittableResult (#3324)
* fix the autoaggregation of contract events 

apparently, the system event for contract emitted events has had its name changed

* fix the autoaggregation of contract events

apparently, the system event for contract emitted events has had its name changed

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

* Apply suggestions from code review

Co-authored-by: Jaco Greeff <jacogr@gmail.com>
2021-03-15 22:16:35 +01:00
Github Actions 463f65d25c [CI Skip] release/stable 4.1.1
skip-checks: true
2021-03-15 11:51:46 +00:00
Jaco Greeff 09d176c82e 4.1 (#3321) 2021-03-15 12:42:20 +01:00
Github Actions fce96baf3d [CI Skip] release/beta 4.0.4-16
skip-checks: true
2021-03-15 11:18:57 +00:00
Jaco Greeff c6785c533f Use at-block registry/types for derive block/header (#3320)
* Use at-block registry/types for derive block/header

* Also apply to subscribe
2021-03-15 12:08:25 +01:00
Github Actions 64de021149 [CI Skip] release/beta 4.0.4-15
skip-checks: true
2021-03-15 10:13:45 +00:00
Jaco Greeff de9e17a1a0 Add Mmr RPCs (#3318)
* Add Mmr RPCs

* blockHash
2021-03-15 11:03:18 +01:00
Github Actions 987bccea2e [CI Skip] release/beta 4.0.4-14
skip-checks: true
2021-03-15 09:46:29 +00:00
Jaco GreeffandXiliang Chen 1434b86b8f Update to latest Substrate metadata (#3316)
* Update to latest Substrate metadata

* Update contract Schedule

* Update CHANGELOG.md

Co-authored-by: Xiliang Chen <xlchen1291@gmail.com>

* CHANGELOG

* Updates

Co-authored-by: Xiliang Chen <xlchen1291@gmail.com>
2021-03-15 10:36:05 +01:00
Github Actions a398b2201f [CI Skip] release/beta 4.0.4-13
skip-checks: true
2021-03-15 08:44:13 +00:00
Jaco Greeff f015837c38 Allow ConsensusEngineId toString with non-ascii (#3315)
* Allow ConsensusEngineId toString with non-ascii

* Add number test
2021-03-15 09:34:16 +01:00
Github Actions 5b51588995 [CI Skip] release/beta 4.0.4-12
skip-checks: true
2021-03-12 15:31:59 +00:00
Jaco Greeff 7383e521e5 Kusama 2029 upgrade block (#3310) 2021-03-12 16:23:41 +01:00
Github Actions b10f05786c [CI Skip] release/beta 4.0.4-11
skip-checks: true
2021-03-11 13:03:32 +00:00
Jaco Greeff a212351528 Re-add old slot types (#3305) 2021-03-11 13:55:11 +01:00
Github Actions 55c01af260 [CI Skip] release/beta 4.0.4-10
skip-checks: true
2021-03-11 07:49:11 +00:00
Jaco Greeff 1cf6ffad2b Updata HostConfig for parachains (#3302) 2021-03-11 08:39:24 +01:00
Github Actions 00d0ab9de1 [CI Skip] release/beta 4.0.4-9
skip-checks: true
2021-03-10 21:27:04 +00:00
Jaco Greeff b38e60a9a7 ValidatorIndex for shared 2021-03-10 22:17:30 +01:00
Github Actions 29f7e46439 [CI Skip] release/beta 4.0.4-8
skip-checks: true
2021-03-10 21:10:51 +00:00
Jaco Greeff fa0add8564 Adjust to new auction types (#3297)
* Adjust to new auction types

* Update BitVec fields, Babe types
2021-03-10 22:00:57 +01:00
Github Actions 5bec38c404 [CI Skip] release/beta 4.0.4-7
skip-checks: true
2021-03-10 16:33:36 +00:00
Jaco Greeff 43b66b6507 Remove createBlueprint (use createContract) (#3300) 2021-03-10 17:24:59 +01:00
Github Actions 7e370b3a23 [CI Skip] release/beta 4.0.4-6
skip-checks: true
2021-03-10 16:06:13 +00:00
Jaco Greeff 2b270a3c9f Fix author extraction (both POW & BABE) (#3299)
* Fix author extaction for Babeb session-end

* Fix extraction from Seal
2021-03-10 16:55:59 +01:00
Github Actions cf0d9a2d3f [CI Skip] release/beta 4.0.4-5
skip-checks: true
2021-03-09 15:49:41 +00:00
Jaco Greeff 5d70622819 Extend signer payload with any additional extension fields (#3269)
* Extend payload with additional fields

* Extras

* Adjust
2021-03-09 16:38:33 +01:00
Github Actions fcebdb6d6f [CI Skip] release/beta 4.0.4-4
skip-checks: true
2021-03-09 15:28:51 +00:00
Jaco Greeff 3d020b5159 Check types against fallbacks (#3293)
* Check types against fallbacks

* Only enable fallback check for latest
2021-03-09 16:17:49 +01:00
Github Actions 530d1bcd03 [CI Skip] release/beta 4.0.4-3
skip-checks: true
2021-03-09 14:48:18 +00:00
Jaco Greeff a4151c2941 Adjust for latest types (#3291) 2021-03-09 15:40:06 +01:00
Github Actions a801d30fb6 [CI Skip] release/beta 4.0.4-2
skip-checks: true
2021-03-09 10:00:17 +00:00
Jaco Greeff 1fe9b605dd Bump substrate metadata (#3289) 2021-03-09 10:49:42 +01:00
Github Actions ecfd822d94 [CI Skip] release/beta 4.0.4-1
skip-checks: true
2021-03-09 09:30:33 +00:00
Jaco Greeff a5e4d68993 Remove jest confix for rxjs (#3288) 2021-03-09 10:20:26 +01:00
Github Actions ca5c002d37 [CI Skip] release/beta 4.0.4-0
skip-checks: true
2021-03-09 08:27:13 +00:00
Jaco Greeff 6e28760da4 Remove explicit RpcCore interface (apply in API itself) (#3284)
* Remove explicit RpcCore interface (apply in API itself)

* Simplify

* Adjust test linting

* casting

* Remove stray eslint

* Re-add enable
2021-03-09 09:17:30 +01:00
Github Actions a253c4edb5 [CI Skip] release/stable 4.0.3
skip-checks: true
2021-03-08 21:20:51 +00:00
Jaco Greeff 7c96525d35 4.0.3 (#3287) 2021-03-08 22:11:42 +01:00
Zeke MostovandJaco Greeff 3f0457efc2 fix: Allow sudo for polkadot indexed proxy enum (#3286)
* fix: Allow sudo for polkadot indexed proxy enum

* Update packages/types-known/src/spec/polkadot.ts

Co-authored-by: Jaco Greeff <jacogr@gmail.com>
2021-03-08 22:00:35 +01:00
Github Actions bfb241d995 [CI Skip] release/stable 4.0.2
skip-checks: true
2021-03-08 14:23:22 +00:00
Jaco Greeff 314ad8c3f2 4.0.2 (#3283)
* 4.0.2

* Update CHANGELOG.md

* Bump common
2021-03-08 15:14:24 +01:00
Github Actions aa85371f82 [CI Skip] release/beta 4.0.2-0
skip-checks: true
2021-03-08 12:46:02 +00:00
Jaco Greeff d0a08dadd9 Add correct election Phase type (#3280) 2021-03-08 13:38:14 +01:00
Github Actions eeff764345 [CI Skip] release/stable 4.0.1
skip-checks: true
2021-03-07 15:47:19 +00:00
Jaco Greeff 4870ec4f40 4.0 (#3277)
* 4.0

* Correct patch
2021-03-07 16:37:47 +01:00
Github Actions 1c3cfbfa0c [CI Skip] release/beta 4.0.1-14
skip-checks: true
2021-03-07 15:10:20 +00:00
Jaco Greeff 3c9b7de6c7 Add createdAtHash to Codec interface (#3276)
* Add createdAtHash to Codec interface

* Adjust linkedHash (also on )

* createdAtHash
2021-03-07 16:00:30 +01:00
Github Actions 22e5488f16 [CI Skip] release/beta 4.0.1-13
skip-checks: true
2021-03-06 14:57:52 +00:00
Jaco Greeff b37887993e Westend 49 upgrade block (#3273) 2021-03-06 15:49:10 +01:00
Github Actions 75361cb0ff [CI Skip] release/beta 4.0.1-12
skip-checks: true
2021-03-06 07:21:18 +00:00
Jaco Greeff 894992bc4c Bump deps (#3272) 2021-03-06 08:12:35 +01:00
Github Actions d955fab169 [CI Skip] release/beta 4.0.1-11
skip-checks: true
2021-03-05 16:23:50 +00:00
Jaco Greeff 580d225387 Bump common (#3271) 2021-03-05 17:13:37 +01:00
Github Actions d48f59e48d [CI Skip] release/beta 4.0.1-10
skip-checks: true
2021-03-05 12:34:38 +00:00
Jaco Greeff 108b49ea03 Expose the hash field from contract wasm (#3267) 2021-03-05 13:25:00 +01:00
Github Actions 9295349886 [CI Skip] release/beta 4.0.1-9
skip-checks: true
2021-03-05 09:38:48 +00:00
Jaco Greeff a51658ffac Cater for at-genesis best headers (#3264) 2021-03-05 10:28:56 +01:00
Github Actions 47f08e9e04 [CI Skip] release/beta 4.0.1-8
skip-checks: true
2021-03-05 08:45:40 +00:00
iiiiiiiiandJaco Greeff 7906ae63dc Make unknownTypes externally accessible (#3263)
* Make unknownTypes externally accessible

* fix lint

* Update registry.ts

* Update registry.ts

* Update packages/types/src/types/registry.ts

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

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

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

Co-authored-by: Jaco Greeff <jacogr@gmail.com>
2021-03-05 09:36:01 +01:00
Github Actions 0e76271dba [CI Skip] release/beta 4.0.1-7
skip-checks: true
2021-03-04 08:04:33 +00:00
Jaco Greeff e117619e34 Use the parent header for era info (#3260) 2021-03-04 08:57:22 +01:00
Github Actions 67b416fe80 [CI Skip] release/beta 4.0.1-6
skip-checks: true
2021-03-04 07:13:35 +00:00
Jaco Greeff 78dbfa46fa AccountInfoWithTripleRefCount type & detection (#3228)
* AccountInfoWithTripleRefCount

* Update naming

* build
2021-03-04 08:03:25 +01:00
Github Actions 01db9261d5 [CI Skip] release/beta 4.0.1-5
skip-checks: true
2021-03-03 12:28:40 +00:00
Jaco Greeff 674c38b384 Enum serializes to camelCase (#3024)
* Enum serializes to camelCase

* Dedupe

* rewrite static json

* test for StorageKind enum
2021-03-03 13:18:07 +01:00
Github Actions 0700e824eb [CI Skip] release/beta 4.0.1-4
skip-checks: true
2021-03-03 09:12:10 +00:00
Jaco Greeff 0362eaf472 Bump deps (& berry) (#3259)
* Bump deps (& berry)

* new 4.2.2 linting issues
2021-03-03 10:03:46 +01:00
Github Actions 696b3964e6 [CI Skip] release/beta 4.0.1-3
skip-checks: true
2021-03-02 20:29:13 +00:00
Jaco Greeff 5d0c2eed7b Default build to type: module (#3253)
* Default build to type: module

* 4.0

* pre

* yarn.lock

* packageInfo

* Bump common

* jest & bumps

* additional
2021-03-02 21:19:55 +01:00
Github Actions e4c3289ad8 [CI Skip] release/beta 3.11.2-4
skip-checks: true
2021-03-01 20:51:04 +00:00
Jaco Greeff 4449bdae6f Bump deps (#3252) 2021-03-01 21:43:13 +01:00
Github Actions 064957db81 [CI Skip] release/beta 3.11.2-3
skip-checks: true
2021-03-01 16:07:02 +00:00
Jaco Greeff ccd89ef0a6 Trigger validator shash retrievals on Bonded events (#3251) 2021-03-01 16:57:27 +01:00
Github Actions 47beb5f41f [CI Skip] release/beta 3.11.2-2
skip-checks: true
2021-03-01 08:32:11 +00:00
Jaco Greeff 9f205392a3 Remove old RewardDestination type (#3246)
* Remove old RewardDestination type

* merge master

* adjust

* Adjust
2021-03-01 09:23:37 +01:00
Github Actions adce7ccbee [CI Skip] release/beta 3.11.2-1
skip-checks: true
2021-03-01 08:08:09 +00:00
Jaco Greeff b83b3a9437 Change default ValidatorPrefs (#3244)
* Change default ValidatorPrefs

* Linkage test

* Previous default
2021-03-01 08:59:38 +01:00
Github Actions 147dbcf24f [CI Skip] release/beta 3.11.2-0
skip-checks: true
2021-03-01 07:52:05 +00:00
Alex D 2afff1b41f Use derive customAccount and customLocks for balance overrides (#3248)
* 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

* renamed derive method name
2021-03-01 08:42:07 +01:00
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
686 changed files with 25469 additions and 12315 deletions
+19 -2
View File
@@ -1,7 +1,24 @@
25
29
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.0.2
4.0.3
4.6.2
4.7.2
+1 -3
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
const base = require('@polkadot/dev/config/eslint.cjs');
@@ -24,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'
}
+1 -1
View File
@@ -1 +1 @@
12
14
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.3.3.cjs
yarnPath: .yarn/releases/yarn-2.4.1.cjs
+546
View File
@@ -1,5 +1,551 @@
# CHANGELOG
## 4.8.1 May 2, 2021
Upgrade priority: Low. Recommended when using or developing for parachains.
Changes:
- De-alias xcm `Outcome` (used in multiple pallettes)
- Adjust xcm types as per latest, e.g. `XcmError`
- Fix generate of well-known storage keys (e.g. `:code`)
- Optimize metadata unknown type validation
- Allow metadata creation for `Map` or `Record`
- Expose additional camelCase `method` on `AbiMessage` (maps to decorated name)
- Added explicit double-byte ss58 `AccountId` encoding test
- Add known upgrade block for Polkadot v30
- Cleanup WebSocket handlers when close event has been received
- Update to latest Substrate metadata
## 4.7.2 Apr 26, 2021
Upgrade priority: Low. Recommended for users of 4.7.1 using nvm
Changes:
- Update `EthBlock`/`EthHeader` types (as per Rust origin)
- Updated Xcm `OriginKind` enum
- Add derives for `membership`
- Cleanups on encodedLength calculations
- Update `.nvmrc` to reflect engines changes
## 4.7.1 Apr 25, 2021
Upgrade priority: Low. Recommended for users following Substrate master.
Changes:
- Adjust Struct decoding with better error messages on invalid input objects
- Add support for new `BoundedVec` type
- Expand `Data` type (as used in identity), with all is/as getters
- Updated `Xcm` types (with Plularity)
- Adjust `DispatchError` type as per current Substrate master
- Adjusted Statemint `Proxy` type
- Remove metadata generation dependency on well-known.json (dedupe)
- Adjust WebSocket reconnection delay from 1s to 2.5s
- Revert Beefy keys addition for Westend
- Add explicit `engines` config to `package.json`
- Support for `None` in `RewardDestination`
- Align with latest substrate metadata
## 4.6.2 Apr 19, 2021
Upgrade priority: Low. Recommended for users of Kusama/Polkadot.
Changes:
- Correct Kusama/Polkadot runtime 30 session key definitions
## 4.6.1 Apr 19, 2021
Upgrade priority: Low. Recommended if used in a Node.js 15.x environment.
Changes:
- Assert keypair validity in signing operations
- Expose `internalError` on submittable results (e.g. event decoding errors)
- Simplify session derives for old/new
- Add Statemint to known types
- Add support for `rpc.beefy.subscribeJustifications`
- Update Xcm types
- Explicitly handle `isReadyOrError` with `Api.create`
- Add Kusama upgrade block for 2030
## 4.5.1 Apr 12, 2021
Upgrade priority: Low. Recommended with usage with the Rococo testnet.
Changes:
- Update parachain types as per latest Polkadot
- Cater for `Keys` with `BEEFY` session keys
- Update `Keys` injection to allow for on-chain type detection
- Add `Westend` known upgrade block for runtime 50
- Align types with latest Substrate master
- Adjust keepalive `system_health` timer
## 4.4.1 Apr 5, 2021
Upgrade priority: Low. Recommended with usage with the Rococo testnet.
Changes:
- Add `ServiceQuality` type for Cumulus
- Adjust XCM MultiLocation type (X5 to X8 junctions)
- Add Polkadot 29 upgrade block
## 4.3.1 Mar 29, 2021
Upgrade priority: Low.
Contributed:
- Fix documentation on ABI parameters (Thanks to https://github.com/vminkov)
Changes:
- Warn on usage of deprecated contract interfaces
- Update `ParaInfo` type
- Council should be optional in treasury derives
- Allow extraction of session derives indexes with no staking
## 4.2.1 Mar 22, 2021
Upgrade priority: Low. Recommended when tracking the latest updates from Substrate.
Contributed:
- Fix contract even decoding on Substrate 3 (Thanks to https://github.com/vminkov)
Changes:
- Adjust `Extender{Header, SignedBlock}` types to ensure at-block `Header` types are used
- Explicit definition for new Rococo triple refcount `AccountData` types
- Convert metadata private class fields to ES-private
- Adjust `SignedBlock` type for new `justifications` field
- Optimize society derive for multi accounts
- Bump metadata to latest substrate version
## 4.1.1 Mar 15, 2021
Upgrade priority: Low. Recommended when tracking the latest updates from Substrate.
Changes:
- Fix author extraction for last block in a session
- Expand `SignerPayload` to inject/expose custom signed extensions
- `ConsensusEngineId` formats non-Ascii engines correctly
- Allow `getBlock/Header` derives to use as-at registry (instead of latest)
- Cleanup `RpcCore` augmentation (removing TS warnings on typegen chains)
- Add upgrade block for Kusama 2029
- Ensure that type alias overrides also apply to map keys
- Check type generation against fallbacks (build-time only sanity check)
- Add `mmr_generateProof` RPC
- Align types with latest substrate master
- Apply latest Polkadot auctions/crowdloan/parachains/slots types
## 4.0.3 Mar 8, 2021
Upgrade priority: Low. Recommended if you use the API to sync the full chain, most notably Polkadot.
Contributed:
- Re-add unused historical `SudoBalances` to `ProxyType` (Thanks to https://github.com/emostov)
## 4.0.2 Mar 8, 2021
Upgrade priority: High. Required if you are using 4.0.1 in a Node.js environment.
Changes:
- Fix import from `@polkadot/x-rxjs` in Node environments (From common)
- Add correct types for `Phase` is new validator elections module
## 4.0.1 Mar 7, 2021
Upgrade priority: Low. Recommended for users wanting to keep updated with chain changes.
**Important** In the 4.0 version the default package type has been changed to ESM modules by default. This should not affect usage, however since the output formats changed, a new major version is required.
Contributed:
- Expose `unknownTypes` on the registry interface (Thanks to https://github.com/ii-ii-ii)
Changes:
- Build to ESM by default (with cjs versions via export map)
- Enum `.toSON()` now encodes all keys as `camelCase` (aligning with the output from Substrate)
- Add `createdAtHash?: Hash` to `Codec` interface (filled-in by storage retrievals)
- Expose the source hash as `wamHash` on Abi parsed instances
- Use `parentHash` when creating mortal era (handles frequent forks better)
- Add `AccountInfoWithTripleRefCount` to cater for latest Substrate
- Add upgrade block for Westend 49
## 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.
+3 -19
View File
@@ -7,7 +7,7 @@
# @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.
@@ -21,26 +21,10 @@ 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/metadata](packages/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/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)
+1 -1
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-config-cjs.cjs');
+5 -4
View File
@@ -1,9 +1,10 @@
// Copyright 2017-2020 @polkadot/api authors & contributors
// Copyright 2017-2021 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0
const config = require('@polkadot/dev/config/jest.cjs');
module.exports = Object.assign({}, config, {
module.exports = {
...config,
moduleNameMapper: {
'@polkadot/api-(contract|derive)(.*)$': '<rootDir>/packages/api-$1/src/$2',
// eslint-disable-next-line sort-keys
@@ -26,5 +27,5 @@ module.exports = Object.assign({}, config, {
'<rootDir>/packages/types/build',
'<rootDir>/packages/types-known/build'
],
resolver: '@polkadot/dev/config/jest-resolver.cjs'
});
transformIgnorePatterns: ['/node_modules/(?!@polkadot|@babel/runtime/helpers/esm/)']
};
+12 -10
View File
@@ -3,14 +3,16 @@
"author": "Jaco Greeff <jacogr@gmail.com>",
"license": "Apache-2",
"private": true,
"type": "commonjs",
"workspaces": [
"packages/*"
],
"resolutions": {
"typescript": "^4.0.5"
"typescript": "^4.2.4"
},
"scripts": {
"build": "yarn build:interfaces && polkadot-dev-build-ts && (cd packages/typegen && copyfiles scripts/* build)",
"build": "yarn build:interfaces && polkadot-dev-build-ts",
"build:extra": "(cd packages/typegen && copyfiles scripts/* build)",
"build:interfaces": "polkadot-types-internal-interfaces",
"build:release": "polkadot-ci-ghact-build",
"docs:metadata": "polkadot-types-internal-metadata",
@@ -23,14 +25,14 @@
"test:watch": "polkadot-dev-run-test --watch"
},
"devDependencies": {
"@babel/core": "^7.12.3",
"@babel/register": "^7.12.1",
"@babel/runtime": "^7.12.5",
"@polkadot/dev": "^0.60.2",
"@polkadot/ts": "^0.3.55",
"@babel/core": "^7.14.0",
"@babel/register": "^7.13.16",
"@babel/runtime": "^7.14.0",
"@polkadot/dev": "^0.62.11",
"@polkadot/ts": "^0.3.64",
"@polkadot/typegen": "workspace:packages/typegen",
"@types/jest": "^26.0.15",
"copyfiles": "^2.4.0"
"@types/jest": "^26.0.23",
"copyfiles": "^2.4.1"
},
"version": "2.7.1"
"version": "4.8.1"
}
+1 -1
View File
@@ -8,7 +8,7 @@ import { Abi } from '@polkadot/api-contract';
const wsProvider = new WsProvider(<...Node Url...>);
const api = await ApiPromise.create({ provider: wsProvider });
const abi = new Abi(api.registry, <...JSON ABI...>);
const abi = new Abi(<...JSON ABI...>, api.registry.getChainProperties());
api.tx.contracts
.call(<contract addr>, <value>, <max gas>, abi.messages.<method name>(<...params...>))
+14 -11
View File
@@ -1,13 +1,16 @@
{
"name": "@polkadot/api-contract",
"version": "2.7.1",
"version": "4.8.1",
"type": "module",
"description": "Interfaces for interacting with contracts and contract ABIs",
"main": "index.js",
"sideEffects": false,
"keywords": [
"Polkadot",
"ABI"
"sideEffects": [
"./detectPackage.js",
"./detectPackage.cjs"
],
"engines": {
"node": ">=14.0.0"
},
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [],
"contributors": [],
@@ -16,11 +19,11 @@
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
"dependencies": {
"@babel/runtime": "^7.12.5",
"@polkadot/api": "2.7.1",
"@polkadot/types": "2.7.1",
"@polkadot/util": "^4.1.1",
"bn.js": "^5.1.3",
"rxjs": "^6.6.3"
"@babel/runtime": "^7.14.0",
"@polkadot/api": "4.8.1",
"@polkadot/types": "4.8.1",
"@polkadot/util": "^6.3.1",
"@polkadot/x-rxjs": "^6.3.1",
"bn.js": "^4.11.9"
}
}
+23 -2
View File
@@ -1,11 +1,18 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Abi } from '.';
import { blake2AsHex } from '@polkadot/util-crypto';
import abis from '../test/contracts';
import { Abi } from '.';
interface JSONAbi {
source: {
compiler: string,
hash: string,
language: string,
wasm: string
},
spec: {
messages: {
name: string[] | string
@@ -28,4 +35,18 @@ describe('Abi', (): void => {
}
});
});
it('has the correct hash for the source', (): void => {
const bundle = abis.ink_flipperBundle as JSONAbi;
const abi = new Abi(bundle as any);
// manual
expect(bundle.source.hash).toEqual(blake2AsHex(bundle.source.wasm));
// the Codec hash
expect(bundle.source.hash).toEqual(abi.project.source.wasm.hash.toHex());
// the hash as per the actual Abi
expect(bundle.source.hash).toEqual(abi.project.source.wasmHash.toHex());
});
});
+13 -11
View File
@@ -1,12 +1,12 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { AnyJson, Codec, CodecArg } from '@polkadot/types/types';
import { ChainProperties, ContractConstructorSpec, ContractEventSpec, ContractMessageSpec, ContractMessageParamSpec, ContractProject } from '@polkadot/types/interfaces';
import { AbiConstructor, AbiEvent, AbiMessage, AbiParam, DecodedEvent, DecodedMessage } from './types';
import type { Bytes } from '@polkadot/types';
import type { ChainProperties, ContractConstructorSpec, ContractEventSpec, ContractMessageParamSpec, ContractMessageSpec, ContractProject } from '@polkadot/types/interfaces';
import type { AnyJson, Codec, CodecArg } from '@polkadot/types/types';
import type { AbiConstructor, AbiEvent, AbiMessage, AbiParam, DecodedEvent, DecodedMessage } from './types';
import { Bytes } from '@polkadot/types';
import { assert, assertReturn, compactAddLength, compactStripLength, isNumber, isObject, isString, logger, stringCamelCase, u8aConcat, u8aToHex } from '@polkadot/util';
import { assert, assertReturn, compactAddLength, compactStripLength, isNumber, isObject, isString, logger, stringCamelCase, stringify, u8aConcat, u8aToHex } from '@polkadot/util';
import { MetaRegistry } from './MetaRegistry';
@@ -21,7 +21,7 @@ function findMessage <T extends AbiMessage> (list: T[], messageOrId: T | string
? list.find(({ identifier }) => [identifier, stringCamelCase(identifier)].includes(messageOrId.toString()))
: messageOrId;
return assertReturn(message, `Attempted to call an invalid contract interface, ${JSON.stringify(messageOrId)}`);
return assertReturn(message, `Attempted to call an invalid contract interface, ${stringify(messageOrId)}`);
}
export class Abi {
@@ -81,7 +81,7 @@ export class Abi {
const index = data[0];
const event = this.#events[index];
assert(event, `Unable to find event with index ${index}`);
assert(event, () => `Unable to find event with index ${index}`);
return event.fromU8a(data.subarray(1));
}
@@ -118,7 +118,7 @@ export class Abi {
type: this.registry.getMetaTypeDef(arg.type)
};
} catch (error) {
l.error(`Error expanding argument ${index} in ${JSON.stringify(spec)}`);
l.error(`Error expanding argument ${index} in ${stringify(spec)}`);
throw error;
}
@@ -143,6 +143,7 @@ export class Abi {
#createMessage = (spec: ContractMessageSpec | ContractConstructorSpec, index: number, add: Partial<AbiMessage> = {}): AbiMessage => {
const args = this.#createArgs(spec.args, spec);
const identifier = spec.name.toString();
const message = {
...add,
args,
@@ -151,8 +152,9 @@ export class Abi {
args: this.#decodeArgs(args, data),
message
}),
identifier: spec.name.toString(),
identifier,
index,
method: stringCamelCase(identifier),
selector: spec.selector,
toU8a: (params: CodecArg[], additional?: Uint8Array) =>
this.#encodeArgs(spec, args, params, additional)
@@ -186,7 +188,7 @@ export class Abi {
}
#encodeArgs = ({ name, selector }: ContractMessageSpec | ContractConstructorSpec, args: AbiParam[], data: CodecArg[], additional = EMPTY_U8A): Uint8Array => {
assert(data.length === args.length, `Expected ${args.length} arguments to contract message '${name.toString()}', found ${data.length}`);
assert(data.length === args.length, () => `Expected ${args.length} arguments to contract message '${name.toString()}', found ${data.length}`);
return compactAddLength(
u8aConcat(
@@ -1,12 +1,11 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import fs from 'fs';
import path from 'path';
import { Abi } from '.';
import abis from '../test/contracts';
import { Abi } from '.';
describe('MetaRegistry', (): void => {
Object.keys(abis).forEach((abiName) => {
+7 -6
View File
@@ -1,11 +1,12 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ContractDisplayName, ChainProperties, SiField, SiLookupTypeId, SiType, SiTypeDefArray, SiTypeDefVariant, SiTypeDefSequence, SiTypeDefTuple, SiVariant } from '@polkadot/types/interfaces';
import { InterfaceTypes, TypeDef, TypeDefInfo } from '@polkadot/types/types';
import type { ChainProperties, ContractDisplayName, SiField, SiLookupTypeId, SiType, SiTypeDefArray, SiTypeDefSequence, SiTypeDefTuple, SiTypeDefVariant, SiVariant } from '@polkadot/types/interfaces';
import type { InterfaceTypes, TypeDef } from '@polkadot/types/types';
import { assert, isUndefined } from '@polkadot/util';
import { TypeRegistry, withTypeString } from '@polkadot/types/create';
import { TypeDefInfo } from '@polkadot/types/types';
import { assert, isUndefined } from '@polkadot/util';
interface PartialTypeSpec {
readonly type: SiLookupTypeId;
@@ -79,7 +80,7 @@ export class MetaRegistry extends TypeRegistry {
#getMetaType = (id: SiLookupTypeId): SiType => {
const type = this.#siTypes[getRegistryOffset(id)];
assert(!isUndefined(type), `getMetaType:: Unable to find ${id.toNumber()} in type values`);
assert(!isUndefined(type), () => `getMetaType:: Unable to find ${id.toNumber()} in type values`);
return this.createType('SiType', type);
}
@@ -183,7 +184,7 @@ export class MetaRegistry extends TypeRegistry {
}
#extractSequence = ({ type }: SiTypeDefSequence, id: SiLookupTypeId): Omit<TypeDef, 'type'> => {
assert(!!type, `ContractRegistry: Invalid sequence type found at id ${id.toString()}`);
assert(!!type, () => `ContractRegistry: Invalid sequence type found at id ${id.toString()}`);
return {
info: TypeDefInfo.Vec,
+4 -4
View File
@@ -1,8 +1,8 @@
// Copyright 2017-2020 @polkadot/api authors & contributors
// Copyright 2017-2021 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ApiTypes, DecorateMethod } from '@polkadot/api/types';
import { AnyJson, Registry } from '@polkadot/types/types';
import type { ApiTypes, DecorateMethod } from '@polkadot/api/types';
import type { AnyJson, Registry } from '@polkadot/types/types';
import { ApiBase } from '@polkadot/api/base';
import { assert } from '@polkadot/util';
@@ -26,6 +26,6 @@ export abstract class Base<ApiType extends ApiTypes> {
this.registry = this.abi.registry;
this._decorateMethod = decorateMethod;
assert(this.api.rx.tx.contracts && this.api.rx.tx.contracts.putCode, 'You need to connect to a node with the contracts module, the metadata does not enable api.tx.contracts on this instance');
assert(api.rx.tx.contracts?.instantiate, 'You need to connect to a node with the contracts module, the metadata does not enable api.tx.contracts on this instance');
}
}
+17 -45
View File
@@ -1,48 +1,22 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ApiTypes, DecorateMethod } from '@polkadot/api/types';
import { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
import { AccountId, EventRecord, Hash } from '@polkadot/types/interfaces';
import { AnyJson, CodecArg, ISubmittableResult } from '@polkadot/types/types';
import { AbiConstructor, BlueprintOptions } from '../types';
import { BlueprintDeploy, ContractGeneric, MapConstructorExec } from './types';
import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
import type { ApiTypes, DecorateMethod } from '@polkadot/api/types';
import type { AccountId, EventRecord, Hash } from '@polkadot/types/interfaces';
import type { AnyJson, CodecArg, ISubmittableResult } from '@polkadot/types/types';
import type { AbiConstructor, BlueprintOptions } from '../types';
import type { ContractGeneric, MapConstructorExec } from './types';
import BN from 'bn.js';
import { SubmittableResult } from '@polkadot/api';
import { ApiBase } from '@polkadot/api/base';
import { Bytes } from '@polkadot/types';
import { isUndefined, stringCamelCase, compactAddLength, u8aToU8a } from '@polkadot/util';
import { randomAsU8a } from '@polkadot/util-crypto';
import { isUndefined } from '@polkadot/util';
import { Abi } from '../Abi';
import { applyOnEvent, extractOptions, isOptions } from '../util';
import { applyOnEvent } from '../util';
import { Base } from './Base';
import { Contract } from './Contract';
const EMPTY_SALT = new Uint8Array();
function createTx <ApiType extends ApiTypes> (fn: (options: BlueprintOptions, params: CodecArg[]) => SubmittableExtrinsic<ApiType, BlueprintSubmittableResult<ApiType>>): BlueprintDeploy<ApiType> {
return (options: BigInt | string | number | BN | BlueprintOptions, ...params: CodecArg[]): SubmittableExtrinsic<ApiType, BlueprintSubmittableResult<ApiType>> =>
isOptions(options)
? fn(options, params)
: fn(...extractOptions(options, params));
}
function createWithId <T> (fn: (constructorOrId: AbiConstructor | string | number, options: BlueprintOptions, params: CodecArg[]) => T): ContractGeneric<BlueprintOptions, T> {
return (constructorOrId: AbiConstructor | string | number, options: BigInt | string | number | BN | BlueprintOptions, ...params: CodecArg[]): T =>
isOptions(options)
? fn(constructorOrId, options, params)
: fn(constructorOrId, ...extractOptions(options, params));
}
function encodeSalt (salt: Uint8Array | string | null = randomAsU8a()) {
return salt instanceof Bytes
? salt
: salt && salt.length
? compactAddLength(u8aToU8a(salt))
: EMPTY_SALT;
}
import { createBluePrintTx, createBluePrintWithId, EMPTY_SALT, encodeSalt } from './util';
export class BlueprintSubmittableResult<ApiType extends ApiTypes> extends SubmittableResult {
public readonly contract?: Contract<ApiType>;
@@ -72,13 +46,11 @@ export class Blueprint<ApiType extends ApiTypes> extends Base<ApiType> {
super(api, abi, decorateMethod);
this.codeHash = this.registry.createType('Hash', codeHash);
this.createContract = createWithId(this.#deploy);
this.createContract = createBluePrintWithId(this.#deploy);
this.abi.constructors.forEach((c): void => {
const messageName = stringCamelCase(c.identifier);
if (isUndefined(this.#tx[messageName])) {
this.#tx[messageName] = createTx((o, p) => this.#deploy(c, o, p));
if (isUndefined(this.#tx[c.method])) {
this.#tx[c.method] = createBluePrintTx((o, p) => this.#deploy(c, o, p));
}
});
}
@@ -87,18 +59,18 @@ export class Blueprint<ApiType extends ApiTypes> extends Base<ApiType> {
return this.#tx;
}
#deploy = (constructorOrId: AbiConstructor | string| number, { gasLimit = 0, salt, value = 0 }: BlueprintOptions, params: CodecArg[]): SubmittableExtrinsic<ApiType, BlueprintSubmittableResult<ApiType>> => {
#deploy = (constructorOrId: AbiConstructor | string | number, { gasLimit = 0, salt, value = 0 }: BlueprintOptions, params: CodecArg[]): SubmittableExtrinsic<ApiType, BlueprintSubmittableResult<ApiType>> => {
const encodedSalt = encodeSalt(salt);
const withSalt = this.api.tx.contracts.instantiate.meta.args.length === 5;
const encoded = this.abi.findConstructor(constructorOrId).toU8a(params, withSalt ? EMPTY_SALT : encodedSalt);
const tx = withSalt
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore new style with salt included
? this.api.tx.contracts.instantiate(value, gasLimit, this.codeHash, encoded, encodedSalt)
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore old style with salt included
: this.api.tx.contracts.instantiate(value, gasLimit, this.codeHash, encoded);
return tx.withResultTransform((result: ISubmittableResult) =>
new BlueprintSubmittableResult(result, applyOnEvent(result, 'Instantiated', ([record]: EventRecord[]) =>
new BlueprintSubmittableResult(result, applyOnEvent(result, ['Instantiated'], ([record]: EventRecord[]) =>
new Contract<ApiType>(this.api, this.abi, record.event.data[1] as AccountId, this._decorateMethod)
))
);
+3 -2
View File
@@ -1,14 +1,15 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import fs from 'fs';
import path from 'path';
import { decorateMethod } from '@polkadot/api/promise';
import contractFlipper from '../../test/contracts/ink/flipper.contract.json';
import abiFlipper from '../../test/contracts/ink/flipper.json';
import { mockApi } from './mock';
import { Code } from './Code';
import { mockApi } from './mock';
const wasmFlipper = fs.readFileSync(path.join(__dirname, '../../test/contracts/ink/flipper.wasm'));
+75 -15
View File
@@ -1,33 +1,44 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ApiTypes, DecorateMethod } from '@polkadot/api/types';
import { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
import { EventRecord, Hash } from '@polkadot/types/interfaces';
import { AnyJson, ISubmittableResult } from '@polkadot/types/types';
import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
import type { ApiTypes, DecorateMethod } from '@polkadot/api/types';
import type { EventRecord } from '@polkadot/types/interfaces';
import type { AnyJson, CodecArg, ISubmittableResult } from '@polkadot/types/types';
import type { AbiConstructor, BlueprintOptions } from '../types';
import type { MapConstructorExec } from './types';
import { SubmittableResult } from '@polkadot/api';
import { ApiBase } from '@polkadot/api/base';
import { assert, compactAddLength, isWasm, u8aToU8a } from '@polkadot/util';
import { assert, compactAddLength, isFunction, isUndefined, isWasm, logger, u8aToU8a } from '@polkadot/util';
import { blake2AsU8a } from '@polkadot/util-crypto';
import { Abi } from '../Abi';
import { applyOnEvent } from '../util';
import { Base } from './Base';
import { Blueprint } from './Blueprint';
import { Contract } from './Contract';
import { createBluePrintTx, EMPTY_SALT, encodeSalt } from './util';
const l = logger('Code');
export class CodeSubmittableResult<ApiType extends ApiTypes> extends SubmittableResult {
public readonly blueprint?: Blueprint<ApiType>;
public readonly contract?: Contract<ApiType>;
constructor (result: ISubmittableResult, blueprint?: Blueprint<ApiType>) {
constructor (result: ISubmittableResult, blueprint?: Blueprint<ApiType>, contract?: Contract<ApiType>) {
super(result);
this.blueprint = blueprint;
this.contract = contract;
}
}
export class Code<ApiType extends ApiTypes> extends Base<ApiType> {
public readonly code: Uint8Array;
readonly #tx: MapConstructorExec<ApiType> = {};
constructor (api: ApiBase<ApiType>, abi: AnyJson | Abi, wasm: Uint8Array | string | Buffer | null | undefined, decorateMethod: DecorateMethod<ApiType>) {
super(api, abi, decorateMethod);
@@ -36,18 +47,67 @@ export class Code<ApiType extends ApiTypes> extends Base<ApiType> {
: u8aToU8a(wasm);
assert(isWasm(this.code), 'No WASM code provided');
this.abi.constructors.forEach((c): void => {
if (isUndefined(this.#tx[c.method])) {
this.#tx[c.method] = createBluePrintTx((o, p) => this.#instantiate(c, o, p));
}
});
}
public get tx (): MapConstructorExec<ApiType> {
return this.#tx;
}
/**
* @description Deploy the code bundle, creating a Blueprint.
* @description Deploy the code bundle and the contract, creating a Blueprint.
* @deprecated Use the `code.tx.<constructor>(...) format to put code and deploy
*/
public createBlueprint (): SubmittableExtrinsic<ApiType, CodeSubmittableResult<ApiType>> {
public createContract (constructorOrId: AbiConstructor | string | number, options: BlueprintOptions, params: CodecArg[]): SubmittableExtrinsic<ApiType, CodeSubmittableResult<ApiType>> {
l.warn('.createContract is deprecated, use code.tx.<constructorName>(...) instead (where code refers to this instance)');
return this.#instantiate(constructorOrId, options, params);
}
#instantiate = (constructorOrId: AbiConstructor | string | number, options: BlueprintOptions, params: CodecArg[]): SubmittableExtrinsic<ApiType, CodeSubmittableResult<ApiType>> => {
return isFunction(this.api.tx.contracts.instantiateWithCode)
? this.#instantiateCurrent(constructorOrId, options, params)
: this.#instantiatePrev(constructorOrId, options, params);
}
#instantiateCurrent = (constructorOrId: AbiConstructor | string | number, { gasLimit = 0, salt, value = 0 }: BlueprintOptions, params: CodecArg[]): SubmittableExtrinsic<ApiType, CodeSubmittableResult<ApiType>> => {
return this.api.tx.contracts
.putCode(compactAddLength(this.code))
.withResultTransform((result: ISubmittableResult) =>
new CodeSubmittableResult(result, applyOnEvent(result, 'CodeStored', ([record]: EventRecord[]) =>
new Blueprint<ApiType>(this.api, this.abi, record.event.data[0] as Hash, this._decorateMethod)
))
);
.instantiateWithCode(value, gasLimit, compactAddLength(this.code), this.abi.findConstructor(constructorOrId).toU8a(params), encodeSalt(salt))
.withResultTransform(this.#transformEvents);
}
#instantiatePrev = (constructorOrId: AbiConstructor | string | number, { gasLimit = 0, salt, value = 0 }: BlueprintOptions, params: CodecArg[]): SubmittableExtrinsic<ApiType, CodeSubmittableResult<ApiType>> => {
assert(isFunction(this.api.tx.utility?.batch), 'Your chain does not include the utility pallet, for contracts v2 deployment, this is required');
const encodedSalt = encodeSalt(salt);
const withSalt = this.api.tx.contracts.instantiate.meta.args.length === 5;
const encoded = this.abi.findConstructor(constructorOrId).toU8a(params, withSalt ? EMPTY_SALT : encodedSalt);
const codeHash = blake2AsU8a(this.code);
return this.api.tx.utility.batch([
this.api.tx.contracts.putCode(compactAddLength(this.code)),
withSalt
? this.api.tx.contracts.instantiate(value, gasLimit, codeHash, encoded, encodedSalt)
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore old style with salt included in the params itself
: this.api.tx.contracts.instantiate(value, gasLimit, codeHash, encoded)
]).withResultTransform(this.#transformEvents);
}
#transformEvents = (result: ISubmittableResult): CodeSubmittableResult<ApiType> => {
return new CodeSubmittableResult(result, ...(applyOnEvent(result, ['CodeStored', 'Instantiated'], (records: EventRecord[]) =>
records.reduce(([blueprint, contract], { event }): [Blueprint<ApiType>?, Contract<ApiType>?] =>
this.api.events.contracts.Instantiated.is(event)
? [blueprint, new Contract<ApiType>(this.api, this.abi, event.data[1], this._decorateMethod)]
: this.api.events.contracts.CodeStored.is(event)
? [new Blueprint<ApiType>(this.api, this.abi, event.data[0], this._decorateMethod), contract]
: [blueprint, contract],
[] as [Blueprint<ApiType>?, Contract<ApiType>?])
) || []));
}
}
+30 -23
View File
@@ -1,19 +1,20 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ApiTypes, DecorateMethod } from '@polkadot/api/types';
import { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
import { AccountId, ContractExecResult, EventRecord } from '@polkadot/types/interfaces';
import { AnyJson, CodecArg, ISubmittableResult, Registry } from '@polkadot/types/types';
import { AbiMessage, ContractCallOutcome, ContractOptions, DecodedEvent } from '../types';
import { ContractCallResult, ContractCallSend, ContractGeneric, ContractQuery, ContractTx, MapMessageQuery, MapMessageTx } from './types';
import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
import type { ApiTypes, DecorateMethod } from '@polkadot/api/types';
import type { Bytes } from '@polkadot/types';
import type { AccountId, ContractExecResult, EventRecord, Weight } from '@polkadot/types/interfaces';
import type { AnyJson, CodecArg, ISubmittableResult, Registry } from '@polkadot/types/types';
import type { AbiMessage, ContractCallOutcome, ContractOptions, DecodedEvent } from '../types';
import type { ContractCallResult, ContractCallSend, ContractGeneric, ContractQuery, ContractTx, MapMessageQuery, MapMessageTx } from './types';
import BN from 'bn.js';
import { map } from 'rxjs/operators';
import { SubmittableResult } from '@polkadot/api';
import { ApiBase } from '@polkadot/api/base';
import { Bytes } from '@polkadot/types';
import { assert, bnToBn, isFunction, isUndefined, logger, stringCamelCase } from '@polkadot/util';
import { assert, bnToBn, isFunction, isUndefined, logger } from '@polkadot/util';
import { map } from '@polkadot/x-rxjs/operators';
import { Abi } from '../Abi';
import { applyOnEvent, extractOptions, formatData, isOptions } from '../util';
@@ -22,6 +23,7 @@ import { Base } from './Base';
// As per Rust, 5 * GAS_PER_SEC
const MAX_CALL_GAS = new BN(5_000_000_000_000).subn(1);
const ERROR_NO_CALL = 'Your node does not expose the contracts.call RPC. This is most probably due to a runtime configuration.';
const l = logger('Contract');
function createQuery <ApiType extends ApiTypes> (fn: (origin: string | AccountId | Uint8Array, options: ContractOptions, params: CodecArg[]) => ContractCallResult<ApiType, ContractCallOutcome>): ContractQuery<ApiType> {
@@ -38,11 +40,14 @@ function createTx <ApiType extends ApiTypes> (fn: (options: ContractOptions, par
: fn(...extractOptions(options, params));
}
function createWithId <T> (fn: (messageOrId: AbiMessage | string | number, options: ContractOptions, params: CodecArg[]) => T): ContractGeneric<ContractOptions, T> {
return (messageOrId: AbiMessage | string | number, options: BigInt | string | number | BN | ContractOptions, ...params: CodecArg[]): T =>
isOptions(options)
function createWithId <T> (fn: (messageOrId: AbiMessage | string | number, options: ContractOptions, params: CodecArg[]) => T, warn?: string): ContractGeneric<ContractOptions, T> {
return (messageOrId: AbiMessage | string | number, options: BigInt | string | number | BN | ContractOptions, ...params: CodecArg[]): T => {
warn && l.warn(warn);
return isOptions(options)
? fn(messageOrId, options, params)
: fn(messageOrId, ...extractOptions(options, params));
};
}
export class ContractSubmittableResult extends SubmittableResult {
@@ -108,18 +113,16 @@ export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
super(api, abi, decorateMethod);
this.address = this.registry.createType('AccountId', address);
this.exec = createWithId(this.#exec);
this.read = createWithId(this.#read);
this.exec = createWithId(this.#exec, '.exec is deprecated, use contract.tx.<messageName>(...) instead (where contract refers to this instance)');
this.read = createWithId(this.#read, '.read is deprecated, use contract.query.<messageName>(...) instead (where contract refers to this instance)');
this.abi.messages.forEach((m): void => {
const messageName = stringCamelCase(m.identifier);
if (isUndefined(this.#tx[messageName])) {
this.#tx[messageName] = createTx((o, p) => this.#exec(m, o, p));
if (isUndefined(this.#tx[m.method])) {
this.#tx[m.method] = createTx((o, p) => this.#exec(m, o, p));
}
if (isUndefined(this.#query[messageName])) {
this.#query[messageName] = createQuery((f, o, p) => this.#read(m, o, p).send(f));
if (isUndefined(this.#query[m.method])) {
this.#query[m.method] = createQuery((f, o, p) => this.#read(m, o, p).send(f));
}
});
}
@@ -144,7 +147,10 @@ export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
return gasLimit.lten(0)
? isCall
? MAX_CALL_GAS
: this.api.consts.system.maximumBlockWeight.muln(64).divn(100)
: (this.api.consts.system.blockWeights
? this.api.consts.system.blockWeights.maxBlock
: this.api.consts.system.maximumBlockWeight as Weight
).muln(64).divn(100)
: gasLimit;
}
@@ -152,7 +158,8 @@ export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
return this.api.tx.contracts
.call(this.address, value, this.#getGas(gasLimit), this.abi.findMessage(messageOrId).toU8a(params))
.withResultTransform((result: ISubmittableResult) =>
new ContractSubmittableResult(result, applyOnEvent(result, 'ContractExecution', (records: EventRecord[]) =>
// ContractEmitted is the current generation, ContractExecution is the previous generation
new ContractSubmittableResult(result, applyOnEvent(result, ['ContractEmitted', 'ContractExecution'], (records: EventRecord[]) =>
records
.map(({ event: { data: [, data] } }): DecodedEvent | null => {
try {
+1 -1
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
export { Blueprint, BlueprintSubmittableResult } from './Blueprint';
+4 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ApiBase } from '@polkadot/api/base';
@@ -11,6 +11,9 @@ export const mockApi = {
rx: {
tx: {
contracts: {
instantiate: (): never => {
throw new Error('mock');
},
putCode: (): never => {
throw new Error('mock');
}
+8 -9
View File
@@ -1,14 +1,13 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ApiTypes, ObsInnerType } from '@polkadot/api/types';
import { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
import { AccountId } from '@polkadot/types/interfaces';
import { CodecArg } from '@polkadot/types/types';
import { AbiMessage, BlueprintOptions, ContractCallOutcome, ContractOptions } from '../types';
import BN from 'bn.js';
import { Observable } from 'rxjs';
import type BN from 'bn.js';
import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
import type { ApiTypes, ObsInnerType } from '@polkadot/api/types';
import type { AccountId } from '@polkadot/types/interfaces';
import type { CodecArg } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { AbiMessage, BlueprintOptions, ContractCallOutcome, ContractOptions } from '../types';
export interface BlueprintDeploy<ApiType extends ApiTypes> {
(options: BlueprintOptions, ...params: CodecArg[]): SubmittableExtrinsic<ApiType>;
+41
View File
@@ -0,0 +1,41 @@
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { SubmittableResult } from '@polkadot/api';
import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
import type { ApiTypes } from '@polkadot/api/types';
import type { CodecArg } from '@polkadot/types/types';
import type { AbiConstructor, BlueprintOptions } from '../types';
import type { BlueprintDeploy, ContractGeneric } from './types';
import BN from 'bn.js';
import { Bytes } from '@polkadot/types';
import { compactAddLength, u8aToU8a } from '@polkadot/util';
import { randomAsU8a } from '@polkadot/util-crypto';
import { extractOptions, isOptions } from '../util';
export const EMPTY_SALT = new Uint8Array();
export function createBluePrintTx <ApiType extends ApiTypes, R extends SubmittableResult> (fn: (options: BlueprintOptions, params: CodecArg[]) => SubmittableExtrinsic<ApiType, R>): BlueprintDeploy<ApiType> {
return (options: BigInt | string | number | BN | BlueprintOptions, ...params: CodecArg[]): SubmittableExtrinsic<ApiType, R> =>
isOptions(options)
? fn(options, params)
: fn(...extractOptions(options, params));
}
export function createBluePrintWithId <T> (fn: (constructorOrId: AbiConstructor | string | number, options: BlueprintOptions, params: CodecArg[]) => T): ContractGeneric<BlueprintOptions, T> {
return (constructorOrId: AbiConstructor | string | number, options: BigInt | string | number | BN | BlueprintOptions, ...params: CodecArg[]): T =>
isOptions(options)
? fn(constructorOrId, options, params)
: fn(constructorOrId, ...extractOptions(options, params));
}
export function encodeSalt (salt: Uint8Array | string | null = randomAsU8a()): Uint8Array {
return salt instanceof Bytes
? salt
: salt && salt.length
? compactAddLength(u8aToU8a(salt))
: EMPTY_SALT;
}
@@ -1,10 +1,10 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Simple non-runnable checks to test type definitions in the editor itself
import { ApiPromise } from '@polkadot/api';
import { TestKeyringMap, createTestPairs } from '@polkadot/keyring/testingPairs';
import { createTestPairs, TestKeyringMap } from '@polkadot/keyring/testingPairs';
import abiIncrementer from '../test/contracts/ink/incrementer.json';
import { BlueprintPromise, ContractPromise } from '.';
@@ -37,7 +37,9 @@ async function checkContract (api: ApiPromise, pairs: TestKeyringMap): Promise<v
}
async function main (): Promise<void> {
const api = await ApiPromise.create();
const api = await ApiPromise.create({
hasher: (data: Uint8Array): Uint8Array => data
});
const pairs = createTestPairs();
// eslint-disable-next-line @typescript-eslint/no-floating-promises
@@ -0,0 +1,10 @@
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { packageInfo as apiInfo } from '@polkadot/api/packageInfo';
import { packageInfo as typesInfo } from '@polkadot/types/packageInfo';
import { detectPackage } from '@polkadot/util';
import { packageInfo } from './packageInfo';
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname, [apiInfo, typesInfo]);
+5 -3
View File
@@ -1,7 +1,9 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
export { Abi } from './Abi';
import './detectPackage';
export { Blueprint as BlueprintRx, Code as CodeRx, Contract as ContractRx } from './rx';
export { Abi } from './Abi';
export { packageInfo } from './packageInfo';
export { Blueprint as BlueprintPromise, Code as CodePromise, Contract as ContractPromise } from './promise';
export { Blueprint as BlueprintRx, Code as CodeRx, Contract as ContractRx } from './rx';
+6
View File
@@ -0,0 +1,6 @@
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/api-contract', version: '4.8.1' };
@@ -1,8 +1,8 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Hash } from '@polkadot/types/interfaces';
import { AnyJson } from '@polkadot/types/types';
import type { Hash } from '@polkadot/types/interfaces';
import type { AnyJson } from '@polkadot/types/types';
import { ApiPromise } from '@polkadot/api';
import { decorateMethod } from '@polkadot/api/promise';
+4 -3
View File
@@ -1,9 +1,10 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ApiPromise } from '@polkadot/api';
import type { ApiPromise } from '@polkadot/api';
import type { AnyJson } from '@polkadot/types/types';
import { decorateMethod } from '@polkadot/api/promise';
import { AnyJson } from '@polkadot/types/types';
import { Abi } from '../Abi';
import { Code as BaseCode } from '../base';
@@ -1,8 +1,8 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { AccountId } from '@polkadot/types/interfaces';
import { AnyJson } from '@polkadot/types/types';
import type { AccountId } from '@polkadot/types/interfaces';
import type { AnyJson } from '@polkadot/types/types';
import { ApiPromise } from '@polkadot/api';
import { decorateMethod } from '@polkadot/api/promise';
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
export { Blueprint } from './Blueprint';
+2 -2
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { BlueprintSubmittableResult as BaseBlueprintSubmittableResult, CodeSubmittableResult as BaseCodeSubmittableResult } from '../base';
import type { BlueprintSubmittableResult as BaseBlueprintSubmittableResult, CodeSubmittableResult as BaseCodeSubmittableResult } from '../base';
export type BlueprintSubmittableResult = BaseBlueprintSubmittableResult<'promise'>;
export type CodeSubmittableResult = BaseCodeSubmittableResult<'promise'>;
+3 -3
View File
@@ -1,8 +1,8 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Hash } from '@polkadot/types/interfaces';
import { AnyJson } from '@polkadot/types/types';
import type { Hash } from '@polkadot/types/interfaces';
import type { AnyJson } from '@polkadot/types/types';
import { ApiRx } from '@polkadot/api';
import { decorateMethod } from '@polkadot/api/rx';
+3 -3
View File
@@ -1,9 +1,9 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { AnyJson } from '@polkadot/types/types';
import type { ApiRx } from '@polkadot/api';
import type { AnyJson } from '@polkadot/types/types';
import { ApiRx } from '@polkadot/api';
import { decorateMethod } from '@polkadot/api/rx';
import { Abi } from '../Abi';
+3 -3
View File
@@ -1,8 +1,8 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { AccountId } from '@polkadot/types/interfaces';
import { AnyJson } from '@polkadot/types/types';
import type { AccountId } from '@polkadot/types/interfaces';
import type { AnyJson } from '@polkadot/types/types';
import { ApiRx } from '@polkadot/api';
import { decorateMethod } from '@polkadot/api/rx';
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
export { Blueprint } from './Blueprint';
+2 -2
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { BlueprintSubmittableResult as BaseBlueprintSubmittableResult, CodeSubmittableResult as BaseCodeSubmittableResult } from '../base';
import type { BlueprintSubmittableResult as BaseBlueprintSubmittableResult, CodeSubmittableResult as BaseCodeSubmittableResult } from '../base';
export type BlueprintSubmittableResult = BaseBlueprintSubmittableResult<'promise'>;
export type CodeSubmittableResult = BaseCodeSubmittableResult<'promise'>;
+9 -10
View File
@@ -1,15 +1,13 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ApiTypes } from '@polkadot/api/types';
import { ContractExecResultResult, ContractSelector } from '@polkadot/types/interfaces';
import { Codec, CodecArg, TypeDef } from '@polkadot/types/types';
import BN from 'bn.js';
import { ApiBase } from '@polkadot/api/base';
import { Text, u64 } from '@polkadot/types';
import { Abi } from '.';
import type BN from 'bn.js';
import type { ApiBase } from '@polkadot/api/base';
import type { ApiTypes } from '@polkadot/api/types';
import type { Text, u64 } from '@polkadot/types';
import type { ContractExecResultResult, ContractSelector } from '@polkadot/types/interfaces';
import type { Codec, CodecArg, TypeDef } from '@polkadot/types/types';
import type { Abi } from '.';
export interface ContractBase<ApiType extends ApiTypes> {
readonly abi: Abi;
@@ -41,6 +39,7 @@ export interface AbiMessage {
isConstructor?: boolean;
isMutating?: boolean;
isPayable?: boolean;
method: string;
returnType?: TypeDef | null;
selector: ContractSelector;
toU8a: (params: CodecArg[], additional?: Uint8Array) => Uint8Array;
+13 -12
View File
@@ -1,27 +1,28 @@
// Copyright 2017-2020 @polkadot/rpc-contract authors & contributors
// Copyright 2017-2021 @polkadot/rpc-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { SubmittableResult } from '@polkadot/api';
import { EventRecord } from '@polkadot/types/interfaces';
import { Codec, CodecArg, Registry, TypeDef } from '@polkadot/types/types';
import { BlueprintOptions, ContractOptions } from './types';
import type { SubmittableResult } from '@polkadot/api';
import type { Raw } from '@polkadot/types';
import type { EventRecord } from '@polkadot/types/interfaces';
import type { Codec, CodecArg, Registry, TypeDef } from '@polkadot/types/types';
import type { BlueprintOptions, ContractOptions } from './types';
import BN from 'bn.js';
import { Raw } from '@polkadot/types';
import { createTypeUnsafe } from '@polkadot/types/create';
import { isBn, isBigInt, isNumber, isString } from '@polkadot/util';
type ContractEvents = 'CodeStored' | 'ContractExecution' | 'Instantiated';
import { createTypeUnsafe } from '@polkadot/types/create';
import { isBigInt, isBn, isNumber, isString } from '@polkadot/util';
type ContractEvents = 'CodeStored' | 'ContractEmitted' | 'ContractExecution' | 'Instantiated';
type TOptions = BlueprintOptions | ContractOptions;
export function formatData (registry: Registry, data: Raw, { type }: TypeDef): Codec {
return createTypeUnsafe(registry, type, [data], true);
return createTypeUnsafe(registry, type, [data], { isPedantic: true });
}
export function applyOnEvent <T> (result: SubmittableResult, type: ContractEvents, fn: (records: EventRecord[]) => T): T | undefined {
export function applyOnEvent <T> (result: SubmittableResult, types: ContractEvents[], fn: (records: EventRecord[]) => T): T | undefined {
if (result.isInBlock || result.isFinalized) {
const records = result.filterRecords('contracts', type);
const records = result.filterRecords('contracts', types);
if (records.length) {
return fn(records);
@@ -0,0 +1,6 @@
[
{
"info": 6,
"type": "bool"
}
]
@@ -1,4 +1,4 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import * as ink from './ink';
@@ -1,4 +1,4 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
export { default as delegator } from './delegator.json';
@@ -6,5 +6,6 @@ export { default as dns } from './dns.json';
export { default as erc20 } from './erc20.json';
export { default as erc721 } from './erc721.json';
export { default as flipper } from './flipper.json';
export { default as flipperBundle } from './flipper.contract.json';
export { default as incrementer } from './incrementer.json';
export { default as multisigPlain } from './multisig_plain.json';
@@ -1,4 +1,4 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
export { default as ints256 } from './ints256.json';
@@ -1,4 +1,4 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
export { default as assetTransfer } from './assetTransfer.json';
+18 -17
View File
@@ -1,14 +1,16 @@
{
"name": "@polkadot/api-derive",
"version": "2.7.1",
"version": "4.8.1",
"type": "module",
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
"main": "index.js",
"sideEffects": false,
"keywords": [
"Polkadot",
"Promise",
"RxJs"
"sideEffects": [
"./detectPackage.js",
"./detectPackage.cjs"
],
"engines": {
"node": ">=14.0.0"
},
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [],
"contributors": [],
@@ -17,18 +19,17 @@
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
"dependencies": {
"@babel/runtime": "^7.12.5",
"@polkadot/api": "2.7.1",
"@polkadot/rpc-core": "2.7.1",
"@polkadot/types": "2.7.1",
"@polkadot/util": "^4.1.1",
"@polkadot/util-crypto": "^4.1.1",
"bn.js": "^5.1.3",
"memoizee": "^0.4.14",
"rxjs": "^6.6.3"
"@babel/runtime": "^7.14.0",
"@polkadot/api": "4.8.1",
"@polkadot/rpc-core": "4.8.1",
"@polkadot/types": "4.8.1",
"@polkadot/util": "^6.3.1",
"@polkadot/util-crypto": "^6.3.1",
"@polkadot/x-rxjs": "^6.3.1",
"bn.js": "^4.11.9"
},
"devDependencies": {
"@polkadot/keyring": "^4.1.1",
"@polkadot/rpc-provider": "2.7.1"
"@polkadot/keyring": "^6.3.1",
"@polkadot/rpc-provider": "4.8.1"
}
}
@@ -1,13 +1,14 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { AccountId, AccountIndex, Address } from '@polkadot/types/interfaces';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { AccountId, AccountIndex, Address } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import { Observable, of } from 'rxjs';
import { map } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { isU8a, assertReturn } from '@polkadot/util';
import { assertReturn, isU8a } from '@polkadot/util';
import { decodeAddress } from '@polkadot/util-crypto';
import { of } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
+9 -8
View File
@@ -1,14 +1,15 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ApiInterfaceRx } from '@polkadot/api/types';
import { AccountId, Address, Balance } from '@polkadot/types/interfaces';
import { ITuple } from '@polkadot/types/types';
import { DeriveAccountFlags } from '../types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Vec } from '@polkadot/types';
import type { AccountId, Address, Balance } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveAccountFlags } from '../types';
import { Observable, combineLatest, of } from 'rxjs';
import { map } from 'rxjs/operators';
import { Vec } from '@polkadot/types';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
+11 -10
View File
@@ -1,18 +1,19 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { AccountId, AccountIndex, Address } from '@polkadot/types/interfaces';
import { AccountIdAndIndex } from '../types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { AccountId, AccountIndex, Address } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { AccountIdAndIndex } from '../types';
import { Observable, of } from 'rxjs';
import { map } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { isU8a } from '@polkadot/util';
import { decodeAddress } from '@polkadot/util-crypto';
import { of } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
function retrieve (api: ApiInterfaceRx, address: Address | AccountId | AccountIndex | string | null | undefined): Observable<AccountIdAndIndex> {
function retrieve (api: ApiInterfaceRx, address: Address | AccountId | AccountIndex | Uint8Array | string | null | undefined): Observable<AccountIdAndIndex> {
try {
// yes, this can fail, don't care too much, catch will catch it
const decoded = isU8a(address)
@@ -39,7 +40,7 @@ function retrieve (api: ApiInterfaceRx, address: Address | AccountId | AccountIn
/**
* @name idAndIndex
* @param {(Address | AccountId | AccountIndex | string | null)} address - An accounts address in various formats.
* @param {(Address | AccountId | AccountIndex | Uint8Array | string | null)} address - An accounts address in various formats.
* @description An array containing the [[AccountId]] and [[AccountIndex]] as optional values.
* @example
* <BR>
@@ -50,7 +51,7 @@ function retrieve (api: ApiInterfaceRx, address: Address | AccountId | AccountIn
* });
* ```
*/
export function idAndIndex (instanceId: string, api: ApiInterfaceRx): (address?: Address | AccountId | AccountIndex | string | null) => Observable<AccountIdAndIndex> {
return memo(instanceId, (address?: Address | AccountId | AccountIndex | string | null): Observable<AccountIdAndIndex> =>
export function idAndIndex (instanceId: string, api: ApiInterfaceRx): (address?: Address | AccountId | AccountIndex | Uint8Array | string | null) => Observable<AccountIdAndIndex> {
return memo(instanceId, (address?: Address | AccountId | AccountIndex | Uint8Array | string | null): Observable<AccountIdAndIndex> =>
retrieve(api, address));
}
@@ -1,12 +1,12 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { AccountId, AccountIndex } from '@polkadot/types/interfaces';
import { AccountIndexes } from '../types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { AccountId, AccountIndex } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { AccountIndexes } from '../types';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -0,0 +1,141 @@
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Data, Option } from '@polkadot/types';
import type { AccountId, IdentityInfoAdditional, Registration } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveAccountRegistration, DeriveHasIdentity } from '../types';
import { isHex, u8aToString } from '@polkadot/util';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
const UNDEF_HEX = { toHex: () => undefined };
function dataAsString (data: Data): string | undefined {
return data.isRaw
? u8aToString(data.asRaw.toU8a(true))
: data.isNone
? undefined
: data.toHex();
}
function extractOther (additional: IdentityInfoAdditional[]): Record<string, string> {
return additional.reduce((other: Record<string, string>, [_key, _value]): Record<string, string> => {
const key = dataAsString(_key);
const value = dataAsString(_value);
if (key && value) {
other[key] = value;
}
return other;
}, {});
}
function extractIdentity (identityOfOpt?: Option<Registration>, superOf?: [AccountId, Data]): DeriveAccountRegistration {
if (!identityOfOpt?.isSome) {
return { judgements: [] };
}
const { info, judgements } = identityOfOpt.unwrap();
const topDisplay = dataAsString(info.display);
return {
display: (superOf && dataAsString(superOf[1])) || topDisplay,
displayParent: superOf && topDisplay,
email: dataAsString(info.email),
image: dataAsString(info.image),
judgements,
legal: dataAsString(info.legal),
other: extractOther(info.additional),
parent: superOf && superOf[0],
pgp: info.pgpFingerprint.unwrapOr(UNDEF_HEX).toHex(),
riot: dataAsString(info.riot),
twitter: dataAsString(info.twitter),
web: dataAsString(info.web)
};
}
function getParent (api: ApiInterfaceRx, identityOfOpt: Option<Registration> | undefined, superOfOpt: Option<ITuple<[AccountId, Data]>> | undefined): Observable<[Option<Registration> | undefined, [AccountId, Data] | undefined]> {
if (identityOfOpt?.isSome) {
// this identity has something set
return of([identityOfOpt, undefined]);
} else if (superOfOpt?.isSome) {
const superOf = superOfOpt.unwrap();
// we have a super
return combineLatest([
api.query.identity.identityOf<Option<Registration>>(superOf[0]),
of(superOf)
]);
}
// nothing of value returned
return of([undefined, undefined]);
}
function getBase (api: ApiInterfaceRx, accountId?: AccountId | Uint8Array | string): Observable<[Option<Registration> | undefined, Option<ITuple<[AccountId, Data]>> | undefined]> {
return accountId && api.query.identity?.identityOf
? api.queryMulti<[Option<Registration>, Option<ITuple<[AccountId, Data]>>]>([
[api.query.identity.identityOf, accountId],
[api.query.identity.superOf, accountId]
])
: of([undefined, undefined]);
}
/**
* @name identity
* @description Returns identity info for an account
*/
export function identity (instanceId: string, api: ApiInterfaceRx): (accountId?: AccountId | Uint8Array | string) => Observable<DeriveAccountRegistration> {
return memo(instanceId, (accountId?: AccountId | Uint8Array | string): Observable<DeriveAccountRegistration> =>
getBase(api, accountId).pipe(
switchMap(([identityOfOpt, superOfOpt]) => getParent(api, identityOfOpt, superOfOpt)),
map(([identityOfOpt, superOf]) => extractIdentity(identityOfOpt, superOf))
)
);
}
export function hasIdentity (instanceId: string, api: ApiInterfaceRx): (accountId: AccountId | Uint8Array | string) => Observable<DeriveHasIdentity> {
return memo(instanceId, (accountId: AccountId | Uint8Array | string): Observable<DeriveHasIdentity> =>
api.derive.accounts.hasIdentityMulti([accountId]).pipe(
map(([first]) => first)
)
);
}
export function hasIdentityMulti (instanceId: string, api: ApiInterfaceRx): (accountIds: (AccountId | Uint8Array | string)[]) => Observable<DeriveHasIdentity[]> {
return memo(instanceId, (accountIds: (AccountId | Uint8Array | string)[]): Observable<DeriveHasIdentity[]> =>
api.query.identity?.identityOf
? combineLatest([
api.query.identity.identityOf.multi<Option<Registration>>(accountIds),
api.query.identity.superOf.multi<Option<ITuple<[AccountId, Data]>>>(accountIds)
]).pipe(
map(([identities, supers]) =>
identities.map((identityOfOpt, index): DeriveHasIdentity => {
const superOfOpt = supers[index];
const parentId = superOfOpt && superOfOpt.isSome
? superOfOpt.unwrap()[0].toString()
: undefined;
let display: string | undefined;
if (identityOfOpt && identityOfOpt.isSome) {
const value = dataAsString(identityOfOpt.unwrap().info.display);
if (value && !isHex(value)) {
display = value;
}
}
return { display, hasIdentity: !!(display || parentId), parentId };
})
)
)
: of(accountIds.map(() => ({ hasIdentity: false })))
);
}
+2 -1
View File
@@ -1,10 +1,11 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './accountId';
export * from './flags';
export * from './idAndIndex';
export * from './idToIndex';
export * from './identity';
export * from './indexToId';
export * from './indexes';
export * from './info';
+13 -34
View File
@@ -1,40 +1,17 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { AccountId, AccountIndex, BalanceOf } from '@polkadot/types/interfaces';
import { ITuple } from '@polkadot/types/types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option } from '@polkadot/types';
import type { AccountId, AccountIndex, BalanceOf } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import { Observable, of } from 'rxjs';
import { map, startWith } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { ENUMSET_SIZE } from '@polkadot/types/generic/AccountIndex';
import { Option, Vec } from '@polkadot/types';
import { isFunction } from '@polkadot/util';
import { of } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
function queryEnumSet (api: ApiInterfaceRx, _accountIndex: AccountIndex | string): Observable<AccountId | undefined> {
const accountIndex = _accountIndex instanceof api.registry.createClass('AccountIndex')
? _accountIndex
: api.registry.createType('AccountIndex', _accountIndex);
return api.query.indices.enumSet<Vec<AccountId>>(accountIndex.div(ENUMSET_SIZE)).pipe(
startWith([]),
map((accounts): AccountId | undefined =>
(accounts || [])[accountIndex.mod(ENUMSET_SIZE).toNumber()]
)
);
}
// current
function query (api: ApiInterfaceRx, accountIndex: AccountIndex | string): Observable<AccountId | undefined> {
return api.query.indices.accounts<Option<ITuple<[AccountId, BalanceOf]>>>(accountIndex).pipe(
map((optResult): AccountId | undefined =>
optResult.unwrapOr([])[0]
)
);
}
/**
* @name indexToId
* @param {( AccountIndex | string )} accountIndex - An accounts index in different formats.
@@ -51,9 +28,11 @@ function query (api: ApiInterfaceRx, accountIndex: AccountIndex | string): Obser
export function indexToId (instanceId: string, api: ApiInterfaceRx): (accountIndex: AccountIndex | string) => Observable<AccountId | undefined> {
return memo(instanceId, (accountIndex: AccountIndex | string): Observable<AccountId | undefined> =>
api.query.indices
? isFunction(api.query.indices.accounts)
? query(api, accountIndex)
: queryEnumSet(api, accountIndex)
? api.query.indices.accounts<Option<ITuple<[AccountId, BalanceOf]>>>(accountIndex).pipe(
map((optResult): AccountId | undefined =>
optResult.unwrapOr([])[0]
)
)
: of(undefined)
);
}
+8 -40
View File
@@ -1,53 +1,23 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ApiInterfaceRx } from '@polkadot/api/types';
import { AccountId, AccountIndex } from '@polkadot/types/interfaces';
import { AccountIndexes } from '../types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { AccountIndexes } from '../types';
import { Observable, of } from 'rxjs';
import { map, startWith, switchMap } from 'rxjs/operators';
import { ENUMSET_SIZE } from '@polkadot/types/generic/AccountIndex';
import { Vec } from '@polkadot/types';
import { isFunction } from '@polkadot/util';
import { of } from '@polkadot/x-rxjs';
import { map, startWith } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
const enumsetSize = ENUMSET_SIZE.toNumber();
let indicesCache: AccountIndexes | null = null;
function queryEnumSet (api: ApiInterfaceRx): Observable<AccountIndexes> {
return api.query.indices.nextEnumSet<AccountIndex>().pipe(
// use the nextEnumSet (which is a counter of the number of sets) to construct
// a range of values to query [0, 1, 2, ...]. Retrieve the full enum set for the
// specific index - each query can return up to ENUMSET_SIZE (64) records, each
// containing an AccountId
switchMap((next: AccountIndex): Observable<Vec<AccountId>[]> =>
api.query.indices.enumSet.multi<Vec<AccountId>>([...Array(next.toNumber() + 1).keys()])
),
map((all: AccountId[][]): AccountIndexes =>
all.reduce((indexes: AccountIndexes, list, outerIndex): AccountIndexes => {
(list || []).forEach((accountId, innerIndex): void => {
// re-create the index based on position 0 is [0][0] and likewise
// 64 (0..63 in first) is [1][0] (the first index value in set 2)
const index = (outerIndex * enumsetSize) + innerIndex;
indexes[accountId.toString()] = api.registry.createType('AccountIndex', index);
});
return indexes;
}, {})
)
);
}
function queryAccounts (api: ApiInterfaceRx): Observable<AccountIndexes> {
return api.query.indices.accounts.entries().pipe(
map((entries): AccountIndexes =>
entries.reduce((indexes: AccountIndexes, [key, idOpt]): AccountIndexes => {
if (idOpt.isSome) {
indexes[idOpt.unwrap()[0].toString()] = key.args[0] as AccountIndex;
indexes[idOpt.unwrap()[0].toString()] = key.args[0];
}
return indexes;
@@ -77,9 +47,7 @@ export function indexes (instanceId: string, api: ApiInterfaceRx): () => Observa
? of(indicesCache)
: (
api.query.indices
? isFunction(api.query.indices.accounts)
? queryAccounts(api).pipe(startWith({}))
: queryEnumSet(api).pipe(startWith({}))
? queryAccounts(api).pipe(startWith({}))
: of({} as AccountIndexes)
).pipe(
map((indices): AccountIndexes => {
+12 -90
View File
@@ -1,28 +1,19 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ApiInterfaceRx } from '@polkadot/api/types';
import { AccountId, AccountIndex, Address, Balance, IdentityInfoAdditional, Registration } from '@polkadot/types/interfaces';
import { ITuple } from '@polkadot/types/types';
import { DeriveAccountInfo, DeriveAccountRegistration } from '../types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Bytes, Option, u32 } from '@polkadot/types';
import type { AccountId, AccountIndex, Address, Balance } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveAccountInfo, DeriveAccountRegistration } from '../types';
import { Observable, combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { Bytes, Data, Option, u32 } from '@polkadot/types';
import { u8aToString } from '@polkadot/util';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
const UNDEF_HEX = { toHex: () => undefined };
function dataAsString (data: Data): string | undefined {
return data.isRaw
? u8aToString(data.asRaw.toU8a(true))
: data.isNone
? undefined
: data.toHex();
}
function retrieveNick (api: ApiInterfaceRx, accountId?: AccountId): Observable<string | undefined> {
return ((
accountId && api.query.nicks?.nameOf
@@ -37,86 +28,17 @@ function retrieveNick (api: ApiInterfaceRx, accountId?: AccountId): Observable<s
);
}
function extractOther (additional: IdentityInfoAdditional[]): Record<string, string> {
return additional.reduce((other: Record<string, string>, [_key, _value]): Record<string, string> => {
const key = dataAsString(_key);
const value = dataAsString(_value);
if (key && value) {
other[key] = value;
}
return other;
}, {});
}
function extractIdentity (identityOfOpt?: Option<Registration>, superOf?: [AccountId, Data]): DeriveAccountRegistration {
if (!identityOfOpt?.isSome) {
return { judgements: [] };
}
const { info, judgements } = identityOfOpt.unwrap();
const topDisplay = dataAsString(info.display);
return {
display: (superOf && dataAsString(superOf[1])) || topDisplay,
displayParent: superOf && topDisplay,
email: dataAsString(info.email),
image: dataAsString(info.image),
judgements,
legal: dataAsString(info.legal),
other: extractOther(info.additional),
parent: superOf && superOf[0],
pgp: info.pgpFingerprint.unwrapOr(UNDEF_HEX).toHex(),
riot: dataAsString(info.riot),
twitter: dataAsString(info.twitter),
web: dataAsString(info.web)
};
}
function retrieveIdentity (api: ApiInterfaceRx, accountId?: AccountId): Observable<DeriveAccountRegistration> {
return ((
accountId && api.query.identity?.identityOf
? api.queryMulti([
[api.query.identity.identityOf, accountId],
[api.query.identity.superOf, accountId]
])
: of([undefined, undefined])
) as Observable<[Option<Registration> | undefined, Option<ITuple<[AccountId, Data]>> | undefined]>).pipe(
switchMap(([identityOfOpt, superOfOpt]): Observable<[Option<Registration> | undefined, [AccountId, Data] | undefined]> => {
if (identityOfOpt?.isSome) {
// this identity has something set
return of([identityOfOpt, undefined]);
} else if (superOfOpt?.isSome) {
const superOf = superOfOpt.unwrap();
// we have a super
return combineLatest([
api.query.identity.identityOf<Option<Registration>>(superOf[0]),
of(superOf)
]);
}
// nothing of value returned
return of([undefined, undefined]);
}),
map(([identityOfOpt, superOf]): DeriveAccountRegistration =>
extractIdentity(identityOfOpt, superOf)
)
);
}
/**
* @name info
* @description Returns aux. info with regards to an account, current that includes the accountId, accountIndex and nickname
*/
export function info (instanceId: string, api: ApiInterfaceRx): (address?: AccountIndex | AccountId | Address | string | null) => Observable<DeriveAccountInfo> {
return memo(instanceId, (address?: AccountIndex | AccountId | Address | string | null): Observable<DeriveAccountInfo> =>
export function info (instanceId: string, api: ApiInterfaceRx): (address?: AccountIndex | AccountId | Address | Uint8Array | string | null) => Observable<DeriveAccountInfo> {
return memo(instanceId, (address?: AccountIndex | AccountId | Address | Uint8Array | string | null): Observable<DeriveAccountInfo> =>
api.derive.accounts.idAndIndex(address).pipe(
switchMap(([accountId, accountIndex]): Observable<[Partial<DeriveAccountInfo>, DeriveAccountRegistration, string?]> =>
combineLatest([
of({ accountId, accountIndex }),
retrieveIdentity(api, accountId),
api.derive.accounts.identity(accountId),
retrieveNick(api, accountId)
])
),
+8 -2
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { AccountId, AccountIndex, RegistrationJudgement } from '@polkadot/types/interfaces';
import type { AccountId, AccountIndex, RegistrationJudgement } from '@polkadot/types/interfaces';
export type AccountIdAndIndex = [AccountId?, AccountIndex?];
@@ -35,3 +35,9 @@ export interface DeriveAccountInfo {
identity: DeriveAccountRegistration;
nickname?: string;
}
export interface DeriveHasIdentity {
display?: string;
hasIdentity: boolean;
parentId?: string;
}
+73 -31
View File
@@ -1,23 +1,30 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { AccountId, AccountData, AccountIndex, AccountInfo, Address, Balance, Index } from '@polkadot/types/interfaces';
import { ITuple } from '@polkadot/types/types';
import { DeriveBalancesAccount } from '../types';
import type { ApiInterfaceRx, QueryableStorageMultiArg } from '@polkadot/api/types';
import type { AccountData, AccountId, AccountIndex, AccountInfo, Address, Balance, Index } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveBalancesAccount, DeriveBalancesAccountData } from '../types';
import { Observable, combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { isFunction } from '@polkadot/util';
import { assert, isFunction } from '@polkadot/util';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
type Result = [Balance, Balance, Balance, Balance, Index];
type BalanceResult = [Balance, Balance, Balance, Balance];
function calcBalances (api: ApiInterfaceRx, [accountId, [freeBalance, reservedBalance, frozenFee, frozenMisc, accountNonce]]: [AccountId, Result]): DeriveBalancesAccount {
type Result = [Index, BalanceResult[]];
type DeriveCustomAccount = ApiInterfaceRx['derive'] & {
[custom: string]: {
customAccount?: ApiInterfaceRx['query']['balances']['account']
}
}
function getBalance (api: ApiInterfaceRx, [freeBalance, reservedBalance, frozenFee, frozenMisc]: BalanceResult): DeriveBalancesAccountData {
return {
accountId,
accountNonce,
freeBalance,
frozenFee,
frozenMisc,
@@ -26,6 +33,19 @@ function calcBalances (api: ApiInterfaceRx, [accountId, [freeBalance, reservedBa
};
}
function calcBalances (api: ApiInterfaceRx, [accountId, [accountNonce, balances]]: [AccountId, Result]): DeriveBalancesAccount {
const primary = balances[0];
assert(primary, 'No balances retrieved for account');
return {
accountId,
accountNonce,
additional: balances.filter((_, index) => index !== 0).map((b) => getBalance(api, b)),
...getBalance(api, primary)
};
}
// old
function queryBalancesFree (api: ApiInterfaceRx, accountId: AccountId): Observable<Result> {
return api.queryMulti<[Balance, Balance, Index]>([
@@ -33,21 +53,31 @@ function queryBalancesFree (api: ApiInterfaceRx, accountId: AccountId): Observab
[api.query.balances.reservedBalance, accountId],
[api.query.system.accountNonce, accountId]
]).pipe(
map(([freeBalance, reservedBalance, accountNonce]): Result =>
[freeBalance, reservedBalance, api.registry.createType('Balance'), api.registry.createType('Balance'), accountNonce]
)
map(([freeBalance, reservedBalance, accountNonce]): Result => [
accountNonce,
[[freeBalance, reservedBalance, api.registry.createType('Balance'), api.registry.createType('Balance')]]
])
);
}
function queryBalancesAccount (api: ApiInterfaceRx, accountId: AccountId): Observable<Result> {
return api.queryMulti<[AccountData, Index]>([
[api.query.balances.account, accountId],
[api.query.system.accountNonce, accountId]
]).pipe(
map(([{ feeFrozen, free, miscFrozen, reserved }, accountNonce]): Result =>
[free, reserved, feeFrozen, miscFrozen, accountNonce]
)
function queryBalancesAccount (api: ApiInterfaceRx, accountId: AccountId, modules: string[] = ['balances']): Observable<Result> {
const balances = modules.map(
(m): QueryableStorageMultiArg<'rxjs'> => [
(api.derive as DeriveCustomAccount)[m]?.customAccount || api.query[m].account,
accountId
]
);
const extract = (data: AccountData[]) =>
data.map(({ feeFrozen, free, miscFrozen, reserved }): BalanceResult => [free, reserved, feeFrozen, miscFrozen]);
return isFunction(api.query.system.account)
? api.queryMulti<[AccountInfo, ...(AccountData[])]>([[api.query.system.account, accountId], ...balances]).pipe(
map(([{ nonce }, ...balances]): Result => [nonce, extract(balances)])
)
: api.queryMulti<[Index, ...(AccountData[])]>([[api.query.system.accountNonce, accountId], ...balances]).pipe(
map(([nonce, ...balances]): Result => [nonce, extract(balances)])
);
}
function queryCurrent (api: ApiInterfaceRx, accountId: AccountId): Observable<Result> {
@@ -57,9 +87,11 @@ function queryCurrent (api: ApiInterfaceRx, accountId: AccountId): Observable<Re
const { feeFrozen, free, miscFrozen, reserved } = (infoOrTuple as AccountInfo).nonce
? (infoOrTuple as AccountInfo).data
: (infoOrTuple as [Index, AccountData])[1];
const accountNonce = (infoOrTuple as AccountInfo).nonce || (infoOrTuple as [Index, AccountData])[0];
return [free, reserved, feeFrozen, miscFrozen, accountNonce];
return [
(infoOrTuple as AccountInfo).nonce || (infoOrTuple as [Index, AccountData])[0],
[[free, reserved, feeFrozen, miscFrozen]]
];
})
);
}
@@ -80,19 +112,29 @@ function queryCurrent (api: ApiInterfaceRx, accountId: AccountId): Observable<Re
* ```
*/
export function account (instanceId: string, api: ApiInterfaceRx): (address: AccountIndex | AccountId | Address | string) => Observable<DeriveBalancesAccount> {
const balanceInstances = api.registry.getModuleInstances(api.runtimeVersion.specName.toString(), 'balances');
return memo(instanceId, (address: AccountIndex | AccountId | Address | string): Observable<DeriveBalancesAccount> =>
api.derive.accounts.accountId(address).pipe(
switchMap((accountId): Observable<[AccountId, Result]> =>
(accountId
? combineLatest([
of(accountId),
isFunction(api.query.system.account)
? queryCurrent(api, accountId)
: isFunction(api.query.balances.account)
? queryBalancesAccount(api, accountId)
: queryBalancesFree(api, accountId)
balanceInstances
? queryBalancesAccount(api, accountId, balanceInstances)
: isFunction(api.query.system.account)
? queryCurrent(api, accountId)
: isFunction(api.query.balances.account)
? queryBalancesAccount(api, accountId)
: queryBalancesFree(api, accountId)
])
: of([
api.registry.createType('AccountId'),
[
api.registry.createType('Index'),
[[api.registry.createType('Balance'), api.registry.createType('Balance'), api.registry.createType('Balance'), api.registry.createType('Balance')]]
]
])
: of([api.registry.createType('AccountId'), [api.registry.createType('Balance'), api.registry.createType('Balance'), api.registry.createType('Balance'), api.registry.createType('Balance'), api.registry.createType('Index')]])
)
),
map((result): DeriveBalancesAccount => calcBalances(api, result))
+72 -43
View File
@@ -1,19 +1,23 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { AccountId, AccountIndex, Address, Balance, BalanceLock, BalanceLockTo212, BlockNumber, VestingInfo, VestingSchedule } from '@polkadot/types/interfaces';
import { DeriveBalancesAccount, DeriveBalancesAll } from '../types';
import type { ApiInterfaceRx, QueryableStorageMultiArg } from '@polkadot/api/types';
import type { Option, Vec } from '@polkadot/types';
import type { AccountId, AccountIndex, Address, Balance, BalanceLock, BalanceLockTo212, BlockNumber, VestingInfo, VestingSchedule } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveBalancesAccount, DeriveBalancesAccountData, DeriveBalancesAll, DeriveBalancesAllAccountData } from '../types';
import BN from 'bn.js';
import { Observable, combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { Option, Vec } from '@polkadot/types';
import { bnMax, isFunction } from '@polkadot/util';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
type ResultBalance = [VestingInfo | null, (BalanceLock | BalanceLockTo212)[]];
type BalanceLocksEntry = Vec<BalanceLock | BalanceLockTo212>;
type BalanceLocks = BalanceLocksEntry[];
type ResultBalance = [VestingInfo | null, ((BalanceLock | BalanceLockTo212)[])[]];
type Result = [DeriveBalancesAccount, BlockNumber, ResultBalance];
interface AllLocked {
@@ -23,6 +27,12 @@ interface AllLocked {
vestingLocked: Balance
}
type DeriveCustomLocks = ApiInterfaceRx['derive'] & {
[custom: string]: {
customLocks?: ApiInterfaceRx['query']['balances']['locks']
}
}
const VESTING_ID = '0x76657374696e6720';
function calcLocked (api: ApiInterfaceRx, bestNumber: BlockNumber, locks: (BalanceLock | BalanceLockTo212)[]): AllLocked {
@@ -48,8 +58,20 @@ function calcLocked (api: ApiInterfaceRx, bestNumber: BlockNumber, locks: (Balan
return { allLocked, lockedBalance, lockedBreakdown, vestingLocked };
}
function calcBalances (api: ApiInterfaceRx, [{ accountId, accountNonce, freeBalance, frozenFee, frozenMisc, reservedBalance, votingBalance }, bestNumber, [vesting, locks]]: Result): DeriveBalancesAll {
function calcShared (api: ApiInterfaceRx, bestNumber: BlockNumber, data: DeriveBalancesAccountData, locks: (BalanceLock | BalanceLockTo212)[]): DeriveBalancesAllAccountData {
const { allLocked, lockedBalance, lockedBreakdown, vestingLocked } = calcLocked(api, bestNumber, locks);
return {
...data,
availableBalance: api.registry.createType('Balance', allLocked ? 0 : bnMax(new BN(0), data.freeBalance.sub(lockedBalance))),
lockedBalance,
lockedBreakdown,
vestingLocked
};
}
function calcBalances (api: ApiInterfaceRx, [data, bestNumber, [vesting, allLocks]]: Result): DeriveBalancesAll {
const shared = calcShared(api, bestNumber, data, allLocks[0]);
// Calculate the vesting balances,
// - offset = balance locked at startingBlock
// - perBlock is the unlock amount
@@ -57,29 +79,19 @@ function calcBalances (api: ApiInterfaceRx, [{ accountId, accountNonce, freeBala
const isStarted = bestNumber.gt(startingBlock);
const vestedNow = isStarted ? perBlock.mul(bestNumber.sub(startingBlock)) : new BN(0);
const vestedBalance = vestedNow.gt(vestingTotal) ? vestingTotal : api.registry.createType('Balance', vestedNow);
const isVesting = isStarted && !vestingLocked.isZero();
const vestedClaimable = api.registry.createType('Balance', isVesting ? vestingLocked.sub(vestingTotal.sub(vestedBalance)) : 0);
const availableBalance = api.registry.createType('Balance', allLocked ? 0 : bnMax(new BN(0), freeBalance.sub(lockedBalance)));
const vestingEndBlock = api.registry.createType('BlockNumber', isVesting ? vestingTotal.div(perBlock).add(startingBlock) : 0);
const isVesting = isStarted && !shared.vestingLocked.isZero();
return {
accountId,
accountNonce,
availableBalance,
freeBalance,
frozenFee,
frozenMisc,
...shared,
accountId: data.accountId,
accountNonce: data.accountNonce,
additional: allLocks.filter((_, index) => index !== 0).map((l, index) => calcShared(api, bestNumber, data.additional[index], l)),
isVesting,
lockedBalance,
lockedBreakdown,
reservedBalance,
vestedBalance,
vestedClaimable,
vestingEndBlock,
vestingLocked,
vestedClaimable: api.registry.createType('Balance', isVesting ? shared.vestingLocked.sub(vestingTotal.sub(vestedBalance)) : 0),
vestingEndBlock: api.registry.createType('BlockNumber', isVesting ? vestingTotal.div(perBlock).add(startingBlock) : 0),
vestingPerBlock: perBlock,
vestingTotal,
votingBalance
vestingTotal
};
}
@@ -98,28 +110,43 @@ function queryOld (api: ApiInterfaceRx, accountId: AccountId): Observable<Result
vestingNew = api.registry.createType('VestingInfo', { locked, perBlock, startingBlock });
}
return [vestingNew, locks];
return [vestingNew, [locks]];
})
);
}
// current (balances vesting)
function queryCurrent (api: ApiInterfaceRx, accountId: AccountId): Observable<ResultBalance> {
const isNonNullable = <T>(nullable: T): nullable is NonNullable<T> => !!nullable;
// current (balances, vesting)
function queryCurrent (api: ApiInterfaceRx, accountId: AccountId, balanceInstances: string[] = ['balances']): Observable<ResultBalance> {
const lockCalls = balanceInstances.map(
(m): ApiInterfaceRx['query']['balances']['locks'] | undefined =>
(api.derive as DeriveCustomLocks)[m]?.customLocks || api.query[m as 'balances']?.locks
);
const lockEmpty = lockCalls.map((c) => !c);
const lockQueries = lockCalls.filter(isNonNullable).map((c): QueryableStorageMultiArg<'rxjs'> => [c, accountId]);
return (
api.query.vesting?.vesting
? api.queryMulti<[Vec<BalanceLock>, Option<VestingInfo>]>([
[api.query.balances.locks, accountId],
[api.query.vesting.vesting, accountId]
? api.queryMulti<[Option<VestingInfo>, ...BalanceLocks]>([
[api.query.vesting.vesting, accountId],
...lockQueries
])
: api.query.balances.locks(accountId).pipe(
map((locks): [Vec<BalanceLock>, Option<VestingInfo>] =>
[locks, api.registry.createType('Option<VestingInfo>')]
// TODO We need to check module instances here as well, not only the balances module
: lockQueries.length
? api.queryMulti<[...(Vec<BalanceLock>)[]]>(lockQueries).pipe(
map((locks): [Option<VestingInfo>, ...BalanceLocks] =>
[api.registry.createType('Option<VestingInfo>'), ...locks]
)
)
)
: of([api.registry.createType('Option<VestingInfo>')] as [Option<VestingInfo>])
).pipe(
map(([locks, optVesting]): ResultBalance =>
[optVesting.unwrapOr(null), locks]
)
map(([optVesting, ...locks]): ResultBalance => {
let offset = -1;
return [optVesting.unwrapOr(null), lockEmpty.map((e) => e ? api.registry.createType('Vec<BalanceLock>') : locks[++offset])];
})
);
}
@@ -139,6 +166,8 @@ function queryCurrent (api: ApiInterfaceRx, accountId: AccountId): Observable<Re
* ```
*/
export function all (instanceId: string, api: ApiInterfaceRx): (address: AccountIndex | AccountId | Address | string) => Observable<DeriveBalancesAll> {
const balanceInstances = api.registry.getModuleInstances(api.runtimeVersion.specName.toString(), 'balances');
return memo(instanceId, (address: AccountIndex | AccountId | Address | string): Observable<DeriveBalancesAll> =>
api.derive.balances.account(address).pipe(
switchMap((account): Observable<Result> =>
@@ -146,11 +175,11 @@ export function all (instanceId: string, api: ApiInterfaceRx): (address: Account
? combineLatest([
of(account),
api.derive.chain.bestNumber(),
isFunction(api.query.system.account) || isFunction(api.query.balances.account)
? queryCurrent(api, account.accountId)
isFunction(api.query.system?.account) || isFunction(api.query.balances?.account)
? queryCurrent(api, account.accountId, balanceInstances)
: queryOld(api, account.accountId)
])
: of([account, api.registry.createType('BlockNumber'), [null, api.registry.createType('Vec<BalanceLock>')]])
: of([account, api.registry.createType('BlockNumber'), [null, []]])
)
),
map((result): DeriveBalancesAll => calcBalances(api, result))
+7 -6
View File
@@ -1,12 +1,13 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ApiInterfaceRx } from '@polkadot/api/types';
import { Balance } from '@polkadot/types/interfaces';
import { DeriveFees } from '../types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Balance } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveFees } from '../types';
import { Observable, of } from 'rxjs';
import { map } from 'rxjs/operators';
import { of } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { all } from './all';
@@ -1,11 +1,12 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { AccountId, AccountIndex, Address } from '@polkadot/types/interfaces';
import { DeriveBalancesAccount } from '../types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { AccountId, AccountIndex, Address } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveBalancesAccount } from '../types';
import { Observable, combineLatest, of } from 'rxjs';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { memo } from '../util';
@@ -0,0 +1,161 @@
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { ApiInterfaceRx, SubmittableExtrinsic } from '@polkadot/api/types';
import type { Bytes, Option, StorageKey } from '@polkadot/types';
import type { Bounty, BountyIndex, ProposalIndex } from '@polkadot/types/interfaces';
import type { Codec, InterfaceTypes } from '@polkadot/types/types';
import { ApiPromise } from '@polkadot/api';
import { DeriveCollectiveProposal } from '@polkadot/api-derive/types';
import { Proposal } from '@polkadot/types/interfaces';
import { of } from '@polkadot/x-rxjs';
import { BountyFactory } from '../../test/bountyFactory';
import { BytesFactory } from '../../test/bytesFactory';
import { createApiWithAugmentations } from '../../test/helpers';
import { ProposalFactory } from '../../test/proposalFactory';
import { bounties } from '.';
const DEFAULT_PROPOSER = '5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUpnhM';
describe('bounties derive', () => {
let storageKey: (index: number) => StorageKey;
let defaultBounty: () => Bounty;
let emptyOption: <T extends Codec> (typeName: keyof InterfaceTypes) => Option<T>;
let optionOf: <T extends Codec> (value: T) => Option<T>;
let bountyIndex: (index: number) => BountyIndex;
let proposalIndex: (index: number) => ProposalIndex;
let bytes: (value: string) => Bytes;
let api: ApiPromise;
let createProposal: (method: SubmittableExtrinsic<'promise'>) => Proposal;
let defaultMockApi: ApiInterfaceRx;
beforeAll(() => {
api = createApiWithAugmentations();
({ bountyIndex, defaultBounty, emptyOption, optionOf, storageKey } = new BountyFactory(api));
({ bytes } = new BytesFactory(api.registry));
({ createProposal, proposalIndex } = new ProposalFactory(api));
});
beforeEach(() => {
defaultMockApi = {
derive: {
council: {
proposals: () => of([] as DeriveCollectiveProposal[])
}
},
query: {
council: {
proposalCount: () => of(proposalIndex(2))
},
treasury: {
bounties: {
keys: () => of([storageKey(0), storageKey(1)]),
multi: () => of([optionOf(defaultBounty()), optionOf(defaultBounty())])
},
bountyCount: () => of(bountyIndex(2)),
bountyDescriptions: {
multi: () => of([
optionOf(bytes('make polkadot even better')),
optionOf(bytes('some other bounty'))
])
}
}
},
tx: api.tx
} as unknown as ApiInterfaceRx;
});
it('creates storage key', function () {
expect(storageKey(194).args[0].eq(194)).toBe(true);
});
it('creates proposal', function () {
expect(createProposal(api.tx.balances.transfer('5EYCAe5ijiYfyeZ2JJCGq56LmPyNRAKzpG4QkoQkkQNB5e6Z', 1))).toBeTruthy();
});
it('combines bounties with descriptions', async () => {
const mockApi = {
...defaultMockApi,
query: {
...defaultMockApi.query,
treasury: {
bounties: {
keys: () => of([storageKey(0), storageKey(2), storageKey(3)]),
multi: () => of([optionOf(defaultBounty()), emptyOption('Bounty'), optionOf(defaultBounty())])
},
bountyCount: () => of(bountyIndex(3)),
bountyDescriptions: {
multi: () => of([
optionOf(bytes('make polkadot even better')),
optionOf(bytes('this will be totally ignored')),
emptyOption('Bytes')
])
}
}
}
} as unknown as ApiInterfaceRx;
const result = await bounties('', mockApi)().toPromise();
expect(result).toHaveLength(2);
expect(result[0].bounty.proposer.toString()).toEqual(DEFAULT_PROPOSER);
expect(result[0].description).toEqual('make polkadot even better');
expect(result[0].index.eq(0)).toBe(true);
expect(result[1].bounty.proposer.toString()).toEqual(DEFAULT_PROPOSER);
expect(result[1].description).toEqual('');
expect(result[1].index.eq(3)).toBe(true);
});
it('returns motions', async () => {
const result = await bounties('', defaultMockApi)().toPromise();
expect(result).toHaveLength(2);
expect(result[0].proposals).toHaveLength(0);
expect(result[1].proposals).toHaveLength(0);
});
it('when no council, returns bounties without motions', async () => {
const mockApi = {
...defaultMockApi,
query: {
...defaultMockApi.query,
council: null
}
} as unknown as ApiInterfaceRx;
const result = await bounties('', mockApi)().toPromise();
expect(result).toHaveLength(2);
expect(result[0].bounty.proposer.toString()).toEqual(DEFAULT_PROPOSER);
expect(result[0].description).toEqual('make polkadot even better');
expect(result[0].index.eq(0)).toBe(true);
expect(result[0].proposals).toHaveLength(0);
expect(result[1].bounty.proposer.toString()).toEqual(DEFAULT_PROPOSER);
expect(result[1].description).toEqual('some other bounty');
expect(result[1].index.eq(1)).toBe(true);
expect(result[1].proposals).toHaveLength(0);
});
it('combines bounties with motions', async () => {
const mockApi = {
...defaultMockApi,
derive: {
council: {
proposals: () => of([
{ proposal: createProposal(api.tx.bounties.approveBounty(1)) },
{ proposal: createProposal(api.tx.treasury.approveProposal(1)) }] as DeriveCollectiveProposal[])
}
}
} as unknown as ApiInterfaceRx;
const result = await bounties('', mockApi)().toPromise();
expect(result).toHaveLength(2);
expect(result[0].proposals).toHaveLength(0);
expect(result[1].proposals).toHaveLength(1);
expect(result[1].proposals[0].proposal.method).toEqual('approveBounty');
});
});
@@ -0,0 +1,65 @@
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { DeriveBounties, DeriveCollectiveProposal } from '@polkadot/api-derive/types';
import type { Bytes, Option } from '@polkadot/types';
import type { Bounty, BountyIndex, ProposalIndex } from '@polkadot/types/interfaces';
import { memo } from '@polkadot/api-derive/util';
import { combineLatest, Observable, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { filterBountiesProposals } from './helpers/filterBountyProposals';
type Result = [Option<Bounty>[], Option<Bytes>[], BountyIndex[], DeriveCollectiveProposal[]];
function parseResult ([maybeBounties, maybeDescriptions, ids, bountyProposals]: Result): DeriveBounties {
const bounties: DeriveBounties = [];
maybeBounties.forEach((bounty, index) => {
if (bounty.isSome) {
bounties.push({
bounty: bounty.unwrap(),
description: maybeDescriptions[index].unwrapOrDefault().toUtf8(),
index: ids[index],
proposals: bountyProposals.filter((bountyProposal) => ids[index].eq(bountyProposal.proposal.args[0]))
});
}
});
return bounties;
}
export function bounties (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveBounties> {
const bountyBase = api.query.bounties || api.query.treasury;
return memo(instanceId, (): Observable<DeriveBounties> =>
combineLatest([
bountyBase.bountyCount<BountyIndex>(),
api.query.council
? api.query.council.proposalCount<ProposalIndex>()
: of(0)
]).pipe(
switchMap(() =>
combineLatest([
bountyBase.bounties.keys<[BountyIndex]>(),
api.derive.council
? api.derive.council.proposals()
: of([])
])
),
switchMap(([keys, proposals]): Observable<Result> => {
const ids = keys.map(({ args: [id] }) => id);
return combineLatest([
bountyBase.bounties.multi<Option<Bounty>>(ids),
bountyBase.bountyDescriptions.multi<Option<Bytes>>(ids),
of(ids),
of(filterBountiesProposals(api, proposals))
]);
}),
map(parseResult)
)
);
}
@@ -0,0 +1,12 @@
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ApiInterfaceRx } from '@polkadot/api/types';
import { DeriveCollectiveProposal } from '@polkadot/api-derive/types';
export function filterBountiesProposals (api: ApiInterfaceRx, allProposals: DeriveCollectiveProposal[]): DeriveCollectiveProposal[] {
const bountyTxBase = api.tx.bounties ? api.tx.bounties : api.tx.treasury;
const bountyProposalCalls = [bountyTxBase.approveBounty, bountyTxBase.closeBounty, bountyTxBase.proposeCurator, bountyTxBase.unassignCurator];
return allProposals.filter((proposal) => bountyProposalCalls.find((bountyCall) => bountyCall.is(proposal.proposal)));
}
@@ -0,0 +1,4 @@
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './bounties';
+5 -5
View File
@@ -1,11 +1,11 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { BlockNumber } from '@polkadot/types/interfaces';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { BlockNumber } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -1,11 +1,11 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { BlockNumber } from '@polkadot/types/interfaces';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { BlockNumber } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -1,11 +1,12 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { BlockNumber } from '@polkadot/types/interfaces';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { BlockNumber } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import { Observable, combineLatest } from 'rxjs';
import { map } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { combineLatest } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
+14 -11
View File
@@ -1,12 +1,14 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ApiInterfaceRx } from '@polkadot/api/types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { SignedBlockExtended } from '../type/types';
import { Observable, combineLatest, of } from 'rxjs';
import { catchError, map } from 'rxjs/operators';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { catchError, map } from '@polkadot/x-rxjs/operators';
import { SignedBlockExtended } from '../type';
import { createSignedBlockExtended } from '../type';
import { memo } from '../util';
/**
@@ -17,25 +19,26 @@ import { memo } from '../util';
* <BR>
*
* ```javascript
* const { author, number } = await api.derive.chain.getHeader('0x123...456');
* const { author, block } = await api.derive.chain.getBlock('0x123...456');
*
* console.log(`block #${number} was authored by ${author}`);
* console.log(`block #${block.header.number} was authored by ${author}`);
* ```
*/
export function getHeader (instanceId: string, api: ApiInterfaceRx): (hash: Uint8Array | string) => Observable<SignedBlockExtended | undefined> {
export function getBlock (instanceId: string, api: ApiInterfaceRx): (hash: Uint8Array | string) => Observable<SignedBlockExtended | undefined> {
return memo(instanceId, (hash: Uint8Array | string): Observable<SignedBlockExtended | undefined> =>
combineLatest([
api.rpc.chain.getBlock(hash),
api.query.system.events.at(hash),
api.query.session
? api.query.session.validators.at(hash)
: of([])
]).pipe(
map(([signedBlock, validators]): SignedBlockExtended =>
new SignedBlockExtended(api.registry, signedBlock, validators)
map(([signedBlock, events, validators]): SignedBlockExtended =>
createSignedBlockExtended(api.registry, signedBlock, events, validators)
),
catchError((): Observable<undefined> =>
// where rpc.chain.getHeader throws, we will land here - it can happen that
// we supplied an invalid hash. (Due to defaults, storeage will have an
// we supplied an invalid hash. (Due to defaults, storage will have an
// empty value, so only the RPC is affected). So return undefined
of()
)
+8 -6
View File
@@ -1,12 +1,14 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ApiInterfaceRx } from '@polkadot/api/types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { HeaderExtended } from '../type/types';
import { Observable, combineLatest, of } from 'rxjs';
import { catchError, map } from 'rxjs/operators';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { catchError, map } from '@polkadot/x-rxjs/operators';
import { HeaderExtended } from '../type';
import { createHeaderExtended } from '../type';
import { memo } from '../util';
/**
@@ -32,7 +34,7 @@ export function getHeader (instanceId: string, api: ApiInterfaceRx): (hash: Uint
: of([])
]).pipe(
map(([header, validators]): HeaderExtended =>
new HeaderExtended(api.registry, header, validators)
createHeaderExtended(header.registry, header, validators)
),
catchError((): Observable<undefined> =>
// where rpc.chain.getHeader throws, we will land here - it can happen that
+2 -1
View File
@@ -1,9 +1,10 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './bestNumber';
export * from './bestNumberFinalized';
export * from './bestNumberLag';
export * from './getHeader';
export * from './getBlock';
export * from './subscribeNewBlocks';
export * from './subscribeNewHeads';
@@ -1,32 +1,37 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ApiInterfaceRx } from '@polkadot/api/types';
import { EventRecord, Hash, SignedBlock } from '@polkadot/types/interfaces';
import { FullNewBlock } from '../types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Vec } from '@polkadot/types';
import type { EventRecord, SignedBlock } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { HeaderExtended, SignedBlockExtended } from '../type/types';
import { Observable, combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { createSignedBlockExtended } from '../type';
import { memo } from '../util';
/**
* @name subscribeNewBlocks
* @returns The latest block & events for that block
*/
export function subscribeNewBlocks (instanceId: string, api: ApiInterfaceRx): () => Observable<FullNewBlock> {
return memo(instanceId, (): Observable<FullNewBlock> =>
export function subscribeNewBlocks (instanceId: string, api: ApiInterfaceRx): () => Observable<SignedBlockExtended> {
return memo(instanceId, (): Observable<SignedBlockExtended> =>
api.derive.chain.subscribeNewHeads().pipe(
switchMap((header): Observable<[Hash, EventRecord[], SignedBlock]> => {
const blockHash = header.hash;
switchMap((header): Observable<[SignedBlock, Vec<EventRecord>, HeaderExtended]> => {
const blockHash = header.createdAtHash || header.hash;
return combineLatest(
of(blockHash),
api.rpc.chain.getBlock(blockHash),
api.query.system.events.at(blockHash),
api.rpc.chain.getBlock(header.hash)
of(header)
);
}),
map(([blockHash, events, block]) => ({ block: block.block, blockHash, blockNumber: block.block.header.number.unwrap(), events, justification: block.justification }))
map(([block, events, header]) =>
createSignedBlockExtended(block.registry, block, events, header.validators)
)
)
);
}
@@ -1,12 +1,14 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ApiInterfaceRx } from '@polkadot/api/types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { HeaderExtended } from '../type/types';
import { Observable, combineLatest, of } from 'rxjs';
import { map } from 'rxjs/operators';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
import { HeaderExtended } from '../type';
import { createHeaderExtended } from '../type';
import { memo } from '../util';
/**
@@ -28,10 +30,13 @@ export function subscribeNewHeads (instanceId: string, api: ApiInterfaceRx): ()
api.rpc.chain.subscribeNewHeads(),
api.query.session
? api.query.session.validators()
: of([])
: of(undefined)
]).pipe(
map(([header, validators]): HeaderExtended =>
new HeaderExtended(api.registry, header, validators)
)
));
map(([header, validators]): HeaderExtended => {
header.createdAtHash = header.hash;
return createHeaderExtended(header.registry, header, validators);
})
)
);
}
-12
View File
@@ -1,12 +0,0 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Block, BlockNumber, EventRecord, Hash, Justification } from '@polkadot/types/interfaces';
export interface FullNewBlock {
block: Block;
blockHash: Hash;
blockNumber: BlockNumber;
events: EventRecord[];
justification: Justification;
}
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './proposals';
+14 -11
View File
@@ -1,17 +1,20 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ApiInterfaceRx } from '@polkadot/api/types';
import { Hash, Proposal, Votes } from '@polkadot/types/interfaces';
import { DeriveCollectiveProposal } from '../types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option } from '@polkadot/types';
import type { Hash, Proposal, Votes } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveCollectiveProposal } from '../types';
import { Observable, combineLatest, of } from 'rxjs';
import { catchError, map, switchMap } from 'rxjs/operators';
import { Option } from '@polkadot/types';
import { isFunction } from '@polkadot/util';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { catchError, map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
type Collective = 'council' | 'membership' | 'technicalCommittee';
type Result = [(Hash | Uint8Array | string)[], (Option<Proposal> | null)[], Option<Votes>[]];
function parse (api: ApiInterfaceRx, [hashes, proposals, votes]: Result): DeriveCollectiveProposal[] {
@@ -28,7 +31,7 @@ function parse (api: ApiInterfaceRx, [hashes, proposals, votes]: Result): Derive
.filter((proposal): proposal is DeriveCollectiveProposal => !!proposal);
}
function _proposalsFrom (instanceId: string, api: ApiInterfaceRx, section: 'council' | 'technicalCommittee' = 'council'): (hashes: (Hash | Uint8Array | string)[]) => Observable<DeriveCollectiveProposal[]> {
function _proposalsFrom (instanceId: string, api: ApiInterfaceRx, section: Collective): (hashes: (Hash | Uint8Array | string)[]) => Observable<DeriveCollectiveProposal[]> {
return memo(instanceId, (hashes: (Hash | Uint8Array | string)[]): Observable<DeriveCollectiveProposal[]> =>
(isFunction(api.query[section]?.proposals) && hashes.length
? combineLatest<Result>([
@@ -48,19 +51,19 @@ function _proposalsFrom (instanceId: string, api: ApiInterfaceRx, section: 'coun
);
}
export function proposals (instanceId: string, api: ApiInterfaceRx, section: 'council' | 'technicalCommittee' = 'council'): () => Observable<DeriveCollectiveProposal[]> {
export function proposals (instanceId: string, api: ApiInterfaceRx, section: Collective): () => Observable<DeriveCollectiveProposal[]> {
const proposalsFrom = _proposalsFrom(instanceId, api, section);
return memo(instanceId, (): Observable<DeriveCollectiveProposal[]> =>
isFunction(api.query[section]?.proposals)
? api.query[section].proposals().pipe(
? api.query[section as 'council'].proposals().pipe(
switchMap(proposalsFrom)
)
: of([] as DeriveCollectiveProposal[])
);
}
export function proposal (instanceId: string, api: ApiInterfaceRx, section: 'council' | 'technicalCommittee' = 'council'): (hash: Hash | Uint8Array | string) => Observable<DeriveCollectiveProposal | null> {
export function proposal (instanceId: string, api: ApiInterfaceRx, section: Collective): (hash: Hash | Uint8Array | string) => Observable<DeriveCollectiveProposal | null> {
const proposalsFrom = _proposalsFrom(instanceId, api, section);
return memo(instanceId, (hash: Hash | Uint8Array | string): Observable<DeriveCollectiveProposal | null> =>
+7 -5
View File
@@ -1,12 +1,14 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ApiInterfaceRx } from '@polkadot/api/types';
import { DeriveContractFees } from '../types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveContractFees } from '../types';
import BN from 'bn.js';
import { Observable, of } from 'rxjs';
import { map } from 'rxjs/operators';
import { of } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './fees';
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './proposals';
+7 -7
View File
@@ -1,18 +1,18 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ApiInterfaceRx } from '@polkadot/api/types';
import { Hash } from '@polkadot/types/interfaces';
import { DeriveCollectiveProposal } from '../types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Hash } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveCollectiveProposal } from '../types';
import { Observable } from 'rxjs';
import { proposal as collectiveProposal, proposals as collectiveProposals } from '../collective';
import { memo } from '../util';
export function proposal (instanceId: string, api: ApiInterfaceRx): (hash: Hash | Uint8Array | string) => Observable<DeriveCollectiveProposal | null> {
return memo(instanceId, collectiveProposal(instanceId, api));
return memo(instanceId, collectiveProposal(instanceId, api, 'council'));
}
export function proposals (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveCollectiveProposal[]> {
return memo(instanceId, collectiveProposals(instanceId, api));
return memo(instanceId, collectiveProposals(instanceId, api, 'council'));
}
+2 -2
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { AccountId, Balance } from '@polkadot/types/interfaces';
import type { AccountId, Balance } from '@polkadot/types/interfaces';
export interface DeriveCouncilVote {
stake: Balance;
+27 -16
View File
@@ -1,29 +1,37 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { AccountId, Balance } from '@polkadot/types/interfaces';
import { ITuple } from '@polkadot/types/types';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { DeriveCouncilVote, DeriveCouncilVotes } from '../types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Vec } from '@polkadot/types';
import type { AccountId, Balance, Voter } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveCouncilVote, DeriveCouncilVotes } from '../types';
import { Observable, combineLatest } from 'rxjs';
import { map } from 'rxjs/operators';
import { Vec } from '@polkadot/types';
import { combineLatest } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
// Voter is current tuple is 2.x-era
type VoteEntry = Voter | ITuple<[Balance, Vec<AccountId>]>;
function isVoter (value: VoteEntry): value is Voter {
return !Array.isArray(value);
}
function retrieveStakeOf (api: ApiInterfaceRx): Observable<[AccountId, Balance][]> {
return (api.query.electionsPhragmen || api.query.elections).stakeOf.entries<Balance>().pipe(
return (api.query.electionsPhragmen || api.query.elections).stakeOf.entries<Balance, [AccountId]>().pipe(
map((entries) =>
entries.map(([key, stake]) => [key.args[0] as AccountId, stake])
entries.map(([{ args: [accountId] }, stake]) => [accountId, stake])
)
);
}
function retrieveVoteOf (api: ApiInterfaceRx): Observable<[AccountId, AccountId[]][]> {
return (api.query.electionsPhragmen || api.query.elections).votesOf.entries<Vec<AccountId>>().pipe(
return (api.query.electionsPhragmen || api.query.elections).votesOf.entries<Vec<AccountId>, [AccountId]>().pipe(
map((entries) =>
entries.map(([key, votes]) => [key.args[0] as AccountId, votes])
entries.map(([{ args: [accountId] }, votes]) => [accountId, votes])
)
);
}
@@ -55,11 +63,14 @@ function retrievePrev (api: ApiInterfaceRx): Observable<DeriveCouncilVotes> {
function retrieveCurrent (api: ApiInterfaceRx): Observable<DeriveCouncilVotes> {
const elections = (api.query.electionsPhragmen || api.query.elections);
return elections.voting.entries<ITuple<[Balance, Vec<AccountId>]>>().pipe(
return elections.voting.entries<VoteEntry, [AccountId]>().pipe(
map((entries): DeriveCouncilVotes =>
entries.map(([key, [stake, votes]]): [AccountId, DeriveCouncilVote] =>
[key.args[0] as AccountId, { stake, votes }]
)
entries.map(([{ args: [accountId] }, value]): [AccountId, DeriveCouncilVote] => [
accountId,
isVoter(value)
? { stake: value.stake, votes: value.votes }
: { stake: value[0], votes: value[1] }
])
)
);
}
+7 -6
View File
@@ -1,12 +1,13 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { AccountId } from '@polkadot/types/interfaces';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { DeriveCouncilVote } from '../types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { AccountId } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveCouncilVote } from '../types';
import { map } from '@polkadot/x-rxjs/operators';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { memo } from '../util';
export function votesOf (instanceId: string, api: ApiInterfaceRx): (accountId: string | Uint8Array | AccountId) => Observable<DeriveCouncilVote> {
@@ -1,15 +1,16 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { BlockNumber, Hash, ReferendumIndex, Scheduled } from '@polkadot/types/interfaces';
import { ITuple } from '@polkadot/types/types';
import { DeriveDispatch, DeriveProposalImage } from '../types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option, u64, Vec } from '@polkadot/types';
import type { BlockNumber, Hash, ReferendumIndex, Scheduled } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveDispatch, DeriveProposalImage } from '../types';
import { Observable, combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { Option, Vec, u64 } from '@polkadot/types';
import { isFunction, stringToHex } from '@polkadot/util';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -50,7 +51,7 @@ function schedulerEntries (api: ApiInterfaceRx): Observable<[BlockNumber[], Opti
api.query.scheduler.agenda.keys()
),
switchMap((keys) => {
const blockNumbers = keys.map((key) => key.args[0] as BlockNumber);
const blockNumbers = keys.map(({ args: [blockNumber] }) => blockNumber);
return combineLatest([
of(blockNumbers),
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './dispatchQueue';
+9 -7
View File
@@ -1,15 +1,17 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { AccountId, ReferendumInfo, ReferendumInfoFinished, ReferendumInfoTo239, Vote, VotingDelegating, VotingDirect, VotingDirectVote } from '@polkadot/types/interfaces';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { DeriveDemocracyLock } from '../types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option } from '@polkadot/types';
import type { AccountId, ReferendumInfo, ReferendumInfoFinished, ReferendumInfoTo239, Vote, VotingDelegating, VotingDirect, VotingDirectVote } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveDemocracyLock } from '../types';
import BN from 'bn.js';
import { Observable, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { Option } from '@polkadot/types';
import { BN_ZERO, isUndefined } from '@polkadot/util';
import { of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -1,14 +1,15 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Hash, VoteThreshold } from '@polkadot/types/interfaces';
import { ITuple } from '@polkadot/types/types';
import { DeriveProposalExternal } from '../types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option } from '@polkadot/types';
import type { Hash, VoteThreshold } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveProposalExternal } from '../types';
import { Observable, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { Option } from '@polkadot/types';
import { of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -1,14 +1,14 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { AccountId, Balance, BlockNumber, Hash } from '@polkadot/types/interfaces';
import { ITuple } from '@polkadot/types/types';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { DeriveProposalImage } from '../types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Bytes, Option } from '@polkadot/types';
import type { AccountId, Balance, BlockNumber, Hash } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveProposalImage } from '../types';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { Bytes, Option } from '@polkadot/types';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
import { parseImage } from './util';
@@ -1,14 +1,14 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { AccountId, Balance, BlockNumber, Hash } from '@polkadot/types/interfaces';
import { ITuple } from '@polkadot/types/types';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { DeriveProposalImage } from '../types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Bytes, Option } from '@polkadot/types';
import type { AccountId, Balance, BlockNumber, Hash } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveProposalImage } from '../types';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { Bytes, Option } from '@polkadot/types';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
import { parseImage } from './util';
+10 -9
View File
@@ -1,15 +1,16 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { AccountId, Balance, Hash, PropIndex } from '@polkadot/types/interfaces';
import { ITuple } from '@polkadot/types/types';
import { DeriveProposalImage, DeriveProposal } from '../types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option, Vec } from '@polkadot/types';
import type { AccountId, Balance, Hash, PropIndex } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveProposal, DeriveProposalImage } from '../types';
import { Observable, combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { Option, Vec } from '@polkadot/types';
import { isFunction } from '@polkadot/util';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -50,7 +51,7 @@ function parse ([proposals, images, optDepositors]: Result): DeriveProposal[] {
export function proposals (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveProposal[]> {
return memo(instanceId, (): Observable<DeriveProposal[]> =>
api.query.democracy?.publicProps && api.query.democracy?.preimages
isFunction(api.query.democracy?.publicProps) && isFunction(api.query.democracy?.preimages)
? api.query.democracy.publicProps<Proposals>().pipe(
switchMap((proposals) =>
combineLatest([
@@ -1,12 +1,14 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ApiInterfaceRx } from '@polkadot/api/types';
import { ReferendumIndex } from '@polkadot/types/interfaces';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { ReferendumIndex } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import BN from 'bn.js';
import { Observable, of } from 'rxjs';
import { map } from 'rxjs/operators';
import { of } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -1,11 +1,12 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ApiInterfaceRx } from '@polkadot/api/types';
import { DeriveReferendumExt } from '../types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveReferendumExt } from '../types';
import { Observable, combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -1,11 +1,12 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ApiInterfaceRx } from '@polkadot/api/types';
import { DeriveReferendum } from '../types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveReferendum } from '../types';
import { Observable, of } from 'rxjs';
import { switchMap } from 'rxjs/operators';
import { of } from '@polkadot/x-rxjs';
import { switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -1,12 +1,12 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ApiInterfaceRx } from '@polkadot/api/types';
import { ReferendumInfo, ReferendumInfoFinished } from '@polkadot/types/interfaces';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option } from '@polkadot/types';
import type { ReferendumInfo, ReferendumInfoFinished } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import { Observable } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { Option } from '@polkadot/types';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -1,15 +1,17 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ApiInterfaceRx } from '@polkadot/api/types';
import { AccountId, ReferendumInfo, ReferendumInfoTo239, Vote, Voting, VotingDirectVote, VotingDelegating } from '@polkadot/types/interfaces';
import { DeriveBalancesAccount, DeriveReferendum, DeriveReferendumVote, DeriveReferendumVotes } from '../types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option, Vec } from '@polkadot/types';
import type { AccountId, ReferendumInfo, ReferendumInfoTo239, Vote, Voting, VotingDelegating, VotingDirectVote } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveBalancesAccount, DeriveReferendum, DeriveReferendumVote, DeriveReferendumVotes } from '../types';
import BN from 'bn.js';
import { Observable, of, combineLatest } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { Option, Vec } from '@polkadot/types';
import { isFunction } from '@polkadot/util';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
import { calcVotes, getStatus, parseImage } from './util';
@@ -65,9 +67,9 @@ function extractVotes (mapped: [AccountId, Voting][], referendumId: BN): DeriveR
}
function votesCurr (api: ApiInterfaceRx, referendumId: BN): Observable<DeriveReferendumVote[]> {
return api.query.democracy.votingOf.entries<Voting>().pipe(
return api.query.democracy.votingOf.entries<Voting, [AccountId]>().pipe(
map((allVoting): DeriveReferendumVote[] => {
const mapped = allVoting.map(([key, voting]): [AccountId, Voting] => [key.args[0] as AccountId, voting]);
const mapped = allVoting.map(([{ args: [accountId] }, voting]): [AccountId, Voting] => [accountId, voting]);
const votes = extractVotes(mapped, referendumId);
const delegations = mapped
.filter(([, voting]) => voting.isDelegating)

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