Compare commits

...

292 Commits

Author SHA1 Message Date
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 Estienne
1ba8f71da1 add client version and sh3 decorators for web3 (#2993)
* add client version and sh3 decorators for web3

* add web3 to rpcCore

* refactored with correct file

* Apply suggestions from code review

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

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

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

* Full generation, with checkTypes

* .is

* Extrinsic with arg type definition

* decorate is

* Call is

* Remove hasOrigin

* Renames

* Query is

* Fix extrinsic is

* Backwards compatibility for generated types

* event with optional AnyTuple

* Cleanups

* Cleanups

* Adjust

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

* Adjust with util array functions

* Remove old enumset support

* Empty controller

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

* Add filters

* Cleanup optional params

* Add ethereum module aliasses

* Split rpc

* Split net RPC

* full block details

* onlyHex

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

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

* Remove RegistryMetadata duplication

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

* typo

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

* Update bounties derive

* Cleanups

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

* Update CHANGELOG.md

* Update CHANGELOG.md

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

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

* Fix detectPackage import

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* fix lint

* e2e tests

* skip lints for api.spec.ts

* remove e2e test from PR

* do not decorate multi() if can not supported

* empty line

* update

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

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

* replaced id with u32

* Apply suggestions from code review

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

* camelCase

* lint

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

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

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

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

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

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

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

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

* dispatch(Info, Error} optional in result

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

* wip

* Some basic tests for derive bounties

* Simplify bounties derive and mocks

* Get bounties and descriptions

* Allow for empty bounties. Refactor tests.

* Move tests to test directory

* Attempt to remove duplication

* Sort imports

* Reorganize tests

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

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

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

* Resort

* Adjust ApiInterfaceRx
2020-12-07 16:26:19 +01:00
631 changed files with 14724 additions and 7303 deletions

View File

@@ -4,4 +4,13 @@
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

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');

View File

@@ -1,5 +1,192 @@
# CHANGELOG
## 3.7.2 Feb 2, 2021
Changes:
- Adjusted the `Keys` type for the 28 runtime on Kusama, Polkadot & Westend
## 3.7.1 Feb 1, 2021
Upgrade priority: Low. However recommended for current Substrate master, Polkadot and Rococo users and those wishing to support the upcoming Polkadot 28 runtime with the new `MultiAddress`.
- **Breaking change** As indicated in the 3.5.1 release notes, the `Address`/`LookupSource` defaults have now been adjusted for `MultiAddress`. If your chain does not use these types, explicitly add the correct `Address`/`LookupSource` types. This new extensible format is mean to cater for all address types into the future, removing a lot of discrepancies between chains.
Contributed:
- Extraction of the block author on Moonbeam (Thanks to https://github.com/joelamouche)
- Cleanup logs with HTTP providers, no subs (Thanks to https://github.com/Tbaut)
Changes:
- Allow `.slice` operator on the `Vec` type
- Apply `MultiAddress` as a default
- Adds support for the upcoming Polkadot 28 and Kusama 2028 runtimes
- Add checkpoint for Kusama 2027 upgrade
- Update all parachain types (as per latest Rococo)
- Correctly use relay blockNumber in parachain validation data
- remove information log for capabilities detection (creates confusion)
- Remove explicit references to `global`, use the `x-global` detection
- Remove explicit `module` in `package.json` (exports map available)
## 3.6.1 Jan 24, 2020
Upgrade priority: Medium if not already on at least 3.3.1. The next upgrade of Kusama/Polkadot requires it.
- **Breaking change** To support chains with multiple tokens, such as bridges, the `ChainProperties` type now returns an array of tokens and decimals (instead of singular values) in the `token{Decimals, Symbol}` getters. Additionally, this means that the `registry` interfaces has been changes, to `registry.chainDecimals: number[]` and `registry.chainTokens: string[]`. Where used the `[0]` index will return the first value if only interested in a single, for a straight conversion.
Changes:
- Allow for the detection of on-chain capabilities as available (e.g. `AccountData`, `ValidatorPrefs`)
- Cater for multiple tokens and decimals in the chain the chain `system.properties` (as per the chain specification)
- Add a `instances: { [key]: [module1, module2] }` definition in teh bundle types, allowing for multiple instances (e.g. Balances)
- Adjust the `api-derive` for balances to retrieve values via `instances` as well as across multiple modules
- Ensure all types are registered for all metadata typegen steps
- Add `rpc.payment.queryFeeDetails` RPC endpoint
- Update types & metadata to latest Substrate
- Move the `@polkadot/x-rxjs` package into the common repo
- Allow doc generation for errors/events (markdown outputs)
## 3.5.1 Jan 18, 2020
Upgrade priority: Low. Recommended for parachain developers.
- **Important** The default for Substrate on the Address types are `MultiAddress`. It is recommended that chains add explicit definitions for `Address` and `LookupSource` in their types, instead of relying on the API-defaults. A future update will swap the API defaults to align with Substrate.
- **Important** Like the above changes in Substrate, the `AccountInfo` structure has also changed. It is recommended that chain developers explicitly add `AccountInfo: 'AccountInfoWithRefCount'` for the version with `refCount` on and `AccountInfoWithProviders` for the latest Substrate version. As per the above, the API defaults will be changed to align with Substrate.
Contributed:
- Apply correct TypeScript type for `toBigInt()` (Thanks to https://github.com/ianhe8x)
- Expand type definitions for storage key tuples (Thanks to https://github.com/monitz87)
- Adjust bounty derive to cater for non-council chains (Thanks to https://github.com/ekowalsk)
Changes:
- Remove recursion in vector/struct U8a stream decoding
- Availability of staking made optional in session length calcs (era does require it)
- Updates to parachain types, ensuring it has coverage for all the latest
- Update all Rococo types to the latest (session keys, session reports, parachain indexes)
- Update known upgrade checkpoints fo WestEnd
- Add types of the lottery module in Substrate
- Add and extend types for the crowdloan module in Polkadot
- Adjust node-template to default to `MultiAddress` on specVersion >= 100
## 3.4.1 Jan 11, 2020
Upgrade priority: Low. Fixes for parachain types, `.entries()` (with no values) and `event.is(...)` checks, users of these interfaces will have benefit.
- **Breaking change** The `derive.chain.{getBlock, subscribeNewBlocks}` now return `SignedBlockExtended`, all with the actual extrinsics and events mapped. Users of the latter interface should take note.
Contributed:
- Fix `SessionKeys{6-9}` definitions (Thanks to https://github.com/icodezjb)
- Support `Vec<(a, b)>` in enums (Thanks to https://github.com/monitz87)
- Add motions to bounty derive (Thanks to https://github.com/ekowalsk)
Changes:
- `derive.chain.getBlock()` now maps events to extrinsics via `.extrinsics` getter
- Ensure dispatchInfo is extracted on failed extrinsics (`getBlock` derive)
- Allow specification of additional signed extrinsic via API options
- Add missing parachain types, `ParaGenesisArgs`
- Correct `EthTransaction` type (as per the correct cargo crate)
- Update with latest contract types for Substrate master
- Update alias mapping for asset palette (including Substrate starting defaults)
- Allow `.entries()` call where 0 keys are present
- Fix `.is` on events not checking the correct index
- Construction of `i*` types ow correctly checks for max positive/negative
## 3.3.1 Jan 4, 2021
Upgrade priority: Low. Recommended for users of frontier evm module with additional types.
Contributed:
- Expand bounty derives (Thanks to https://github.com/ekowalsk)
- Adjust known-types (Thanks to https://github.com/mikiquantum)
Changes:
- Parallelize the API-init RPC calls for faster overall startup
- Add `ExitReason` types for the frontier evm module
- Adjust checks for indexed/non-indexed module checks (metadata decoration)
- Apply module aliases on constants (aligning with events, extrinsics)
- Allow for use of `system.ss58Prefix` as exposed (current Substrate master)
- Correct use of api-contract `blockWeights.maxBlock` in estimation
- Build metadata docs & interfaces with section aliases
- Update to latest Substrate master metadata in tests
## 3.2.1 Dec 27, 2020
Upgrade priority: Low. Recommended for users of parachains.
Contributed:
- Adjust metadata `.asV12` type signature (Thanks to https://github.com/yjhmelody)
Changes:
- Add `api.{errors, events, query, tx}.<section>.<name>.is(...)`
- Remove support for staking pre Substrate 2.0
- Add all frontier types & RPCs
- Support `AccountInfo` with new provider/consumer refCount structure
- Additional Cumulus parachain types
- Consistently format number JSON based on bitLength
- Cleanup metadata -> api dependencies
- Update `@polkadot/util` to 5.2.1
## 3.1.1 Dec 20, 2020
Upgrade priority: Low. Recommended for users of parachains.
Contributed:
- Additional parachain types (Thanks to https://github.com/joelamouche)
- Support for multi queries with `HttpProvider` (Thanks to https://github.com/ianhe8x)
- Configurable error logging with `createTypeUnsafe` (Thanks to https://github.com/dvdplm)
Changes:
- Adjust core type creation, removing storage duplication
- Update parachain types to support Rococo v1
- Adjust bounties derive to cater for new Substrate namespaces (& move to bounties)
- Mark `detectPackage` as known side-effect
- Add `detectPackage` to `@polkadot/metadata` (a number of requests on this)
- Adjust x-rxjs wrapper to expose all methods, incl. Node.js esm fixes
- Update to latest Substrate static metadata
- Update `@polkadot/util` to 5.1.1
## 3.0.1 Dec 14, 2020
Upgrade priority: Low. Recommended for the next Kusama/Polkadot upgrades due to additional types and those following chains following Substrate master closely.
**Important** While this package contains no external interface changes, it now compiles and ships both cjs and esm modules. This means that modern bundlers will have more information for tree-shaking available. Additionally when using Node with `.mjs` extensions, the esm version imports will be used on recent Node versions. Adding an export map, as here, may have some impacts so a major semver bump is advised. There may be (small) dragons hiding in the dark corners...
Contributed:
- Injection of derives via typesBundle (Thanks to https://github.com/pr0fedt)
- Added derives for bounties (Thanks to https://github.com/krzysztof-jelski)
Changes:
- Build and expose both cjs and esm via exports map
- Inject RPC definitions for typesBundle, allowing per-spec configuration
- Added `query.<section>.<method>.sizeAt(hash, [...params])` for all storage
- Add new Substrate consumed Weight types
- Expand `SessionKeys<n>` definitions (up to 9)
- Cleanup circular `Type` <-> `Text` definitions
- Cleanup circular `Metadata` <-> `TypeRegistry` imports
- Update `@polkadot/util` to 5.0.1
## 2.10.1 Dec 7, 2020
Upgrade priority: Low. Recommended when following Substrate master and/or parachains development, contains the latest types for both.

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');

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 config = require('@polkadot/dev/config/jest.cjs');

View File

@@ -3,14 +3,16 @@
"author": "Jaco Greeff <jacogr@gmail.com>",
"license": "Apache-2",
"private": true,
"type": "commonjs",
"workspaces": [
"packages/*"
],
"resolutions": {
"typescript": "^4.1.2"
"typescript": "^4.1.3"
},
"scripts": {
"build": "yarn build:interfaces && polkadot-dev-build-ts && (cd packages/typegen && copyfiles scripts/* build)",
"build": "yarn build:interfaces && polkadot-dev-build-ts",
"build:extra": "(cd packages/typegen && copyfiles scripts/* build)",
"build:interfaces": "polkadot-types-internal-interfaces",
"build:release": "polkadot-ci-ghact-build",
"docs:metadata": "polkadot-types-internal-metadata",
@@ -23,14 +25,14 @@
"test:watch": "polkadot-dev-run-test --watch"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@babel/register": "^7.12.1",
"@babel/core": "^7.12.10",
"@babel/register": "^7.12.10",
"@babel/runtime": "^7.12.5",
"@polkadot/dev": "^0.60.8",
"@polkadot/ts": "^0.3.57",
"@polkadot/dev": "^0.61.24",
"@polkadot/ts": "^0.3.59",
"@polkadot/typegen": "workspace:packages/typegen",
"@types/jest": "^26.0.16",
"@types/jest": "^26.0.20",
"copyfiles": "^2.4.1"
},
"version": "2.10.1"
"version": "3.7.2"
}

View File

@@ -1,13 +1,9 @@
{
"name": "@polkadot/api-contract",
"version": "2.10.1",
"version": "3.7.2",
"description": "Interfaces for interacting with contracts and contract ABIs",
"main": "index.js",
"sideEffects": false,
"keywords": [
"Polkadot",
"ABI"
],
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [],
"contributors": [],
@@ -17,10 +13,10 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
"dependencies": {
"@babel/runtime": "^7.12.5",
"@polkadot/api": "2.10.1",
"@polkadot/types": "2.10.1",
"@polkadot/util": "^4.2.1",
"bn.js": "^4.11.9",
"rxjs": "^6.6.3"
"@polkadot/api": "3.7.2",
"@polkadot/types": "3.7.2",
"@polkadot/util": "^5.5.1",
"@polkadot/x-rxjs": "^5.5.1",
"bn.js": "^4.11.9"
}
}

View File

@@ -1,9 +1,8 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Abi } from '.';
import abis from '../test/contracts';
import { Abi } from '.';
interface JSONAbi {
spec: {

View File

@@ -1,9 +1,9 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Bytes } from '@polkadot/types';
import type { ChainProperties, ContractConstructorSpec, ContractEventSpec, ContractMessageParamSpec, ContractMessageSpec, ContractProject } from '@polkadot/types/interfaces';
import type { AnyJson, Codec, CodecArg } from '@polkadot/types/types';
import type { ChainProperties, ContractConstructorSpec, ContractEventSpec, ContractMessageSpec, ContractMessageParamSpec, ContractProject } from '@polkadot/types/interfaces';
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';

View File

@@ -1,12 +1,11 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import fs from 'fs';
import path from 'path';
import { Abi } from '.';
import abis from '../test/contracts';
import { Abi } from '.';
describe('MetaRegistry', (): void => {
Object.keys(abis).forEach((abiName) => {

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 { ContractDisplayName, ChainProperties, SiField, SiLookupTypeId, SiType, SiTypeDefArray, SiTypeDefVariant, SiTypeDefSequence, SiTypeDefTuple, SiVariant } from '@polkadot/types/interfaces';
import type { ChainProperties, ContractDisplayName, SiField, SiLookupTypeId, SiType, SiTypeDefArray, SiTypeDefSequence, SiTypeDefTuple, SiTypeDefVariant, SiVariant } from '@polkadot/types/interfaces';
import type { InterfaceTypes, TypeDef } from '@polkadot/types/types';
import { assert, isUndefined } from '@polkadot/util';
import { TypeRegistry, withTypeString } from '@polkadot/types/create';
import { TypeDefInfo } from '@polkadot/types/types';
import { assert, isUndefined } from '@polkadot/util';
interface PartialTypeSpec {
readonly type: SiLookupTypeId;

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
import type { ApiTypes, DecorateMethod } from '@polkadot/api/types';

View File

@@ -1,18 +1,19 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { ApiTypes, DecorateMethod } from '@polkadot/api/types';
import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
import type { ApiTypes, DecorateMethod } from '@polkadot/api/types';
import type { AccountId, EventRecord, Hash } from '@polkadot/types/interfaces';
import type { AnyJson, CodecArg, ISubmittableResult } from '@polkadot/types/types';
import type { AbiConstructor, BlueprintOptions } from '../types';
import type { BlueprintDeploy, ContractGeneric, MapConstructorExec } from './types';
import BN from 'bn.js';
import { SubmittableResult } from '@polkadot/api';
import { ApiBase } from '@polkadot/api/base';
import { Bytes } from '@polkadot/types';
import { isUndefined, stringCamelCase, compactAddLength, u8aToU8a } from '@polkadot/util';
import { compactAddLength, isUndefined, stringCamelCase, u8aToU8a } from '@polkadot/util';
import { randomAsU8a } from '@polkadot/util-crypto';
import { Abi } from '../Abi';

View File

@@ -1,14 +1,15 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import fs from 'fs';
import path from 'path';
import { decorateMethod } from '@polkadot/api/promise';
import contractFlipper from '../../test/contracts/ink/flipper.contract.json';
import abiFlipper from '../../test/contracts/ink/flipper.json';
import { mockApi } from './mock';
import { Code } from './Code';
import { mockApi } from './mock';
const wasmFlipper = fs.readFileSync(path.join(__dirname, '../../test/contracts/ink/flipper.wasm'));

View File

@@ -1,8 +1,8 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { ApiTypes, DecorateMethod } from '@polkadot/api/types';
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';

View File

@@ -1,19 +1,20 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { ApiTypes, DecorateMethod } from '@polkadot/api/types';
import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
import type { ApiTypes, DecorateMethod } from '@polkadot/api/types';
import type { Bytes } from '@polkadot/types';
import type { AccountId, ContractExecResult, EventRecord } from '@polkadot/types/interfaces';
import type { AccountId, ContractExecResult, EventRecord, Weight } from '@polkadot/types/interfaces';
import type { AnyJson, CodecArg, ISubmittableResult, Registry } from '@polkadot/types/types';
import type { AbiMessage, ContractCallOutcome, ContractOptions, DecodedEvent } from '../types';
import type { ContractCallResult, ContractCallSend, ContractGeneric, ContractQuery, ContractTx, MapMessageQuery, MapMessageTx } from './types';
import BN from 'bn.js';
import { map } from 'rxjs/operators';
import { SubmittableResult } from '@polkadot/api';
import { ApiBase } from '@polkadot/api/base';
import { assert, bnToBn, isFunction, isUndefined, logger, stringCamelCase } from '@polkadot/util';
import { map } from '@polkadot/x-rxjs/operators';
import { Abi } from '../Abi';
import { applyOnEvent, extractOptions, formatData, isOptions } from '../util';
@@ -144,7 +145,10 @@ export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
return gasLimit.lten(0)
? isCall
? MAX_CALL_GAS
: this.api.consts.system.maximumBlockWeight.muln(64).divn(100)
: (this.api.consts.system.blockWeights
? this.api.consts.system.blockWeights.maxBlock
: this.api.consts.system.maximumBlockWeight as Weight
).muln(64).divn(100)
: gasLimit;
}

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';

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';

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 { Observable } from 'rxjs';
import type { ApiTypes, ObsInnerType } from '@polkadot/api/types';
import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
import type { ApiTypes, ObsInnerType } from '@polkadot/api/types';
import type { AccountId } from '@polkadot/types/interfaces';
import type { CodecArg } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { AbiMessage, BlueprintOptions, ContractCallOutcome, ContractOptions } from '../types';
export interface BlueprintDeploy<ApiType extends ApiTypes> {

View File

@@ -1,10 +1,10 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Simple non-runnable checks to test type definitions in the editor itself
import { ApiPromise } from '@polkadot/api';
import { TestKeyringMap, createTestPairs } from '@polkadot/keyring/testingPairs';
import { createTestPairs, TestKeyringMap } from '@polkadot/keyring/testingPairs';
import abiIncrementer from '../test/contracts/ink/incrementer.json';
import { BlueprintPromise, ContractPromise } from '.';

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 { Abi } from './Abi';

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';

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';

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';

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';

View File

@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { BlueprintSubmittableResult as BaseBlueprintSubmittableResult, CodeSubmittableResult as BaseCodeSubmittableResult } from '../base';
import type { BlueprintSubmittableResult as BaseBlueprintSubmittableResult, CodeSubmittableResult as BaseCodeSubmittableResult } from '../base';
export type BlueprintSubmittableResult = BaseBlueprintSubmittableResult<'promise'>;
export type CodeSubmittableResult = BaseCodeSubmittableResult<'promise'>;

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';

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';

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';

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';

View File

@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { BlueprintSubmittableResult as BaseBlueprintSubmittableResult, CodeSubmittableResult as BaseCodeSubmittableResult } from '../base';
import type { BlueprintSubmittableResult as BaseBlueprintSubmittableResult, CodeSubmittableResult as BaseCodeSubmittableResult } from '../base';
export type BlueprintSubmittableResult = BaseBlueprintSubmittableResult<'promise'>;
export type CodeSubmittableResult = BaseCodeSubmittableResult<'promise'>;

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 BN from 'bn.js';

View File

@@ -1,4 +1,4 @@
// 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';
@@ -8,15 +8,16 @@ import type { Codec, CodecArg, Registry, TypeDef } from '@polkadot/types/types';
import type { BlueprintOptions, ContractOptions } from './types';
import BN from 'bn.js';
import { createTypeUnsafe } from '@polkadot/types/create';
import { isBn, isBigInt, isNumber, isString } from '@polkadot/util';
import { isBigInt, isBn, isNumber, isString } from '@polkadot/util';
type ContractEvents = 'CodeStored' | 'ContractExecution' | 'Instantiated';
type TOptions = BlueprintOptions | ContractOptions;
export function formatData (registry: Registry, data: Raw, { type }: TypeDef): Codec {
return createTypeUnsafe(registry, type, [data], true);
return createTypeUnsafe(registry, type, [data], { isPedantic: true });
}
export function applyOnEvent <T> (result: SubmittableResult, type: ContractEvents, fn: (records: EventRecord[]) => T): T | undefined {

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 * as ink from './ink';

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 { default as delegator } from './delegator.json';

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 { default as ints256 } from './ints256.json';

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 { default as assetTransfer } from './assetTransfer.json';

View File

@@ -1,14 +1,9 @@
{
"name": "@polkadot/api-derive",
"version": "2.10.1",
"version": "3.7.2",
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
"main": "index.js",
"sideEffects": false,
"keywords": [
"Polkadot",
"Promise",
"RxJs"
],
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [],
"contributors": [],
@@ -18,17 +13,16 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
"dependencies": {
"@babel/runtime": "^7.12.5",
"@polkadot/api": "2.10.1",
"@polkadot/rpc-core": "2.10.1",
"@polkadot/types": "2.10.1",
"@polkadot/util": "^4.2.1",
"@polkadot/util-crypto": "^4.2.1",
"bn.js": "^4.11.9",
"memoizee": "^0.4.14",
"rxjs": "^6.6.3"
"@polkadot/api": "3.7.2",
"@polkadot/rpc-core": "3.7.2",
"@polkadot/types": "3.7.2",
"@polkadot/util": "^5.5.1",
"@polkadot/util-crypto": "^5.5.1",
"@polkadot/x-rxjs": "^5.5.1",
"bn.js": "^4.11.9"
},
"devDependencies": {
"@polkadot/keyring": "^4.2.1",
"@polkadot/rpc-provider": "2.10.1"
"@polkadot/keyring": "^5.5.1",
"@polkadot/rpc-provider": "3.7.2"
}
}

View File

@@ -1,14 +1,14 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { AccountId, AccountIndex, Address } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import { of } from 'rxjs';
import { map } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { isU8a, assertReturn } from '@polkadot/util';
import { assertReturn, isU8a } from '@polkadot/util';
import { decodeAddress } from '@polkadot/util-crypto';
import { of } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';

View File

@@ -1,15 +1,15 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Vec } from '@polkadot/types';
import type { AccountId, Address, Balance } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveAccountFlags } from '../types';
import { combineLatest, of } from 'rxjs';
import { map } from 'rxjs/operators';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';

View File

@@ -1,15 +1,15 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { AccountId, AccountIndex, Address } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { AccountIdAndIndex } from '../types';
import { of } from 'rxjs';
import { map } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { isU8a } from '@polkadot/util';
import { decodeAddress } from '@polkadot/util-crypto';
import { of } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';

View File

@@ -1,12 +1,12 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { AccountId, AccountIndex } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { AccountIndexes } from '../types';
import { map } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';

View File

@@ -1,16 +1,16 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Data, Option } from '@polkadot/types';
import type { AccountId, IdentityInfoAdditional, Registration } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveAccountRegistration, DeriveHasIdentity } from '../types';
import { combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { isHex, u8aToString } from '@polkadot/util';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';

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';

View File

@@ -1,41 +1,17 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { Option, Vec } from '@polkadot/types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option } from '@polkadot/types';
import type { AccountId, AccountIndex, BalanceOf } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import { of } from 'rxjs';
import { map, startWith } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { ENUMSET_SIZE } from '@polkadot/types/generic/AccountIndex';
import { isFunction } from '@polkadot/util';
import { of } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
function queryEnumSet (api: ApiInterfaceRx, _accountIndex: AccountIndex | string): Observable<AccountId | undefined> {
const accountIndex = _accountIndex instanceof api.registry.createClass('AccountIndex')
? _accountIndex
: api.registry.createType('AccountIndex', _accountIndex);
return api.query.indices.enumSet<Vec<AccountId>>(accountIndex.div(ENUMSET_SIZE)).pipe(
startWith([]),
map((accounts): AccountId | undefined =>
(accounts || [])[accountIndex.mod(ENUMSET_SIZE).toNumber()]
)
);
}
// current
function query (api: ApiInterfaceRx, accountIndex: AccountIndex | string): Observable<AccountId | undefined> {
return api.query.indices.accounts<Option<ITuple<[AccountId, BalanceOf]>>>(accountIndex).pipe(
map((optResult): AccountId | undefined =>
optResult.unwrapOr([])[0]
)
);
}
/**
* @name indexToId
* @param {( AccountIndex | string )} accountIndex - An accounts index in different formats.
@@ -52,9 +28,11 @@ function query (api: ApiInterfaceRx, accountIndex: AccountIndex | string): Obser
export function indexToId (instanceId: string, api: ApiInterfaceRx): (accountIndex: AccountIndex | string) => Observable<AccountId | undefined> {
return memo(instanceId, (accountIndex: AccountIndex | string): Observable<AccountId | undefined> =>
api.query.indices
? isFunction(api.query.indices.accounts)
? query(api, accountIndex)
: queryEnumSet(api, accountIndex)
? api.query.indices.accounts<Option<ITuple<[AccountId, BalanceOf]>>>(accountIndex).pipe(
map((optResult): AccountId | undefined =>
optResult.unwrapOr([])[0]
)
)
: of(undefined)
);
}

View File

@@ -1,54 +1,23 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Vec } from '@polkadot/types';
import type { AccountId, AccountIndex } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { AccountIndexes } from '../types';
import { of } from 'rxjs';
import { map, startWith, switchMap } from 'rxjs/operators';
import { ENUMSET_SIZE } from '@polkadot/types/generic/AccountIndex';
import { isFunction } from '@polkadot/util';
import { of } from '@polkadot/x-rxjs';
import { map, startWith } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
const enumsetSize = ENUMSET_SIZE.toNumber();
let indicesCache: AccountIndexes | null = null;
function queryEnumSet (api: ApiInterfaceRx): Observable<AccountIndexes> {
return api.query.indices.nextEnumSet<AccountIndex>().pipe(
// use the nextEnumSet (which is a counter of the number of sets) to construct
// a range of values to query [0, 1, 2, ...]. Retrieve the full enum set for the
// specific index - each query can return up to ENUMSET_SIZE (64) records, each
// containing an AccountId
switchMap((next: AccountIndex): Observable<Vec<AccountId>[]> =>
api.query.indices.enumSet.multi<Vec<AccountId>>([...Array(next.toNumber() + 1).keys()])
),
map((all: AccountId[][]): AccountIndexes =>
all.reduce((indexes: AccountIndexes, list, outerIndex): AccountIndexes => {
(list || []).forEach((accountId, innerIndex): void => {
// re-create the index based on position 0 is [0][0] and likewise
// 64 (0..63 in first) is [1][0] (the first index value in set 2)
const index = (outerIndex * enumsetSize) + innerIndex;
indexes[accountId.toString()] = api.registry.createType('AccountIndex', index);
});
return indexes;
}, {})
)
);
}
function queryAccounts (api: ApiInterfaceRx): Observable<AccountIndexes> {
return api.query.indices.accounts.entries().pipe(
map((entries): AccountIndexes =>
entries.reduce((indexes: AccountIndexes, [key, idOpt]): AccountIndexes => {
if (idOpt.isSome) {
indexes[idOpt.unwrap()[0].toString()] = key.args[0] as AccountIndex;
indexes[idOpt.unwrap()[0].toString()] = key.args[0];
}
return indexes;
@@ -78,9 +47,7 @@ export function indexes (instanceId: string, api: ApiInterfaceRx): () => Observa
? of(indicesCache)
: (
api.query.indices
? isFunction(api.query.indices.accounts)
? queryAccounts(api).pipe(startWith({}))
: queryEnumSet(api).pipe(startWith({}))
? queryAccounts(api).pipe(startWith({}))
: of({} as AccountIndexes)
).pipe(
map((indices): AccountIndexes => {

View File

@@ -1,16 +1,16 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Bytes, Option, u32 } from '@polkadot/types';
import type { AccountId, AccountIndex, Address, Balance } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveAccountInfo, DeriveAccountRegistration } from '../types';
import { combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { u8aToString } from '@polkadot/util';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';

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';

View File

@@ -1,24 +1,24 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { AccountId, AccountData, AccountIndex, AccountInfo, Address, Balance, Index } from '@polkadot/types/interfaces';
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 { DeriveBalancesAccount } from '../types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveBalancesAccount, DeriveBalancesAccountData } from '../types';
import { combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { isFunction } from '@polkadot/util';
import { assert, isFunction } from '@polkadot/util';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
type Result = [Balance, Balance, Balance, Balance, Index];
type BalanceResult = [Balance, Balance, Balance, Balance];
function calcBalances (api: ApiInterfaceRx, [accountId, [freeBalance, reservedBalance, frozenFee, frozenMisc, accountNonce]]: [AccountId, Result]): DeriveBalancesAccount {
type Result = [Index, BalanceResult[]];
function getBalance (api: ApiInterfaceRx, [freeBalance, reservedBalance, frozenFee, frozenMisc]: BalanceResult): DeriveBalancesAccountData {
return {
accountId,
accountNonce,
freeBalance,
frozenFee,
frozenMisc,
@@ -27,6 +27,19 @@ function calcBalances (api: ApiInterfaceRx, [accountId, [freeBalance, reservedBa
};
}
function calcBalances (api: ApiInterfaceRx, [accountId, [accountNonce, balances]]: [AccountId, Result]): DeriveBalancesAccount {
const primary = balances[0];
assert(primary, 'No balances retrieved for account');
return {
accountId,
accountNonce,
additional: balances.filter((_, index) => index !== 0).map((b) => getBalance(api, b)),
...getBalance(api, primary)
};
}
// old
function queryBalancesFree (api: ApiInterfaceRx, accountId: AccountId): Observable<Result> {
return api.queryMulti<[Balance, Balance, Index]>([
@@ -34,21 +47,25 @@ function queryBalancesFree (api: ApiInterfaceRx, accountId: AccountId): Observab
[api.query.balances.reservedBalance, accountId],
[api.query.system.accountNonce, accountId]
]).pipe(
map(([freeBalance, reservedBalance, accountNonce]): Result =>
[freeBalance, reservedBalance, api.registry.createType('Balance'), api.registry.createType('Balance'), accountNonce]
)
map(([freeBalance, reservedBalance, accountNonce]): Result => [
accountNonce,
[[freeBalance, reservedBalance, api.registry.createType('Balance'), api.registry.createType('Balance')]]
])
);
}
function queryBalancesAccount (api: ApiInterfaceRx, accountId: AccountId): Observable<Result> {
return api.queryMulti<[AccountData, Index]>([
[api.query.balances.account, accountId],
[api.query.system.accountNonce, accountId]
]).pipe(
map(([{ feeFrozen, free, miscFrozen, reserved }, accountNonce]): Result =>
[free, reserved, feeFrozen, miscFrozen, accountNonce]
function queryBalancesAccount (api: ApiInterfaceRx, accountId: AccountId, modules: string[] = ['balances']): Observable<Result> {
const balances = modules.map((m): QueryableStorageMultiArg<'rxjs'> => [api.query[m].account, accountId]);
const extract = (data: AccountData[]) =>
data.map(({ feeFrozen, free, miscFrozen, reserved }): BalanceResult => [free, reserved, feeFrozen, miscFrozen]);
return isFunction(api.query.system.account)
? api.queryMulti<[AccountInfo, ...(AccountData[])]>([[api.query.system.account, accountId], ...balances]).pipe(
map(([{ nonce }, ...balances]): Result => [nonce, extract(balances)])
)
);
: api.queryMulti<[Index, ...(AccountData[])]>([[api.query.system.accountNonce, accountId], ...balances]).pipe(
map(([nonce, ...balances]): Result => [nonce, extract(balances)])
);
}
function queryCurrent (api: ApiInterfaceRx, accountId: AccountId): Observable<Result> {
@@ -60,7 +77,7 @@ function queryCurrent (api: ApiInterfaceRx, accountId: AccountId): Observable<Re
: (infoOrTuple as [Index, AccountData])[1];
const accountNonce = (infoOrTuple as AccountInfo).nonce || (infoOrTuple as [Index, AccountData])[0];
return [free, reserved, feeFrozen, miscFrozen, accountNonce];
return [accountNonce, [[free, reserved, feeFrozen, miscFrozen]]];
})
);
}
@@ -81,19 +98,29 @@ function queryCurrent (api: ApiInterfaceRx, accountId: AccountId): Observable<Re
* ```
*/
export function account (instanceId: string, api: ApiInterfaceRx): (address: AccountIndex | AccountId | Address | string) => Observable<DeriveBalancesAccount> {
const balanceInstances = api.registry.getModuleInstances(api.runtimeVersion.specName.toString(), 'balances');
return memo(instanceId, (address: AccountIndex | AccountId | Address | string): Observable<DeriveBalancesAccount> =>
api.derive.accounts.accountId(address).pipe(
switchMap((accountId): Observable<[AccountId, Result]> =>
(accountId
? combineLatest([
of(accountId),
isFunction(api.query.system.account)
? queryCurrent(api, accountId)
: isFunction(api.query.balances.account)
? queryBalancesAccount(api, accountId)
: queryBalancesFree(api, accountId)
balanceInstances
? queryBalancesAccount(api, accountId, balanceInstances)
: isFunction(api.query.system.account)
? queryCurrent(api, accountId)
: isFunction(api.query.balances.account)
? queryBalancesAccount(api, accountId)
: queryBalancesFree(api, accountId)
])
: of([
api.registry.createType('AccountId'),
[
api.registry.createType('Index'),
[[api.registry.createType('Balance'), api.registry.createType('Balance'), api.registry.createType('Balance'), api.registry.createType('Balance')]]
]
])
: of([api.registry.createType('AccountId'), [api.registry.createType('Balance'), api.registry.createType('Balance'), api.registry.createType('Balance'), api.registry.createType('Balance'), api.registry.createType('Index')]])
)
),
map((result): DeriveBalancesAccount => calcBalances(api, result))

View File

@@ -1,20 +1,23 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
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 { DeriveBalancesAccount, DeriveBalancesAll } from '../types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveBalancesAccount, DeriveBalancesAccountData, DeriveBalancesAll, DeriveBalancesAllAccountData } from '../types';
import BN from 'bn.js';
import { combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { bnMax, isFunction } from '@polkadot/util';
import { bnMax } 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 {
@@ -49,8 +52,21 @@ 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);
const availableBalance = api.registry.createType('Balance', allLocked ? 0 : bnMax(new BN(0), data.freeBalance.sub(lockedBalance)));
return {
...data,
availableBalance,
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
@@ -58,29 +74,21 @@ 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 isVesting = isStarted && !shared.vestingLocked.isZero();
const vestedClaimable = api.registry.createType('Balance', isVesting ? shared.vestingLocked.sub(vestingTotal.sub(vestedBalance)) : 0);
const vestingEndBlock = api.registry.createType('BlockNumber', isVesting ? vestingTotal.div(perBlock).add(startingBlock) : 0);
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,
vestingPerBlock: perBlock,
vestingTotal,
votingBalance
vestingTotal
};
}
@@ -99,28 +107,37 @@ 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> {
// current (balances, vesting)
function queryCurrent (api: ApiInterfaceRx, accountId: AccountId, balanceInstances: string[] = ['balances']): Observable<ResultBalance> {
const lockCalls = balanceInstances.map((m) => api.query[m].locks);
const lockEmpty = lockCalls.map((c) => !c);
const lockQueries = lockCalls.filter((c) => c).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])];
})
);
}
@@ -140,6 +157,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> =>
@@ -147,11 +166,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)
api.query.system?.account || 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))

View File

@@ -1,13 +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 { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Balance } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveFees } from '../types';
import { of } from 'rxjs';
import { map } from 'rxjs/operators';
import { of } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';

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';

View File

@@ -1,12 +1,12 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { AccountId, AccountIndex, Address } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveBalancesAccount } from '../types';
import { combineLatest, of } from 'rxjs';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { memo } from '../util';

View File

@@ -0,0 +1,161 @@
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { ApiInterfaceRx, SubmittableExtrinsic } from '@polkadot/api/types';
import type { Bytes, Option, StorageKey } from '@polkadot/types';
import type { Bounty, BountyIndex, ProposalIndex } from '@polkadot/types/interfaces';
import type { Codec, InterfaceTypes } from '@polkadot/types/types';
import { ApiPromise } from '@polkadot/api';
import { DeriveCollectiveProposal } from '@polkadot/api-derive/types';
import { Proposal } from '@polkadot/types/interfaces';
import { of } from '@polkadot/x-rxjs';
import { BountyFactory } from '../../test/bountyFactory';
import { BytesFactory } from '../../test/bytesFactory';
import { createApiWithAugmentations } from '../../test/helpers';
import { ProposalFactory } from '../../test/proposalFactory';
import { bounties } from '.';
const DEFAULT_PROPOSER = '5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUpnhM';
describe('bounties derive', () => {
let storageKey: (index: number) => StorageKey;
let defaultBounty: () => Bounty;
let emptyOption: <T extends Codec> (typeName: keyof InterfaceTypes) => Option<T>;
let optionOf: <T extends Codec> (value: T)=> Option<T>;
let bountyIndex: (index: number) => BountyIndex;
let proposalIndex: (index: number) => ProposalIndex;
let bytes: (value: string) => Bytes;
let api: ApiPromise;
let createProposal: (method: SubmittableExtrinsic<'promise'>) => Proposal;
let defaultMockApi: ApiInterfaceRx;
beforeAll(() => {
api = createApiWithAugmentations();
({ bountyIndex, defaultBounty, emptyOption, optionOf, storageKey } = new BountyFactory(api));
({ bytes } = new BytesFactory(api.registry));
({ createProposal, proposalIndex } = new ProposalFactory(api));
});
beforeEach(() => {
defaultMockApi = {
derive: {
council: {
proposals: () => of([] as DeriveCollectiveProposal[])
}
},
query: {
council: {
proposalCount: () => of(proposalIndex(2))
},
treasury: {
bounties: {
keys: () => of([storageKey(0), storageKey(1)]),
multi: () => of([optionOf(defaultBounty()), optionOf(defaultBounty())])
},
bountyCount: () => of(bountyIndex(2)),
bountyDescriptions: {
multi: () => of([
optionOf(bytes('make polkadot even better')),
optionOf(bytes('some other bounty'))
])
}
}
},
tx: api.tx
} as unknown as ApiInterfaceRx;
});
it('creates storage key', function () {
expect(storageKey(194).args[0].eq(194)).toBe(true);
});
it('creates proposal', function () {
expect(createProposal(api.tx.balances.transfer('5EYCAe5ijiYfyeZ2JJCGq56LmPyNRAKzpG4QkoQkkQNB5e6Z', 1))).toBeTruthy();
});
it('combines bounties with descriptions', async () => {
const mockApi = {
...defaultMockApi,
query: {
...defaultMockApi.query,
treasury: {
bounties: {
keys: () => of([storageKey(0), storageKey(2), storageKey(3)]),
multi: () => of([optionOf(defaultBounty()), emptyOption('Bounty'), optionOf(defaultBounty())])
},
bountyCount: () => of(bountyIndex(3)),
bountyDescriptions: {
multi: () => of([
optionOf(bytes('make polkadot even better')),
optionOf(bytes('this will be totally ignored')),
emptyOption('Bytes')
])
}
}
}
} as unknown as ApiInterfaceRx;
const result = await bounties('', mockApi)().toPromise();
expect(result).toHaveLength(2);
expect(result[0].bounty.proposer.toString()).toEqual(DEFAULT_PROPOSER);
expect(result[0].description).toEqual('make polkadot even better');
expect(result[0].index.eq(0)).toBe(true);
expect(result[1].bounty.proposer.toString()).toEqual(DEFAULT_PROPOSER);
expect(result[1].description).toEqual('');
expect(result[1].index.eq(3)).toBe(true);
});
it('returns motions', async () => {
const result = await bounties('', defaultMockApi)().toPromise();
expect(result).toHaveLength(2);
expect(result[0].proposals).toHaveLength(0);
expect(result[1].proposals).toHaveLength(0);
});
it('when no council, returns bounties without motions', async () => {
const mockApi = {
...defaultMockApi,
query: {
...defaultMockApi.query,
council: null
}
} as unknown as ApiInterfaceRx;
const result = await bounties('', mockApi)().toPromise();
expect(result).toHaveLength(2);
expect(result[0].bounty.proposer.toString()).toEqual(DEFAULT_PROPOSER);
expect(result[0].description).toEqual('make polkadot even better');
expect(result[0].index.eq(0)).toBe(true);
expect(result[0].proposals).toHaveLength(0);
expect(result[1].bounty.proposer.toString()).toEqual(DEFAULT_PROPOSER);
expect(result[1].description).toEqual('some other bounty');
expect(result[1].index.eq(1)).toBe(true);
expect(result[1].proposals).toHaveLength(0);
});
it('combines bounties with motions', async () => {
const mockApi = {
...defaultMockApi,
derive: {
council: {
proposals: () => of([
{ proposal: createProposal(api.tx.bounties.approveBounty(1)) },
{ proposal: createProposal(api.tx.treasury.approveProposal(1)) }] as DeriveCollectiveProposal[])
}
}
} as unknown as ApiInterfaceRx;
const result = await bounties('', mockApi)().toPromise();
expect(result).toHaveLength(2);
expect(result[0].proposals).toHaveLength(0);
expect(result[1].proposals).toHaveLength(1);
expect(result[1].proposals[0].proposal.method).toEqual('approveBounty');
});
});

View File

@@ -0,0 +1,61 @@
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { DeriveBounties, DeriveCollectiveProposal } from '@polkadot/api-derive/types';
import type { Bytes, Option, StorageKey } from '@polkadot/types';
import type { Bounty, BountyIndex, ProposalIndex } from '@polkadot/types/interfaces';
import { memo } from '@polkadot/api-derive/util';
import { combineLatest, Observable, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { filterBountiesProposals } from './helpers/filterBountyProposals';
type Result = [Option<Bounty>[], Option<Bytes>[], BountyIndex[], DeriveCollectiveProposal[]];
function parseResult ([maybeBounties, maybeDescriptions, ids, bountyProposals]: Result): DeriveBounties {
const bounties: DeriveBounties = [];
maybeBounties.forEach((bounty, index) => {
if (bounty.isSome) {
bounties.push({
bounty: bounty.unwrap(),
description: maybeDescriptions[index].unwrapOrDefault().toUtf8(),
index: ids[index],
proposals: bountyProposals.filter((bountyProposal) => ids[index].eq(bountyProposal.proposal.args[0]))
});
}
});
return bounties;
}
export function bounties (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveBounties> {
const bountyBase = api.query.bounties ? api.query.bounties : api.query.treasury;
return memo(instanceId, (): Observable<DeriveBounties> =>
combineLatest([
bountyBase.bountyCount<BountyIndex>(),
api.query.council ? api.query.council.proposalCount<ProposalIndex>() : of(0)
]).pipe(
switchMap(() =>
combineLatest([
bountyBase.bounties.keys(),
api.derive.council ? api.derive.council.proposals() : of([])
])
),
switchMap(([keys, proposals]): Observable<Result> => {
const ids = (keys as StorageKey<[BountyIndex]>[]).map(({ args: [id] }) => id);
return combineLatest([
bountyBase.bounties.multi<Option<Bounty>>(ids),
bountyBase.bountyDescriptions.multi<Option<Bytes>>(ids),
of(ids),
of(filterBountiesProposals(api, proposals))
]);
}),
map(parseResult)
)
);
}

View File

@@ -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)));
}

View File

@@ -0,0 +1,4 @@
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './bounties';

View File

@@ -1,11 +1,11 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { BlockNumber } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import { map } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';

View File

@@ -1,11 +1,11 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { BlockNumber } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import { map } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';

View File

@@ -1,12 +1,12 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { BlockNumber } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import { combineLatest } from 'rxjs';
import { map } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { combineLatest } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';

View File

@@ -1,11 +1,11 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import { ApiInterfaceRx } from '@polkadot/api/types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Observable } from '@polkadot/x-rxjs';
import { combineLatest, of } from 'rxjs';
import { catchError, map } from 'rxjs/operators';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { catchError, map } from '@polkadot/x-rxjs/operators';
import { SignedBlockExtended } from '../type';
import { memo } from '../util';
@@ -27,12 +27,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 =>
new SignedBlockExtended(api.registry, signedBlock, events, validators)
),
catchError((): Observable<undefined> =>
// where rpc.chain.getHeader throws, we will land here - it can happen that

View File

@@ -1,11 +1,11 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import { ApiInterfaceRx } from '@polkadot/api/types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Observable } from '@polkadot/x-rxjs';
import { combineLatest, of } from 'rxjs';
import { catchError, map } from 'rxjs/operators';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { catchError, map } from '@polkadot/x-rxjs/operators';
import { HeaderExtended } from '../type';
import { memo } from '../util';

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';

View File

@@ -1,33 +1,35 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { EventRecord, Hash, SignedBlock } from '@polkadot/types/interfaces';
import type { FullNewBlock } from '../types';
import type { AccountId, EventRecord, SignedBlock } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import { combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { SignedBlockExtended } 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]> => {
switchMap((header): Observable<[SignedBlock, EventRecord[], AccountId[] | undefined]> => {
const blockHash = 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.validators)
);
}),
map(([blockHash, events, block]) => ({ block: block.block, blockHash, blockNumber: block.block.header.number.unwrap(), events, justification: block.justification }))
map(([block, events, validators]) =>
new SignedBlockExtended(api.registry, block, events, validators)
)
)
);
}

View File

@@ -1,11 +1,11 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import { ApiInterfaceRx } from '@polkadot/api/types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Observable } from '@polkadot/x-rxjs';
import { combineLatest, of } from 'rxjs';
import { map } from 'rxjs/operators';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
import { HeaderExtended } from '../type';
import { memo } from '../util';

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;
}

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';

View File

@@ -1,15 +1,15 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option } from '@polkadot/types';
import type { Hash, Proposal, Votes } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveCollectiveProposal } from '../types';
import { combineLatest, of } from 'rxjs';
import { catchError, map, switchMap } from 'rxjs/operators';
import { isFunction } from '@polkadot/util';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { catchError, map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';

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 { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveContractFees } from '../types';
import BN from 'bn.js';
import { of } from 'rxjs';
import { map } from 'rxjs/operators';
import { of } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';

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';

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';

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 { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Hash } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveCollectiveProposal } from '../types';
import { proposal as collectiveProposal, proposals as collectiveProposals } from '../collective';

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';

View File

@@ -1,15 +1,15 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Vec } from '@polkadot/types';
import type { AccountId, Balance } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveCouncilVote, DeriveCouncilVotes } from '../types';
import { combineLatest } from 'rxjs';
import { map } from 'rxjs/operators';
import { combineLatest } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';

View File

@@ -1,12 +1,13 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { AccountId } from '@polkadot/types/interfaces';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { AccountId } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveCouncilVote } from '../types';
import { map } from 'rxjs/operators';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
export function votesOf (instanceId: string, api: ApiInterfaceRx): (accountId: string | Uint8Array | AccountId) => Observable<DeriveCouncilVote> {

View File

@@ -1,16 +1,16 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option, Vec, u64 } from '@polkadot/types';
import type { Option, u64, Vec } from '@polkadot/types';
import type { BlockNumber, Hash, ReferendumIndex, Scheduled } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveDispatch, DeriveProposalImage } from '../types';
import { combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { isFunction, stringToHex } from '@polkadot/util';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
@@ -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((key) => key.args[0]);
return combineLatest([
of(blockNumbers),

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';

View File

@@ -1,16 +1,17 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
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 { ApiInterfaceRx } from '@polkadot/api/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveDemocracyLock } from '../types';
import BN from 'bn.js';
import { of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { BN_ZERO, isUndefined } from '@polkadot/util';
import { of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';

View File

@@ -1,15 +1,15 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option } from '@polkadot/types';
import type { Hash, VoteThreshold } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveProposalExternal } from '../types';
import { of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';

View File

@@ -1,14 +1,14 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Bytes, Option } from '@polkadot/types';
import type { AccountId, Balance, BlockNumber, Hash } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveProposalImage } from '../types';
import { map } from 'rxjs/operators';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
import { parseImage } from './util';

View File

@@ -1,14 +1,14 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Bytes, Option } from '@polkadot/types';
import type { AccountId, Balance, BlockNumber, Hash } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveProposalImage } from '../types';
import { map } from 'rxjs/operators';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
import { parseImage } from './util';

View File

@@ -1,16 +1,16 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option, Vec } from '@polkadot/types';
import type { AccountId, Balance, Hash, PropIndex } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { DeriveProposalImage, DeriveProposal } from '../types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveProposal, DeriveProposalImage } from '../types';
import { combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { isFunction } from '@polkadot/util';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';

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 { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { ReferendumIndex } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import BN from 'bn.js';
import { of } from 'rxjs';
import { map } from 'rxjs/operators';
import { of } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';

View File

@@ -1,12 +1,12 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveReferendumExt } from '../types';
import { combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';

View File

@@ -1,12 +1,12 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveReferendum } from '../types';
import { of } from 'rxjs';
import { switchMap } from 'rxjs/operators';
import { of } from '@polkadot/x-rxjs';
import { switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';

View File

@@ -1,12 +1,12 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option } from '@polkadot/types';
import type { ReferendumInfo, ReferendumInfoFinished } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import { map, switchMap } from 'rxjs/operators';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';

View File

@@ -1,16 +1,17 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option, Vec } from '@polkadot/types';
import type { AccountId, ReferendumInfo, ReferendumInfoTo239, Vote, Voting, VotingDirectVote, VotingDelegating } from '@polkadot/types/interfaces';
import type { AccountId, ReferendumInfo, ReferendumInfoTo239, Vote, Voting, VotingDelegating, VotingDirectVote } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveBalancesAccount, DeriveReferendum, DeriveReferendumVote, DeriveReferendumVotes } from '../types';
import BN from 'bn.js';
import { combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { isFunction } from '@polkadot/util';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
import { calcVotes, getStatus, parseImage } from './util';
@@ -68,7 +69,7 @@ function extractVotes (mapped: [AccountId, Voting][], referendumId: BN): DeriveR
function votesCurr (api: ApiInterfaceRx, referendumId: BN): Observable<DeriveReferendumVote[]> {
return api.query.democracy.votingOf.entries<Voting>().pipe(
map((allVoting): DeriveReferendumVote[] => {
const mapped = allVoting.map(([key, voting]): [AccountId, Voting] => [key.args[0] as AccountId, voting]);
const mapped = allVoting.map(([key, voting]): [AccountId, Voting] => [key.args[0], voting]);
const votes = extractVotes(mapped, referendumId);
const delegations = mapped
.filter(([, voting]) => voting.isDelegating)

View File

@@ -1,12 +1,13 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import { ApiInterfaceRx } from '@polkadot/api/types';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Observable } from '@polkadot/x-rxjs';
import BN from 'bn.js';
import { map } from 'rxjs/operators';
import { bnSqrt } from '@polkadot/util';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';

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 BN from 'bn.js';
import type { Vec } from '@polkadot/types';
import type { AccountId, Balance, BlockNumber, Hash, Proposal, PropIndex, ReferendumInfoTo239, ReferendumStatus, Vote, ReferendumIndex, VoteThreshold } from '@polkadot/types/interfaces';
import type { AccountId, Balance, BlockNumber, Hash, PropIndex, Proposal, ReferendumIndex, ReferendumInfoTo239, ReferendumStatus, Vote, VoteThreshold } from '@polkadot/types/interfaces';
export interface DeriveDemocracyLock {
balance: Balance;

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';
@@ -8,6 +8,7 @@ import type { ITuple } from '@polkadot/types/types';
import type { DeriveProposalImage, DeriveReferendum, DeriveReferendumVote, DeriveReferendumVotes, DeriveReferendumVoteState } from '../types';
import BN from 'bn.js';
import { bnSqrt } from '@polkadot/util';
type PreimageInfo = [Bytes, AccountId, Balance, BlockNumber];

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 './info';

View File

@@ -1,14 +1,14 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Vec, u32 } from '@polkadot/types';
import type { u32, Vec } from '@polkadot/types';
import type { AccountId, Balance, BlockNumber } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveElectionsInfo } from './types';
import { map } from 'rxjs/operators';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';

View File

@@ -1,8 +1,8 @@
// 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, BlockNumber, SetIndex, VoteIndex } from '@polkadot/types/interfaces';
import type { u32 } from '@polkadot/types';
import type { AccountId, Balance, BlockNumber, SetIndex, VoteIndex } from '@polkadot/types/interfaces';
export interface DeriveElectionsInfo {
candidates: AccountId[];

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 './receivedHeartbeats';

View File

@@ -1,15 +1,15 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Bytes, Option, u32 } from '@polkadot/types';
import type { AccountId } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveHeartbeats } from '../types';
import { combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { BN_ZERO } from '@polkadot/util';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';

View File

@@ -1,14 +1,14 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable @typescript-eslint/no-unsafe-return */
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/restrict-template-expressions */
import { Observable, from } from 'rxjs';
import { ApiRx } from '@polkadot/api/rx';
import { MockProvider } from '@polkadot/rpc-provider/mock';
import { TypeRegistry } from '@polkadot/types/create';
import { from, Observable } from '@polkadot/x-rxjs';
import { ExactDerive } from '.';

View File

@@ -1,12 +1,13 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { AnyFunction } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import * as accounts from './accounts';
import * as balances from './balances';
import * as bounties from './bounties';
import * as chain from './chain';
import * as contracts from './contracts';
import * as council from './council';
@@ -23,7 +24,7 @@ import * as tx from './tx';
export * from './type';
export const derive = { accounts, balances, chain, contracts, council, democracy, elections, imOnline, parachains, session, society, staking, technicalCommittee, treasury, tx };
export const derive = { accounts, balances, bounties, chain, contracts, council, democracy, elections, imOnline, parachains, session, society, staking, technicalCommittee, treasury, tx };
type DeriveSection<Section> = {
[Method in keyof Section]: Section[Method] extends AnyFunction

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 './info';

View File

@@ -1,14 +1,14 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { CollatorId, ParaId } from '@polkadot/types/interfaces';
import type { DeriveParachainInfo, DeriveParachainFull, DeriveParachainActive } from '../types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveParachainActive, DeriveParachainFull, DeriveParachainInfo } from '../types';
import type { Active, DidUpdate, Heads, ParaInfoResult, PendingSwap, RelayDispatchQueue, RetryQueue, SelectedThreads } from './types';
import { of } from 'rxjs';
import { map } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { of } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
import { didUpdateToBool } from './util';

View File

@@ -1,14 +1,14 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { ParaId } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveParachain, DeriveParachainInfo } from '../types';
import type { DidUpdate, ParaInfoResult, PendingSwap, RelayDispatchQueueSize } from './types';
import { combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
import { didUpdateToBool } from './util';

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