Skip to content

is there a way to callStatic func like in ethers js? #26254

Closed
@jonathantyar

Description

@jonathantyar

just try out go-ethereum its worked great so far. but had problem when trying to call static func like in ether js. using transactionOpt to not send the transaction. the command is worked, but abigen only return transacction and error where it should send another value. How to get the value i need on these transaction.

this is how i call to contract func, with nosend and signer params

	trx, err := client.Collect(&bind.TransactOpts{
		Signer: func(addr common.Address, trx *types.Transaction) (*types.Transaction, error) {
			return trx, nil
		},
		NoSend: true,
	}, cex.INonfungiblePositionManagerCollectParams{
		TokenId:    big.NewInt(tokenId),
		Recipient:  address.Address(),
		Amount0Max: bigTotal,
		Amount1Max: bigTotal,
	})

this is generated code from abigen, it shows comment that a func should return 3 values, but instead abigen generated just 2 values


// Collect is a paid mutator transaction binding the contract method 0xfc6f7865.
//
// Solidity: function collect((uint256,address,uint128,uint128) params) payable returns(uint256 amount0, uint256 amount1)
func (_UNISWAPv3 *UNISWAPv3Transactor) Collect(opts *bind.TransactOpts, params INonfungiblePositionManagerCollectParams) (*types.Transaction, error) {
	return _UNISWAPv3.contract.Transact(opts, "collect", params)
}

// Collect is a paid mutator transaction binding the contract method 0xfc6f7865.
//
// Solidity: function collect((uint256,address,uint128,uint128) params) payable returns(uint256 amount0, uint256 amount1)
func (_UNISWAPv3 *UNISWAPv3Session) Collect(params INonfungiblePositionManagerCollectParams) (*types.Transaction, error) {
	return _UNISWAPv3.Contract.Collect(&_UNISWAPv3.TransactOpts, params)
}

// Collect is a paid mutator transaction binding the contract method 0xfc6f7865.
//
// Solidity: function collect((uint256,address,uint128,uint128) params) payable returns(uint256 amount0, uint256 amount1)
func (_UNISWAPv3 *UNISWAPv3TransactorSession) Collect(params INonfungiblePositionManagerCollectParams) (*types.Transaction, error) {
	return _UNISWAPv3.Contract.Collect(&_UNISWAPv3.TransactOpts, params)
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions