diff --git a/packages/restapi/src/lib/alias/getAliasInfo.ts b/packages/restapi/src/lib/alias/getAliasInfo.ts index 549e73b25..24675407f 100644 --- a/packages/restapi/src/lib/alias/getAliasInfo.ts +++ b/packages/restapi/src/lib/alias/getAliasInfo.ts @@ -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'; @@ -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); }); -} +}; diff --git a/packages/restapi/src/lib/constants.ts b/packages/restapi/src/lib/constants.ts index af0788ff1..b8e18c426 100644 --- a/packages/restapi/src/lib/constants.ts +++ b/packages/restapi/src/lib/constants.ts @@ -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, diff --git a/packages/restapi/src/lib/pushNotification/pushNotificationBase.ts b/packages/restapi/src/lib/pushNotification/pushNotificationBase.ts index 6d6f7eb3f..b61435fa6 100644 --- a/packages/restapi/src/lib/pushNotification/pushNotificationBase.ts +++ b/packages/restapi/src/lib/pushNotification/pushNotificationBase.ts @@ -340,7 +340,7 @@ export class PushNotificationBaseClass { } return balance; } catch (error) { - console.log(error); + console.error(error); throw new Error(JSON.stringify(error)); } } @@ -401,7 +401,6 @@ export class PushNotificationBaseClass { const approvalTrxPromise = contract; 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'); @@ -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; } } diff --git a/packages/restapi/src/lib/space/acceptPromotionRequest.ts b/packages/restapi/src/lib/space/acceptPromotionRequest.ts index c37c5e3b7..893c1202d 100644 --- a/packages/restapi/src/lib/space/acceptPromotionRequest.ts +++ b/packages/restapi/src/lib/space/acceptPromotionRequest.ts @@ -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, diff --git a/packages/restapi/src/lib/space/broadcastRaisedHand.ts b/packages/restapi/src/lib/space/broadcastRaisedHand.ts index d90b706e8..3984c3996 100644 --- a/packages/restapi/src/lib/space/broadcastRaisedHand.ts +++ b/packages/restapi/src/lib/space/broadcastRaisedHand.ts @@ -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, diff --git a/packages/restapi/src/lib/space/join.ts b/packages/restapi/src/lib/space/join.ts index 8bb82c441..fd4c62090 100644 --- a/packages/restapi/src/lib/space/join.ts +++ b/packages/restapi/src/lib/space/join.ts @@ -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, @@ -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, @@ -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, @@ -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, diff --git a/packages/restapi/src/lib/space/onJoinListener.ts b/packages/restapi/src/lib/space/onJoinListener.ts index 72aa30c68..1f106028d 100644 --- a/packages/restapi/src/lib/space/onJoinListener.ts +++ b/packages/restapi/src/lib/space/onJoinListener.ts @@ -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) !== diff --git a/packages/restapi/src/lib/space/onReceiveMetaMessage.ts b/packages/restapi/src/lib/space/onReceiveMetaMessage.ts index 800511e31..858b32f6b 100644 --- a/packages/restapi/src/lib/space/onReceiveMetaMessage.ts +++ b/packages/restapi/src/lib/space/onReceiveMetaMessage.ts @@ -13,8 +13,6 @@ export function onReceiveMetaMessage( ) { const { receivedMetaMessage } = options || {}; - console.log('ONRECEIVEMETAMESSAGE', receivedMetaMessage); - if ( receivedMetaMessage.messageType !== MessageType.META || typeof receivedMetaMessage.messageObj !== 'object' || @@ -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, diff --git a/packages/restapi/src/lib/space/requestToBePromoted.ts b/packages/restapi/src/lib/space/requestToBePromoted.ts index 0fd3b703e..b8bc6615b 100644 --- a/packages/restapi/src/lib/space/requestToBePromoted.ts +++ b/packages/restapi/src/lib/space/requestToBePromoted.ts @@ -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, diff --git a/packages/restapi/src/lib/space/start.ts b/packages/restapi/src/lib/space/start.ts index 5fd42f966..770d99c5e 100644 --- a/packages/restapi/src/lib/space/start.ts +++ b/packages/restapi/src/lib/space/start.ts @@ -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; // } @@ -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}`); diff --git a/packages/restapi/src/lib/video/Video.ts b/packages/restapi/src/lib/video/Video.ts index ad9262d60..987327155 100644 --- a/packages/restapi/src/lib/video/Video.ts +++ b/packages/restapi/src/lib/video/Video.ts @@ -156,7 +156,7 @@ export class Video { }); }); } catch (err) { - console.log('error in create', err); + console.error('error in create', err); } } @@ -165,15 +165,11 @@ export class Video { senderAddress, recipientAddress, chatId, - onReceiveMessage = (message: string) => { - console.log('received a meesage', message); - }, + onReceiveMessage, retry = false, details, } = options || {}; - console.log('request', 'options', options); - const recipientAddresses = Array.isArray(recipientAddress) ? recipientAddress : [recipientAddress]; @@ -273,11 +269,6 @@ export class Video { const connectedAddresses = getConnectedAddresses({ incomingPeers: this.data.incoming, }); - console.log( - 'REQUEST - SENDING THE CONNECTED ADDRESSES', - 'connectedAddresses', - connectedAddresses - ); this.peerInstances[recipientAddress].send( JSON.stringify({ type: 'connectedAddresses', @@ -291,12 +282,6 @@ export class Video { const parsedData = JSON.parse(data); if (parsedData.type === 'connectedAddresses') { - console.log( - 'REQUEST - RECEIVING CONNECTED ADDRESSES', - 'CONNECTED ADDRESSES', - parsedData.value - ); - const receivedConnectedAddresses = parsedData.value; const localConnectedAddresses = getConnectedAddresses({ incomingPeers: this.data.incoming, @@ -321,7 +306,6 @@ export class Video { } if (parsedData.type === 'isVideoOn') { - console.log('IS VIDEO ON', parsedData.value); this.setData((oldData) => { return produce(oldData, (draft) => { const incomingIndex = getIncomingIndexFromAddress( @@ -334,7 +318,6 @@ export class Video { } if (parsedData.type === 'isAudioOn') { - console.log('IS AUDIO ON', parsedData.value); this.setData((oldData) => { return produce(oldData, (draft) => { const incomingIndex = getIncomingIndexFromAddress( @@ -347,8 +330,6 @@ export class Video { } if (parsedData.type === 'endCall') { - console.log('END CALL'); - if ( this.callType === VIDEO_CALL_TYPE.PUSH_SPACE && parsedData?.details?.type === SPACE_DISCONNECT_TYPE.LEAVE @@ -398,7 +379,7 @@ export class Video { this.setData(() => initVideoCallData); } } - } else { + } else if(onReceiveMessage) { onReceiveMessage(data); } }); @@ -406,7 +387,6 @@ export class Video { this.peerInstances[recipientAddress].on( 'stream', (currentStream: MediaStream) => { - console.log('received incoming stream', currentStream); const incomingIndex = getIncomingIndexFromAddress( this.data.incoming, recipientAddress @@ -424,7 +404,7 @@ export class Video { } ); } catch (err) { - console.log('error in request', err); + console.error('error in request', err); } } } @@ -435,16 +415,12 @@ export class Video { senderAddress, recipientAddress, chatId, - onReceiveMessage = (message: string) => { - console.log('received a meesage', message); - }, + onReceiveMessage, retry = false, details, } = options || {}; try { - console.log('accept request', 'options', options); - // if peerInstance is not null -> acceptRequest/request was called before if (this.peerInstances[recipientAddress]) { // to prevent connection error we stop the exec of acceptRequest @@ -499,10 +475,7 @@ export class Video { // setup error handler this.peerInstances[recipientAddress].on('error', (err: any) => { - console.log('error in accept request', err); - if (this.data.incoming[0].retryCount >= 5) { - console.log('Max retries exceeded, please try again.'); this.disconnect({ peerAddress: recipientAddress }); } @@ -573,11 +546,6 @@ export class Video { const connectedAddresses = getConnectedAddresses({ incomingPeers: this.data.incoming, }); - console.log( - 'ACCEPT REQUEST - SENDING THE CONNECTED ADDRESSES', - 'connectedAddresses', - connectedAddresses - ); this.peerInstances[recipientAddress].send( JSON.stringify({ type: 'connectedAddresses', @@ -602,12 +570,6 @@ export class Video { const parsedData = JSON.parse(data); if (parsedData.type === 'connectedAddresses') { - console.log( - 'ACCEPT REQUEST - RECEIVING CONNECTED ADDRESSES', - 'CONNECTED ADDRESSES', - parsedData.value - ); - const receivedConnectedAddresses = parsedData.value; const localConnectedAddresses = getConnectedAddresses({ incomingPeers: this.data.incoming, @@ -632,7 +594,6 @@ export class Video { } if (parsedData.type === 'isVideoOn') { - console.log('IS VIDEO ON', parsedData.value); this.setData((oldData) => { return produce(oldData, (draft) => { const incomingIndex = getIncomingIndexFromAddress( @@ -645,7 +606,6 @@ export class Video { } if (parsedData.type === 'isAudioOn') { - console.log('IS AUDIO ON', parsedData.value); this.setData((oldData) => { return produce(oldData, (draft) => { const incomingIndex = getIncomingIndexFromAddress( @@ -658,8 +618,6 @@ export class Video { } if (parsedData.type === 'endCall') { - console.log('END CALL'); - if ( this.callType === VIDEO_CALL_TYPE.PUSH_SPACE && parsedData?.details?.type === SPACE_DISCONNECT_TYPE.LEAVE @@ -709,7 +667,7 @@ export class Video { this.setData(() => initVideoCallData); } } - } else { + } else if(onReceiveMessage) { onReceiveMessage(data); } }); @@ -717,7 +675,6 @@ export class Video { this.peerInstances[recipientAddress].on( 'stream', (currentStream: MediaStream) => { - console.log('received incoming stream', currentStream); const incomingIndex = getIncomingIndexFromAddress( this.data.incoming, recipientAddress @@ -735,7 +692,7 @@ export class Video { } ); } catch (err) { - console.log('error in accept request', err); + console.error('error in accept request', err); } } @@ -743,14 +700,6 @@ export class Video { const { peerAddress, signalData } = options || {}; try { - console.log( - 'connect', - 'options', - options, - 'default', - this.data.incoming[0].address - ); - if (!peerAddress) { console.warn('disconnect requires a peer address'); } @@ -759,14 +708,11 @@ export class Video { this.peerInstances[ peerAddress ? peerAddress : this.data.incoming[0].address ].on('error', (err: any) => { - console.log('error in connect', err); - const incomingIndex = peerAddress ? getIncomingIndexFromAddress(this.data.incoming, peerAddress) : 0; if (this.data.incoming[incomingIndex].retryCount >= 5) { - console.log('Max retries exceeded, please try again.'); this.disconnect({ peerAddress: peerAddress ? peerAddress @@ -797,7 +743,7 @@ export class Video { }); }); } catch (err) { - console.log('error in connect', err); + console.error('error in connect', err); } } @@ -805,13 +751,6 @@ export class Video { const { peerAddress, details } = options || {}; try { - console.log( - 'DISCONNECT OPTIONS', - options, - 'default', - this.data.incoming[0].address - ); - if (!options?.peerAddress) { console.warn('disconnect requires a peer address'); } @@ -820,13 +759,6 @@ export class Video { ? getIncomingIndexFromAddress(this.data.incoming, peerAddress) : 0; - console.log( - 'disconnect', - 'options', - options, - 'status', - this.data.incoming[incomingIndex]?.status - ); if ( this.data.incoming[incomingIndex].status === VideoCallStatus.CONNECTED ) { @@ -874,7 +806,7 @@ export class Video { // reset the state this.setData(() => initVideoCallData); } catch (err) { - console.log('error in disconnect', err); + console.error('error in disconnect', err); } } diff --git a/packages/restapi/src/lib/video/helpers/mediaToggle.ts b/packages/restapi/src/lib/video/helpers/mediaToggle.ts index 260368d97..87f0bedc9 100644 --- a/packages/restapi/src/lib/video/helpers/mediaToggle.ts +++ b/packages/restapi/src/lib/video/helpers/mediaToggle.ts @@ -1,28 +1,23 @@ export const restartVideoStream = (stream: MediaStream): void => { - console.log('RESTART LOCAL STREAM'); const vidTracks = stream.getVideoTracks(); vidTracks.forEach((track) => (track.enabled = true)); }; export const stopVideoStream = (stream: MediaStream): void => { - console.log('STOP LOCAL STREAM'); const vidTracks = stream.getVideoTracks(); vidTracks.forEach((track) => (track.enabled = false)); }; export const restartAudioStream = (stream: MediaStream): void => { - console.log('RESTART AUDIO'); const audTracks = stream.getAudioTracks(); audTracks.forEach((track) => (track.enabled = true)); }; export const stopAudioStream = (stream: MediaStream): void => { - console.log('STOP AUDIO'); const audTracks = stream.getAudioTracks(); audTracks.forEach((track) => (track.enabled = false)); }; export const endStream = (stream: MediaStream) => { - console.log("END STREAM"); stream.getTracks().forEach((track) => track.stop()); } diff --git a/packages/restapi/src/lib/video/helpers/sendVideoCallNotification.ts b/packages/restapi/src/lib/video/helpers/sendVideoCallNotification.ts index ab4b2664e..738312eba 100644 --- a/packages/restapi/src/lib/video/helpers/sendVideoCallNotification.ts +++ b/packages/restapi/src/lib/video/helpers/sendVideoCallNotification.ts @@ -64,8 +64,6 @@ const sendVideoCallNotification = async ( callDetails }; - console.log('sendVideoCallNotification', 'videoData', videoData); - const senderAddressInCaip = getCAIPWithChainId(senderAddress, chainId); const recipientAddressInCaip = getCAIPWithChainId( recipientAddress, @@ -102,7 +100,7 @@ const sendVideoCallNotification = async ( env, }); } catch (err) { - console.log('Error occured while sending notification for video call', err); + console.error('Error occured while sending notification for video call', err); } }; diff --git a/packages/restapi/tests/lib/userLowLevel/createUserWithProfile.test.ts b/packages/restapi/tests/lib/userLowLevel/createUserWithProfile.test.ts index 9450e111d..5438736e0 100644 --- a/packages/restapi/tests/lib/userLowLevel/createUserWithProfile.test.ts +++ b/packages/restapi/tests/lib/userLowLevel/createUserWithProfile.test.ts @@ -18,7 +18,6 @@ describe('Create Push Profile with Profile update', () => { let walletAddress: string; let account: string; - beforeEach(() => { provider = ethers.getDefaultProvider(11155111); const WALLET = ethers.Wallet.createRandom(); @@ -27,11 +26,11 @@ describe('Create Push Profile with Profile update', () => { account = `eip155:${walletAddress}`; }); - it('Push Profile V3', async () => { const name = 'John'; - const desc = 'He is web3 dev' - const picture = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvUlEQVR4AcXBsa3CMBiF0Y+rFNarM0Jqi1EoU2QIj+IxPACTuGYEBnAH7Q+FI/SKe87lflxfGAkzYSbMFr7kMoh6TUTb2ph5PHeiXAZRr4lImAkzYbbkMoh6TUTb2vjFtjaiXneiXAaRMBNmwmzhxN9xI+o1MZPL4ENNzAgzYSbMFk70mohyGcz0mviFMBNmwmzhxLY2Pt2Y2dZG9HjuzAgzYSbMLvfj+mIil8F/9JqYEWbCTJgJM2EmzITZG0wkJb/EapQdAAAAAElFTkSuQmCC' + const desc = 'He is web3 dev'; + const picture = + 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvUlEQVR4AcXBsa3CMBiF0Y+rFNarM0Jqi1EoU2QIj+IxPACTuGYEBnAH7Q+FI/SKe87lflxfGAkzYSbMFr7kMoh6TUTb2ph5PHeiXAZRr4lImAkzYbbkMoh6TUTb2vjFtjaiXneiXAaRMBNmwmzhxN9xI+o1MZPL4ENNzAgzYSbMFk70mohyGcz0mviFMBNmwmzhxLY2Pt2Y2dZG9HjuzAgzYSbMLvfj+mIil8F/9JqYEWbCTJgJM2EmzITZG0wkJb/EapQdAAAAAElFTkSuQmCC'; const user = await createUserWithProfile({ account: account, env: _env, @@ -42,7 +41,6 @@ describe('Create Push Profile with Profile update', () => { picture: picture, }, }); - console.log(user) expect(user).to.be.an('object'); expect(user).not.to.be.null; expect(user).not.to.be.undefined; @@ -56,7 +54,7 @@ describe('Create Push Profile with Profile update', () => { ); expect(user.profile.name).to.be.equal(name); expect(user.profile.desc).to.be.equal(desc); - expect(user.profile.picture).to.be.equal(picture);; + expect(user.profile.picture).to.be.equal(picture); expect(user.msgSent).to.be.equal(0); }); });