paraspell / xcm-tools

ParaSpell✨: Set of XCM-Tools for Polkadot and Kusama ecosystem
https://paraspell.github.io/docs/
MIT License
30 stars 9 forks source link

Refactor Asset selection in XCM SDK #366

Closed dudo50 closed 3 days ago

dudo50 commented 1 month ago

We have been playing with the idea of how can we abstract asset selection from developer further and do not overengineer it too much. Currently currency selection consists of following types: string | number | bigint | {symbol: symbol}(If asset Symbol is number) | {id: id} (If there are duplicate assets on Parachain) | multilocation | multiasset

These are 7 options and it could be hard to navigate between them and know which one is the right one.

Thus our idea is to let currency selection be an object and format would look like this:

.currency({ id: //Asset id })

or

.currency({ symbol: //Asset symbol })

or

.currency({ multilocation: //Asset multilocation })

or

.currency({ multiasset: //Multiasset selection })

This will limit currency type to 1 with 4 options instead of 7 different types and 7 different options.

The major drawback to this option is, that it will be breaking change.

We will assist projects with switch if this gets implemented.

dudo50 commented 1 week ago

Expanding this task to cover XCM API & XCM Router also

✅ XCM SDK - https://github.com/paraspell/xcm-tools/pull/394 ✅ XCM API - https://github.com/paraspell/xcm-tools/pull/397 ✅ XCM ROUTER - https://github.com/paraspell/xcm-tools/pull/403

Related issues https://github.com/paraspell/xcm-tools/issues/348 https://github.com/paraspell/xcm-tools/issues/349