Skip to content

Commit

Permalink
fix(wallet): fix popup blocked in safari browser (#1135)
Browse files Browse the repository at this point in the history
Co-authored-by: Overzunov <[email protected]>
  • Loading branch information
VERZUOL1 and Overzunov authored Jun 3, 2022
1 parent 56a2fe0 commit 2f4bdbf
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ import {
import BN from 'bn.js';
import { NearConfig } from 'config/near';
import { parseNearAmount } from 'near-api-js/lib/utils/format';
import { FunctionCallPermissionView } from 'near-api-js/lib/providers/provider';
import {
AccessKeyInfoView,
FunctionCallPermissionView,
} from 'near-api-js/lib/providers/provider';
import { httpService } from 'services/HttpService';

export class SputnikWalletService implements WalletService {
Expand All @@ -56,6 +59,8 @@ export class SputnikWalletService implements WalletService {

public readonly failureUrl: string = `${window.origin}/callback/auth`;

private accessKeys: AccessKeyInfoView[] = [];

constructor(nearConfig: NearConfig) {
const keyStore = new keyStores.BrowserLocalStorageKeyStore(
window.localStorage
Expand Down Expand Up @@ -93,8 +98,7 @@ export class SputnikWalletService implements WalletService {
): Promise<FinalExecutionOutcome[]> {
const directCallsList = ['act_proposal'];
const accountId = this.getAccountId();

const accessKeys = await this.getAccount().getAccessKeys();
const { accessKeys } = this;

const accessKeyForDao = accessKeys
.filter(accessKey => accessKey.access_key.permission !== 'FullAccess')
Expand Down Expand Up @@ -163,6 +167,12 @@ export class SputnikWalletService implements WalletService {
this.failureUrl
);

const keys = await this.getAccount().getAccessKeys();

if (keys) {
this.accessKeys = keys;
}

return Promise.resolve(true);
}

Expand Down

0 comments on commit 2f4bdbf

Please sign in to comment.