diff --git a/packages/fuel-indexer-lib/src/constants.rs b/packages/fuel-indexer-lib/src/constants.rs index c874f9501..fb675d5b5 100644 --- a/packages/fuel-indexer-lib/src/constants.rs +++ b/packages/fuel-indexer-lib/src/constants.rs @@ -214,8 +214,12 @@ lazy_static! { /// Generic Sway ABI types. pub static ref IGNORED_GENERIC_METADATA: HashSet<&'static str> = HashSet::from([ "generic T", + "generic E", "raw untyped ptr", "struct RawVec", + "struct RawBytes", + "struct Bytes", + "enum Result" ]); pub static ref GENERIC_STRUCTS: HashSet<&'static str> = HashSet::from([ diff --git a/packages/fuel-indexer-macros/src/helpers.rs b/packages/fuel-indexer-macros/src/helpers.rs index 72734a404..cf0f502b5 100644 --- a/packages/fuel-indexer-macros/src/helpers.rs +++ b/packages/fuel-indexer-macros/src/helpers.rs @@ -95,6 +95,7 @@ pub fn is_non_decodable_type(typ: &TypeDeclaration) -> bool { is_tuple_type(typ) || is_unit_type(typ) || IGNORED_GENERIC_METADATA.contains(typ.type_field.as_str()) + || is_array_type(typ) } /// Derive Ident for decoded type @@ -1116,6 +1117,12 @@ pub fn typed_path_components( (name, tokens) } +fn is_array_type(typ: &TypeDeclaration) -> bool { + typ.type_field.starts_with('[') + && typ.type_field.ends_with(']') + && typ.type_field.contains(';') +} + /// Determine whether or not the given type name is an unsupported type. /// /// Since we allow unsupported types in the ABI JSON, this check is only diff --git a/packages/fuel-indexer-macros/src/indexer.rs b/packages/fuel-indexer-macros/src/indexer.rs index ba476c985..18b60bd25 100644 --- a/packages/fuel-indexer-macros/src/indexer.rs +++ b/packages/fuel-indexer-macros/src/indexer.rs @@ -19,6 +19,15 @@ use std::collections::{HashMap, HashSet}; use std::path::{Path, PathBuf}; use syn::{parse_macro_input, FnArg, Item, ItemMod, PatType, Type}; +fn additional_declarations() -> proc_macro2::TokenStream { + quote! { + // Miscellaneous types that can be included in ABI JSON + type b256 = [u8; 32]; + type Bytes = Vec; + type B512 = [u8; 64]; + } +} + fn process_fn_items( manifest: &Manifest, abi_path: Option, @@ -930,6 +939,8 @@ pub fn process_indexer_module(attrs: TokenStream, item: TokenStream) -> TokenStr manifest.execution_source(), ); + let decl_tokens = additional_declarations(); + let output = match manifest.execution_source() { ExecutionSource::Native => { let (handler_block, fn_items) = @@ -939,6 +950,8 @@ pub fn process_indexer_module(attrs: TokenStream, item: TokenStream) -> TokenStr quote! { + #decl_tokens + #abi_tokens #graphql_tokens @@ -956,6 +969,8 @@ pub fn process_indexer_module(attrs: TokenStream, item: TokenStream) -> TokenStr let handler_block = handler_block_wasm(handler_block); quote! { + #decl_tokens + #abi_tokens #graphql_tokens diff --git a/packages/fuel-indexer-macros/src/native.rs b/packages/fuel-indexer-macros/src/native.rs index 544dd066c..463df0b92 100644 --- a/packages/fuel-indexer-macros/src/native.rs +++ b/packages/fuel-indexer-macros/src/native.rs @@ -33,8 +33,6 @@ pub fn handler_block_native( /// indexer module, not within the scope of the entire lib module. fn native_prelude() -> proc_macro2::TokenStream { quote! { - type B256 = [u8; 32]; - static mut db: Option>> = None; use fuel_indexer_utils::plugin::types::*; @@ -60,10 +58,10 @@ pub fn native_main() -> proc_macro2::TokenStream { let config = args - .config - .as_ref() - .map(IndexerConfig::from_file) - .unwrap_or(Ok(IndexerConfig::from(args)))?; + .config + .as_ref() + .map(IndexerConfig::from_file) + .unwrap_or(Ok(IndexerConfig::from(args)))?; init_logging(&config).await?; diff --git a/packages/fuel-indexer-macros/src/wasm.rs b/packages/fuel-indexer-macros/src/wasm.rs index 95838c13b..04494a2e6 100644 --- a/packages/fuel-indexer-macros/src/wasm.rs +++ b/packages/fuel-indexer-macros/src/wasm.rs @@ -39,8 +39,6 @@ fn wasm_prelude() -> proc_macro2::TokenStream { use alloc::{format, vec, vec::Vec}; use std::str::FromStr; - type B256 = [u8; 32]; - use fuel_indexer_utils::plugin::types::*; use fuel_indexer_utils::plugin::wasm::*; use fuel_indexer_utils::plugin::{serde_json, serialize, deserialize, bincode}; diff --git a/packages/fuel-indexer-tests/scripts/copy-swap-app-abi.bash b/packages/fuel-indexer-tests/scripts/copy-swap-app-abi.bash new file mode 100644 index 000000000..92a4ee526 --- /dev/null +++ b/packages/fuel-indexer-tests/scripts/copy-swap-app-abi.bash @@ -0,0 +1,60 @@ +#!/bin/bash + +# This script copies the JSON ABI for each Sway application into the indexer's +# trybuild tests. +# +# This helps ensure that the indexers can be built with Sway projects that more +# closely resemble "real-world" contracts, as oppposed to just indexer test +# contracts. +# +# This script should be run from the repository root, and might have to be updated +# to account for the addition/removal of Sway applications. + +usage() { + echo "Usage: $0 [options] " + echo "Options:" + echo " -h, --help Show this help message and exit." + echo + echo "Arguments:" + echo " The root path of the sway-application repository." + echo +} + +swayapps_root=$1 + +if [[ "$1" == "-h" || "$1" == "--help" ]]; then + usage + exit 0 +fi + +if [[ -z "$1" || ! -d "$1" ]]; then + echo "Error: Invalid or missing directory root path." + usage + exit 1 +fi + +testdir=$(realpath $(dirname $(dirname $0))) +abidir=$testdir/trybuild/abi +echo $abidir + +paths=( + "AMM/project/contracts/AMM-contract" + "AMM/project/contracts/exchange-contract" + "DAO/project/contracts/DAO-contract" + "OTC-swap-predicate/project/predicates/swap-predicate" + "airdrop/project/contracts/asset-contract" + "airdrop/project/contracts/distributor-contract" + "multisig-wallet/project/contracts/multisig-contract" + "escrow/project/contracts/escrow-contract" + "timelock/project/contracts/timelock-contract" + "auctions/english-auction/project/contracts/auction-contract" + "name-registry/project/contracts/registry-contract" + "oracle/project/contracts/oracle-contract" +) + +for path in "${paths[@]}"; do + cd $swayapps_root/$path + forc build + cp -fv $path/out/debug/*-abi.json $abidir/ +done + diff --git a/packages/fuel-indexer-tests/tests/trybuild.rs b/packages/fuel-indexer-tests/tests/trybuild.rs index 486f7175d..2455b546e 100644 --- a/packages/fuel-indexer-tests/tests/trybuild.rs +++ b/packages/fuel-indexer-tests/tests/trybuild.rs @@ -8,6 +8,29 @@ enum TestKind { Fail, } +fn manifest_with_contract_abi(contract_name: &str) -> String { + let manifest_dir = env!("CARGO_MANIFEST_DIR"); + let project_root = + std::fs::canonicalize(std::path::Path::new(manifest_dir).join("..").join("..")) + .unwrap(); + let project_root_str = project_root.to_str().unwrap(); + let tests_root = project_root.join("packages").join("fuel-indexer-tests"); + let tests_root_str = tests_root.to_str().unwrap(); + let trybuild_root = tests_root.join("trybuild"); + let abi_root = trybuild_root.join("abi"); + let abi_root_str = abi_root.to_str().unwrap(); + format!( + r#" +namespace: test_namespace +identifier: simple_wasm_executor +abi: {abi_root_str}/{contract_name} +graphql_schema: {tests_root_str}/indexers/simple-wasm/schema/simple_wasm.graphql +contract_id: ~ +module: + wasm: {project_root_str}/target/wasm32-unknown-unknown/release/simple_wasm.wasm"# + ) +} + #[test] fn test_success_and_failure_macros() { let t = trybuild::TestCases::new(); @@ -21,6 +44,8 @@ fn test_success_and_failure_macros() { let tests_root = project_root.join("packages").join("fuel-indexer-tests"); let tests_root_str = tests_root.to_str().unwrap(); let trybuild_root = tests_root.join("trybuild"); + let abi_root = trybuild_root.join("abi"); + let abi_root_str = abi_root.to_str().unwrap(); let manifest_content = format!( r#" @@ -34,12 +59,16 @@ module: "# ); + // IMPORTANT: Even though in theory we should be able to just re-use the same filename + // since we're writing and reading to each file for each test individually, in practice, + // these tests will error out if we use the same filename for each test. + // + // So, we simply change the manifest name according to each test to avoid these flaky errors. let tests = vec![ ( "fail_if_attribute_manifest_schema_arg_is_invalid.rs", "invalid_schema_simple_wasm.yaml", TestKind::Fail, - // Using a custom manifest here format!( r#" namespace: test_namespace @@ -84,38 +113,27 @@ module: ), ( "pass_if_indexer_is_valid_single_type.rs", - "simple_wasm.yaml", + "simple_wasm_single.yaml", TestKind::Pass, manifest_content.clone(), ), ( "pass_if_indexer_is_valid_multi_type.rs", - "simple_wasm.yaml", + "simple_wasm_multi.yaml", TestKind::Pass, manifest_content.clone(), ), ( "pass_if_unsupported_types_are_used.rs", - "simple_wasm.yaml", + "simple_wasm_unsupported.yaml", TestKind::Pass, - // Using a custom manifest here manifest_content.clone(), ), ( "fail_if_abi_contains_reserved_fuel_type.rs", "invalid_abi_type_simple_wasm.yaml", TestKind::Fail, - // Using a custom manifest here - format!( - r#" - namespace: test_namespace - identifier: simple_wasm_executor - abi: {tests_root_str}/contracts/simple-wasm/out/debug/contracts-abi-reserved-name.json - graphql_schema: {tests_root_str}/indexers/simple-wasm/schema/simple_wasm.graphql - contract_id: ~ - module: - wasm: {project_root_str}/target/wasm32-unknown-unknown/release/simple_wasm.wasm"# - ), + manifest_with_contract_abi("contracts-abi-reserved-name.json"), ), ( "fail_if_ident_not_defined_in_abi.rs", @@ -135,6 +153,73 @@ module: TestKind::Fail, manifest_content.clone(), ), + ( + "pass_if_using_sway_amm_abi.rs", + "sway_amm.yaml", + TestKind::Pass, + manifest_with_contract_abi("AMM-contract-abi.json"), + ), + ( + "pass_if_using_sway_dao_abi.rs", + "sway_dao.yaml", + TestKind::Pass, + manifest_with_contract_abi("DAO-contract-abi.json"), + ), + ( + "pass_if_using_sway_asset_contract_abi.rs", + "asset_contract.yaml", + TestKind::Pass, + manifest_with_contract_abi("asset-contract-abi.json"), + ), + ( + "pass_if_using_sway_distributor_contract_abi.rs", + "distributor_contract.yaml", + TestKind::Pass, + manifest_with_contract_abi("distributor-contract-abi.json"), + ), + ( + "pass_if_using_sway_escrow_contract_abi.rs", + "escrow_contract.yaml", + TestKind::Pass, + manifest_with_contract_abi("escrow-contract-abi.json"), + ), + ( + "pass_is_using_sway_exchange_contract_abi.rs", + "exchange_contract.yaml", + TestKind::Pass, + manifest_with_contract_abi("exchange-contract-abi.json"), + ), + // NOTE: I don't think the ABI tokens are being properly generated from this contract JSON + // ( + // "pass_if_using_sway_multisig_contract_abi.rs", + // "multisig_contract.yaml", + // TestKind::Pass, + // manifest_with_contract_abi("multisig-contract-abi.json"), + // ), + ( + "pass_if_using_sway_oracle_contract_abi.rs", + "oracle_contract.yaml", + TestKind::Pass, + manifest_with_contract_abi("oracle-contract-abi.json"), + ), + ( + "pass_if_using_sway_registry_contract_abi.rs", + "registry_contract.yaml", + TestKind::Pass, + manifest_with_contract_abi("registry-contract-abi.json"), + ), + ( + "pass_if_using_swap_predicate_abi.rs", + "predicate_abi.yaml", + TestKind::Pass, + manifest_with_contract_abi("swap-predicate-abi.json"), + ), + ( + "pass_if_using_timelock_contract_abi.rs", + "timelock_contract.yaml", + TestKind::Pass, + manifest_with_contract_abi("timelock-contract-abi.json"), + ), ]; for (name, manifest_name, kind, manifest_content) in tests { diff --git a/packages/fuel-indexer-tests/trybuild/abi/AMM-contract-abi.json b/packages/fuel-indexer-tests/trybuild/abi/AMM-contract-abi.json new file mode 100644 index 000000000..fa34098e7 --- /dev/null +++ b/packages/fuel-indexer-tests/trybuild/abi/AMM-contract-abi.json @@ -0,0 +1,262 @@ +{ + "types": [ + { + "typeId": 0, + "type": "()", + "components": [], + "typeParameters": null + }, + { + "typeId": 1, + "type": "(_, _)", + "components": [ + { + "name": "__tuple_element", + "type": 6, + "typeArguments": null + }, + { + "name": "__tuple_element", + "type": 6, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 2, + "type": "b256", + "components": null, + "typeParameters": null + }, + { + "typeId": 3, + "type": "enum InitError", + "components": [ + { + "name": "BytecodeRootAlreadySet", + "type": 0, + "typeArguments": null + }, + { + "name": "BytecodeRootDoesNotMatch", + "type": 0, + "typeArguments": null + }, + { + "name": "BytecodeRootNotSet", + "type": 0, + "typeArguments": null + }, + { + "name": "PairDoesNotDefinePool", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 4, + "type": "enum Option", + "components": [ + { + "name": "None", + "type": 0, + "typeArguments": null + }, + { + "name": "Some", + "type": 5, + "typeArguments": null + } + ], + "typeParameters": [ + 5 + ] + }, + { + "typeId": 5, + "type": "generic T", + "components": null, + "typeParameters": null + }, + { + "typeId": 6, + "type": "struct ContractId", + "components": [ + { + "name": "value", + "type": 2, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 7, + "type": "struct RegisterPoolEvent", + "components": [ + { + "name": "asset_pair", + "type": 1, + "typeArguments": null + }, + { + "name": "pool", + "type": 6, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 8, + "type": "struct SetExchangeBytecodeRootEvent", + "components": [ + { + "name": "root", + "type": 2, + "typeArguments": null + } + ], + "typeParameters": null + } + ], + "functions": [ + { + "inputs": [ + { + "name": "asset_pair", + "type": 1, + "typeArguments": null + }, + { + "name": "pool", + "type": 6, + "typeArguments": null + } + ], + "name": "add_pool", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "exchange_bytecode_root", + "type": 6, + "typeArguments": null + } + ], + "name": "initialize", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "asset_pair", + "type": 1, + "typeArguments": null + } + ], + "name": "pool", + "output": { + "name": "", + "type": 4, + "typeArguments": [ + { + "name": "", + "type": 6, + "typeArguments": null + } + ] + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + } + ], + "loggedTypes": [ + { + "logId": 0, + "loggedType": { + "name": "", + "type": 3, + "typeArguments": [] + } + }, + { + "logId": 1, + "loggedType": { + "name": "", + "type": 3, + "typeArguments": [] + } + }, + { + "logId": 2, + "loggedType": { + "name": "", + "type": 3, + "typeArguments": [] + } + }, + { + "logId": 3, + "loggedType": { + "name": "", + "type": 7, + "typeArguments": [] + } + }, + { + "logId": 4, + "loggedType": { + "name": "", + "type": 3, + "typeArguments": [] + } + }, + { + "logId": 5, + "loggedType": { + "name": "", + "type": 8, + "typeArguments": [] + } + } + ], + "messagesTypes": [], + "configurables": [] +} \ No newline at end of file diff --git a/packages/fuel-indexer-tests/trybuild/abi/DAO-contract-abi.json b/packages/fuel-indexer-tests/trybuild/abi/DAO-contract-abi.json new file mode 100644 index 000000000..6daa57505 --- /dev/null +++ b/packages/fuel-indexer-tests/trybuild/abi/DAO-contract-abi.json @@ -0,0 +1,945 @@ +{ + "types": [ + { + "typeId": 0, + "type": "()", + "components": [], + "typeParameters": null + }, + { + "typeId": 1, + "type": "b256", + "components": null, + "typeParameters": null + }, + { + "typeId": 2, + "type": "bool", + "components": null, + "typeParameters": null + }, + { + "typeId": 3, + "type": "enum CreationError", + "components": [ + { + "name": "DurationCannotBeZero", + "type": 0, + "typeArguments": null + }, + { + "name": "InvalidAcceptancePercentage", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 4, + "type": "enum Identity", + "components": [ + { + "name": "Address", + "type": 8, + "typeArguments": null + }, + { + "name": "ContractId", + "type": 10, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 5, + "type": "enum InitializationError", + "components": [ + { + "name": "CannotReinitialize", + "type": 0, + "typeArguments": null + }, + { + "name": "ContractNotInitialized", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 6, + "type": "enum ProposalError", + "components": [ + { + "name": "InsufficientApprovals", + "type": 0, + "typeArguments": null + }, + { + "name": "ProposalExecuted", + "type": 0, + "typeArguments": null + }, + { + "name": "ProposalExpired", + "type": 0, + "typeArguments": null + }, + { + "name": "ProposalStillActive", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 7, + "type": "enum UserError", + "components": [ + { + "name": "AmountCannotBeZero", + "type": 0, + "typeArguments": null + }, + { + "name": "IncorrectAssetSent", + "type": 0, + "typeArguments": null + }, + { + "name": "InsufficientBalance", + "type": 0, + "typeArguments": null + }, + { + "name": "InvalidId", + "type": 0, + "typeArguments": null + }, + { + "name": "VoteAmountCannotBeZero", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 8, + "type": "struct Address", + "components": [ + { + "name": "value", + "type": 1, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 9, + "type": "struct CallData", + "components": [ + { + "name": "arguments", + "type": 21, + "typeArguments": null + }, + { + "name": "function_selector", + "type": 21, + "typeArguments": null + }, + { + "name": "id", + "type": 10, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 10, + "type": "struct ContractId", + "components": [ + { + "name": "value", + "type": 1, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 11, + "type": "struct CreateProposalEvent", + "components": [ + { + "name": "id", + "type": 21, + "typeArguments": null + }, + { + "name": "proposal_info", + "type": 16, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 12, + "type": "struct DepositEvent", + "components": [ + { + "name": "amount", + "type": 21, + "typeArguments": null + }, + { + "name": "user", + "type": 4, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 13, + "type": "struct ExecuteEvent", + "components": [ + { + "name": "acceptance_percentage", + "type": 21, + "typeArguments": null + }, + { + "name": "id", + "type": 21, + "typeArguments": null + }, + { + "name": "user", + "type": 4, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 14, + "type": "struct InitializeEvent", + "components": [ + { + "name": "author", + "type": 4, + "typeArguments": null + }, + { + "name": "token", + "type": 10, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 15, + "type": "struct Proposal", + "components": [ + { + "name": "amount", + "type": 21, + "typeArguments": null + }, + { + "name": "asset", + "type": 10, + "typeArguments": null + }, + { + "name": "call_data", + "type": 9, + "typeArguments": null + }, + { + "name": "gas", + "type": 21, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 16, + "type": "struct ProposalInfo", + "components": [ + { + "name": "acceptance_percentage", + "type": 21, + "typeArguments": null + }, + { + "name": "author", + "type": 4, + "typeArguments": null + }, + { + "name": "deadline", + "type": 21, + "typeArguments": null + }, + { + "name": "executed", + "type": 2, + "typeArguments": null + }, + { + "name": "no_votes", + "type": 21, + "typeArguments": null + }, + { + "name": "proposal_transaction", + "type": 15, + "typeArguments": null + }, + { + "name": "yes_votes", + "type": 21, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 17, + "type": "struct UnlockVotesEvent", + "components": [ + { + "name": "id", + "type": 21, + "typeArguments": null + }, + { + "name": "user", + "type": 4, + "typeArguments": null + }, + { + "name": "vote_amount", + "type": 21, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 18, + "type": "struct VoteEvent", + "components": [ + { + "name": "id", + "type": 21, + "typeArguments": null + }, + { + "name": "user", + "type": 4, + "typeArguments": null + }, + { + "name": "vote_amount", + "type": 21, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 19, + "type": "struct Votes", + "components": [ + { + "name": "no_votes", + "type": 21, + "typeArguments": null + }, + { + "name": "yes_votes", + "type": 21, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 20, + "type": "struct WithdrawEvent", + "components": [ + { + "name": "amount", + "type": 21, + "typeArguments": null + }, + { + "name": "user", + "type": 4, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 21, + "type": "u64", + "components": null, + "typeParameters": null + } + ], + "functions": [ + { + "inputs": [ + { + "name": "token", + "type": 10, + "typeArguments": null + } + ], + "name": "constructor", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "acceptance_percentage", + "type": 21, + "typeArguments": null + }, + { + "name": "duration", + "type": 21, + "typeArguments": null + }, + { + "name": "proposal_transaction", + "type": 15, + "typeArguments": null + } + ], + "name": "create_proposal", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + } + ] + }, + { + "inputs": [], + "name": "deposit", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + }, + { + "name": "payable", + "arguments": [] + } + ] + }, + { + "inputs": [ + { + "name": "proposal_id", + "type": 21, + "typeArguments": null + } + ], + "name": "execute", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "proposal_id", + "type": 21, + "typeArguments": null + } + ], + "name": "unlock_votes", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "approve", + "type": 2, + "typeArguments": null + }, + { + "name": "proposal_id", + "type": 21, + "typeArguments": null + }, + { + "name": "vote_amount", + "type": 21, + "typeArguments": null + } + ], + "name": "vote", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "amount", + "type": 21, + "typeArguments": null + } + ], + "name": "withdraw", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + } + ] + }, + { + "inputs": [], + "name": "balance", + "output": { + "name": "", + "type": 21, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [], + "name": "governance_token_id", + "output": { + "name": "", + "type": 10, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [ + { + "name": "proposal_id", + "type": 21, + "typeArguments": null + } + ], + "name": "proposal", + "output": { + "name": "", + "type": 16, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [], + "name": "proposal_count", + "output": { + "name": "", + "type": 21, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [ + { + "name": "user", + "type": 4, + "typeArguments": null + } + ], + "name": "user_balance", + "output": { + "name": "", + "type": 21, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [ + { + "name": "proposal_id", + "type": 21, + "typeArguments": null + }, + { + "name": "user", + "type": 4, + "typeArguments": null + } + ], + "name": "user_votes", + "output": { + "name": "", + "type": 19, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + } + ], + "loggedTypes": [ + { + "logId": 0, + "loggedType": { + "name": "", + "type": 5, + "typeArguments": [] + } + }, + { + "logId": 1, + "loggedType": { + "name": "", + "type": 14, + "typeArguments": [] + } + }, + { + "logId": 2, + "loggedType": { + "name": "", + "type": 3, + "typeArguments": [] + } + }, + { + "logId": 3, + "loggedType": { + "name": "", + "type": 3, + "typeArguments": [] + } + }, + { + "logId": 4, + "loggedType": { + "name": "", + "type": 11, + "typeArguments": [] + } + }, + { + "logId": 5, + "loggedType": { + "name": "", + "type": 5, + "typeArguments": [] + } + }, + { + "logId": 6, + "loggedType": { + "name": "", + "type": 7, + "typeArguments": [] + } + }, + { + "logId": 7, + "loggedType": { + "name": "", + "type": 7, + "typeArguments": [] + } + }, + { + "logId": 8, + "loggedType": { + "name": "", + "type": 12, + "typeArguments": [] + } + }, + { + "logId": 9, + "loggedType": { + "name": "", + "type": 7, + "typeArguments": [] + } + }, + { + "logId": 10, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 11, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 12, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 13, + "loggedType": { + "name": "", + "type": 13, + "typeArguments": [] + } + }, + { + "logId": 14, + "loggedType": { + "name": "", + "type": 7, + "typeArguments": [] + } + }, + { + "logId": 15, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 16, + "loggedType": { + "name": "", + "type": 17, + "typeArguments": [] + } + }, + { + "logId": 17, + "loggedType": { + "name": "", + "type": 7, + "typeArguments": [] + } + }, + { + "logId": 18, + "loggedType": { + "name": "", + "type": 7, + "typeArguments": [] + } + }, + { + "logId": 19, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 20, + "loggedType": { + "name": "", + "type": 7, + "typeArguments": [] + } + }, + { + "logId": 21, + "loggedType": { + "name": "", + "type": 18, + "typeArguments": [] + } + }, + { + "logId": 22, + "loggedType": { + "name": "", + "type": 7, + "typeArguments": [] + } + }, + { + "logId": 23, + "loggedType": { + "name": "", + "type": 7, + "typeArguments": [] + } + }, + { + "logId": 24, + "loggedType": { + "name": "", + "type": 20, + "typeArguments": [] + } + }, + { + "logId": 25, + "loggedType": { + "name": "", + "type": 5, + "typeArguments": [] + } + }, + { + "logId": 26, + "loggedType": { + "name": "", + "type": 7, + "typeArguments": [] + } + }, + { + "logId": 27, + "loggedType": { + "name": "", + "type": 7, + "typeArguments": [] + } + } + ], + "messagesTypes": [], + "configurables": [] +} \ No newline at end of file diff --git a/packages/fuel-indexer-tests/trybuild/abi/README.md b/packages/fuel-indexer-tests/trybuild/abi/README.md new file mode 100644 index 000000000..ac76f0ea2 --- /dev/null +++ b/packages/fuel-indexer-tests/trybuild/abi/README.md @@ -0,0 +1,5 @@ +# `fuel-indexer-tests/trybuild/abi` + +- This directory contains several Sway JSON ABI files copied over from various [Sway applications](https://github.com/FuelLabs/sway-applications/tree/master). +- We use this ABI in a few trybuild tests in order to ensure that `forc index` builds with actual/legitimate Sway code (not just indexer-related test code) +- We include these JSON ABI files here (in their own `abi` directory) because we are only using ABI files in the relevant tests (i.e., we are not combining these ABI files with GraphQL schema). \ No newline at end of file diff --git a/packages/fuel-indexer-tests/trybuild/abi/asset-contract-abi.json b/packages/fuel-indexer-tests/trybuild/abi/asset-contract-abi.json new file mode 100644 index 000000000..093b8021a --- /dev/null +++ b/packages/fuel-indexer-tests/trybuild/abi/asset-contract-abi.json @@ -0,0 +1,200 @@ +{ + "types": [ + { + "typeId": 0, + "type": "()", + "components": [], + "typeParameters": null + }, + { + "typeId": 1, + "type": "b256", + "components": null, + "typeParameters": null + }, + { + "typeId": 2, + "type": "enum AccessError", + "components": [ + { + "name": "SenderNotPermittedToMint", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 3, + "type": "enum Identity", + "components": [ + { + "name": "Address", + "type": 6, + "typeArguments": null + }, + { + "name": "ContractId", + "type": 7, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 4, + "type": "enum InitError", + "components": [ + { + "name": "AlreadyInitialized", + "type": 0, + "typeArguments": null + }, + { + "name": "AssetSupplyCannotBeZero", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 5, + "type": "enum InputError", + "components": [ + { + "name": "GreaterThanMaximumSupply", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 6, + "type": "struct Address", + "components": [ + { + "name": "value", + "type": 1, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 7, + "type": "struct ContractId", + "components": [ + { + "name": "value", + "type": 1, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 8, + "type": "u64", + "components": null, + "typeParameters": null + } + ], + "functions": [ + { + "inputs": [ + { + "name": "asset_supply", + "type": 8, + "typeArguments": null + }, + { + "name": "minter", + "type": 3, + "typeArguments": null + } + ], + "name": "constructor", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "amount", + "type": 8, + "typeArguments": null + }, + { + "name": "to", + "type": 3, + "typeArguments": null + } + ], + "name": "mint_to", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + } + ] + } + ], + "loggedTypes": [ + { + "logId": 0, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 1, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 2, + "loggedType": { + "name": "", + "type": 2, + "typeArguments": [] + } + }, + { + "logId": 3, + "loggedType": { + "name": "", + "type": 5, + "typeArguments": [] + } + } + ], + "messagesTypes": [], + "configurables": [] +} \ No newline at end of file diff --git a/packages/fuel-indexer-tests/trybuild/abi/auction-contract-abi.json b/packages/fuel-indexer-tests/trybuild/abi/auction-contract-abi.json new file mode 100644 index 000000000..064478445 --- /dev/null +++ b/packages/fuel-indexer-tests/trybuild/abi/auction-contract-abi.json @@ -0,0 +1,954 @@ +{ + "types": [ + { + "typeId": 0, + "type": "()", + "components": [], + "typeParameters": null + }, + { + "typeId": 1, + "type": "b256", + "components": null, + "typeParameters": null + }, + { + "typeId": 2, + "type": "enum AccessError", + "components": [ + { + "name": "AuctionIsNotClosed", + "type": 0, + "typeArguments": null + }, + { + "name": "AuctionIsNotOpen", + "type": 0, + "typeArguments": null + }, + { + "name": "NFTTransferNotApproved", + "type": 0, + "typeArguments": null + }, + { + "name": "SenderIsNotSeller", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 3, + "type": "enum AssetError", + "components": [ + { + "name": "AssetsAreNotTheSame", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 4, + "type": "enum AuctionAsset", + "components": [ + { + "name": "NFTAsset", + "type": 18, + "typeArguments": null + }, + { + "name": "TokenAsset", + "type": 19, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 5, + "type": "enum Identity", + "components": [ + { + "name": "Address", + "type": 12, + "typeArguments": null + }, + { + "name": "ContractId", + "type": 16, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 6, + "type": "enum InitError", + "components": [ + { + "name": "AuctionDurationNotProvided", + "type": 0, + "typeArguments": null + }, + { + "name": "BidAssetAmountNotZero", + "type": 0, + "typeArguments": null + }, + { + "name": "CannotAcceptMoreThanOneNFT", + "type": 0, + "typeArguments": null + }, + { + "name": "InitialPriceCannotBeZero", + "type": 0, + "typeArguments": null + }, + { + "name": "ReserveLessThanInitialPrice", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 7, + "type": "enum InputError", + "components": [ + { + "name": "AuctionDoesNotExist", + "type": 0, + "typeArguments": null + }, + { + "name": "InitialPriceNotMet", + "type": 0, + "typeArguments": null + }, + { + "name": "IncorrectAmountProvided", + "type": 0, + "typeArguments": null + }, + { + "name": "IncorrectAssetProvided", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 8, + "type": "enum Option", + "components": [ + { + "name": "None", + "type": 0, + "typeArguments": null + }, + { + "name": "Some", + "type": 11, + "typeArguments": null + } + ], + "typeParameters": [ + 11 + ] + }, + { + "typeId": 9, + "type": "enum State", + "components": [ + { + "name": "Closed", + "type": 0, + "typeArguments": null + }, + { + "name": "Open", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 10, + "type": "enum UserError", + "components": [ + { + "name": "BidderIsSeller", + "type": 0, + "typeArguments": null + }, + { + "name": "UserHasAlreadyWithdrawn", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 11, + "type": "generic T", + "components": null, + "typeParameters": null + }, + { + "typeId": 12, + "type": "struct Address", + "components": [ + { + "name": "value", + "type": 1, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 13, + "type": "struct Auction", + "components": [ + { + "name": "bid_asset", + "type": 4, + "typeArguments": null + }, + { + "name": "end_block", + "type": 21, + "typeArguments": null + }, + { + "name": "highest_bidder", + "type": 8, + "typeArguments": [ + { + "name": "", + "type": 5, + "typeArguments": null + } + ] + }, + { + "name": "initial_price", + "type": 21, + "typeArguments": null + }, + { + "name": "reserve_price", + "type": 8, + "typeArguments": [ + { + "name": "", + "type": 21, + "typeArguments": null + } + ] + }, + { + "name": "sell_asset", + "type": 4, + "typeArguments": null + }, + { + "name": "seller", + "type": 5, + "typeArguments": null + }, + { + "name": "state", + "type": 9, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 14, + "type": "struct BidEvent", + "components": [ + { + "name": "amount", + "type": 21, + "typeArguments": null + }, + { + "name": "auction_id", + "type": 21, + "typeArguments": null + }, + { + "name": "user", + "type": 5, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 15, + "type": "struct CancelAuctionEvent", + "components": [ + { + "name": "auction_id", + "type": 21, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 16, + "type": "struct ContractId", + "components": [ + { + "name": "value", + "type": 1, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 17, + "type": "struct CreateAuctionEvent", + "components": [ + { + "name": "auction_id", + "type": 21, + "typeArguments": null + }, + { + "name": "bid_asset", + "type": 4, + "typeArguments": null + }, + { + "name": "sell_asset", + "type": 4, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 18, + "type": "struct NFTAsset", + "components": [ + { + "name": "asset_id", + "type": 16, + "typeArguments": null + }, + { + "name": "token_id", + "type": 21, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 19, + "type": "struct TokenAsset", + "components": [ + { + "name": "amount", + "type": 21, + "typeArguments": null + }, + { + "name": "asset_id", + "type": 16, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 20, + "type": "struct WithdrawEvent", + "components": [ + { + "name": "asset", + "type": 4, + "typeArguments": null + }, + { + "name": "auction_id", + "type": 21, + "typeArguments": null + }, + { + "name": "user", + "type": 5, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 21, + "type": "u64", + "components": null, + "typeParameters": null + } + ], + "functions": [ + { + "inputs": [ + { + "name": "auction_id", + "type": 21, + "typeArguments": null + }, + { + "name": "bid_asset", + "type": 4, + "typeArguments": null + } + ], + "name": "bid", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + }, + { + "name": "payable", + "arguments": [] + } + ] + }, + { + "inputs": [ + { + "name": "auction_id", + "type": 21, + "typeArguments": null + } + ], + "name": "cancel", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "bid_asset", + "type": 4, + "typeArguments": null + }, + { + "name": "duration", + "type": 21, + "typeArguments": null + }, + { + "name": "initial_price", + "type": 21, + "typeArguments": null + }, + { + "name": "reserve_price", + "type": 8, + "typeArguments": [ + { + "name": "", + "type": 21, + "typeArguments": null + } + ] + }, + { + "name": "seller", + "type": 5, + "typeArguments": null + }, + { + "name": "sell_asset", + "type": 4, + "typeArguments": null + } + ], + "name": "create", + "output": { + "name": "", + "type": 21, + "typeArguments": null + }, + "attributes": [ + { + "name": "payable", + "arguments": [] + }, + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "auction_id", + "type": 21, + "typeArguments": null + } + ], + "name": "withdraw", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "auction_id", + "type": 21, + "typeArguments": null + } + ], + "name": "auction_info", + "output": { + "name": "", + "type": 8, + "typeArguments": [ + { + "name": "", + "type": 13, + "typeArguments": null + } + ] + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [ + { + "name": "auction_id", + "type": 21, + "typeArguments": null + }, + { + "name": "identity", + "type": 5, + "typeArguments": null + } + ], + "name": "deposit_balance", + "output": { + "name": "", + "type": 8, + "typeArguments": [ + { + "name": "", + "type": 4, + "typeArguments": null + } + ] + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [], + "name": "total_auctions", + "output": { + "name": "", + "type": 21, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + } + ], + "loggedTypes": [ + { + "logId": 0, + "loggedType": { + "name": "", + "type": 7, + "typeArguments": [] + } + }, + { + "logId": 1, + "loggedType": { + "name": "", + "type": 10, + "typeArguments": [] + } + }, + { + "logId": 2, + "loggedType": { + "name": "", + "type": 2, + "typeArguments": [] + } + }, + { + "logId": 3, + "loggedType": { + "name": "", + "type": 7, + "typeArguments": [] + } + }, + { + "logId": 4, + "loggedType": { + "name": "", + "type": 3, + "typeArguments": [] + } + }, + { + "logId": 5, + "loggedType": { + "name": "", + "type": 2, + "typeArguments": [] + } + }, + { + "logId": 6, + "loggedType": { + "name": "", + "type": 7, + "typeArguments": [] + } + }, + { + "logId": 7, + "loggedType": { + "name": "", + "type": 7, + "typeArguments": [] + } + }, + { + "logId": 8, + "loggedType": { + "name": "", + "type": 7, + "typeArguments": [] + } + }, + { + "logId": 9, + "loggedType": { + "name": "", + "type": 7, + "typeArguments": [] + } + }, + { + "logId": 10, + "loggedType": { + "name": "", + "type": 7, + "typeArguments": [] + } + }, + { + "logId": 11, + "loggedType": { + "name": "", + "type": 7, + "typeArguments": [] + } + }, + { + "logId": 12, + "loggedType": { + "name": "", + "type": 7, + "typeArguments": [] + } + }, + { + "logId": 13, + "loggedType": { + "name": "", + "type": 7, + "typeArguments": [] + } + }, + { + "logId": 14, + "loggedType": { + "name": "", + "type": 7, + "typeArguments": [] + } + }, + { + "logId": 15, + "loggedType": { + "name": "", + "type": 14, + "typeArguments": [] + } + }, + { + "logId": 16, + "loggedType": { + "name": "", + "type": 7, + "typeArguments": [] + } + }, + { + "logId": 17, + "loggedType": { + "name": "", + "type": 2, + "typeArguments": [] + } + }, + { + "logId": 18, + "loggedType": { + "name": "", + "type": 2, + "typeArguments": [] + } + }, + { + "logId": 19, + "loggedType": { + "name": "", + "type": 15, + "typeArguments": [] + } + }, + { + "logId": 20, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 21, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 22, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 23, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 24, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 25, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 26, + "loggedType": { + "name": "", + "type": 7, + "typeArguments": [] + } + }, + { + "logId": 27, + "loggedType": { + "name": "", + "type": 7, + "typeArguments": [] + } + }, + { + "logId": 28, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 29, + "loggedType": { + "name": "", + "type": 2, + "typeArguments": [] + } + }, + { + "logId": 30, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 31, + "loggedType": { + "name": "", + "type": 2, + "typeArguments": [] + } + }, + { + "logId": 32, + "loggedType": { + "name": "", + "type": 17, + "typeArguments": [] + } + }, + { + "logId": 33, + "loggedType": { + "name": "", + "type": 7, + "typeArguments": [] + } + }, + { + "logId": 34, + "loggedType": { + "name": "", + "type": 2, + "typeArguments": [] + } + }, + { + "logId": 35, + "loggedType": { + "name": "", + "type": 10, + "typeArguments": [] + } + }, + { + "logId": 36, + "loggedType": { + "name": "", + "type": 2, + "typeArguments": [] + } + }, + { + "logId": 37, + "loggedType": { + "name": "", + "type": 2, + "typeArguments": [] + } + }, + { + "logId": 38, + "loggedType": { + "name": "", + "type": 2, + "typeArguments": [] + } + }, + { + "logId": 39, + "loggedType": { + "name": "", + "type": 20, + "typeArguments": [] + } + } + ], + "messagesTypes": [], + "configurables": [] +} \ No newline at end of file diff --git a/packages/fuel-indexer-tests/contracts/simple-wasm/out/debug/contracts-abi-reserved-name.json b/packages/fuel-indexer-tests/trybuild/abi/contracts-abi-reserved-name.json similarity index 100% rename from packages/fuel-indexer-tests/contracts/simple-wasm/out/debug/contracts-abi-reserved-name.json rename to packages/fuel-indexer-tests/trybuild/abi/contracts-abi-reserved-name.json diff --git a/packages/fuel-indexer-tests/trybuild/abi/distributor-contract-abi.json b/packages/fuel-indexer-tests/trybuild/abi/distributor-contract-abi.json new file mode 100644 index 000000000..3d5c04698 --- /dev/null +++ b/packages/fuel-indexer-tests/trybuild/abi/distributor-contract-abi.json @@ -0,0 +1,676 @@ +{ + "types": [ + { + "typeId": 0, + "type": "()", + "components": [], + "typeParameters": null + }, + { + "typeId": 1, + "type": "b256", + "components": null, + "typeParameters": null + }, + { + "typeId": 2, + "type": "bool", + "components": null, + "typeParameters": null + }, + { + "typeId": 3, + "type": "enum AccessError", + "components": [ + { + "name": "CallerNotAdmin", + "type": 0, + "typeArguments": null + }, + { + "name": "NotEnoughTokens", + "type": 0, + "typeArguments": null + }, + { + "name": "UserAlreadyClaimed", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 4, + "type": "enum ClaimState", + "components": [ + { + "name": "Unclaimed", + "type": 0, + "typeArguments": null + }, + { + "name": "Claimed", + "type": 20, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 5, + "type": "enum Identity", + "components": [ + { + "name": "Address", + "type": 13, + "typeArguments": null + }, + { + "name": "ContractId", + "type": 16, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 6, + "type": "enum InitError", + "components": [ + { + "name": "AlreadyInitialized", + "type": 0, + "typeArguments": null + }, + { + "name": "CannotAirdropZeroTokens", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 7, + "type": "enum Option", + "components": [ + { + "name": "None", + "type": 0, + "typeArguments": null + }, + { + "name": "Some", + "type": 11, + "typeArguments": null + } + ], + "typeParameters": [ + 11 + ] + }, + { + "typeId": 8, + "type": "enum ProofError", + "components": [ + { + "name": "InvalidKey", + "type": 0, + "typeArguments": null + }, + { + "name": "InvalidProofLength", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 9, + "type": "enum StateError", + "components": [ + { + "name": "ClaimPeriodNotActive", + "type": 0, + "typeArguments": null + }, + { + "name": "ClaimPeriodActive", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 10, + "type": "enum VerificationError", + "components": [ + { + "name": "MerkleProofFailed", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 11, + "type": "generic T", + "components": null, + "typeParameters": null + }, + { + "typeId": 12, + "type": "raw untyped ptr", + "components": null, + "typeParameters": null + }, + { + "typeId": 13, + "type": "struct Address", + "components": [ + { + "name": "value", + "type": 1, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 14, + "type": "struct ClaimEvent", + "components": [ + { + "name": "amount", + "type": 20, + "typeArguments": null + }, + { + "name": "claimer", + "type": 5, + "typeArguments": null + }, + { + "name": "to", + "type": 5, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 15, + "type": "struct ClawbackEvent", + "components": [ + { + "name": "amount", + "type": 20, + "typeArguments": null + }, + { + "name": "to", + "type": 5, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 16, + "type": "struct ContractId", + "components": [ + { + "name": "value", + "type": 1, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 17, + "type": "struct CreateAirdropEvent", + "components": [ + { + "name": "admin", + "type": 5, + "typeArguments": null + }, + { + "name": "asset", + "type": 16, + "typeArguments": null + }, + { + "name": "end_block", + "type": 20, + "typeArguments": null + }, + { + "name": "merkle_root", + "type": 1, + "typeArguments": null + }, + { + "name": "number_of_leaves", + "type": 20, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 18, + "type": "struct RawVec", + "components": [ + { + "name": "ptr", + "type": 12, + "typeArguments": null + }, + { + "name": "cap", + "type": 20, + "typeArguments": null + } + ], + "typeParameters": [ + 11 + ] + }, + { + "typeId": 19, + "type": "struct Vec", + "components": [ + { + "name": "buf", + "type": 18, + "typeArguments": [ + { + "name": "", + "type": 11, + "typeArguments": null + } + ] + }, + { + "name": "len", + "type": 20, + "typeArguments": null + } + ], + "typeParameters": [ + 11 + ] + }, + { + "typeId": 20, + "type": "u64", + "components": null, + "typeParameters": null + } + ], + "functions": [ + { + "inputs": [ + { + "name": "amount", + "type": 20, + "typeArguments": null + }, + { + "name": "key", + "type": 20, + "typeArguments": null + }, + { + "name": "proof", + "type": 19, + "typeArguments": [ + { + "name": "", + "type": 1, + "typeArguments": null + } + ] + }, + { + "name": "to", + "type": 5, + "typeArguments": null + } + ], + "name": "claim", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + } + ] + }, + { + "inputs": [], + "name": "clawback", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [ + { + "name": "admin", + "type": 5, + "typeArguments": null + }, + { + "name": "claim_time", + "type": 20, + "typeArguments": null + }, + { + "name": "merkle_root", + "type": 1, + "typeArguments": null + }, + { + "name": "number_of_leaves", + "type": 20, + "typeArguments": null + } + ], + "name": "constructor", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + }, + { + "name": "payable", + "arguments": [] + } + ] + }, + { + "inputs": [], + "name": "admin", + "output": { + "name": "", + "type": 7, + "typeArguments": [ + { + "name": "", + "type": 5, + "typeArguments": null + } + ] + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [ + { + "name": "identity", + "type": 5, + "typeArguments": null + } + ], + "name": "claim_data", + "output": { + "name": "", + "type": 4, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [], + "name": "end_block", + "output": { + "name": "", + "type": 20, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [], + "name": "is_active", + "output": { + "name": "", + "type": 2, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [], + "name": "merkle_root", + "output": { + "name": "", + "type": 7, + "typeArguments": [ + { + "name": "", + "type": 1, + "typeArguments": null + } + ] + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [], + "name": "number_of_leaves", + "output": { + "name": "", + "type": 20, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + } + ], + "loggedTypes": [ + { + "logId": 0, + "loggedType": { + "name": "", + "type": 9, + "typeArguments": [] + } + }, + { + "logId": 1, + "loggedType": { + "name": "", + "type": 3, + "typeArguments": [] + } + }, + { + "logId": 2, + "loggedType": { + "name": "", + "type": 3, + "typeArguments": [] + } + }, + { + "logId": 3, + "loggedType": { + "name": "", + "type": 8, + "typeArguments": [] + } + }, + { + "logId": 4, + "loggedType": { + "name": "", + "type": 8, + "typeArguments": [] + } + }, + { + "logId": 5, + "loggedType": { + "name": "", + "type": 8, + "typeArguments": [] + } + }, + { + "logId": 6, + "loggedType": { + "name": "", + "type": 8, + "typeArguments": [] + } + }, + { + "logId": 7, + "loggedType": { + "name": "", + "type": 10, + "typeArguments": [] + } + }, + { + "logId": 8, + "loggedType": { + "name": "", + "type": 14, + "typeArguments": [] + } + }, + { + "logId": 9, + "loggedType": { + "name": "", + "type": 3, + "typeArguments": [] + } + }, + { + "logId": 10, + "loggedType": { + "name": "", + "type": 9, + "typeArguments": [] + } + }, + { + "logId": 11, + "loggedType": { + "name": "", + "type": 3, + "typeArguments": [] + } + }, + { + "logId": 12, + "loggedType": { + "name": "", + "type": 15, + "typeArguments": [] + } + }, + { + "logId": 13, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 14, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 15, + "loggedType": { + "name": "", + "type": 17, + "typeArguments": [] + } + } + ], + "messagesTypes": [], + "configurables": [] +} \ No newline at end of file diff --git a/packages/fuel-indexer-tests/trybuild/abi/escrow-contract-abi.json b/packages/fuel-indexer-tests/trybuild/abi/escrow-contract-abi.json new file mode 100644 index 000000000..bb6fe36f2 --- /dev/null +++ b/packages/fuel-indexer-tests/trybuild/abi/escrow-contract-abi.json @@ -0,0 +1,1476 @@ +{ + "types": [ + { + "typeId": 0, + "type": "()", + "components": [], + "typeParameters": null + }, + { + "typeId": 1, + "type": "b256", + "components": null, + "typeParameters": null + }, + { + "typeId": 2, + "type": "bool", + "components": null, + "typeParameters": null + }, + { + "typeId": 3, + "type": "enum ArbiterInputError", + "components": [ + { + "name": "AssetDoesNotMatch", + "type": 0, + "typeArguments": null + }, + { + "name": "CannotBeBuyer", + "type": 0, + "typeArguments": null + }, + { + "name": "CannotBeSeller", + "type": 0, + "typeArguments": null + }, + { + "name": "FeeCannotBeZero", + "type": 0, + "typeArguments": null + }, + { + "name": "FeeDoesNotMatchAmountSent", + "type": 0, + "typeArguments": null + }, + { + "name": "PaymentTooLarge", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 4, + "type": "enum AssetInputError", + "components": [ + { + "name": "UnspecifiedAssets", + "type": 0, + "typeArguments": null + }, + { + "name": "AssetAmountCannotBeZero", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 5, + "type": "enum DeadlineInputError", + "components": [ + { + "name": "MustBeInTheFuture", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 6, + "type": "enum DepositError", + "components": [ + { + "name": "IncorrectAssetAmount", + "type": 0, + "typeArguments": null + }, + { + "name": "IncorrectAssetSent", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 7, + "type": "enum Identity", + "components": [ + { + "name": "Address", + "type": 16, + "typeArguments": null + }, + { + "name": "ContractId", + "type": 20, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 8, + "type": "enum Option", + "components": [ + { + "name": "None", + "type": 0, + "typeArguments": null + }, + { + "name": "Some", + "type": 13, + "typeArguments": null + } + ], + "typeParameters": [ + 13 + ] + }, + { + "typeId": 9, + "type": "enum State", + "components": [ + { + "name": "Pending", + "type": 0, + "typeArguments": null + }, + { + "name": "Completed", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 10, + "type": "enum StateError", + "components": [ + { + "name": "AlreadyDeposited", + "type": 0, + "typeArguments": null + }, + { + "name": "AlreadyDisputed", + "type": 0, + "typeArguments": null + }, + { + "name": "ArbiterHasNotBeenProposed", + "type": 0, + "typeArguments": null + }, + { + "name": "CannotDisputeBeforeDeposit", + "type": 0, + "typeArguments": null + }, + { + "name": "CannotResolveBeforeDeposit", + "type": 0, + "typeArguments": null + }, + { + "name": "CannotTakePaymentBeforeDeadline", + "type": 0, + "typeArguments": null + }, + { + "name": "CannotTakePaymentDuringDispute", + "type": 0, + "typeArguments": null + }, + { + "name": "CannotTransferBeforeDeposit", + "type": 0, + "typeArguments": null + }, + { + "name": "CannotWithdrawAfterDeposit", + "type": 0, + "typeArguments": null + }, + { + "name": "CannotWithdrawBeforeDeadline", + "type": 0, + "typeArguments": null + }, + { + "name": "EscrowExpired", + "type": 0, + "typeArguments": null + }, + { + "name": "NotDisputed", + "type": 0, + "typeArguments": null + }, + { + "name": "StateNotPending", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 11, + "type": "enum UserError", + "components": [ + { + "name": "Unauthorized", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 12, + "type": "enum UserInputError", + "components": [ + { + "name": "InvalidRecipient", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 13, + "type": "generic T", + "components": null, + "typeParameters": null + }, + { + "typeId": 14, + "type": "raw untyped ptr", + "components": null, + "typeParameters": null + }, + { + "typeId": 15, + "type": "struct AcceptedArbiterEvent", + "components": [ + { + "name": "identifier", + "type": 34, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 16, + "type": "struct Address", + "components": [ + { + "name": "value", + "type": 1, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 17, + "type": "struct Arbiter", + "components": [ + { + "name": "address", + "type": 7, + "typeArguments": null + }, + { + "name": "asset", + "type": 20, + "typeArguments": null + }, + { + "name": "fee_amount", + "type": 34, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 18, + "type": "struct Asset", + "components": [ + { + "name": "amount", + "type": 34, + "typeArguments": null + }, + { + "name": "id", + "type": 20, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 19, + "type": "struct Buyer", + "components": [ + { + "name": "address", + "type": 7, + "typeArguments": null + }, + { + "name": "asset", + "type": 8, + "typeArguments": [ + { + "name": "", + "type": 20, + "typeArguments": null + } + ] + }, + { + "name": "deposited_amount", + "type": 34, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 20, + "type": "struct ContractId", + "components": [ + { + "name": "value", + "type": 1, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 21, + "type": "struct CreatedEscrowEvent", + "components": [ + { + "name": "escrow", + "type": 24, + "typeArguments": null + }, + { + "name": "identifier", + "type": 34, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 22, + "type": "struct DepositEvent", + "components": [ + { + "name": "asset", + "type": 20, + "typeArguments": null + }, + { + "name": "identifier", + "type": 34, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 23, + "type": "struct DisputeEvent", + "components": [ + { + "name": "identifier", + "type": 34, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 24, + "type": "struct EscrowInfo", + "components": [ + { + "name": "arbiter", + "type": 17, + "typeArguments": null + }, + { + "name": "asset_count", + "type": 34, + "typeArguments": null + }, + { + "name": "buyer", + "type": 19, + "typeArguments": null + }, + { + "name": "deadline", + "type": 34, + "typeArguments": null + }, + { + "name": "disputed", + "type": 2, + "typeArguments": null + }, + { + "name": "first_asset_index", + "type": 34, + "typeArguments": null + }, + { + "name": "seller", + "type": 30, + "typeArguments": null + }, + { + "name": "state", + "type": 9, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 25, + "type": "struct PaymentTakenEvent", + "components": [ + { + "name": "identifier", + "type": 34, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 26, + "type": "struct ProposedArbiterEvent", + "components": [ + { + "name": "arbiter", + "type": 17, + "typeArguments": null + }, + { + "name": "identifier", + "type": 34, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 27, + "type": "struct RawVec", + "components": [ + { + "name": "ptr", + "type": 14, + "typeArguments": null + }, + { + "name": "cap", + "type": 34, + "typeArguments": null + } + ], + "typeParameters": [ + 13 + ] + }, + { + "typeId": 28, + "type": "struct ResolvedDisputeEvent", + "components": [ + { + "name": "identifier", + "type": 34, + "typeArguments": null + }, + { + "name": "user", + "type": 7, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 29, + "type": "struct ReturnedDepositEvent", + "components": [ + { + "name": "identifier", + "type": 34, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 30, + "type": "struct Seller", + "components": [ + { + "name": "address", + "type": 7, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 31, + "type": "struct TransferredToSellerEvent", + "components": [ + { + "name": "identifier", + "type": 34, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 32, + "type": "struct Vec", + "components": [ + { + "name": "buf", + "type": 27, + "typeArguments": [ + { + "name": "", + "type": 13, + "typeArguments": null + } + ] + }, + { + "name": "len", + "type": 34, + "typeArguments": null + } + ], + "typeParameters": [ + 13 + ] + }, + { + "typeId": 33, + "type": "struct WithdrawnCollateralEvent", + "components": [ + { + "name": "identifier", + "type": 34, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 34, + "type": "u64", + "components": null, + "typeParameters": null + } + ], + "functions": [ + { + "inputs": [ + { + "name": "identifier", + "type": 34, + "typeArguments": null + } + ], + "name": "accept_arbiter", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "arbiter", + "type": 17, + "typeArguments": null + }, + { + "name": "assets", + "type": 32, + "typeArguments": [ + { + "name": "", + "type": 18, + "typeArguments": null + } + ] + }, + { + "name": "buyer", + "type": 7, + "typeArguments": null + }, + { + "name": "deadline", + "type": 34, + "typeArguments": null + } + ], + "name": "create_escrow", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + }, + { + "name": "payable", + "arguments": [] + } + ] + }, + { + "inputs": [ + { + "name": "identifier", + "type": 34, + "typeArguments": null + } + ], + "name": "deposit", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + }, + { + "name": "payable", + "arguments": [] + } + ] + }, + { + "inputs": [ + { + "name": "identifier", + "type": 34, + "typeArguments": null + } + ], + "name": "dispute", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "arbiter", + "type": 17, + "typeArguments": null + }, + { + "name": "identifier", + "type": 34, + "typeArguments": null + } + ], + "name": "propose_arbiter", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + }, + { + "name": "payable", + "arguments": [] + } + ] + }, + { + "inputs": [ + { + "name": "identifier", + "type": 34, + "typeArguments": null + }, + { + "name": "payment_amount", + "type": 34, + "typeArguments": null + }, + { + "name": "user", + "type": 7, + "typeArguments": null + } + ], + "name": "resolve_dispute", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "identifier", + "type": 34, + "typeArguments": null + } + ], + "name": "return_deposit", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "identifier", + "type": 34, + "typeArguments": null + } + ], + "name": "take_payment", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "identifier", + "type": 34, + "typeArguments": null + } + ], + "name": "transfer_to_seller", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "identifier", + "type": 34, + "typeArguments": null + } + ], + "name": "withdraw_collateral", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "identifier", + "type": 34, + "typeArguments": null + } + ], + "name": "arbiter_proposal", + "output": { + "name": "", + "type": 8, + "typeArguments": [ + { + "name": "", + "type": 17, + "typeArguments": null + } + ] + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [ + { + "name": "identifier", + "type": 34, + "typeArguments": null + } + ], + "name": "assets", + "output": { + "name": "", + "type": 8, + "typeArguments": [ + { + "name": "", + "type": 18, + "typeArguments": null + } + ] + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [], + "name": "escrow_count", + "output": { + "name": "", + "type": 34, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [ + { + "name": "identifier", + "type": 34, + "typeArguments": null + } + ], + "name": "escrows", + "output": { + "name": "", + "type": 8, + "typeArguments": [ + { + "name": "", + "type": 24, + "typeArguments": null + } + ] + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + } + ], + "loggedTypes": [ + { + "logId": 0, + "loggedType": { + "name": "", + "type": 10, + "typeArguments": [] + } + }, + { + "logId": 1, + "loggedType": { + "name": "", + "type": 11, + "typeArguments": [] + } + }, + { + "logId": 2, + "loggedType": { + "name": "", + "type": 10, + "typeArguments": [] + } + }, + { + "logId": 3, + "loggedType": { + "name": "", + "type": 15, + "typeArguments": [] + } + }, + { + "logId": 4, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 5, + "loggedType": { + "name": "", + "type": 5, + "typeArguments": [] + } + }, + { + "logId": 6, + "loggedType": { + "name": "", + "type": 3, + "typeArguments": [] + } + }, + { + "logId": 7, + "loggedType": { + "name": "", + "type": 3, + "typeArguments": [] + } + }, + { + "logId": 8, + "loggedType": { + "name": "", + "type": 3, + "typeArguments": [] + } + }, + { + "logId": 9, + "loggedType": { + "name": "", + "type": 3, + "typeArguments": [] + } + }, + { + "logId": 10, + "loggedType": { + "name": "", + "type": 3, + "typeArguments": [] + } + }, + { + "logId": 11, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 12, + "loggedType": { + "name": "", + "type": 21, + "typeArguments": [] + } + }, + { + "logId": 13, + "loggedType": { + "name": "", + "type": 10, + "typeArguments": [] + } + }, + { + "logId": 14, + "loggedType": { + "name": "", + "type": 10, + "typeArguments": [] + } + }, + { + "logId": 15, + "loggedType": { + "name": "", + "type": 11, + "typeArguments": [] + } + }, + { + "logId": 16, + "loggedType": { + "name": "", + "type": 10, + "typeArguments": [] + } + }, + { + "logId": 17, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 18, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 19, + "loggedType": { + "name": "", + "type": 22, + "typeArguments": [] + } + }, + { + "logId": 20, + "loggedType": { + "name": "", + "type": 10, + "typeArguments": [] + } + }, + { + "logId": 21, + "loggedType": { + "name": "", + "type": 10, + "typeArguments": [] + } + }, + { + "logId": 22, + "loggedType": { + "name": "", + "type": 11, + "typeArguments": [] + } + }, + { + "logId": 23, + "loggedType": { + "name": "", + "type": 10, + "typeArguments": [] + } + }, + { + "logId": 24, + "loggedType": { + "name": "", + "type": 23, + "typeArguments": [] + } + }, + { + "logId": 25, + "loggedType": { + "name": "", + "type": 10, + "typeArguments": [] + } + }, + { + "logId": 26, + "loggedType": { + "name": "", + "type": 11, + "typeArguments": [] + } + }, + { + "logId": 27, + "loggedType": { + "name": "", + "type": 3, + "typeArguments": [] + } + }, + { + "logId": 28, + "loggedType": { + "name": "", + "type": 3, + "typeArguments": [] + } + }, + { + "logId": 29, + "loggedType": { + "name": "", + "type": 3, + "typeArguments": [] + } + }, + { + "logId": 30, + "loggedType": { + "name": "", + "type": 3, + "typeArguments": [] + } + }, + { + "logId": 31, + "loggedType": { + "name": "", + "type": 3, + "typeArguments": [] + } + }, + { + "logId": 32, + "loggedType": { + "name": "", + "type": 26, + "typeArguments": [] + } + }, + { + "logId": 33, + "loggedType": { + "name": "", + "type": 10, + "typeArguments": [] + } + }, + { + "logId": 34, + "loggedType": { + "name": "", + "type": 10, + "typeArguments": [] + } + }, + { + "logId": 35, + "loggedType": { + "name": "", + "type": 11, + "typeArguments": [] + } + }, + { + "logId": 36, + "loggedType": { + "name": "", + "type": 12, + "typeArguments": [] + } + }, + { + "logId": 37, + "loggedType": { + "name": "", + "type": 10, + "typeArguments": [] + } + }, + { + "logId": 38, + "loggedType": { + "name": "", + "type": 3, + "typeArguments": [] + } + }, + { + "logId": 39, + "loggedType": { + "name": "", + "type": 28, + "typeArguments": [] + } + }, + { + "logId": 40, + "loggedType": { + "name": "", + "type": 10, + "typeArguments": [] + } + }, + { + "logId": 41, + "loggedType": { + "name": "", + "type": 11, + "typeArguments": [] + } + }, + { + "logId": 42, + "loggedType": { + "name": "", + "type": 10, + "typeArguments": [] + } + }, + { + "logId": 43, + "loggedType": { + "name": "", + "type": 29, + "typeArguments": [] + } + }, + { + "logId": 44, + "loggedType": { + "name": "", + "type": 10, + "typeArguments": [] + } + }, + { + "logId": 45, + "loggedType": { + "name": "", + "type": 10, + "typeArguments": [] + } + }, + { + "logId": 46, + "loggedType": { + "name": "", + "type": 10, + "typeArguments": [] + } + }, + { + "logId": 47, + "loggedType": { + "name": "", + "type": 11, + "typeArguments": [] + } + }, + { + "logId": 48, + "loggedType": { + "name": "", + "type": 10, + "typeArguments": [] + } + }, + { + "logId": 49, + "loggedType": { + "name": "", + "type": 25, + "typeArguments": [] + } + }, + { + "logId": 50, + "loggedType": { + "name": "", + "type": 10, + "typeArguments": [] + } + }, + { + "logId": 51, + "loggedType": { + "name": "", + "type": 10, + "typeArguments": [] + } + }, + { + "logId": 52, + "loggedType": { + "name": "", + "type": 11, + "typeArguments": [] + } + }, + { + "logId": 53, + "loggedType": { + "name": "", + "type": 31, + "typeArguments": [] + } + }, + { + "logId": 54, + "loggedType": { + "name": "", + "type": 10, + "typeArguments": [] + } + }, + { + "logId": 55, + "loggedType": { + "name": "", + "type": 10, + "typeArguments": [] + } + }, + { + "logId": 56, + "loggedType": { + "name": "", + "type": 11, + "typeArguments": [] + } + }, + { + "logId": 57, + "loggedType": { + "name": "", + "type": 10, + "typeArguments": [] + } + }, + { + "logId": 58, + "loggedType": { + "name": "", + "type": 33, + "typeArguments": [] + } + } + ], + "messagesTypes": [], + "configurables": [] +} \ No newline at end of file diff --git a/packages/fuel-indexer-tests/trybuild/abi/exchange-contract-abi.json b/packages/fuel-indexer-tests/trybuild/abi/exchange-contract-abi.json new file mode 100644 index 000000000..7afad6baa --- /dev/null +++ b/packages/fuel-indexer-tests/trybuild/abi/exchange-contract-abi.json @@ -0,0 +1,1135 @@ +{ + "types": [ + { + "typeId": 0, + "type": "()", + "components": [], + "typeParameters": null + }, + { + "typeId": 1, + "type": "b256", + "components": null, + "typeParameters": null + }, + { + "typeId": 2, + "type": "bool", + "components": null, + "typeParameters": null + }, + { + "typeId": 3, + "type": "enum InitError", + "components": [ + { + "name": "AssetPairAlreadySet", + "type": 0, + "typeArguments": null + }, + { + "name": "AssetPairNotSet", + "type": 0, + "typeArguments": null + }, + { + "name": "IdenticalAssets", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 4, + "type": "enum InputError", + "components": [ + { + "name": "CannotAddLessThanMinimumLiquidity", + "type": 21, + "typeArguments": null + }, + { + "name": "DeadlinePassed", + "type": 21, + "typeArguments": null + }, + { + "name": "ExpectedNonZeroAmount", + "type": 11, + "typeArguments": null + }, + { + "name": "ExpectedNonZeroParameter", + "type": 11, + "typeArguments": null + }, + { + "name": "InvalidAsset", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 5, + "type": "enum Option", + "components": [ + { + "name": "None", + "type": 0, + "typeArguments": null + }, + { + "name": "Some", + "type": 7, + "typeArguments": null + } + ], + "typeParameters": [ + 7 + ] + }, + { + "typeId": 6, + "type": "enum TransactionError", + "components": [ + { + "name": "DesiredAmountTooHigh", + "type": 21, + "typeArguments": null + }, + { + "name": "DesiredAmountTooLow", + "type": 21, + "typeArguments": null + }, + { + "name": "ExpectedNonZeroDeposit", + "type": 11, + "typeArguments": null + }, + { + "name": "InsufficientReserve", + "type": 11, + "typeArguments": null + }, + { + "name": "NoLiquidityToRemove", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 7, + "type": "generic T", + "components": null, + "typeParameters": null + }, + { + "typeId": 8, + "type": "struct AddLiquidityEvent", + "components": [ + { + "name": "added_assets", + "type": 10, + "typeArguments": null + }, + { + "name": "liquidity", + "type": 9, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 9, + "type": "struct Asset", + "components": [ + { + "name": "id", + "type": 11, + "typeArguments": null + }, + { + "name": "amount", + "type": 21, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 10, + "type": "struct AssetPair", + "components": [ + { + "name": "a", + "type": 9, + "typeArguments": null + }, + { + "name": "b", + "type": 9, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 11, + "type": "struct ContractId", + "components": [ + { + "name": "value", + "type": 1, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 12, + "type": "struct DefineAssetPairEvent", + "components": [ + { + "name": "asset_a_id", + "type": 11, + "typeArguments": null + }, + { + "name": "asset_b_id", + "type": 11, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 13, + "type": "struct DepositEvent", + "components": [ + { + "name": "deposited_asset", + "type": 9, + "typeArguments": null + }, + { + "name": "new_balance", + "type": 21, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 14, + "type": "struct PoolInfo", + "components": [ + { + "name": "reserves", + "type": 10, + "typeArguments": null + }, + { + "name": "liquidity", + "type": 21, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 15, + "type": "struct PreviewAddLiquidityInfo", + "components": [ + { + "name": "other_asset_to_add", + "type": 9, + "typeArguments": null + }, + { + "name": "liquidity_asset_to_receive", + "type": 9, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 16, + "type": "struct PreviewSwapInfo", + "components": [ + { + "name": "other_asset", + "type": 9, + "typeArguments": null + }, + { + "name": "sufficient_reserve", + "type": 2, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 17, + "type": "struct RemoveLiquidityEvent", + "components": [ + { + "name": "removed_reserve", + "type": 10, + "typeArguments": null + }, + { + "name": "burned_liquidity", + "type": 9, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 18, + "type": "struct RemoveLiquidityInfo", + "components": [ + { + "name": "removed_amounts", + "type": 10, + "typeArguments": null + }, + { + "name": "burned_liquidity", + "type": 9, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 19, + "type": "struct SwapEvent", + "components": [ + { + "name": "input", + "type": 9, + "typeArguments": null + }, + { + "name": "output", + "type": 9, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 20, + "type": "struct WithdrawEvent", + "components": [ + { + "name": "withdrawn_asset", + "type": 9, + "typeArguments": null + }, + { + "name": "remaining_balance", + "type": 21, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 21, + "type": "u64", + "components": null, + "typeParameters": null + } + ], + "functions": [ + { + "inputs": [ + { + "name": "desired_liquidity", + "type": 21, + "typeArguments": null + }, + { + "name": "deadline", + "type": 21, + "typeArguments": null + } + ], + "name": "add_liquidity", + "output": { + "name": "", + "type": 21, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "asset_id", + "type": 11, + "typeArguments": null + } + ], + "name": "balance", + "output": { + "name": "", + "type": 21, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [ + { + "name": "asset_a", + "type": 11, + "typeArguments": null + }, + { + "name": "asset_b", + "type": 11, + "typeArguments": null + } + ], + "name": "constructor", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + } + ] + }, + { + "inputs": [], + "name": "deposit", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "payable", + "arguments": [] + }, + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + } + ] + }, + { + "inputs": [], + "name": "pool_info", + "output": { + "name": "", + "type": 14, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [ + { + "name": "asset", + "type": 9, + "typeArguments": null + } + ], + "name": "preview_add_liquidity", + "output": { + "name": "", + "type": 15, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [ + { + "name": "exact_input_asset", + "type": 9, + "typeArguments": null + } + ], + "name": "preview_swap_exact_input", + "output": { + "name": "", + "type": 16, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [ + { + "name": "exact_output_asset", + "type": 9, + "typeArguments": null + } + ], + "name": "preview_swap_exact_output", + "output": { + "name": "", + "type": 16, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [ + { + "name": "min_asset_a", + "type": 21, + "typeArguments": null + }, + { + "name": "min_asset_b", + "type": 21, + "typeArguments": null + }, + { + "name": "deadline", + "type": 21, + "typeArguments": null + } + ], + "name": "remove_liquidity", + "output": { + "name": "", + "type": 18, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + }, + { + "name": "payable", + "arguments": [] + } + ] + }, + { + "inputs": [ + { + "name": "min_output", + "type": 5, + "typeArguments": [ + { + "name": "", + "type": 21, + "typeArguments": null + } + ] + }, + { + "name": "deadline", + "type": 21, + "typeArguments": null + } + ], + "name": "swap_exact_input", + "output": { + "name": "", + "type": 21, + "typeArguments": null + }, + "attributes": [ + { + "name": "payable", + "arguments": [] + }, + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "output", + "type": 21, + "typeArguments": null + }, + { + "name": "deadline", + "type": 21, + "typeArguments": null + } + ], + "name": "swap_exact_output", + "output": { + "name": "", + "type": 21, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + }, + { + "name": "payable", + "arguments": [] + } + ] + }, + { + "inputs": [ + { + "name": "asset", + "type": 9, + "typeArguments": null + } + ], + "name": "withdraw", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + } + ] + } + ], + "loggedTypes": [ + { + "logId": 0, + "loggedType": { + "name": "", + "type": 3, + "typeArguments": [] + } + }, + { + "logId": 1, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 2, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 3, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 4, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 5, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 6, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 7, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 8, + "loggedType": { + "name": "", + "type": 8, + "typeArguments": [] + } + }, + { + "logId": 9, + "loggedType": { + "name": "", + "type": 3, + "typeArguments": [] + } + }, + { + "logId": 10, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 11, + "loggedType": { + "name": "", + "type": 3, + "typeArguments": [] + } + }, + { + "logId": 12, + "loggedType": { + "name": "", + "type": 3, + "typeArguments": [] + } + }, + { + "logId": 13, + "loggedType": { + "name": "", + "type": 12, + "typeArguments": [] + } + }, + { + "logId": 14, + "loggedType": { + "name": "", + "type": 3, + "typeArguments": [] + } + }, + { + "logId": 15, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 16, + "loggedType": { + "name": "", + "type": 13, + "typeArguments": [] + } + }, + { + "logId": 17, + "loggedType": { + "name": "", + "type": 3, + "typeArguments": [] + } + }, + { + "logId": 18, + "loggedType": { + "name": "", + "type": 3, + "typeArguments": [] + } + }, + { + "logId": 19, + "loggedType": { + "name": "", + "type": 3, + "typeArguments": [] + } + }, + { + "logId": 20, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 21, + "loggedType": { + "name": "", + "type": 3, + "typeArguments": [] + } + }, + { + "logId": 22, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 23, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 24, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 25, + "loggedType": { + "name": "", + "type": 3, + "typeArguments": [] + } + }, + { + "logId": 26, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 27, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 28, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 29, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 30, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 31, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 32, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 33, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 34, + "loggedType": { + "name": "", + "type": 17, + "typeArguments": [] + } + }, + { + "logId": 35, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 36, + "loggedType": { + "name": "", + "type": 3, + "typeArguments": [] + } + }, + { + "logId": 37, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 38, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 39, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 40, + "loggedType": { + "name": "", + "type": 19, + "typeArguments": [] + } + }, + { + "logId": 41, + "loggedType": { + "name": "", + "type": 3, + "typeArguments": [] + } + }, + { + "logId": 42, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 43, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 44, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 45, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 46, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 47, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 48, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 49, + "loggedType": { + "name": "", + "type": 19, + "typeArguments": [] + } + }, + { + "logId": 50, + "loggedType": { + "name": "", + "type": 3, + "typeArguments": [] + } + }, + { + "logId": 51, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 52, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 53, + "loggedType": { + "name": "", + "type": 20, + "typeArguments": [] + } + } + ], + "messagesTypes": [], + "configurables": [ + { + "name": "LIQUIDITY_MINER_FEE", + "configurableType": { + "name": "", + "type": 21, + "typeArguments": null + }, + "offset": 67464 + }, + { + "name": "MINIMUM_LIQUIDITY", + "configurableType": { + "name": "", + "type": 21, + "typeArguments": null + }, + "offset": 67264 + } + ] +} \ No newline at end of file diff --git a/packages/fuel-indexer-tests/trybuild/abi/multisig-contract-abi.json b/packages/fuel-indexer-tests/trybuild/abi/multisig-contract-abi.json new file mode 100644 index 000000000..47d389d15 --- /dev/null +++ b/packages/fuel-indexer-tests/trybuild/abi/multisig-contract-abi.json @@ -0,0 +1,1182 @@ +{ + "types": [ + { + "typeId": 0, + "type": "()", + "components": [], + "typeParameters": null + }, + { + "typeId": 1, + "type": "[_; 2]", + "components": [ + { + "name": "__array_element", + "type": 2, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 2, + "type": "b256", + "components": null, + "typeParameters": null + }, + { + "typeId": 3, + "type": "bool", + "components": null, + "typeParameters": null + }, + { + "typeId": 4, + "type": "enum ExecutionError", + "components": [ + { + "name": "CanOnlyCallContracts", + "type": 0, + "typeArguments": null + }, + { + "name": "IncorrectSignerOrdering", + "type": 0, + "typeArguments": null + }, + { + "name": "InsufficientAssetAmount", + "type": 0, + "typeArguments": null + }, + { + "name": "InsufficientApprovals", + "type": 0, + "typeArguments": null + }, + { + "name": "TransferRequiresAValue", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 5, + "type": "enum Identity", + "components": [ + { + "name": "Address", + "type": 16, + "typeArguments": null + }, + { + "name": "ContractId", + "type": 20, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 6, + "type": "enum InitError", + "components": [ + { + "name": "CannotReinitialize", + "type": 0, + "typeArguments": null + }, + { + "name": "NotInitialized", + "type": 0, + "typeArguments": null + }, + { + "name": "ThresholdCannotBeZero", + "type": 0, + "typeArguments": null + }, + { + "name": "TotalWeightCannotBeLessThanThreshold", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 7, + "type": "enum MessageFormat", + "components": [ + { + "name": "None", + "type": 0, + "typeArguments": null + }, + { + "name": "EIP191PersonalSign", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 8, + "type": "enum MessagePrefix", + "components": [ + { + "name": "None", + "type": 0, + "typeArguments": null + }, + { + "name": "Ethereum", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 9, + "type": "enum Option", + "components": [ + { + "name": "None", + "type": 0, + "typeArguments": null + }, + { + "name": "Some", + "type": 13, + "typeArguments": null + } + ], + "typeParameters": [ + 13 + ] + }, + { + "typeId": 10, + "type": "enum TransactionParameters", + "components": [ + { + "name": "Call", + "type": 19, + "typeArguments": null + }, + { + "name": "Transfer", + "type": 30, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 11, + "type": "enum TypeToHash", + "components": [ + { + "name": "Threshold", + "type": 28, + "typeArguments": null + }, + { + "name": "Transaction", + "type": 29, + "typeArguments": null + }, + { + "name": "Weight", + "type": 33, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 12, + "type": "enum WalletType", + "components": [ + { + "name": "Fuel", + "type": 0, + "typeArguments": null + }, + { + "name": "EVM", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 13, + "type": "generic T", + "components": null, + "typeParameters": null + }, + { + "typeId": 14, + "type": "raw untyped ptr", + "components": null, + "typeParameters": null + }, + { + "typeId": 15, + "type": "str[33]", + "components": null, + "typeParameters": null + }, + { + "typeId": 16, + "type": "struct Address", + "components": [ + { + "name": "value", + "type": 2, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 17, + "type": "struct B512", + "components": [ + { + "name": "bytes", + "type": 1, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 18, + "type": "struct Bytes", + "components": [ + { + "name": "buf", + "type": 23, + "typeArguments": null + }, + { + "name": "len", + "type": 34, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 19, + "type": "struct ContractCallParams", + "components": [ + { + "name": "calldata", + "type": 18, + "typeArguments": null + }, + { + "name": "forwarded_gas", + "type": 34, + "typeArguments": null + }, + { + "name": "function_selector", + "type": 18, + "typeArguments": null + }, + { + "name": "single_value_type_arg", + "type": 3, + "typeArguments": null + }, + { + "name": "transfer_params", + "type": 30, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 20, + "type": "struct ContractId", + "components": [ + { + "name": "value", + "type": 2, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 21, + "type": "struct EvmAddress", + "components": [ + { + "name": "value", + "type": 2, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 22, + "type": "struct ExecuteTransactionEvent", + "components": [ + { + "name": "nonce", + "type": 34, + "typeArguments": null + }, + { + "name": "target", + "type": 5, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 23, + "type": "struct RawBytes", + "components": [ + { + "name": "ptr", + "type": 14, + "typeArguments": null + }, + { + "name": "cap", + "type": 34, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 24, + "type": "struct RawVec", + "components": [ + { + "name": "ptr", + "type": 14, + "typeArguments": null + }, + { + "name": "cap", + "type": 34, + "typeArguments": null + } + ], + "typeParameters": [ + 13 + ] + }, + { + "typeId": 25, + "type": "struct SetThresholdEvent", + "components": [ + { + "name": "previous_threshold", + "type": 34, + "typeArguments": null + }, + { + "name": "threshold", + "type": 34, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 26, + "type": "struct SetWeightEvent", + "components": [ + { + "name": "user", + "type": 31, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 27, + "type": "struct SignatureInfo", + "components": [ + { + "name": "message_format", + "type": 7, + "typeArguments": null + }, + { + "name": "message_prefix", + "type": 8, + "typeArguments": null + }, + { + "name": "signature", + "type": 17, + "typeArguments": null + }, + { + "name": "wallet_type", + "type": 12, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 28, + "type": "struct Threshold", + "components": [ + { + "name": "contract_identifier", + "type": 20, + "typeArguments": null + }, + { + "name": "nonce", + "type": 34, + "typeArguments": null + }, + { + "name": "threshold", + "type": 34, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 29, + "type": "struct Transaction", + "components": [ + { + "name": "contract_identifier", + "type": 20, + "typeArguments": null + }, + { + "name": "nonce", + "type": 34, + "typeArguments": null + }, + { + "name": "target", + "type": 5, + "typeArguments": null + }, + { + "name": "transaction_parameters", + "type": 10, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 30, + "type": "struct TransferParams", + "components": [ + { + "name": "asset_id", + "type": 20, + "typeArguments": null + }, + { + "name": "value", + "type": 9, + "typeArguments": [ + { + "name": "", + "type": 34, + "typeArguments": null + } + ] + } + ], + "typeParameters": null + }, + { + "typeId": 31, + "type": "struct User", + "components": [ + { + "name": "address", + "type": 2, + "typeArguments": null + }, + { + "name": "weight", + "type": 34, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 32, + "type": "struct Vec", + "components": [ + { + "name": "buf", + "type": 24, + "typeArguments": [ + { + "name": "", + "type": 13, + "typeArguments": null + } + ] + }, + { + "name": "len", + "type": 34, + "typeArguments": null + } + ], + "typeParameters": [ + 13 + ] + }, + { + "typeId": 33, + "type": "struct Weight", + "components": [ + { + "name": "contract_identifier", + "type": 20, + "typeArguments": null + }, + { + "name": "nonce", + "type": 34, + "typeArguments": null + }, + { + "name": "user", + "type": 31, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 34, + "type": "u64", + "components": null, + "typeParameters": null + } + ], + "functions": [ + { + "inputs": [ + { + "name": "users", + "type": 32, + "typeArguments": [ + { + "name": "", + "type": 31, + "typeArguments": null + } + ] + } + ], + "name": "constructor", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "signatures", + "type": 32, + "typeArguments": [ + { + "name": "", + "type": 27, + "typeArguments": null + } + ] + }, + { + "name": "target", + "type": 5, + "typeArguments": null + }, + { + "name": "transaction_parameters", + "type": 10, + "typeArguments": null + } + ], + "name": "execute_transaction", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "signatures", + "type": 32, + "typeArguments": [ + { + "name": "", + "type": 27, + "typeArguments": null + } + ] + }, + { + "name": "threshold", + "type": 34, + "typeArguments": null + } + ], + "name": "set_threshold", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "signatures", + "type": 32, + "typeArguments": [ + { + "name": "", + "type": 27, + "typeArguments": null + } + ] + }, + { + "name": "user", + "type": 31, + "typeArguments": null + } + ], + "name": "set_weight", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "user", + "type": 2, + "typeArguments": null + } + ], + "name": "approval_weight", + "output": { + "name": "", + "type": 34, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [ + { + "name": "asset_id", + "type": 20, + "typeArguments": null + } + ], + "name": "balance", + "output": { + "name": "", + "type": 34, + "typeArguments": null + }, + "attributes": null + }, + { + "inputs": [ + { + "name": "type_to_hash", + "type": 11, + "typeArguments": null + } + ], + "name": "compute_hash", + "output": { + "name": "", + "type": 2, + "typeArguments": null + }, + "attributes": null + }, + { + "inputs": [], + "name": "nonce", + "output": { + "name": "", + "type": 34, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [], + "name": "threshold", + "output": { + "name": "", + "type": 34, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + } + ], + "loggedTypes": [ + { + "logId": 0, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 1, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 2, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 3, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 4, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 5, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 6, + "loggedType": { + "name": "", + "type": 16, + "typeArguments": [] + } + }, + { + "logId": 7, + "loggedType": { + "name": "", + "type": 21, + "typeArguments": [] + } + }, + { + "logId": 8, + "loggedType": { + "name": "", + "type": 21, + "typeArguments": [] + } + }, + { + "logId": 9, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 10, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 11, + "loggedType": { + "name": "", + "type": 15, + "typeArguments": null + } + }, + { + "logId": 12, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 13, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 14, + "loggedType": { + "name": "", + "type": 16, + "typeArguments": [] + } + }, + { + "logId": 15, + "loggedType": { + "name": "", + "type": 21, + "typeArguments": [] + } + }, + { + "logId": 16, + "loggedType": { + "name": "", + "type": 21, + "typeArguments": [] + } + }, + { + "logId": 17, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 18, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 19, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 20, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 21, + "loggedType": { + "name": "", + "type": 16, + "typeArguments": [] + } + }, + { + "logId": 22, + "loggedType": { + "name": "", + "type": 21, + "typeArguments": [] + } + }, + { + "logId": 23, + "loggedType": { + "name": "", + "type": 21, + "typeArguments": [] + } + }, + { + "logId": 24, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 25, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 26, + "loggedType": { + "name": "", + "type": 22, + "typeArguments": [] + } + }, + { + "logId": 27, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 28, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 29, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 30, + "loggedType": { + "name": "", + "type": 16, + "typeArguments": [] + } + }, + { + "logId": 31, + "loggedType": { + "name": "", + "type": 21, + "typeArguments": [] + } + }, + { + "logId": 32, + "loggedType": { + "name": "", + "type": 21, + "typeArguments": [] + } + }, + { + "logId": 33, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 34, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 35, + "loggedType": { + "name": "", + "type": 25, + "typeArguments": [] + } + }, + { + "logId": 36, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 37, + "loggedType": { + "name": "", + "type": 16, + "typeArguments": [] + } + }, + { + "logId": 38, + "loggedType": { + "name": "", + "type": 21, + "typeArguments": [] + } + }, + { + "logId": 39, + "loggedType": { + "name": "", + "type": 21, + "typeArguments": [] + } + }, + { + "logId": 40, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 41, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 42, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 43, + "loggedType": { + "name": "", + "type": 26, + "typeArguments": [] + } + } + ], + "messagesTypes": [], + "configurables": [ + { + "name": "THRESHOLD", + "configurableType": { + "name": "", + "type": 34, + "typeArguments": null + }, + "offset": 77108 + } + ] +} \ No newline at end of file diff --git a/packages/fuel-indexer-tests/trybuild/abi/oracle-contract-abi.json b/packages/fuel-indexer-tests/trybuild/abi/oracle-contract-abi.json new file mode 100644 index 000000000..3ecad014f --- /dev/null +++ b/packages/fuel-indexer-tests/trybuild/abi/oracle-contract-abi.json @@ -0,0 +1,200 @@ +{ + "types": [ + { + "typeId": 0, + "type": "()", + "components": [], + "typeParameters": null + }, + { + "typeId": 1, + "type": "b256", + "components": null, + "typeParameters": null + }, + { + "typeId": 2, + "type": "enum AccessError", + "components": [ + { + "name": "NotOwner", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 3, + "type": "enum Identity", + "components": [ + { + "name": "Address", + "type": 6, + "typeArguments": null + }, + { + "name": "ContractId", + "type": 7, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 4, + "type": "enum Option", + "components": [ + { + "name": "None", + "type": 0, + "typeArguments": null + }, + { + "name": "Some", + "type": 5, + "typeArguments": null + } + ], + "typeParameters": [ + 5 + ] + }, + { + "typeId": 5, + "type": "generic T", + "components": null, + "typeParameters": null + }, + { + "typeId": 6, + "type": "struct Address", + "components": [ + { + "name": "value", + "type": 1, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 7, + "type": "struct ContractId", + "components": [ + { + "name": "value", + "type": 1, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 8, + "type": "struct PriceUpdateEvent", + "components": [ + { + "name": "price", + "type": 9, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 9, + "type": "u64", + "components": null, + "typeParameters": null + } + ], + "functions": [ + { + "inputs": [], + "name": "owner", + "output": { + "name": "", + "type": 3, + "typeArguments": null + }, + "attributes": null + }, + { + "inputs": [], + "name": "price", + "output": { + "name": "", + "type": 4, + "typeArguments": [ + { + "name": "", + "type": 9, + "typeArguments": null + } + ] + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [ + { + "name": "price", + "type": 9, + "typeArguments": null + } + ], + "name": "set_price", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "write" + ] + } + ] + } + ], + "loggedTypes": [ + { + "logId": 0, + "loggedType": { + "name": "", + "type": 2, + "typeArguments": [] + } + }, + { + "logId": 1, + "loggedType": { + "name": "", + "type": 8, + "typeArguments": [] + } + } + ], + "messagesTypes": [], + "configurables": [ + { + "name": "OWNER", + "configurableType": { + "name": "", + "type": 3, + "typeArguments": [] + }, + "offset": 2228 + } + ] +} \ No newline at end of file diff --git a/packages/fuel-indexer-tests/trybuild/abi/registry-contract-abi.json b/packages/fuel-indexer-tests/trybuild/abi/registry-contract-abi.json new file mode 100644 index 000000000..92e1ee64d --- /dev/null +++ b/packages/fuel-indexer-tests/trybuild/abi/registry-contract-abi.json @@ -0,0 +1,756 @@ +{ + "types": [ + { + "typeId": 0, + "type": "()", + "components": [], + "typeParameters": null + }, + { + "typeId": 1, + "type": "b256", + "components": null, + "typeParameters": null + }, + { + "typeId": 2, + "type": "enum AssetError", + "components": [ + { + "name": "InsufficientPayment", + "type": 0, + "typeArguments": null + }, + { + "name": "IncorrectAssetSent", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 3, + "type": "enum AuthorizationError", + "components": [ + { + "name": "SenderNotOwner", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 4, + "type": "enum Identity", + "components": [ + { + "name": "Address", + "type": 11, + "typeArguments": null + }, + { + "name": "ContractId", + "type": 13, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 5, + "type": "enum Option", + "components": [ + { + "name": "None", + "type": 0, + "typeArguments": null + }, + { + "name": "Some", + "type": 9, + "typeArguments": null + } + ], + "typeParameters": [ + 9 + ] + }, + { + "typeId": 6, + "type": "enum RegistrationValidityError", + "components": [ + { + "name": "NameNotRegistered", + "type": 0, + "typeArguments": null + }, + { + "name": "NameExpired", + "type": 0, + "typeArguments": null + }, + { + "name": "NameNotExpired", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 7, + "type": "enum Result", + "components": [ + { + "name": "Ok", + "type": 9, + "typeArguments": null + }, + { + "name": "Err", + "type": 8, + "typeArguments": null + } + ], + "typeParameters": [ + 9, + 8 + ] + }, + { + "typeId": 8, + "type": "generic E", + "components": null, + "typeParameters": null + }, + { + "typeId": 9, + "type": "generic T", + "components": null, + "typeParameters": null + }, + { + "typeId": 10, + "type": "str[8]", + "components": null, + "typeParameters": null + }, + { + "typeId": 11, + "type": "struct Address", + "components": [ + { + "name": "value", + "type": 1, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 12, + "type": "struct AssetRateEvent", + "components": [ + { + "name": "id", + "type": 13, + "typeArguments": null + }, + { + "name": "rate", + "type": 5, + "typeArguments": [ + { + "name": "", + "type": 18, + "typeArguments": null + } + ] + } + ], + "typeParameters": null + }, + { + "typeId": 13, + "type": "struct ContractId", + "components": [ + { + "name": "value", + "type": 1, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 14, + "type": "struct IdentityChangedEvent", + "components": [ + { + "name": "name", + "type": 10, + "typeArguments": null + }, + { + "name": "new_identity", + "type": 4, + "typeArguments": null + }, + { + "name": "previous_identity", + "type": 4, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 15, + "type": "struct NameRegisteredEvent", + "components": [ + { + "name": "expiry", + "type": 18, + "typeArguments": null + }, + { + "name": "name", + "type": 10, + "typeArguments": null + }, + { + "name": "owner", + "type": 4, + "typeArguments": null + }, + { + "name": "identity", + "type": 4, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 16, + "type": "struct OwnerChangedEvent", + "components": [ + { + "name": "name", + "type": 10, + "typeArguments": null + }, + { + "name": "new_owner", + "type": 4, + "typeArguments": null + }, + { + "name": "previous_owner", + "type": 4, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 17, + "type": "struct RegistrationExtendedEvent", + "components": [ + { + "name": "duration", + "type": 18, + "typeArguments": null + }, + { + "name": "name", + "type": 10, + "typeArguments": null + }, + { + "name": "new_expiry", + "type": 18, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 18, + "type": "u64", + "components": null, + "typeParameters": null + } + ], + "functions": [ + { + "inputs": [ + { + "name": "name", + "type": 10, + "typeArguments": null + }, + { + "name": "duration", + "type": 18, + "typeArguments": null + }, + { + "name": "payment_asset", + "type": 13, + "typeArguments": null + } + ], + "name": "extend", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "payable", + "arguments": [] + }, + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "name", + "type": 10, + "typeArguments": null + }, + { + "name": "duration", + "type": 18, + "typeArguments": null + }, + { + "name": "owner", + "type": 4, + "typeArguments": null + }, + { + "name": "identity", + "type": 4, + "typeArguments": null + }, + { + "name": "payment_asset", + "type": 13, + "typeArguments": null + } + ], + "name": "register", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "payable", + "arguments": [] + }, + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "id", + "type": 13, + "typeArguments": null + }, + { + "name": "rate", + "type": 5, + "typeArguments": [ + { + "name": "", + "type": 18, + "typeArguments": null + } + ] + } + ], + "name": "set_asset", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "name", + "type": 10, + "typeArguments": null + }, + { + "name": "identity", + "type": 4, + "typeArguments": null + } + ], + "name": "set_identity", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "name", + "type": 10, + "typeArguments": null + }, + { + "name": "owner", + "type": 4, + "typeArguments": null + } + ], + "name": "set_owner", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "name", + "type": 10, + "typeArguments": null + } + ], + "name": "expiry", + "output": { + "name": "", + "type": 7, + "typeArguments": [ + { + "name": "", + "type": 18, + "typeArguments": null + }, + { + "name": "", + "type": 6, + "typeArguments": null + } + ] + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [ + { + "name": "name", + "type": 10, + "typeArguments": null + } + ], + "name": "identity", + "output": { + "name": "", + "type": 7, + "typeArguments": [ + { + "name": "", + "type": 4, + "typeArguments": null + }, + { + "name": "", + "type": 6, + "typeArguments": null + } + ] + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [ + { + "name": "name", + "type": 10, + "typeArguments": null + } + ], + "name": "owner", + "output": { + "name": "", + "type": 7, + "typeArguments": [ + { + "name": "", + "type": 4, + "typeArguments": null + }, + { + "name": "", + "type": 6, + "typeArguments": null + } + ] + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [ + { + "name": "id", + "type": 13, + "typeArguments": null + } + ], + "name": "rate", + "output": { + "name": "", + "type": 5, + "typeArguments": [ + { + "name": "", + "type": 18, + "typeArguments": null + } + ] + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + } + ], + "loggedTypes": [ + { + "logId": 0, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 1, + "loggedType": { + "name": "", + "type": 2, + "typeArguments": [] + } + }, + { + "logId": 2, + "loggedType": { + "name": "", + "type": 2, + "typeArguments": [] + } + }, + { + "logId": 3, + "loggedType": { + "name": "", + "type": 17, + "typeArguments": [] + } + }, + { + "logId": 4, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 5, + "loggedType": { + "name": "", + "type": 2, + "typeArguments": [] + } + }, + { + "logId": 6, + "loggedType": { + "name": "", + "type": 2, + "typeArguments": [] + } + }, + { + "logId": 7, + "loggedType": { + "name": "", + "type": 15, + "typeArguments": [] + } + }, + { + "logId": 8, + "loggedType": { + "name": "", + "type": 3, + "typeArguments": [] + } + }, + { + "logId": 9, + "loggedType": { + "name": "", + "type": 12, + "typeArguments": [] + } + }, + { + "logId": 10, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 11, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 12, + "loggedType": { + "name": "", + "type": 3, + "typeArguments": [] + } + }, + { + "logId": 13, + "loggedType": { + "name": "", + "type": 14, + "typeArguments": [] + } + }, + { + "logId": 14, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 15, + "loggedType": { + "name": "", + "type": 6, + "typeArguments": [] + } + }, + { + "logId": 16, + "loggedType": { + "name": "", + "type": 3, + "typeArguments": [] + } + }, + { + "logId": 17, + "loggedType": { + "name": "", + "type": 16, + "typeArguments": [] + } + } + ], + "messagesTypes": [], + "configurables": [ + { + "name": "OWNER", + "configurableType": { + "name": "", + "type": 4, + "typeArguments": [] + }, + "offset": 12640 + } + ] +} \ No newline at end of file diff --git a/packages/fuel-indexer-tests/trybuild/abi/swap-predicate-abi.json b/packages/fuel-indexer-tests/trybuild/abi/swap-predicate-abi.json new file mode 100644 index 000000000..c39ab0ee0 --- /dev/null +++ b/packages/fuel-indexer-tests/trybuild/abi/swap-predicate-abi.json @@ -0,0 +1,144 @@ +{ + "types": [ + { + "typeId": 0, + "type": "b256", + "components": null, + "typeParameters": null + }, + { + "typeId": 1, + "type": "bool", + "components": null, + "typeParameters": null + }, + { + "typeId": 2, + "type": "struct Address", + "components": [ + { + "name": "value", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 3, + "type": "struct ContractId", + "components": [ + { + "name": "value", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 4, + "type": "u64", + "components": null, + "typeParameters": null + } + ], + "functions": [ + { + "inputs": [], + "name": "main", + "output": { + "name": "", + "type": 1, + "typeArguments": null + }, + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " Validates conditions within the transaction to perform a swap" + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Additional Information" + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " The user can cancel their order by including an input coin from themselves." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Returns" + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * [bool] - `true` if the spender is the receiver or if the terms of the order are met, `false` otherwise." + ] + } + ] + } + ], + "loggedTypes": [], + "messagesTypes": [], + "configurables": [ + { + "name": "ASK_AMOUNT", + "configurableType": { + "name": "", + "type": 4, + "typeArguments": null + }, + "offset": 2292 + }, + { + "name": "ASK_TOKEN", + "configurableType": { + "name": "", + "type": 3, + "typeArguments": [] + }, + "offset": 2300 + }, + { + "name": "RECEIVER", + "configurableType": { + "name": "", + "type": 2, + "typeArguments": [] + }, + "offset": 2252 + } + ] +} \ No newline at end of file diff --git a/packages/fuel-indexer-tests/trybuild/abi/timelock-contract-abi.json b/packages/fuel-indexer-tests/trybuild/abi/timelock-contract-abi.json new file mode 100644 index 000000000..c9a02befc --- /dev/null +++ b/packages/fuel-indexer-tests/trybuild/abi/timelock-contract-abi.json @@ -0,0 +1,701 @@ +{ + "types": [ + { + "typeId": 0, + "type": "()", + "components": [], + "typeParameters": null + }, + { + "typeId": 1, + "type": "(_, _)", + "components": [ + { + "name": "__tuple_element", + "type": 20, + "typeArguments": null + }, + { + "name": "__tuple_element", + "type": 20, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 2, + "type": "(_, _, _)", + "components": [ + { + "name": "__tuple_element", + "type": 20, + "typeArguments": null + }, + { + "name": "__tuple_element", + "type": 20, + "typeArguments": null + }, + { + "name": "__tuple_element", + "type": 20, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 3, + "type": "b256", + "components": null, + "typeParameters": null + }, + { + "typeId": 4, + "type": "enum AccessControlError", + "components": [ + { + "name": "AuthorizationError", + "type": 0, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 5, + "type": "enum FundingError", + "components": [ + { + "name": "InsufficientContractBalance", + "type": 20, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 6, + "type": "enum Identity", + "components": [ + { + "name": "Address", + "type": 11, + "typeArguments": null + }, + { + "name": "ContractId", + "type": 15, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 7, + "type": "enum Option", + "components": [ + { + "name": "None", + "type": 0, + "typeArguments": null + }, + { + "name": "Some", + "type": 9, + "typeArguments": null + } + ], + "typeParameters": [ + 9 + ] + }, + { + "typeId": 8, + "type": "enum TransactionError", + "components": [ + { + "name": "DuplicateTransaction", + "type": 3, + "typeArguments": null + }, + { + "name": "InvalidTransaction", + "type": 3, + "typeArguments": null + }, + { + "name": "TimestampNotInRange", + "type": 2, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 9, + "type": "generic T", + "components": null, + "typeParameters": null + }, + { + "typeId": 10, + "type": "raw untyped ptr", + "components": null, + "typeParameters": null + }, + { + "typeId": 11, + "type": "struct Address", + "components": [ + { + "name": "value", + "type": 3, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 12, + "type": "struct Asset", + "components": [ + { + "name": "amount", + "type": 20, + "typeArguments": null + }, + { + "name": "id", + "type": 15, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 13, + "type": "struct Bytes", + "components": [ + { + "name": "buf", + "type": 19, + "typeArguments": null + }, + { + "name": "len", + "type": 20, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 14, + "type": "struct CancelEvent", + "components": [ + { + "name": "id", + "type": 3, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 15, + "type": "struct ContractId", + "components": [ + { + "name": "value", + "type": 3, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 16, + "type": "struct ExecuteEvent", + "components": [ + { + "name": "asset", + "type": 7, + "typeArguments": [ + { + "name": "", + "type": 12, + "typeArguments": null + } + ] + }, + { + "name": "data", + "type": 7, + "typeArguments": [ + { + "name": "", + "type": 13, + "typeArguments": null + } + ] + }, + { + "name": "id", + "type": 3, + "typeArguments": null + }, + { + "name": "recipient", + "type": 6, + "typeArguments": null + }, + { + "name": "timestamp", + "type": 20, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 17, + "type": "struct ExecutionRange", + "components": [ + { + "name": "start", + "type": 20, + "typeArguments": null + }, + { + "name": "end", + "type": 20, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 18, + "type": "struct QueueEvent", + "components": [ + { + "name": "asset", + "type": 7, + "typeArguments": [ + { + "name": "", + "type": 12, + "typeArguments": null + } + ] + }, + { + "name": "data", + "type": 7, + "typeArguments": [ + { + "name": "", + "type": 13, + "typeArguments": null + } + ] + }, + { + "name": "id", + "type": 3, + "typeArguments": null + }, + { + "name": "recipient", + "type": 6, + "typeArguments": null + }, + { + "name": "timestamp", + "type": 20, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 19, + "type": "struct RawBytes", + "components": [ + { + "name": "ptr", + "type": 10, + "typeArguments": null + }, + { + "name": "cap", + "type": 20, + "typeArguments": null + } + ], + "typeParameters": null + }, + { + "typeId": 20, + "type": "u64", + "components": null, + "typeParameters": null + } + ], + "functions": [ + { + "inputs": [ + { + "name": "id", + "type": 3, + "typeArguments": null + } + ], + "name": "cancel", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "recipient", + "type": 6, + "typeArguments": null + }, + { + "name": "asset", + "type": 7, + "typeArguments": [ + { + "name": "", + "type": 12, + "typeArguments": null + } + ] + }, + { + "name": "data", + "type": 7, + "typeArguments": [ + { + "name": "", + "type": 13, + "typeArguments": null + } + ] + }, + { + "name": "timestamp", + "type": 20, + "typeArguments": null + } + ], + "name": "execute", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "recipient", + "type": 6, + "typeArguments": null + }, + { + "name": "asset", + "type": 7, + "typeArguments": [ + { + "name": "", + "type": 12, + "typeArguments": null + } + ] + }, + { + "name": "data", + "type": 7, + "typeArguments": [ + { + "name": "", + "type": 13, + "typeArguments": null + } + ] + }, + { + "name": "timestamp", + "type": 20, + "typeArguments": null + } + ], + "name": "queue", + "output": { + "name": "", + "type": 0, + "typeArguments": null + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read", + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "asset_id", + "type": 15, + "typeArguments": null + } + ], + "name": "balance", + "output": { + "name": "", + "type": 20, + "typeArguments": null + }, + "attributes": null + }, + { + "inputs": [], + "name": "delays", + "output": { + "name": "", + "type": 1, + "typeArguments": null + }, + "attributes": null + }, + { + "inputs": [ + { + "name": "id", + "type": 3, + "typeArguments": null + } + ], + "name": "queued", + "output": { + "name": "", + "type": 7, + "typeArguments": [ + { + "name": "", + "type": 17, + "typeArguments": null + } + ] + }, + "attributes": [ + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [ + { + "name": "recipient", + "type": 6, + "typeArguments": null + }, + { + "name": "asset", + "type": 7, + "typeArguments": [ + { + "name": "", + "type": 12, + "typeArguments": null + } + ] + }, + { + "name": "data", + "type": 7, + "typeArguments": [ + { + "name": "", + "type": 13, + "typeArguments": null + } + ] + }, + { + "name": "timestamp", + "type": 20, + "typeArguments": null + } + ], + "name": "transaction_hash", + "output": { + "name": "", + "type": 3, + "typeArguments": null + }, + "attributes": null + } + ], + "loggedTypes": [ + { + "logId": 0, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 1, + "loggedType": { + "name": "", + "type": 8, + "typeArguments": [] + } + }, + { + "logId": 2, + "loggedType": { + "name": "", + "type": 14, + "typeArguments": [] + } + }, + { + "logId": 3, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 4, + "loggedType": { + "name": "", + "type": 8, + "typeArguments": [] + } + }, + { + "logId": 5, + "loggedType": { + "name": "", + "type": 8, + "typeArguments": [] + } + }, + { + "logId": 6, + "loggedType": { + "name": "", + "type": 5, + "typeArguments": [] + } + }, + { + "logId": 7, + "loggedType": { + "name": "", + "type": 16, + "typeArguments": [] + } + }, + { + "logId": 8, + "loggedType": { + "name": "", + "type": 4, + "typeArguments": [] + } + }, + { + "logId": 9, + "loggedType": { + "name": "", + "type": 8, + "typeArguments": [] + } + }, + { + "logId": 10, + "loggedType": { + "name": "", + "type": 8, + "typeArguments": [] + } + }, + { + "logId": 11, + "loggedType": { + "name": "", + "type": 18, + "typeArguments": [] + } + } + ], + "messagesTypes": [], + "configurables": [ + { + "name": "MAXIMUM_DELAY", + "configurableType": { + "name": "", + "type": 20, + "typeArguments": null + }, + "offset": 9060 + }, + { + "name": "MINIMUM_DELAY", + "configurableType": { + "name": "", + "type": 20, + "typeArguments": null + }, + "offset": 9052 + }, + { + "name": "ADMIN", + "configurableType": { + "name": "", + "type": 6, + "typeArguments": [] + }, + "offset": 8900 + } + ] +} \ No newline at end of file diff --git a/packages/fuel-indexer-tests/trybuild/invalid_abi_type_simple_wasm.yaml b/packages/fuel-indexer-tests/trybuild/invalid_abi_type_simple_wasm.yaml index 374a79f92..767984310 100644 --- a/packages/fuel-indexer-tests/trybuild/invalid_abi_type_simple_wasm.yaml +++ b/packages/fuel-indexer-tests/trybuild/invalid_abi_type_simple_wasm.yaml @@ -1,8 +1,8 @@ - namespace: test_namespace - identifier: simple_wasm_executor - abi: /Users/rashad/dev/repos/fuel-indexer/packages/fuel-indexer-tests/contracts/simple-wasm/out/debug/contracts-abi-reserved-name.json - graphql_schema: /Users/rashad/dev/repos/fuel-indexer/packages/fuel-indexer-tests/indexers/simple-wasm/schema/simple_wasm.graphql - contract_id: ~ - module: - wasm: /Users/rashad/dev/repos/fuel-indexer/target/wasm32-unknown-unknown/release/simple_wasm.wasm \ No newline at end of file +namespace: test_namespace +identifier: simple_wasm_executor +abi: /Users/rashad/dev/repos/fuel-indexer/packages/fuel-indexer-tests/trybuild/abi/contracts-abi-reserved-name.json +graphql_schema: /Users/rashad/dev/repos/fuel-indexer/packages/fuel-indexer-tests/indexers/simple-wasm/schema/simple_wasm.graphql +contract_id: ~ +module: + wasm: /Users/rashad/dev/repos/fuel-indexer/target/wasm32-unknown-unknown/release/simple_wasm.wasm \ No newline at end of file diff --git a/packages/fuel-indexer-tests/trybuild/pass_if_indexer_is_valid_multi_type.rs b/packages/fuel-indexer-tests/trybuild/pass_if_indexer_is_valid_multi_type.rs index 7a6196747..9b5c3678d 100644 --- a/packages/fuel-indexer-tests/trybuild/pass_if_indexer_is_valid_multi_type.rs +++ b/packages/fuel-indexer-tests/trybuild/pass_if_indexer_is_valid_multi_type.rs @@ -13,7 +13,7 @@ fn ff_put_many_to_many_record(_inp: ()) {} #[no_mangle] fn ff_early_exit(_inp: ()) {} -#[indexer(manifest = "packages/fuel-indexer-tests/trybuild/simple_wasm.yaml")] +#[indexer(manifest = "packages/fuel-indexer-tests/trybuild/simple_wasm_multi.yaml")] mod indexer { fn function_one(event: SomeEvent) { let SomeEvent { id, account } = event; diff --git a/packages/fuel-indexer-tests/trybuild/pass_if_indexer_is_valid_single_type.rs b/packages/fuel-indexer-tests/trybuild/pass_if_indexer_is_valid_single_type.rs index c097f1e24..2cb61b371 100644 --- a/packages/fuel-indexer-tests/trybuild/pass_if_indexer_is_valid_single_type.rs +++ b/packages/fuel-indexer-tests/trybuild/pass_if_indexer_is_valid_single_type.rs @@ -13,7 +13,7 @@ fn ff_put_many_to_many_record(_inp: ()) {} #[no_mangle] fn ff_early_exit(_inp: ()) {} -#[indexer(manifest = "packages/fuel-indexer-tests/trybuild/simple_wasm.yaml")] +#[indexer(manifest = "packages/fuel-indexer-tests/trybuild/simple_wasm_single.yaml")] mod indexer { fn function_one(event: SomeEvent) { let SomeEvent { id, account } = event; diff --git a/packages/fuel-indexer-tests/trybuild/pass_if_unsupported_types_are_used.rs b/packages/fuel-indexer-tests/trybuild/pass_if_unsupported_types_are_used.rs index bcc01f01b..f7e98ceae 100644 --- a/packages/fuel-indexer-tests/trybuild/pass_if_unsupported_types_are_used.rs +++ b/packages/fuel-indexer-tests/trybuild/pass_if_unsupported_types_are_used.rs @@ -13,7 +13,7 @@ fn ff_put_many_to_many_record(_inp: ()) {} #[no_mangle] fn ff_early_exit(_inp: ()) {} -#[indexer(manifest = "packages/fuel-indexer-tests/trybuild/simple_wasm.yaml")] +#[indexer(manifest = "packages/fuel-indexer-tests/trybuild/simple_wasm_unsupported.yaml")] mod indexer { fn function_one(event: SomeEvent) { let SomeEvent { id, account } = event; @@ -24,78 +24,6 @@ mod indexer { } fn main() { - use fuels::core::codec::ABIEncoder; - - let s1 = SomeEvent { - id: 9, - account: Bits256([48u8; 32]), - }; - - let encoded1 = ABIEncoder::encode(&[s1.into_token()]).expect("Failed compile test"); - let bytes1 = encoded1.resolve(0); - - let data: Vec = vec![BlockData { - id: [0u8; 32].into(), - time: 1, - producer: None, - height: 0, - consensus: fuel::Consensus::default(), - header: fuel::Header { - id: [0u8; 32].into(), - da_height: 1, - transactions_count: 1, - message_receipt_count: 1, - transactions_root: [0u8; 32].into(), - height: 1, - prev_root: [0u8; 32].into(), - time: 1, - application_hash: [0u8; 32].into(), - message_receipt_root: [0u8; 32].into(), - }, - transactions: vec![fuel::TransactionData { - id: [0u8; 32].into(), - status: fuel::TransactionStatus::default(), - receipts: vec![ - fuel::Receipt::Call { - id: [0u8; 32].into(), - to: [0u8; 32].into(), - amount: 400, - asset_id: [0u8; 32].into(), - gas: 4, - param1: 2048508220, - param2: 0, - pc: 0, - is: 0, - }, - fuel::Receipt::ReturnData { - id: [0u8; 32].into(), - ptr: 2342143, - len: bytes1.len() as u64, - digest: [0u8; 32].into(), - data: Some(bytes1), - pc: 0, - is: 0, - }, - fuel::Receipt::Call { - id: [0u8; 32].into(), - to: [0u8; 32].into(), - amount: 400, - asset_id: [0u8; 32].into(), - gas: 4, - param1: 2379805026, - param2: 0, - pc: 0, - is: 0, - }, - ], - transaction: fuel::Transaction::default(), - }], - }]; - - let mut bytes = serialize(&data); - - let ptr = bytes.as_mut_ptr(); - let len = bytes.len(); - - handle_events(ptr, len); + // We're not actually testing the serialization of the event from the ABI JSON here, + // we're just testing that this compiles. } diff --git a/packages/fuel-indexer-tests/trybuild/pass_if_using_swap_predicate_abi.rs b/packages/fuel-indexer-tests/trybuild/pass_if_using_swap_predicate_abi.rs new file mode 100644 index 000000000..6c7bf4527 --- /dev/null +++ b/packages/fuel-indexer-tests/trybuild/pass_if_using_swap_predicate_abi.rs @@ -0,0 +1,24 @@ +extern crate alloc; +use fuel_indexer_utils::prelude::*; + +#[no_mangle] +fn ff_log_data(_inp: ()) {} + +#[no_mangle] +fn ff_put_object(_inp: ()) {} + +#[no_mangle] +fn ff_put_many_to_many_record(_inp: ()) {} + +#[no_mangle] +fn ff_early_exit(_inp: ()) {} + +#[indexer(manifest = "packages/fuel-indexer-tests/trybuild/predicate_abi.yaml")] +mod indexer { + fn function_one(_event: BlockData) {} +} + +fn main() { + // We're not actually testing the serialization of the event from the ABI JSON here, + // we're just testing that this compiles. +} diff --git a/packages/fuel-indexer-tests/trybuild/pass_if_using_sway_amm_abi.rs b/packages/fuel-indexer-tests/trybuild/pass_if_using_sway_amm_abi.rs new file mode 100644 index 000000000..40814e07e --- /dev/null +++ b/packages/fuel-indexer-tests/trybuild/pass_if_using_sway_amm_abi.rs @@ -0,0 +1,24 @@ +extern crate alloc; +use fuel_indexer_utils::prelude::*; + +#[no_mangle] +fn ff_log_data(_inp: ()) {} + +#[no_mangle] +fn ff_put_object(_inp: ()) {} + +#[no_mangle] +fn ff_put_many_to_many_record(_inp: ()) {} + +#[no_mangle] +fn ff_early_exit(_inp: ()) {} + +#[indexer(manifest = "packages/fuel-indexer-tests/trybuild/sway_amm.yaml")] +mod indexer { + fn function_one(_event: RegisterPoolEvent) {} +} + +fn main() { + // We're not actually testing the serialization of the event from the ABI JSON here, + // we're just testing that this compiles. +} diff --git a/packages/fuel-indexer-tests/trybuild/pass_if_using_sway_asset_contract_abi.rs b/packages/fuel-indexer-tests/trybuild/pass_if_using_sway_asset_contract_abi.rs new file mode 100644 index 000000000..ebb5aa9d6 --- /dev/null +++ b/packages/fuel-indexer-tests/trybuild/pass_if_using_sway_asset_contract_abi.rs @@ -0,0 +1,24 @@ +extern crate alloc; +use fuel_indexer_utils::prelude::*; + +#[no_mangle] +fn ff_log_data(_inp: ()) {} + +#[no_mangle] +fn ff_put_object(_inp: ()) {} + +#[no_mangle] +fn ff_put_many_to_many_record(_inp: ()) {} + +#[no_mangle] +fn ff_early_exit(_inp: ()) {} + +#[indexer(manifest = "packages/fuel-indexer-tests/trybuild/asset_contract.yaml")] +mod indexer { + fn function_one(_event: AccessError) {} +} + +fn main() { + // We're not actually testing the serialization of the event from the ABI JSON here, + // we're just testing that this compiles. +} diff --git a/packages/fuel-indexer-tests/trybuild/pass_if_using_sway_dao_abi.rs b/packages/fuel-indexer-tests/trybuild/pass_if_using_sway_dao_abi.rs new file mode 100644 index 000000000..321ca6dfb --- /dev/null +++ b/packages/fuel-indexer-tests/trybuild/pass_if_using_sway_dao_abi.rs @@ -0,0 +1,24 @@ +extern crate alloc; +use fuel_indexer_utils::prelude::*; + +#[no_mangle] +fn ff_log_data(_inp: ()) {} + +#[no_mangle] +fn ff_put_object(_inp: ()) {} + +#[no_mangle] +fn ff_put_many_to_many_record(_inp: ()) {} + +#[no_mangle] +fn ff_early_exit(_inp: ()) {} + +#[indexer(manifest = "packages/fuel-indexer-tests/trybuild/sway_dao.yaml")] +mod indexer { + fn function_one(_event: CreateProposalEvent) {} +} + +fn main() { + // We're not actually testing the serialization of the event from the ABI JSON here, + // we're just testing that this compiles. +} diff --git a/packages/fuel-indexer-tests/trybuild/pass_if_using_sway_distributor_contract_abi.rs b/packages/fuel-indexer-tests/trybuild/pass_if_using_sway_distributor_contract_abi.rs new file mode 100644 index 000000000..29db1c0e1 --- /dev/null +++ b/packages/fuel-indexer-tests/trybuild/pass_if_using_sway_distributor_contract_abi.rs @@ -0,0 +1,24 @@ +extern crate alloc; +use fuel_indexer_utils::prelude::*; + +#[no_mangle] +fn ff_log_data(_inp: ()) {} + +#[no_mangle] +fn ff_put_object(_inp: ()) {} + +#[no_mangle] +fn ff_put_many_to_many_record(_inp: ()) {} + +#[no_mangle] +fn ff_early_exit(_inp: ()) {} + +#[indexer(manifest = "packages/fuel-indexer-tests/trybuild/distributor_contract.yaml")] +mod indexer { + fn function_one(_event: ClaimEvent) {} +} + +fn main() { + // We're not actually testing the serialization of the event from the ABI JSON here, + // we're just testing that this compiles. +} diff --git a/packages/fuel-indexer-tests/trybuild/pass_if_using_sway_escrow_contract_abi.rs b/packages/fuel-indexer-tests/trybuild/pass_if_using_sway_escrow_contract_abi.rs new file mode 100644 index 000000000..b4b364a1f --- /dev/null +++ b/packages/fuel-indexer-tests/trybuild/pass_if_using_sway_escrow_contract_abi.rs @@ -0,0 +1,24 @@ +extern crate alloc; +use fuel_indexer_utils::prelude::*; + +#[no_mangle] +fn ff_log_data(_inp: ()) {} + +#[no_mangle] +fn ff_put_object(_inp: ()) {} + +#[no_mangle] +fn ff_put_many_to_many_record(_inp: ()) {} + +#[no_mangle] +fn ff_early_exit(_inp: ()) {} + +#[indexer(manifest = "packages/fuel-indexer-tests/trybuild/escrow_contract.yaml")] +mod indexer { + fn function_one(_event: AcceptedArbiterEvent) {} +} + +fn main() { + // We're not actually testing the serialization of the event from the ABI JSON here, + // we're just testing that this compiles. +} diff --git a/packages/fuel-indexer-tests/trybuild/pass_if_using_sway_multisig_contract_abi.rs b/packages/fuel-indexer-tests/trybuild/pass_if_using_sway_multisig_contract_abi.rs new file mode 100644 index 000000000..ead824400 --- /dev/null +++ b/packages/fuel-indexer-tests/trybuild/pass_if_using_sway_multisig_contract_abi.rs @@ -0,0 +1,24 @@ +extern crate alloc; +use fuel_indexer_utils::prelude::*; + +#[no_mangle] +fn ff_log_data(_inp: ()) {} + +#[no_mangle] +fn ff_put_object(_inp: ()) {} + +#[no_mangle] +fn ff_put_many_to_many_record(_inp: ()) {} + +#[no_mangle] +fn ff_early_exit(_inp: ()) {} + +#[indexer(manifest = "packages/fuel-indexer-tests/trybuild/multisig_contract.yaml")] +mod indexer { + fn function_one(_event: SignatureInfo) {} +} + +fn main() { + // We're not actually testing the serialization of the event from the ABI JSON here, + // we're just testing that this compiles. +} diff --git a/packages/fuel-indexer-tests/trybuild/pass_if_using_sway_oracle_contract_abi.rs b/packages/fuel-indexer-tests/trybuild/pass_if_using_sway_oracle_contract_abi.rs new file mode 100644 index 000000000..7c27adcbf --- /dev/null +++ b/packages/fuel-indexer-tests/trybuild/pass_if_using_sway_oracle_contract_abi.rs @@ -0,0 +1,24 @@ +extern crate alloc; +use fuel_indexer_utils::prelude::*; + +#[no_mangle] +fn ff_log_data(_inp: ()) {} + +#[no_mangle] +fn ff_put_object(_inp: ()) {} + +#[no_mangle] +fn ff_put_many_to_many_record(_inp: ()) {} + +#[no_mangle] +fn ff_early_exit(_inp: ()) {} + +#[indexer(manifest = "packages/fuel-indexer-tests/trybuild/oracle_contract.yaml")] +mod indexer { + fn function_one(_event: PriceUpdateEvent) {} +} + +fn main() { + // We're not actually testing the serialization of the event from the ABI JSON here, + // we're just testing that this compiles. +} diff --git a/packages/fuel-indexer-tests/trybuild/pass_if_using_sway_registry_contract_abi.rs b/packages/fuel-indexer-tests/trybuild/pass_if_using_sway_registry_contract_abi.rs new file mode 100644 index 000000000..4bfdafe7d --- /dev/null +++ b/packages/fuel-indexer-tests/trybuild/pass_if_using_sway_registry_contract_abi.rs @@ -0,0 +1,24 @@ +extern crate alloc; +use fuel_indexer_utils::prelude::*; + +#[no_mangle] +fn ff_log_data(_inp: ()) {} + +#[no_mangle] +fn ff_put_object(_inp: ()) {} + +#[no_mangle] +fn ff_put_many_to_many_record(_inp: ()) {} + +#[no_mangle] +fn ff_early_exit(_inp: ()) {} + +#[indexer(manifest = "packages/fuel-indexer-tests/trybuild/registry_contract.yaml")] +mod indexer { + fn function_one(_event: AssetRateEvent) {} +} + +fn main() { + // We're not actually testing the serialization of the event from the ABI JSON here, + // we're just testing that this compiles. +} diff --git a/packages/fuel-indexer-tests/trybuild/pass_if_using_timelock_contract_abi.rs b/packages/fuel-indexer-tests/trybuild/pass_if_using_timelock_contract_abi.rs new file mode 100644 index 000000000..197f14923 --- /dev/null +++ b/packages/fuel-indexer-tests/trybuild/pass_if_using_timelock_contract_abi.rs @@ -0,0 +1,24 @@ +extern crate alloc; +use fuel_indexer_utils::prelude::*; + +#[no_mangle] +fn ff_log_data(_inp: ()) {} + +#[no_mangle] +fn ff_put_object(_inp: ()) {} + +#[no_mangle] +fn ff_put_many_to_many_record(_inp: ()) {} + +#[no_mangle] +fn ff_early_exit(_inp: ()) {} + +#[indexer(manifest = "packages/fuel-indexer-tests/trybuild/timelock_contract.yaml")] +mod indexer { + fn function_one(_event: ExecuteEvent) {} +} + +fn main() { + // We're not actually testing the serialization of the event from the ABI JSON here, + // we're just testing that this compiles. +} diff --git a/packages/fuel-indexer-tests/trybuild/pass_is_using_sway_exchange_contract_abi.rs b/packages/fuel-indexer-tests/trybuild/pass_is_using_sway_exchange_contract_abi.rs new file mode 100644 index 000000000..b21bcd47d --- /dev/null +++ b/packages/fuel-indexer-tests/trybuild/pass_is_using_sway_exchange_contract_abi.rs @@ -0,0 +1,24 @@ +extern crate alloc; +use fuel_indexer_utils::prelude::*; + +#[no_mangle] +fn ff_log_data(_inp: ()) {} + +#[no_mangle] +fn ff_put_object(_inp: ()) {} + +#[no_mangle] +fn ff_put_many_to_many_record(_inp: ()) {} + +#[no_mangle] +fn ff_early_exit(_inp: ()) {} + +#[indexer(manifest = "packages/fuel-indexer-tests/trybuild/exchange_contract.yaml")] +mod indexer { + fn function_one(_event: AddLiquidityEvent) {} +} + +fn main() { + // We're not actually testing the serialization of the event from the ABI JSON here, + // we're just testing that this compiles. +} diff --git a/packages/fuel-indexer-types/src/lib.rs b/packages/fuel-indexer-types/src/lib.rs index 0decb6742..b99bfe746 100644 --- a/packages/fuel-indexer-types/src/lib.rs +++ b/packages/fuel-indexer-types/src/lib.rs @@ -11,7 +11,7 @@ pub use fuels::{ core::codec::try_from_bytes, types::{ bech32::{Bech32Address, Bech32ContractId}, - Bits256, Identity, SizedAsciiString, + Bits256, EvmAddress, Identity, SizedAsciiString, B512, }, }; diff --git a/packages/fuel-indexer-types/src/scalar.rs b/packages/fuel-indexer-types/src/scalar.rs index 684dc0cb4..468246f9f 100644 --- a/packages/fuel-indexer-types/src/scalar.rs +++ b/packages/fuel-indexer-types/src/scalar.rs @@ -7,6 +7,9 @@ use fuels::types::SizedAsciiString; use serde::{Deserialize, Serialize}; use tai64::Tai64; +/// Scalar for 256-bit value. +pub type B256 = [u8; 32]; + /// Scalar for 32-byte unique ID payloads. pub type UID = SizedAsciiString<64>;