Closed yuunlimm closed 1 month ago
Added a feature to add a mapping function for any scripted txn to its file name. This is used by the CLI command within the intergation-test repo to generate expected db output.
rust code it generates looks like below:
pub const IMPORTED_MAINNET_TXNS_123123_TEST_ACTIVITY: &[u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/json_transactions/imported_mainnet_txns/123123_test_activity.json")); pub const IMPORTED_MAINNET_TXNS_308783012_FA_TRANSFER: &[u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/json_transactions/imported_mainnet_txns/308783012_fa_transfer.json")); pub const ALL_IMPORTED_MAINNET_TXNS: &[&[u8]] = &[IMPORTED_MAINNET_TXNS_123123_TEST_ACTIVITY,IMPORTED_MAINNET_TXNS_308783012_FA_TRANSFER,]; pub const IMPORTED_TESTNET_TXNS_5979639459_COIN_REGISTER: &[u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/json_transactions/imported_testnet_txns/5979639459_coin_register.json")); pub const IMPORTED_TESTNET_TXNS_1255836496_V2_FA_METADATA_: &[u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/json_transactions/imported_testnet_txns/1255836496_v2_fa_metadata_.json")); pub const IMPORTED_TESTNET_TXNS_5992795934_FA_ACTIVITIES: &[u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/json_transactions/imported_testnet_txns/5992795934_fa_activities.json")); pub const IMPORTED_TESTNET_TXNS_278556781_V1_COIN_REGISTER_FA_METADATA: &[u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/json_transactions/imported_testnet_txns/278556781_v1_coin_register_fa_metadata.json")); pub const IMPORTED_TESTNET_TXNS_5523474016_VALIDATOR_TXN: &[u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/json_transactions/imported_testnet_txns/5523474016_validator_txn.json")); pub const IMPORTED_TESTNET_TXNS_1_GENESIS: &[u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/json_transactions/imported_testnet_txns/1_genesis.json")); pub const ALL_IMPORTED_TESTNET_TXNS: &[&[u8]] = &[IMPORTED_TESTNET_TXNS_5979639459_COIN_REGISTER,IMPORTED_TESTNET_TXNS_1255836496_V2_FA_METADATA_,IMPORTED_TESTNET_TXNS_5992795934_FA_ACTIVITIES,IMPORTED_TESTNET_TXNS_278556781_V1_COIN_REGISTER_FA_METADATA,IMPORTED_TESTNET_TXNS_5523474016_VALIDATOR_TXN,IMPORTED_TESTNET_TXNS_1_GENESIS,]; pub const SCRIPTED_TRANSACTIONS_SIMPLE_USER_SCRIPT4: &[u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/json_transactions/scripted_transactions/simple_user_script4.json")); pub const SCRIPTED_TRANSACTIONS_SIMPLE_USER_SCRIPT2: &[u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/json_transactions/scripted_transactions/simple_user_script2.json")); pub const SCRIPTED_TRANSACTIONS_SIMPLE_USER_SCRIPT3: &[u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/json_transactions/scripted_transactions/simple_user_script3.json")); pub const SCRIPTED_TRANSACTIONS_SIMPLE_USER_SCRIPT1: &[u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/json_transactions/scripted_transactions/simple_user_script1.json")); pub const ALL_SCRIPTED_TRANSACTIONS: &[&[u8]] = &[SCRIPTED_TRANSACTIONS_SIMPLE_USER_SCRIPT4,SCRIPTED_TRANSACTIONS_SIMPLE_USER_SCRIPT2,SCRIPTED_TRANSACTIONS_SIMPLE_USER_SCRIPT3,SCRIPTED_TRANSACTIONS_SIMPLE_USER_SCRIPT1,]; pub fn get_transaction_name(const_data: &[u8]) -> Option<&'static str> { match const_data { SCRIPTED_TRANSACTIONS_SIMPLE_USER_SCRIPT4 => Some("simple_user_script4"), SCRIPTED_TRANSACTIONS_SIMPLE_USER_SCRIPT2 => Some("simple_user_script2"), SCRIPTED_TRANSACTIONS_SIMPLE_USER_SCRIPT3 => Some("simple_user_script3"), SCRIPTED_TRANSACTIONS_SIMPLE_USER_SCRIPT1 => Some("simple_user_script1"), _ => None, } }
Description
Added a feature to add a mapping function for any scripted txn to its file name. This is used by the CLI command within the intergation-test repo to generate expected db output.
rust code it generates looks like below: