Skip to content

feat: stellar tx new invoke from XDR#2460

Open
ifropc wants to merge 5 commits intostellar:mainfrom
ifropc:invoke-xdr
Open

feat: stellar tx new invoke from XDR#2460
ifropc wants to merge 5 commits intostellar:mainfrom
ifropc:invoke-xdr

Conversation

@ifropc
Copy link
Copy Markdown
Contributor

@ifropc ifropc commented Mar 23, 2026

What

Add ability to call stellar tx new invoke with base64 encoded InvokeFunctionOp

Why

This is very useful for invoking contracts when arguments are already in JSON or XDR
One particular case is replaying transactions (e.g. after testnet reset one can simply re-apply all previous transactions by simply reading the chain and storing all XDRs)
This is much more simple that writing custom scripts where invoker must know all argument names, and correctly transform JSON XDR into the format the cli expects

Testing

Example:

  1. Encode arguments into XDR. Here's the function signature in the code and an example JSON
Input JSON
{
  "host_function": {
    "invoke_contract": {
      "contract_address": "CBC7JZTXRS7X6DCX6DRCI2NFJJI4BXYPTPOGVG3GPHH27OMPKR434BSX",
      "function_name": "deploy",
      "args": [
        {
          "string": "hello"
        },
        {
          "string": "1.0.0"
        },
        {
          "string": "test-deploy"
        },
        {
          "address": "GCXX2CS5NHBULN3SAITLAA7VRK46PP7NTK3BUQUZ6UXLBNWRHYVGR446"
        },
        "void",
        "void"
      ]
    }
  },
  "auth": [
    {
      "credentials": "source_account",
      "root_invocation": {
        "function": {
          "contract_fn": {
            "contract_address": "CBC7JZTXRS7X6DCX6DRCI2NFJJI4BXYPTPOGVG3GPHH27OMPKR434BSX",
            "function_name": "deploy",
            "args": [
              {
                "string": "hello"
              },
              {
                "string": "1.0.0"
              },
              {
                "string": "test-deploy"
              },
              {
                "address": "GCXX2CS5NHBULN3SAITLAA7VRK46PP7NTK3BUQUZ6UXLBNWRHYVGR446"
              },
              "void",
              "void"
            ]
          }
        },
        "sub_invocations": []
      }
    }
  ]
}

Giving following XDR

AAAAAAAAAAFF9OZ3jL9/DFfw4iRppUpRwN8Pm9xqm2Z5z6+5j1R5vgAAAAZkZXBsb3kAAAAAAAYAAAAOAAAABWhlbGxvAAAAAAAADgAAAAUxLjAuMAAAAAAAAA4AAAALdGVzdC1kZXBsb3kAAAAAEgAAAAAAAAAAr30KXWnDRbdyAiawA/WKuee/7Zq2GkKZ9S6wttE+KmgAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAFF9OZ3jL9/DFfw4iRppUpRwN8Pm9xqm2Z5z6+5j1R5vgAAAAZkZXBsb3kAAAAAAAYAAAAOAAAABWhlbGxvAAAAAAAADgAAAAUxLjAuMAAAAAAAAA4AAAALdGVzdC1kZXBsb3kAAAAAEgAAAAAAAAAAr30KXWnDRbdyAiawA/WKuee/7Zq2GkKZ9S6wttE+KmgAAAABAAAAAQAAAAA=
  1. Check the ownership (registry's manager's signature is required), in my case Alice is manager
[ ~/projects/stellar-cli ] > stellar contract alias ls | grep registry
registry: CBC7JZTXRS7X6DCX6DRCI2NFJJI4BXYPTPOGVG3GPHH27OMPKR434BSX
[ ~/projects/stellar-cli ] > stellar contract invoke --id registry -- manager
ℹ️  Simulation identified as read-only. Send by rerunning with `--send=yes`.
"GAPGYTYEYIHW5TXR2EBF7FE26P2JELDMZKO3P4SJGPJTHMX33VCXSKV7"
[ ~/projects/stellar-cli ] > stellar keys public-key alice                   
GAPGYTYEYIHW5TXR2EBF7FE26P2JELDMZKO3P4SJGPJTHMX33VCXSKV7

(From here on XDR results are converted to JSON for readability)
3. Create transaction with > cargo run tx new invoke --source-account alice --xdr AAAAAAAAAAFF9OZ3jL9/DFfw4iRppUpRwN8Pm9xqm2Z5z6+5j1R5vgAAAAZkZXBsb3kAAAAAAAYAAAAOAAAABWhlbGxvAAAAAAAADgAAAAUxLjAuMAAAAAAAAA4AAAALdGVzdC1kZXBsb3kAAAAAEgAAAAAAAAAAr30KXWnDRbdyAiawA/WKuee/7Zq2GkKZ9S6wttE+KmgAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAFF9OZ3jL9/DFfw4iRppUpRwN8Pm9xqm2Z5z6+5j1R5vgAAAAZkZXBsb3kAAAAAAAYAAAAOAAAABWhlbGxvAAAAAAAADgAAAAUxLjAuMAAAAAAAAA4AAAALdGVzdC1kZXBsb3kAAAAAEgAAAAAAAAAAr30KXWnDRbdyAiawA/WKuee/7Zq2GkKZ9S6wttE+KmgAAAABAAAAAQAAAAA= --build-only | cargo run xdr decode --type TransactionEnvelope | jq

JSON result
{
  "tx": {
    "tx": {
      "source_account": "GAPGYTYEYIHW5TXR2EBF7FE26P2JELDMZKO3P4SJGPJTHMX33VCXSKV7",
      "fee": 100,
      "seq_num": "1362904792170531",
      "cond": "none",
      "memo": "none",
      "operations": [
        {
          "source_account": null,
          "body": {
            "invoke_host_function": {
              "host_function": {
                "invoke_contract": {
                  "contract_address": "CBC7JZTXRS7X6DCX6DRCI2NFJJI4BXYPTPOGVG3GPHH27OMPKR434BSX",
                  "function_name": "deploy",
                  "args": [
                    {
                      "string": "hello"
                    },
                    {
                      "string": "1.0.0"
                    },
                    {
                      "string": "test-deploy"
                    },
                    {
                      "address": "GCXX2CS5NHBULN3SAITLAA7VRK46PP7NTK3BUQUZ6UXLBNWRHYVGR446"
                    },
                    "void",
                    "void"
                  ]
                }
              },
              "auth": [
                {
                  "credentials": "source_account",
                  "root_invocation": {
                    "function": {
                      "contract_fn": {
                        "contract_address": "CBC7JZTXRS7X6DCX6DRCI2NFJJI4BXYPTPOGVG3GPHH27OMPKR434BSX",
                        "function_name": "deploy",
                        "args": [
                          {
                            "string": "hello"
                          },
                          {
                            "string": "1.0.0"
                          },
                          {
                            "string": "test-deploy"
                          },
                          {
                            "address": "GCXX2CS5NHBULN3SAITLAA7VRK46PP7NTK3BUQUZ6UXLBNWRHYVGR446"
                          },
                          "void",
                          "void"
                        ]
                      }
                    },
                    "sub_invocations": []
                  }
                }
              ]
            }
          }
        }
      ],
      "ext": "v0"
    },
    "signatures": []
  }
}

Transaction has been created successfully
4. Sign transaction with the Registry admin key > cargo run tx new invoke --source-account alice --xdr AAAAAAAAAAFF9OZ3jL9/DFfw4iRppUpRwN8Pm9xqm2Z5z6+5j1R5vgAAAAZkZXBsb3kAAAAAAAYAAAAOAAAABWhlbGxvAAAAAAAADgAAAAUxLjAuMAAAAAAAAA4AAAALdGVzdC1kZXBsb3kAAAAAEgAAAAAAAAAAr30KXWnDRbdyAiawA/WKuee/7Zq2GkKZ9S6wttE+KmgAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAFF9OZ3jL9/DFfw4iRppUpRwN8Pm9xqm2Z5z6+5j1R5vgAAAAZkZXBsb3kAAAAAAAYAAAAOAAAABWhlbGxvAAAAAAAADgAAAAUxLjAuMAAAAAAAAA4AAAALdGVzdC1kZXBsb3kAAAAAEgAAAAAAAAAAr30KXWnDRbdyAiawA/WKuee/7Zq2GkKZ9S6wttE+KmgAAAABAAAAAQAAAAA= --build-only | stellar tx sign --sign-with-key alice | cargo run xdr decode --type TransactionEnvelope | jq

JSON result
{
  "tx": {
    "tx": {
      "source_account": "GAPGYTYEYIHW5TXR2EBF7FE26P2JELDMZKO3P4SJGPJTHMX33VCXSKV7",
      "fee": 100,
      "seq_num": "1362904792170531",
      "cond": "none",
      "memo": "none",
      "operations": [
        {
          "source_account": null,
          "body": {
            "invoke_host_function": {
              "host_function": {
                "invoke_contract": {
                  "contract_address": "CBC7JZTXRS7X6DCX6DRCI2NFJJI4BXYPTPOGVG3GPHH27OMPKR434BSX",
                  "function_name": "deploy",
                  "args": [
                    {
                      "string": "hello"
                    },
                    {
                      "string": "1.0.0"
                    },
                    {
                      "string": "test-deploy"
                    },
                    {
                      "address": "GCXX2CS5NHBULN3SAITLAA7VRK46PP7NTK3BUQUZ6UXLBNWRHYVGR446"
                    },
                    "void",
                    "void"
                  ]
                }
              },
              "auth": [
                {
                  "credentials": "source_account",
                  "root_invocation": {
                    "function": {
                      "contract_fn": {
                        "contract_address": "CBC7JZTXRS7X6DCX6DRCI2NFJJI4BXYPTPOGVG3GPHH27OMPKR434BSX",
                        "function_name": "deploy",
                        "args": [
                          {
                            "string": "hello"
                          },
                          {
                            "string": "1.0.0"
                          },
                          {
                            "string": "test-deploy"
                          },
                          {
                            "address": "GCXX2CS5NHBULN3SAITLAA7VRK46PP7NTK3BUQUZ6UXLBNWRHYVGR446"
                          },
                          "void",
                          "void"
                        ]
                      }
                    },
                    "sub_invocations": []
                  }
                }
              ]
            }
          }
        }
      ],
      "ext": "v0"
    },
    "signatures": [
      {
        "hint": "fbdd4579",
        "signature": "32af9598ed5392e9ecea7ac18288d16c3e3eecb0b72105d76bbe19fd29892376500b93ed98fbd69a54ce8c9556bbc2152e4337a74006716598c456a3590eba05"                                                                               
      }
    ]
  }
}
  1. Finally simulate transaction with cargo run tx new invoke --source-account alice --xdr AAAAAAAAAAFF9OZ3jL9/DFfw4iRppUpRwN8Pm9xqm2Z5z6+5j1R5vgAAAAZkZXBsb3kAAAAAAAYAAAAOAAAABWhlbGxvAAAAAAAADgAAAAUxLjAuMAAAAAAAAA4AAAALdGVzdC1kZXBsb3kAAAAAEgAAAAAAAAAAr30KXWnDRbdyAiawA/WKuee/7Zq2GkKZ9S6wttE+KmgAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAFF9OZ3jL9/DFfw4iRppUpRwN8Pm9xqm2Z5z6+5j1R5vgAAAAZkZXBsb3kAAAAAAAYAAAAOAAAABWhlbGxvAAAAAAAADgAAAAUxLjAuMAAAAAAAAA4AAAALdGVzdC1kZXBsb3kAAAAAEgAAAAAAAAAAr30KXWnDRbdyAiawA/WKuee/7Zq2GkKZ9S6wttE+KmgAAAABAAAAAQAAAAA= --build-only | stellar tx sign --sign-with-key alice | stellar tx simulate | cargo run xdr decode --type TransactionEnvelope | jq
JSON result
{
  "tx": {
    "tx": {
      "source_account": "GAPGYTYEYIHW5TXR2EBF7FE26P2JELDMZKO3P4SJGPJTHMX33VCXSKV7",
      "fee": 220712,
      "seq_num": "1362904792170531",
      "cond": "none",
      "memo": "none",
      "operations": [
        {
          "source_account": null,
          "body": {
            "invoke_host_function": {
              "host_function": {
                "invoke_contract": {
                  "contract_address": "CBC7JZTXRS7X6DCX6DRCI2NFJJI4BXYPTPOGVG3GPHH27OMPKR434BSX",
                  "function_name": "deploy",
                  "args": [
                    {
                      "string": "hello"
                    },
                    {
                      "string": "1.0.0"
                    },
                    {
                      "string": "test-deploy"
                    },
                    {
                      "address": "GCXX2CS5NHBULN3SAITLAA7VRK46PP7NTK3BUQUZ6UXLBNWRHYVGR446"
                    },
                    "void",
                    "void"
                  ]
                }
              },
              "auth": [
                {
                  "credentials": "source_account",
                  "root_invocation": {
                    "function": {
                      "contract_fn": {
                        "contract_address": "CBC7JZTXRS7X6DCX6DRCI2NFJJI4BXYPTPOGVG3GPHH27OMPKR434BSX",
                        "function_name": "deploy",
                        "args": [
                          {
                            "string": "hello"
                          },
                          {
                            "string": "1.0.0"
                          },
                          {
                            "string": "test-deploy"
                          },
                          {
                            "address": "GCXX2CS5NHBULN3SAITLAA7VRK46PP7NTK3BUQUZ6UXLBNWRHYVGR446"
                          },
                          "void",
                          "void"
                        ]
                      }
                    },
                    "sub_invocations": []
                  }
                }
              ]
            }
          }
        }
      ],
      "ext": {
        "v1": {
          "ext": "v0",
          "resources": {
            "footprint": {
              "read_only": [
                {
                  "contract_data": {
                    "contract": "CBC7JZTXRS7X6DCX6DRCI2NFJJI4BXYPTPOGVG3GPHH27OMPKR434BSX",
                    "key": {
                      "bytes": "d6a8390d0d77f7611d7f4517715bdb7b95bed1257f8c83b2105450ba360a19f8"
                    },
                    "durability": "persistent"
                  }
                },
                {
                  "contract_data": {
                    "contract": "CBC7JZTXRS7X6DCX6DRCI2NFJJI4BXYPTPOGVG3GPHH27OMPKR434BSX",
                    "key": {
                      "vec": [
                        {
                          "symbol": "WA"
                        },
                        {
                          "string": "hello"
                        }
                      ]
                    },
                    "durability": "persistent"
                  }
                },
                {
                  "contract_data": {
                    "contract": "CBC7JZTXRS7X6DCX6DRCI2NFJJI4BXYPTPOGVG3GPHH27OMPKR434BSX",
                    "key": "ledger_key_contract_instance",
                    "durability": "persistent"
                  }
                },
                {
                  "contract_code": {
                    "hash": "59ab13ca475b96d029a8243d4190212a892f611a78aef5b38321318044b6b3e8"
                  }
                },
                {
                  "contract_code": {
                    "hash": "d6a8390d0d77f7611d7f4517715bdb7b95bed1257f8c83b2105450ba360a19f8"
                  }
                }
              ],
              "read_write": [
                {
                  "contract_data": {
                    "contract": "CA5M4IFGGWALQ3E3U7LYKG4CJ36YTQKPSNDQGUSPJO7LOYTAVQSK2Y6Q",
                    "key": "ledger_key_contract_instance",
                    "durability": "persistent"
                  }
                },
                {
                  "contract_data": {
                    "contract": "CBC7JZTXRS7X6DCX6DRCI2NFJJI4BXYPTPOGVG3GPHH27OMPKR434BSX",
                    "key": {
                      "vec": [
                        {
                          "symbol": "CR"
                        },
                        {
                          "string": "test-deploy"
                        }
                      ]
                    },
                    "durability": "persistent"
                  }
                }
              ]
            },
            "instructions": 2364726,
            "disk_read_bytes": 0,
            "write_bytes": 300
          },
          "resource_fee": "220612"
        }
      }
    },
    "signatures": []
  }
}

Final test is to encode very similar transaction (changing deployed contract id to test-deploy2) see example JSON and signing + sending it

> cargo run tx new invoke --source-account alice --xdr AAAAAAAAAAFF9OZ3jL9/DFfw4iRppUpRwN8Pm9xqm2Z5z6+5j1R5vgAAAAZkZXBsb3kAAAAAAAYAAAAOAAAABWhlbGxvAAAAAAAADgAAAAUxLjAuMAAAAAAAAA4AAAAMdGVzdC1kZXBsb3kyAAAAEgAAAAAAAAAAr30KXWnDRbdyAiawA/WKuee/7Zq2GkKZ9S6wttE+KmgAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAFF9OZ3jL9/DFfw4iRppUpRwN8Pm9xqm2Z5z6+5j1R5vgAAAAZkZXBsb3kAAAAAAAYAAAAOAAAABWhlbGxvAAAAAAAADgAAAAUxLjAuMAAAAAAAAA4AAAAMdGVzdC1kZXBsb3kyAAAAEgAAAAAAAAAAr30KXWnDRbdyAiawA/WKuee/7Zq2GkKZ9S6wttE+KmgAAAABAAAAAQAAAAA= --build-only | stellar tx sign --sign-with-key alice | stellar tx simulate | stellar tx sign --sign-with-key alice | stellar tx send
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.17s
     Running `target/debug/soroban tx new invoke --source-account alice --xdr AAAAAAAAAAFF9OZ3jL9/DFfw4iRppUpRwN8Pm9xqm2Z5z6+5j1R5vgAAAAZkZXBsb3kAAAAAAAYAAAAOAAAABWhlbGxvAAAAAAAADgAAAAUxLjAuMAAAAAAAAA4AAAAMdGVzdC1kZXBsb3kyAAAAEgAAAAAAAAAAr30KXWnDRbdyAiawA/WKuee/7Zq2GkKZ9S6wttE+KmgAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAFF9OZ3jL9/DFfw4iRppUpRwN8Pm9xqm2Z5z6+5j1R5vgAAAAZkZXBsb3kAAAAAAAYAAAAOAAAABWhlbGxvAAAAAAAADgAAAAUxLjAuMAAAAAAAAA4AAAAMdGVzdC1kZXBsb3kyAAAAEgAAAAAAAAAAr30KXWnDRbdyAiawA/WKuee/7Zq2GkKZ9S6wttE+KmgAAAABAAAAAQAAAAA= --build-only`
ℹ️  Signing transaction: a7280b272d72a39a412c031f9946305ee060fc265f9c80366c9a004119580c53
ℹ️  Signing transaction: b5b27c8964b74412519fa552b16bbfc7486848a7f5472934efe8313667b0352f
ℹ️  Transaction hash is b5b27c8964b74412519fa552b16bbfc7486848a7f5472934efe8313667b0352f
🔗 https://stellar.expert/explorer/testnet/tx/b5b27c8964b74412519fa552b16bbfc7486848a7f5472934efe8313667b0352f
Response JSON (very! verbose)
{
  "status": "SUCCESS",
  "ledger": 1820246,
  "envelope": {
    "tx": {
      "tx": {
        "source_account": "GAPGYTYEYIHW5TXR2EBF7FE26P2JELDMZKO3P4SJGPJTHMX33VCXSKV7",
        "fee": 220756,
        "seq_num": "1362904792170531",
        "cond": "none",
        "memo": "none",
        "operations": [
          {
            "source_account": null,
            "body": {
              "invoke_host_function": {
                "host_function": {
                  "invoke_contract": {
                    "contract_address": "CBC7JZTXRS7X6DCX6DRCI2NFJJI4BXYPTPOGVG3GPHH27OMPKR434BSX",
                    "function_name": "deploy",
                    "args": [
                      {
                        "string": "hello"
                      },
                      {
                        "string": "1.0.0"
                      },
                      {
                        "string": "test-deploy2"
                      },
                      {
                        "address": "GCXX2CS5NHBULN3SAITLAA7VRK46PP7NTK3BUQUZ6UXLBNWRHYVGR446"
                      },
                      "void",
                      "void"
                    ]
                  }
                },
                "auth": [
                  {
                    "credentials": "source_account",
                    "root_invocation": {
                      "function": {
                        "contract_fn": {
                          "contract_address": "CBC7JZTXRS7X6DCX6DRCI2NFJJI4BXYPTPOGVG3GPHH27OMPKR434BSX",
                          "function_name": "deploy",
                          "args": [
                            {
                              "string": "hello"
                            },
                            {
                              "string": "1.0.0"
                            },
                            {
                              "string": "test-deploy2"
                            },
                            {
                              "address": "GCXX2CS5NHBULN3SAITLAA7VRK46PP7NTK3BUQUZ6UXLBNWRHYVGR446"
                            },
                            "void",
                            "void"
                          ]
                        }
                      },
                      "sub_invocations": []
                    }
                  }
                ]
              }
            }
          }
        ],
        "ext": {
          "v1": {
            "ext": "v0",
            "resources": {
              "footprint": {
                "read_only": [
                  {
                    "contract_data": {
                      "contract": "CBC7JZTXRS7X6DCX6DRCI2NFJJI4BXYPTPOGVG3GPHH27OMPKR434BSX",
                      "key": {
                        "bytes": "d6a8390d0d77f7611d7f4517715bdb7b95bed1257f8c83b2105450ba360a19f8"
                      },
                      "durability": "persistent"
                    }
                  },
                  {
                    "contract_data": {
                      "contract": "CBC7JZTXRS7X6DCX6DRCI2NFJJI4BXYPTPOGVG3GPHH27OMPKR434BSX",
                      "key": {
                        "vec": [
                          {
                            "symbol": "WA"
                          },
                          {
                            "string": "hello"
                          }
                        ]
                      },
                      "durability": "persistent"
                    }
                  },
                  {
                    "contract_data": {
                      "contract": "CBC7JZTXRS7X6DCX6DRCI2NFJJI4BXYPTPOGVG3GPHH27OMPKR434BSX",
                      "key": "ledger_key_contract_instance",
                      "durability": "persistent"
                    }
                  },
                  {
                    "contract_code": {
                      "hash": "59ab13ca475b96d029a8243d4190212a892f611a78aef5b38321318044b6b3e8"
                    }
                  },
                  {
                    "contract_code": {
                      "hash": "d6a8390d0d77f7611d7f4517715bdb7b95bed1257f8c83b2105450ba360a19f8"
                    }
                  }
                ],
                "read_write": [
                  {
                    "contract_data": {
                      "contract": "CAS6VKZO4FEIX2R5V6NLKH3OTKLBON5UAAFNNAFENUNOKVDZNPRVBHAP",
                      "key": "ledger_key_contract_instance",
                      "durability": "persistent"
                    }
                  },
                  {
                    "contract_data": {
                      "contract": "CBC7JZTXRS7X6DCX6DRCI2NFJJI4BXYPTPOGVG3GPHH27OMPKR434BSX",
                      "key": {
                        "vec": [
                          {
                            "symbol": "CR"
                          },
                          {
                            "string": "test-deploy2"
                          }
                        ]
                      },
                      "durability": "persistent"
                    }
                  }
                ]
              },
              "instructions": 2365741,
              "disk_read_bytes": 0,
              "write_bytes": 300
            },
            "resource_fee": "220656"
          }
        }
      },
      "signatures": [
        {
          "hint": "fbdd4579",
          "signature": "c8ecad6cd2f5b84858bccc10a6d7115ca39ee0d21c02dc2ca32a49ac857a73fa466f520cb0e544aed9c2a33fe04db23ee6a439f42b3d330ae0239450dd77660a"
        }
      ]
    }
  },
  "result": {
    "fee_charged": "185152",
    "result": {
      "tx_success": [
        {
          "op_inner": {
            "invoke_host_function": {
              "success": "354366c9b0bb6635136642adc67f075c0e27365337e8fb27def13e95b1f6dc22"
            }
          }
        }
      ]
    },
    "ext": "v0"
  },
  "result_meta": {
    "v4": {
      "ext": "v0",
      "tx_changes_before": [
        {
          "state": {
            "last_modified_ledger_seq": 1820246,
            "data": {
              "account": {
                "account_id": "GAPGYTYEYIHW5TXR2EBF7FE26P2JELDMZKO3P4SJGPJTHMX33VCXSKV7",
                "balance": "99884086875",
                "seq_num": "1362904792170530",
                "num_sub_entries": 0,
                "inflation_dest": null,
                "flags": 0,
                "home_domain": "",
                "thresholds": "01000000",
                "signers": [],
                "ext": {
                  "v1": {
                    "liabilities": {
                      "buying": "0",
                      "selling": "0"
                    },
                    "ext": {
                      "v2": {
                        "num_sponsored": 0,
                        "num_sponsoring": 0,
                        "signer_sponsoring_i_ds": [],
                        "ext": {
                          "v3": {
                            "ext": "v0",
                            "seq_ledger": 1647455,
                            "seq_time": "1774238904"
                          }
                        }
                      }
                    }
                  }
                }
              }
            },
            "ext": "v0"
          }
        },
        {
          "updated": {
            "last_modified_ledger_seq": 1820246,
            "data": {
              "account": {
                "account_id": "GAPGYTYEYIHW5TXR2EBF7FE26P2JELDMZKO3P4SJGPJTHMX33VCXSKV7",
                "balance": "99884086875",
                "seq_num": "1362904792170531",
                "num_sub_entries": 0,
                "inflation_dest": null,
                "flags": 0,
                "home_domain": "",
                "thresholds": "01000000",
                "signers": [],
                "ext": {
                  "v1": {
                    "liabilities": {
                      "buying": "0",
                      "selling": "0"
                    },
                    "ext": {
                      "v2": {
                        "num_sponsored": 0,
                        "num_sponsoring": 0,
                        "signer_sponsoring_i_ds": [],
                        "ext": {
                          "v3": {
                            "ext": "v0",
                            "seq_ledger": 1820246,
                            "seq_time": "1775103918"
                          }
                        }
                      }
                    }
                  }
                }
              }
            },
            "ext": "v0"
          }
        }
      ],
      "operations": [
        {
          "ext": "v0",
          "changes": [
            {
              "state": {
                "last_modified_ledger_seq": 1820013,
                "data": {
                  "ttl": {
                    "key_hash": "a7f4fbb6d853b202fc45ca5c6994ddeb011e1519896286acb98a954fdf25d0e4",
                    "live_until_ledger_seq": 1940972
                  }
                },
                "ext": "v0"
              }
            },
            {
              "updated": {
                "last_modified_ledger_seq": 1820246,
                "data": {
                  "ttl": {
                    "key_hash": "a7f4fbb6d853b202fc45ca5c6994ddeb011e1519896286acb98a954fdf25d0e4",
                    "live_until_ledger_seq": 2355925
                  }
                },
                "ext": "v0"
              }
            },
            {
              "state": {
                "last_modified_ledger_seq": 1820013,
                "data": {
                  "ttl": {
                    "key_hash": "18cb34ba98f054ebd7558b43c9215dd9692a5fec3883ff4c10ab5305443e9883",
                    "live_until_ledger_seq": 1940972
                  }
                },
                "ext": "v0"
              }
            },
            {
              "updated": {
                "last_modified_ledger_seq": 1820246,
                "data": {
                  "ttl": {
                    "key_hash": "18cb34ba98f054ebd7558b43c9215dd9692a5fec3883ff4c10ab5305443e9883",
                    "live_until_ledger_seq": 2355925
                  }
                },
                "ext": "v0"
              }
            },
            {
              "created": {
                "last_modified_ledger_seq": 1820246,
                "data": {
                  "contract_data": {
                    "ext": "v0",
                    "contract": "CBC7JZTXRS7X6DCX6DRCI2NFJJI4BXYPTPOGVG3GPHH27OMPKR434BSX",
                    "key": {
                      "vec": [
                        {
                          "symbol": "CR"
                        },
                        {
                          "string": "test-deploy2"
                        }
                      ]
                    },
                    "durability": "persistent",
                    "val": {
                      "vec": [
                        {
                          "address": "GCXX2CS5NHBULN3SAITLAA7VRK46PP7NTK3BUQUZ6UXLBNWRHYVGR446"
                        },
                        {
                          "address": "CAS6VKZO4FEIX2R5V6NLKH3OTKLBON5UAAFNNAFENUNOKVDZNPRVBHAP"
                        }
                      ]
                    }
                  }
                },
                "ext": "v0"
              }
            },
            {
              "created": {
                "last_modified_ledger_seq": 1820246,
                "data": {
                  "ttl": {
                    "key_hash": "f506bece1bcf28dbb7d31662e553a877d8143d816776497c4d93a4be3bd822c7",
                    "live_until_ledger_seq": 1941205
                  }
                },
                "ext": "v0"
              }
            },
            {
              "created": {
                "last_modified_ledger_seq": 1820246,
                "data": {
                  "ttl": {
                    "key_hash": "114ba025f6486f6e2b12b162c5da9b6a560d8c8d7f6b6bcf8391011f1824a164",
                    "live_until_ledger_seq": 1941205
                  }
                },
                "ext": "v0"
              }
            },
            {
              "created": {
                "last_modified_ledger_seq": 1820246,
                "data": {
                  "contract_data": {
                    "ext": "v0",
                    "contract": "CAS6VKZO4FEIX2R5V6NLKH3OTKLBON5UAAFNNAFENUNOKVDZNPRVBHAP",
                    "key": "ledger_key_contract_instance",
                    "durability": "persistent",
                    "val": {
                      "contract_instance": {
                        "executable": {
                          "wasm": "d6a8390d0d77f7611d7f4517715bdb7b95bed1257f8c83b2105450ba360a19f8"
                        },
                        "storage": null
                      }
                    }
                  }
                },
                "ext": "v0"
              }
            }
          ],
          "events": [
            {
              "ext": "v0",
              "contract_id": "CBC7JZTXRS7X6DCX6DRCI2NFJJI4BXYPTPOGVG3GPHH27OMPKR434BSX",
              "type_": "contract",
              "body": {
                "v0": {
                  "topics": [
                    {
                      "symbol": "deploy"
                    }
                  ],
                  "data": {
                    "map": [
                      {
                        "key": {
                          "symbol": "contract_id"
                        },
                        "val": {
                          "address": "CAS6VKZO4FEIX2R5V6NLKH3OTKLBON5UAAFNNAFENUNOKVDZNPRVBHAP"
                        }
                      },
                      {
                        "key": {
                          "symbol": "deployer"
                        },
                        "val": {
                          "address": "CBC7JZTXRS7X6DCX6DRCI2NFJJI4BXYPTPOGVG3GPHH27OMPKR434BSX"
                        }
                      },
                      {
                        "key": {
                          "symbol": "version"
                        },
                        "val": {
                          "string": "1.0.0"
                        }
                      },
                      {
                        "key": {
                          "symbol": "wasm_name"
                        },
                        "val": {
                          "string": "hello"
                        }
                      }
                    ]
                  }
                }
              }
            },
            {
              "ext": "v0",
              "contract_id": "CBC7JZTXRS7X6DCX6DRCI2NFJJI4BXYPTPOGVG3GPHH27OMPKR434BSX",
              "type_": "contract",
              "body": {
                "v0": {
                  "topics": [
                    {
                      "symbol": "register"
                    }
                  ],
                  "data": {
                    "map": [
                      {
                        "key": {
                          "symbol": "contract_id"
                        },
                        "val": {
                          "address": "CAS6VKZO4FEIX2R5V6NLKH3OTKLBON5UAAFNNAFENUNOKVDZNPRVBHAP"
                        }
                      },
                      {
                        "key": {
                          "symbol": "contract_name"
                        },
                        "val": {
                          "string": "test-deploy2"
                        }
                      },
                      {
                        "key": {
                          "symbol": "sac"
                        },
                        "val": {
                          "bool": false
                        }
                      },
                      {
                        "key": {
                          "symbol": "wasm_hash"
                        },
                        "val": {
                          "bytes": "d6a8390d0d77f7611d7f4517715bdb7b95bed1257f8c83b2105450ba360a19f8"
                        }
                      }
                    ]
                  }
                }
              }
            }
          ]
        }
      ],
      "tx_changes_after": [],
      "soroban_meta": {
        "ext": {
          "v1": {
            "ext": "v0",
            "total_non_refundable_resource_fee_charged": "12203",
            "total_refundable_resource_fee_charged": "172849",
            "rent_fee_charged": "170075"
          }
        },
        "return_value": {
          "address": "CAS6VKZO4FEIX2R5V6NLKH3OTKLBON5UAAFNNAFENUNOKVDZNPRVBHAP"
        }
      },
      "events": [
        {
          "stage": "before_all_txs",
          "event": {
            "ext": "v0",
            "contract_id": "CDLZFC3SYJYDZT7K67VZ75HPJVIEUVNIXF47ZG2FB2RMQQVU2HHGCYSC",
            "type_": "contract",
            "body": {
              "v0": {
                "topics": [
                  {
                    "symbol": "fee"
                  },
                  {
                    "address": "GAPGYTYEYIHW5TXR2EBF7FE26P2JELDMZKO3P4SJGPJTHMX33VCXSKV7"
                  }
                ],
                "data": {
                  "i128": "220756"
                }
              }
            }
          }
        },
        {
          "stage": "after_all_txs",
          "event": {
            "ext": "v0",
            "contract_id": "CDLZFC3SYJYDZT7K67VZ75HPJVIEUVNIXF47ZG2FB2RMQQVU2HHGCYSC",
            "type_": "contract",
            "body": {
              "v0": {
                "topics": [
                  {
                    "symbol": "fee"
                  },
                  {
                    "address": "GAPGYTYEYIHW5TXR2EBF7FE26P2JELDMZKO3P4SJGPJTHMX33VCXSKV7"
                  }
                ],
                "data": {
                  "i128": "-35604"
                }
              }
            }
          }
        }
      ],
      "diagnostic_events": [
        {
          "in_successful_contract_call": true,
          "event": {
            "ext": "v0",
            "contract_id": null,
            "type_": "diagnostic",
            "body": {
              "v0": {
                "topics": [
                  {
                    "symbol": "fn_call"
                  },
                  {
                    "bytes": "45f4e6778cbf7f0c57f0e22469a54a51c0df0f9bdc6a9b6679cfafb98f5479be"
                  },
                  {
                    "symbol": "deploy"
                  }
                ],
                "data": {
                  "vec": [
                    {
                      "string": "hello"
                    },
                    {
                      "string": "1.0.0"
                    },
                    {
                      "string": "test-deploy2"
                    },
                    {
                      "address": "GCXX2CS5NHBULN3SAITLAA7VRK46PP7NTK3BUQUZ6UXLBNWRHYVGR446"
                    },
                    "void",
                    "void"
                  ]
                }
              }
            }
          }
        },
        {
          "in_successful_contract_call": true,
          "event": {
            "ext": "v0",
            "contract_id": "CBC7JZTXRS7X6DCX6DRCI2NFJJI4BXYPTPOGVG3GPHH27OMPKR434BSX",
            "type_": "diagnostic",
            "body": {
              "v0": {
                "topics": [
                  {
                    "symbol": "fn_call"
                  },
                  {
                    "bytes": "25eaab2ee1488bea3daf9ab51f6e9a961737b4000ad680a46d1ae554796be350"
                  },
                  {
                    "symbol": "__constructor"
                  }
                ],
                "data": "void"
              }
            }
          }
        },
        {
          "in_successful_contract_call": true,
          "event": {
            "ext": "v0",
            "contract_id": "CAS6VKZO4FEIX2R5V6NLKH3OTKLBON5UAAFNNAFENUNOKVDZNPRVBHAP",
            "type_": "diagnostic",
            "body": {
              "v0": {
                "topics": [
                  {
                    "symbol": "fn_return"
                  },
                  {
                    "symbol": "__constructor"
                  }
                ],
                "data": "void"
              }
            }
          }
        },
        {
          "in_successful_contract_call": true,
          "event": {
            "ext": "v0",
            "contract_id": "CBC7JZTXRS7X6DCX6DRCI2NFJJI4BXYPTPOGVG3GPHH27OMPKR434BSX",
            "type_": "contract",
            "body": {
              "v0": {
                "topics": [
                  {
                    "symbol": "deploy"
                  }
                ],
                "data": {
                  "map": [
                    {
                      "key": {
                        "symbol": "contract_id"
                      },
                      "val": {
                        "address": "CAS6VKZO4FEIX2R5V6NLKH3OTKLBON5UAAFNNAFENUNOKVDZNPRVBHAP"
                      }
                    },
                    {
                      "key": {
                        "symbol": "deployer"
                      },
                      "val": {
                        "address": "CBC7JZTXRS7X6DCX6DRCI2NFJJI4BXYPTPOGVG3GPHH27OMPKR434BSX"
                      }
                    },
                    {
                      "key": {
                        "symbol": "version"
                      },
                      "val": {
                        "string": "1.0.0"
                      }
                    },
                    {
                      "key": {
                        "symbol": "wasm_name"
                      },
                      "val": {
                        "string": "hello"
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        {
          "in_successful_contract_call": true,
          "event": {
            "ext": "v0",
            "contract_id": "CBC7JZTXRS7X6DCX6DRCI2NFJJI4BXYPTPOGVG3GPHH27OMPKR434BSX",
            "type_": "contract",
            "body": {
              "v0": {
                "topics": [
                  {
                    "symbol": "register"
                  }
                ],
                "data": {
                  "map": [
                    {
                      "key": {
                        "symbol": "contract_id"
                      },
                      "val": {
                        "address": "CAS6VKZO4FEIX2R5V6NLKH3OTKLBON5UAAFNNAFENUNOKVDZNPRVBHAP"
                      }
                    },
                    {
                      "key": {
                        "symbol": "contract_name"
                      },
                      "val": {
                        "string": "test-deploy2"
                      }
                    },
                    {
                      "key": {
                        "symbol": "sac"
                      },
                      "val": {
                        "bool": false
                      }
                    },
                    {
                      "key": {
                        "symbol": "wasm_hash"
                      },
                      "val": {
                        "bytes": "d6a8390d0d77f7611d7f4517715bdb7b95bed1257f8c83b2105450ba360a19f8"
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        {
          "in_successful_contract_call": true,
          "event": {
            "ext": "v0",
            "contract_id": "CBC7JZTXRS7X6DCX6DRCI2NFJJI4BXYPTPOGVG3GPHH27OMPKR434BSX",
            "type_": "diagnostic",
            "body": {
              "v0": {
                "topics": [
                  {
                    "symbol": "fn_return"
                  },
                  {
                    "symbol": "deploy"
                  }
                ],
                "data": {
                  "address": "CAS6VKZO4FEIX2R5V6NLKH3OTKLBON5UAAFNNAFENUNOKVDZNPRVBHAP"
                }
              }
            }
          }
        },
        {
          "in_successful_contract_call": true,
          "event": {
            "ext": "v0",
            "contract_id": null,
            "type_": "diagnostic",
            "body": {
              "v0": {
                "topics": [
                  {
                    "symbol": "core_metrics"
                  },
                  {
                    "symbol": "read_entry"
                  }
                ],
                "data": {
                  "u64": "7"
                }
              }
            }
          }
        },
        {
          "in_successful_contract_call": true,
          "event": {
            "ext": "v0",
            "contract_id": null,
            "type_": "diagnostic",
            "body": {
              "v0": {
                "topics": [
                  {
                    "symbol": "core_metrics"
                  },
                  {
                    "symbol": "write_entry"
                  }
                ],
                "data": {
                  "u64": "2"
                }
              }
            }
          }
        },
        {
          "in_successful_contract_call": true,
          "event": {
            "ext": "v0",
            "contract_id": null,
            "type_": "diagnostic",
            "body": {
              "v0": {
                "topics": [
                  {
                    "symbol": "core_metrics"
                  },
                  {
                    "symbol": "ledger_read_byte"
                  }
                ],
                "data": {
                  "u64": "0"
                }
              }
            }
          }
        },
        {
          "in_successful_contract_call": true,
          "event": {
            "ext": "v0",
            "contract_id": null,
            "type_": "diagnostic",
            "body": {
              "v0": {
                "topics": [
                  {
                    "symbol": "core_metrics"
                  },
                  {
                    "symbol": "ledger_write_byte"
                  }
                ],
                "data": {
                  "u64": "300"
                }
              }
            }
          }
        },
        {
          "in_successful_contract_call": true,
          "event": {
            "ext": "v0",
            "contract_id": null,
            "type_": "diagnostic",
            "body": {
              "v0": {
                "topics": [
                  {
                    "symbol": "core_metrics"
                  },
                  {
                    "symbol": "read_key_byte"
                  }
                ],
                "data": {
                  "u64": "0"
                }
              }
            }
          }
        },
        {
          "in_successful_contract_call": true,
          "event": {
            "ext": "v0",
            "contract_id": null,
            "type_": "diagnostic",
            "body": {
              "v0": {
                "topics": [
                  {
                    "symbol": "core_metrics"
                  },
                  {
                    "symbol": "write_key_byte"
                  }
                ],
                "data": {
                  "u64": "0"
                }
              }
            }
          }
        },
        {
          "in_successful_contract_call": true,
          "event": {
            "ext": "v0",
            "contract_id": null,
            "type_": "diagnostic",
            "body": {
              "v0": {
                "topics": [
                  {
                    "symbol": "core_metrics"
                  },
                  {
                    "symbol": "read_data_byte"
                  }
                ],
                "data": {
                  "u64": "0"
                }
              }
            }
          }
        },
        {
          "in_successful_contract_call": true,
          "event": {
            "ext": "v0",
            "contract_id": null,
            "type_": "diagnostic",
            "body": {
              "v0": {
                "topics": [
                  {
                    "symbol": "core_metrics"
                  },
                  {
                    "symbol": "write_data_byte"
                  }
                ],
                "data": {
                  "u64": "300"
                }
              }
            }
          }
        },
        {
          "in_successful_contract_call": true,
          "event": {
            "ext": "v0",
            "contract_id": null,
            "type_": "diagnostic",
            "body": {
              "v0": {
                "topics": [
                  {
                    "symbol": "core_metrics"
                  },
                  {
                    "symbol": "read_code_byte"
                  }
                ],
                "data": {
                  "u64": "0"
                }
              }
            }
          }
        },
        {
          "in_successful_contract_call": true,
          "event": {
            "ext": "v0",
            "contract_id": null,
            "type_": "diagnostic",
            "body": {
              "v0": {
                "topics": [
                  {
                    "symbol": "core_metrics"
                  },
                  {
                    "symbol": "write_code_byte"
                  }
                ],
                "data": {
                  "u64": "0"
                }
              }
            }
          }
        },
        {
          "in_successful_contract_call": true,
          "event": {
            "ext": "v0",
            "contract_id": null,
            "type_": "diagnostic",
            "body": {
              "v0": {
                "topics": [
                  {
                    "symbol": "core_metrics"
                  },
                  {
                    "symbol": "emit_event"
                  }
                ],
                "data": {
                  "u64": "2"
                }
              }
            }
          }
        },
        {
          "in_successful_contract_call": true,
          "event": {
            "ext": "v0",
            "contract_id": null,
            "type_": "diagnostic",
            "body": {
              "v0": {
                "topics": [
                  {
                    "symbol": "core_metrics"
                  },
                  {
                    "symbol": "emit_event_byte"
                  }
                ],
                "data": {
                  "u64": "568"
                }
              }
            }
          }
        },
        {
          "in_successful_contract_call": true,
          "event": {
            "ext": "v0",
            "contract_id": null,
            "type_": "diagnostic",
            "body": {
              "v0": {
                "topics": [
                  {
                    "symbol": "core_metrics"
                  },
                  {
                    "symbol": "cpu_insn"
                  }
                ],
                "data": {
                  "u64": "2234090"
                }
              }
            }
          }
        },
        {
          "in_successful_contract_call": true,
          "event": {
            "ext": "v0",
            "contract_id": null,
            "type_": "diagnostic",
            "body": {
              "v0": {
                "topics": [
                  {
                    "symbol": "core_metrics"
                  },
                  {
                    "symbol": "mem_byte"
                  }
                ],
                "data": {
                  "u64": "4116286"
                }
              }
            }
          }
        },
        {
          "in_successful_contract_call": true,
          "event": {
            "ext": "v0",
            "contract_id": null,
            "type_": "diagnostic",
            "body": {
              "v0": {
                "topics": [
                  {
                    "symbol": "core_metrics"
                  },
                  {
                    "symbol": "invoke_time_nsecs"
                  }
                ],
                "data": {
                  "u64": "619946"
                }
              }
            }
          }
        },
        {
          "in_successful_contract_call": true,
          "event": {
            "ext": "v0",
            "contract_id": null,
            "type_": "diagnostic",
            "body": {
              "v0": {
                "topics": [
                  {
                    "symbol": "core_metrics"
                  },
                  {
                    "symbol": "max_rw_key_byte"
                  }
                ],
                "data": {
                  "u64": "88"
                }
              }
            }
          }
        },
        {
          "in_successful_contract_call": true,
          "event": {
            "ext": "v0",
            "contract_id": null,
            "type_": "diagnostic",
            "body": {
              "v0": {
                "topics": [
                  {
                    "symbol": "core_metrics"
                  },
                  {
                    "symbol": "max_rw_data_byte"
                  }
                ],
                "data": {
                  "u64": "196"
                }
              }
            }
          }
        },
        {
          "in_successful_contract_call": true,
          "event": {
            "ext": "v0",
            "contract_id": null,
            "type_": "diagnostic",
            "body": {
              "v0": {
                "topics": [
                  {
                    "symbol": "core_metrics"
                  },
                  {
                    "symbol": "max_rw_code_byte"
                  }
                ],
                "data": {
                  "u64": "0"
                }
              }
            }
          }
        },
        {
          "in_successful_contract_call": true,
          "event": {
            "ext": "v0",
            "contract_id": null,
            "type_": "diagnostic",
            "body": {
              "v0": {
                "topics": [
                  {
                    "symbol": "core_metrics"
                  },
                  {
                    "symbol": "max_emit_event_byte"
                  }
                ],
                "data": {
                  "u64": "264"
                }
              }
            }
          }
        }
      ]
    }
  },
  "events": {
    "contract_events": [
      [
        {
          "ext": "v0",
          "contract_id": "CBC7JZTXRS7X6DCX6DRCI2NFJJI4BXYPTPOGVG3GPHH27OMPKR434BSX",
          "type_": "contract",
          "body": {
            "v0": {
              "topics": [
                {
                  "symbol": "deploy"
                }
              ],
              "data": {
                "map": [
                  {
                    "key": {
                      "symbol": "contract_id"
                    },
                    "val": {
                      "address": "CAS6VKZO4FEIX2R5V6NLKH3OTKLBON5UAAFNNAFENUNOKVDZNPRVBHAP"
                    }
                  },
                  {
                    "key": {
                      "symbol": "deployer"
                    },
                    "val": {
                      "address": "CBC7JZTXRS7X6DCX6DRCI2NFJJI4BXYPTPOGVG3GPHH27OMPKR434BSX"
                    }
                  },
                  {
                    "key": {
                      "symbol": "version"
                    },
                    "val": {
                      "string": "1.0.0"
                    }
                  },
                  {
                    "key": {
                      "symbol": "wasm_name"
                    },
                    "val": {
                      "string": "hello"
                    }
                  }
                ]
              }
            }
          }
        },
        {
          "ext": "v0",
          "contract_id": "CBC7JZTXRS7X6DCX6DRCI2NFJJI4BXYPTPOGVG3GPHH27OMPKR434BSX",
          "type_": "contract",
          "body": {
            "v0": {
              "topics": [
                {
                  "symbol": "register"
                }
              ],
              "data": {
                "map": [
                  {
                    "key": {
                      "symbol": "contract_id"
                    },
                    "val": {
                      "address": "CAS6VKZO4FEIX2R5V6NLKH3OTKLBON5UAAFNNAFENUNOKVDZNPRVBHAP"
                    }
                  },
                  {
                    "key": {
                      "symbol": "contract_name"
                    },
                    "val": {
                      "string": "test-deploy2"
                    }
                  },
                  {
                    "key": {
                      "symbol": "sac"
                    },
                    "val": {
                      "bool": false
                    }
                  },
                  {
                    "key": {
                      "symbol": "wasm_hash"
                    },
                    "val": {
                      "bytes": "d6a8390d0d77f7611d7f4517715bdb7b95bed1257f8c83b2105450ba360a19f8"
                    }
                  }
                ]
              }
            }
          }
        }
      ]
    ],
    "diagnostic_events": [],
    "transaction_events": [
      {
        "stage": "before_all_txs",
        "event": {
          "ext": "v0",
          "contract_id": "CDLZFC3SYJYDZT7K67VZ75HPJVIEUVNIXF47ZG2FB2RMQQVU2HHGCYSC",
          "type_": "contract",
          "body": {
            "v0": {
              "topics": [
                {
                  "symbol": "fee"
                },
                {
                  "address": "GAPGYTYEYIHW5TXR2EBF7FE26P2JELDMZKO3P4SJGPJTHMX33VCXSKV7"
                }
              ],
              "data": {
                "i128": "220756"
              }
            }
          }
        }
      },
      {
        "stage": "after_all_txs",
        "event": {
          "ext": "v0",
          "contract_id": "CDLZFC3SYJYDZT7K67VZ75HPJVIEUVNIXF47ZG2FB2RMQQVU2HHGCYSC",
          "type_": "contract",
          "body": {
            "v0": {
              "topics": [
                {
                  "symbol": "fee"
                },
                {
                  "address": "GAPGYTYEYIHW5TXR2EBF7FE26P2JELDMZKO3P4SJGPJTHMX33VCXSKV7"
                }
              ],
              "data": {
                "i128": "-35604"
              }
            }
          }
        }
      }
    ]
  }
}
Details

Copilot AI review requested due to automatic review settings March 23, 2026 04:22
@github-project-automation github-project-automation bot moved this to Backlog (Not Ready) in DevX Mar 23, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an alternate contract invocation flow that accepts pre-encoded base64 XDR arguments (string or file input), and removes a local whitespace-stripping reader now that stellar-xdr provides SkipWhitespace.

Changes:

  • Use stellar_xdr::curr::SkipWhitespace directly (remove local SkipWhitespace shim).
  • Add --invoke-contract-args to stellar contract invoke and make the existing “slop” args optional/alternative.
  • Implement XDR decoding helpers in contract arg parsing to build invoke parameters from base64 XDR.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
cmd/soroban-cli/src/commands/tx/xdr.rs Switches to upstream SkipWhitespace and removes local implementation.
cmd/soroban-cli/src/commands/contract/invoke.rs Adds --invoke-contract-args and routes invocation parameter building accordingly.
cmd/soroban-cli/src/commands/contract/arg_parsing.rs Adds XDR decoding path for InvokeContractArgs and plumbing to build host function parameters from it.

@chadoh
Copy link
Copy Markdown
Contributor

chadoh commented Mar 27, 2026

Should these be the same contract ID?

contract ID in encoded 'function' object vs contract id in 'contract invoke' command

I find it a little bit odd/unfortunate that we need to encode the entire function object into XDR, rather than just the args array. For one, the args are the only hard thing to do in the "replay transactions from history" context, not the contract ID and function name. For another, the contract ID is duplicated (I think?) between the still-existing --id arg and the encoded parameters.

Ideally, I would want an interface like:

stellar contract invoke --id … -s … -- deploy --args-xdr …

Which would accept only the args portion encoded as XDR.

I understand that this creates the possibility of clobbering a contract-defined function if it happens to have the name args_xdr. And maybe there's other reasons to not do this, or that reorganizing this PR in such a way would be too difficult to be worthwhile.

Alternatively, if we just rename invoke-contract-args, then I would already like the current implementation more. And if we can make --id incompatible with this new arg, to avoid contradictory input, that seems nice. So the interface might become something like:

stellar contract invoke -s alice --function-xdr …

Hmmm. That might be nice because it specifies that you need to encode a function as XDR. But maybe another name would be better?

Backing up: this deviating enough from the other invoke functionality that we should make a new subcommand?

stellar contract invoke-raw -s alice --xdr AAAAAUX05…

Or maybe we add this to the tx subcommand. It looks like the current tx functionality is still a little higher-level than we ideally want; maybe we add a new tx from-xdr command:

stellar tx from-xdr AAAAAUX05… | stellar tx sign --sign-with-key alice | stellar tx send

Would we need to encode a larger parent object, or would just the function object shown in your example be enough?

Either way, I think I like this approach best. The tx interface is currently quite small, so we avoid cluttering the more frequently-used and larger contract interface further with something like invoke-raw, and we avoid further complicating the invoke behavior. And tx feels lower-level, which is a good match for this use-case.

This might also effectively work around the bug in #2459, which is blocking the contract invoke approach.

@leighmcculloch
Copy link
Copy Markdown
Member

leighmcculloch commented Mar 30, 2026

The stellar contract invoke is really for helping construct the invoke, but in the case you have an xdr containing the entire invoke you don't need to construct the invoke since you already have it.

The stellar tx new sub-commands create tx, maybe this would work:

stellar tx new invoke_host_function --xdr ...
# or
stellar tx new invoke --xdr ...

This could be supported across all the stellar tx new commands. They could all support XDR and XDR-JSON.

The tx can then be pushed to stellar tx simulate.

@leighmcculloch
Copy link
Copy Markdown
Member

I would at least start with adding it to stellar tx new, and see if folks are able to find it, and then revisit adding to stellar contract invoke after seeing how that plays out, see if the convenience methods are really needed before increasing the complexity of it.

@ifropc ifropc changed the title feat: invoke from XDR args feat: stellar tx new invoke from XDR Apr 2, 2026
@ifropc
Copy link
Copy Markdown
Contributor Author

ifropc commented Apr 2, 2026

@chadoh and @leighmcculloch thanks for feedback. Agree, just adding new stellar tx makes much more sense. Not sure if we want to publish this examples somewhere, but it illustrates how to invoke relatively complex contract (registry) with just using the JSON format that people can also play around with in the lab (that's what I did when was changing parameters)

Copy link
Copy Markdown
Contributor

@chadoh chadoh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it! This is a very clean approach.

@chadoh
Copy link
Copy Markdown
Contributor

chadoh commented Apr 2, 2026

Not sure what to make of the CI failure. Maybe you need to rebase on main?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog (Not Ready)

Development

Successfully merging this pull request may close these issues.

4 participants