I am getting the following error when trying to make a ICRC2_approve call from the frontent using oisy wallet
here is my frontend call:
const bigIntAmount = BigInt(Number(amount) * DECIMALS);
const result = await signedICPLedgerActor.icrc2_approve({
fee: [],
memo: [],
from_subaccount: [],
created_at_time: [],
amount: bigIntAmount + BigInt(ICP_LEDGER_FEE),
expected_allowance: [],
expires_at: [],
spender: {
owner: Principal.fromText(import.meta.env.CANISTER_ID),
subaccount: [],
},
});
I get the following error message:
An error occurred while retrieving the consent message / Call
D failed: Canister: <CANISTER_ID> lMethod:“”=
icrc21_canister_call_consent_message (update) “Request ID”:
Any idea what might be going on here?
All other wallets work just Oisy fails
It is happening when trying to login to oisy
Thats all i can see before it disappears
Can you provide the full log, please? The message displayed in the toast can be scrolled.
Also, what’s the target canister ID?
Here is the full message
The target canister is just a very simple rust canister that is collecting funds before redistributing them on a monthly timer
But this point is just trying to make an ICRC2_transfer_from call which is where i think this might be failing
pub async fn make_deposit(principal: Principal, amount: u64) -> Result<(), String> {
let transfer_from_args = TransferFromArgs {
from: IcpAccount {
owner: principal,
subaccount: None,
},
memo: None,
amount: Nat::from(amount),
spender_subaccount: None,
fee: Some(Nat::from(ICP_LEDGER_FEE)),
to: IcpAccount {
owner: ic_cdk::api::canister_self(),
subaccount: None,
},
created_at_time: None,
};
let allowance_args = AllowanceArgs {
account: IcpAccount {
owner: principal,
subaccount: None,
},
spender: IcpAccount {
owner: ic_cdk::api::canister_self(),
subaccount: None,
},
};
let (allowance,) = ApiClients::icp_ledger()
.icrc_2_allowance(allowance_args)
.await
.map_err(|e| e.1.to_string())?;
let (transfer_result,) = ApiClients::icp_ledger()
.icrc_2_transfer_from(transfer_from_args)
.await
.map_err(|e| {
e.1.to_string()
+ &format!(" allowance: {:?}", allowance.allowance)
+ &format!(" amount: {:?}", amount)
})?;
match transfer_result {
Result3::Ok(_) => {
DEPOSITS.with(|deposits| {
let current_amount = deposits.borrow().get(&principal).unwrap_or(0);
deposits
.borrow_mut()
.insert(principal, current_amount + amount);
});
}
Result3::Err(err) => {
return Err(format!("Error making deposit: {:?}", err)
+ &format!(" allowance: {:?}", allowance.allowance)
+ &format!(" amount: {:?}", amount));
}
}
Ok(())
}
The approve call is going through successfully. I have also just removed the allowance call and it is still coming up with the same error message so it must be the transfer from call that is failing
It would be helpful if you could share the canister ID. Based on your message, I assume the targeted canister is not a ledger (or a fork) and does not implement ICRC-21. Is that correct?
To use the signer standards, the targeted canister must implement ICRC-21. If it doesn’t, OISY may still emulate a potential consent message—but only if the canister is an ICRC ledger that exposes metadata (see this function). All other cases are rejected for security reasons.
Does your case fall into this scenario?
1 Like