Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Get createType to return types without using as #41

Open
forgetso opened this issue Dec 20, 2022 · 0 comments
Open

Get createType to return types without using as #41

forgetso opened this issue Dec 20, 2022 · 0 comments
Labels
dev Product development
Milestone

Comments

@forgetso
Copy link
Member

    private unwrapContractResultOrThrow<T>(result: ContractExecResultOk, type: DefinitionKeys): T {
        const decoded = this.contract.api.registry.createType(`Result<${type}, ProsopoError>`, result.data.toU8a(true))
        if (decoded.isOk) {
            return decoded.asOk.toPrimitive() as T
        } else {
            throw new ProsopoContractError(decoded.asErr.toString())
        }
    }

@forgetso forgetso added the dev Product development label Mar 30, 2023
@forgetso forgetso added this to the MVP milestone Mar 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
dev Product development
Projects
None yet
Development

No branches or pull requests

1 participant