Commit Graph

371 Commits

Author SHA1 Message Date
Igor Matuszewski ea5daa444f ci: Appease Clippy (#761)
This should make the CI green again, as the lints have been introduced
in a new stable release, outside of the changes made in this repository.
2023-01-10 10:47:07 +00:00
Sabaun Taraki d41f657417 Make verbose rpc error display (#758)
* Make verbose rpc erro display

* Apply review results

* Minor fix doc-comment
2023-01-09 15:43:50 +01:00
dependabot[bot] 392c1915ca Bump JasonEtco/create-an-issue from 2.8.2 to 2.9.1 (#757)
Bumps [JasonEtco/create-an-issue](https://github.com/JasonEtco/create-an-issue) from 2.8.2 to 2.9.1.
- [Release notes](https://github.com/JasonEtco/create-an-issue/releases)
- [Commits](https://github.com/JasonEtco/create-an-issue/compare/3a8ba796516b57db8cb2ee6dfc65bc76cd39d56d...e27dddc79c92bc6e4562f268fffa5ed752639abd)

---
updated-dependencies:
- dependency-name: JasonEtco/create-an-issue
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-09 15:42:14 +01:00
dependabot[bot] 0ff4e13b83 Bump JasonEtco/create-an-issue from 2.8.1 to 2.8.2 (#744)
Bumps [JasonEtco/create-an-issue](https://github.com/JasonEtco/create-an-issue) from 2.8.1 to 2.8.2.
- [Release notes](https://github.com/JasonEtco/create-an-issue/releases)
- [Commits](https://github.com/JasonEtco/create-an-issue/compare/77399b6110ef82b94c1c9f9f615acf9e604f7f56...3a8ba796516b57db8cb2ee6dfc65bc76cd39d56d)

---
updated-dependencies:
- dependency-name: JasonEtco/create-an-issue
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-14 13:24:18 +02:00
dependabot[bot] 8484c18624 Bump JasonEtco/create-an-issue from 2.6.0 to 2.8.1 (#736)
Bumps [JasonEtco/create-an-issue](https://github.com/JasonEtco/create-an-issue) from 2.6.0 to 2.8.1.
- [Release notes](https://github.com/JasonEtco/create-an-issue/releases)
- [Commits](https://github.com/JasonEtco/create-an-issue/compare/9e6213aec58987fa7d2f4deb8b256b99e63107a2...77399b6110ef82b94c1c9f9f615acf9e604f7f56)

---
updated-dependencies:
- dependency-name: JasonEtco/create-an-issue
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-02 10:56:33 +00:00
Alexandru Vasile 463e2aa93f rpc: Expose the subscription ID for RpcClientT (#733)
* rpc: Extend `RpcClientT` to return the subscription ID

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* rpc: Return `RpcSubscriptionId` for jsonrpsee clients

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* rpc: Expose subscription ID via subxt subscription

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* examples: Adjust example to return subscription ID

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* rpc: Add structure for subscription stream and subscription id

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
2022-11-25 17:07:26 +02:00
Igor Matuszewski f0ce26db7b Add bitvec-like generic support to the scale-bits type for use in codegen (#718)
* Add bitvec-like generic support to the scale-bits type for use in codegen

* Use nightly 1.66 formatting

* Fix reading input while decoding bit sequences

* Add tests for our DecodedBits wrapper

* Add convenience DecodedBits::(in)to_bits functions

* Don't expose DecodedBits::bit_format

* Re-export scale_bits as peer dependency

* Move subxt::utils into a separate file

* Hide DecodedBits internals

* Don't re-export types from the `bits` module

* Update subxt/src/utils/bits.rs

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>

* Update subxt/src/utils/bits.rs

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>

* Address review feedback

* Clarify the byte needed calculation in DecodedBits encoding

* Remove remaining dbg! invocations

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
2022-11-24 15:09:20 +01:00
Francisco Miguel García a80d6cfd30 Add --derive-for-type to cli (#708)
* Add `--derive-for-type` to cli

* Remove clippy warnings
2022-11-23 15:25:32 +00:00
Igor Matuszewski 702e87e58d Remove a soon-to-be-removed const_err lint (#731)
Removed in Rust 1.66:
```
warning: lint `const_err` has been removed: converted into hard error, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> for more information
   --> subxt/src/lib.rs:114:5
    |
114 |     const_err,
    |     ^^^^^^^^^
    |
    = note: `#[warn(renamed_and_removed_lints)]` on by default
```
2022-11-23 16:08:26 +01:00
Alexandru Vasile 1c9aabf0f5 events: Fetch metadata at arbitrary blocks (#727)
* subxt/rpc: Fetch metadata at arbitrary blocks

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* subxt/events: Fetch metadata for events at arbitrary blocks

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Revert "subxt/events: Fetch metadata for events at arbitrary blocks"

This reverts commit 381409b7a8916611d7c44dc6ad58a90993b6c297.

* subxt/events: Custom constructor with metadata for events

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Update subxt/src/events/events_type.rs

Co-authored-by: James Wilson <james@jsdw.me>

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Co-authored-by: James Wilson <james@jsdw.me>
2022-11-23 16:03:04 +02:00
Igor Matuszewski 523534464f Add and adapt a publish.sh utility script from jsonrpsee (#723)
* refactor: Explicitly indicate which crates should be published

* chore: Add a convenience publish.sh script

* Update scripts/publish.sh

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>

* Update scripts/publish.sh

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>

* fix: Don't use unsupported -P flag in BSD grep in publish.sh

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
2022-11-23 12:30:13 +01:00
Igor Matuszewski 8b46f5c786 Retain Rust code items from mod decorated with subxt attribute (#721)
* refactor: Simplify collecting type substitutes

* Simplify ItemMod::from

* Preserve inner Rust items when expanding the subxt::subxt macro

* No named lifetimes

* Update codegen/src/api/mod.rs

Co-authored-by: Andrew Jones <ascjones@gmail.com>

* Move passing UI tests under `ui_tests`

Co-authored-by: Andrew Jones <ascjones@gmail.com>
2022-11-23 12:28:49 +01:00
Niklas Adolfsson 15ffbb6c4b fix(ci): wasm tests with cache + disable logging (#722)
* fix(ci): wasm tests with cache

* disable logging in wasm tests
2022-11-21 18:05:42 +01:00
Niklas Adolfsson 37392f33a5 fix(ci): wasm tests (#720) 2022-11-21 16:04:16 +01:00
Alexandru Vasile 6f2623e11d scripts: Fix generate_changelog.sh with empty printf (#719)
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
2022-11-18 18:30:13 +02:00
Niklas Adolfsson 428bc35ed8 chore: prep release v0.25 (#717)
* bump versions 0.25

* update changelog

* adjust RELEASE.md

* fix weird formatting

* rephrase bad english

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md
v0.25.0
2022-11-16 16:10:31 +01:00
Andrew Jones 389f20ff94 Update substrate crates (#709)
* Patch all substrate deps to use my substrate branch

* default-features = false causing issus in test-runtime

* Use substrate polkadot release branch

* Use default-features for sp-runtime again :(

* Restore default-features for subxt-cli/sp-core

* Fix module error integration test

* Add Send + Sync bounds to ExtrinsicEvents::iter()

* Elide lifetime

* Revert adding Send + Sync

* Add Sync bound to Rpc::ClientError

* Remove version in subxt-metadata

* Use released crates

* Use released sp-keyring

* Fix sp-keyring deps

* Remove unnecessary sp-keyring default-features = false
2022-11-16 13:21:17 +01:00
James Wilson 92ace0629a Make working with nested queries a touch easier (#714)
* First pass adding functions to get blocks and extrinsics

* cargo fmt and cache block events

* prefix block hash with 0x

* pin streams for better ergonomics and add an example of subscribing to blocks

* remove unused var

* standardise on _all, _best and _finalized for different block header subs

* WIP center subscribing around blocks

* Remove the event filtering/subscribing  stuff

* clippy

* we need tokio, silly clippy

* add extrinsic_index() call

* Update subxt/src/blocks/block_types.rs

Co-authored-by: Andrew Jones <ascjones@gmail.com>

* Add dynbamic nested query example and make dynamic::tx a little easier to work with

* calL_value -> inner_tx

* rename example to dynamic_multisig to align with #713 naming

* align dynamic and static multisig examples

* Fix comment typo

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>

Co-authored-by: Andrew Jones <ascjones@gmail.com>
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
2022-11-15 09:05:35 +01:00
Niklas Adolfsson 14e8e6f6b6 add wasm support (#700)
* get started

* make it work again

* make it compile again

* Use async-wasm-feature of jsonrpsee from the master branch

* Ensure we enable JS feature of getrandom for the wasm target

* Update subxt/src/lib.rs

* update jsonrpsee

* fix CI

* cargo fmt

* fix wasm test

* fix grumbles

* exclude wasm-tests from workspace

To avoid leaking `jsonrpsee-web` feature into the workspace

Co-authored-by: Igor Matuszewski <xanewok@gmail.com>
2022-11-14 11:45:21 +00:00
dependabot[bot] 71e58b2c16 Bump Swatinem/rust-cache from 2.0.1 to 2.2.0 (#710)
Bumps [Swatinem/rust-cache](https://github.com/Swatinem/rust-cache) from 2.0.1 to 2.2.0.
- [Release notes](https://github.com/Swatinem/rust-cache/releases)
- [Changelog](https://github.com/Swatinem/rust-cache/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Swatinem/rust-cache/compare/22c9328bcba27aa81a32b1bef27c7e3c78052531...359a70e43a0bb8a13953b04a90f76428b4959bb6)

---
updated-dependencies:
- dependency-name: Swatinem/rust-cache
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-11 14:44:27 +01:00
Niklas Adolfsson 9235d5041c fix clippy (#715)
* fix clippy

* remove used id in codegen

* fix clippy again
2022-11-11 11:03:23 +00:00
James Wilson 33a9ec91af Extend the new api.blocks() to be the primary way to subscribe and fetch blocks/extrinsics/events (#691)
* First pass adding functions to get blocks and extrinsics

* cargo fmt and cache block events

* prefix block hash with 0x

* pin streams for better ergonomics and add an example of subscribing to blocks

* remove unused var

* standardise on _all, _best and _finalized for different block header subs

* WIP center subscribing around blocks

* Remove the event filtering/subscribing  stuff

* clippy

* we need tokio, silly clippy

* add extrinsic_index() call

* Update subxt/src/blocks/block_types.rs

Co-authored-by: Andrew Jones <ascjones@gmail.com>

Co-authored-by: Andrew Jones <ascjones@gmail.com>
2022-11-01 16:53:35 +01:00
Andrew Jones 52d4762d13 Upgrade to scale-info 2.3 and fix errors (#704) 2022-11-01 10:45:06 +01:00
James Wilson da507fa6d2 No need to entangle Signer and nonce now (#702)
* no need to entangle Signr and nonce now

* fmt
2022-10-28 15:15:16 +02:00
Andrew Jones 563afdaded Fix contracts integration test (#699) 2022-10-25 15:32:41 +02:00
Alexandru Vasile 6742fe0b12 error: RpcError with custom client error (#694)
* error: `RpcError` with custom client error

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* error: Add `SubscriptionDropped` and panic on param errors

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Update subxt/src/rpc/rpc_client_t.rs

Co-authored-by: James Wilson <james@jsdw.me>

* Apply rustfmt

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Co-authored-by: James Wilson <james@jsdw.me>
2022-10-20 14:33:50 +01:00
Alexandru Vasile 1736f618d9 codegen: Increase request timeout from 1min to 3min (#696)
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
2022-10-20 14:17:28 +01:00
Michael Müller 2ed959e0e3 Add getters for Module (#697)
* Add getters for `Module`

* Return `Iterator` instead
2022-10-20 14:13:11 +01:00
James Wilson d03e599684 Add runtime_metadata_url to pull metadata directly from a node (#689)
* Allow metadata to be pulled directly from a node with runtime_metadata_url

* Update docs

* https too, and abstract out block_on fn

* tweak a comment in the example
2022-10-19 11:07:12 +01:00
dependabot[bot] d7546db843 Bump Swatinem/rust-cache from 2.0.0 to 2.0.1 (#690)
* Bump Swatinem/rust-cache from 2.0.0 to 2.0.1

Bumps [Swatinem/rust-cache](https://github.com/Swatinem/rust-cache) from 2.0.0 to 2.0.1.
- [Release notes](https://github.com/Swatinem/rust-cache/releases)
- [Changelog](https://github.com/Swatinem/rust-cache/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Swatinem/rust-cache/compare/6720f05bc48b77f96918929a9019fb2203ff71f8...22c9328bcba27aa81a32b1bef27c7e3c78052531)

---
updated-dependencies:
- dependency-name: Swatinem/rust-cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* gha match hash and version

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Sergejs Kostjucenko <sergejs@parity.io>
2022-10-17 11:06:04 +01:00
James Wilson 353cdb8748 into_encoded() for consistency (#685)
* into_encoded() for consistency

* clippy fix
2022-10-10 16:30:35 +02:00
Alexandru Vasile 95e6aa9dda Implement BlocksClient for working with blocks (#671)
* rpc: Fill in any missing finalized blocks

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* tests: Move fill blocks test to RPC location

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* events: Remove the fill in strategy

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* blocks: Introduce blocks client

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* client: Enable the block API

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* blocks: Simplify `subscribe_finalized_headers` method

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* tests: Add tests for `subscribe_finalized_headers`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* blocks: Implement `subscribe_headers`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* tests: Add tests for `subscribe_headers`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* tests: Move `missing_block_headers_will_be_filled_in` to blocks

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* events: Use the new subscribe to blocks

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* blocks: Change API to return future similar to events

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* events: Use blocks API for subscribing to blocks

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Update subxt/src/blocks/blocks_client.rs

Co-authored-by: James Wilson <james@jsdw.me>

* blocks: Simplify docs for `subscribe_finalized_headers`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* blocks: Use `PhantomDataSendSync` to avoid other bounds on `T: Config`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* blocks: Add docs for best blocks

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* blocks: Avoid one clone for the `client.rpc()`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Update testing/integration-tests/src/blocks/mod.rs

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>

* blocks: Improve `subscribe_headers` doc

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Co-authored-by: James Wilson <james@jsdw.me>
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
2022-10-10 10:31:54 +01:00
MOZGIII 10def3c2c4 Allow taking out raw bytes from a SubmittableExtrinsic (#683) 2022-10-10 10:28:23 +01:00
Web3 Smith 51179a8b72 make subxt::Config::Extrinsic Send (#681) 2022-10-07 12:16:59 +01:00
James Wilson 98af356644 Add DecodedValueThunk to allow getting bytes back from dynamic queries (#680) 2022-10-06 09:58:01 +01:00
Web3 Philosopher 81175b2dd9 expose jsonrpc-core client (#672)
* expose jsonrpc-core client

* use shared reference to RpcClienT

* don't expose Arc<dyn RpcClientT>

* cargo fmt
2022-10-04 09:56:51 +01:00
Andrew Jones 6cfd3bb511 Upgrade clap to v4 (#678) 2022-10-03 18:40:06 +01:00
Andrew Jones 432df581f6 Fix contracts integration test (#679)
* Fix contracts integration test

* Revert proof size to 0

* Upload code for instantiate test

* Set proof size to half of max
2022-10-03 18:11:28 +01:00
Alexandru Vasile d4fda9366e tests: Add proof_size field for the Weight (#673)
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
2022-09-29 18:17:15 +03:00
James Wilson 4722028ce7 Refactor CLI tool to give room for growth (#667)
* refactor CLI commands for easier expansion

* add license headers

* cargo fmt
2022-09-27 12:29:34 +01:00
Michael Müller f115ff975c Allow specifying the subxt crate path for generated code (#664)
* Allow specifying the `subxt` crate path for generated code

* Make `clippy` happy

* Add documentation

* Improve optics

* Remove custom crate path test

* Implement comments

* Update comment

* Make `crate_path` property instead of argument

* Remove unnecessary derives

* Remove `Default` impls in favor of explicit constructors

* Remove unnecessary `into`

* Update codegen/src/types/mod.rs

Co-authored-by: Andrew Jones <ascjones@gmail.com>

Co-authored-by: Andrew Jones <ascjones@gmail.com>
2022-09-27 11:41:36 +01:00
James Wilson 75e383dfcf Prep for 0.24 release (#663)
* Bump versions and update changelog

* tweak text

* merge a couple of related changelog entries
v0.24.0
2022-09-22 17:16:04 +01:00
Alexandru Vasile f48a5df2ca Fix history_depth testing (#662)
* testing/staking: `history_depth` storage is now a constant

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* artifacts: Update metadata from `9ffe6e9e3da`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* testing: Update `polkadot.rs` from `9ffe6e9e3da`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* examples: Update comment wrt polkadot version

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* codegen: Fix clippy

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
2022-09-22 16:02:30 +01:00
Niklas Adolfsson e233dd6bcb feat: add low-level runtime upgrade API (#657)
* feat: add low-level runtime upgrade API

* grumbles

* cargo fmt

* dont use apply_update in perform_runtime_upgrades

* fix nit

* remove metadata check

* fix doc tests

* fix final comments

* Update subxt/src/client/online_client.rs

* cargo fmt

* Update subxt/src/client/online_client.rs
2022-09-22 14:07:50 +02:00
Michael Müller 93cc55feb4 Add accessor for StaticTxPayload::call_data (#660) 2022-09-21 14:26:34 +02:00
Andrew Jones c100b0b2ba Export EventFieldMetadata (#656)
* Export EventFieldMetadata

* Fix up comments for public api
2022-09-21 12:59:14 +01:00
James Wilson 52dd640b5e Bump scale-value and scale-decode (#659)
* Bump scale-value and scale-decode (these both compile to wasm ok)

* clippy
2022-09-21 12:58:26 +01:00
Andrew Jones 3bf7ddc18c Fix codegen for codec::Compact as type parameters (#651)
* Add failing test for compact generic parameter

* WIP refactor type generation

* Fmt

* Remove deprecated rustfmt optionns

* Remove license template path

* Update parent type parameter visitor

* Introduce different methods for generating a type path for a field

* Add comment

* Fix weights refs

* Add extra compact test cases

* Fmt
2022-09-21 10:03:47 +01:00
German 033ceb246f Store type name of a field in event metadata (#654) 2022-09-20 09:59:14 +01:00
Andrew Jones 359c3dae41 Fix latest substrate compatibility check (#653)
* Fix weights refs

* Update Runtime Call name
2022-09-15 10:10:47 +01:00