From 0036d0a784d868a9d41b10873150b1c302df0302 Mon Sep 17 00:00:00 2001 From: 21Chani Date: Tue, 1 Apr 2025 06:19:01 -0300 Subject: [PATCH 1/7] feat: convert string struct to object --- src/types/extractor/struct.ts | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/types/extractor/struct.ts diff --git a/src/types/extractor/struct.ts b/src/types/extractor/struct.ts new file mode 100644 index 0000000..92bd8f2 --- /dev/null +++ b/src/types/extractor/struct.ts @@ -0,0 +1,35 @@ +import { ABIRoot, ABIStruct } from '../abi.js'; +import { MovePrimitivesMap } from '../moveTypes.js'; + +// ===================================================== +// DEFINED TYPES +// ===================================================== + +// ==================================================== +// STRUCTS +// ==================================================== + +export type ExtractStructName< + ABI extends ABIRoot, + FunctionName extends string, +> = + | `0x1::object::Object<${ABI['address']}::${ABI['name']}::${FunctionName}>` + | `${ABI['address']}::${ABI['name']}::${FunctionName}`; + +// Extracts a raw Struct from the ABI structs array by its name. +export type ExtractStruct< + Abi extends ABIRoot, + T extends Abi['structs'][number]['name'], +> = Extract; + +// Convert a raw Struct from abi to an object with its fields and parsed object types +export type ConvertedStruct = { + [K in T['fields'][number] as K['name']]: K['type'] extends keyof MovePrimitivesMap + ? MovePrimitivesMap[K['type']] // Non Struct Types + : K['type'] extends ExtractStructName + ? StructName extends ABI['structs'][number]['name'] + ? // Transformed 0x1::object::Object<0x1::coin::CustomStruct> to object. + ConvertedStruct> + : never + : never; +}; From 6f49943feca16b799c0c4add88c3bae7bab63fa8 Mon Sep 17 00:00:00 2001 From: 21Chani Date: Tue, 1 Apr 2025 06:19:12 -0300 Subject: [PATCH 2/7] feat: fungible_asset abi --- src/abi/fungible_asset.ts | 1036 +++++++++++++++++++++++++++++++++++++ 1 file changed, 1036 insertions(+) create mode 100644 src/abi/fungible_asset.ts diff --git a/src/abi/fungible_asset.ts b/src/abi/fungible_asset.ts new file mode 100644 index 0000000..48c417e --- /dev/null +++ b/src/abi/fungible_asset.ts @@ -0,0 +1,1036 @@ +export const FUNGIBLE_ASSET = { + address: '0x1', + name: 'fungible_asset', + friends: [ + '0x1::aptos_account', + '0x1::coin', + '0x1::dispatchable_fungible_asset', + '0x1::governed_gas_pool', + '0x1::primary_fungible_store', + ], + exposed_functions: [ + { + name: 'add_fungibility', + visibility: 'public', + is_entry: false, + is_view: false, + generic_type_params: [], + params: [ + '&0x1::object::ConstructorRef', + '0x1::option::Option', + '0x1::string::String', + '0x1::string::String', + 'u8', + '0x1::string::String', + '0x1::string::String', + ], + return: ['0x1::object::Object<0x1::fungible_asset::Metadata>'], + }, + { + name: 'address_burn_from', + visibility: 'friend', + is_entry: false, + is_view: false, + generic_type_params: [], + params: ['&0x1::fungible_asset::BurnRef', 'address', 'u64'], + return: [], + }, + { + name: 'amount', + visibility: 'public', + is_entry: false, + is_view: false, + generic_type_params: [], + params: ['&0x1::fungible_asset::FungibleAsset'], + return: ['u64'], + }, + { + name: 'asset_metadata', + visibility: 'public', + is_entry: false, + is_view: false, + generic_type_params: [], + params: ['&0x1::fungible_asset::FungibleAsset'], + return: ['0x1::object::Object<0x1::fungible_asset::Metadata>'], + }, + { + name: 'balance', + visibility: 'public', + is_entry: false, + is_view: true, + generic_type_params: [ + { + constraints: ['key'], + }, + ], + params: ['0x1::object::Object'], + return: ['u64'], + }, + { + name: 'burn', + visibility: 'public', + is_entry: false, + is_view: false, + generic_type_params: [], + params: [ + '&0x1::fungible_asset::BurnRef', + '0x1::fungible_asset::FungibleAsset', + ], + return: [], + }, + { + name: 'burn_from', + visibility: 'public', + is_entry: false, + is_view: false, + generic_type_params: [ + { + constraints: ['key'], + }, + ], + params: [ + '&0x1::fungible_asset::BurnRef', + '0x1::object::Object', + 'u64', + ], + return: [], + }, + { + name: 'burn_internal', + visibility: 'friend', + is_entry: false, + is_view: false, + generic_type_params: [], + params: ['0x1::fungible_asset::FungibleAsset'], + return: ['u64'], + }, + { + name: 'burn_ref_metadata', + visibility: 'public', + is_entry: false, + is_view: false, + generic_type_params: [], + params: ['&0x1::fungible_asset::BurnRef'], + return: ['0x1::object::Object<0x1::fungible_asset::Metadata>'], + }, + { + name: 'create_store', + visibility: 'public', + is_entry: false, + is_view: false, + generic_type_params: [ + { + constraints: ['key'], + }, + ], + params: ['&0x1::object::ConstructorRef', '0x1::object::Object'], + return: ['0x1::object::Object<0x1::fungible_asset::FungibleStore>'], + }, + { + name: 'decimals', + visibility: 'public', + is_entry: false, + is_view: true, + generic_type_params: [ + { + constraints: ['key'], + }, + ], + params: ['0x1::object::Object'], + return: ['u8'], + }, + { + name: 'deposit', + visibility: 'public', + is_entry: false, + is_view: false, + generic_type_params: [ + { + constraints: ['key'], + }, + ], + params: ['0x1::object::Object', '0x1::fungible_asset::FungibleAsset'], + return: [], + }, + { + name: 'deposit_dispatch_function', + visibility: 'public', + is_entry: false, + is_view: false, + generic_type_params: [ + { + constraints: ['key'], + }, + ], + params: ['0x1::object::Object'], + return: ['0x1::option::Option<0x1::function_info::FunctionInfo>'], + }, + { + name: 'deposit_internal', + visibility: 'friend', + is_entry: false, + is_view: false, + generic_type_params: [], + params: ['address', '0x1::fungible_asset::FungibleAsset'], + return: [], + }, + { + name: 'deposit_sanity_check', + visibility: 'public', + is_entry: false, + is_view: false, + generic_type_params: [ + { + constraints: ['key'], + }, + ], + params: ['0x1::object::Object', 'bool'], + return: [], + }, + { + name: 'deposit_with_ref', + visibility: 'public', + is_entry: false, + is_view: false, + generic_type_params: [ + { + constraints: ['key'], + }, + ], + params: [ + '&0x1::fungible_asset::TransferRef', + '0x1::object::Object', + '0x1::fungible_asset::FungibleAsset', + ], + return: [], + }, + { + name: 'derived_balance_dispatch_function', + visibility: 'friend', + is_entry: false, + is_view: false, + generic_type_params: [ + { + constraints: ['key'], + }, + ], + params: ['0x1::object::Object'], + return: ['0x1::option::Option<0x1::function_info::FunctionInfo>'], + }, + { + name: 'destroy_zero', + visibility: 'public', + is_entry: false, + is_view: false, + generic_type_params: [], + params: ['0x1::fungible_asset::FungibleAsset'], + return: [], + }, + { + name: 'extract', + visibility: 'public', + is_entry: false, + is_view: false, + generic_type_params: [], + params: ['&mut 0x1::fungible_asset::FungibleAsset', 'u64'], + return: ['0x1::fungible_asset::FungibleAsset'], + }, + { + name: 'generate_burn_ref', + visibility: 'public', + is_entry: false, + is_view: false, + generic_type_params: [], + params: ['&0x1::object::ConstructorRef'], + return: ['0x1::fungible_asset::BurnRef'], + }, + { + name: 'generate_mint_ref', + visibility: 'public', + is_entry: false, + is_view: false, + generic_type_params: [], + params: ['&0x1::object::ConstructorRef'], + return: ['0x1::fungible_asset::MintRef'], + }, + { + name: 'generate_mutate_metadata_ref', + visibility: 'public', + is_entry: false, + is_view: false, + generic_type_params: [], + params: ['&0x1::object::ConstructorRef'], + return: ['0x1::fungible_asset::MutateMetadataRef'], + }, + { + name: 'generate_transfer_ref', + visibility: 'public', + is_entry: false, + is_view: false, + generic_type_params: [], + params: ['&0x1::object::ConstructorRef'], + return: ['0x1::fungible_asset::TransferRef'], + }, + { + name: 'icon_uri', + visibility: 'public', + is_entry: false, + is_view: true, + generic_type_params: [ + { + constraints: ['key'], + }, + ], + params: ['0x1::object::Object'], + return: ['0x1::string::String'], + }, + { + name: 'is_address_balance_at_least', + visibility: 'friend', + is_entry: false, + is_view: false, + generic_type_params: [], + params: ['address', 'u64'], + return: ['bool'], + }, + { + name: 'is_balance_at_least', + visibility: 'public', + is_entry: false, + is_view: true, + generic_type_params: [ + { + constraints: ['key'], + }, + ], + params: ['0x1::object::Object', 'u64'], + return: ['bool'], + }, + { + name: 'is_frozen', + visibility: 'public', + is_entry: false, + is_view: true, + generic_type_params: [ + { + constraints: ['key'], + }, + ], + params: ['0x1::object::Object'], + return: ['bool'], + }, + { + name: 'is_store_dispatchable', + visibility: 'public', + is_entry: false, + is_view: true, + generic_type_params: [ + { + constraints: ['key'], + }, + ], + params: ['0x1::object::Object'], + return: ['bool'], + }, + { + name: 'is_untransferable', + visibility: 'public', + is_entry: false, + is_view: true, + generic_type_params: [ + { + constraints: ['key'], + }, + ], + params: ['0x1::object::Object'], + return: ['bool'], + }, + { + name: 'maximum', + visibility: 'public', + is_entry: false, + is_view: true, + generic_type_params: [ + { + constraints: ['key'], + }, + ], + params: ['0x1::object::Object'], + return: ['0x1::option::Option'], + }, + { + name: 'merge', + visibility: 'public', + is_entry: false, + is_view: false, + generic_type_params: [], + params: [ + '&mut 0x1::fungible_asset::FungibleAsset', + '0x1::fungible_asset::FungibleAsset', + ], + return: [], + }, + { + name: 'metadata', + visibility: 'public', + is_entry: false, + is_view: true, + generic_type_params: [ + { + constraints: ['key'], + }, + ], + params: ['0x1::object::Object'], + return: ['0x1::fungible_asset::Metadata'], + }, + { + name: 'metadata_from_asset', + visibility: 'public', + is_entry: false, + is_view: false, + generic_type_params: [], + params: ['&0x1::fungible_asset::FungibleAsset'], + return: ['0x1::object::Object<0x1::fungible_asset::Metadata>'], + }, + { + name: 'mint', + visibility: 'public', + is_entry: false, + is_view: false, + generic_type_params: [], + params: ['&0x1::fungible_asset::MintRef', 'u64'], + return: ['0x1::fungible_asset::FungibleAsset'], + }, + { + name: 'mint_internal', + visibility: 'friend', + is_entry: false, + is_view: false, + generic_type_params: [], + params: ['0x1::object::Object<0x1::fungible_asset::Metadata>', 'u64'], + return: ['0x1::fungible_asset::FungibleAsset'], + }, + { + name: 'mint_ref_metadata', + visibility: 'public', + is_entry: false, + is_view: false, + generic_type_params: [], + params: ['&0x1::fungible_asset::MintRef'], + return: ['0x1::object::Object<0x1::fungible_asset::Metadata>'], + }, + { + name: 'mint_to', + visibility: 'public', + is_entry: false, + is_view: false, + generic_type_params: [ + { + constraints: ['key'], + }, + ], + params: [ + '&0x1::fungible_asset::MintRef', + '0x1::object::Object', + 'u64', + ], + return: [], + }, + { + name: 'mutate_metadata', + visibility: 'public', + is_entry: false, + is_view: false, + generic_type_params: [], + params: [ + '&0x1::fungible_asset::MutateMetadataRef', + '0x1::option::Option<0x1::string::String>', + '0x1::option::Option<0x1::string::String>', + '0x1::option::Option', + '0x1::option::Option<0x1::string::String>', + '0x1::option::Option<0x1::string::String>', + ], + return: [], + }, + { + name: 'name', + visibility: 'public', + is_entry: false, + is_view: true, + generic_type_params: [ + { + constraints: ['key'], + }, + ], + params: ['0x1::object::Object'], + return: ['0x1::string::String'], + }, + { + name: 'object_from_metadata_ref', + visibility: 'public', + is_entry: false, + is_view: false, + generic_type_params: [], + params: ['&0x1::fungible_asset::MutateMetadataRef'], + return: ['0x1::object::Object<0x1::fungible_asset::Metadata>'], + }, + { + name: 'project_uri', + visibility: 'public', + is_entry: false, + is_view: true, + generic_type_params: [ + { + constraints: ['key'], + }, + ], + params: ['0x1::object::Object'], + return: ['0x1::string::String'], + }, + { + name: 'register_dispatch_functions', + visibility: 'friend', + is_entry: false, + is_view: false, + generic_type_params: [], + params: [ + '&0x1::object::ConstructorRef', + '0x1::option::Option<0x1::function_info::FunctionInfo>', + '0x1::option::Option<0x1::function_info::FunctionInfo>', + '0x1::option::Option<0x1::function_info::FunctionInfo>', + ], + return: [], + }, + { + name: 'remove_store', + visibility: 'public', + is_entry: false, + is_view: false, + generic_type_params: [], + params: ['&0x1::object::DeleteRef'], + return: [], + }, + { + name: 'set_frozen_flag', + visibility: 'public', + is_entry: false, + is_view: false, + generic_type_params: [ + { + constraints: ['key'], + }, + ], + params: [ + '&0x1::fungible_asset::TransferRef', + '0x1::object::Object', + 'bool', + ], + return: [], + }, + { + name: 'set_frozen_flag_internal', + visibility: 'friend', + is_entry: false, + is_view: false, + generic_type_params: [ + { + constraints: ['key'], + }, + ], + params: ['0x1::object::Object', 'bool'], + return: [], + }, + { + name: 'set_untransferable', + visibility: 'public', + is_entry: false, + is_view: false, + generic_type_params: [], + params: ['&0x1::object::ConstructorRef'], + return: [], + }, + { + name: 'store_exists', + visibility: 'public', + is_entry: false, + is_view: true, + generic_type_params: [], + params: ['address'], + return: ['bool'], + }, + { + name: 'store_metadata', + visibility: 'public', + is_entry: false, + is_view: true, + generic_type_params: [ + { + constraints: ['key'], + }, + ], + params: ['0x1::object::Object'], + return: ['0x1::object::Object<0x1::fungible_asset::Metadata>'], + }, + { + name: 'supply', + visibility: 'public', + is_entry: false, + is_view: true, + generic_type_params: [ + { + constraints: ['key'], + }, + ], + params: ['0x1::object::Object'], + return: ['0x1::option::Option'], + }, + { + name: 'symbol', + visibility: 'public', + is_entry: false, + is_view: true, + generic_type_params: [ + { + constraints: ['key'], + }, + ], + params: ['0x1::object::Object'], + return: ['0x1::string::String'], + }, + { + name: 'transfer', + visibility: 'public', + is_entry: true, + is_view: false, + generic_type_params: [ + { + constraints: ['key'], + }, + ], + params: [ + '&signer', + '0x1::object::Object', + '0x1::object::Object', + 'u64', + ], + return: [], + }, + { + name: 'transfer_ref_metadata', + visibility: 'public', + is_entry: false, + is_view: false, + generic_type_params: [], + params: ['&0x1::fungible_asset::TransferRef'], + return: ['0x1::object::Object<0x1::fungible_asset::Metadata>'], + }, + { + name: 'transfer_with_ref', + visibility: 'public', + is_entry: false, + is_view: false, + generic_type_params: [ + { + constraints: ['key'], + }, + ], + params: [ + '&0x1::fungible_asset::TransferRef', + '0x1::object::Object', + '0x1::object::Object', + 'u64', + ], + return: [], + }, + { + name: 'upgrade_store_to_concurrent', + visibility: 'public', + is_entry: true, + is_view: false, + generic_type_params: [ + { + constraints: ['key'], + }, + ], + params: ['&signer', '0x1::object::Object'], + return: [], + }, + { + name: 'upgrade_to_concurrent', + visibility: 'public', + is_entry: false, + is_view: false, + generic_type_params: [], + params: ['&0x1::object::ExtendRef'], + return: [], + }, + { + name: 'withdraw', + visibility: 'public', + is_entry: false, + is_view: false, + generic_type_params: [ + { + constraints: ['key'], + }, + ], + params: ['&signer', '0x1::object::Object', 'u64'], + return: ['0x1::fungible_asset::FungibleAsset'], + }, + { + name: 'withdraw_dispatch_function', + visibility: 'public', + is_entry: false, + is_view: false, + generic_type_params: [ + { + constraints: ['key'], + }, + ], + params: ['0x1::object::Object'], + return: ['0x1::option::Option<0x1::function_info::FunctionInfo>'], + }, + { + name: 'withdraw_internal', + visibility: 'friend', + is_entry: false, + is_view: false, + generic_type_params: [], + params: ['address', 'u64'], + return: ['0x1::fungible_asset::FungibleAsset'], + }, + { + name: 'withdraw_sanity_check', + visibility: 'friend', + is_entry: false, + is_view: false, + generic_type_params: [ + { + constraints: ['key'], + }, + ], + params: ['&signer', '0x1::object::Object', 'bool'], + return: [], + }, + { + name: 'withdraw_with_ref', + visibility: 'public', + is_entry: false, + is_view: false, + generic_type_params: [ + { + constraints: ['key'], + }, + ], + params: [ + '&0x1::fungible_asset::TransferRef', + '0x1::object::Object', + 'u64', + ], + return: ['0x1::fungible_asset::FungibleAsset'], + }, + { + name: 'zero', + visibility: 'public', + is_entry: false, + is_view: false, + generic_type_params: [ + { + constraints: ['key'], + }, + ], + params: ['0x1::object::Object'], + return: ['0x1::fungible_asset::FungibleAsset'], + }, + ], + structs: [ + { + name: 'BurnRef', + is_native: false, + abilities: ['drop', 'store'], + generic_type_params: [], + fields: [ + { + name: 'metadata', + type: '0x1::object::Object<0x1::fungible_asset::Metadata>', + }, + ], + }, + { + name: 'ConcurrentFungibleBalance', + is_native: false, + abilities: ['key'], + generic_type_params: [], + fields: [ + { + name: 'balance', + type: '0x1::aggregator_v2::Aggregator', + }, + ], + }, + { + name: 'ConcurrentSupply', + is_native: false, + abilities: ['key'], + generic_type_params: [], + fields: [ + { + name: 'current', + type: '0x1::aggregator_v2::Aggregator', + }, + ], + }, + { + name: 'Deposit', + is_native: false, + abilities: ['drop', 'store'], + generic_type_params: [], + fields: [ + { + name: 'store', + type: 'address', + }, + { + name: 'amount', + type: 'u64', + }, + ], + }, + { + name: 'DepositEvent', + is_native: false, + abilities: ['drop', 'store'], + generic_type_params: [], + fields: [ + { + name: 'amount', + type: 'u64', + }, + ], + }, + { + name: 'DispatchFunctionStore', + is_native: false, + abilities: ['key'], + generic_type_params: [], + fields: [ + { + name: 'withdraw_function', + type: '0x1::option::Option<0x1::function_info::FunctionInfo>', + }, + { + name: 'deposit_function', + type: '0x1::option::Option<0x1::function_info::FunctionInfo>', + }, + { + name: 'derived_balance_function', + type: '0x1::option::Option<0x1::function_info::FunctionInfo>', + }, + ], + }, + { + name: 'Frozen', + is_native: false, + abilities: ['drop', 'store'], + generic_type_params: [], + fields: [ + { + name: 'store', + type: 'address', + }, + { + name: 'frozen', + type: 'bool', + }, + ], + }, + { + name: 'FrozenEvent', + is_native: false, + abilities: ['drop', 'store'], + generic_type_params: [], + fields: [ + { + name: 'frozen', + type: 'bool', + }, + ], + }, + { + name: 'FungibleAsset', + is_native: false, + abilities: [], + generic_type_params: [], + fields: [ + { + name: 'metadata', + type: '0x1::object::Object<0x1::fungible_asset::Metadata>', + }, + { + name: 'amount', + type: 'u64', + }, + ], + }, + { + name: 'FungibleAssetEvents', + is_native: false, + abilities: ['key'], + generic_type_params: [], + fields: [ + { + name: 'deposit_events', + type: '0x1::event::EventHandle<0x1::fungible_asset::DepositEvent>', + }, + { + name: 'withdraw_events', + type: '0x1::event::EventHandle<0x1::fungible_asset::WithdrawEvent>', + }, + { + name: 'frozen_events', + type: '0x1::event::EventHandle<0x1::fungible_asset::FrozenEvent>', + }, + ], + }, + { + name: 'FungibleStore', + is_native: false, + abilities: ['key'], + generic_type_params: [], + fields: [ + { + name: 'metadata', + type: '0x1::object::Object<0x1::fungible_asset::Metadata>', + }, + { + name: 'balance', + type: 'u64', + }, + { + name: 'frozen', + type: 'bool', + }, + ], + }, + { + name: 'Metadata', + is_native: false, + abilities: ['copy', 'drop', 'key'], + generic_type_params: [], + fields: [ + { + name: 'name', + type: '0x1::string::String', + }, + { + name: 'symbol', + type: '0x1::string::String', + }, + { + name: 'decimals', + type: 'u8', + }, + { + name: 'icon_uri', + type: '0x1::string::String', + }, + { + name: 'project_uri', + type: '0x1::string::String', + }, + ], + }, + { + name: 'MintRef', + is_native: false, + abilities: ['drop', 'store'], + generic_type_params: [], + fields: [ + { + name: 'metadata', + type: '0x1::object::Object<0x1::fungible_asset::Metadata>', + }, + ], + }, + { + name: 'MutateMetadataRef', + is_native: false, + abilities: ['drop', 'store'], + generic_type_params: [], + fields: [ + { + name: 'metadata', + type: '0x1::object::Object<0x1::fungible_asset::Metadata>', + }, + ], + }, + { + name: 'Supply', + is_native: false, + abilities: ['key'], + generic_type_params: [], + fields: [ + { + name: 'current', + type: 'u128', + }, + { + name: 'maximum', + type: '0x1::option::Option', + }, + ], + }, + { + name: 'TransferRef', + is_native: false, + abilities: ['drop', 'store'], + generic_type_params: [], + fields: [ + { + name: 'metadata', + type: '0x1::object::Object<0x1::fungible_asset::Metadata>', + }, + ], + }, + { + name: 'Untransferable', + is_native: false, + abilities: ['key'], + generic_type_params: [], + fields: [ + { + name: 'dummy_field', + type: 'bool', + }, + ], + }, + { + name: 'Withdraw', + is_native: false, + abilities: ['drop', 'store'], + generic_type_params: [], + fields: [ + { + name: 'store', + type: 'address', + }, + { + name: 'amount', + type: 'u64', + }, + ], + }, + { + name: 'WithdrawEvent', + is_native: false, + abilities: ['drop', 'store'], + generic_type_params: [], + fields: [ + { + name: 'amount', + type: 'u64', + }, + ], + }, + ], +} as const; From 2a5da369cb95a37de7ad4a0ae99d6e07faad4793 Mon Sep 17 00:00:00 2001 From: 21Chani Date: Tue, 1 Apr 2025 06:20:06 -0300 Subject: [PATCH 3/7] chore: use MovePrimitives as map for converting simple values --- src/types/convertor/argsConvertor.ts | 28 +++------ src/types/convertor/returnConvertor.ts | 78 +++++++++++++------------- src/types/convertor/structConvertor.ts | 31 ++-------- src/types/moveTypes.ts | 27 +++++---- 4 files changed, 68 insertions(+), 96 deletions(-) diff --git a/src/types/convertor/argsConvertor.ts b/src/types/convertor/argsConvertor.ts index c4c639c..936afb9 100644 --- a/src/types/convertor/argsConvertor.ts +++ b/src/types/convertor/argsConvertor.ts @@ -3,8 +3,12 @@ * for input arguments of view function or entry function. */ -import { AnyNumber, UnknownStruct } from '../common.js'; -import { MoveNonStructTypes, MovePrimitive } from '../moveTypes.js'; +import { UnknownStruct } from '../common.js'; +import { + MoveNonStructTypes, + MovePrimitive, + MovePrimitivesMap, +} from '../moveTypes.js'; /** * Convert an array of input arguments type. @@ -27,25 +31,7 @@ type ConvertArgType = UnknownStruct; type ConvertPrimitiveArgType = - TMoveType extends 'bool' - ? boolean - : TMoveType extends 'u8' - ? number - : TMoveType extends 'u16' - ? number - : TMoveType extends 'u32' - ? number - : TMoveType extends 'u64' - ? AnyNumber - : TMoveType extends 'u128' - ? AnyNumber - : TMoveType extends 'u256' - ? AnyNumber - : TMoveType extends 'address' - ? `0x${string}` - : TMoveType extends '0x1::string::String' - ? string - : never; + MovePrimitivesMap[TMoveType]; type ConvertNonStructArgType = TMoveType extends MovePrimitive diff --git a/src/types/convertor/returnConvertor.ts b/src/types/convertor/returnConvertor.ts index 46e1620..8ae28a3 100644 --- a/src/types/convertor/returnConvertor.ts +++ b/src/types/convertor/returnConvertor.ts @@ -3,59 +3,57 @@ * for return value of view functions. */ +import { ABIRoot } from '../abi.js'; import { UnknownStruct } from '../common.js'; import { DefaultABITable } from '../defaultABITable.js'; -import { MoveNonStructTypes, MovePrimitive } from '../moveTypes.js'; +import { + ConvertedStruct, + ExtractStruct, + ExtractStructName, +} from '../extractor/struct.js'; +import { + MoveNonStructTypes, + MovePrimitive, + MovePrimitivesMap, +} from '../moveTypes.js'; import { ConvertStructFieldOptionType } from './structConvertor.js'; /** * Convert an array of return types. */ -export type ConvertReturns = T extends readonly [ +export type ConvertReturns< + ABI extends ABIRoot, + T extends readonly string[], +> = T extends readonly [ infer TArg extends string, ...infer TRest extends string[], ] - ? [ConvertReturnType, ...ConvertReturns] + ? [ConvertReturnType, ...ConvertReturns] : []; /** * Internal */ -type ConvertReturnType = - TMoveType extends MoveNonStructTypes - ? // it's a non-struct type - ConvertNonStructReturnType - : // it's a struct type - UnknownStruct; +type ConvertReturnType< + ABI extends ABIRoot, + TMoveType extends string, +> = TMoveType extends MoveNonStructTypes + ? // it's a non-struct type + ConvertNonStructReturnType + : // Verify if struct is a valid string, example 0x1::object_name::StructName and infer only StructName to a new type for validation + TMoveType extends ExtractStructName + ? ConvertedStruct> + : UnknownStruct; -type ConvertPrimitiveReturnType = - TMoveType extends 'bool' - ? boolean - : TMoveType extends 'u8' - ? number - : TMoveType extends 'u16' - ? number - : TMoveType extends 'u32' - ? number - : TMoveType extends 'u64' - ? string - : TMoveType extends 'u128' - ? string - : TMoveType extends 'u256' - ? string - : TMoveType extends 'address' - ? `0x${string}` - : TMoveType extends '0x1::string::String' - ? string - : never; - -type ConvertNonStructReturnType = - TMoveType extends MovePrimitive - ? ConvertPrimitiveReturnType - : TMoveType extends `vector<${infer TInner}>` - ? ConvertReturnType[] - : TMoveType extends `0x1::object::Object<${string}>` - ? { inner: `0x${string}` } - : TMoveType extends `0x1::option::Option<${infer TInner}>` - ? ConvertStructFieldOptionType - : UnknownStruct; +type ConvertNonStructReturnType< + ABI extends ABIRoot, + TMoveType extends MoveNonStructTypes, +> = TMoveType extends MovePrimitive + ? MovePrimitivesMap[TMoveType] + : TMoveType extends `vector<${infer TInner}>` + ? ConvertReturnType[] + : TMoveType extends `0x1::object::Object<${string}>` + ? { inner: `0x${string}` } + : TMoveType extends `0x1::option::Option<${infer TInner}>` + ? ConvertStructFieldOptionType + : UnknownStruct; diff --git a/src/types/convertor/structConvertor.ts b/src/types/convertor/structConvertor.ts index 15b2bbd..e5c17a9 100644 --- a/src/types/convertor/structConvertor.ts +++ b/src/types/convertor/structConvertor.ts @@ -7,7 +7,11 @@ import { ExtractStructType, ResourceStructName, } from '../extractor/structExtractor.js'; -import { MoveNonStructTypes, MovePrimitive } from '../moveTypes.js'; +import { + MoveNonStructTypes, + MovePrimitive, + MovePrimitivesMap, +} from '../moveTypes.js'; // Convert a struct field Move type to a TypeScript type export type ConvertStructFieldType< @@ -19,35 +23,12 @@ export type ConvertStructFieldType< : // it's a struct type ConvertStructFieldStructType; -/** - * Internal - */ -type ConvertPrimitiveStructField = T extends 'bool' - ? boolean - : T extends 'u8' - ? number - : T extends 'u16' - ? number - : T extends 'u32' - ? number - : T extends 'u64' - ? string - : T extends 'u128' - ? string - : T extends 'u256' - ? string - : T extends 'address' - ? `0x${string}` - : T extends '0x1::string::String' - ? string - : never; - // Convert a struct field non-struct Move type to a TypeScript type type ConvertStructFieldNonStructType< TABITable extends ABITable, TMoveType extends MoveNonStructTypes, > = TMoveType extends MovePrimitive - ? ConvertPrimitiveStructField + ? MovePrimitivesMap[TMoveType] : TMoveType extends `vector<${infer TInner}>` ? ConvertStructFieldType[] : TMoveType extends `0x1::object::Object<${string}>` diff --git a/src/types/moveTypes.ts b/src/types/moveTypes.ts index 95bdc74..ce081f0 100644 --- a/src/types/moveTypes.ts +++ b/src/types/moveTypes.ts @@ -2,22 +2,29 @@ * Types from Move language */ +import { AnyNumber } from './common.js'; + export type MoveNonStructTypes = | MovePrimitive | MoveVector | MoveObject | MoveOption; -export type MovePrimitive = - | 'bool' - | 'u8' - | 'u16' - | 'u32' - | 'u64' - | 'u128' - | 'u256' - | 'address' - | '0x1::string::String'; +export type MovePrimitivesMap = { + '0x1::string::String': string; + address: `0x${string}`; + + // Numeric types + u8: number; + u16: number; + u32: number; + u64: AnyNumber; + u128: AnyNumber; + u256: AnyNumber; + + bool: boolean; +}; +export type MovePrimitive = keyof MovePrimitivesMap; export type MoveVector = `vector<${string}>`; From c26a05081b1ecb1b189a5e47ceea1aabf7c0d67e Mon Sep 17 00:00:00 2001 From: 21Chani Date: Tue, 1 Apr 2025 06:20:25 -0300 Subject: [PATCH 4/7] feat: add struct converter to functionExtractor --- src/types/extractor/functionExtractor.ts | 48 ++++++++++++------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/types/extractor/functionExtractor.ts b/src/types/extractor/functionExtractor.ts index b3050a7..7ef322f 100644 --- a/src/types/extractor/functionExtractor.ts +++ b/src/types/extractor/functionExtractor.ts @@ -22,33 +22,33 @@ export type EntryFunctionName = EntryFunction['name']; * Extract the return type of a function from ABI with function name. */ export type ExtractReturnType< - T extends ABIRoot, - TFuncName extends FunctionName, -> = ConvertReturns>; + Abi extends ABIRoot, + TFuncName extends FunctionName, +> = ConvertReturns>; /** * Extract the input arguments type of a function from ABI with function name. */ export type ExtractArgsType< - T extends ABIRoot, - TFuncName extends FunctionName, -> = ConvertArgs>; + Abi extends ABIRoot, + TFuncName extends FunctionName, +> = ConvertArgs>; /** * Extract the input arguments type of a function from ABI with function name, but omit the signer. */ export type ExtractArgsTypeOmitSigner< - T extends ABIRoot, - TFuncName extends FunctionName, -> = ConvertArgs>>; + Abi extends ABIRoot, + TFuncName extends FunctionName, +> = ConvertArgs>>; /** * Extract the input generic arguments type of a function from ABI with function name. */ export type ExtractGenericArgsType< - T extends ABIRoot, - TFuncName extends FunctionName, -> = ConvertGenerics>; + Abi extends ABIRoot, + TFuncName extends FunctionName, +> = ConvertGenerics>; /** * Internal @@ -66,21 +66,21 @@ type EntryFunction = Extract< >; type ExtractFunction< - T extends ABIRoot, - TFuncName extends FunctionName, -> = Extract, { name: TFuncName }>; + Abi extends ABIRoot, + TFuncName extends FunctionName, +> = Extract, { name: TFuncName }>; type ExtractMoveReturnType< - T extends ABIRoot, - TFuncName extends FunctionName, -> = ExtractFunction['return']; + Abi extends ABIRoot, + TFuncName extends FunctionName, +> = ExtractFunction['return']; type ExtractMoveArgsType< - T extends ABIRoot, - TFuncName extends FunctionName, -> = ExtractFunction['params']; + Abi extends ABIRoot, + TFuncName extends FunctionName, +> = ExtractFunction['params']; type ExtractMoveGenericParamsType< - T extends ABIRoot, - TFuncName extends FunctionName, -> = ExtractFunction['generic_type_params']; + Abi extends ABIRoot, + TFuncName extends FunctionName, +> = ExtractFunction['generic_type_params']; From 9f2c4448f325872b5dd6d6d6b5312e62ec103f4e Mon Sep 17 00:00:00 2001 From: 21Chani Date: Tue, 1 Apr 2025 15:12:38 -0300 Subject: [PATCH 5/7] chore: test for createViewPayload --- src/core/__tests__/createViewPayload.test.ts | 74 +++++++++++++++++--- src/types/convertor/argsConvertor.ts | 55 +++++++++------ src/types/extractor/functionExtractor.ts | 4 +- src/types/extractor/struct.ts | 20 +++--- src/types/moveTypes.ts | 10 +++ 5 files changed, 120 insertions(+), 43 deletions(-) diff --git a/src/core/__tests__/createViewPayload.test.ts b/src/core/__tests__/createViewPayload.test.ts index 07a2dcf..7c0ae11 100644 --- a/src/core/__tests__/createViewPayload.test.ts +++ b/src/core/__tests__/createViewPayload.test.ts @@ -1,13 +1,16 @@ +import { parseTypeTag } from '@aptos-labs/ts-sdk'; import { COIN_ABI } from '../../abi/coin'; +import { ABIRoot } from '../../types'; +import { MovePrimitive } from '../../types/moveTypes'; import { createViewPayload } from '../createViewPayload'; // TODO: add struct, vector of vector describe('createViewPayload', () => { // Act before assertions - beforeAll(async () => { }); + beforeAll(async () => {}); // Teardown (cleanup) after assertions - afterAll(() => { }); + afterAll(() => {}); it('basic type checking', async () => { // no need to run, type check only. @@ -113,7 +116,7 @@ describe('createViewPayload', () => { "returnTypes": [], "typeParameters": [], }, - "function": "0x123::test::bool_as_input", + "function": "0x1::test::bool_as_input", "functionArguments": [ true, false, @@ -154,7 +157,7 @@ describe('createViewPayload', () => { "returnTypes": [], "typeParameters": [], }, - "function": "0x123::test::address_as_input", + "function": "0x1::test::address_as_input", "functionArguments": [ "0x1", "0x2", @@ -199,7 +202,7 @@ describe('createViewPayload', () => { "returnTypes": [], "typeParameters": [], }, - "function": "0x123::test::number_as_input", + "function": "0x1::test::number_as_input", "functionArguments": [ 1, 2, @@ -249,7 +252,7 @@ describe('createViewPayload', () => { "returnTypes": [], "typeParameters": [], }, - "function": "0x123::test::vector_as_input", + "function": "0x1::test::vector_as_input", "functionArguments": [ [ 1, @@ -278,10 +281,33 @@ describe('createViewPayload', () => { } `); }); + it('object', async () => { + const payload = createViewPayload(TEST_ABI, { + function: 'object_as_input', + functionArguments: [ + { + decimals: 1, + symbol: 'Aptos', + }, + ], + typeArguments: [], + }); + + expect(payload.abi).toBeTruthy(); + expect(payload.function).toBe('0x1::test::object_as_input'); + expect(payload.functionArguments).toStrictEqual([ + { decimals: 1, symbol: 'Aptos' }, + ]); + expect(payload.abi?.parameters).toStrictEqual([ + parseTypeTag('0x1::test::TestStruct'), + ]); + expect(payload.abi?.returnTypes).toStrictEqual([]); + expect(payload.abi?.typeParameters).toStrictEqual([]); + }); }); const TEST_ABI = { - address: '0x123', + address: '0x1', name: 'test', friends: [], exposed_functions: [ @@ -327,6 +353,36 @@ const TEST_ABI = { ], return: [], }, + { + name: 'object_as_input', + visibility: 'public', + is_entry: false, + is_view: true, + generic_type_params: [], + params: ['0x1::test::TestStruct'], + return: [], + }, + ], + structs: [ + { + abilities: ['copy', 'drop'], + name: 'TestStruct', + fields: [ + { + name: 'symbol', + type: '0x1::string::String' satisfies MovePrimitive, + }, + { + name: 'decimals', + type: 'u8' satisfies MovePrimitive, + }, + // { + // name: 'addressList', + // type: 'vector
' satisfies MovePrimitive, + // }, + ], + generic_type_params: [], + is_native: false, + }, ], - structs: [], -} as const; +} as const satisfies ABIRoot; diff --git a/src/types/convertor/argsConvertor.ts b/src/types/convertor/argsConvertor.ts index 936afb9..51f3993 100644 --- a/src/types/convertor/argsConvertor.ts +++ b/src/types/convertor/argsConvertor.ts @@ -3,7 +3,13 @@ * for input arguments of view function or entry function. */ +import { ABIRoot } from '../abi.js'; import { UnknownStruct } from '../common.js'; +import { + ConvertedStruct, + ExtractStruct, + ExtractStructName, +} from '../extractor/struct.js'; import { MoveNonStructTypes, MovePrimitive, @@ -13,35 +19,44 @@ import { /** * Convert an array of input arguments type. */ -export type ConvertArgs = T extends readonly [ +export type ConvertArgs< + Abi extends ABIRoot, + T extends readonly string[], +> = T extends readonly [ infer TArg extends string, ...infer TRest extends string[], ] - ? [ConvertArgType, ...ConvertArgs] + ? [ConvertArgType, ...ConvertArgs] : []; /** * Internal */ -type ConvertArgType = - TMoveType extends MoveNonStructTypes - ? // it's a non-struct type - ConvertNonStructArgType - : // it's a struct type - UnknownStruct; +type ConvertArgType< + ABI extends ABIRoot, + TMoveType extends string, +> = TMoveType extends MoveNonStructTypes + ? // it's a non-struct type + ConvertNonStructArgType + : // Verify if struct is a valid string, example 0x1::object_name::StructName and infer only StructName to a new type for validation + TMoveType extends ExtractStructName + ? ConvertedStruct> + : UnknownStruct; type ConvertPrimitiveArgType = MovePrimitivesMap[TMoveType]; -type ConvertNonStructArgType = - TMoveType extends MovePrimitive - ? ConvertPrimitiveArgType - : TMoveType extends `vector` - ? string | number[] | Uint8Array - : TMoveType extends `vector<${infer TInner}>` - ? ConvertArgType[] - : TMoveType extends `0x1::object::Object<${string}>` - ? `0x${string}` - : TMoveType extends `0x1::option::Option<${infer TInner}>` - ? ConvertArgType | undefined - : UnknownStruct; +type ConvertNonStructArgType< + Abi extends ABIRoot, + TMoveType extends MoveNonStructTypes, +> = TMoveType extends MovePrimitive + ? ConvertPrimitiveArgType + : TMoveType extends `vector` + ? string | number[] | Uint8Array + : TMoveType extends `vector<${infer TInner}>` + ? ConvertArgType[] + : TMoveType extends `0x1::object::Object<${string}>` + ? `0x${string}` + : TMoveType extends `0x1::option::Option<${infer TInner}>` + ? ConvertArgType | undefined + : UnknownStruct; diff --git a/src/types/extractor/functionExtractor.ts b/src/types/extractor/functionExtractor.ts index 7ef322f..afc5f0e 100644 --- a/src/types/extractor/functionExtractor.ts +++ b/src/types/extractor/functionExtractor.ts @@ -32,7 +32,7 @@ export type ExtractReturnType< export type ExtractArgsType< Abi extends ABIRoot, TFuncName extends FunctionName, -> = ConvertArgs>; +> = ConvertArgs>; /** * Extract the input arguments type of a function from ABI with function name, but omit the signer. @@ -40,7 +40,7 @@ export type ExtractArgsType< export type ExtractArgsTypeOmitSigner< Abi extends ABIRoot, TFuncName extends FunctionName, -> = ConvertArgs>>; +> = ConvertArgs>>; /** * Extract the input generic arguments type of a function from ABI with function name. diff --git a/src/types/extractor/struct.ts b/src/types/extractor/struct.ts index 92bd8f2..ccaf99b 100644 --- a/src/types/extractor/struct.ts +++ b/src/types/extractor/struct.ts @@ -1,14 +1,6 @@ import { ABIRoot, ABIStruct } from '../abi.js'; import { MovePrimitivesMap } from '../moveTypes.js'; -// ===================================================== -// DEFINED TYPES -// ===================================================== - -// ==================================================== -// STRUCTS -// ==================================================== - export type ExtractStructName< ABI extends ABIRoot, FunctionName extends string, @@ -23,10 +15,14 @@ export type ExtractStruct< > = Extract; // Convert a raw Struct from abi to an object with its fields and parsed object types -export type ConvertedStruct = { - [K in T['fields'][number] as K['name']]: K['type'] extends keyof MovePrimitivesMap - ? MovePrimitivesMap[K['type']] // Non Struct Types - : K['type'] extends ExtractStructName +export type ConvertedStruct< + ABI extends ABIRoot, + T extends ABIStruct, + Fields extends T['fields'][number] = T['fields'][number], +> = { + [Key in Fields as Key['name']]: Key['type'] extends keyof MovePrimitivesMap + ? MovePrimitivesMap[Key['type']] // Non Struct Types + : Key['type'] extends ExtractStructName ? StructName extends ABI['structs'][number]['name'] ? // Transformed 0x1::object::Object<0x1::coin::CustomStruct> to object. ConvertedStruct> diff --git a/src/types/moveTypes.ts b/src/types/moveTypes.ts index ce081f0..19742da 100644 --- a/src/types/moveTypes.ts +++ b/src/types/moveTypes.ts @@ -22,6 +22,16 @@ export type MovePrimitivesMap = { u128: AnyNumber; u256: AnyNumber; + // Vector types + 'vector': string | number[] | Uint8Array; + 'vector': number[]; + 'vector': AnyNumber[]; + 'vector': AnyNumber[]; + 'vector': AnyNumber[]; + 'vector': boolean[]; + 'vector
': `0x${string}`[]; + 'vector<0x1::string::String>': MoveNonStructTypes[]; + bool: boolean; }; export type MovePrimitive = keyof MovePrimitivesMap; From 938b025ebf00f69dcd6773d23e2b64deb26d8006 Mon Sep 17 00:00:00 2001 From: 21Chani Date: Tue, 1 Apr 2025 15:16:46 -0300 Subject: [PATCH 6/7] feat: addressList for complex typing --- src/core/__tests__/createViewPayload.test.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/core/__tests__/createViewPayload.test.ts b/src/core/__tests__/createViewPayload.test.ts index 7c0ae11..886e03d 100644 --- a/src/core/__tests__/createViewPayload.test.ts +++ b/src/core/__tests__/createViewPayload.test.ts @@ -286,8 +286,9 @@ describe('createViewPayload', () => { function: 'object_as_input', functionArguments: [ { - decimals: 1, + decimals: 8, symbol: 'Aptos', + addressList: ['0x1', '0x2'], }, ], typeArguments: [], @@ -296,10 +297,10 @@ describe('createViewPayload', () => { expect(payload.abi).toBeTruthy(); expect(payload.function).toBe('0x1::test::object_as_input'); expect(payload.functionArguments).toStrictEqual([ - { decimals: 1, symbol: 'Aptos' }, + { decimals: 8, symbol: 'Aptos', addressList: ['0x1', '0x2'] }, ]); expect(payload.abi?.parameters).toStrictEqual([ - parseTypeTag('0x1::test::TestStruct'), + parseTypeTag('0x1::test::TestStruct'), //On abi the paramater its parsed as type tag for generation. ]); expect(payload.abi?.returnTypes).toStrictEqual([]); expect(payload.abi?.typeParameters).toStrictEqual([]); @@ -376,10 +377,10 @@ const TEST_ABI = { name: 'decimals', type: 'u8' satisfies MovePrimitive, }, - // { - // name: 'addressList', - // type: 'vector
' satisfies MovePrimitive, - // }, + { + name: 'addressList', + type: 'vector
' satisfies MovePrimitive, + }, ], generic_type_params: [], is_native: false, From 86337492396f6276dd180fb97bcfa192d8139188 Mon Sep 17 00:00:00 2001 From: 21Chani Date: Tue, 8 Apr 2025 11:10:25 -0300 Subject: [PATCH 7/7] wip: type support for view return --- src/core/__tests__/createViewPayload.test.ts | 4 +++- src/core/__tests__/view.test.ts | 2 +- src/types/convertor/argsConvertor.ts | 11 +++++++---- src/types/moveTypes.ts | 5 ++--- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/core/__tests__/createViewPayload.test.ts b/src/core/__tests__/createViewPayload.test.ts index 886e03d..13e8046 100644 --- a/src/core/__tests__/createViewPayload.test.ts +++ b/src/core/__tests__/createViewPayload.test.ts @@ -285,6 +285,8 @@ describe('createViewPayload', () => { const payload = createViewPayload(TEST_ABI, { function: 'object_as_input', functionArguments: [ + '0xAddressType', + [0, 1, 2], { decimals: 8, symbol: 'Aptos', @@ -360,7 +362,7 @@ const TEST_ABI = { is_entry: false, is_view: true, generic_type_params: [], - params: ['0x1::test::TestStruct'], + params: ['address', 'vec', '0x1::test::TestStruct'], return: [], }, ], diff --git a/src/core/__tests__/view.test.ts b/src/core/__tests__/view.test.ts index 879c780..3e8a165 100644 --- a/src/core/__tests__/view.test.ts +++ b/src/core/__tests__/view.test.ts @@ -94,7 +94,7 @@ describe('call view functions', () => { // struct FixedPoint64 has copy, drop, store { value: u128 } const result = await clientMain.view({ payload: viewPayload }); - result[0][0]!.inner; + result[0][0]; // @ts-expect-error result[0][0].abc; diff --git a/src/types/convertor/argsConvertor.ts b/src/types/convertor/argsConvertor.ts index 51f3993..6c5885a 100644 --- a/src/types/convertor/argsConvertor.ts +++ b/src/types/convertor/argsConvertor.ts @@ -14,6 +14,7 @@ import { MoveNonStructTypes, MovePrimitive, MovePrimitivesMap, + MoveVector, } from '../moveTypes.js'; /** @@ -38,10 +39,12 @@ type ConvertArgType< > = TMoveType extends MoveNonStructTypes ? // it's a non-struct type ConvertNonStructArgType - : // Verify if struct is a valid string, example 0x1::object_name::StructName and infer only StructName to a new type for validation - TMoveType extends ExtractStructName - ? ConvertedStruct> - : UnknownStruct; + : TMoveType extends MoveVector + ? ConvertArgType[] // If it is a NON primitive vector, convert the inner type to argType[] + : // Verify if struct is a valid string, example 0x1::object_name::StructName and infer only StructName to a new type for validation + TMoveType extends ExtractStructName + ? ConvertedStruct> + : UnknownStruct; type ConvertPrimitiveArgType = MovePrimitivesMap[TMoveType]; diff --git a/src/types/moveTypes.ts b/src/types/moveTypes.ts index 19742da..5c1ac30 100644 --- a/src/types/moveTypes.ts +++ b/src/types/moveTypes.ts @@ -6,8 +6,7 @@ import { AnyNumber } from './common.js'; export type MoveNonStructTypes = | MovePrimitive - | MoveVector - | MoveObject + // | MoveObject | MoveOption; export type MovePrimitivesMap = { @@ -36,7 +35,7 @@ export type MovePrimitivesMap = { }; export type MovePrimitive = keyof MovePrimitivesMap; -export type MoveVector = `vector<${string}>`; +export type MoveVector = `vector<${Inner}>`; export type MoveObject = `0x1::object::Object<${string}>`;