Using the rust defi example in other projects

In this project GitHub - aliscie/icp_wallet: rust ic wallet only backend. people can deposit and withdraw IC here., I am trying to create ICP wallet where users can deposit and withdraw ICPs.
However, I was following this example, examples/rust/defi at master · dfinity/examples · GitHub and I copied the script folder and the DIP20 and the ledgers into my project folder then I tried to run everything using make install But I am facing this error

Error: Failed while trying to deploy canisters.
Caused by: Failed while trying to deploy canisters.
  Failed while trying to install all canisters.
    Failed to install wasm module to canister 'ledger'.
      Failed during wasm installation call: The replica returned an HTTP Error: Http Error: status 413 Payload Too Large, content type "", content: Request 0x06c3685cb2c68652fc45ff2a8482bbe0f0f6477630d5c3e835cfe80294abeb5a is too large. Message byte size 2502974 is larger than the max allowed 2097152.
make: *** [install] Error 255

However, I was not facing the error when I ran the command inside the dfinity examples folder. Why my project showing this?
Also, can I just run the ledger from a separated repository (separate project) then connect it to my project?
Goal: Also, all what I need from the ledger is to run this make init-local II_PRINCIPAL=<YOUR II PRINCIPAL>

These are the critical lines: examples/dfx.json at master · dfinity/examples · GitHub. Note that by configuring it in dfx.json it will only apply if you run dfx start in that project.

The problem is that the ledger you have (not sure if there is a smaller one somewhere) is too large to be installed on an application subnet, so you have to set your local replica to system subnet type.

Yes, no problem. In that case I would recommend you define your dependency as a remote canister like this, just with the network key local instead of (or in addition to ic)

1 Like

Also, what is the ii principal? is it the user principal that I can get from

import {AuthClient} from "@dfinity/auth-client";

const auth await authClient.login({
        onSuccess: () => {
auth._principal.toText() // u mean this one?

I think that’s it, yes

1 Like

I think I did everything correctly
here is a minimal example: GitHub - aliscie/icp_wallet: rust ic wallet only backend. people can deposit and withdraw IC here.

  1. After I ran make install
  2. then npm start and go to the website and login then copy the user principal
  3. then ran make init-local II_PRINCIPAL=<principal>
  4. in index.js I have
const balances = await actor.getBalances();
console.log("balances", balances)

which return an empty list all the time even after I ran that

note: in src/ic_wallet_frontend/src/utils/agent.js you should update these constants based on your new variables
export const port = “4943”
export const canisterId = “br5f7-7uaaa-aaaaa-qaaca-cai”
export const identityId = “be2us-64aaa-aaaaa-qaabq-cai”