Skip to content

Commit

Permalink
fix: remove unnecessary logs (#927)
Browse files Browse the repository at this point in the history
* fix: remove logs

* chore(video, spaces): remove console logs

---------

Co-authored-by: Madhur Gupta <[email protected]>
  • Loading branch information
Aman035 and madhur-push authored Dec 15, 2023
1 parent 2bb1eed commit c717303
Show file tree
Hide file tree
Showing 14 changed files with 25 additions and 148 deletions.
25 changes: 8 additions & 17 deletions packages/restapi/src/lib/alias/getAliasInfo.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import axios from 'axios';
import {
getAPIBaseUrls,
getCAIPWithChainId
} from '../helpers';
import { getAPIBaseUrls, getCAIPWithChainId } from '../helpers';
import Constants, { ENV } from '../constants';
import { ALIAS_CHAIN, ALIAS_CHAIN_ID } from '../config';

Expand All @@ -16,32 +13,26 @@ export type GetAliasInfoOptionsType = {
/** name of the alias chain, can be Polygon or BSC or Optimism */
aliasChain: ALIAS_CHAIN;
env?: ENV;
}
};

/**
* Returns the ethereum channel address of the provided alias address along with its verification status
*/

export const getAliasInfo = async (
options : GetAliasInfoOptionsType
) => {
const {
alias,
aliasChain,
env = Constants.ENV.PROD,
} = options || {};
export const getAliasInfo = async (options: GetAliasInfoOptionsType) => {
const { alias, aliasChain, env = Constants.ENV.PROD } = options || {};

const aliasChainId:number = ALIAS_CHAIN_ID[aliasChain][env];
const aliasChainId: number = ALIAS_CHAIN_ID[aliasChain][env];

const _alias = getCAIPWithChainId(alias, aliasChainId, 'Alias');
// console.log(_alias)
const API_BASE_URL = getAPIBaseUrls(env);
const apiEndpoint = `${API_BASE_URL}/v1/alias`;
const requestUrl = `${apiEndpoint}/${_alias}/channel`;

return await axios.get(requestUrl)
return await axios
.get(requestUrl)
.then((response) => response.data)
.catch((err) => {
console.error(`[EPNS-SDK] - API ${requestUrl}: `, err);
});
}
};
2 changes: 1 addition & 1 deletion packages/restapi/src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const ALPHA_FEATURES = {
export const PACKAGE_BUILD = packageJson.version.includes('alpha')
? 'ALPHA'
: 'STABLE';
console.log(PACKAGE_BUILD);

const Constants = {
ENV,
ENCRYPTION_TYPE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ export class PushNotificationBaseClass {
}
return balance;
} catch (error) {
console.log(error);
console.error(error);
throw new Error(JSON.stringify(error));
}
}
Expand Down Expand Up @@ -401,7 +401,6 @@ export class PushNotificationBaseClass {
const approvalTrxPromise = contract!['approve'](spenderAddress, amount);
const approvalTrx = await approvalTrxPromise;
await this.signer?.provider?.waitForTransaction(approvalTrx.hash);
// console.log(approvalTrx.hash)
} else if ('signTypedData' in this.signer!) {
if (!contract.write) {
throw new Error('viem signer is not provided');
Expand All @@ -410,13 +409,12 @@ export class PushNotificationBaseClass {
args: [spenderAddress, amount],
});
const approvalTrxRes = await approvalTrxPromise;
// console.log(approvalTrxRes);
} else {
throw new Error('Unsupported signer');
}
return true;
} catch (error) {
console.log(error);
console.error(error);
return false;
}
}
Expand Down
7 changes: 0 additions & 7 deletions packages/restapi/src/lib/space/acceptPromotionRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@ export async function acceptPromotionRequest(
) {
const { signalData, promoteeAddress, spaceId, role } = options || {};

console.log(
'acceptPromotionRequest options',
options,
'local stream',
this.data.local.stream
);

await addSpeakers({
spaceId: this.spaceSpecificData.spaceId,
signer: this.signer,
Expand Down
2 changes: 0 additions & 2 deletions packages/restapi/src/lib/space/broadcastRaisedHand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ export async function broadcastRaisedHand(
) {
const { promoteeAddress } = options || {};

console.log('BROADCAST RAISE HAND', options);

// update live space info
const updatedLiveSpaceData = produce(
this.spaceSpecificData.liveSpaceData,
Expand Down
12 changes: 0 additions & 12 deletions packages/restapi/src/lib/space/join.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,6 @@ export async function join(this: Space) {
}
});

console.log(
'ISSPEAKER',
isSpeaker,
'isListner',
isListner,
'isSpeakerPending',
isSpeakerPending
);

const hostAddress = getPlainAddress(space.spaceCreator);
const incomingIndex = getIncomingIndexFromAddress(
this.data.incoming,
Expand All @@ -69,7 +60,6 @@ export async function join(this: Space) {

// if speaker is pending then approve first or if listner is pending/not found then approve first
if (!isSpeaker && !isListner) {
console.log('CALLING APPROVE');
await approve({
signer: this.signer,
pgpPrivateKey: this.pgpPrivateKey,
Expand All @@ -80,7 +70,6 @@ export async function join(this: Space) {

if (isSpeaker || isSpeakerPending) {
// Call the host and join the mesh connection
console.log('CALLING REQUEST');
await this.request({
senderAddress: this.data.local.address,
recipientAddress: hostAddress,
Expand All @@ -96,7 +85,6 @@ export async function join(this: Space) {
spaceId: this.spaceSpecificData.spaceId,
env: this.env,
});
console.log('UPDATED SPACE', updatedSpace);
// update space specific data
this.setSpaceSpecificData(() => ({
...updatedSpace,
Expand Down
2 changes: 0 additions & 2 deletions packages/restapi/src/lib/space/onJoinListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ export interface OnJoinListenerType {
export async function onJoinListener(this: Space, options: OnJoinListenerType) {
const { receivedAddress } = options || {};

console.log('JOIN LISTENER CALLED', 'receivedAddress', receivedAddress);

// method should be called only by the host
if (
pCAIP10ToWallet(this.spaceSpecificData.spaceCreator) !==
Expand Down
4 changes: 0 additions & 4 deletions packages/restapi/src/lib/space/onReceiveMetaMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ export function onReceiveMetaMessage(
) {
const { receivedMetaMessage } = options || {};

console.log('ONRECEIVEMETAMESSAGE', receivedMetaMessage);

if (
receivedMetaMessage.messageType !== MessageType.META ||
typeof receivedMetaMessage.messageObj !== 'object' ||
Expand All @@ -28,8 +26,6 @@ export function onReceiveMetaMessage(
receivedMetaMessage.messageObj as Omit<InfoMessage, 'type'>
).info.arbitrary as LiveSpaceData;

console.log('RECEIVED LIVE SPACE DATA', receivedLiveSpaceData);

this.setSpaceSpecificData(() => ({
...this.spaceSpecificData,
liveSpaceData: receivedLiveSpaceData,
Expand Down
2 changes: 0 additions & 2 deletions packages/restapi/src/lib/space/requestToBePromoted.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ export async function requestToBePromoted(
) {
const { role, promotorAddress } = options || {};

console.log("requestToBePromoted", options);

// requesting host to include local computer into the mesh connection
this.request({
senderAddress: this.data.local.address,
Expand Down
6 changes: 0 additions & 6 deletions packages/restapi/src/lib/space/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,14 @@ export async function start(this: Space): Promise<void> {

// const { streamKey, playbackId } = responseData;

// console.log('livepeer details', streamKey, playbackId);

// this.update({ meta: playbackId });

// let redirectUrl;
// try {
// console.log('Ignore the following error');

// // the redirect URL from the above GET request
// await axios.get(`https://livepeer.studio/webrtc/${streamKey}`);
// } catch (err: any) {
// console.log('redirectUrl error', err);
// redirectUrl = err.request.responseURL;
// }

Expand Down Expand Up @@ -219,8 +215,6 @@ export async function start(this: Space): Promise<void> {
// new RTCSessionDescription({ type: 'answer', sdp: answerSDP })
// );
// }

console.log('Live Stream started');
} catch (err) {
console.error(`[Push SDK] - API - Error - API ${start.name} -: `, err);
throw Error(`[Push SDK] - API - Error - API ${start.name} -: ${err}`);
Expand Down
Loading

0 comments on commit c717303

Please sign in to comment.