mnft.ensureMachineNftAllowance(EnsureMachineNftAllowance)
Ensure the ERC20 allowance for the Machine NFT registration account is sufficient to cover the registration fee for N machines of a given value. If the allowance is insufficient, it submits an approval transaction.
EnsureMachineNftAllowance Type Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| machineController | Signer | Required | Signer that will pay the ERC20 fee. Must be connected to a provider. |
| machineNft | string | Required | Machine NFT contract address. |
| machineValueHuman | string | Required | Machine value in human-readable units (e.g., "10"). |
| erc20 | string | Required | ERC20 token address used to pay the fee. |
| tokenDecimals | number | Required | ERC20 token decimals. |
| machineCount | number | Required | Number of machines to register. |
Returns
| Field | Type | Description |
|---|---|---|
| status | approved or already_sufficient | Whether an approval was sent. |
| machineNft | string | Machine NFT contract address. |
| feeToken | string | ERC20 token address used for fees. |
| feePerMachine | bigint | Fee per machine in token units. |
| requiredAllowance | bigint | Total allowance required for machineCount. |
| currentAllowance | bigint | Current allowance after the check/approval. |
| receipt | TransactionReceipt | Only present when status is 'approved'. |

