soroban-cli icon indicating copy to clipboard operation
soroban-cli copied to clipboard

No good way to use `restorePreamble` meaning you can't really restore anything via the TS bindings 😳

Open kalepail opened this issue 1 year ago • 1 comments
trafficstars

As far as I can tell the TS bindings don't make use of the restorePreamble section of the simulated endpoint meaning you can't restore entries when they expire in the way the RPC expects you to.

This should be observed and utilized as part of the simulation process before or in addition to signAndSend. I don't think it should be required but likely defaulted with a path to check and insert into the flow in the case there are entries that need to be restored.

kalepail avatar Feb 09 '24 16:02 kalepail

I also don't like that the error is just a massive Error string without any ability to dig into the underlying RPC response.

RPC gives me

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "transactionData": "AAAAAAAAAAEAAAAHeYCw8N3Non6lAKIhUXNOBk0cMOJlM2R5Osm1LdP6TIYAAAAFAAAABgAAAAFSzmMC8+GwkvwZ8I4e0kF7Rte7y215/CN7vziHUO952gAAABAAAAABAAAAAgAAAA8AAAAGQXV0aG9yAAAAAAADAAAAIgAAAAEAAAAGAAAAAVLOYwLz4bCS/Bnwjh7SQXtG17vLbXn8I3u/OIdQ73naAAAAEAAAAAEAAAACAAAADwAAAAdBdXRob3JzAAAAAAMAAAABAAAAAQAAAAYAAAABUs5jAvPhsJL8GfCOHtJBe0bXu8ttefwje784h1DvedoAAAAQAAAAAQAAAAIAAAAPAAAABk51bWJlcgAAAAAAEgAAAAAAAAAA902dO18iFPtVcmYaRdb8T06GJ+WdroUja3nMmZASUOYAAAABAAAABgAAAAFSzmMC8+GwkvwZ8I4e0kF7Rte7y215/CN7vziHUO952gAAABAAAAABAAAAAgAAAA8AAAAHUGljdHVyZQAAAAADAAAAIgAAAAEAAAAGAAAAAVLOYwLz4bCS/Bnwjh7SQXtG17vLbXn8I3u/OIdQ73naAAAAFAAAAAEAUmfmAAAUbAAABpQAAAAAAAGP1g==",
        "minResourceFee": "102358",
        "events": [
            "AAAAAQAAAAAAAAAAAAAAAgAAAAAAAAADAAAADwAAAAdmbl9jYWxsAAAAAA0AAAAgUs5jAvPhsJL8GfCOHtJBe0bXu8ttefwje784h1DvedoAAAAPAAAABG1pbnQAAAAQAAAAAQAAAAMAAAAOAAAAAAAAABIAAAAAAAAAAPdNnTtfIhT7VXJmGkXW/E9Ohiflna6FI2t5zJmQElDmAAAADQAAAGQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
            "AAAAAQAAAAAAAAABUs5jAvPhsJL8GfCOHtJBe0bXu8ttefwje784h1DvedoAAAACAAAAAAAAAAIAAAAPAAAACWZuX3JldHVybgAAAAAAAA8AAAAEbWludAAAAAMAAAAi"
        ],
        "results": [
            {
                "auth": [
                    "AAAAAAAAAAAAAAABUs5jAvPhsJL8GfCOHtJBe0bXu8ttefwje784h1DvedoAAAAEbWludAAAAAMAAAAOAAAAAAAAABIAAAAAAAAAAPdNnTtfIhT7VXJmGkXW/E9Ohiflna6FI2t5zJmQElDmAAAADQAAAGQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="
                ],
                "xdr": "AAAAAwAAACI="
            }
        ],
        "cost": {
            "cpuInsns": "2400550",
            "memBytes": "1556377"
        },
        "restorePreamble": {
            "transactionData": "AAAAAAAAAAAAAAADAAAAB3mAsPDdzaJ+pQCiIVFzTgZNHDDiZTNkeTrJtS3T+kyGAAAABgAAAAFSzmMC8+GwkvwZ8I4e0kF7Rte7y215/CN7vziHUO952gAAABAAAAABAAAAAgAAAA8AAAAHQXV0aG9ycwAAAAADAAAAAQAAAAEAAAAGAAAAAVLOYwLz4bCS/Bnwjh7SQXtG17vLbXn8I3u/OIdQ73naAAAAFAAAAAEAAAAAAAAUbAAAFGwAAAAAAACuhw==",
            "minResourceFee": "44679"
        },
        "latestLedger": 474594
    }
}

The TS bindings throws into the catch and just delivers

index.ts:95 Error: You need to restore some contract state before you can invoke this method. {
  "_parsed": true,
  "latestLedger": 474624,
  "events": [
    {
      "_attributes": {
        "inSuccessfulContractCall": true,
        "event": {
          "_attributes": {
            "ext": {
              "_switch": 0
            },
            "type": {
              "name": "diagnostic",
              "value": 2
            },
            "body": {
              "_switch": 0,
              "_arm": "v0",
              "_value": {
                "_attributes": {
                  "topics": [
                    {
                      "_switch": {
                        "name": "scvSymbol",
                        "value": 15
                      },
                      "_arm": "sym",
                      "_armType": {
                        "_maxLength": 32
                      },
                      "_value": {
                        "type": "Buffer",
                        "data": [
                          102,
                          110,
                          95,
                          99,
                          97,
                          108,
                          108
                        ]
                      }
                    },
                    {
                      "_switch": {
                        "name": "scvBytes",
                        "value": 13
                      },
                      "_arm": "bytes",
                      "_armType": {
                        "_maxLength": 4294967295
                      },
                      "_value": {
                        "type": "Buffer",
                        "data": [
                          82,
                          206,
                          99,
                          2,
                          243,
                          225,
                          176,
                          146,
                          252,
                          25,
                          240,
                          142,
                          30,
                          210,
                          65,
                          123,
                          70,
                          215,
                          187,
                          203,
                          109,
                          121,
                          252,
                          35,
                          123,
                          191,
                          56,
                          135,
                          80,
                          239,
                          121,
                          218
                        ]
                      }
                    },
                    {
                      "_switch": {
                        "name": "scvSymbol",
                        "value": 15
                      },
                      "_arm": "sym",
                      "_armType": {
                        "_maxLength": 32
                      },
                      "_value": {
                        "type": "Buffer",
                        "data": [
                          109,
                          105,
                          110,
                          116
                        ]
                      }
                    }
                  ],
                  "data": {
                    "_switch": {
                      "name": "scvVec",
                      "value": 16
                    },
                    "_arm": "vec",
                    "_armType": {
                      "_childType": {
                        "_maxLength": 2147483647
                      }
                    },
                    "_value": [
                      {
                        "_switch": {
                          "name": "scvString",
                          "value": 14
                        },
                        "_arm": "str",
                        "_armType": {
                          "_maxLength": 4294967295
                        },
                        "_value": {
                          "type": "Buffer",
                          "data": []
                        }
                      },
                      {
                        "_switch": {
                          "name": "scvAddress",
                          "value": 18
                        },
                        "_arm": "address",
                        "_value": {
                          "_switch": {
                            "name": "scAddressTypeAccount",
                            "value": 0
                          },
                          "_arm": "accountId",
                          "_value": {
                            "_switch": {
                              "name": "publicKeyTypeEd25519",
                              "value": 0
                            },
                            "_arm": "ed25519",
                            "_armType": {
                              "_length": 32
                            },
                            "_value": {
                              "type": "Buffer",
                              "data": [
                                108,
                                134,
                                65,
                                0,
                                128,
                                59,
                                24,
                                3,
                                73,
                                27,
                                83,
                                38,
                                56,
                                130,
                                135,
                                189,
                                206,
                                229,
                                18,
                                8,
                                69,
                                122,
                                36,
                                56,
                                105,
                                139,
                                189,
                                225,
                                64,
                                88,
                                246,
                                140
                              ]
                            }
                          }
                        }
                      },
                      {
                        "_switch": {
                          "name": "scvBytes",
                          "value": 13
                        },
                        "_arm": "bytes",
                        "_armType": {
                          "_maxLength": 4294967295
                        },
                        "_value": {
                          "type": "Buffer",
                          "data": [
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0
                          ]
                        }
                      }
                    ]
                  }
                }
              }
            }
          }
        }
      }
    },
    {
      "_attributes": {
        "inSuccessfulContractCall": true,
        "event": {
          "_attributes": {
            "ext": {
              "_switch": 0
            },
            "contractId": {
              "type": "Buffer",
              "data": [
                82,
                206,
                99,
                2,
                243,
                225,
                176,
                146,
                252,
                25,
                240,
                142,
                30,
                210,
                65,
                123,
                70,
                215,
                187,
                203,
                109,
                121,
                252,
                35,
                123,
                191,
                56,
                135,
                80,
                239,
                121,
                218
              ]
            },
            "type": {
              "name": "diagnostic",
              "value": 2
            },
            "body": {
              "_switch": 0,
              "_arm": "v0",
              "_value": {
                "_attributes": {
                  "topics": [
                    {
                      "_switch": {
                        "name": "scvSymbol",
                        "value": 15
                      },
                      "_arm": "sym",
                      "_armType": {
                        "_maxLength": 32
                      },
                      "_value": {
                        "type": "Buffer",
                        "data": [
                          102,
                          110,
                          95,
                          114,
                          101,
                          116,
                          117,
                          114,
                          110
                        ]
                      }
                    },
                    {
                      "_switch": {
                        "name": "scvSymbol",
                        "value": 15
                      },
                      "_arm": "sym",
                      "_armType": {
                        "_maxLength": 32
                      },
                      "_value": {
                        "type": "Buffer",
                        "data": [
                          109,
                          105,
                          110,
                          116
                        ]
                      }
                    }
                  ],
                  "data": {
                    "_switch": {
                      "name": "scvU32",
                      "value": 3
                    },
                    "_arm": "u32",
                    "_value": 34
                  }
                }
              }
            }
          }
        }
      }
    }
  ],
  "transactionData": {
    "_data": {
      "_attributes": {
        "ext": {
          "_switch": 0
        },
        "resources": {
          "_attributes": {
            "footprint": {
              "_attributes": {
                "readOnly": [
                  {
                    "_switch": {
                      "name": "contractCode",
                      "value": 7
                    },
                    "_arm": "contractCode",
                    "_value": {
                      "_attributes": {
                        "hash": {
                          "type": "Buffer",
                          "data": [
                            121,
                            128,
                            176,
                            240,
                            221,
                            205,
                            162,
                            126,
                            165,
                            0,
                            162,
                            33,
                            81,
                            115,
                            78,
                            6,
                            77,
                            28,
                            48,
                            226,
                            101,
                            51,
                            100,
                            121,
                            58,
                            201,
                            181,
                            45,
                            211,
                            250,
                            76,
                            134
                          ]
                        }
                      }
                    }
                  }
                ],
                "readWrite": [
                  {
                    "_switch": {
                      "name": "contractData",
                      "value": 6
                    },
                    "_arm": "contractData",
                    "_value": {
                      "_attributes": {
                        "contract": {
                          "_switch": {
                            "name": "scAddressTypeContract",
                            "value": 1
                          },
                          "_arm": "contractId",
                          "_armType": {
                            "_length": 32
                          },
                          "_value": {
                            "type": "Buffer",
                            "data": [
                              82,
                              206,
                              99,
                              2,
                              243,
                              225,
                              176,
                              146,
                              252,
                              25,
                              240,
                              142,
                              30,
                              210,
                              65,
                              123,
                              70,
                              215,
                              187,
                              203,
                              109,
                              121,
                              252,
                              35,
                              123,
                              191,
                              56,
                              135,
                              80,
                              239,
                              121,
                              218
                            ]
                          }
                        },
                        "key": {
                          "_switch": {
                            "name": "scvVec",
                            "value": 16
                          },
                          "_arm": "vec",
                          "_armType": {
                            "_childType": {
                              "_maxLength": 2147483647
                            }
                          },
                          "_value": [
                            {
                              "_switch": {
                                "name": "scvSymbol",
                                "value": 15
                              },
                              "_arm": "sym",
                              "_armType": {
                                "_maxLength": 32
                              },
                              "_value": {
                                "type": "Buffer",
                                "data": [
                                  65,
                                  117,
                                  116,
                                  104,
                                  111,
                                  114
                                ]
                              }
                            },
                            {
                              "_switch": {
                                "name": "scvU32",
                                "value": 3
                              },
                              "_arm": "u32",
                              "_value": 34
                            }
                          ]
                        },
                        "durability": {
                          "name": "persistent",
                          "value": 1
                        }
                      }
                    }
                  },
                  {
                    "_switch": {
                      "name": "contractData",
                      "value": 6
                    },
                    "_arm": "contractData",
                    "_value": {
                      "_attributes": {
                        "contract": {
                          "_switch": {
                            "name": "scAddressTypeContract",
                            "value": 1
                          },
                          "_arm": "contractId",
                          "_armType": {
                            "_length": 32
                          },
                          "_value": {
                            "type": "Buffer",
                            "data": [
                              82,
                              206,
                              99,
                              2,
                              243,
                              225,
                              176,
                              146,
                              252,
                              25,
                              240,
                              142,
                              30,
                              210,
                              65,
                              123,
                              70,
                              215,
                              187,
                              203,
                              109,
                              121,
                              252,
                              35,
                              123,
                              191,
                              56,
                              135,
                              80,
                              239,
                              121,
                              218
                            ]
                          }
                        },
                        "key": {
                          "_switch": {
                            "name": "scvVec",
                            "value": 16
                          },
                          "_arm": "vec",
                          "_armType": {
                            "_childType": {
                              "_maxLength": 2147483647
                            }
                          },
                          "_value": [
                            {
                              "_switch": {
                                "name": "scvSymbol",
                                "value": 15
                              },
                              "_arm": "sym",
                              "_armType": {
                                "_maxLength": 32
                              },
                              "_value": {
                                "type": "Buffer",
                                "data": [
                                  65,
                                  117,
                                  116,
                                  104,
                                  111,
                                  114,
                                  115
                                ]
                              }
                            },
                            {
                              "_switch": {
                                "name": "scvU32",
                                "value": 3
                              },
                              "_arm": "u32",
                              "_value": 1
                            }
                          ]
                        },
                        "durability": {
                          "name": "persistent",
                          "value": 1
                        }
                      }
                    }
                  },
                  {
                    "_switch": {
                      "name": "contractData",
                      "value": 6
                    },
                    "_arm": "contractData",
                    "_value": {
                      "_attributes": {
                        "contract": {
                          "_switch": {
                            "name": "scAddressTypeContract",
                            "value": 1
                          },
                          "_arm": "contractId",
                          "_armType": {
                            "_length": 32
                          },
                          "_value": {
                            "type": "Buffer",
                            "data": [
                              82,
                              206,
                              99,
                              2,
                              243,
                              225,
                              176,
                              146,
                              252,
                              25,
                              240,
                              142,
                              30,
                              210,
                              65,
                              123,
                              70,
                              215,
                              187,
                              203,
                              109,
                              121,
                              252,
                              35,
                              123,
                              191,
                              56,
                              135,
                              80,
                              239,
                              121,
                              218
                            ]
                          }
                        },
                        "key": {
                          "_switch": {
                            "name": "scvVec",
                            "value": 16
                          },
                          "_arm": "vec",
                          "_armType": {
                            "_childType": {
                              "_maxLength": 2147483647
                            }
                          },
                          "_value": [
                            {
                              "_switch": {
                                "name": "scvSymbol",
                                "value": 15
                              },
                              "_arm": "sym",
                              "_armType": {
                                "_maxLength": 32
                              },
                              "_value": {
                                "type": "Buffer",
                                "data": [
                                  78,
                                  117,
                                  109,
                                  98,
                                  101,
                                  114
                                ]
                              }
                            },
                            {
                              "_switch": {
                                "name": "scvAddress",
                                "value": 18
                              },
                              "_arm": "address",
                              "_value": {
                                "_switch": {
                                  "name": "scAddressTypeAccount",
                                  "value": 0
                                },
                                "_arm": "accountId",
                                "_value": {
                                  "_switch": {
                                    "name": "publicKeyTypeEd25519",
                                    "value": 0
                                  },
                                  "_arm": "ed25519",
                                  "_armType": {
                                    "_length": 32
                                  },
                                  "_value": {
                                    "type": "Buffer",
                                    "data": [
                                      108,
                                      134,
                                      65,
                                      0,
                                      128,
                                      59,
                                      24,
                                      3,
                                      73,
                                      27,
                                      83,
                                      38,
                                      56,
                                      130,
                                      135,
                                      189,
                                      206,
                                      229,
                                      18,
                                      8,
                                      69,
                                      122,
                                      36,
                                      56,
                                      105,
                                      139,
                                      189,
                                      225,
                                      64,
                                      88,
                                      246,
                                      140
                                    ]
                                  }
                                }
                              }
                            }
                          ]
                        },
                        "durability": {
                          "name": "persistent",
                          "value": 1
                        }
                      }
                    }
                  },
                  {
                    "_switch": {
                      "name": "contractData",
                      "value": 6
                    },
                    "_arm": "contractData",
                    "_value": {
                      "_attributes": {
                        "contract": {
                          "_switch": {
                            "name": "scAddressTypeContract",
                            "value": 1
                          },
                          "_arm": "contractId",
                          "_armType": {
                            "_length": 32
                          },
                          "_value": {
                            "type": "Buffer",
                            "data": [
                              82,
                              206,
                              99,
                              2,
                              243,
                              225,
                              176,
                              146,
                              252,
                              25,
                              240,
                              142,
                              30,
                              210,
                              65,
                              123,
                              70,
                              215,
                              187,
                              203,
                              109,
                              121,
                              252,
                              35,
                              123,
                              191,
                              56,
                              135,
                              80,
                              239,
                              121,
                              218
                            ]
                          }
                        },
                        "key": {
                          "_switch": {
                            "name": "scvVec",
                            "value": 16
                          },
                          "_arm": "vec",
                          "_armType": {
                            "_childType": {
                              "_maxLength": 2147483647
                            }
                          },
                          "_value": [
                            {
                              "_switch": {
                                "name": "scvSymbol",
                                "value": 15
                              },
                              "_arm": "sym",
                              "_armType": {
                                "_maxLength": 32
                              },
                              "_value": {
                                "type": "Buffer",
                                "data": [
                                  80,
                                  105,
                                  99,
                                  116,
                                  117,
                                  114,
                                  101
                                ]
                              }
                            },
                            {
                              "_switch": {
                                "name": "scvU32",
                                "value": 3
                              },
                              "_arm": "u32",
                              "_value": 34
                            }
                          ]
                        },
                        "durability": {
                          "name": "persistent",
                          "value": 1
                        }
                      }
                    }
                  },
                  {
                    "_switch": {
                      "name": "contractData",
                      "value": 6
                    },
                    "_arm": "contractData",
                    "_value": {
                      "_attributes": {
                        "contract": {
                          "_switch": {
                            "name": "scAddressTypeContract",
                            "value": 1
                          },
                          "_arm": "contractId",
                          "_armType": {
                            "_length": 32
                          },
                          "_value": {
                            "type": "Buffer",
                            "data": [
                              82,
                              206,
                              99,
                              2,
                              243,
                              225,
                              176,
                              146,
                              252,
                              25,
                              240,
                              142,
                              30,
                              210,
                              65,
                              123,
                              70,
                              215,
                              187,
                              203,
                              109,
                              121,
                              252,
                              35,
                              123,
                              191,
                              56,
                              135,
                              80,
                              239,
                              121,
                              218
                            ]
                          }
                        },
                        "key": {
                          "_switch": {
                            "name": "scvLedgerKeyContractInstance",
                            "value": 20
                          }
                        },
                        "durability": {
                          "name": "persistent",
                          "value": 1
                        }
                      }
                    }
                  }
                ]
              }
            },
            "instructions": 5400550,
            "readBytes": 5228,
            "writeBytes": 1684
          }
        },
        "resourceFee": {
          "_value": "102358"
        }
      }
    }
  },
  "minResourceFee": "102358",
  "cost": {
    "cpuInsns": "2400550",
    "memBytes": "1556377"
  },
  "result": {
    "auth": [
      {
        "_attributes": {
          "credentials": {
            "_switch": {
              "name": "sorobanCredentialsSourceAccount",
              "value": 0
            }
          },
          "rootInvocation": {
            "_attributes": {
              "function": {
                "_switch": {
                  "name": "sorobanAuthorizedFunctionTypeContractFn",
                  "value": 0
                },
                "_arm": "contractFn",
                "_value": {
                  "_attributes": {
                    "contractAddress": {
                      "_switch": {
                        "name": "scAddressTypeContract",
                        "value": 1
                      },
                      "_arm": "contractId",
                      "_armType": {
                        "_length": 32
                      },
                      "_value": {
                        "type": "Buffer",
                        "data": [
                          82,
                          206,
                          99,
                          2,
                          243,
                          225,
                          176,
                          146,
                          252,
                          25,
                          240,
                          142,
                          30,
                          210,
                          65,
                          123,
                          70,
                          215,
                          187,
                          203,
                          109,
                          121,
                          252,
                          35,
                          123,
                          191,
                          56,
                          135,
                          80,
                          239,
                          121,
                          218
                        ]
                      }
                    },
                    "functionName": {
                      "type": "Buffer",
                      "data": [
                        109,
                        105,
                        110,
                        116
                      ]
                    },
                    "args": [
                      {
                        "_switch": {
                          "name": "scvString",
                          "value": 14
                        },
                        "_arm": "str",
                        "_armType": {
                          "_maxLength": 4294967295
                        },
                        "_value": {
                          "type": "Buffer",
                          "data": []
                        }
                      },
                      {
                        "_switch": {
                          "name": "scvAddress",
                          "value": 18
                        },
                        "_arm": "address",
                        "_value": {
                          "_switch": {
                            "name": "scAddressTypeAccount",
                            "value": 0
                          },
                          "_arm": "accountId",
                          "_value": {
                            "_switch": {
                              "name": "publicKeyTypeEd25519",
                              "value": 0
                            },
                            "_arm": "ed25519",
                            "_armType": {
                              "_length": 32
                            },
                            "_value": {
                              "type": "Buffer",
                              "data": [
                                108,
                                134,
                                65,
                                0,
                                128,
                                59,
                                24,
                                3,
                                73,
                                27,
                                83,
                                38,
                                56,
                                130,
                                135,
                                189,
                                206,
                                229,
                                18,
                                8,
                                69,
                                122,
                                36,
                                56,
                                105,
                                139,
                                189,
                                225,
                                64,
                                88,
                                246,
                                140
                              ]
                            }
                          }
                        }
                      },
                      {
                        "_switch": {
                          "name": "scvBytes",
                          "value": 13
                        },
                        "_arm": "bytes",
                        "_armType": {
                          "_maxLength": 4294967295
                        },
                        "_value": {
                          "type": "Buffer",
                          "data": [
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0,
                            0
                          ]
                        }
                      }
                    ]
                  }
                }
              },
              "subInvocations": []
            }
          }
        }
      }
    ],
    "retval": {
      "_switch": {
        "name": "scvU32",
        "value": 3
      },
      "_arm": "u32",
      "_value": 34
    }
  },
  "restorePreamble": {
    "minResourceFee": "44679",
    "transactionData": {
      "_data": {
        "_attributes": {
          "ext": {
            "_switch": 0
          },
          "resources": {
            "_attributes": {
              "footprint": {
                "_attributes": {
                  "readOnly": [],
                  "readWrite": [
                    {
                      "_switch": {
                        "name": "contractCode",
                        "value": 7
                      },
                      "_arm": "contractCode",
                      "_value": {
                        "_attributes": {
                          "hash": {
                            "type": "Buffer",
                            "data": [
                              121,
                              128,
                              176,
                              240,
                              221,
                              205,
                              162,
                              126,
                              165,
                              0,
                              162,
                              33,
                              81,
                              115,
                              78,
                              6,
                              77,
                              28,
                              48,
                              226,
                              101,
                              51,
                              100,
                              121,
                              58,
                              201,
                              181,
                              45,
                              211,
                              250,
                              76,
                              134
                            ]
                          }
                        }
                      }
                    },
                    {
                      "_switch": {
                        "name": "contractData",
                        "value": 6
                      },
                      "_arm": "contractData",
                      "_value": {
                        "_attributes": {
                          "contract": {
                            "_switch": {
                              "name": "scAddressTypeContract",
                              "value": 1
                            },
                            "_arm": "contractId",
                            "_armType": {
                              "_length": 32
                            },
                            "_value": {
                              "type": "Buffer",
                              "data": [
                                82,
                                206,
                                99,
                                2,
                                243,
                                225,
                                176,
                                146,
                                252,
                                25,
                                240,
                                142,
                                30,
                                210,
                                65,
                                123,
                                70,
                                215,
                                187,
                                203,
                                109,
                                121,
                                252,
                                35,
                                123,
                                191,
                                56,
                                135,
                                80,
                                239,
                                121,
                                218
                              ]
                            }
                          },
                          "key": {
                            "_switch": {
                              "name": "scvVec",
                              "value": 16
                            },
                            "_arm": "vec",
                            "_armType": {
                              "_childType": {
                                "_maxLength": 2147483647
                              }
                            },
                            "_value": [
                              {
                                "_switch": {
                                  "name": "scvSymbol",
                                  "value": 15
                                },
                                "_arm": "sym",
                                "_armType": {
                                  "_maxLength": 32
                                },
                                "_value": {
                                  "type": "Buffer",
                                  "data": [
                                    65,
                                    117,
                                    116,
                                    104,
                                    111,
                                    114,
                                    115
                                  ]
                                }
                              },
                              {
                                "_switch": {
                                  "name": "scvU32",
                                  "value": 3
                                },
                                "_arm": "u32",
                                "_value": 1
                              }
                            ]
                          },
                          "durability": {
                            "name": "persistent",
                            "value": 1
                          }
                        }
                      }
                    },
                    {
                      "_switch": {
                        "name": "contractData",
                        "value": 6
                      },
                      "_arm": "contractData",
                      "_value": {
                        "_attributes": {
                          "contract": {
                            "_switch": {
                              "name": "scAddressTypeContract",
                              "value": 1
                            },
                            "_arm": "contractId",
                            "_armType": {
                              "_length": 32
                            },
                            "_value": {
                              "type": "Buffer",
                              "data": [
                                82,
                                206,
                                99,
                                2,
                                243,
                                225,
                                176,
                                146,
                                252,
                                25,
                                240,
                                142,
                                30,
                                210,
                                65,
                                123,
                                70,
                                215,
                                187,
                                203,
                                109,
                                121,
                                252,
                                35,
                                123,
                                191,
                                56,
                                135,
                                80,
                                239,
                                121,
                                218
                              ]
                            }
                          },
                          "key": {
                            "_switch": {
                              "name": "scvLedgerKeyContractInstance",
                              "value": 20
                            }
                          },
                          "durability": {
                            "name": "persistent",
                            "value": 1
                          }
                        }
                      }
                    }
                  ]
                }
              },
              "instructions": 0,
              "readBytes": 5228,
              "writeBytes": 5228
            }
          },
          "resourceFee": {
            "_value": "44679"
          }
        }
      }
    }
  }
}
    at get simulationData [as simulationData] (assembled-tx.js:126:19)
    at get result [as result] (assembled-tx.js:141:53)
    at index.ts:91:25
    at async kalewalkMint (index.ts:85:21)
    at async mint (+page.svelte:29:13)

This should be far cleaner and more parseable as a usable error. Especially in the case when it's not actually an error but a request for initial action prior to the actual original transaction execution.

kalepail avatar Feb 09 '24 16:02 kalepail