LemonNekoGH / easinteraction-for-cadence

Easinteraction is a tool that help users to generate code for easier contract interaction.
https://docs.easi-gen.lemonneko.moe/
MIT License
6 stars 0 forks source link

Add composite type conversion in in script generation #17

Closed LemonNekoGH closed 1 year ago

LemonNekoGH commented 1 year ago

Example: Cadence:

pub struct A {
  pub let one: Int64
  pub let two: UInt64

  init(_ one: Int64, _ two: UInt64) {
    self.one = one
    self.two = two
  }
}

Go struct:

struct A {
  One int64
  Two uint64
}

Query script differents:

- pub fun main(_ arg0: A): A {
+ pub fun main(_ argA0: Int64, _ argA1: UInt64): A {
-   return a
+   return A(argA0, argA1)
  }
LemonNekoGH commented 1 year ago

There is a problem: We can't construct the struct without constructor that contains all fields, or the struct fields are not pub(set)