Skip to main content
8 votes
Accepted

What are type bundles and versioned metadata?

First the good news - for any chain using metadata v14, specifying custom types are not needed. The metadata itself supplies all the types required. This means that when a call is defined in the ...
Jaco's user avatar
  • 5,865
7 votes
Accepted

Correct way to use dynamic sized types in chain extension

In order to read memory from a contract you should check out the different functions on the Environment type. As Green Baneling already pointed out correctly you should use SCALE in order to encode ...
Alexander Theißen's user avatar
7 votes
Accepted

Why can't we use `T::Call` in pallet like `T::AccountId` and `T::BlockNumber`?

The Call type from frame_system is not the call that you want to use in this scenario. You should look at how the Multisig pallet handles working with the Call type. You must define a new Call type ...
Shawn Tabrizi's user avatar
  • 16.1k
5 votes
Accepted

How does typegen work with metadata v14?

You are correct in that the actual definitions are basically deprecated. However, it does still play a (small) role in that the RPC types are not carried in the metadata. (This will change in the ...
Jaco's user avatar
  • 5,865
5 votes
Accepted

Cannot infer type for type parameter 'T'

Rather than call Investor::contribute(who,dev.account_id,rent); Seems you should call: Investor::<T::AccountId, u32>::contribute(who,dev.account_id,rent); And just be explicit with your type ...
Shawn Tabrizi's user avatar
  • 16.1k
4 votes
Accepted

api.createType does not work?

The XcmVersionedMultiLocation type-example you shared can be created as follows : const loc = api.createType("XcmVersionedMultiLocation", { V3: { ...
dominique's user avatar
  • 1,693
3 votes
Accepted

MultiLocation type polkadot js

So you are very close to the correct answer. Using createType will automically set the type reference to the interface you assign. So the correct code here in typescript would be: const loc = api....
Tarik Gul's user avatar
  • 1,131
2 votes
Accepted

Substrate Sidecar Custom Type Issue

Geez... remove the outer types property so just have: { "AccountInfo": "AccountInfoWithRefCount" } And everything works... maybe this will help someone else.
Will White's user avatar
2 votes

Correct way to use dynamic sized types in chain extension

Each type in ink! implements scale::Encode and scale::Decode. That serialization and deserialization are used across the substrate everywhere. To pass some dynamic types you can encode it on the ...
Green Baneling's user avatar
2 votes
Accepted

what is the correct typescript syntax for declaring the return type of session.queuedKeys()

Looks like you have a syntax error in your TypeScript. TS does not use the Rust syntax of (value1, value2, ...) for tuples, but it uses the same syntax as an Array: [value1, value2, ...] Correcting ...
Joe Caputo's user avatar
2 votes
Accepted

Add my custom chain types to Polkadot-js/apps

In the Usage section of the Polkadot.js typegen tutorial it first shows how to extract the types from your custom type definitions, for example see how the Edgeware team releases versions their types ...
Luke Schoen's user avatar
  • 2,346
1 vote

facing unconstrained type parameter issue

You have to constrain the struct with generic phantom type. pub struct DataProvider<T>(sp_std::marker::PhantomData<T>); impl<T: Config> DataProvider<T> { fn details() ->...
dastansam's user avatar
  • 591
1 vote
Accepted

How can you use Polkadot JS API to Create an XCM Reserve Transfer Assets? (XCM V2)

This can all be done in a simple, pure JavaScript example. Start with a minimal HTML page with the necessary Polkadot JS imports: index.html <!doctype html> <html lang="en"> <...
Shawn Tabrizi's user avatar
  • 16.1k
1 vote

Generated Types Not Found

I am no longer using tsc for generation of types .. I am using esno or tsx because of ESM. npx esno node_modules/.bin/polkadot-types-from-defs --package @mangata-finance/types/interfaces --input ./src/...
Michal Danco's user avatar
1 vote
Accepted

Polkadot JS query response types are missing

What you are missing is to apply augmentation, for that you have to import '@polkadot/api-augment' into your codebase entry point before any imports from the API itself: import "@polkadot/api-...
Alex Bean's user avatar
  • 5,757
1 vote

Property X does not exist on type DecoratedRpc

It seems that you require this update from https://github.com/paritytech/substrate/pull/14481. Without it, the custom RPC metadata will not be included in the runtime metadata.
AurevoirXavier's user avatar
  • 10.7k
1 vote

Custom RPC sized array parameters

[u8; 32] is basically an array of u8. Try directly with the array you have: const message = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, ...
Alex Bean's user avatar
  • 5,757
1 vote
Accepted

impl<T: Config> unconstrained type parameter

Write: impl<PostId, AccountId> Post<PostId, AccountId> { pub fn new(id: PostId, created_by: AccountId, content: Vec<u8>) -> Self { Post { id, edited: false, owner: ...
bkchr's user avatar
  • 11.6k

Only top scored, non community-wiki answers of a minimum length are eligible