From 1bd1947e972cb7f9b148a68ee9d7256576b61d1e Mon Sep 17 00:00:00 2001 From: Thiago Ribeiro <62709592+thiagodeev@users.noreply.github.com> Date: Wed, 18 Dec 2024 13:00:30 -0300 Subject: [PATCH] Creates a description for the multi-call feature (#648) * description of the multi call feature * Improves description --- examples/README.md | 3 ++- examples/simpleInvoke/main.go | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/README.md b/examples/README.md index d2035384..3b897110 100644 --- a/examples/README.md +++ b/examples/README.md @@ -28,6 +28,8 @@ To run an example: R: See [deployContractUDC](./deployContractUDC/main.go). 1. How to send an invoke transaction? R: See [simpleInvoke](./simpleInvoke/main.go). +1. How to make multiple function calls in the same transaction? + R: See [simpleInvoke](./simpleInvoke/main.go), line 92. 1. How to get the transaction status? R: See [simpleInvoke](./simpleInvoke/main.go), line 131. 1. How to deploy an ERC20 token? @@ -38,4 +40,3 @@ To run an example: R: See [simpleCall](./simpleCall/main.go). 1. How to sign and verify a typed data? R: See [typedData](./typedData/main.go). - diff --git a/examples/simpleInvoke/main.go b/examples/simpleInvoke/main.go index 09be957e..c081d5bf 100644 --- a/examples/simpleInvoke/main.go +++ b/examples/simpleInvoke/main.go @@ -88,6 +88,10 @@ func main() { } // Building the Calldata with the help of FmtCalldata where we pass in the FnCall struct along with the Cairo version + // + // note: in Starknet, you can execute multiple function calls in the same transaction, even if they are from different contracts. + // To do this in Starknet.go, just group all the function calls in the same slice and pass it to FmtCalldata + // e.g. : InvokeTx.Calldata, err = accnt.FmtCalldata([]rpc.FunctionCall{funcCall, anotherFuncCall, yetAnotherFuncCallFromDifferentContract}) InvokeTx.Calldata, err = accnt.FmtCalldata([]rpc.FunctionCall{FnCall}) if err != nil { panic(err)