When making a transfer within my app the user authorises a payment like so:
let principal = auth.identity?.getPrincipal();
console.log(principal)
if (principal) {
let subaccount: Uint8Array = principalToSubAccount(principal);
console.log(subaccount);
try {
let transfer_result = await transfer({
to: {
owner: Principal.fromText(
process.env.FOOTBALL_GOD_BACKEND_CANISTER_ID ?? “”,
),
subaccount: [subaccount],
},
fee: 100_000n,
memo: new Uint8Array(Text.encodeValue(“0”)),
from_subaccount: undefined,
created_at_time: BigInt(Date.now()) * BigInt(1_000_000),
amount: 10_000_000_000n,
});
console.log(transfer_result);
} catch (err: any) {
console.error(err.errorType);
}
}
I’ve checked the log of this sub account on the frontend
and it matches the transactions on the ledger canister
I then ran a check on the backend to see what the callers principalToSubAccount is to ensure they match:
However, they don’t:
Any idea where I’ve gone wrong?