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 | |
OOGmp | $maxFeePerBlobGas |
array | $blobVersionedHashes |
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 |
DencunTransaction is transaction type 3, enabled in Proto-DankSharding ethereum upgrade, defined by EIP 4844
Note that support is only partial, Ether Binder does not interact with consensus layer at all, so transmitting or fetching blobs isn't part of binder.
M8B\EtherBinder\Common\CancunTransaction::__construct | ( | ) |
Reimplemented from M8B\EtherBinder\Common\LondonTransaction.
|
inherited |
Returns the transaction's access list.
M8B\EtherBinder\Common\CancunTransaction::addVersionedHash | ( | Hash | $hash | ) |
Adds a versioned hash to the blobVersionedHashes array.
Hash | $hash | The versioned hash to add. |
|
protected |
InvalidHexException | |
InvalidHexLengthException |
Reimplemented from M8B\EtherBinder\Common\LondonTransaction.
|
inherited |
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.
|
inherited |
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 |
|
inherited |
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.
|
inherited |
RLP-encodes the transaction into binary format.
EthBinderArgumentException |
Reimplemented from M8B\EtherBinder\Common\Transaction.
|
inherited |
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.
|
inherited |
Returns the base fee cap.
|
inherited |
Gets the gas fee tip.
M8B\EtherBinder\Common\CancunTransaction::getMaxFeePerBlobGas | ( | ) |
Returns the maximum fee per blob gas.
|
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 from M8B\EtherBinder\Common\LondonTransaction.
|
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.
|
inherited |
Sets the access list for the transaction. This invalidates signature if data differs from existing data.
array | $accessList | The new access list. |
|
inherited |
Sets the base fee cap for the transaction. This invalidates signature if data differs from existing data.
OOGmp | $fee | The new base fee cap. |
|
inherited |
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 |
|
inherited |
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\LondonTransaction.
M8B\EtherBinder\Common\CancunTransaction::setMaxFeePerBlobGas | ( | OOGmp | $maxFeePerBlobGas | ) |
Sets the maximum fee per blob gas. Note that this value is not serviced by estimations.
OOGmp | $maxFeePerBlobGas | The maximum fee per blob gas to set. |
|
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.
|
inherited |
Calculates the total gas price for the transaction of both tip and base fee.
Reimplemented from M8B\EtherBinder\Common\Transaction.
M8B\EtherBinder\Common\CancunTransaction::transactionType | ( | ) |
Returns the transaction type enum.
Reimplemented from M8B\EtherBinder\Common\LondonTransaction.
|
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 |
|
inherited |
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. |
M8B\EtherBinder\Common\CancunTransaction::versionedHashes | ( | ) |
Returns an array of versioned hashes.