interbtc-clients icon indicating copy to clipboard operation
interbtc-clients copied to clipboard

Use Runtime APIs instead of RPCs

Open gregdhill opened this issue 1 year ago • 2 comments

The latest subxt release (v0.29.0) includes support for metadata v15 and generating a runtime API interface. See this PR for more detail on how to consume the new (unstable) interface. We can replace any existing RPC calls (.rpc().request("xxx")) with the generated code and presumably use the static metadata for types such as BalanceWrapper.

gregdhill avatar Jul 24 '23 13:07 gregdhill

The interbtc substrate dependencies needs to be upgraded to v1.0.0 release to generate the v15 metadata that can be decoded by subxt.

nakul1010 avatar Jul 27 '23 04:07 nakul1010

subxt cli command to generate metadata subxt metadata --version unstable -f bytes > metadata-parachain-kintsugi.scale

Error received

Error: 
   0: Could not decode `RuntimeMetadataPrefixed.1`:
   0:     Could not decode `RuntimeMetadata::V15.0`:
   0:         Could not decode `RuntimeMetadataV15::extrinsic`:
   0:             Could not decode `ExtrinsicMetadata::extra_ty`:
   0:                 Could not decode `UntrackedSymbol::id`:
   0:                     out of range decoding Compact<u32>
   0: 
   1: Could not decode `RuntimeMetadata::V15.0`:
   1:     Could not decode `RuntimeMetadataV15::extrinsic`:
   1:         Could not decode `ExtrinsicMetadata::extra_ty`:
   1:             Could not decode `UntrackedSymbol::id`:
   1:                 out of range decoding Compact<u32>
   1: 
   2: Could not decode `RuntimeMetadataV15::extrinsic`:
   2:     Could not decode `ExtrinsicMetadata::extra_ty`:
   2:         Could not decode `UntrackedSymbol::id`:
   2:             out of range decoding Compact<u32>
   2: 
   3: Could not decode `ExtrinsicMetadata::extra_ty`:
   3:     Could not decode `UntrackedSymbol::id`:
   3:         out of range decoding Compact<u32>
   3: 
   4: Could not decode `UntrackedSymbol::id`:
   4:     out of range decoding Compact<u32>
   4: 
   5: out of range decoding Compact<u32>

The v15 metadata is stabilised in 1.0.0 release.

nakul1010 avatar Jul 28 '23 13:07 nakul1010