/home/runner/actions-runner/_work/fuel-vm/fuel-vm/fuel-tx/src/lib.rs
| Line | Count | Source (jump to first uncovered line) | 
| 1 |  | #![cfg_attr(not(feature = "std"), no_std)] | 
| 2 |  | #![allow(clippy::too_many_arguments)] | 
| 3 |  | #![allow(clippy::try_err)] | 
| 4 |  | // Wrong clippy convention; check | 
| 5 |  | // https://rust-lang.github.io/api-guidelines/naming.html | 
| 6 |  | #![allow(clippy::wrong_self_convention)] | 
| 7 |  | #![deny( | 
| 8 |  |     clippy::arithmetic_side_effects, | 
| 9 |  |     clippy::cast_sign_loss, | 
| 10 |  |     clippy::cast_possible_truncation, | 
| 11 |  |     clippy::cast_possible_wrap, | 
| 12 |  |     clippy::string_slice | 
| 13 |  | )] | 
| 14 |  | #![deny(unused_crate_dependencies)] | 
| 15 |  | #![deny(unsafe_code)] | 
| 16 |  |  | 
| 17 |  | // TODO: Add docs | 
| 18 |  |  | 
| 19 |  | #[cfg(feature = "alloc")] | 
| 20 |  | extern crate alloc; | 
| 21 |  | extern crate core; | 
| 22 |  |  | 
| 23 |  | pub mod consts; | 
| 24 |  | mod tx_pointer; | 
| 25 |  |  | 
| 26 |  | pub use fuel_asm::{ | 
| 27 |  |     PanicInstruction, | 
| 28 |  |     PanicReason, | 
| 29 |  | }; | 
| 30 |  | pub use fuel_types::{ | 
| 31 |  |     Address, | 
| 32 |  |     AssetId, | 
| 33 |  |     BlobId, | 
| 34 |  |     Bytes32, | 
| 35 |  |     Bytes4, | 
| 36 |  |     Bytes64, | 
| 37 |  |     Bytes8, | 
| 38 |  |     ContractId, | 
| 39 |  |     MessageId, | 
| 40 |  |     Salt, | 
| 41 |  |     Word, | 
| 42 |  | }; | 
| 43 |  | pub use tx_pointer::TxPointer; | 
| 44 |  |  | 
| 45 |  | #[cfg(feature = "test-helpers")] | 
| 46 |  | mod builder; | 
| 47 |  |  | 
| 48 |  | #[cfg(feature = "alloc")] | 
| 49 |  | mod contract; | 
| 50 |  |  | 
| 51 |  | #[cfg(feature = "alloc")] | 
| 52 |  | mod receipt; | 
| 53 |  |  | 
| 54 |  | #[cfg(feature = "alloc")] | 
| 55 |  | mod transaction; | 
| 56 |  |  | 
| 57 |  | #[cfg(test)] | 
| 58 |  | mod tests; | 
| 59 |  |  | 
| 60 |  | #[cfg(feature = "test-helpers")] | 
| 61 |  | pub mod test_helper; | 
| 62 |  |  | 
| 63 |  | #[cfg(feature = "test-helpers")] | 
| 64 |  | pub use builder::{ | 
| 65 |  |     Buildable, | 
| 66 |  |     Finalizable, | 
| 67 |  |     TransactionBuilder, | 
| 68 |  | }; | 
| 69 |  |  | 
| 70 |  | #[cfg(feature = "alloc")] | 
| 71 |  | pub use receipt::{ | 
| 72 |  |     Receipt, | 
| 73 |  |     ScriptExecutionResult, | 
| 74 |  | }; | 
| 75 |  |  | 
| 76 |  | #[cfg(feature = "alloc")] | 
| 77 |  | pub use transaction::{ | 
| 78 |  |     consensus_parameters, | 
| 79 |  |     field, | 
| 80 |  |     input, | 
| 81 |  |     input::Input, | 
| 82 |  |     input::InputRepr, | 
| 83 |  |     output, | 
| 84 |  |     output::Output, | 
| 85 |  |     output::OutputRepr, | 
| 86 |  |     policies, | 
| 87 |  |     Blob, | 
| 88 |  |     BlobBody, | 
| 89 |  |     BlobIdExt, | 
| 90 |  |     BlobMetadata, | 
| 91 |  |     Cacheable, | 
| 92 |  |     Chargeable, | 
| 93 |  |     ChargeableMetadata, | 
| 94 |  |     ChargeableTransaction, | 
| 95 |  |     ConsensusParameters, | 
| 96 |  |     ContractParameters, | 
| 97 |  |     Create, | 
| 98 |  |     CreateMetadata, | 
| 99 |  |     DependentCost, | 
| 100 |  |     Executable, | 
| 101 |  |     FeeParameters, | 
| 102 |  |     FormatValidityChecks, | 
| 103 |  |     GasCosts, | 
| 104 |  |     GasCostsValues, | 
| 105 |  |     Mint, | 
| 106 |  |     PredicateParameters, | 
| 107 |  |     Script, | 
| 108 |  |     ScriptParameters, | 
| 109 |  |     StorageSlot, | 
| 110 |  |     Transaction, | 
| 111 |  |     TransactionFee, | 
| 112 |  |     TransactionRepr, | 
| 113 |  |     TxId, | 
| 114 |  |     TxParameters, | 
| 115 |  |     Upgrade, | 
| 116 |  |     UpgradeBody, | 
| 117 |  |     UpgradeMetadata, | 
| 118 |  |     UpgradePurpose, | 
| 119 |  |     Upload, | 
| 120 |  |     UploadBody, | 
| 121 |  |     UploadMetadata, | 
| 122 |  |     UploadSubsection, | 
| 123 |  |     UtxoId, | 
| 124 |  |     ValidityError, | 
| 125 |  |     Witness, | 
| 126 |  | }; | 
| 127 |  |  | 
| 128 |  | pub use transaction::{ | 
| 129 |  |     PrepareSign, | 
| 130 |  |     Signable, | 
| 131 |  |     UniqueIdentifier, | 
| 132 |  | }; | 
| 133 |  |  | 
| 134 |  | #[cfg(feature = "alloc")] | 
| 135 |  | pub use contract::Contract; | 
| 136 |  |  | 
| 137 |  | /// Trait extends the functionality of the `ContractId` type. | 
| 138 |  | pub trait ContractIdExt { | 
| 139 |  |     /// Creates an `AssetId` from the `ContractId` and `sub_id`. | 
| 140 |  |     fn asset_id(&self, sub_id: &Bytes32) -> AssetId; | 
| 141 |  |  | 
| 142 |  |     /// Creates an `AssetId` from the `ContractId` and the default 0x00..000 `sub_id`. | 
| 143 |  |     fn default_asset(&self) -> AssetId; | 
| 144 |  | } | 
| 145 |  |  | 
| 146 |  | impl ContractIdExt for ContractId { | 
| 147 | 85 |     fn asset_id(&self, sub_id: &Bytes32) -> AssetId { | 
| 148 | 85 |         let hasher = fuel_crypto::Hasher::default(); | 
| 149 | 85 |         AssetId::new( | 
| 150 | 85 |             *hasher | 
| 151 | 85 |                 .chain(self.as_slice()) | 
| 152 | 85 |                 .chain(sub_id.as_slice()) | 
| 153 | 85 |                 .finalize(), | 
| 154 | 85 |         ) | 
| 155 | 85 |     } | 
| 156 |  |  | 
| 157 | 0 |     fn default_asset(&self) -> AssetId { | 
| 158 | 0 |         self.asset_id(&Bytes32::zeroed()) | 
| 159 | 0 |     } | 
| 160 |  | } |