Compare commits

...
787 Commits
Author SHA1 Message Date
Github Actions 4c2593629d [CI Skip] release/stable 4.15.1
skip-checks: true
2021-06-19 09:34:55 +00:00
Jaco 612d85ca2a 4.15 (#3679)
* 4.15

* CHANGELOG
2021-06-19 11:24:31 +02:00
Jaco Greeff b25b92dddc Metadata generation has spaces between lines 2021-06-19 11:48:49 +03:00
Github Actions f01376ebe1 [CI Skip] release/beta 4.14.2-11
skip-checks: true
2021-06-19 08:38:55 +00:00
Jaco 03acde19b8 Expand nested getTypeDef tests (#3678)
* Expand nested getTypeDef tests

* Rename to fallback

* Remove --detectOpenHandles
2021-06-19 10:27:01 +02:00
Alexander Popiak 1de533ca9c add ChargeAssetTxPayment to SignedExtensions (#3668) 2021-06-19 09:50:30 +02:00
Jaco ce2037400c Bump common (#3677) 2021-06-19 09:18:04 +02:00
Github Actions 379fe12979 [CI Skip] release/beta 4.14.2-10
skip-checks: true
2021-06-19 06:21:43 +00:00
Jaco a285f53753 Add compatibility export for GenericAddress (#3676)
* Add compatibility export for GenericAddress

* GenericAddress -> GenericMultiAddress (new form)
2021-06-19 08:10:36 +02:00
Github Actions ed36eed112 [CI Skip] release/beta 4.14.2-9
skip-checks: true
2021-06-18 13:48:37 +00:00
Jaco ddf6f574f6 XcmOrigin definition (#3675)
* XcmOrigin definition

* CHANGELOG
2021-06-18 15:39:48 +02:00
Github Actions 4f7c4e8b4e [CI Skip] release/beta 4.14.2-8
skip-checks: true
2021-06-18 13:35:09 +00:00
Jaco f2a82ddd0f Allow for nested fixed vec defintions (#3673)
* Allow for nested fixed vec defintions

* struct with nested struct & tuple

* extract conversion to type string

* Include < & > in split iteration

* Allow for nested ( & )

* CHANGELOG
2021-06-18 15:23:54 +02:00
Github Actions 3cec316683 [CI Skip] release/beta 4.14.2-7
skip-checks: true
2021-06-18 13:08:49 +00:00
Jaco c23b5e674b Adjust module checks (& allow for nonce-only) (#3672) 2021-06-18 15:00:20 +02:00
Github Actions 8bf8222c31 [CI Skip] release/beta 4.14.2-6
skip-checks: true
2021-06-18 06:28:17 +00:00
Jaco 0c19e966cc Add BeefyId (#3671)
* Add BeefyId

* Alias
2021-06-18 08:19:00 +02:00
Github Actions 9fbda5a6e0 [CI Skip] release/beta 4.14.2-5
skip-checks: true
2021-06-17 07:38:18 +00:00
Jaco 3d7d39073f Remove isStakerPayout flag (#3665) 2021-06-17 09:26:50 +02:00
Github Actions ae26aebdf8 [CI Skip] release/beta 4.14.2-4
skip-checks: true
2021-06-16 11:52:28 +00:00
Alexander PopiakandJaco c43f442fb9 handle empty account data/missing balance gracefully (#3658)
* handle empty account data/missing balance gracefully

* check whether data is empty

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

* pull out zero balance function

Co-authored-by: Jaco <jacogr@gmail.com>
2021-06-16 13:41:23 +02:00
Github Actions f97a6d0418 [CI Skip] release/beta 4.14.2-3
skip-checks: true
2021-06-15 09:19:27 +00:00
Jaco 7cd2fa5f6a Additional check for API connection & decoration in contracts (#3654)
* Additional check for API connection & decoration in contracts

* Remove snuck-in-file
2021-06-15 11:08:47 +02:00
Github Actions 6015552aab [CI Skip] release/beta 4.14.2-2
skip-checks: true
2021-06-15 07:05:21 +00:00
Jaco 8748c02b20 Adjust error message for contracts V3 (#3653)
* Adjust error message for contracts V3

* Adjust mock API
2021-06-15 08:54:43 +02:00
Github Actions 6e04d4aa93 [CI Skip] release/beta 4.14.2-1
skip-checks: true
2021-06-15 06:33:15 +00:00
Jaco 4a955f7b77 Add support for childstate_getKeysPaged RPC (#3652)
* Add support for childstate_getKeysPaged RPC

* Optional last
2021-06-15 08:22:51 +02:00
Github Actions 227143728d [CI Skip] release/beta 4.14.2-0
skip-checks: true
2021-06-15 06:19:06 +00:00
Jaco 7330555c37 Latest metadata (#3647) 2021-06-15 08:08:16 +02:00
Github Actions 09831fe325 [CI Skip] release/stable 4.14.1
skip-checks: true
2021-06-14 09:19:12 +00:00
Jaco c7dda6fe85 4.14 (#3646) 2021-06-14 11:08:27 +02:00
Github Actions 285bbab055 [CI Skip] release/beta 4.13.2-12
skip-checks: true
2021-06-14 08:35:39 +00:00
Xiliang Chen b73010a506 add Authority origin (#3645) 2021-06-14 10:25:33 +02:00
Github Actions 9c951fe1cb [CI Skip] release/beta 4.13.2-11
skip-checks: true
2021-06-14 06:18:55 +00:00
Jaco f7dfb633d6 Bump deps (#3644)
* Bump deps

* Adjust base test timeouts
2021-06-14 08:07:54 +02:00
Github Actions e32286b610 [CI Skip] release/beta 4.13.2-10
skip-checks: true
2021-06-14 05:08:25 +00:00
Jaco fe2687b514 Add GeneralCouncil as origin until solution is available (#3643) 2021-06-14 06:59:11 +02:00
Github Actions 1adde99e1b [CI Skip] release/beta 4.13.2-9
skip-checks: true
2021-06-12 15:01:26 +00:00
André Silva 33dcc9c8aa add support for ValidationCodeHash (#3640) 2021-06-12 17:52:20 +03:00
Github Actions db563bc131 [CI Skip] release/beta 4.13.2-8
skip-checks: true
2021-06-12 08:40:26 +00:00
hamidra 35d2fa31e0 Fix typo and add missing type (#3639)
fixing a typo and also seems the 'attribute': 'u32' is missing from ClassDetails struct.
https://github.com/paritytech/substrate/blob/41ab01a8cb2a43f7d743778c066ad91453e0c883/frame/uniques/src/types.rs#L54
2021-06-12 10:29:10 +02:00
Github Actions 399637280c [CI Skip] release/beta 4.13.2-7
skip-checks: true
2021-06-11 16:22:23 +00:00
Jaco f46916b215 djust keys/entries retrieval batch sizes (#3638) 2021-06-11 18:09:47 +02:00
Github Actions 94aa79d1e5 [CI Skip] release/beta 4.13.2-6
skip-checks: true
2021-06-11 11:04:45 +00:00
Jaco 10dacf1d16 Correct dangling (old-style) HttpProvider docs (#3635) 2021-06-11 12:54:10 +02:00
Jaco bdaacfdd56 BN import from util (#3637)
* BN import from util

* Update packages/api-derive/src/staking/stakerRewards.ts
2021-06-11 12:52:21 +02:00
Github Actions 4fa77b3654 [CI Skip] release/beta 4.13.2-5
skip-checks: true
2021-06-09 13:28:42 +00:00
Jaco 400e14d6c9 Explicit length checks for u8aFixed (#3630)
* Explicit length checks for u8aFixed

* Adjust tests
2021-06-09 15:19:48 +02:00
Github Actions 09f247432f [CI Skip] release/beta 4.13.2-4
skip-checks: true
2021-06-09 05:34:53 +00:00
Jaco fd195dd4f0 Add Kusama 9040 upgrade block (#3625) 2021-06-09 07:23:01 +02:00
Github Actions 0038227680 [CI Skip] release/beta 4.13.2-3
skip-checks: true
2021-06-08 15:16:16 +00:00
Jaco Greeff 89dec0bc0b .prettierignore 2021-06-08 18:05:18 +03:00
Github Actions a55a835504 [CI Skip] release/beta 4.13.2-2
skip-checks: true
2021-06-07 14:10:52 +00:00
Jaco Greeff c1266a6657 Merge branch 'master' of github.com:polkadot-js/api 2021-06-07 17:00:30 +03:00
Jaco Greeff b78f08e2e6 Adjust cron locks 2021-06-07 17:00:25 +03:00
Github Actions 298ef03787 [CI Skip] release/beta 4.13.2-1
skip-checks: true
2021-06-07 13:59:20 +00:00
Jaco Greeff dd80b1873c lock cron 2021-06-07 16:48:23 +03:00
Github Actions f7672e053b [CI Skip] release/beta 4.13.2-0
skip-checks: true
2021-06-07 05:48:23 +00:00
Jaco 281e9d2dee Adjust semgrep check (#3624) 2021-06-07 07:37:28 +02:00
Github Actions 3f0d11b026 [CI Skip] release/stable 4.13.1
skip-checks: true
2021-06-06 19:30:05 +00:00
Jaco 0c997d2850 4.13 (#3623) 2021-06-06 21:18:30 +02:00
Github Actions cb0beea7cd [CI Skip] release/beta 4.12.2-20
skip-checks: true
2021-06-05 11:19:19 +00:00
Jaco Greeff 4ed783878d No semgrep.yml on forks 2021-06-05 14:07:41 +03:00
Github Actions 3846b5cc18 [CI Skip] release/beta 4.12.2-19
skip-checks: true
2021-06-05 06:49:48 +00:00
Jaco Greeff 57b8915101 push-master.yml adjust skip 2021-06-05 09:38:02 +03:00
Github Actions 4f3f7e8dff [CI Skip] release/beta 4.12.2-18
skip-checks: true
2021-06-05 06:30:54 +00:00
Jaco Greeff a42c266a35 semgrep.yml on PR 2021-06-05 09:20:00 +03:00
Github Actions b03b2db3f8 [CI Skip] release/beta 4.12.2-17
skip-checks: true
2021-06-04 14:50:06 +00:00
Jaco 5347db445d Split page sizes for keys & values on maps (#3620)
* Ssplit page sizes for keys & values on maps

* Adjust semgrep
2021-06-04 16:39:23 +02:00
Github Actions 2a15b65385 [CI Skip] release/beta 4.12.2-16
skip-checks: true
2021-06-04 10:49:58 +00:00
Jaco 7f1952acfc Bump deps (#3618) 2021-06-04 13:40:32 +03:00
Github Actions d8920b4bac [CI Skip] release/beta 4.12.2-15
skip-checks: true
2021-06-04 09:25:48 +00:00
Jaco 3b46505027 Bump static Substrate metadata (#3616)
* Bump static Substrate metadata

* Add size alias
2021-06-04 11:15:11 +02:00
Github Actions ba3ac3f73d [CI Skip] release/beta 4.12.2-14
skip-checks: true
2021-06-04 08:49:45 +00:00
Jaco Greeff 81d460ccc8 Merge branch 'master' of github.com:polkadot-js/api 2021-06-04 11:38:49 +03:00
Jaco Greeff e6bb6c49b3 semgrep on master only 2021-06-04 11:38:45 +03:00
Jaco 82ffa8a6e2 Bump deps (#3617) 2021-06-04 10:37:55 +02:00
Github Actions adc1af1f21 [CI Skip] release/beta 4.12.2-13
skip-checks: true
2021-06-04 05:45:25 +00:00
Jaco Greeff a05d6ad7dc semgrep only for non-forked 2021-06-04 08:36:01 +03:00
Github Actions be592f53b8 [CI Skip] release/beta 4.12.2-12
skip-checks: true
2021-06-03 15:24:02 +00:00
Jaco Greeff 8e74eca435 lock.yml cron 2021-06-03 18:14:53 +03:00
Github Actions 8a28d2cf46 [CI Skip] release/beta 4.12.2-11
skip-checks: true
2021-06-02 16:15:00 +00:00
Jaco Greeff d36886fcbf fix stale.yml 2021-06-02 19:03:46 +03:00
Github Actions 3bbc9fbf6e [CI Skip] release/beta 4.12.2-10
skip-checks: true
2021-06-02 14:36:16 +00:00
Jaco Greeff 1d4539f3ef lock.yml interval 2021-06-02 17:24:17 +03:00
Github Actions 215b20f7db [CI Skip] release/beta 4.12.2-9
skip-checks: true
2021-06-02 07:48:17 +00:00
Jaco c034b54822 Add CandidateInfo type (#3609)
* Add CandidateInfo type

* Adjust lock time
2021-06-02 09:37:47 +02:00
Jaco Greeff 261ca2149d Merge branch 'master' of github.com:polkadot-js/api 2021-06-02 10:07:17 +03:00
Jaco Greeff eaa67c8ea6 cron workflows 2021-06-02 10:07:12 +03:00
Github Actions db287d6997 [CI Skip] release/beta 4.12.2-8
skip-checks: true
2021-06-02 07:07:06 +00:00
Jaco b85bf7e41c setKeys accepts string/Uint8Array (#3608)
* setKeys accepts string/Uint8Array

* CHANGELOG

* Update CHANGELOG

* Westend upgrade block

* --forceExit for jest
2021-06-02 08:56:22 +02:00
Github Actions 84b82dd9b5 [CI Skip] release/beta 4.12.2-7
skip-checks: true
2021-06-02 06:50:02 +00:00
Jaco 3df5b01375 Bump metadata (#3607)
* Bump metadata

* Generate

* s/removeBounded/removeExtensions/
2021-06-02 08:38:17 +02:00
Github Actions 2e6a59e2a0 [CI Skip] release/beta 4.12.2-6
skip-checks: true
2021-06-01 18:04:18 +00:00
Jaco 2f91561166 Westmint spec types (#3602) 2021-06-01 19:54:02 +02:00
Github Actions b307772be2 [CI Skip] release/beta 4.12.2-5
skip-checks: true
2021-06-01 10:09:09 +00:00
Jaco Greeff d14d2ccc86 semgrep.yml 2021-06-01 12:58:25 +03:00
Github Actions 0f26ec47e2 [CI Skip] release/beta 4.12.2-4
skip-checks: true
2021-06-01 06:15:01 +00:00
Jaco Greeff 40065e300b cron daily only 2021-06-01 09:03:59 +03:00
Github Actions bbdb8a317f [CI Skip] release/beta 4.12.2-3
skip-checks: true
2021-05-31 20:27:45 +00:00
Jaco Greeff 668085262c cron locks 2021-05-31 23:15:48 +03:00
Github Actions 508400684a [CI Skip] release/beta 4.12.2-2
skip-checks: true
2021-05-31 12:42:37 +00:00
Jaco 3273556f7b Convert stragging BN type imports (#3595) 2021-05-31 14:32:33 +02:00
Github Actions d36144bf36 [CI Skip] release/beta 4.12.2-1
skip-checks: true
2021-05-31 08:11:04 +00:00
Jaco 444479011e Update .123trigger 2021-05-31 10:00:35 +02:00
Github Actions 8ac713abcf [CI Skip] release/beta 4.12.2-0
skip-checks: true
2021-05-31 07:58:00 +00:00
Jaco Greeff 728bc5294f Bump dev 2021-05-31 10:47:09 +03:00
Jaco fd2f331bdf Bump dev (#3594) 2021-05-31 09:19:54 +02:00
Jaco Greeff 2aebbb89cb lock.yml 2021-05-30 22:23:25 +03:00
Github Actions 532c011495 [CI Skip] release/beta 4.12.2-0
skip-checks: true
2021-05-30 10:52:28 +00:00
Jaco e2802df9ce Bump berry (#3592) 2021-05-30 12:41:59 +02:00
Github Actions cc181e2cc3 [CI Skip] release/stable 4.12.1
skip-checks: true
2021-05-30 06:36:49 +00:00
Jaco 1b8ba41715 4.12 (#3590)
* 4.12

* Bump dev
2021-05-30 08:25:51 +02:00
Github Actions 648be9aecb [CI Skip] release/beta 4.11.3-9
skip-checks: true
2021-05-30 05:52:02 +00:00
Jaco 292af97dc9 Eth RPC def cleanups (#3589) 2021-05-30 07:40:26 +02:00
Github Actions bcdd537214 [CI Skip] release/beta 4.11.3-8
skip-checks: true
2021-05-29 08:29:57 +00:00
Jaco Greeff 514c5e4825 Update stale.yml 2021-05-29 11:19:23 +03:00
Github Actions 9b9581487d [CI Skip] release/beta 4.11.3-7
skip-checks: true
2021-05-28 14:39:22 +00:00
Jaco d443f31a9a Kusama 9030 upgrade block (#3584) 2021-05-28 16:30:14 +02:00
Github Actions 3951da5df3 [CI Skip] release/beta 4.11.3-6
skip-checks: true
2021-05-28 08:50:52 +00:00
Jaco Greeff 5f3a1e5b24 Update stale.yml 2021-05-28 11:39:43 +03:00
Github Actions b1a6ccd425 [CI Skip] release/beta 4.11.3-5
skip-checks: true
2021-05-28 08:26:21 +00:00
Jaco adc40e581f Add stale.yml (#3582) 2021-05-28 10:14:47 +02:00
Jaco c6b0b0c161 Remove confusing external-use rpc-core README (#3581)
Closes https://github.com/polkadot-js/api/issues/3580
2021-05-28 10:14:24 +02:00
Github Actions bf5b14580b [CI Skip] release/beta 4.11.3-4
skip-checks: true
2021-05-28 07:08:13 +00:00
Jaco 088c02862b Added 9030 upgrade block for Westend (#3579) 2021-05-28 08:59:04 +02:00
Github Actions a05980900e [CI Skip] release/beta 4.11.3-3
skip-checks: true
2021-05-28 06:47:44 +00:00
Jaco 77019def08 Allow storage queries with default keys values (#3578)
* Allow storage queries with default keys values

* Cleanups

* Adjust

* Tuple test
2021-05-28 08:37:08 +02:00
Github Actions ae6a3307b1 [CI Skip] release/beta 4.11.3-2
skip-checks: true
2021-05-27 15:25:37 +00:00
Jaco 8cb15c6a87 Update Substrate static metadata (#3576) 2021-05-27 17:13:57 +02:00
Github Actions 389dbb58a9 [CI Skip] release/beta 4.11.3-1
skip-checks: true
2021-05-27 08:30:51 +00:00
Jaco 2d02f61fa7 Align Data.Raw decoding with Substrate (32-bytes) (#3573)
* Align Data.Raw decoding with Substrate (32-bytes)

* CHANGELOG

* Encoding test updates

* provider.disconnect

* Adjust provider tests

* Unique connection URLs

* Dangling tests

* detectOpenHandles

* Additional

* Remove rx test (catered for by Promise wrap)

* Additional cleanups to tests
2021-05-27 10:18:56 +02:00
Github Actions 7497ac723f [CI Skip] release/beta 4.11.3-0
skip-checks: true
2021-05-26 06:47:13 +00:00
Arjan Zijderveld 711a145e1e Changed firstSlot and lastSlot to firstPeriod and lastPeriod. Reference: [Polkadot definition source](https://github.com/paritytech/polkadot/blob/master/runtime/common/src/crowdloan.rs#L141) (#3568) 2021-05-26 08:38:22 +02:00
Github Actions 05e3db01ba [CI Skip] release/stable 4.11.2
skip-checks: true
2021-05-24 06:51:49 +00:00
Jaco 6158c07e0a 4.11.2 (#3565) 2021-05-24 08:42:06 +02:00
Github Actions ce505aaf62 [CI Skip] release/stable 4.11.1
skip-checks: true
2021-05-23 16:47:01 +00:00
Jaco 09f9a48037 4.11 (#3564) 2021-05-23 18:37:27 +02:00
Github Actions 700c1cfcd4 [CI Skip] release/beta 4.10.2-10
skip-checks: true
2021-05-23 16:18:10 +00:00
Jaco 7d2463e53f Update entries/keys for max of 256 items per call (#3563) 2021-05-23 18:08:30 +02:00
Github Actions a2ecd9bd3b [CI Skip] release/beta 4.10.2-9
skip-checks: true
2021-05-23 15:50:40 +00:00
Jaco b0de692147 Under Node.js allow for WS receiving up to 16MB messages (#3562) 2021-05-23 17:40:13 +02:00
Github Actions dcd53c76d7 [CI Skip] release/beta 4.10.2-8
skip-checks: true
2021-05-23 15:11:24 +00:00
Jaco 6ed90c6111 Augment NMap entries (#3556)
* Augment NMap entries

* CHANGELOG

* DropLast generic helper

* Keys checkType

* Signular argument

* Adjust augmentation

* Adjust

* restore key types

* NMap iterKey

* NMap keys/entries

* Adjust creation

* Simplify

* Update

* CHANGELOG
2021-05-23 17:00:58 +02:00
Github Actions babef6d7bc [CI Skip] release/beta 4.10.2-7
skip-checks: true
2021-05-23 12:47:52 +00:00
Jaco e2205a65e9 Bump deps (#3560)
* Bump deps

* yargs typing
2021-05-23 14:39:32 +02:00
Github Actions 32d55dfb18 [CI Skip] release/beta 4.10.2-6
skip-checks: true
2021-05-21 05:40:12 +00:00
Jaco 60e0d0eae4 Cleanup Rococo known types (#3555)
* Clenup Rococo known types

* CHANGELOG
2021-05-21 07:28:35 +02:00
Github Actions 9cef1febe1 [CI Skip] release/beta 4.10.2-5
skip-checks: true
2021-05-21 05:07:42 +00:00
Jaco 4c9032fedc Add state_getChildReadProof RPC (#3554)
* Add state_getChildReadProof RPC

* CHANGELOG
2021-05-21 06:58:36 +02:00
Github Actions 5b6f222e5e [CI Skip] release/beta 4.10.2-4
skip-checks: true
2021-05-20 13:28:08 +00:00
Jaco 47235d01bf Add types for Bridges (#3552)
* Add types for Bridges

* Bump deps
2021-05-20 15:17:42 +02:00
Github Actions 32efe83136 [CI Skip] release/beta 4.10.2-3
skip-checks: true
2021-05-20 12:13:02 +00:00
Jaco c4c099e693 Add types for uniques (#3551) 2021-05-20 14:02:10 +02:00
Github Actions f26ca0e624 [CI Skip] release/beta 4.10.2-2
skip-checks: true
2021-05-20 08:50:31 +00:00
Jaco 5f496f1809 Fix metadata V13 decoding (on NMap) (#3548) 2021-05-20 10:39:26 +02:00
Github Actions f1cbf8cc70 [CI Skip] release/beta 4.10.2-1
skip-checks: true
2021-05-19 15:11:05 +00:00
Jaco 8b7fccb744 DisallowSigned extension (#3547) 2021-05-19 16:59:57 +02:00
Github Actions 66d3486674 [CI Skip] release/beta 4.10.2-0
skip-checks: true
2021-05-18 19:01:54 +00:00
Jaco 2dbd217f6d Alias &'static[u8] -> Text (#3545)
* Alias &'static[u8] -> Text

* Bytes
2021-05-18 20:53:34 +02:00
Jaco fea9ae8f97 Westend has 16 nominator slots (#3544)
* Westend has 16 nominator slots

* CHANGELOG
2021-05-18 20:53:06 +02:00
Jaco 4e81bbc43c Return additional error information from decodeU8a (#3540) 2021-05-18 12:57:48 +02:00
Github Actions 83650b8f28 [CI Skip] release/stable 4.10.1
skip-checks: true
2021-05-17 05:00:09 +00:00
Jaco 50a3501dd2 4.10 (#3539) 2021-05-17 06:49:57 +02:00
Github Actions 526a3fd139 [CI Skip] release/beta 4.9.3-24
skip-checks: true
2021-05-16 18:33:15 +00:00
Jaco 3b996b3444 CompactSolution for 24 nominees (#3537)
* CompactSolution for 24 nominees

* Westend & Rococo

* CompactAssignments: 'CompactAssignmentsTo265'

* With{16, 24}

* CompactAssignmentsWith16 in test

* With16 in historic types

* RawSolution alias

* Types

* Bump common
2021-05-16 20:22:54 +02:00
Github Actions c72c9e4a5e [CI Skip] release/beta 4.9.3-23
skip-checks: true
2021-05-15 05:50:42 +00:00
Jaco 60a71a5ac9 Bump static Substrate metadata (#3532) 2021-05-15 07:39:22 +02:00
Jaco 26c3ccccc3 Additional phragmenElection check (#3531) 2021-05-15 07:32:32 +02:00
Github Actions 963e25934d [CI Skip] release/beta 4.9.3-22
skip-checks: true
2021-05-15 04:54:15 +00:00
Jaco 55d9f8a062 Fix 9010 upgrade blocks (#3530)
* Fix 9010 upgrade blocks

* CHANGELOG
2021-05-15 06:43:51 +02:00
Github Actions 700c8ba21f [CI Skip] release/beta 4.9.3-21
skip-checks: true
2021-05-14 16:16:15 +00:00
Jaco cbc255b4e7 Cater for new phragmenElection module (#3528) 2021-05-14 19:07:47 +03:00
Jaco 2fe1e5031e Add Westend & Kusama blocks for 9100 (#3527) 2021-05-14 18:01:07 +02:00
Github Actions f2cdac7875 [CI Skip] release/beta 4.9.3-20
skip-checks: true
2021-05-13 19:29:42 +00:00
Jaco 165405bdc3 Contracts read for variable-length bytes (#3526) 2021-05-13 21:19:11 +02:00
Github Actions f86d71524d [CI Skip] release/beta 4.9.3-19
skip-checks: true
2021-05-13 15:34:14 +00:00
Jaco 4d6d59f1c5 Adjust Compact toBigInt() (#3525) 2021-05-13 17:23:46 +02:00
Github Actions 7a709898e5 [CI Skip] release/beta 4.9.3-18
skip-checks: true
2021-05-13 07:17:24 +00:00
Jaco 121bfc7913 VecFixed with hex inputs (& adjust isPedantic) (#3522)
* VecFixed with hex inputs (& adjust isPedantic)

* Update packages/types/src/codec/VecFixed.spec.ts

* Cleanups
2021-05-13 09:08:52 +02:00
Github Actions a04ccec445 [CI Skip] release/beta 4.9.3-17
skip-checks: true
2021-05-13 05:21:42 +00:00
Jaco 2611fc5e1a Handle Text is same way as Bytes (isPedantic mode) (#3521)
* Handle Text is same was as Bytes (isPedantic mode)

* Length on input

* tests

* raw decoding test
2021-05-13 07:10:44 +02:00
Github Actions cd5c306b22 [CI Skip] release/beta 4.9.3-16
skip-checks: true
2021-05-12 16:55:21 +00:00
Branan Riley ca6a7819f6 Update centrifuge-chain types for updated substrate used in parachain (#3520) 2021-05-12 18:44:35 +02:00
Github Actions 29c0ea9856 [CI Skip] release/beta 4.9.3-15
skip-checks: true
2021-05-12 13:21:30 +00:00
Jaco c82ed58d68 Bump common (#3519) 2021-05-12 15:11:14 +02:00
Github Actions 59a3867c50 [CI Skip] release/beta 4.9.3-14
skip-checks: true
2021-05-11 10:35:32 +00:00
Jaco 0fca4e6866 Raw getHeader value for metadata determination (#3490)
* Raw getHeader value for metadata determination

* Don't cache raw/json RPC calls

* getRuntimeVersion via .json RPC

* Minimal RuntimeVersion type

* getMetadata with isHistoric

* User .raw for Metadata

* Adjust types

* Updates

* Remove (now-unused) isCached

* Update packages/api/src/base/Init.ts

* Update packages/api/src/base/Init.ts

* Apply suggestions from code review

* Only decorate registry on scale

* tidy typings

* typing

* Linting updates

* CHANGELOG

* V2 contracts
2021-05-11 12:25:27 +02:00
Github Actions 3f9e65a179 [CI Skip] release/beta 4.9.3-13
skip-checks: true
2021-05-11 09:08:46 +00:00
Jaco 92bde9de6f Adjust ABI registry (#3516)
* Adjust ABI registry

* Remove V2 support

* instantiateWithCode mock
2021-05-11 10:58:20 +02:00
Github Actions 9b3158599c [CI Skip] release/beta 4.9.3-12
skip-checks: true
2021-05-11 08:12:16 +00:00
Jaco 206fb49df5 Cater for Abi type offsets in 1+ (#3514)
* Cater for Abi type offsets in 1+

* Update packages/api-contract/src/MetaRegistry.ts
2021-05-11 10:01:27 +02:00
Github Actions cc0ad9b04b [CI Skip] release/beta 4.9.3-11
skip-checks: true
2021-05-10 08:32:30 +00:00
Jaco 39902dd8ac Adjust DispatchError (#3513)
* Adjust DisptachError

* Merge master, rebuild generation
2021-05-10 11:23:15 +03:00
Github Actions 324e4ab89b [CI Skip] release/beta 4.9.3-10
skip-checks: true
2021-05-10 05:06:07 +00:00
KarishmaBothara 68bf0a487f Backward compatibility thing (#3511) 2021-05-10 06:56:04 +02:00
Github Actions 3acf7e0fd7 [CI Skip] release/beta 4.9.3-9
skip-checks: true
2021-05-10 04:45:08 +00:00
Jaco edaf13abe1 Updata cumulus types (#3512)
* Updata cumulus types

* yarn .lock
2021-05-10 06:33:20 +02:00
Github Actions b3649a70ce [CI Skip] release/beta 4.9.3-8
skip-checks: true
2021-05-09 07:58:08 +00:00
Jaco 80ab628643 Adjust contract call result decoding (#3510)
* Adjust types for node/node-template

* Adjust contract call result

* Adjust

* Raw directly

* CHANGELOG
2021-05-09 09:46:21 +02:00
Github Actions 76363c0142 [CI Skip] release/beta 4.9.3-7
skip-checks: true
2021-05-09 07:37:35 +00:00
Jaco 80c18c2201 Adjust types for node/node-template (#3509) 2021-05-09 09:27:23 +02:00
Github Actions fcf9b86b87 [CI Skip] release/beta 4.9.3-6
skip-checks: true
2021-05-07 12:52:17 +00:00
Jaco 1113a3d2f8 Use BN_* constants in contract default params (#3507) 2021-05-07 14:41:08 +02:00
Github Actions c899dbf893 [CI Skip] release/beta 4.9.3-5
skip-checks: true
2021-05-07 11:28:49 +00:00
Jaco be137b2a03 Fix ContractRx query result definitions (#3506) 2021-05-07 13:19:23 +02:00
Github Actions 122d780fe8 [CI Skip] release/beta 4.9.3-4
skip-checks: true
2021-05-07 08:57:49 +00:00
Jaco 12be027b18 Allow for Bounded* type usage (#3504)
* Allow for `Bounded*` type usage

* Adjust start index after found

* Adjust

* Add tests for bounded

* Bounded with length value

* adjust
2021-05-07 10:47:09 +02:00
Github Actions dfeef40037 [CI Skip] release/beta 4.9.3-3
skip-checks: true
2021-05-07 07:26:32 +00:00
Jaco a7b4fe4dd0 Adjust internal TS definitions for providers (#3503) 2021-05-07 09:16:10 +02:00
Github Actions f4ec64d6f5 [CI Skip] release/beta 4.9.3-2
skip-checks: true
2021-05-07 06:15:35 +00:00
JQQQ 9a0d39199e Allow rpc expose definition/ metadata (#3488)
* Expose rpc defination(meta)

* Fix lint

* Change def to meta
2021-05-07 08:04:55 +02:00
Github Actions 77d82d9511 [CI Skip] release/beta 4.9.3-1
skip-checks: true
2021-05-07 06:00:57 +00:00
Jaco 5464b91cc6 Bump dev (#3502) 2021-05-07 07:52:31 +02:00
Github Actions 64ff87952a [CI Skip] release/beta 4.9.3-0
skip-checks: true
2021-05-06 11:12:47 +00:00
WoeOm 0de39e4c52 adapt Darwinia, Crab Network types (#3498) 2021-05-06 13:03:16 +02:00
Github Actions 60bc384d22 [CI Skip] release/stable 4.9.2
skip-checks: true
2021-05-06 10:37:05 +00:00
Jaco Greeff ca7ea0e143 4.9.2 (publish failure on .1) 2021-05-06 13:26:36 +03:00
Github Actions 23d50248de [CI Skip] release/stable 4.9.1
skip-checks: true
2021-05-06 10:07:39 +00:00
Jaco ad4e54a2f6 4.9 (#3497) 2021-05-06 11:57:51 +02:00
Github Actions e659df27ae [CI Skip] release/beta 4.8.2-17
skip-checks: true
2021-05-06 09:09:11 +00:00
Jaco 6dc3c06fe8 Metadata bump for latest Substrate (#3496) 2021-05-06 11:01:00 +02:00
Github Actions 776956f166 [CI Skip] release/beta 4.8.2-16
skip-checks: true
2021-05-06 09:00:25 +00:00
Jaco 4c5203acba Optimize historic metadata retrieval from rpc core (#3495)
* Optimize historic metadata retrieval from rpc core

* Bump deps
2021-05-06 10:50:46 +02:00
Github Actions d80070a041 [CI Skip] release/beta 4.8.2-15
skip-checks: true
2021-05-05 19:44:34 +00:00
Jaco 1c00cb4c4e Align RPCs with Substrate master (#3493)
* Align RPCs with Substrate master

* Build interfaces, apply fixes

* Metadata v13 changes
2021-05-05 21:35:28 +02:00
Github Actions 736505603e [CI Skip] release/beta 4.8.2-14
skip-checks: true
2021-05-05 19:23:44 +00:00
Jaco c243da79e1 Prepare for auto-capability detection for historic queries (#3474)
* Add auto-capability detection for historic queries

* Detect

* Detection via storage length

* Capabilities via storage sizes

* Update CHANGELOG.md

* Explicit

* CHANGELOG

* Westend upgrade block

* Pass registry explcitly

* Updates

* Adjust

* .at remove capabilities call
2021-05-05 21:12:50 +02:00
Github Actions 2677f38090 [CI Skip] release/beta 4.8.2-13
skip-checks: true
2021-05-05 18:45:37 +00:00
Jaco 41d05d2402 Westend 9000 upgrade block (#3491)
* Westend 9000 upgrade block

* Upgrade block for Westend 9000

* Correct block
2021-05-05 20:37:13 +02:00
Github Actions 0f38584566 [CI Skip] release/beta 4.8.2-12
skip-checks: true
2021-05-05 16:38:02 +00:00
André Silva 2b7fb8667e parachains: update HostConfiguration type (#3492) 2021-05-05 19:27:39 +03:00
Github Actions ca18846bfb [CI Skip] release/beta 4.8.2-11
skip-checks: true
2021-05-05 10:04:57 +00:00
Jaco 4ba372d29b Remove deprecated api-contract methods (#3486)
* Remove deprectaed api-contract methods

* Remove deprecated read/exec from checkTypes
2021-05-05 11:54:25 +02:00
Github Actions bdc2d24366 [CI Skip] release/beta 4.8.2-10
skip-checks: true
2021-05-05 07:06:39 +00:00
Jaco 3de06c1d4c Support for metadata v13 (#3465)
* Support for metadata v13

* Lint fixes

* Lastest tag as string

* Documentation

* MagicNumber opt

* NMap enum entry

* NMapTypeLatest

* Adjust for NMap type overrides

* Static from v13

* Basic NMap support

* lint

* Test expectations
2021-05-05 08:55:49 +02:00
Github Actions b51149d895 [CI Skip] release/beta 4.8.2-9
skip-checks: true
2021-05-04 15:09:01 +00:00
Jaco Greeff e0fef55366 Adjust aliasses for paras* 2021-05-04 17:59:18 +03:00
Github Actions e2aac5f94a [CI Skip] release/beta 4.8.2-8
skip-checks: true
2021-05-04 09:45:59 +00:00
Jaco 8f44f84c7f Update ChangesTrieSignal (#3485) 2021-05-04 11:36:02 +02:00
Jaco d53a61ec86 ConsensusEngineId implements [u8; 4] (#3482)
* ConsensusEngineId implements [u8; 4]

* Adjust tests

* isLE
2021-05-04 11:27:01 +02:00
Github Actions cf18f79c14 [CI Skip] release/beta 4.8.2-7
skip-checks: true
2021-05-04 09:26:08 +00:00
Jaco beb8011b4c Adjust ContractInfo types (#3484) 2021-05-04 11:15:38 +02:00
Github Actions 38a601b665 [CI Skip] release/beta 4.8.2-6
skip-checks: true
2021-05-04 08:18:36 +00:00
Jaco 11a3483ce5 Adjust error logs on create (#3480) 2021-05-04 10:08:44 +02:00
Github Actions 1db133b741 [CI Skip] release/beta 4.8.2-5
skip-checks: true
2021-05-03 19:40:32 +00:00
Jaco 716dce0093 Westend 900 upgrade block (#3478) 2021-05-03 21:30:49 +02:00
Github Actions 3b53442172 [CI Skip] release/beta 4.8.2-4
skip-checks: true
2021-05-03 18:21:51 +00:00
Jaco 253d94a47d Adjust re-encoding of BitVec based on decoded length (#3476) 2021-05-03 20:12:37 +02:00
Github Actions fb1129a49b [CI Skip] release/beta 4.8.2-3
skip-checks: true
2021-05-03 17:23:51 +00:00
Jaco 1cc56d6e44 Adjust para types (#3475) 2021-05-03 19:14:15 +02:00
Github Actions 9e2983a735 [CI Skip] release/beta 4.8.2-2
skip-checks: true
2021-05-03 13:33:19 +00:00
Jaco a6fcba95de Adjust capability detection (#3473)
* Adjust capability detection

* Adjust types

* Fully known isU32
2021-05-03 15:24:31 +02:00
Github Actions c8c535834e [CI Skip] release/beta 4.8.2-1
skip-checks: true
2021-05-03 11:55:00 +00:00
Jaco b8d7c2e3e3 Re-add isPedantic check on storage decoding (#3471)
* Re-add isPedantic check on storage decoding

* Additional length log

* Check for existing system

* Adjust output length
2021-05-03 13:45:37 +02:00
Github Actions 0283d4727b [CI Skip] release/beta 4.8.2-0
skip-checks: true
2021-05-03 11:25:48 +00:00
Jaco a4ab732478 Additional Xcm types (#3472) 2021-05-03 13:16:18 +02:00
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
709 changed files with 39530 additions and 13539 deletions
+20 -2
View File
@@ -1,7 +1,25 @@
25
30
1.4.2
1.6.2
1.11.2
1.12.2
1.17.2
1.31.22.8.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
4.9.2
4.11.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'
}
+23
View File
@@ -0,0 +1,23 @@
name: 'Lock Threads'
on:
schedule:
- cron: '30 1/2 * * *'
jobs:
lock:
runs-on: ubuntu-latest
steps:
- uses: dessant/lock-threads@v2
with:
github-token: ${{ secrets.GH_PAT_BOT }}
issue-lock-inactive-days: '7'
issue-lock-comment: >
This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue
if you think you have a related problem or query.
pr-lock-inactive-days: '2'
pr-lock-comment: >
This pull request has been automatically locked since there
has not been any recent activity after it was closed.
Please open a new issue for related bugs.
+1 -8
View File
@@ -6,11 +6,11 @@ on:
jobs:
master:
if: "! startsWith(github.event.head_commit.message, '[CI Skip]')"
strategy:
matrix:
step: ['build:release']
name: ${{ matrix.step }}
if: "! startsWith(github.event.head_commit.message, '[CI Skip]') && github.repository == 'polkadot-js/api'"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
@@ -25,10 +25,3 @@ jobs:
run: |
yarn install --immutable | grep -v 'YN0013'
yarn ${{ matrix.step }}
dummy:
runs-on: ubuntu-latest
steps:
- name: dummy
run: |
echo "Dummy skip step"
+18
View File
@@ -0,0 +1,18 @@
name: Semgrep
on:
pull_request: {}
push:
branches:
- master
jobs:
check:
if: "! startsWith(github.event.head_commit.message, '[CI Skip]') && (!github.event.pull_request || github.event.pull_request.head.repo.full_name == github.repository)"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: returntocorp/semgrep-action@v1
with:
auditOn: push
publishToken: ${{ secrets.SEMGREP_APP_TOKEN }}
publishDeployment: 1395
+17
View File
@@ -0,0 +1,17 @@
name: 'Close stale issues and PRs'
on:
schedule:
- cron: '30 2/2 * * *'
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v3
with:
repo-token: ${{ secrets.GH_PAT_BOT }}
stale-issue-message: 'This issue has been open for 21 days with no activity and is not labelled as an enhancement. It will be closed in 7 days.'
stale-issue-label: 'stale'
exempt-issue-labels: '-size-l,-size-m,-size-s,-size-xl,-size-xs,[bug]'
days-before-stale: 21
days-before-close: 7
+1 -1
View File
@@ -1 +1 @@
12
14
+3
View File
@@ -0,0 +1,3 @@
build
coverage
packages
+4
View File
@@ -0,0 +1,4 @@
// Copyright 2017-2021 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0
module.exports = require('@polkadot/dev/config/prettier.cjs');
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
+591
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -10,4 +10,4 @@ plugins:
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: "@yarnpkg/plugin-version"
yarnPath: .yarn/releases/yarn-2.4.0.cjs
yarnPath: .yarn/releases/yarn-3.0.0-rc.2.cjs
+584
View File
@@ -1,5 +1,589 @@
# CHANGELOG
## 4.15.1 Jun 19, 2021
Upgrade priority: Medium. Recommended for all chains where Xcm is used (addition of new `XcmOrigin`)
Contributed:
- Added `ChargeAssetTxPayment` extension (Thanks to https://github.com/apopiak)
Changes:
- Allow for type decoding of nested fixed vectors, tuples and structs
- Added `childstate_getKeysPaged` RPC
- Add `XcmOrigin` mapping for `OriginCaller` generation
- Align static metadata with latest Substrate
- Adjust error message for contracts V3 (extrinsic from runtime)
- Correct module optionality in `api.derive.balances.account`
- Add alias for `GenericAddress` -> `GenericMultiAddress`
- Adjust metadata doc generation (keep spaces between subsequent lines)
## 4.14.1 Jun 14, 2021
Upgrade priority: Low. Internal adjustment only, no major external usage changes.
Contributed:
- Adjust types for uniques (Thanks to https://github.com/hamidra)
- Add `ValidationCodeHash` type (Thanks to https://github.com/andresilva)
- Extend `OriginCaller` type creation (Thanks to https://github.com/xlc)
Changes:
- Do strict length checking on `[u8; <length>]` type inputs
- Adjust keys/entries retrieval batch sizes
- Add upgrade block for Kusama 9040
- Use `BN` imports from `@polkadot/util`
## 4.13.1 Jun 6, 2021
Upgrade priority: Medium. Required for users connecting to Statemine and future Kusama upgrades.
Changes:
- Overrides for `westmint` spec (same as `statemint`)
- Adjust `tx.session.setKeys` TS augmentation to allow `string` & `Uint8Array` keys
- Add & adjust types for latest Cumulus code
- Added 9031-9033 upgrade block for Westend
- Update static metadata to latest Substrate
- Optimize map retrieval with split page sizes for keys & values
- Sanitizing `BN` imports to `type`-only as required
## 4.12.1 May 30, 2021
Upgrade priority: Low. Internal adjustment only, no major external usage changes.
Changelog:
- Update `FundInfo` type with Polkadot (Thanks to https://github.com/arjanz)
Changes:
- Allow storage queries with default keys values
- Align identity `Data` to limit to 32 bytes in the `Raw` enum (as per Substrate)
- Align static (test & docs-only) metadata with latest Substrate master
- Added 9030 upgrade blocks for Kusama & Westend
- Cleanup of Eth pallet RPC definitions
- Cleanup README for `@polkadot/rpc-core` (recommended for internal-usage only)
- Cleanup internal tests (no dangling handles, cater for Jest 27)
## 4.11.2 May 24, 2021
Upgrade priority: Low. Recommended where users are having TS mismatches with type definitions created on older versions.
Changes:
- Add backwards-compatible TS-only `AugmentedQueryDoubleMap` type (unused now in type generation)
## 4.11.1 May 23, 2021
Upgrade priority: Low. Recommended for users using staking entries on Polkadot and users of Substrate master.
Changes:
- Fix metadata v13 storage decoding on `NMap`
- Add augmentation & keys/entries for NMap types
- Return additional error information from internal u8a decoding failures
- Adjust Westend types for 16 nominators-only
- Add support for `DisallowSigned` (as per shell runtime) extension
- Display small hex-slice with u8a decoding failures
- Add `state_getChildReadProof` RPC
- Cleanup Rococo known types (only as used)
- Under Node.js allow for WS receiving up to 16MB messages
- Update entries/keys for max of 256 items per call
## 4.10.1 May 17, 2021
Upgrade priority: Medium. Recommended for uses of Polkadot/Kusama 9010 runtimes.
- **Breaking change** Support for the contracts V2 compatibility has been dropped in `@polkadot/api-contract`
Contributed:
- Expose RPC definitions via `.meta` (Thanks to https://github.com/jiqiang90)
- Adjust staking derives for chain-specific optional fields (https://github.com/WoeOm)
- Update base Centrifuge types (Thanks to https://github.com/branan)
Changes:
- Allow for `Bounded*` type usage (as per latest Substrate)
- Adjust internal TS definitions for providers
- Fix `ContractRx` query result definitions (no extra Observable)
- Handle contract call RPC result directly as `Raw` (returned as hex)
- Use `BN_*` constants as non-specified defaults in contract interfaces
- Remove all type overrides for node/node-template (API tracks latest)
- Contracts ABI now supports metadata version where indexes are 0-based
- Remove support for the old-style V2 contracts from `@polkadot/api-contract`
- Adjust historic decoration, return as-at registry via `getHeader`, `getMetadata` & `getRuntimeVersion`
- Adjust `VecFixed` to allow for the handling of hex inputs
- Adjust `Compact<*>` to allow for wrapped `toBigInt()` conversions
- Fix `isPedantic` decoding to correctly handle `Text`
- Cater for new `phragmenElection` module naming
- Add Kusama & Westend 9010 upgrade blocks
- Adjust `CompactSolution` for 24 nominators
- Bump static metadata to latest Substrate
## 4.9.1 May 6, 2021
Upgrade priority: Medium. Required for the next v0.9.0 Polkadot/Kusama chain upgrades where parachains are used.
- **Breaking change** The previously deprecated contracts interfaces, has been removed. Update to `<myContract>.query.*`, `<myContract>.tx.*` and `<myCode>.tx.*` interfaces as per the previous code usage hints.
- **Important** By default the `isPedantic` mode is now switched on for storage queries. This means that the API will fail on any types where the input/output decoding doesn't match 100%
Changes:
- Re-add isPedantic check on storage decoding
- `ConsensusEngineId` now implements `[u8;4]` (mapping closer to Rust source)
- Additional Xcm types
- Adjust parachain types
- Remove error logging on createType (details passed in error)
- Adjust `ContractInfo` type as per latest Substrate
- Adjust `DigestItem` type as per latest Substrate
- Adjust re-encoding of `BitVec` based on decoded length
- Added `contracts_instantiate`, `state_traceBlock` & `system_reservedPeers` RPCs
- Prepare for auto-capability detection with historic `.at` queries
- Add known upgrade block for Westend 900 & 9000
- Remove all deprecated interfaces inside `@polkadot/api-contracts`
- Initial support for NMap storage keys
- Support metadata v13 from Substrate (upcoming upgrade)
- Optimize historic metadata retrieval from rpc core
## 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.
+3 -3
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,8 +21,8 @@ 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 -
+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');
+8 -8
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
@@ -13,8 +14,7 @@ module.exports = Object.assign({}, config, {
'@polkadot/typegen(.*)$': '<rootDir>/packages/typegen/src/$1',
'@polkadot/types-known(.*)$': '<rootDir>/packages/types-known/src/$1',
// eslint-disable-next-line sort-keys
'@polkadot/types(.*)$': '<rootDir>/packages/types/src/$1',
'@polkadot/x-rxjs(.*)$': '<rootDir>/packages/x-rxjs/src/$1'
'@polkadot/types(.*)$': '<rootDir>/packages/types/src/$1'
},
modulePathIgnorePatterns: [
'<rootDir>/packages/api/build',
@@ -25,8 +25,8 @@ module.exports = Object.assign({}, config, {
'<rootDir>/packages/rpc-provider/build',
'<rootDir>/packages/typegen/build',
'<rootDir>/packages/types/build',
'<rootDir>/packages/types-known/build',
'<rootDir>/packages/x-rxjs/build'
'<rootDir>/packages/types-known/build'
],
resolver: '@polkadot/dev/config/jest-resolver.cjs'
});
testTimeout: 10000,
transformIgnorePatterns: ['/node_modules/(?!@polkadot|@babel/runtime/helpers/esm/)']
};
+10 -10
View File
@@ -8,7 +8,7 @@
"packages/*"
],
"resolutions": {
"typescript": "^4.1.3"
"typescript": "^4.3.2"
},
"scripts": {
"build": "yarn build:interfaces && polkadot-dev-build-ts",
@@ -20,19 +20,19 @@
"lint": "polkadot-dev-run-lint",
"clean": "polkadot-dev-clean-build",
"postinstall": "polkadot-dev-yarn-only",
"test": "polkadot-dev-run-test --coverage --runInBand --testPathIgnorePatterns e2e",
"test:one": "polkadot-dev-run-test",
"test": "polkadot-dev-run-test --coverage --forceExit --runInBand --testPathIgnorePatterns e2e",
"test:one": "polkadot-dev-run-test --detectOpenHandles --forceExit",
"test:watch": "polkadot-dev-run-test --watch"
},
"devDependencies": {
"@babel/core": "^7.12.10",
"@babel/register": "^7.12.10",
"@babel/runtime": "^7.12.5",
"@polkadot/dev": "^0.61.16",
"@polkadot/ts": "^0.3.58",
"@babel/core": "^7.14.5",
"@babel/register": "^7.14.5",
"@babel/runtime": "^7.14.5",
"@polkadot/dev": "^0.62.42",
"@polkadot/ts": "^0.3.90",
"@polkadot/typegen": "workspace:packages/typegen",
"@types/jest": "^26.0.19",
"@types/jest": "^26.0.23",
"copyfiles": "^2.4.1"
},
"version": "3.2.1"
"version": "4.15.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 -9
View File
@@ -1,10 +1,16 @@
{
"name": "@polkadot/api-contract",
"version": "3.2.1",
"version": "4.15.1",
"type": "module",
"description": "Interfaces for interacting with contracts and contract ABIs",
"main": "index.js",
"module": "index.mjs",
"sideEffects": false,
"sideEffects": [
"./detectPackage.js",
"./detectPackage.cjs"
],
"engines": {
"node": ">=14.0.0"
},
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [],
"contributors": [],
@@ -13,11 +19,10 @@
"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": "3.2.1",
"@polkadot/types": "3.2.1",
"@polkadot/util": "^5.2.2",
"@polkadot/x-rxjs": "3.2.1",
"bn.js": "^4.11.9"
"@babel/runtime": "^7.14.5",
"@polkadot/api": "4.15.1",
"@polkadot/types": "4.15.1",
"@polkadot/util": "^6.9.1",
"@polkadot/x-rxjs": "^6.9.1"
}
}
+23 -1
View File
@@ -1,10 +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 { 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
@@ -27,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());
});
});
+15 -16
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 type { Bytes } from '@polkadot/types';
@@ -6,12 +6,10 @@ import type { ChainProperties, ContractConstructorSpec, ContractEventSpec, Contr
import type { AnyJson, Codec, CodecArg } from '@polkadot/types/types';
import type { AbiConstructor, AbiEvent, AbiMessage, AbiParam, DecodedEvent, DecodedMessage } from './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';
const EMPTY_U8A = new Uint8Array();
const l = logger('Abi');
function findMessage <T extends AbiMessage> (list: T[], messageOrId: T | string | number): T {
@@ -21,7 +19,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 {
@@ -45,13 +43,13 @@ export class Abi {
assert(isObject(json) && !Array.isArray(json) && json.metadataVersion && isObject(json.spec) && !Array.isArray(json.spec) && Array.isArray(json.spec.constructors) && Array.isArray(json.spec.messages), 'Invalid JSON ABI structure supplied, expected a recent metadata version');
this.json = json;
this.registry = new MetaRegistry(chainProperties);
this.registry = new MetaRegistry(json.metadataVersion as string, chainProperties);
this.project = this.registry.createType('ContractProject', json);
this.registry.setMetaTypes(this.project.types);
this.project.types.forEach((_, index) =>
this.registry.getMetaTypeDef({ type: this.registry.createType('SiLookupTypeId', index + 1) })
this.registry.getMetaTypeDef({ type: this.registry.createType('SiLookupTypeId', index + this.registry.typeOffset) })
);
this.constructors = this.project.spec.constructors.map((spec: ContractConstructorSpec, index) =>
this.#createMessage(spec, index, {
@@ -81,7 +79,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 +116,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 +141,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,11 +150,12 @@ 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)
toU8a: (params: CodecArg[]) =>
this.#encodeArgs(spec, args, params)
};
return message;
@@ -185,14 +185,13 @@ export class Abi {
return message.fromU8a(trimmed.subarray(4));
}
#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}`);
#encodeArgs = ({ name, selector }: ContractMessageSpec | ContractConstructorSpec, args: AbiParam[], data: CodecArg[]): Uint8Array => {
assert(data.length === args.length, () => `Expected ${args.length} arguments to contract message '${name.toString()}', found ${data.length}`);
return compactAddLength(
u8aConcat(
this.registry.createType('ContractSelector', selector).toU8a(),
...args.map(({ type }, index) => this.registry.createType(type.type as 'Text', data[index]).toU8a()),
additional
...args.map(({ type }, index) => this.registry.createType(type.type as 'Text', data[index]).toU8a())
)
);
}
@@ -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 fs from 'fs';
+31 -23
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 type { ChainProperties, ContractDisplayName, SiField, SiLookupTypeId, SiType, SiTypeDefArray, SiTypeDefSequence, SiTypeDefTuple, SiTypeDefVariant, SiVariant } from '@polkadot/types/interfaces';
@@ -14,8 +14,8 @@ interface PartialTypeSpec {
}
// convert the offset into project-specific, index-1
export function getRegistryOffset (id: SiLookupTypeId): number {
return id.toNumber() - 1;
export function getRegistryOffset (id: SiLookupTypeId, typeOffset: number): number {
return id.toNumber() - typeOffset;
}
const PRIMITIVE_ALIAS: Record<string, keyof InterfaceTypes> = {
@@ -28,11 +28,16 @@ const PRIMITIVE_ALWAYS = ['AccountId', 'AccountIndex', 'Address', 'Balance'];
export class MetaRegistry extends TypeRegistry {
public readonly metaTypeDefs: TypeDef[] = [];
public readonly typeOffset;
#siTypes: SiType[] = [];
constructor (chainProperties?: ChainProperties) {
constructor (metadataVersion: string, chainProperties?: ChainProperties) {
super();
// type indexes are 1-based pre-1.0 and 0-based post-1.0
this.typeOffset = metadataVersion.split('.')[0] === '0' ? 1 : 0;
if (chainProperties) {
this.setChainProperties(chainProperties);
}
@@ -43,7 +48,7 @@ export class MetaRegistry extends TypeRegistry {
}
public getMetaTypeDef (typeSpec: PartialTypeSpec): TypeDef {
const offset = getRegistryOffset(typeSpec.type);
const offset = getRegistryOffset(typeSpec.type, this.typeOffset);
let typeDef = this.metaTypeDefs[offset];
if (!typeDef) {
@@ -78,19 +83,22 @@ export class MetaRegistry extends TypeRegistry {
}
#getMetaType = (id: SiLookupTypeId): SiType => {
const type = this.#siTypes[getRegistryOffset(id)];
const type = this.#siTypes[getRegistryOffset(id, this.typeOffset)];
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);
}
#extract = (type: SiType, id: SiLookupTypeId): TypeDef => {
const path = [...type.path];
const pathFinal = path.length ? path[path.length - 1].toString() : '';
const isPrimitivePath = !!path.length && (
(path.length > 2 && path[0].eq('ink_env') && path[1].eq('types')) ||
PRIMITIVE_ALWAYS.includes(path[path.length - 1].toString())
);
let typeDef: Omit<TypeDef, 'type'>;
if (type.path.join('::').startsWith('ink_env::types::') || PRIMITIVE_ALWAYS.includes(pathFinal)) {
if (isPrimitivePath) {
typeDef = this.#extractPrimitivePath(type);
} else if (type.def.isPrimitive) {
typeDef = this.#extractPrimitive(type);
@@ -128,7 +136,7 @@ export class MetaRegistry extends TypeRegistry {
}
#extractArray = ({ len: length, type }: SiTypeDefArray): Omit<TypeDef, 'type'> => {
assert(!length || length.toNumber() <= 256, 'MetaRegistry: Only support for [Type; <length>], where length > 256');
assert(!length || length.toNumber() <= 256, 'MetaRegistry: Only support for [Type; <length>], where length <= 256');
return {
info: TypeDefInfo.VecFixed,
@@ -144,27 +152,27 @@ export class MetaRegistry extends TypeRegistry {
]),
[true, true]);
let info;
// check for tuple first (no fields may be available)
if (isTuple) {
info = TypeDefInfo.Tuple;
} else if (isStruct) {
info = TypeDefInfo.Struct;
} else {
throw new Error('Invalid fields type detected, expected either Tuple or Struct');
}
assert(isTuple || isStruct, 'Invalid fields type detected, expected either Tuple or Struct');
const sub = fields.map(({ name, type }) => {
return {
...this.getMetaTypeDef({ type }),
...(name.isSome ? { name: name.unwrap().toString() } : {})
...(name.isSome
? { name: name.unwrap().toString() }
: {}
)
};
});
return isTuple && sub.length === 1
? sub[0]
: { info, sub };
: {
// check for tuple first (no fields may be available)
info: isTuple
? TypeDefInfo.Tuple
: TypeDefInfo.Struct,
sub
};
}
#extractPrimitive = (type: SiType): TypeDef => {
@@ -184,7 +192,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 -3
View File
@@ -1,11 +1,11 @@
// Copyright 2017-2020 @polkadot/api authors & contributors
// Copyright 2017-2021 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0
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';
import { assert, isFunction } from '@polkadot/util';
import { Abi } from '../Abi';
@@ -26,6 +26,7 @@ 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 && api.isConnected && api.tx && api.tx.contracts && Object.keys(api.tx.contracts).length), 'Your API has not been initialized correctly and it not decorated with the runtime interfaces for contracts as retrieved from the on-chain runtime');
assert(isFunction(api.tx.contracts.instantiateWithCode), 'You need to connect to a chain with a runtime with a V3 contracts module. The runtime does not expose api.tx.contracts.instantiateWithCode');
}
}
+21 -58
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 type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
@@ -6,44 +6,17 @@ 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 { BlueprintDeploy, ContractGeneric, MapConstructorExec } from './types';
import BN from 'bn.js';
import type { MapConstructorExec } from './types';
import { SubmittableResult } from '@polkadot/api';
import { ApiBase } from '@polkadot/api/base';
import { Bytes } from '@polkadot/types';
import { compactAddLength, isUndefined, stringCamelCase, u8aToU8a } from '@polkadot/util';
import { randomAsU8a } from '@polkadot/util-crypto';
import { BN_ZERO, 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, encodeSalt } from './util';
export class BlueprintSubmittableResult<ApiType extends ApiTypes> extends SubmittableResult {
public readonly contract?: Contract<ApiType>;
@@ -61,25 +34,16 @@ export class Blueprint<ApiType extends ApiTypes> extends Base<ApiType> {
*/
public readonly codeHash: Hash;
/**
* @deprecated
* @description Deprecated. Use `.tx.<constructorName>`. Creates a contract in a non-deterministic way.
*/
public readonly createContract: ContractGeneric<BlueprintOptions, SubmittableExtrinsic<ApiType, BlueprintSubmittableResult<ApiType>>>;
readonly #tx: MapConstructorExec<ApiType> = {};
constructor (api: ApiBase<ApiType>, abi: AnyJson | Abi, codeHash: string | Hash | Uint8Array, decorateMethod: DecorateMethod<ApiType>) {
super(api, abi, decorateMethod);
this.codeHash = this.registry.createType('Hash', codeHash);
this.createContract = createWithId(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));
}
});
}
@@ -88,20 +52,19 @@ 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>> => {
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
? 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 Contract<ApiType>(this.api, this.abi, record.event.data[1] as AccountId, this._decorateMethod)
))
);
#deploy = (constructorOrId: AbiConstructor | string | number, { gasLimit = BN_ZERO, salt, value = BN_ZERO }: BlueprintOptions, params: CodecArg[]): SubmittableExtrinsic<ApiType, BlueprintSubmittableResult<ApiType>> => {
return this.api.tx.contracts
.instantiate(
value,
gasLimit,
this.codeHash,
this.abi.findConstructor(constructorOrId).toU8a(params),
encodeSalt(salt)
)
.withResultTransform((result: ISubmittableResult) =>
new BlueprintSubmittableResult(result, applyOnEvent(result, ['Instantiated'], ([record]: EventRecord[]) =>
new Contract<ApiType>(this.api, this.abi, record.event.data[1] as AccountId, this._decorateMethod)
))
);
}
}
+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
import fs from 'fs';
+40 -13
View File
@@ -1,33 +1,41 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
import type { ApiTypes, DecorateMethod } from '@polkadot/api/types';
import type { EventRecord, Hash } from '@polkadot/types/interfaces';
import type { AnyJson, ISubmittableResult } from '@polkadot/types/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, BN_ZERO, compactAddLength, isUndefined, isWasm, u8aToU8a } from '@polkadot/util';
import { Abi } from '../Abi';
import { applyOnEvent } from '../util';
import { Base } from './Base';
import { Blueprint } from './Blueprint';
import { Contract } from './Contract';
import { createBluePrintTx, encodeSalt } from './util';
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 +44,37 @@ 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));
}
});
}
/**
* @description Deploy the code bundle, creating a Blueprint.
*/
public createBlueprint (): SubmittableExtrinsic<ApiType, CodeSubmittableResult<ApiType>> {
public get tx (): MapConstructorExec<ApiType> {
return this.#tx;
}
#instantiate = (constructorOrId: AbiConstructor | string | number, { gasLimit = BN_ZERO, salt, value = BN_ZERO }: BlueprintOptions, params: CodecArg[]): SubmittableExtrinsic<ApiType, CodeSubmittableResult<ApiType>> => {
return this.api.tx.contracts
.putCode(compactAddLength(this.code))
.instantiateWithCode(
value,
gasLimit,
compactAddLength(this.code),
this.abi.findConstructor(constructorOrId).toU8a(params),
encodeSalt(salt)
)
.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)
))
new CodeSubmittableResult(result, ...(applyOnEvent(result, ['CodeStored', 'Instantiated'], (records: EventRecord[]) =>
records.reduce<[Blueprint<ApiType>?, Contract<ApiType>?]>(([blueprint, contract], { event }) =>
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],
[])
) || []))
);
}
}
+46 -89
View File
@@ -1,28 +1,28 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
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 { AccountId, EventRecord, Weight } from '@polkadot/types/interfaces';
import type { AnyJson, CodecArg, ISubmittableResult } 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 type { ContractCallResult, ContractCallSend, ContractQuery, ContractTx, MapMessageQuery, MapMessageTx } from './types';
import { SubmittableResult } from '@polkadot/api';
import { ApiBase } from '@polkadot/api/base';
import { assert, bnToBn, isFunction, isUndefined, logger, stringCamelCase } from '@polkadot/util';
import { createTypeUnsafe } from '@polkadot/types';
import { assert, BN, BN_HUNDRED, BN_ONE, BN_ZERO, 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';
import { applyOnEvent, extractOptions, isOptions } from '../util';
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 MAX_CALL_GAS = new BN(5_000_000_000_000).isub(BN_ONE);
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> {
@@ -39,13 +39,6 @@ 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)
? fn(messageOrId, options, params)
: fn(messageOrId, ...extractOptions(options, params));
}
export class ContractSubmittableResult extends SubmittableResult {
public readonly contractEvents?: DecodedEvent[];
@@ -56,51 +49,12 @@ export class ContractSubmittableResult extends SubmittableResult {
}
}
// map from a JSON result to current-style ContractExecResult
function mapExecResult (registry: Registry, json: Record<string, AnyJson>): ContractExecResult {
if (!Object.keys(json).some((key) => ['error', 'success'].includes(key))) {
return registry.createType('ContractExecResult', json);
}
const from = registry.createType('ContractExecResultTo260', json);
if (from.isSuccess) {
const s = from.asSuccess;
return registry.createType('ContractExecResult', {
gasConsumed: s.gasConsumed,
result: {
ok: {
data: s.data,
flags: s.flags
}
}
});
}
// in the old format error has no additional information,
// map it as-is with an "unknown" error
return registry.createType('ContractExecResult', { result: { err: { other: 'unknown' } } });
}
export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
/**
* @description The on-chain address for this contract
*/
public readonly address: AccountId;
/**
* @deprecated
* @description Deprecated. Use `.tx.<messageName>` to send a transaction.
*/
public readonly exec: ContractGeneric<ContractOptions, SubmittableExtrinsic<ApiType>>;
/**
* @deprecated
* @description Deprecated. Use `.tx.<messageName>` to send a transaction.
*/
public readonly read: ContractGeneric<ContractOptions, ContractCallSend<ApiType>>;
readonly #query: MapMessageQuery<ApiType> = {};
readonly #tx: MapMessageTx<ApiType> = {};
@@ -109,18 +63,14 @@ 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.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));
}
});
}
@@ -142,20 +92,27 @@ export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
#getGas = (_gasLimit: BigInt | BN | string | number, isCall = false): BN => {
const gasLimit = bnToBn(_gasLimit);
return gasLimit.lten(0)
return gasLimit.lte(BN_ZERO)
? isCall
? MAX_CALL_GAS
: this.api.consts.system.blockWeights
? this.api.consts.system.blockWeights.perClass.normal.maxExtrinsic.sub(this.api.consts.system.blockWeights.perClass.normal.baseExtrinsic)
: (this.api.consts.system.maximumBlockWeight as Weight).muln(64).divn(100)
: (this.api.consts.system.blockWeights
? this.api.consts.system.blockWeights.maxBlock
: this.api.consts.system.maximumBlockWeight as Weight
).muln(64).div(BN_HUNDRED)
: gasLimit;
}
#exec = (messageOrId: AbiMessage | string | number, { gasLimit = 0, value = 0 }: ContractOptions, params: CodecArg[]): SubmittableExtrinsic<ApiType> => {
#exec = (messageOrId: AbiMessage | string | number, { gasLimit = BN_ZERO, value = BN_ZERO }: ContractOptions, params: CodecArg[]): SubmittableExtrinsic<ApiType> => {
return this.api.tx.contracts
.call(this.address, value, this.#getGas(gasLimit), this.abi.findMessage(messageOrId).toU8a(params))
.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 {
@@ -171,7 +128,7 @@ export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
);
}
#read = (messageOrId: AbiMessage | string | number, { gasLimit = 0, value = 0 }: ContractOptions, params: CodecArg[]): ContractCallSend<ApiType> => {
#read = (messageOrId: AbiMessage | string | number, { gasLimit = BN_ZERO, value = BN_ZERO }: ContractOptions, params: CodecArg[]): ContractCallSend<ApiType> => {
assert(this.hasRpcContractsCall, ERROR_NO_CALL);
const message = this.abi.findMessage(messageOrId);
@@ -179,24 +136,24 @@ export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
return {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
send: this._decorateMethod((origin: string | AccountId | Uint8Array) =>
this.api.rx.rpc.contracts.call.json({
dest: this.address,
gasLimit: this.#getGas(gasLimit, true),
inputData: message.toU8a(params),
origin,
value
}).pipe(map((json): ContractCallOutcome => {
const { debugMessage, gasConsumed, result } = mapExecResult(this.registry, json.toJSON());
return {
debugMessage,
gasConsumed,
output: result.isOk && message.returnType
? formatData(this.registry, result.asOk.data, message.returnType)
: null,
result
};
}))
this.api.rx.rpc.contracts
.call({
dest: this.address,
gasLimit: this.#getGas(gasLimit, true),
inputData: message.toU8a(params),
origin,
value
})
.pipe(
map(({ debugMessage, gasConsumed, result }): ContractCallOutcome => ({
debugMessage,
gasConsumed,
output: result.isOk && message.returnType
? createTypeUnsafe(this.registry, message.returnType.type, [result.asOk.data.toU8a(true)], { isPedantic: true })
: null,
result
}))
)
)
};
}
+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';
+6 -7
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';
@@ -7,13 +7,12 @@ import { TypeRegistry } from '@polkadot/types';
const registry = new TypeRegistry();
export const mockApi = {
isConnected: true,
registry,
rx: {
tx: {
contracts: {
putCode: (): never => {
throw new Error('mock');
}
tx: {
contracts: {
instantiateWithCode: (): never => {
throw new Error('mock');
}
}
}
+3 -3
View File
@@ -1,11 +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 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 { BN } from '@polkadot/util';
import type { Observable } from '@polkadot/x-rxjs';
import type { AbiMessage, BlueprintOptions, ContractCallOutcome, ContractOptions } from '../types';
@@ -30,7 +30,7 @@ export interface ContractGeneric<O, T> {
}
export type ContractCallResult<ApiType extends ApiTypes, T> = ApiType extends 'rxjs'
? Observable<Observable<T>>
? Observable<T>
: Promise<ObsInnerType<Observable<T>>>;
export interface ContractCallSend<ApiType extends ApiTypes> {
+40
View File
@@ -0,0 +1,40 @@
// 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 { BN } from '@polkadot/util';
import type { AbiConstructor, BlueprintOptions } from '../types';
import type { BlueprintDeploy, ContractGeneric } from './types';
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,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
// Simple non-runnable checks to test type definitions in the editor itself
@@ -30,14 +30,12 @@ async function checkContract (api: ApiPromise, pairs: TestKeyringMap): Promise<v
// execute
await contract.tx.inc({ gasLimit: 1234 }, 123).signAndSend(pairs.eve);
await contract.tx.inc(123, 456, 69).signAndSend(pairs.eve);
// deprecated
await contract.read('get', {}).send(pairs.eve.address);
await contract.exec('inc', {}, 123).signAndSend(pairs.dave);
}
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.15.1' };
@@ -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 type { Hash } from '@polkadot/types/interfaces';
+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
import type { ApiPromise } from '@polkadot/api';
@@ -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 type { AccountId } from '@polkadot/types/interfaces';
+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';
+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
import type { BlueprintSubmittableResult as BaseBlueprintSubmittableResult, CodeSubmittableResult as BaseCodeSubmittableResult } from '../base';
+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
import type { Hash } from '@polkadot/types/interfaces';
+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
import type { ApiRx } from '@polkadot/api';
+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
import type { AccountId } from '@polkadot/types/interfaces';
+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';
+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
import type { BlueprintSubmittableResult as BaseBlueprintSubmittableResult, CodeSubmittableResult as BaseCodeSubmittableResult } from '../base';
+4 -3
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 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 { BN } from '@polkadot/util';
import type { Abi } from '.';
export interface ContractBase<ApiType extends ApiTypes> {
@@ -39,9 +39,10 @@ export interface AbiMessage {
isConstructor?: boolean;
isMutating?: boolean;
isPayable?: boolean;
method: string;
returnType?: TypeDef | null;
selector: ContractSelector;
toU8a: (params: CodecArg[], additional?: Uint8Array) => Uint8Array;
toU8a: (params: CodecArg[]) => Uint8Array;
}
export type AbiConstructor = AbiMessage;
+6 -13
View File
@@ -1,28 +1,21 @@
// Copyright 2017-2020 @polkadot/rpc-contract authors & contributors
// Copyright 2017-2021 @polkadot/rpc-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
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 { CodecArg } from '@polkadot/types/types';
import type { BN } from '@polkadot/util';
import type { BlueprintOptions, ContractOptions } from './types';
import BN from 'bn.js';
import { createTypeUnsafe } from '@polkadot/types/create';
import { isBigInt, isBn, isNumber, isString } from '@polkadot/util';
type ContractEvents = 'CodeStored' | 'ContractExecution' | 'Instantiated';
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], { 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 -13
View File
@@ -1,10 +1,16 @@
{
"name": "@polkadot/api-derive",
"version": "3.2.1",
"version": "4.15.1",
"type": "module",
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
"main": "index.js",
"module": "index.mjs",
"sideEffects": false,
"sideEffects": [
"./detectPackage.js",
"./detectPackage.cjs"
],
"engines": {
"node": ">=14.0.0"
},
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [],
"contributors": [],
@@ -13,17 +19,16 @@
"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": "3.2.1",
"@polkadot/rpc-core": "3.2.1",
"@polkadot/types": "3.2.1",
"@polkadot/util": "^5.2.2",
"@polkadot/util-crypto": "^5.2.2",
"@polkadot/x-rxjs": "3.2.1",
"bn.js": "^4.11.9"
"@babel/runtime": "^7.14.5",
"@polkadot/api": "4.15.1",
"@polkadot/rpc-core": "4.15.1",
"@polkadot/types": "4.15.1",
"@polkadot/util": "^6.9.1",
"@polkadot/util-crypto": "^6.9.1",
"@polkadot/x-rxjs": "^6.9.1"
},
"devDependencies": {
"@polkadot/keyring": "^5.2.2",
"@polkadot/rpc-provider": "3.2.1"
"@polkadot/keyring": "^6.9.1",
"@polkadot/rpc-provider": "4.15.1"
}
}
@@ -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 type { ApiInterfaceRx } from '@polkadot/api/types';
+6 -2
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 type { ApiInterfaceRx } from '@polkadot/api/types';
@@ -41,7 +41,11 @@ function parseFlags (address: AccountId | Address | string | null | undefined, [
*/
export function flags (instanceId: string, api: ApiInterfaceRx): (address?: AccountId | Address | string | null) => Observable<DeriveAccountFlags> {
return memo(instanceId, (address?: AccountId | Address | string | null): Observable<DeriveAccountFlags> => {
const councilSection = api.query.electionsPhragmen ? 'electionsPhragmen' : 'elections';
const councilSection = api.query.phragmenElection
? 'phragmenElection'
: api.query.electionsPhragmen
? 'electionsPhragmen'
: 'elections';
return combineLatest<FlagsIntermediate>([
address && api.query[councilSection]?.members
@@ -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 type { ApiInterfaceRx } from '@polkadot/api/types';
@@ -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 type { ApiInterfaceRx } from '@polkadot/api/types';
+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 type { ApiInterfaceRx } from '@polkadot/api/types';
+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 './accountId';
@@ -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 type { ApiInterfaceRx } from '@polkadot/api/types';
+2 -3
View File
@@ -1,8 +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 type { ApiInterfaceRx } from '@polkadot/api/types';
import type { AccountIndex } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { AccountIndexes } from '../types';
@@ -18,7 +17,7 @@ function queryAccounts (api: ApiInterfaceRx): Observable<AccountIndexes> {
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;
+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 type { ApiInterfaceRx } from '@polkadot/api/types';
+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 type { AccountId, AccountIndex, RegistrationJudgement } from '@polkadot/types/interfaces';
+100 -30
View File
@@ -1,29 +1,54 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { ApiInterfaceRx } from '@polkadot/api/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 } from '../types';
import type { DeriveBalancesAccount, DeriveBalancesAccountData } from '../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];
type Result = [Index, BalanceResult[]];
type DeriveCustomAccount = ApiInterfaceRx['derive'] & {
[custom: string]: {
customAccount?: ApiInterfaceRx['query']['balances']['account']
}
}
function zeroBalance (api: ApiInterfaceRx) {
return api.registry.createType('Balance');
}
function getBalance (api: ApiInterfaceRx, [freeBalance, reservedBalance, frozenFee, frozenMisc]: BalanceResult): DeriveBalancesAccountData {
const votingBalance = api.registry.createType('Balance', freeBalance.toBn());
function calcBalances (api: ApiInterfaceRx, [accountId, [freeBalance, reservedBalance, frozenFee, frozenMisc, accountNonce]]: [AccountId, Result]): DeriveBalancesAccount {
return {
accountId,
accountNonce,
freeBalance,
frozenFee,
frozenMisc,
reservedBalance,
votingBalance: api.registry.createType('Balance', freeBalance.toBn())
votingBalance
};
}
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)
};
}
@@ -34,33 +59,66 @@ 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, zeroBalance(api), zeroBalance(api)]]
])
);
}
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 querySystemNonce (api: ApiInterfaceRx, accountId: AccountId): Observable<Result> {
return api.query.system.accountNonce<Index>(accountId).pipe(
map((accountNonce): Result => [
accountNonce,
[[zeroBalance(api), zeroBalance(api), zeroBalance(api), zeroBalance(api)]]
])
);
}
function queryCurrent (api: ApiInterfaceRx, accountId: AccountId): Observable<Result> {
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]);
// NOTE this is for the first case where we do have instances specified
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 querySystemAccount (api: ApiInterfaceRx, accountId: AccountId): Observable<Result> {
// AccountInfo is current, support old, eg. Edgeware
return api.query.system.account<AccountInfo | ITuple<[Index, AccountData]>>(accountId).pipe(
map((infoOrTuple): Result => {
const { feeFrozen, free, miscFrozen, reserved } = (infoOrTuple as AccountInfo).nonce
const data = (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];
const nonce = (infoOrTuple as AccountInfo).nonce || (infoOrTuple as [Index, AccountData])[0];
if (!data || data.isEmpty) {
return [
nonce,
[[zeroBalance(api), zeroBalance(api), zeroBalance(api), zeroBalance(api)]]
];
}
const { feeFrozen, free, miscFrozen, reserved } = data;
return [
nonce,
[[free, reserved, feeFrozen, miscFrozen]]
];
})
);
}
@@ -81,19 +139,31 @@ 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');
const empty: Result = [
api.registry.createType('Index'),
[[zeroBalance(api), zeroBalance(api), zeroBalance(api), zeroBalance(api)]]
];
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)
? querySystemAccount(api, accountId)
: isFunction(api.query.balances?.account)
? queryBalancesAccount(api, accountId)
: isFunction(api.query.balances?.freeBalance)
? queryBalancesFree(api, accountId)
: isFunction(api.query.system?.accountNonce)
? querySystemNonce(api, accountId)
: of(empty)
])
: 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')]])
: of([api.registry.createType('AccountId'), empty])
)
),
map((result): DeriveBalancesAccount => calcBalances(api, result))
+69 -44
View File
@@ -1,21 +1,21 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { ApiInterfaceRx } from '@polkadot/api/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, DeriveBalancesAll } from '../types';
import type { DeriveBalancesAccount, DeriveBalancesAccountData, DeriveBalancesAll, DeriveBalancesAllAccountData } from '../types';
import BN from 'bn.js';
import { bnMax, isFunction } from '@polkadot/util';
import { BN, 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 {
@@ -25,6 +25,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 {
@@ -36,11 +42,11 @@ function calcLocked (api: ApiInterfaceRx, bestNumber: BlockNumber, locks: (Balan
if (Array.isArray(locks)) {
// only get the locks that are valid until passed the current block
lockedBreakdown = (locks as BalanceLockTo212[]).filter(({ until }): boolean => !until || (bestNumber && until.gt(bestNumber)));
allLocked = lockedBreakdown.some(({ amount }) => amount.isMax());
allLocked = lockedBreakdown.some(({ amount }) => amount && amount.isMax());
vestingLocked = api.registry.createType('Balance', lockedBreakdown.filter(({ id }) => id.eq(VESTING_ID)).reduce((result: BN, { amount }) => result.iadd(amount), new BN(0)));
// get the maximum of the locks according to https://github.com/paritytech/substrate/blob/master/srml/balances/src/lib.rs#L699
const notAll = lockedBreakdown.filter(({ amount }) => !amount.isMax());
const notAll = lockedBreakdown.filter(({ amount }) => amount && !amount.isMax());
if (notAll.length) {
lockedBalance = api.registry.createType('Balance', bnMax(...notAll.map(({ amount }): Balance => amount)));
@@ -50,8 +56,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
@@ -59,29 +77,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
};
}
@@ -100,28 +108,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])];
})
);
}
@@ -141,6 +164,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> =>
@@ -148,11 +173,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))
+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 type { ApiInterfaceRx } from '@polkadot/api/types';
+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,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 type { ApiInterfaceRx } from '@polkadot/api/types';
@@ -1,16 +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 type { ApiInterfaceRx } from '@polkadot/api/types';
import type { ApiInterfaceRx, SubmittableExtrinsic } from '@polkadot/api/types';
import type { Bytes, Option, StorageKey } from '@polkadot/types';
import type { Bounty, BountyIndex } from '@polkadot/types/interfaces';
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';
@@ -19,23 +23,67 @@ 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 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(() => {
const api = createApiWithAugmentations();
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(1), storageKey(2)]),
keys: () => of([storageKey(0), storageKey(2), storageKey(3)]),
multi: () => of([optionOf(defaultBounty()), emptyOption('Bounty'), optionOf(defaultBounty())])
},
bountyCount: () => of(bountyIndex(3)),
@@ -55,7 +103,59 @@ describe('bounties derive', () => {
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');
});
});
+33 -15
View File
@@ -1,24 +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 type { ApiInterfaceRx } from '@polkadot/api/types';
import type { DeriveBounties } from '@polkadot/api-derive/types';
import type { DeriveBounties, DeriveCollectiveProposal } from '@polkadot/api-derive/types';
import type { Bytes, Option } from '@polkadot/types';
import type { Bounty, BountyIndex } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { Bounty, BountyIndex, ProposalIndex } from '@polkadot/types/interfaces';
import { memo } from '@polkadot/api-derive/util';
import { combineLatest } from '@polkadot/x-rxjs';
import { combineLatest, Observable, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
type Result = [Option<Bounty>[], Option<Bytes>[]];
import { filterBountiesProposals } from './helpers/filterBountyProposals';
function parseResult ([maybeBounties, maybeDescriptions]: Result): DeriveBounties {
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() });
bounties.push({
bounty: bounty.unwrap(),
description: maybeDescriptions[index].unwrapOrDefault().toUtf8(),
index: ids[index],
proposals: bountyProposals.filter((bountyProposal) => ids[index].eq(bountyProposal.proposal.args[0]))
});
}
});
@@ -26,19 +32,31 @@ function parseResult ([maybeBounties, maybeDescriptions]: Result): DeriveBountie
}
export function bounties (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveBounties> {
const bountyBase = api.query.bounties
? api.query.bounties
: api.query.treasury;
const bountyBase = api.query.bounties || api.query.treasury;
return memo(instanceId, (): Observable<DeriveBounties> =>
bountyBase.bountyCount<BountyIndex>().pipe(
switchMap(() => bountyBase.bounties.keys()),
switchMap((keys): Observable<Result> => {
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)
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)));
}
+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 './bounties';
+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 type { ApiInterfaceRx } from '@polkadot/api/types';
@@ -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 type { ApiInterfaceRx } from '@polkadot/api/types';
@@ -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 type { ApiInterfaceRx } from '@polkadot/api/types';
+6 -4
View File
@@ -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 type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { SignedBlockExtended } from '../type/types';
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';
/**
@@ -27,12 +28,13 @@ export function getBlock (instanceId: string, api: ApiInterfaceRx): (hash: Uint8
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
+4 -3
View File
@@ -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 type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { HeaderExtended } from '../type/types';
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';
/**
@@ -33,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
+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 './bestNumber';
@@ -1,33 +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 type { ApiInterfaceRx } from '@polkadot/api/types';
import type { EventRecord, Hash, SignedBlock } from '@polkadot/types/interfaces';
import type { Vec } from '@polkadot/types';
import type { EventRecord, SignedBlock } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { FullNewBlock } from '../types';
import type { HeaderExtended, SignedBlockExtended } from '../type/types';
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,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 type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { HeaderExtended } from '../type/types';
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';
/**
@@ -29,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 type { 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';
@@ -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 type { ApiInterfaceRx } from '@polkadot/api/types';
@@ -13,6 +13,8 @@ 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[] {
@@ -29,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>([
@@ -49,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> =>
+2 -3
View File
@@ -1,12 +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 type { ApiInterfaceRx } from '@polkadot/api/types';
import type { BN } from '@polkadot/util';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveContractFees } from '../types';
import BN from 'bn.js';
import { of } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
+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';
+3 -3
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 type { ApiInterfaceRx } from '@polkadot/api/types';
@@ -10,9 +10,9 @@ import { proposal as collectiveProposal, proposals as collectiveProposals } from
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'));
}
+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 type { AccountId, Balance } from '@polkadot/types/interfaces';
+22 -12
View File
@@ -1,9 +1,9 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Vec } from '@polkadot/types';
import type { AccountId, Balance } from '@polkadot/types/interfaces';
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';
@@ -13,18 +13,25 @@ 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.phragmenElection || 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.phragmenElection || 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])
)
);
}
@@ -54,20 +61,23 @@ function retrievePrev (api: ApiInterfaceRx): Observable<DeriveCouncilVotes> {
}
function retrieveCurrent (api: ApiInterfaceRx): Observable<DeriveCouncilVotes> {
const elections = (api.query.electionsPhragmen || api.query.elections);
const elections = (api.query.phragmenElection || 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] }
])
)
);
}
export function votes (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveCouncilVotes> {
return memo(instanceId, (): Observable<DeriveCouncilVotes> =>
(api.query.electionsPhragmen || api.query.elections).stakeOf
(api.query.phragmenElection || api.query.electionsPhragmen || api.query.elections).stakeOf
? retrievePrev(api)
: retrieveCurrent(api)
);
+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 type { ApiInterfaceRx } from '@polkadot/api/types';
@@ -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 type { ApiInterfaceRx } from '@polkadot/api/types';
@@ -51,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';
+2 -3
View File
@@ -1,14 +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 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 { BN } from '@polkadot/util';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveDemocracyLock } from '../types';
import BN from 'bn.js';
import { BN_ZERO, isUndefined } from '@polkadot/util';
import { of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
@@ -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 type { ApiInterfaceRx } from '@polkadot/api/types';
@@ -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 type { ApiInterfaceRx } from '@polkadot/api/types';
@@ -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 type { ApiInterfaceRx } from '@polkadot/api/types';
@@ -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 type { ApiInterfaceRx } from '@polkadot/api/types';
@@ -51,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([

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