From 89128ccb2578f939aa92131bf71f96d8d3730205 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Fri, 6 Sep 2024 20:18:14 +0300 Subject: [PATCH 1/2] system SC proxy - arg reference fix --- .../examples/nft-minter/src/nft_module.rs | 4 +- .../system_proxy/builtin_func_proxy.rs | 58 +++---- .../system_proxy/esdt_system_sc_proxy.rs | 146 +++++++++--------- .../src/system_sc_interact.rs | 72 ++++----- 4 files changed, 140 insertions(+), 140 deletions(-) diff --git a/contracts/examples/nft-minter/src/nft_module.rs b/contracts/examples/nft-minter/src/nft_module.rs index 66f50ea958..12f2c3b868 100644 --- a/contracts/examples/nft-minter/src/nft_module.rs +++ b/contracts/examples/nft-minter/src/nft_module.rs @@ -49,8 +49,8 @@ pub trait NftModule { self.send() .esdt_system_sc_proxy() .set_special_roles( - &self.blockchain().get_sc_address(), - &self.nft_token_id().get(), + self.blockchain().get_sc_address(), + self.nft_token_id().get(), [EsdtLocalRole::NftCreate][..].iter().cloned(), ) .async_call_and_exit() diff --git a/framework/base/src/types/interaction/system_proxy/builtin_func_proxy.rs b/framework/base/src/types/interaction/system_proxy/builtin_func_proxy.rs index 6e4978980a..6755dbbd03 100644 --- a/framework/base/src/types/interaction/system_proxy/builtin_func_proxy.rs +++ b/framework/base/src/types/interaction/system_proxy/builtin_func_proxy.rs @@ -78,7 +78,7 @@ where self.wrapped_tx .payment(NotPayable) .raw_call(CHANGE_OWNER_BUILTIN_FUNC_NAME) - .argument(new_owner) + .argument(&new_owner) .original_result() } @@ -87,26 +87,26 @@ where Arg1: ProxyArg>, >( self, - token: &Arg0, + token: Arg0, nonce: u64, - amount: &Arg1, + amount: Arg1, ) -> TxTypedCall { if nonce == 0 { return self .wrapped_tx .payment(NotPayable) .raw_call(ESDT_LOCAL_BURN_FUNC_NAME) - .argument(token) - .argument(amount) + .argument(&token) + .argument(&amount) .original_result(); } self.wrapped_tx .payment(NotPayable) .raw_call(ESDT_NFT_BURN_FUNC_NAME) - .argument(token) + .argument(&token) .argument(&nonce) - .argument(amount) + .argument(&amount) .original_result() } @@ -115,31 +115,31 @@ where Arg1: ProxyArg>, >( self, - token: &Arg0, + token: Arg0, nonce: u64, - amount: &Arg1, + amount: Arg1, ) -> TxTypedCall { if nonce == 0 { return self .wrapped_tx .payment(NotPayable) .raw_call(ESDT_LOCAL_MINT_FUNC_NAME) - .argument(token) - .argument(amount) + .argument(&token) + .argument(&amount) .original_result(); } self.wrapped_tx .payment(NotPayable) .raw_call(ESDT_NFT_ADD_QUANTITY_FUNC_NAME) - .argument(token) + .argument(&token) .argument(&nonce) - .argument(amount) + .argument(&amount) .original_result() } pub fn nft_add_multiple_uri>>( self, - token_id: &Arg0, + token_id: Arg0, nft_nonce: u64, new_uris: &ManagedVec>, ) -> TxTypedCall { @@ -147,7 +147,7 @@ where .wrapped_tx .payment(NotPayable) .raw_call(ESDT_NFT_ADD_URI_FUNC_NAME) - .argument(token_id) + .argument(&token_id) .argument(&nft_nonce); for uri in new_uris { @@ -159,16 +159,16 @@ where pub fn nft_update_attributes>>( self, - token_id: &Arg0, + token_id: Arg0, nft_nonce: u64, new_attributes: &T, ) -> TxTypedCall { self.wrapped_tx .payment(NotPayable) .raw_call(ESDT_NFT_UPDATE_ATTRIBUTES_FUNC_NAME) - .argument(token_id) + .argument(&token_id) .argument(&nft_nonce) - .argument(new_attributes) + .argument(&new_attributes) .original_result() } @@ -182,11 +182,11 @@ where Arg4: ProxyArg>, >( self, - token: &Arg0, - amount: &Arg1, - name: &Arg2, - royalties: &Arg3, - hash: &Arg4, + token: Arg0, + amount: Arg1, + name: Arg2, + royalties: Arg3, + hash: Arg4, attributes: &T, uris: &ManagedVec>, ) -> TxTypedCall { @@ -194,12 +194,12 @@ where .wrapped_tx .payment(NotPayable) .raw_call(ESDT_NFT_CREATE_FUNC_NAME) - .argument(token) - .argument(amount) - .argument(name) - .argument(royalties) - .argument(hash) - .argument(attributes); + .argument(&token) + .argument(&amount) + .argument(&name) + .argument(&royalties) + .argument(&hash) + .argument(&attributes); if uris.is_empty() { // at least one URI is required, so we push an empty one diff --git a/framework/base/src/types/interaction/system_proxy/esdt_system_sc_proxy.rs b/framework/base/src/types/interaction/system_proxy/esdt_system_sc_proxy.rs index 10730ff0fc..979f9d1d60 100644 --- a/framework/base/src/types/interaction/system_proxy/esdt_system_sc_proxy.rs +++ b/framework/base/src/types/interaction/system_proxy/esdt_system_sc_proxy.rs @@ -70,9 +70,9 @@ where >( self, issue_cost: BigUint, - token_display_name: &Arg0, - token_ticker: &Arg1, - initial_supply: &Arg2, + token_display_name: Arg0, + token_ticker: Arg1, + initial_supply: Arg2, properties: FungibleTokenProperties, ) -> IssueCall { self.issue( @@ -104,8 +104,8 @@ where >( self, issue_cost: BigUint, - token_display_name: &Arg0, - token_ticker: &Arg1, + token_display_name: Arg0, + token_ticker: Arg1, properties: NonFungibleTokenProperties, ) -> IssueCall { let zero = &BigUint::zero(); @@ -138,8 +138,8 @@ where >( self, issue_cost: BigUint, - token_display_name: &Arg0, - token_ticker: &Arg1, + token_display_name: Arg0, + token_ticker: Arg1, properties: SemiFungibleTokenProperties, ) -> IssueCall { let zero = BigUint::zero(); @@ -172,8 +172,8 @@ where >( self, issue_cost: BigUint, - token_display_name: &Arg0, - token_ticker: &Arg1, + token_display_name: Arg0, + token_ticker: Arg1, properties: MetaTokenProperties, ) -> IssueCall { let zero = &BigUint::zero(); @@ -236,9 +236,9 @@ where self, issue_cost: BigUint, token_type: EsdtTokenType, - token_display_name: &Arg0, - token_ticker: &Arg1, - initial_supply: &Arg2, + token_display_name: Arg0, + token_ticker: Arg1, + initial_supply: Arg2, properties: TokenProperties, ) -> IssueCall { let endpoint_name = match token_type { @@ -253,11 +253,11 @@ where .wrapped_tx .raw_call(endpoint_name) .egld(issue_cost) - .argument(token_display_name) - .argument(token_ticker); + .argument(&token_display_name) + .argument(&token_ticker); if token_type == EsdtTokenType::Fungible { - tx = tx.argument(initial_supply); + tx = tx.argument(&initial_supply); tx = tx.argument(&properties.num_decimals); } else if token_type == EsdtTokenType::Meta { tx = tx.argument(&properties.num_decimals); @@ -290,14 +290,14 @@ where /// It will fail if the SC is not the owner of the token. pub fn mint>, Arg1: ProxyArg>>( self, - token_identifier: &Arg0, - amount: &Arg1, + token_identifier: Arg0, + amount: Arg1, ) -> TxTypedCall { self.wrapped_tx .payment(NotPayable) .raw_call("mint") - .argument(token_identifier) - .argument(amount) + .argument(&token_identifier) + .argument(&amount) .original_result() } @@ -305,14 +305,14 @@ where /// which causes it to burn fungible ESDT tokens owned by the SC. pub fn burn>, Arg1: ProxyArg>>( self, - token_identifier: &Arg0, - amount: &Arg1, + token_identifier: Arg0, + amount: Arg1, ) -> TxTypedCall { self.wrapped_tx .payment(NotPayable) .raw_call("ESDTBurn") - .argument(token_identifier) - .argument(amount) + .argument(&token_identifier) + .argument(&amount) .original_result() } @@ -320,24 +320,24 @@ where /// except minting, freezing/unfreezing and wiping. pub fn pause>>( self, - token_identifier: &Arg0, + token_identifier: Arg0, ) -> TxTypedCall { self.wrapped_tx .payment(NotPayable) .raw_call("pause") - .argument(token_identifier) + .argument(&token_identifier) .original_result() } /// The reverse operation of `pause`. pub fn unpause>>( self, - token_identifier: &Arg0, + token_identifier: Arg0, ) -> TxTypedCall { self.wrapped_tx .payment(NotPayable) .raw_call("unPause") - .argument(token_identifier) + .argument(&token_identifier) .original_result() } @@ -349,14 +349,14 @@ where Arg1: ProxyArg>, >( self, - token_identifier: &Arg0, - address: &Arg1, + token_identifier: Arg0, + address: Arg1, ) -> TxTypedCall { self.wrapped_tx .payment(NotPayable) .raw_call("freeze") - .argument(token_identifier) - .argument(address) + .argument(&token_identifier) + .argument(&address) .original_result() } @@ -366,14 +366,14 @@ where Arg1: ProxyArg>, >( self, - token_identifier: &Arg0, - address: &Arg1, + token_identifier: Arg0, + address: Arg1, ) -> TxTypedCall { self.wrapped_tx .payment(NotPayable) .raw_call("unFreeze") - .argument(token_identifier) - .argument(address) + .argument(&token_identifier) + .argument(&address) .original_result() } @@ -386,14 +386,14 @@ where Arg1: ProxyArg>, >( self, - token_identifier: &Arg0, - address: &Arg1, + token_identifier: Arg0, + address: Arg1, ) -> TxTypedCall { self.wrapped_tx .payment(NotPayable) .raw_call("wipe") - .argument(token_identifier) - .argument(address) + .argument(&token_identifier) + .argument(&address) .original_result() } @@ -405,16 +405,16 @@ where Arg1: ProxyArg>, >( self, - token_identifier: &Arg0, + token_identifier: Arg0, nft_nonce: u64, - address: &Arg1, + address: Arg1, ) -> TxTypedCall { self.wrapped_tx .payment(NotPayable) .raw_call("freezeSingleNFT") - .argument(token_identifier) + .argument(&token_identifier) .argument(&nft_nonce) - .argument(address) + .argument(&address) .original_result() } @@ -424,16 +424,16 @@ where Arg1: ProxyArg>, >( self, - token_identifier: &Arg0, + token_identifier: Arg0, nft_nonce: u64, - address: &Arg1, + address: Arg1, ) -> TxTypedCall { self.wrapped_tx .payment(NotPayable) .raw_call("unFreezeSingleNFT") - .argument(token_identifier) + .argument(&token_identifier) .argument(&nft_nonce) - .argument(address) + .argument(&address) .original_result() } @@ -446,16 +446,16 @@ where Arg1: ProxyArg>, >( self, - token_identifier: &Arg0, + token_identifier: Arg0, nft_nonce: u64, - address: &Arg1, + address: Arg1, ) -> TxTypedCall { self.wrapped_tx .payment(NotPayable) .raw_call("wipeSingleNFT") - .argument(token_identifier) + .argument(&token_identifier) .argument(&nft_nonce) - .argument(address) + .argument(&address) .original_result() } @@ -463,13 +463,13 @@ where /// This function as almost all in case of ESDT can be called only by the owner. pub fn change_sft_to_meta_esdt>>( self, - token_identifier: &Arg0, + token_identifier: Arg0, num_decimals: usize, ) -> TxTypedCall { self.wrapped_tx .payment(NotPayable) .raw_call("changeSFTToMetaESDT") - .argument(token_identifier) + .argument(&token_identifier) .argument(&num_decimals) .original_result() } @@ -484,16 +484,16 @@ where Arg1: ProxyArg>, >( self, - address: &Arg0, - token_identifier: &Arg1, + address: Arg0, + token_identifier: Arg1, roles_iter: RoleIter, ) -> TxTypedCall { let mut tx = self .wrapped_tx .payment(NotPayable) .raw_call("setSpecialRole") - .argument(token_identifier) - .argument(address); + .argument(&token_identifier) + .argument(&address); for role in roles_iter { if role != EsdtLocalRole::None { tx = tx.argument(&role.as_role_name()); @@ -513,16 +513,16 @@ where Arg1: ProxyArg>, >( self, - address: &Arg0, - token_identifier: &Arg1, + address: Arg0, + token_identifier: Arg1, roles_iter: RoleIter, ) -> TxTypedCall { let mut tx = self .wrapped_tx .payment(NotPayable) .raw_call("unSetSpecialRole") - .argument(token_identifier) - .argument(address); + .argument(&token_identifier) + .argument(&address); for role in roles_iter { if role != EsdtLocalRole::None { tx = tx.argument(&role.as_role_name()); @@ -537,14 +537,14 @@ where Arg1: ProxyArg>, >( self, - token_identifier: &Arg0, - new_owner: &Arg1, + token_identifier: Arg0, + new_owner: Arg1, ) -> TxTypedCall { self.wrapped_tx .payment(NotPayable) .raw_call("transferOwnership") - .argument(token_identifier) - .argument(new_owner) + .argument(&token_identifier) + .argument(&new_owner) .original_result() } @@ -553,29 +553,29 @@ where Arg1: ProxyArg>, >( self, - token_identifier: &Arg0, - old_creator: &Arg1, - new_creator: &Arg1, + token_identifier: Arg0, + old_creator: Arg1, + new_creator: Arg1, ) -> TxTypedCall { self.wrapped_tx .payment(NotPayable) .raw_call("transferNFTCreateRole") - .argument(token_identifier) - .argument(old_creator) - .argument(new_creator) + .argument(&token_identifier) + .argument(&old_creator) + .argument(&new_creator) .original_result() } pub fn control_changes>>( self, - token_identifier: &Arg0, + token_identifier: Arg0, property_arguments: &TokenPropertyArguments, ) -> TxTypedCall { let mut tx = self .wrapped_tx .payment(NotPayable) .raw_call("controlChanges") - .argument(token_identifier); + .argument(&token_identifier); append_token_property_arguments(&mut tx.data, property_arguments); tx.original_result() } diff --git a/tools/interactor-system-func-calls/src/system_sc_interact.rs b/tools/interactor-system-func-calls/src/system_sc_interact.rs index 0558eba3c1..df47733d47 100644 --- a/tools/interactor-system-func-calls/src/system_sc_interact.rs +++ b/tools/interactor-system-func-calls/src/system_sc_interact.rs @@ -257,9 +257,9 @@ impl SysFuncCallsInteract { .typed(ESDTSystemSCProxy) .issue_fungible( issue_cost.into(), - &token_display_name, - &token_ticker, - &initial_supply, + token_display_name, + token_ticker, + initial_supply, FungibleTokenProperties { num_decimals, can_freeze: true, @@ -297,8 +297,8 @@ impl SysFuncCallsInteract { .typed(ESDTSystemSCProxy) .issue_non_fungible( issue_cost.into(), - &token_display_name, - &token_ticker, + token_display_name, + token_ticker, NonFungibleTokenProperties { can_freeze: true, can_wipe: true, @@ -334,8 +334,8 @@ impl SysFuncCallsInteract { .typed(ESDTSystemSCProxy) .issue_semi_fungible( issue_cost.into(), - &token_display_name, - &token_ticker, + token_display_name, + token_ticker, SemiFungibleTokenProperties { can_freeze: true, can_wipe: true, @@ -397,8 +397,8 @@ impl SysFuncCallsInteract { .gas(100_000_000u64) .typed(ESDTSystemSCProxy) .set_special_roles( - &ManagedAddress::from_address(wallet_address), - &TokenIdentifier::from(token_id), + ManagedAddress::from_address(wallet_address), + TokenIdentifier::from(token_id), roles.into_iter(), ) .prepare_async() @@ -423,11 +423,11 @@ impl SysFuncCallsInteract { .gas(100_000_000u64) .typed(UserBuiltinProxy) .esdt_nft_create( - &token_id, - &amount, - &name, - &royalties, - &hash, + token_id, + amount, + name, + royalties, + hash, &NftDummyAttributes { creation_epoch: 2104, cool_factor: 5, @@ -457,8 +457,8 @@ impl SysFuncCallsInteract { .typed(ESDTSystemSCProxy) .register_meta_esdt( issue_cost.into(), - &token_display_name, - &token_ticker, + token_display_name, + token_ticker, MetaTokenProperties { num_decimals, can_freeze: true, @@ -487,7 +487,7 @@ impl SysFuncCallsInteract { .to(ESDTSystemSCAddress) .gas(100_000_000u64) .typed(ESDTSystemSCProxy) - .change_sft_to_meta_esdt(&token_id, num_decimals) + .change_sft_to_meta_esdt(token_id, num_decimals) .prepare_async() .run() .await; @@ -502,7 +502,7 @@ impl SysFuncCallsInteract { .to(&self.wallet_address) .gas(100_000_000u64) .typed(UserBuiltinProxy) - .esdt_local_mint(&token_id, nonce, &amount) + .esdt_local_mint(token_id, nonce, amount) .prepare_async() .run() .await; @@ -517,7 +517,7 @@ impl SysFuncCallsInteract { .to(&self.wallet_address) .gas(100_000_000u64) .typed(UserBuiltinProxy) - .esdt_local_burn(&token_id, nonce, &amount) + .esdt_local_burn(token_id, nonce, amount) .prepare_async() .run() .await; @@ -532,7 +532,7 @@ impl SysFuncCallsInteract { .to(ESDTSystemSCAddress) .gas(100_000_000u64) .typed(ESDTSystemSCProxy) - .pause(&token_id) + .pause(token_id) .prepare_async() .run() .await; @@ -547,7 +547,7 @@ impl SysFuncCallsInteract { .to(ESDTSystemSCAddress) .gas(100_000_000u64) .typed(ESDTSystemSCProxy) - .unpause(&token_id) + .unpause(token_id) .prepare_async() .run() .await; @@ -562,7 +562,7 @@ impl SysFuncCallsInteract { .to(ESDTSystemSCAddress) .gas(100_000_000u64) .typed(ESDTSystemSCProxy) - .freeze(&token_id, &address) + .freeze(token_id, address) .prepare_async() .run() .await; @@ -577,7 +577,7 @@ impl SysFuncCallsInteract { .to(ESDTSystemSCAddress) .gas(100_000_000u64) .typed(ESDTSystemSCProxy) - .unfreeze(&token_id, &address) + .unfreeze(token_id, address) .prepare_async() .run() .await; @@ -592,7 +592,7 @@ impl SysFuncCallsInteract { .to(ESDTSystemSCAddress) .gas(100_000_000u64) .typed(ESDTSystemSCProxy) - .freeze_nft(&token_id, nonce, &address) + .freeze_nft(token_id, nonce, address) .prepare_async() .run() .await; @@ -607,7 +607,7 @@ impl SysFuncCallsInteract { .to(ESDTSystemSCAddress) .gas(100_000_000u64) .typed(ESDTSystemSCProxy) - .unfreeze_nft(&token_id, nonce, &address) + .unfreeze_nft(token_id, nonce, address) .prepare_async() .run() .await; @@ -622,7 +622,7 @@ impl SysFuncCallsInteract { .to(ESDTSystemSCAddress) .gas(100_000_000u64) .typed(ESDTSystemSCProxy) - .wipe(&token_id, &address) + .wipe(token_id, address) .prepare_async() .run() .await; @@ -637,7 +637,7 @@ impl SysFuncCallsInteract { .to(ESDTSystemSCAddress) .gas(100_000_000u64) .typed(ESDTSystemSCProxy) - .wipe_nft(&token_id, nonce, &address) + .wipe_nft(token_id, nonce, address) .prepare_async() .run() .await; @@ -660,11 +660,11 @@ impl SysFuncCallsInteract { .gas(100_000_000u64) .typed(UserBuiltinProxy) .esdt_nft_create( - &token_id, - &amount, - &name, - &royalties, - &hash, + token_id, + amount, + name, + royalties, + hash, &NftDummyAttributes { creation_epoch: 2104, cool_factor: 5, @@ -690,7 +690,7 @@ impl SysFuncCallsInteract { .to(ESDTSystemSCAddress) .gas(100_000_000u64) .typed(ESDTSystemSCProxy) - .unset_special_roles(&address, &token_id, roles.into_iter()) + .unset_special_roles(address, token_id, roles.into_iter()) .prepare_async() .run() .await; @@ -705,7 +705,7 @@ impl SysFuncCallsInteract { .to(ESDTSystemSCAddress) .gas(100_000_000u64) .typed(ESDTSystemSCProxy) - .transfer_ownership(&token_id, &new_owner) + .transfer_ownership(token_id, new_owner) .prepare_async() .run() .await; @@ -725,7 +725,7 @@ impl SysFuncCallsInteract { .to(ESDTSystemSCAddress) .gas(100_000_000u64) .typed(ESDTSystemSCProxy) - .transfer_nft_create_role(&token_id, &old_owner, &new_owner) + .transfer_nft_create_role(token_id, old_owner, new_owner) .prepare_async() .run() .await; @@ -741,7 +741,7 @@ impl SysFuncCallsInteract { .gas(100_000_000u64) .typed(ESDTSystemSCProxy) .control_changes( - &token_id, + token_id, &TokenPropertyArguments { can_freeze: Some(true), can_wipe: Some(true), From ac12c0c1c3562f44b91fbdc4f04f000d9e008d2d Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Thu, 26 Sep 2024 12:42:54 +0300 Subject: [PATCH 2/2] sdk - separated gateway in new crate --- Cargo.lock | 218 +++++++----------- Cargo.toml | 1 + framework/snippets/Cargo.toml | 4 +- framework/snippets/src/account_tool.rs | 8 +- framework/snippets/src/imports.rs | 2 +- framework/snippets/src/interactor.rs | 10 +- .../interactor_scenario/interactor_sc_call.rs | 2 +- .../interactor_sc_deploy.rs | 2 +- .../interactor_vm_query.rs | 2 +- framework/snippets/src/interactor_sender.rs | 2 +- framework/snippets/src/lib.rs | 4 +- .../src/multi/interactor_multi_sc_exec.rs | 2 +- .../src/multi/interactor_multi_sc_process.rs | 2 +- .../snippets/src/multi/interactor_step.rs | 2 +- framework/snippets/src/network_response.rs | 2 +- framework/snippets/src/test_wallets.rs | 2 +- .../tests/test_tx_deployed_address.rs | 4 +- .../tests/test_tx_issued_token_identifier.rs | 2 +- .../tests/test_tx_multi_contract_sc_result.rs | 2 +- .../tests/test_tx_multiple_sc_results.rs | 2 +- framework/snippets/tests/test_tx_sc_result.rs | 2 +- sdk/core/Cargo.toml | 2 - sdk/core/src/lib.rs | 1 - sdk/reqwest/Cargo.toml | 28 +++ sdk/reqwest/README.md | 25 ++ sdk/{core => reqwest}/examples/account.rs | 4 +- .../examples/account_storage.rs | 4 +- sdk/reqwest/examples/generate_mnemonic.rs | 9 + .../examples/get_esdt_tokens.rs | 4 +- .../examples/get_hyper_block_by_hash.rs | 2 +- .../examples/get_hyper_block_by_nonce.rs | 2 +- .../examples/get_hyper_block_latest.rs | 2 +- .../examples/get_network_config.rs | 2 +- .../examples/get_network_economics.rs | 2 +- sdk/{core => reqwest}/examples/sign_tx.rs | 6 +- sdk/{core => reqwest}/examples/sign_txs.rs | 6 +- sdk/{core => reqwest}/examples/tx_cost.rs | 6 +- .../examples/tx_default_args.rs | 4 +- sdk/{core => reqwest}/examples/tx_info.rs | 2 +- sdk/{core => reqwest}/examples/vm_query.rs | 6 +- sdk/{core => reqwest}/src/gateway.rs | 0 .../src/gateway/gateway_account.rs | 2 +- .../src/gateway/gateway_block.rs | 2 +- .../src/gateway/gateway_network.rs | 2 +- .../src/gateway/gateway_proxy.rs | 0 .../src/gateway/gateway_tx.rs | 2 +- .../src/gateway/gateway_tx_retrieve.rs | 2 +- sdk/reqwest/src/lib.rs | 4 + 48 files changed, 212 insertions(+), 196 deletions(-) create mode 100644 sdk/reqwest/Cargo.toml create mode 100644 sdk/reqwest/README.md rename sdk/{core => reqwest}/examples/account.rs (86%) rename sdk/{core => reqwest}/examples/account_storage.rs (87%) create mode 100644 sdk/reqwest/examples/generate_mnemonic.rs rename sdk/{core => reqwest}/examples/get_esdt_tokens.rs (86%) rename sdk/{core => reqwest}/examples/get_hyper_block_by_hash.rs (81%) rename sdk/{core => reqwest}/examples/get_hyper_block_by_nonce.rs (76%) rename sdk/{core => reqwest}/examples/get_hyper_block_latest.rs (76%) rename sdk/{core => reqwest}/examples/get_network_config.rs (76%) rename sdk/{core => reqwest}/examples/get_network_economics.rs (77%) rename sdk/{core => reqwest}/examples/sign_tx.rs (91%) rename sdk/{core => reqwest}/examples/sign_txs.rs (93%) rename sdk/{core => reqwest}/examples/tx_cost.rs (88%) rename sdk/{core => reqwest}/examples/tx_default_args.rs (89%) rename sdk/{core => reqwest}/examples/tx_info.rs (87%) rename sdk/{core => reqwest}/examples/vm_query.rs (86%) rename sdk/{core => reqwest}/src/gateway.rs (100%) rename sdk/{core => reqwest}/src/gateway/gateway_account.rs (99%) rename sdk/{core => reqwest}/src/gateway/gateway_block.rs (98%) rename sdk/{core => reqwest}/src/gateway/gateway_network.rs (98%) rename sdk/{core => reqwest}/src/gateway/gateway_proxy.rs (100%) rename sdk/{core => reqwest}/src/gateway/gateway_tx.rs (99%) rename sdk/{core => reqwest}/src/gateway/gateway_tx_retrieve.rs (98%) create mode 100644 sdk/reqwest/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index b865897548..18b8fbb93d 100755 --- a/Cargo.lock +++ b/Cargo.lock @@ -47,19 +47,13 @@ dependencies = [ [[package]] name = "addr2line" -version = "0.22.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +checksum = "f5fb1d8e4442bd405fdfd1dacb42792696b0cf9cb15882e5d097b742a676d375" dependencies = [ "gimli", ] -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - [[package]] name = "adler2" version = "2.0.0" @@ -166,9 +160,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" [[package]] name = "arbitrary" @@ -199,17 +193,17 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "backtrace" -version = "0.3.73" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" dependencies = [ "addr2line", - "cc", "cfg-if", "libc", - "miniz_oxide 0.7.4", + "miniz_oxide", "object", "rustc-demangle", + "windows-targets 0.52.6", ] [[package]] @@ -386,15 +380,15 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.7.1" +version = "1.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" +checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" [[package]] name = "cc" -version = "1.1.15" +version = "1.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57b6a275aa2903740dc87da01c62040406b8812552e97129a63ea8850a17c6e6" +checksum = "07b1695e2c7e8fc85310cde85aeaab7e3097f593c91d209d3f9df76c928100f0" dependencies = [ "shlex", ] @@ -452,9 +446,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.16" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed6719fffa43d0d87e5fd8caeab59be1554fb028cd30edc88fc4369b17971019" +checksum = "b0956a43b323ac1afaffc053ed5c4b7c1f1800bacd1683c353aabbb752515dd3" dependencies = [ "clap_builder", "clap_derive", @@ -462,9 +456,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.15" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6" +checksum = "4d72166dd41634086d5803a47eb71ae740e61d84709c36f3c34110173db3961b" dependencies = [ "anstream", "anstyle", @@ -474,9 +468,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.13" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" +checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" dependencies = [ "heck", "proc-macro2", @@ -572,9 +566,9 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51e852e6dc9a5bed1fae92dd2375037bf2b768725bf3be87811edee3249d09ad" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" dependencies = [ "libc", ] @@ -1087,7 +1081,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "324a1be68054ef05ad64b861cc9eaf1d623d2d8cb25b4bf2cb9cdd902b4bf253" dependencies = [ "crc32fast", - "miniz_oxide 0.8.0", + "miniz_oxide", ] [[package]] @@ -1333,15 +1327,15 @@ dependencies = [ [[package]] name = "gimli" -version = "0.29.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" +checksum = "32085ea23f3234fc7846555e85283ba4de91e21016dc0455a16286d87a292d64" [[package]] name = "globset" -version = "0.4.14" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57da3b9b5b85bd66f31093f8c408b90a74431672542466497dcbdfdc02034be1" +checksum = "15f1ce686646e7f1e19bf7d5533fe443a45dbfb990e00629110797578b42fb19" dependencies = [ "aho-corasick", "bstr", @@ -1480,9 +1474,9 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.27.2" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155" +checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" dependencies = [ "futures-util", "http", @@ -1513,9 +1507,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.7" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde7055719c54e36e95e8719f95883f22072a48ede39db7fc17a4e1d5281e9b9" +checksum = "41296eb09f183ac68eec06e03cdbea2e759633d4067b2f6552fc2e009bcad08b" dependencies = [ "bytes", "futures-channel", @@ -1526,7 +1520,6 @@ dependencies = [ "pin-project-lite", "socket2", "tokio", - "tower", "tower-service", "tracing", ] @@ -1543,9 +1536,9 @@ dependencies = [ [[package]] name = "ignore" -version = "0.4.22" +version = "0.4.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b46810df39e66e925525d6e38ce1e7f6e1d208f72dc39757880fcb66e2c58af1" +checksum = "6d89fd380afde86567dfba715db065673989d6253f42b88179abd3eae47bda4b" dependencies = [ "crossbeam-deque", "globset", @@ -1590,9 +1583,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.9.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" +checksum = "187674a687eed5fe42285b40c6291f9a01517d415fad1c3cbc6a9f778af7fcd4" [[package]] name = "is_terminal_polyfill" @@ -1720,9 +1713,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.158" +version = "0.2.159" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" [[package]] name = "linked-list-repeat" @@ -1864,15 +1857,6 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" -[[package]] -name = "miniz_oxide" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" -dependencies = [ - "adler", -] - [[package]] name = "miniz_oxide" version = "0.8.0" @@ -2134,7 +2118,7 @@ dependencies = [ "log", "multiversx-chain-scenario-format", "multiversx-sc-scenario", - "multiversx-sdk", + "multiversx-sdk-reqwest", "serde_json", "tokio", ] @@ -2163,18 +2147,29 @@ dependencies = [ "pbkdf2", "pem", "rand", - "reqwest", "scrypt", "serde", "serde_json", "serde_repr", "sha2", "sha3", - "tokio", "uuid", "zeroize", ] +[[package]] +name = "multiversx-sdk-reqwest" +version = "0.6.0" +dependencies = [ + "anyhow", + "hex", + "itertools", + "log", + "multiversx-sdk", + "reqwest", + "tokio", +] + [[package]] name = "multiversx-wegld-swap-sc" version = "0.53.0" @@ -2509,26 +2504,6 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" -[[package]] -name = "pin-project" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "pin-project-lite" version = "0.2.14" @@ -2569,9 +2544,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "ppv-lite86" @@ -2757,9 +2732,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.3" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" +checksum = "355ae415ccd3a04315d3f8246e86d67689ea74d88d915576e1589a351062a13b" dependencies = [ "bitflags", ] @@ -2939,9 +2914,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.35" +version = "0.38.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a85d50532239da68e9addb745ba38ff4612a242c1c7ceea689c4bc7c2f43c36f" +checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" dependencies = [ "bitflags", "errno", @@ -2952,9 +2927,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.12" +version = "0.23.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c58f8c84392efc0a126acce10fa59ff7b3d2ac06ab451a33f2741989b806b044" +checksum = "f2dabaac7466917e566adb06783a81ca48944c6898a1b08b9374106dd671f4c8" dependencies = [ "once_cell", "rustls-pki-types", @@ -2981,9 +2956,9 @@ checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" [[package]] name = "rustls-webpki" -version = "0.102.7" +version = "0.102.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84678086bd54edf2b415183ed7a94d0efb049f1b646a33e22a36f3794be6ae56" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" dependencies = [ "ring", "rustls-pki-types", @@ -3032,11 +3007,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" +checksum = "e9aaafd5a2b6e3d657ff009d82fbd630b6bd54dd4eb06f21693925cdf80f9b8b" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -3089,9 +3064,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.11.1" +version = "2.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75da29fe9b9b08fe9d6b22b5b4bcbc75d8db3aa31e639aa56bb62e9d46bfceaf" +checksum = "ea4a292869320c0272d7bc55a5a6aafaff59b4f63404a003887b679a2e05b4b6" dependencies = [ "core-foundation-sys", "libc", @@ -3138,18 +3113,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.209" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.209" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", @@ -3158,9 +3133,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.127" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8043c06d9f82bd7271361ed64f415fe5e12a77fdb52e573e7f06a516dea329ad" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" dependencies = [ "indexmap", "itoa", @@ -3182,9 +3157,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.7" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" dependencies = [ "serde", ] @@ -3430,18 +3405,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" dependencies = [ "proc-macro2", "quote", @@ -3531,9 +3506,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.11" +version = "0.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" +checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" dependencies = [ "bytes", "futures-core", @@ -3566,9 +3541,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.20" +version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ "indexmap", "serde", @@ -3577,27 +3552,6 @@ dependencies = [ "winnow", ] -[[package]] -name = "tower" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" -dependencies = [ - "futures-core", - "futures-util", - "pin-project", - "pin-project-lite", - "tokio", - "tower-layer", - "tower-service", -] - -[[package]] -name = "tower-layer" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" - [[package]] name = "tower-service" version = "0.3.3" @@ -3661,9 +3615,9 @@ checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unicode-normalization" @@ -3676,9 +3630,9 @@ dependencies = [ [[package]] name = "unicode-segmentation" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" [[package]] name = "untrusted" @@ -4097,9 +4051,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.6.18" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" dependencies = [ "memchr", ] diff --git a/Cargo.toml b/Cargo.toml index 651456eebd..2ba98c81a2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,6 +14,7 @@ members = [ "framework/wasm-adapter", "sdk/core", + "sdk/reqwest", "sdk/scenario-format", "tools/mxpy-snippet-generator", diff --git a/framework/snippets/Cargo.toml b/framework/snippets/Cargo.toml index 43ca798a69..1991242460 100644 --- a/framework/snippets/Cargo.toml +++ b/framework/snippets/Cargo.toml @@ -29,9 +29,9 @@ path = "../scenario" version = "0.23.0" path = "../../sdk/scenario-format" -[dependencies.multiversx-sdk] +[dependencies.multiversx-sdk-reqwest] version = "=0.6.0" -path = "../../sdk/core" +path = "../../sdk/reqwest" [dev-dependencies] serde_json = "1.0" diff --git a/framework/snippets/src/account_tool.rs b/framework/snippets/src/account_tool.rs index b10baf4a80..9238b08849 100644 --- a/framework/snippets/src/account_tool.rs +++ b/framework/snippets/src/account_tool.rs @@ -1,12 +1,10 @@ +use crate::sdk_core::data::{address::Address, esdt::EsdtBalance}; use multiversx_chain_scenario_format::interpret_trait::IntoRaw; use multiversx_sc_scenario::{ imports::Bech32Address, scenario_model::{Account, BytesKey, BytesValue, Scenario, SetStateStep, Step}, }; -use multiversx_sdk::{ - data::{address::Address, esdt::EsdtBalance}, - gateway::GatewayProxy, -}; +use multiversx_sdk_reqwest::gateway::GatewayProxy; use std::collections::{BTreeMap, HashMap}; /// Called directly from CLI, from `sc-meta`. @@ -67,7 +65,7 @@ pub async fn retrieve_account_as_scenario_set_state( } fn set_account( - account: multiversx_sdk::data::account::Account, + account: crate::sdk::data::account::Account, account_storage: HashMap, account_esdt: HashMap, account_esdt_roles: HashMap>, diff --git a/framework/snippets/src/imports.rs b/framework/snippets/src/imports.rs index a22c969887..4e08dbc5ea 100644 --- a/framework/snippets/src/imports.rs +++ b/framework/snippets/src/imports.rs @@ -4,7 +4,7 @@ pub use crate::{ dns_address_for_name, test_wallets, Interactor, InteractorPrepareAsync, StepBuffer, }; -pub use multiversx_sdk::{data::keystore::InsertPassword, wallet::Wallet}; +pub use crate::sdk::{data::keystore::InsertPassword, wallet::Wallet}; pub use env_logger; pub use tokio; diff --git a/framework/snippets/src/interactor.rs b/framework/snippets/src/interactor.rs index bb38873afe..71412d68a1 100644 --- a/framework/snippets/src/interactor.rs +++ b/framework/snippets/src/interactor.rs @@ -1,14 +1,14 @@ +use crate::sdk::{ + data::{address::Address as ErdrsAddress, network_config::NetworkConfig}, + wallet::Wallet, +}; use multiversx_sc_scenario::{ imports::{Bech32Address, ScenarioRunner}, mandos_system::{run_list::ScenarioRunnerList, run_trace::ScenarioTraceFile}, multiversx_sc::types::Address, scenario_model::AddressValue, }; -use multiversx_sdk::{ - data::{address::Address as ErdrsAddress, network_config::NetworkConfig}, - gateway::GatewayProxy, - wallet::Wallet, -}; +use multiversx_sdk_reqwest::gateway::GatewayProxy; use std::{ collections::HashMap, path::{Path, PathBuf}, diff --git a/framework/snippets/src/interactor_scenario/interactor_sc_call.rs b/framework/snippets/src/interactor_scenario/interactor_sc_call.rs index 6802304ae9..f0b01badab 100644 --- a/framework/snippets/src/interactor_scenario/interactor_sc_call.rs +++ b/framework/snippets/src/interactor_scenario/interactor_sc_call.rs @@ -5,7 +5,7 @@ use multiversx_sc_scenario::{ scenario::ScenarioRunner, scenario_model::{ScCallStep, SetStateStep, TxCall}, }; -use multiversx_sdk::{data::transaction::Transaction, utils::base64_encode}; +use crate::sdk::{data::transaction::Transaction, utils::base64_encode}; impl Interactor { pub async fn sc_call(&mut self, mut sc_call_step: S) diff --git a/framework/snippets/src/interactor_scenario/interactor_sc_deploy.rs b/framework/snippets/src/interactor_scenario/interactor_sc_deploy.rs index 59de249e83..764cff02c6 100644 --- a/framework/snippets/src/interactor_scenario/interactor_sc_deploy.rs +++ b/framework/snippets/src/interactor_scenario/interactor_sc_deploy.rs @@ -5,7 +5,7 @@ use multiversx_sc_scenario::{ mandos_system::ScenarioRunner, scenario_model::{ScDeployStep, SetStateStep}, }; -use multiversx_sdk::{ +use crate::sdk::{ data::{address::Address as ErdrsAddress, transaction::Transaction}, utils::base64_encode, }; diff --git a/framework/snippets/src/interactor_scenario/interactor_vm_query.rs b/framework/snippets/src/interactor_scenario/interactor_vm_query.rs index aa9f87efb7..87f3d444a2 100644 --- a/framework/snippets/src/interactor_scenario/interactor_vm_query.rs +++ b/framework/snippets/src/interactor_scenario/interactor_vm_query.rs @@ -8,7 +8,7 @@ use multiversx_sc_scenario::{ multiversx_sc::{abi::TypeAbiFrom, codec::TopDecodeMulti, types::ContractCall}, scenario_model::{ScQueryStep, TxResponse}, }; -use multiversx_sdk::{data::vm::VmValueRequest, utils::base64_decode}; +use crate::sdk::{data::vm::VmValueRequest, utils::base64_decode}; impl Interactor { pub async fn sc_query(&mut self, mut step: S) -> &mut Self diff --git a/framework/snippets/src/interactor_sender.rs b/framework/snippets/src/interactor_sender.rs index 86d6abcada..37cca670b3 100644 --- a/framework/snippets/src/interactor_sender.rs +++ b/framework/snippets/src/interactor_sender.rs @@ -1,6 +1,6 @@ use log::debug; use multiversx_sc_scenario::multiversx_sc::types::Address; -use multiversx_sdk::{data::transaction::Transaction, wallet::Wallet}; +use crate::sdk::{data::transaction::Transaction, wallet::Wallet}; use crate::{address_h256_to_erdrs, Interactor}; diff --git a/framework/snippets/src/lib.rs b/framework/snippets/src/lib.rs index 7d3b52c696..3e7ee2b7ec 100644 --- a/framework/snippets/src/lib.rs +++ b/framework/snippets/src/lib.rs @@ -17,8 +17,8 @@ pub use interactor_tx::*; pub use log; pub use multi::*; pub use multiversx_sc_scenario::{self, multiversx_sc}; -pub use multiversx_sdk as erdrs; // TODO: remove -pub use multiversx_sdk as sdk; +pub use multiversx_sdk_reqwest::core as sdk_core; +pub use multiversx_sdk_reqwest::core as sdk; pub use tokio; /// Imports normally needed in interactors, grouped together. diff --git a/framework/snippets/src/multi/interactor_multi_sc_exec.rs b/framework/snippets/src/multi/interactor_multi_sc_exec.rs index 8ac6a4eba9..255224f86f 100644 --- a/framework/snippets/src/multi/interactor_multi_sc_exec.rs +++ b/framework/snippets/src/multi/interactor_multi_sc_exec.rs @@ -1,6 +1,6 @@ use super::interactor_multi_sc_process::{update_nonces_and_sign_tx, SenderSet, Txs}; +use crate::sdk::data::transaction::Transaction; use crate::{network_response, Interactor, InteractorStep, StepBuffer}; -use multiversx_sdk::data::transaction::Transaction; impl Interactor { pub async fn multi_sc_exec(&mut self, mut buffer: StepBuffer<'_>) { diff --git a/framework/snippets/src/multi/interactor_multi_sc_process.rs b/framework/snippets/src/multi/interactor_multi_sc_process.rs index 3364a4d5ee..e842a6ae15 100644 --- a/framework/snippets/src/multi/interactor_multi_sc_process.rs +++ b/framework/snippets/src/multi/interactor_multi_sc_process.rs @@ -1,6 +1,6 @@ use crate::{multiversx_sc::types::Address, Interactor, Sender}; use futures::future::join_all; -use multiversx_sdk::data::transaction::{Transaction, TransactionOnNetwork}; +use crate::sdk::data::transaction::{Transaction, TransactionOnNetwork}; use std::collections::HashSet; pub(crate) type Txs = Vec; diff --git a/framework/snippets/src/multi/interactor_step.rs b/framework/snippets/src/multi/interactor_step.rs index be172bbb82..7b2a8a0db2 100644 --- a/framework/snippets/src/multi/interactor_step.rs +++ b/framework/snippets/src/multi/interactor_step.rs @@ -2,7 +2,7 @@ use multiversx_sc_scenario::{ mandos_system::ScenarioRunner, scenario_model::{AddressValue, ScCallStep, ScDeployStep, TxResponse}, }; -use multiversx_sdk::data::transaction::Transaction; +use crate::sdk::data::transaction::Transaction; use crate::Interactor; diff --git a/framework/snippets/src/network_response.rs b/framework/snippets/src/network_response.rs index 0140dd839e..a5a075d438 100644 --- a/framework/snippets/src/network_response.rs +++ b/framework/snippets/src/network_response.rs @@ -3,7 +3,7 @@ use multiversx_sc_scenario::{ multiversx_chain_vm::crypto_functions::keccak256, scenario_model::{Log, TxResponse, TxResponseStatus}, }; -use multiversx_sdk::{ +use crate::sdk::{ data::transaction::{ApiSmartContractResult, Events, TransactionOnNetwork}, utils::base64_decode, }; diff --git a/framework/snippets/src/test_wallets.rs b/framework/snippets/src/test_wallets.rs index 341f93ef29..94fccc2521 100644 --- a/framework/snippets/src/test_wallets.rs +++ b/framework/snippets/src/test_wallets.rs @@ -1,4 +1,4 @@ -use multiversx_sdk::wallet::Wallet; +use crate::sdk::wallet::Wallet; fn test_wallet(pem_file_contents: &str) -> Wallet { Wallet::from_pem_file_contents(pem_file_contents.to_string()).unwrap() diff --git a/framework/snippets/tests/test_tx_deployed_address.rs b/framework/snippets/tests/test_tx_deployed_address.rs index 377a0e779f..702f069cf8 100644 --- a/framework/snippets/tests/test_tx_deployed_address.rs +++ b/framework/snippets/tests/test_tx_deployed_address.rs @@ -1,6 +1,6 @@ use multiversx_sc_scenario::imports::Address; use multiversx_sc_snippets::network_response; -use multiversx_sdk::data::transaction::{TransactionInfo, TransactionOnNetwork}; +use multiversx_sc_snippets::sdk::data::transaction::{TransactionInfo, TransactionOnNetwork}; #[test] fn test_deployed_address() { @@ -55,7 +55,7 @@ fn test_deployed_address() { .transaction; let tx_response = network_response::parse_tx_response(tx_on_network); let opt_address = tx_response.new_deployed_address.map(|e| { - multiversx_sdk::data::address::Address::from_bytes(*e.as_array()) + multiversx_sc_snippets::sdk::data::address::Address::from_bytes(*e.as_array()) .to_bech32_string() .unwrap() }); diff --git a/framework/snippets/tests/test_tx_issued_token_identifier.rs b/framework/snippets/tests/test_tx_issued_token_identifier.rs index 3539c4e757..5cb356c4e1 100644 --- a/framework/snippets/tests/test_tx_issued_token_identifier.rs +++ b/framework/snippets/tests/test_tx_issued_token_identifier.rs @@ -1,5 +1,5 @@ use multiversx_sc_snippets::network_response; -use multiversx_sdk::data::transaction::{TransactionInfo, TransactionOnNetwork}; +use multiversx_sc_snippets::sdk::data::transaction::{TransactionInfo, TransactionOnNetwork}; #[test] fn test_process_issued_token_identifier_fungible() { diff --git a/framework/snippets/tests/test_tx_multi_contract_sc_result.rs b/framework/snippets/tests/test_tx_multi_contract_sc_result.rs index a9b64d8941..f6a2fe8d6d 100644 --- a/framework/snippets/tests/test_tx_multi_contract_sc_result.rs +++ b/framework/snippets/tests/test_tx_multi_contract_sc_result.rs @@ -1,5 +1,5 @@ use multiversx_sc_snippets::network_response; -use multiversx_sdk::data::transaction::{TransactionInfo, TransactionOnNetwork}; +use multiversx_sc_snippets::sdk::data::transaction::{TransactionInfo, TransactionOnNetwork}; #[test] fn test_with_multi_contract_same_shard_tx_that_has_no_sc_result() { diff --git a/framework/snippets/tests/test_tx_multiple_sc_results.rs b/framework/snippets/tests/test_tx_multiple_sc_results.rs index 4fee781b7f..cb1b634665 100644 --- a/framework/snippets/tests/test_tx_multiple_sc_results.rs +++ b/framework/snippets/tests/test_tx_multiple_sc_results.rs @@ -1,5 +1,5 @@ use multiversx_sc_snippets::network_response::{self, is_out_scr}; -use multiversx_sdk::data::transaction::{TransactionInfo, TransactionOnNetwork}; +use multiversx_sc_snippets::sdk::data::transaction::{TransactionInfo, TransactionOnNetwork}; #[test] fn test_transaction_multiple_sc_results() { diff --git a/framework/snippets/tests/test_tx_sc_result.rs b/framework/snippets/tests/test_tx_sc_result.rs index b3809eb2f8..f67b899ce0 100644 --- a/framework/snippets/tests/test_tx_sc_result.rs +++ b/framework/snippets/tests/test_tx_sc_result.rs @@ -1,5 +1,5 @@ use multiversx_sc_snippets::network_response; -use multiversx_sdk::data::transaction::{TransactionInfo, TransactionOnNetwork}; +use multiversx_sc_snippets::sdk::data::transaction::{TransactionInfo, TransactionOnNetwork}; #[test] fn test_with_tx_that_has_sc_result() { diff --git a/sdk/core/Cargo.toml b/sdk/core/Cargo.toml index 1dc7b129f5..328453ab9d 100644 --- a/sdk/core/Cargo.toml +++ b/sdk/core/Cargo.toml @@ -16,8 +16,6 @@ categories = ["cryptography::cryptocurrencies", "api-bindings"] keywords = ["multiversx", "blockchain", "sdk", "api"] [dependencies] -tokio = { version = "1.24", features = ["full"] } -reqwest = { version = "0.12", features = ["blocking", "json"] } serde = { version = "1.0.130", features = ["derive"] } serde_json = { version = "1.0.68", features = ["preserve_order"] } serde_repr = "0.1.8" diff --git a/sdk/core/src/lib.rs b/sdk/core/src/lib.rs index 3a1db99fd7..e19f3cf2cb 100644 --- a/sdk/core/src/lib.rs +++ b/sdk/core/src/lib.rs @@ -1,5 +1,4 @@ pub mod crypto; pub mod data; -pub mod gateway; pub mod utils; pub mod wallet; diff --git a/sdk/reqwest/Cargo.toml b/sdk/reqwest/Cargo.toml new file mode 100644 index 0000000000..2758ada520 --- /dev/null +++ b/sdk/reqwest/Cargo.toml @@ -0,0 +1,28 @@ +[package] +name = "multiversx-sdk-reqwest" +version = "0.6.0" +edition = "2021" + +authors = [ + "MultiversX ", +] +license = "MIT" +readme = "README.md" +repository = "https://github.com/multiversx/mx-sdk-rs" +homepage = "https://multiversx.com/" +documentation = "https://docs.multiversx.com/" +description = "SDK for interacting with the MultiversX blockchain" +categories = ["cryptography::cryptocurrencies", "api-bindings"] +keywords = ["multiversx", "blockchain", "sdk", "api"] + +[dependencies] +tokio = { version = "1.24", features = ["full"] } +reqwest = { version = "0.12", features = ["blocking", "json"] } +anyhow = "1.0.44" +hex = "0.4.3" +itertools = "0.13.0" +log = "0.4.17" + +[dependencies.multiversx-sdk] +version = "=0.6.0" +path = "../core" \ No newline at end of file diff --git a/sdk/reqwest/README.md b/sdk/reqwest/README.md new file mode 100644 index 0000000000..64ab1a19ac --- /dev/null +++ b/sdk/reqwest/README.md @@ -0,0 +1,25 @@ +# MultiversX SDK for Rust + +[![Crates.io](https://img.shields.io/crates/v/multiversx-sdk)](https://crates.io/crates/multiversx-sdk) + +General purpose collection of tools & SDKs to interact with the MultiversX blockchain from Rust projects. + +## Example + +```rust +use multiversx_sdk::blockchain::rpc::{CommunicationProxy, DEVNET_GATEWAY}; + +#[tokio::test] +async fn get_network_config() { + let blockchain = CommunicationProxy::new(DEVNET_GATEWAY.to_string()); + let network_config = blockchain.get_network_config().await.unwrap(); + + println!("network_config: {:?}", network_config) +} +``` + +More examples in `./examples`. + +## Acknowledgements + +Project originally started by [Bicarus labs](https://github.com/bicarus-labs/elrond-sdk-erdrs), later integrated into the MultiversX official codebase. diff --git a/sdk/core/examples/account.rs b/sdk/reqwest/examples/account.rs similarity index 86% rename from sdk/core/examples/account.rs rename to sdk/reqwest/examples/account.rs index 5e9456f4b0..1551ea2827 100644 --- a/sdk/core/examples/account.rs +++ b/sdk/reqwest/examples/account.rs @@ -1,5 +1,5 @@ -use multiversx_sdk::{ - data::address::Address, +use multiversx_sdk_reqwest::{ + core::data::address::Address, gateway::{GatewayProxy, DEVNET_GATEWAY}, }; diff --git a/sdk/core/examples/account_storage.rs b/sdk/reqwest/examples/account_storage.rs similarity index 87% rename from sdk/core/examples/account_storage.rs rename to sdk/reqwest/examples/account_storage.rs index 7693c26e08..b6fc269b98 100644 --- a/sdk/core/examples/account_storage.rs +++ b/sdk/reqwest/examples/account_storage.rs @@ -1,5 +1,5 @@ -use multiversx_sdk::{ - data::address::Address, +use multiversx_sdk_reqwest::{ + core::data::address::Address, gateway::{GatewayProxy, DEVNET_GATEWAY}, }; diff --git a/sdk/reqwest/examples/generate_mnemonic.rs b/sdk/reqwest/examples/generate_mnemonic.rs new file mode 100644 index 0000000000..2dcb1b6ed9 --- /dev/null +++ b/sdk/reqwest/examples/generate_mnemonic.rs @@ -0,0 +1,9 @@ +use multiversx_sdk::wallet::Wallet; + +fn main() { + let mnemonic = Wallet::generate_mnemonic(); + println!("mnemonic: {mnemonic}"); + + let private_key = Wallet::get_private_key_from_mnemonic(mnemonic, 0, 0); + println!("private key: {:?}", private_key.to_string()); +} diff --git a/sdk/core/examples/get_esdt_tokens.rs b/sdk/reqwest/examples/get_esdt_tokens.rs similarity index 86% rename from sdk/core/examples/get_esdt_tokens.rs rename to sdk/reqwest/examples/get_esdt_tokens.rs index fac424da27..9884f5c39f 100644 --- a/sdk/core/examples/get_esdt_tokens.rs +++ b/sdk/reqwest/examples/get_esdt_tokens.rs @@ -1,5 +1,5 @@ -use multiversx_sdk::{ - data::address::Address, +use multiversx_sdk_reqwest::{ + core::data::address::Address, gateway::{GatewayProxy, DEVNET_GATEWAY}, }; diff --git a/sdk/core/examples/get_hyper_block_by_hash.rs b/sdk/reqwest/examples/get_hyper_block_by_hash.rs similarity index 81% rename from sdk/core/examples/get_hyper_block_by_hash.rs rename to sdk/reqwest/examples/get_hyper_block_by_hash.rs index 1d7f969ce1..d7c9d57761 100644 --- a/sdk/core/examples/get_hyper_block_by_hash.rs +++ b/sdk/reqwest/examples/get_hyper_block_by_hash.rs @@ -1,4 +1,4 @@ -use multiversx_sdk::gateway::{GatewayProxy, DEVNET_GATEWAY}; +use multiversx_sdk_reqwest::gateway::{GatewayProxy, DEVNET_GATEWAY}; #[tokio::main] async fn main() { diff --git a/sdk/core/examples/get_hyper_block_by_nonce.rs b/sdk/reqwest/examples/get_hyper_block_by_nonce.rs similarity index 76% rename from sdk/core/examples/get_hyper_block_by_nonce.rs rename to sdk/reqwest/examples/get_hyper_block_by_nonce.rs index 575255d6c9..1a250881f0 100644 --- a/sdk/core/examples/get_hyper_block_by_nonce.rs +++ b/sdk/reqwest/examples/get_hyper_block_by_nonce.rs @@ -1,4 +1,4 @@ -use multiversx_sdk::gateway::{GatewayProxy, DEVNET_GATEWAY}; +use multiversx_sdk_reqwest::gateway::{GatewayProxy, DEVNET_GATEWAY}; #[tokio::main] async fn main() { diff --git a/sdk/core/examples/get_hyper_block_latest.rs b/sdk/reqwest/examples/get_hyper_block_latest.rs similarity index 76% rename from sdk/core/examples/get_hyper_block_latest.rs rename to sdk/reqwest/examples/get_hyper_block_latest.rs index 934358fdbf..628969225e 100644 --- a/sdk/core/examples/get_hyper_block_latest.rs +++ b/sdk/reqwest/examples/get_hyper_block_latest.rs @@ -1,4 +1,4 @@ -use multiversx_sdk::gateway::{GatewayProxy, DEVNET_GATEWAY}; +use multiversx_sdk_reqwest::gateway::{GatewayProxy, DEVNET_GATEWAY}; #[tokio::main] async fn main() { diff --git a/sdk/core/examples/get_network_config.rs b/sdk/reqwest/examples/get_network_config.rs similarity index 76% rename from sdk/core/examples/get_network_config.rs rename to sdk/reqwest/examples/get_network_config.rs index d53e0e7ce1..070270bb2c 100644 --- a/sdk/core/examples/get_network_config.rs +++ b/sdk/reqwest/examples/get_network_config.rs @@ -1,4 +1,4 @@ -use multiversx_sdk::gateway::{GatewayProxy, DEVNET_GATEWAY}; +use multiversx_sdk_reqwest::gateway::{GatewayProxy, DEVNET_GATEWAY}; #[tokio::main] async fn main() { diff --git a/sdk/core/examples/get_network_economics.rs b/sdk/reqwest/examples/get_network_economics.rs similarity index 77% rename from sdk/core/examples/get_network_economics.rs rename to sdk/reqwest/examples/get_network_economics.rs index bb0410c8f0..bfafa0fa6e 100644 --- a/sdk/core/examples/get_network_economics.rs +++ b/sdk/reqwest/examples/get_network_economics.rs @@ -1,4 +1,4 @@ -use multiversx_sdk::gateway::{GatewayProxy, DEVNET_GATEWAY}; +use multiversx_sdk_reqwest::gateway::{GatewayProxy, DEVNET_GATEWAY}; #[tokio::main] async fn main() { diff --git a/sdk/core/examples/sign_tx.rs b/sdk/reqwest/examples/sign_tx.rs similarity index 91% rename from sdk/core/examples/sign_tx.rs rename to sdk/reqwest/examples/sign_tx.rs index aa3f977321..3320bb70c1 100644 --- a/sdk/core/examples/sign_tx.rs +++ b/sdk/reqwest/examples/sign_tx.rs @@ -1,7 +1,7 @@ -use multiversx_sdk::{ - data::transaction::Transaction, +use multiversx_sdk_reqwest::{ + core::data::transaction::Transaction, gateway::{GatewayProxy, DEVNET_GATEWAY}, - wallet::Wallet, + core::wallet::Wallet, }; #[tokio::main] diff --git a/sdk/core/examples/sign_txs.rs b/sdk/reqwest/examples/sign_txs.rs similarity index 93% rename from sdk/core/examples/sign_txs.rs rename to sdk/reqwest/examples/sign_txs.rs index 2860d528f7..aadeafec51 100644 --- a/sdk/core/examples/sign_txs.rs +++ b/sdk/reqwest/examples/sign_txs.rs @@ -1,7 +1,7 @@ -use multiversx_sdk::{ - data::transaction::Transaction, +use multiversx_sdk_reqwest::{ + core::data::transaction::Transaction, gateway::{GatewayProxy, DEVNET_GATEWAY}, - wallet::Wallet, + core::wallet::Wallet, }; #[tokio::main] diff --git a/sdk/core/examples/tx_cost.rs b/sdk/reqwest/examples/tx_cost.rs similarity index 88% rename from sdk/core/examples/tx_cost.rs rename to sdk/reqwest/examples/tx_cost.rs index a982b130ec..0a65d3adc5 100644 --- a/sdk/core/examples/tx_cost.rs +++ b/sdk/reqwest/examples/tx_cost.rs @@ -1,7 +1,7 @@ -use multiversx_sdk::{ - data::{address::Address, transaction::Transaction}, +use multiversx_sdk_reqwest::{ + core::data::{address::Address, transaction::Transaction}, + core::utils::base64_encode, gateway::{GatewayProxy, DEVNET_GATEWAY}, - utils::base64_encode, }; #[tokio::main] diff --git a/sdk/core/examples/tx_default_args.rs b/sdk/reqwest/examples/tx_default_args.rs similarity index 89% rename from sdk/core/examples/tx_default_args.rs rename to sdk/reqwest/examples/tx_default_args.rs index 01b91aa5a6..d9cab55141 100644 --- a/sdk/core/examples/tx_default_args.rs +++ b/sdk/reqwest/examples/tx_default_args.rs @@ -1,5 +1,5 @@ -use multiversx_sdk::{ - data::address::Address, +use multiversx_sdk_reqwest::{ + core::data::address::Address, gateway::{GatewayProxy, DEVNET_GATEWAY}, }; diff --git a/sdk/core/examples/tx_info.rs b/sdk/reqwest/examples/tx_info.rs similarity index 87% rename from sdk/core/examples/tx_info.rs rename to sdk/reqwest/examples/tx_info.rs index f7126daca9..bb0bdd2802 100644 --- a/sdk/core/examples/tx_info.rs +++ b/sdk/reqwest/examples/tx_info.rs @@ -1,4 +1,4 @@ -use multiversx_sdk::gateway::{GatewayProxy, DEVNET_GATEWAY}; +use multiversx_sdk_reqwest::gateway::{GatewayProxy, DEVNET_GATEWAY}; #[tokio::main] async fn main() { diff --git a/sdk/core/examples/vm_query.rs b/sdk/reqwest/examples/vm_query.rs similarity index 86% rename from sdk/core/examples/vm_query.rs rename to sdk/reqwest/examples/vm_query.rs index d07f49b856..4671505929 100644 --- a/sdk/core/examples/vm_query.rs +++ b/sdk/reqwest/examples/vm_query.rs @@ -1,7 +1,7 @@ -use multiversx_sdk::{ - data::{address::Address, vm::VmValueRequest}, +use multiversx_sdk_reqwest::{ + core::data::{address::Address, vm::VmValueRequest}, gateway::{GatewayProxy, DEVNET_GATEWAY}, - wallet::Wallet, + core::wallet::Wallet, }; #[tokio::main] diff --git a/sdk/core/src/gateway.rs b/sdk/reqwest/src/gateway.rs similarity index 100% rename from sdk/core/src/gateway.rs rename to sdk/reqwest/src/gateway.rs diff --git a/sdk/core/src/gateway/gateway_account.rs b/sdk/reqwest/src/gateway/gateway_account.rs similarity index 99% rename from sdk/core/src/gateway/gateway_account.rs rename to sdk/reqwest/src/gateway/gateway_account.rs index 7d72258544..f0de122694 100644 --- a/sdk/core/src/gateway/gateway_account.rs +++ b/sdk/reqwest/src/gateway/gateway_account.rs @@ -1,4 +1,4 @@ -use crate::data::{ +use multiversx_sdk::data::{ account::{Account, AccountResponse}, account_storage::AccountStorageResponse, address::Address, diff --git a/sdk/core/src/gateway/gateway_block.rs b/sdk/reqwest/src/gateway/gateway_block.rs similarity index 98% rename from sdk/core/src/gateway/gateway_block.rs rename to sdk/reqwest/src/gateway/gateway_block.rs index b6daf57abb..7b23436f8d 100644 --- a/sdk/core/src/gateway/gateway_block.rs +++ b/sdk/reqwest/src/gateway/gateway_block.rs @@ -1,4 +1,4 @@ -use crate::data::{ +use multiversx_sdk::data::{ hyperblock::{HyperBlock, HyperBlockResponse}, network_status::NetworkStatusResponse, }; diff --git a/sdk/core/src/gateway/gateway_network.rs b/sdk/reqwest/src/gateway/gateway_network.rs similarity index 98% rename from sdk/core/src/gateway/gateway_network.rs rename to sdk/reqwest/src/gateway/gateway_network.rs index 8b02a57d0d..19b5d6c865 100644 --- a/sdk/core/src/gateway/gateway_network.rs +++ b/sdk/reqwest/src/gateway/gateway_network.rs @@ -1,4 +1,4 @@ -use crate::data::{ +use multiversx_sdk::data::{ network_config::{NetworkConfig, NetworkConfigResponse}, network_economics::{NetworkEconomics, NetworkEconomicsResponse}, }; diff --git a/sdk/core/src/gateway/gateway_proxy.rs b/sdk/reqwest/src/gateway/gateway_proxy.rs similarity index 100% rename from sdk/core/src/gateway/gateway_proxy.rs rename to sdk/reqwest/src/gateway/gateway_proxy.rs diff --git a/sdk/core/src/gateway/gateway_tx.rs b/sdk/reqwest/src/gateway/gateway_tx.rs similarity index 99% rename from sdk/core/src/gateway/gateway_tx.rs rename to sdk/reqwest/src/gateway/gateway_tx.rs index 88d9cd4ece..a862f2818a 100644 --- a/sdk/core/src/gateway/gateway_tx.rs +++ b/sdk/reqwest/src/gateway/gateway_tx.rs @@ -1,4 +1,4 @@ -use crate::data::{ +use multiversx_sdk::data::{ address::Address, network_config::NetworkConfig, transaction::{ diff --git a/sdk/core/src/gateway/gateway_tx_retrieve.rs b/sdk/reqwest/src/gateway/gateway_tx_retrieve.rs similarity index 98% rename from sdk/core/src/gateway/gateway_tx_retrieve.rs rename to sdk/reqwest/src/gateway/gateway_tx_retrieve.rs index 61ba080430..527b7ef736 100644 --- a/sdk/core/src/gateway/gateway_tx_retrieve.rs +++ b/sdk/reqwest/src/gateway/gateway_tx_retrieve.rs @@ -1,4 +1,4 @@ -use crate::data::transaction::TransactionOnNetwork; +use multiversx_sdk::data::transaction::TransactionOnNetwork; use log::info; use std::time::{Duration, Instant}; diff --git a/sdk/reqwest/src/lib.rs b/sdk/reqwest/src/lib.rs new file mode 100644 index 0000000000..bc2a32b091 --- /dev/null +++ b/sdk/reqwest/src/lib.rs @@ -0,0 +1,4 @@ + +pub mod gateway; + +pub use multiversx_sdk as core;