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

Errors in BatchTransaction #31

Closed
sdaveas opened this issue Apr 16, 2024 · 1 comment
Closed

Errors in BatchTransaction #31

sdaveas opened this issue Apr 16, 2024 · 1 comment

Comments

@sdaveas
Copy link
Contributor

sdaveas commented Apr 16, 2024

Hello team! I am trying to make a BatchTransaction call, but I am getting some errors.

Here's how I do a MoveCall which works fine:

func MoveCall(
   ctx context.Context,
   sender types.Address,
) (*types.TransactionBytes, error) {
   client, err := client.Dial(types.TestnetRpcUrl)
   if err != nil {
   	return nil, err
   }

   packageIDHex, err := types.NewHexData("0xd8f042479dcb0028d868051bd53f0d3a41c600db7b14241674db1c2e60124975")
   if err != nil {
   	return nil, err
   }

   txBytes, err := client.MoveCall(
   	ctx, 
   	sender, 
   	*packageIDHex, 
   	"math", 
   	"add", 
   	[]string{},
   	[]interface{}{"1", "1"},
   	nil, 
   	types.NewSafeSuiBigInt(uint64(2000000)),
   )

   if err != nil {
   	return nil, err
   }

   return txBytes, nil
}

However, when trying to do the same for a BatchTransaction, I am getting

Error: invalid type: integer `2000000`, expected a string at line 1 column 7

Here's my code invoking BatchTransaction:

func MoveCallBatch(
	ctx context.Context,
	sender types.Address,
) (*types.TransactionBytes, error) {
	client, err := client.Dial(types.TestnetRpcUrl)
	if err != nil {
		return nil, err
	}
	
	txnParams := []map[string]interface{}{
		{
			"moveCallRequestParams": []interface{}{
				"0xd8f042479dcb0028d868051bd53f0d3a41c600db7b14241674db1c2e60124975",
				"math",
				"add",
				[]string{},
				[]interface{}{"1", "1"},
			},
		},
	}

	txBytes, err := client.BatchTransaction(ctx, sender, txnParams, nil, uint64(2000000))
	if err != nil {
		return nil, err
	}

	return txBytes, nil
}

Any help would be appreciated!

@sdaveas sdaveas changed the title BatchTransaction Errors in BatchTransaction Apr 16, 2024
@sdaveas
Copy link
Contributor Author

sdaveas commented Jul 22, 2024

ended up just using programmable transactions from v2.

@sdaveas sdaveas closed this as completed Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant