Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to send a Cairo 1.0 class transactions #511

Open
gotoweb3 opened this issue Feb 1, 2024 · 2 comments
Open

How to send a Cairo 1.0 class transactions #511

gotoweb3 opened this issue Feb 1, 2024 · 2 comments

Comments

@gotoweb3
Copy link

gotoweb3 commented Feb 1, 2024

With tag v0.5.0 it is possible to send Cairo 0 class transactions successfully, as soon as the account is upgraded to Cairo 1, the transaction fails!

@rianhughes rianhughes added this to the v0.7.0 milestone Feb 5, 2024
@rianhughes rianhughes moved this to 🔖 To do in [Nubia] Starknet.go Feb 5, 2024
@rianhughes
Copy link
Contributor

Is your account version V1 or V2?

It should work if you set the account version to 2, but if your account is actually V1 let me know.

For example, the following transaction was generated successfully by starknet.go, and uses a V2 account.

@gotoweb3
Copy link
Author

gotoweb3 commented Feb 20, 2024

I understand, but as soon as my wallet is upgraded to cairo1 the code below fails to execute, if I keep my account unupgraded the cario version is 0 and the code succeeds. Is there something wrong with my code?

       // maxfee, err := utils.HexToFelt("0x9184e72a000")
	invokeTx := rpc.InvokeTxnV1{
		// MaxFee:        maxfee,
		MaxFee:        new(felt.Felt).SetUint64(0),
		Version:       rpc.TransactionV1,
		Nonce:         nonce,
		Type:          rpc.TransactionType_Invoke,
		SenderAddress: s.account.AccountAddress,
	}

	// Build the Calldata
	if invokeTx.Calldata, err = s.account.FmtCalldata(fnCalls); err != nil {
		panic(err.Error())
	}

	// Sign the transaction
	if err = s.account.SignInvokeTransaction(ctx, &invokeTx); err != nil {
		panic(err.Error())
	}

        // account_cairo_version = 2 
        // 1.my account Class Version is actually Cairo 2 ; output err: Invalid params 
        // 2.my account Class Version is actually Cairo 0 ; success
	fees, err := s.account.EstimateFee(ctx, []rpc.BroadcastTxn{invokeTx}, []rpc.SimulationFlag{}, latestBlock)
	if err != nil {
		panic(err.Error())  //output err: Invalid params  (when Class Version = Cairo 2)
	}

@thiagodeev thiagodeev removed this from the v0.7.0 milestone Oct 2, 2024
@thiagodeev thiagodeev moved this from 🔖 To do to 📋 Backlog in [Nubia] Starknet.go Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋 Backlog
Development

No branches or pull requests

3 participants