Type-safe APIs to interact with ink! Smart Contracts | Dedot

Hello everyone,

Following up on last month’s forum post introducing Dedot, we discussed the limitations of Polkadot.js and how Dedot addresses these issues to enhance the developer experience for dApps development in the ecosystem.

Interacting with ink! smart contracts has been challenging with Polkadot.js, especially for new developers. One of our primary goals with Dedot has been to address this issue, and it has been a major focus for us over the past few months.

Today, we are pleased to announce that interacting with ink! smart contracts is now easier and more developer-friendly than ever before, thanks to Dedot’s type-safe APIs (latest version: v0.4.1). You can now have confidence in the types of messages and parameters to send to the contracts and accurately interpret the data types you receive. With Dedot, you work exclusively with TypeScript’s native type system, eliminating the need to handle wrapped codec types.

typink

Example Dapps & Scripts

We’ve put together a few examples to show-case how easy it is to interact with ink! Smart contracts using type-safe APIs from Dedot.

Tiny Link (https://link.dedot.dev)

We’ve made a fork of the project link (https://tiny.ink) to completely use Dedot instead of Polkadot.js. It’s now not only easier to work with but we also see the bundle size of the application is cut off more than a half (pre-compression: 2.4MB → 1MB, gzip: 696KB → 313KB)

The contract is deployed on POP Network, make sure to claim some testnet token to try out the dapp. Below is a few shortened links available for you to try out:

Source code: github.com/dedotdev/link

PSP22 Contract Interaction (Script)

This is a simple script to demonstrate how easy it’s to interact with a PSP22 Contract. The script is hosted on Stackblitz, so you can play with it as well as you like.

psp22

What you can do with Dedot’s type-safe contract APIs?

  1. Generate Types & APIs for your contracts using dedot cli
  2. Deploy contracts using ContractDeployer interface
  3. Interact with contracts via Contract interface (query & submit transaction)
  4. Dry-run contract’s constructors or calls for validation and gas estimation
  5. Decode & access to fully-typed contract events

Find out more in detail about these here in the document.

Conclusion

We really appreciate it if you could give it a try and let us know if you havea any feedback or questions. This will help us to further improve the API and lower the entry-bar for new developers into ink & the ecosystem!

Don’t hesitate to throw any questions you might have on Dedot’s Telegram group or reach out to me directly on X/Telegram at @realsinzii. Thank you all very much!

8 Likes

very good stuff

1 Like

This is amazing!!

What is your roadmap with respect to ink! x Dedot?

1 Like

@NTP-996 @Daanvdplas Thanks a lot for the support guys! :partying_face:

What is your roadmap with respect to ink! x Dedot?

We’re expecting a few more minor improvements for the contract APIs, but in general it’s ready to use for dapp development now unless there’re major feedback from the community. We eagerly look forward to the community feedback while exploring Dedot.

Our next focus regarding ink! contracts integration is to create a better & intuiative documentation & tutorials to make it easier for developers to getting started into building ink! dapps.

1 Like