Skip to content

Commit

Permalink
Define the backend canister principal in a shared location
Browse files Browse the repository at this point in the history
  • Loading branch information
bitdivine committed Oct 9, 2024
1 parent afb1e2e commit 7834c3c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/frontend/src/lib/canisters/signer.canister.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ import type {
import { idlFactory as idlCertifiedFactorySigner } from '$declarations/signer/signer.factory.certified.did';
import { idlFactory as idlFactorySigner } from '$declarations/signer/signer.factory.did';
import { getAgent } from '$lib/actors/agents.ic';
import { BACKEND_CANISTER_ID } from '$lib/constants/app.constants';
import { BACKEND_CANISTER_PRINCIPAL } from '$lib/constants/app.constants';
import type { BtcAddress, EthAddress } from '$lib/types/address';
import type { SendBtcParams } from '$lib/types/api';
import type { CreateCanisterOptions } from '$lib/types/canister';
import { Principal } from '@dfinity/principal';
import { Canister, createServices } from '@dfinity/utils';
import {
mapSignerCanisterBtcError,
Expand Down Expand Up @@ -74,7 +73,7 @@ export class SignerCanister extends Canister<SignerService> {
const response = await eth_address_of_caller([
{
PatronPaysIcrc2Cycles: {
owner: Principal.fromText(BACKEND_CANISTER_ID),
owner: BACKEND_CANISTER_PRINCIPAL,
subaccount: []
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/frontend/src/lib/constants/app.constants.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Principal } from '@dfinity/principal';
import { nonNullish } from '@dfinity/utils';
import { BigNumber } from '@ethersproject/bignumber';

Expand Down Expand Up @@ -48,6 +49,8 @@ export const BACKEND_CANISTER_ID = LOCAL
? import.meta.env.VITE_STAGING_BACKEND_CANISTER_ID
: import.meta.env.VITE_IC_BACKEND_CANISTER_ID;

export const BACKEND_CANISTER_PRINCIPAL = Principal.fromText(BACKEND_CANISTER_ID);

export const SIGNER_CANISTER_ID = LOCAL
? import.meta.env.VITE_LOCAL_SIGNER_CANISTER_ID
: STAGING
Expand Down

0 comments on commit 7834c3c

Please sign in to comment.