|
Ether Binder
Set of utilities for interacting with Ethereum and it's smart contracts with PHP, with generating ABI bindings and Ethereum-related types
|
Static Public Member Functions | |
| static | decodeHex (string $rlp) |
| static | decodeBin (string $rlp) |
| static | fromHex (string $hex) |
| static | fromBin (string $bin) |
| static | fromRPCArr (array $rpcArr) |
Protected Member Functions | |
| internalEncodeBin (bool $signing, ?int $signingChainID) | |
| blanksFromRPCArr (array $rpcArr) | |
| setInnerFromRLPValues (array $rlpValues) | |
| setGasPriceOrBaseFee (OOGmp $fee) | |
Protected Attributes | |
| array | $accessList = [] |
| OOGmp | $gasFeeTip |
| bool | $signed = false |
| int | $nonce = 0 |
| int | $gas = 0 |
| OOGmp | $gasPrice |
| OOGmp | $value |
| Address | $to = null |
| string | $dataBin = "" |
| OOGmp | $v |
| OOGmp | $r |
| OOGmp | $s |
| int | $chainId = null |
LondonTransaction handles Ethereum transactions post EIP-1559.
| M8B\EtherBinder\Common\LondonTransaction::__construct | ( | ) |
Reimplemented from M8B\EtherBinder\Common\Transaction.
| M8B\EtherBinder\Common\LondonTransaction::accessList | ( | ) |
Returns the transaction's access list.
|
protected |
Reimplemented from M8B\EtherBinder\Common\Transaction.
Reimplemented in M8B\EtherBinder\Common\CancunTransaction.
| M8B\EtherBinder\Common\LondonTransaction::calculateV | ( | OOGmp | $recovery | ) |
in typed transactions, the chainID is part of transaction data, and V is "vanilla" ECDSA signature recovery param, without any alteration. See https://eips.ethereum.org/EIPS/eip-2930 @inheritDoc
Reimplemented from M8B\EtherBinder\Common\Transaction.
| M8B\EtherBinder\Common\LondonTransaction::chainId | ( | ) |
Returns the chain ID for the transaction.
|
inherited |
Gets the binary data payload of the transaction.
|
inherited |
Gets the transaction data in hex format.
|
staticinherited |
Decodes a binary RLP-encoded transaction. Accepts both legacy formatting and typed transaction.
| string | $rlp | The RLP-encoded transaction as a binary string. |
| BadAddressChecksumException | |
| EthBinderLogicException | |
| EthBinderRuntimeException | |
| InvalidHexException | |
| InvalidHexLengthException | |
| NotSupportedException |
|
staticinherited |
Decodes a hexadecimal RLP-encoded transaction. Accepts both legacy formatting and typed transaction.
| string | $rlp | The RLP-encoded transaction as a hexadecimal string. |
| BadAddressChecksumException | |
| EthBinderLogicException | |
| EthBinderRuntimeException | |
| InvalidHexException | |
| InvalidHexLengthException | |
| NotSupportedException |
|
inherited |
Gets the address where the contract will be deployed if it's deploy transaction. If it is not deploy transaction, it will return null address - Address::NULL()
| EthBinderLogicException | |
| InvalidLengthException |
| M8B\EtherBinder\Common\LondonTransaction::ecRecover | ( | ) |
Recovers the address of the signer from the signature. Returns null address if is not signed.
| EthBinderRuntimeException | |
| EthBinderLogicException | |
| InvalidLengthException |
Reimplemented from M8B\EtherBinder\Common\Transaction.
| M8B\EtherBinder\Common\LondonTransaction::encodeBin | ( | ) |
RLP-encodes the transaction into binary format.
| EthBinderArgumentException |
Reimplemented from M8B\EtherBinder\Common\Transaction.
| M8B\EtherBinder\Common\LondonTransaction::encodeBinForSigning | ( | ?int | $chainId | ) |
Encodes the transaction for signing with optional chain ID (which differs from encoding for storage or transfer. Difference is for example missing fields).
| int | null | $chainId | The chain ID to use for signing. If null, the transaction's current chain ID will be used. |
| EthBinderArgumentException |
Reimplemented from M8B\EtherBinder\Common\Transaction.
|
inherited |
Encodes the transaction into a hexadecimal string.
| EthBinderArgumentException |
|
inherited |
Encodes the transaction into a hexadecimal string for signing purposes (which differs from encoding for storage or transfer. Difference is for example missing fields).
| ?int | $chainId | The chain ID for the transaction. |
| EthBinderArgumentException |
|
staticinherited |
Alias function for decodeBin()
| string | $bin |
| BadAddressChecksumException | |
| EthBinderLogicException | |
| EthBinderRuntimeException | |
| InvalidHexException | |
| InvalidHexLengthException | |
| NotSupportedException |
Implements M8B\EtherBinder\Common\BinarySerializableInterface.
|
staticinherited |
Alias function for decodeHex()
| string | $hex |
| BadAddressChecksumException | |
| EthBinderLogicException | |
| EthBinderRuntimeException | |
| InvalidHexException | |
| InvalidHexLengthException | |
| NotSupportedException |
Implements M8B\EtherBinder\Common\BinarySerializableInterface.
|
staticinherited |
Creates a transaction from an RPC array.
| array | $rpcArr | The array containing transaction details from RPC. |
| BadAddressChecksumException | |
| NotSupportedException | |
| InvalidHexLengthException | |
| EthBinderLogicException | |
| InvalidHexException | |
| HexBlobNotEvenException |
|
inherited |
Gets the gas limit of the transaction.
| M8B\EtherBinder\Common\LondonTransaction::getBaseFeeCap | ( | ) |
Returns the base fee cap.
| M8B\EtherBinder\Common\LondonTransaction::getGasFeeTip | ( | ) |
Gets the gas fee tip.
|
inherited |
Calculates the hash used for signing the transaction.
| int | null | $chainId | Optional chain ID. |
| InvalidLengthException | |
| EthBinderLogicException |
|
inherited |
Calculates the transaction hash.
| EthBinderLogicException |
|
protected |
| EthBinderArgumentException |
Reimplemented in M8B\EtherBinder\Common\CancunTransaction.
|
inherited |
Checks if the transaction is signed.
|
inherited |
Gets the nonce of the transaction.
|
inherited |
Convenience function that fetches nonce from RPC and places it into transaction. If new nonce mismatches currently set nonce, it invalidates signature.
| Address | $from | Address of which to set next nonce. |
| AbstractRPC | $rpc | RPC to query transaction count from. |
| EthBinderRuntimeException | |
| RPCGeneralException | |
| RPCInvalidResponseParamException | |
| RPCNotFoundException |
|
inherited |
Gets the ECDSA 'r' value of the signature.
|
inherited |
Gets the ECDSA 's' value of the signature.
| M8B\EtherBinder\Common\LondonTransaction::setAccessList | ( | array | $accessList | ) |
Sets the access list for the transaction. This invalidates signature if data differs from existing data.
| array | $accessList | The new access list. |
| M8B\EtherBinder\Common\LondonTransaction::setBaseFeeCap | ( | OOGmp | $fee | ) |
Sets the base fee cap for the transaction. This invalidates signature if data differs from existing data.
| OOGmp | $fee | The new base fee cap. |
| M8B\EtherBinder\Common\LondonTransaction::setChainId | ( | int | $chainId | ) |
Sets the chain ID for the transaction. This invalidates signature if data differs from existing data.
| int | $chainId | The new chain ID. |
|
inherited |
Sets the data payload for the transaction using binary blob. This invalidates signature if data differs from existing data.
| string | $dataBin | The binary data. |
|
inherited |
Sets the data for the transaction using a hex string. This invalidates signature if data differs from existing data.
| string | $dataHex | Data in hex format. |
| HexBlobNotEvenException | |
| InvalidHexException |
| M8B\EtherBinder\Common\LondonTransaction::setGasFeeTip | ( | OOGmp | $gasFeeTip | ) |
Sets the gas fee tip for the transaction. This invalidates signature if data differs from existing data.
| OOGmp | $gasFeeTip | The new gas fee tip. |
|
inherited |
Sets the gas limit for the transaction. This invalidates signature if data differs from existing data.
| int | $gasLimit | The gas limit value. |
|
protected |
| BadAddressChecksumException | |
| EthBinderLogicException | |
| InvalidHexLengthException | |
| InvalidHexException | |
| HexBlobNotEvenException |
Reimplemented from M8B\EtherBinder\Common\Transaction.
Reimplemented in M8B\EtherBinder\Common\CancunTransaction.
|
inherited |
Sets the nonce for the transaction. This invalidates signature if data differs from existing data.
| int | $nonce | The nonce value. |
|
inherited |
Sets the signature. Note that there is no guarantee the signature will work correctly. This is for advanced use only. Ensure to properly account for EIP 155 in signature's V.
|
inherited |
Sets the recipient address for the transaction. If it's null, the transaction is contract deploy transaction. This invalidates signature if data differs from existing data.
| Address | null | $address | The Address object or null. If null, the transaction is contract deploy |
|
inherited |
Sets the value for the transaction. This invalidates signature if data differs from existing data.
| OOGmp | $valueWEI | The value in Wei. |
|
inherited |
Sets the value for the transaction using WeiFormatter. Accepts "human" input. This invalidates signature if data differs from existing data.
| float | int | string | OOGmp | $human | |
| int | string | EtherFormats | $format |
|
inherited |
Signs the transaction.
| Key | $key | Private key for signing. |
| int | null | $chainId | Optional chain ID. |
| InvalidLengthException | |
| EthBinderLogicException |
|
inherited |
Gets the signature in wrapper object.
|
inherited |
Gets the recipient address of the transaction, null if it's deploy transaction.
|
inherited |
Alias function for encodeBin()
| EthBinderArgumentException |
Implements M8B\EtherBinder\Common\BinarySerializableInterface.
|
inherited |
Alias function for encodeHex()
| EthBinderArgumentException |
Implements M8B\EtherBinder\Common\BinarySerializableInterface.
| M8B\EtherBinder\Common\LondonTransaction::totalGasPrice | ( | ) |
Calculates the total gas price for the transaction of both tip and base fee.
Reimplemented from M8B\EtherBinder\Common\Transaction.
| M8B\EtherBinder\Common\LondonTransaction::transactionType | ( | ) |
Returns the transaction type enum.
Reimplemented from M8B\EtherBinder\Common\Transaction.
Reimplemented in M8B\EtherBinder\Common\CancunTransaction.
|
inherited |
Estimates gas and fee values using from RPC, trying to use conservative values. This invalidates signature if data differs from existing data
| AbstractRPC | $rpc | The RPC client. |
| Address | $from | The sender address. |
| RPCGeneralException | |
| RPCNotFoundException | |
| RPCInvalidResponseParamException | |
| EthBinderLogicException | |
| EthBinderRuntimeException |
| M8B\EtherBinder\Common\LondonTransaction::useRpcEstimatesWithBump | ( | AbstractRPC | $rpc, |
| ?Address | $from, | ||
| int | $bumpGasPercentage, | ||
| int | $bumpFeePercentage ) |
Updates the transaction gas and fee estimates using RPC, with added N percent "bump". Note that percentage is added, so if 120% of minimal value is required, param should be 20, not 120. This invalidates signature if data differs from existing data.
| AbstractRPC | $rpc | The RPC client. |
| Address | null | $from | The sender's address. |
| int | $bumpGasPercentage | Increase in gas limit as a percentage. |
| int | $bumpFeePercentage | Increase in fee as a percentage. |
| EthBinderLogicException | |
| RPCInvalidResponseParamException | |
| RPCGeneralException | |
| RPCNotFoundException | |
| EthBinderRuntimeException |
Reimplemented from M8B\EtherBinder\Common\Transaction.
|
inherited |
Gets the ECDSA 'v' value of the signature.
|
inherited |
Gets the value of the transaction.
|
inherited |
Gets the value of the transaction and formats it with WeiFormatter, proxying params to it.
| int | $finalDecimals | Number of decimals for formatting. |
| int | string | EtherFormats | $format | Ether format. |