Skip to content

Commit

Permalink
Merge pull request #80 from soonaverse/feat/projectId
Browse files Browse the repository at this point in the history
Feat/project Id implementation
  • Loading branch information
adamunchained authored Nov 1, 2023
2 parents 9107995 + fcc77c4 commit db43962
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/app/components/auth/services/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { NzNotificationService } from 'ng-zorro-antd/notification';
import { BehaviorSubject, firstValueFrom, skip, Subscription } from 'rxjs';
import { MemberApi, TokenDistributionWithAirdrops } from './../../../@api/member.api';
import { removeItem } from './../../../@core/utils/local-storage.utils';
import { environment } from '@env/environment';
const tanglePay = (window as any).iota;

export interface MetamaskSignature {
Expand Down Expand Up @@ -206,14 +207,15 @@ export class AuthService {
public async sign(params: any = {}, cb: SignCallback): Promise<WenRequest | undefined> {
this.showWalletPopup$.next(WalletStatus.ACTIVE);
// We support either resign with metamask or reuse token.
let sc: WenRequest | undefined | false = undefined;
let sc: any | undefined | false = undefined;
const customToken: any = getItem(StorageItem.CustomToken);
const wallet = customToken.wallet || Wallets.Metamask;
// check it's not expired.
if (this.isCustomTokenNotExpired(customToken)) {
sc = {
address: customToken.address,
customToken: customToken.value,
projectApiKey: environment.build5Token,
body: params,
};
} else if (customToken) {
Expand Down Expand Up @@ -271,7 +273,7 @@ export class AuthService {
return true;
}

private async signWithMetamask(params: any = {}): Promise<WenRequest | undefined | false> {
private async signWithMetamask(params: any = {}): Promise<any | undefined | false> {
const provider: any = await detectEthereumProvider();
if (provider) {
try {
Expand Down Expand Up @@ -319,6 +321,7 @@ export class AuthService {
return {
address: provider.selectedAddress,
signature: signature,
projectApiKey: environment.build5Token,
body: params,
};
} catch (e) {
Expand Down Expand Up @@ -389,9 +392,10 @@ export class AuthService {
},
});

const returnObj: WenRequest = {
const returnObj: any = {
address: currentAddress,
signature: signature,
projectApiKey: environment.build5Token,
body: params,
};

Expand Down
1 change: 1 addition & 0 deletions src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ export const environment = {
key: 'ed51a01fc204688339e89ac8e9d53028',
},
soonaversePlaceholder: 'https://soonaverse.com/favicon.ico',
build5Token: '',
};
2 changes: 2 additions & 0 deletions src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ export const environment = {
key: '5c053a0370395f0fe8cf7ce9e5a21a72',
},
soonaversePlaceholder: 'https://soonaverse.com/favicon.ico',
build5Token:
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOiIweDU1MWZkMmM3YzdiZjM1NmJhYzE5NDU4N2RhYjJmY2Q0NjQyMDA1NGIiLCJwcm9qZWN0IjoiMHg0NjIyM2VkZDQxNTc2MzVkZmM2Mzk5MTU1NjA5ZjMwMWRlY2JmZDg4IiwiaWF0IjoxNjk1ODUyNTk2fQ.WT9L4H9eDdFfJZMrfxTKhEq4PojNWSGNv_CbmlG9sJg',
};

0 comments on commit db43962

Please sign in to comment.