TypeError: interfaceFactory is not a function
?
I’ve modified your code and integrated it with @ic-reactor/react.
You can check out the updated sandbox.
Do you know to to get my usdc address for deposit from external wallet?
You need to convert user principal into bytes32 format, Please take a look at this tutorial:
what I mean is when I go to binance account and withdraw to a wallet like 0xb7d95e0837fa3a722e28003bae44dd2011e6832f
which is a USC wallet. How can I generate such an address?
You cannot generate an Ethereum address using Internet Identity because it currently doesn’t support signing Ethereum transactions.
To create an Ethereum wallet within the ICP ecosystem, you need to develop a canister smart contract. Use the ecdsa_public_key to generate an Ethereum address and sign_with_ecdsa for signing transactions.
For a wallet that interacts with ck tokens, you only need an interface to call the ckMinter canister and the ckUSDC canister directly from the frontend.
Note: To mint ck tokens, you need a bytes32 address and then call a helper smart contract on Ethereum.
ok, s I can just call this from my backend
use b3_utils::{vec_to_hex_string_with_0x, Subaccount};
use candid::Principal;
#[ic_cdk::query]
fn deposit_principal(principal: String) -> String {
let principal = Principal::from_text(principal).unwrap();
let subaccount = Subaccount::from_principal(principal);
let bytes32 = subaccount.to_bytes32().unwrap();
vec_to_hex_string_with_0x(bytes32)
}