Skip to main content

OKTransaction

The OKTransaction represents a single step within a OKInteraction. It encapsulates all the details and state necessary to execute and monitor a transaction.

Instance: One per step in an interaction

Features:

  • Manages user inputs data required for the transaction
  • Manages the state of the transaction, including submission status and responses
  • Manages state related to the contract's transactions (after submission)
  • Captures logs and events emitted during transaction mining.

Methods

sendTX

sendTX submits the transaction on-chain returns block hash

<button
onClick={() => (chainOK ? current?.sendTX() : current?.switchChain())}
type="button"
disabled={
!current || !canSendTX || isSending || receipt !== undefined
}
>
{chain && !chainOK
? `Switch to ${chain?.name}`
: isSending
? "Please wait..."
: buttonLabel}
</button>

setValue

setValue sets the $value cell containing the transaction value v any float or integer number, without decimals conversion, or exact bigint. For example, tx.setValue(0.001)

<input onChange={(event) => setValue(() => +event.target.value)} value={value}
disabled={isSending} type="number" />

Properties

NameTypeDescription
$valueValueCell<Rational>Represents a rational value.
functionAnyCell<AbiFunction>Holds the ABI function details.
chainOKAnyCell<boolean>Checks if the target method is on the correct chain.
dcContractAnyCell<SmartContract \| null>Holds the smart contract details or null.
dcTokenAnyCell<EVMToken \| null>Holds the EVM token details or null.
okContractOKContractRepresents the OKContract instance.
contractChainAnyCell<ChainType>Represents the contract's blockchain network type.
chainAnyCell<Chain>Represents the blockchain network.
abiAnyCell<ABI>Contains the ABI (Application Binary Interface).
abixAnyCell<ABIExtra>Contains additional ABI information.
inputEnvEnvironmentBasic environment data.
schemaAnyCell<TypeScheme>Schema of the transaction.
dataAnyCell<Environment>Transaction data derived from schema values.
editorAnyCell<DataEditor>Data editor instance.
envMapCell<Environment, false>OKTransaction environment.
missingInputsMapCell<string[], false>Missing input fields.
orgMapCell<string, false>Organization details.
btnLabelMapCell<string, false>Label for a button.
titleMapCell<unknown[], false>Title information.
infoMapCell<unknown[], false>Additional information.
infoLineMapCell<string, false>Single line of information.
buttonMapCell<Value<string>[], false>Button configurations.
imageMapCell<unknown, boolean>Image details.
allowancesMapCell<[string, Value<unknown>][], boolean>Token allowances.
txInputsMapCell<AnyCell<unknown>[], false>Transaction input values.
inputsOKMapCell<boolean, false>Check if input values are valid.
isPreOkMapCell<boolean, false>Check if preconditions are met.
canSendTXMapCell<boolean, false>Check if the transaction can be sent.
skipAnyCell<boolean>Check if the transaction can be skipped.
encodedDataMapCell<'0x${string}', false>Encoded transaction data.
txMapCell<{ tx: TXRequest; gas_amount: bigint }, false>The transaction to be sent.
readOutputMapCell<Record<number, AnyCell<unknown>>, false>Output of the readonly method.
sentTxValueCell<SentTransaction[]>The sent transaction details.
receiptAnyCell<TransactionReceipt>Transaction receipt.
receiptsValueCell<TransactionReceipt[]>List of transaction receipts.
rawLogsAnyCell<AnyCell<Log>[]>Raw logs from the transaction receipt.
$logsAnyCell<AnyCell<AnalyzedLog>[]>Analyzed logs from the transaction.
prettyLogsAnyCell<unknown[]>Prettified transaction logs.
isSendingValueCell<boolean>Indicates if the transaction is being processed.
isDoneValueCell<boolean>Indicates if the transaction has been processed.
decimalsAnyCell<Rational>Decimal value representation.
tokenPriceDataAnyCell<TokenMarketData>Market data for the token.
currencyAnyCell<EVMToken>EVM token details.