securesecrets / shadejs

SDK for integrating with Shade contracts
https://shadejs.dev
7 stars 1 forks source link

Recommandation for Wrapping tokens? #127

Closed Subfortytwo closed 3 months ago

Subfortytwo commented 3 months ago

Hi,

Is there a way to use shadejs to wrap/unwrap tokens? I am currently doing this step manually. Would you mind providing an example?

Thank you very very much!

AustinWoetzel commented 3 months ago

Hi, thanks for the suggestion. ShadeJS in it's current form is mainly for understanding and collecting data on shade contracts rather than executing transactions. We do have one example of a swap execute message, but this is the message only and nothing related to signing with a wallet. I have future hopes that we can extend shadejs to signing, but this is not in the near-term roadmap.

The wrap/unwrap messages are included here for reference. Using these, you can look at the secret.js docs for info on signing and broadcasting.

    deposit(
      amount: string,
      denom: string,
    ): Snip20MessageRequest {
      const msg = { deposit: { } };
      const transferAmount = {
        amount, denom,
      };
      return {
        msg,
        transferAmount,
      };
    },

    redeem({
      amount,
      denom,
      padding,
    }:{
      amount: string,
      denom: string,
      padding: string,
    }): Snip20MessageRequest {
      const msg = {
        redeem: {
          amount,
          denom,
          padding,
        },
      };
      return { msg };
    },