Skip to content
This repository has been archived by the owner on Aug 31, 2024. It is now read-only.

Commit

Permalink
update randata
Browse files Browse the repository at this point in the history
Signed-off-by: Qiang Zhou <[email protected]>
  • Loading branch information
zhouqiang-cl committed Jan 31, 2024
1 parent dbae313 commit 46eff13
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
1 change: 0 additions & 1 deletion cairoVM/cairo.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ func (c *Cairo) HandleDeclareTx(tx *core.DeclareTransaction, class core.Class) (
}

func (c *Cairo) HandleInvokeTx(tx *core.InvokeTransaction) (*vm.TransactionTrace, error) {
tx.Nonce = &felt.Zero
tx.MaxFee = c.MaxFee
tx.SenderAddress = &felt.Zero
txnHash, err := core.TransactionHash(tx, c.cfg.Network)
Expand Down
10 changes: 4 additions & 6 deletions cairoVM/invoke.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ func NewInvoke() (*core.InvokeTransaction, error) {
// Converting the contractAddress from hex to felt
contractAddress := new(felt.Felt).SetUint64(2)

randata, err := utils.HexToFelt("0x9184e72a000")
if err != nil {
panic(err.Error())
}
randata := new(felt.Felt).SetUint64(2)
// Building the functionCall struct, where :
FnCall := rpc.FunctionCall{
ContractAddress: contractAddress, //contractAddress is the contract that we want to call
Expand All @@ -34,13 +31,14 @@ func NewInvoke() (*core.InvokeTransaction, error) {

InvokeTx.Calldata = account.FmtCalldataCairo2([]rpc.FunctionCall{FnCall})

nonce := new(felt.Felt).SetUint64(1)
tx := core.InvokeTransaction{
Nonce: &felt.Zero,
Nonce: nonce,
MaxFee: &felt.Zero,
Version: new(core.TransactionVersion).SetUint64(1),
ContractAddress: contractAddress,
EntryPointSelector: utils.GetSelectorFromNameFelt(contractMethod),
CallData: InvokeTx.Calldata,
CallData: []*felt.Felt{randata},
}

return &tx, nil
Expand Down

0 comments on commit 46eff13

Please sign in to comment.