Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use query/update rather than query_/update_ #3412

Merged
merged 2 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use ic_utils::Canister;

pub(crate) async fn api_version(canister: &Canister<'_>) -> u16 {
canister
.query_(API_VERSION)
.query(API_VERSION)
.build()
.call()
.await
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub(crate) async fn get_asset_properties(
asset_id: &str,
) -> Result<AssetProperties, AgentError> {
let (asset_properties,): (AssetProperties,) = canister
.query_(GET_ASSET_PROPERTIES)
.query(GET_ASSET_PROPERTIES)
.with_arg(GetAssetPropertiesArgument(asset_id.to_string()))
.build()
.call()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub(crate) async fn create_batch(canister: &Canister<'_>) -> Result<Nat, AgentEr
let result = loop {
let create_batch_args = CreateBatchRequest {};
let response = canister
.update_(CREATE_BATCH)
.update(CREATE_BATCH)
.with_arg(&create_batch_args)
.build()
.map(|result: (CreateBatchResponse,)| (result.0.batch_id,))
Expand Down Expand Up @@ -58,7 +58,7 @@ pub(crate) async fn submit_commit_batch<T: CandidType + Sync>(

loop {
match canister
.update_(method_name)
.update(method_name)
.with_arg(&arg)
.build()
.call_and_wait()
Expand Down Expand Up @@ -103,7 +103,7 @@ pub(crate) async fn compute_evidence(

loop {
match canister
.update_(COMPUTE_EVIDENCE)
.update(COMPUTE_EVIDENCE)
.with_arg(arg)
.build()
.map(|result: (Option<ByteBuf>,)| (result.0,))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub(crate) async fn create_chunk(
.build();

loop {
let builder = canister.update_(CREATE_CHUNK);
let builder = canister.update(CREATE_CHUNK);
let builder = builder.with_arg(&args);
let request_id_result = {
let _releaser = semaphores.create_chunk_call.acquire(1).await;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub(crate) async fn list_assets(
canister: &Canister<'_>,
) -> Result<HashMap<String, AssetDetails>, AgentError> {
let (entries,): (Vec<AssetDetails>,) = canister
.query_(LIST)
.query(LIST)
.with_arg(ListAssetsRequest {})
.build()
.call()
Expand Down
2 changes: 1 addition & 1 deletion src/canisters/frontend/icx-asset/src/commands/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub async fn list(canister: &Canister<'_>, logger: &Logger) -> anyhow::Result<()
struct EmptyRecord {}

let (entries,): (Vec<ListEntry>,) = canister
.query_("list")
.query("list")
.with_arg(EmptyRecord {})
.build()
.call()
Expand Down
4 changes: 2 additions & 2 deletions src/dfx/src/commands/canister/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ struct CallIn<TCycles = u128> {
async fn do_wallet_call(wallet: &WalletCanister<'_>, args: &CallIn) -> DfxResult<Vec<u8>> {
// todo change to wallet.call when IDLValue implements ArgumentDecoder
let builder = if wallet.version_supports_u128_cycles() {
wallet.update_("wallet_call128").with_arg(args)
wallet.update("wallet_call128").with_arg(args)
} else {
let CallIn {
canister,
Expand All @@ -108,7 +108,7 @@ async fn do_wallet_call(wallet: &WalletCanister<'_>, args: &CallIn) -> DfxResult
args,
cycles: cycles as u64,
};
wallet.update_("wallet_call").with_arg(args64)
wallet.update("wallet_call").with_arg(args64)
};
let (result,): (Result<CallResult, String>,) = builder
.build()
Expand Down
4 changes: 2 additions & 2 deletions src/dfx/src/commands/wallet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ where
let wallet = get_or_create_wallet_canister(env, network, &identity_name).await?;

let out: O = wallet
.query_(method)
.query(method)
.with_arg(arg)
.build()
.call()
Expand All @@ -109,7 +109,7 @@ where
{
let wallet = get_wallet(env).await?;
let out: O = wallet
.update_(method)
.update(method)
.with_arg(arg)
.build()
.call_and_wait()
Expand Down
2 changes: 1 addition & 1 deletion src/dfx/src/lib/operations/canister/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ where
CallSender::SelectedId => {
let mgr = ManagementCanister::create(agent);

mgr.update_(method)
mgr.update(method)
.with_arg(arg)
.with_effective_canister_id(destination_canister)
.build()
Expand Down
4 changes: 2 additions & 2 deletions src/dfx/src/lib/operations/ledger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub async fn balance(
.with_canister_id(canister_id)
.build()?;
let (result,) = canister
.query_(ACCOUNT_BALANCE_METHOD)
.query(ACCOUNT_BALANCE_METHOD)
.with_arg(AccountBalanceArgs {
account: acct.to_string(),
})
Expand All @@ -53,7 +53,7 @@ pub async fn xdr_permyriad_per_icp(agent: &Agent) -> DfxResult<u64> {
.with_canister_id(MAINNET_CYCLE_MINTER_CANISTER_ID)
.build()?;
let (certified_rate,): (IcpXdrConversionRateCertifiedResponse,) = canister
.query_("get_icp_xdr_conversion_rate")
.query("get_icp_xdr_conversion_rate")
.build()
.call()
.await?;
Expand Down