Skip to content

Commit

Permalink
Done the changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
“AkashBalasubramani-Router committed Oct 6, 2023
1 parent 36aa42a commit f1c6d94
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
6 changes: 6 additions & 0 deletions examples/simpleInvoke/go.work
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
go 1.18

use (
.
../..
)
30 changes: 16 additions & 14 deletions examples/simpleInvoke/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,34 @@ func main() {
panic(err)
}
clientv02 := rpc.NewProvider(c)
account_address, _ := utils.HexToFelt(account_addr)
account_address, err := utils.HexToFelt(account_addr)
if err != nil {
panic(err.Error())
}
ks := starknetgo.NewMemKeystore()
fakePrivKeyBI, _ := new(big.Int).SetString(privateKey, 0)

ks.Put(public_key, fakePrivKeyBI)

fmt.Println("Established connection with the client")

maxfee, _ := utils.HexToFelt("0x9184e72a000")
maxfee, err := utils.HexToFelt("0x9184e72a000")
if err != nil {
panic(err.Error())
}

InvokeTx := rpc.InvokeTxnV1{
MaxFee: maxfee,
Version: rpc.TransactionV1,
Nonce: new(felt.Felt).SetUint64(104), // You will have to modify this accordingly
Nonce: new(felt.Felt).SetUint64(108), // You will have to modify this accordingly
Type: rpc.TransactionType_Invoke,
SenderAddress: account_address,
}

contractAddress, _ := utils.HexToFelt(someContract)
contractAddress, err := utils.HexToFelt(someContract)
if err != nil {
panic(err.Error())
}

FnCall := rpc.FunctionCall{
ContractAddress: contractAddress,
Expand All @@ -64,19 +74,11 @@ func main() {
panic(err.Error())
}
accnt.BuildInvokeTx(context.Background(), &InvokeTx, &[]rpc.FunctionCall{FnCall})
txHash, err := accnt.TransactionHashInvoke(InvokeTx)
if err != nil {
panic(err.Error())
}
fmt.Printf("TxHash :", txHash)

resp, err := accnt.AddInvokeTransaction(context.Background(), InvokeTx)
if err != nil {
panic(err.Error())
}
fmt.Printf("Response : ", resp)
fmt.Println("Response : ", resp)

}

// func main() {
// ExecuteIncreaseValue()
// }

0 comments on commit f1c6d94

Please sign in to comment.