You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use-ink/ink#1673 introduced macro (ink::contract_ref!) that generates a type-safe API of a contract out of its trait. The dependant trait has to be available during compilation for the macro to work. This is difficult for projects that want to depend on others without having access to all of their repository. In the future where on-chain contracts are verified, it will be easier to download contract's metadata files and generate API than pulling in all of the contracts code as our dependency.
This issue is a feature request to generate ink-compatible trait definitions out of contract's metadata.
A more concrete example: imagine a project my-contract that needs to call something with PSP22 interface. To do that right now, the project would have to look like this:
let psp22_ref: ink::contract_ref!(PSP22) = (*reward_token).into();let balance:Balance = psp22_ref.balance_of(Self::env().account_id());
If ink-wrapper was capable of generating ink trait definitions out of contract's metadata, the first part of the setup would go away and we'd be left with:
use-ink/ink#1673 introduced macro (
ink::contract_ref!
) that generates a type-safe API of a contract out of its trait. The dependant trait has to be available during compilation for the macro to work. This is difficult for projects that want to depend on others without having access to all of their repository. In the future where on-chain contracts are verified, it will be easier to download contract's metadata files and generate API than pulling in all of the contracts code as our dependency.This issue is a feature request to generate ink-compatible trait definitions out of contract's metadata.
A more concrete example: imagine a project
my-contract
that needs to call something withPSP22
interface. To do that right now, the project would have to look like this:where
psp22-traits/lib.rs
defines the PSP22 trait:my-contract/Cargo.toml
needs to specify it as dependency:so that it can use type-safe API for PSP22:
If
ink-wrapper
was capable of generating ink trait definitions out of contract's metadata, the first part of the setup would go away and we'd be left with:and in
my-contract/lib.rs
generate the refThe text was updated successfully, but these errors were encountered: