Skip to content

Commit 88b1888

Browse files
authoredMar 11, 2025··
Merge pull request #631 from enkryptcom/develop
Release: v2.4.3
2 parents 0e603c7 + 048f6f5 commit 88b1888

File tree

7 files changed

+51
-11
lines changed

7 files changed

+51
-11
lines changed
 

‎packages/extension/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@enkryptcom/extension",
3-
"version": "2.4.2",
3+
"version": "2.4.3",
44
"private": true,
55
"type": "module",
66
"scripts": {

‎packages/extension/src/providers/bitcoin/methods/btc_requestAccounts.ts

+12-2
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,21 @@ import { ProviderRPCRequest } from '@/types/provider';
44
import { WindowPromise } from '@/libs/window-promise';
55
import AccountState from '../libs/accounts-state';
66
import { getCustomError } from '@/libs/error';
7+
import openOnboard from '@/libs/utils/open-onboard';
8+
import { throttle } from 'lodash';
9+
710
let isAccountAccessPending = false;
11+
const throttledOpenOnboard = throttle(() => openOnboard(), 10000);
812
const pendingPromises: {
913
payload: ProviderRPCRequest;
1014
res: CallbackFunction;
1115
}[] = [];
12-
const method: MiddlewareFunction = function (
16+
const method: MiddlewareFunction = async function (
1317
this: BitcoinProvider,
1418
payload: ProviderRPCRequest,
1519
res,
1620
next,
17-
): void {
21+
): Promise<void> {
1822
if (payload.method !== 'btc_requestAccounts') return next();
1923
else {
2024
if (isAccountAccessPending) {
@@ -25,6 +29,7 @@ const method: MiddlewareFunction = function (
2529
return;
2630
}
2731
isAccountAccessPending = true;
32+
const isInitialized = await this.KeyRing.isInitialized();
2833
const handleRemainingPromises = () => {
2934
isAccountAccessPending = false;
3035
if (pendingPromises.length) {
@@ -38,6 +43,11 @@ const method: MiddlewareFunction = function (
3843
) => {
3944
if (_payload.options && _payload.options.domain) {
4045
isAccountAccessPending = true;
46+
if (!isInitialized) {
47+
_res(getCustomError('Enkrypt not initialized'));
48+
throttledOpenOnboard();
49+
return handleRemainingPromises();
50+
}
4151
const accountsState = new AccountState();
4252
accountsState
4353
.getApprovedAddresses(_payload.options.domain)

‎packages/extension/src/providers/ethereum/networks/aa.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const artheraOptions: EvmNetworkOptions = {
1414
isTestNetwork: false,
1515
currencyName: 'AA',
1616
currencyNameLong: 'Arthera',
17-
node: 'wss://ws.arthera.net',
17+
node: 'https://rpc.arthera.net',
1818
icon,
1919
activityHandler: wrapActivityHandler(EtherscanActivity),
2020
};

‎packages/extension/src/providers/ethereum/networks/aat.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const artheraTestOptions: EvmNetworkOptions = {
1414
isTestNetwork: true,
1515
currencyName: 'AA',
1616
currencyNameLong: 'Arthera',
17-
node: 'wss://ws-test.arthera.net',
17+
node: 'https://rpc-test.arthera.net',
1818
icon,
1919
activityHandler: wrapActivityHandler(EtherscanActivity),
2020
};

‎packages/extension/src/providers/kadena/methods/kda_requestAccounts.ts

+11-2
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,26 @@ import KadenaProvider from '..';
1313
import AccountState from '../libs/accounts-state';
1414
import { KadenaNetworks } from '../types';
1515
import { getNetworkInfo } from '../libs/network';
16+
import openOnboard from '@/libs/utils/open-onboard';
17+
import { throttle } from 'lodash';
1618

1719
let isAccountAccessPending = false;
20+
const throttledOpenOnboard = throttle(() => openOnboard(), 10000);
1821

1922
const pendingPromises: {
2023
payload: ProviderRPCRequest;
2124
res: CallbackFunction;
2225
}[] = [];
2326

24-
const method: MiddlewareFunction = function (
27+
const method: MiddlewareFunction = async function (
2528
this: KadenaProvider,
2629
payload: ProviderRPCRequest,
2730
res,
2831
next,
29-
): void {
32+
): Promise<void> {
3033
if (payload.method !== 'kda_requestAccounts') return next();
3134
else {
35+
const isInitialized = await this.KeyRing.isInitialized();
3236
if (isAccountAccessPending) {
3337
pendingPromises.push({
3438
payload,
@@ -95,6 +99,11 @@ const method: MiddlewareFunction = function (
9599
) => {
96100
if (_payload.options && _payload.options.domain) {
97101
isAccountAccessPending = true;
102+
if (!isInitialized) {
103+
_res(getCustomError('Enkrypt not initialized'));
104+
throttledOpenOnboard();
105+
return handleRemainingPromises();
106+
}
98107
const accountsState = new AccountState();
99108

100109
accountsState

‎packages/extension/src/providers/polkadot/methods/dot_accounts_get.ts

+12-2
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,25 @@ import PublicKeyRing from '@/libs/keyring/public-keyring';
99
import AccountState from '../libs/accounts-state';
1010
import { ProviderRPCRequest } from '@/types/provider';
1111
import { getCustomError } from '@/libs/error';
12+
import openOnboard from '@/libs/utils/open-onboard';
13+
import { throttle } from 'lodash';
1214

1315
let isAccountAccessPending = false;
16+
const throttledOpenOnboard = throttle(() => openOnboard(), 10000);
1417
const pendingPromises: {
1518
payload: ProviderRPCRequest;
1619
res: CallbackFunction;
1720
}[] = [];
18-
const method: MiddlewareFunction = function (
21+
const method: MiddlewareFunction = async function (
1922
this: SubstrateProvider,
2023
payload: ProviderRPCRequest,
2124
res,
2225
next,
23-
): void {
26+
): Promise<void> {
2427
if (payload.method !== 'dot_accounts_get') return next();
2528
else {
29+
const isInitialized = await this.KeyRing.isInitialized();
30+
2631
if (isAccountAccessPending) {
2732
pendingPromises.push({
2833
payload,
@@ -59,6 +64,11 @@ const method: MiddlewareFunction = function (
5964
) => {
6065
if (_payload.options && _payload.options.domain) {
6166
isAccountAccessPending = true;
67+
if (!isInitialized) {
68+
_res(getCustomError('Enkrypt not initialized'));
69+
throttledOpenOnboard();
70+
return handleRemainingPromises();
71+
}
6272
const accountsState = new AccountState();
6373
accountsState.isApproved(_payload.options.domain).then(isApproved => {
6474
if (isApproved) {

‎packages/extension/src/providers/solana/methods/sol_connect.ts

+13-2
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,22 @@ import { ProviderRPCRequest } from '@/types/provider';
33
import { WindowPromise } from '@/libs/window-promise';
44
import AccountState from '../libs/accounts-state';
55
import { getCustomError } from '@/libs/error';
6+
import openOnboard from '@/libs/utils/open-onboard';
7+
import { throttle } from 'lodash';
8+
69
import SolanaProvider from '..';
710
let isAccountAccessPending = false;
11+
const throttledOpenOnboard = throttle(() => openOnboard(), 10000);
812
const pendingPromises: {
913
payload: ProviderRPCRequest;
1014
res: CallbackFunction;
1115
}[] = [];
12-
const method: MiddlewareFunction = function (
16+
const method: MiddlewareFunction = async function (
1317
this: SolanaProvider,
1418
payload: ProviderRPCRequest,
1519
res,
1620
next,
17-
): void {
21+
): Promise<void> {
1822
if (payload.method !== 'sol_connect') return next();
1923
else {
2024
if (isAccountAccessPending) {
@@ -25,6 +29,7 @@ const method: MiddlewareFunction = function (
2529
return;
2630
}
2731
isAccountAccessPending = true;
32+
const isInitialized = await this.KeyRing.isInitialized();
2833
const handleRemainingPromises = () => {
2934
isAccountAccessPending = false;
3035
if (pendingPromises.length) {
@@ -38,6 +43,12 @@ const method: MiddlewareFunction = function (
3843
) => {
3944
if (_payload.options && _payload.options.domain) {
4045
isAccountAccessPending = true;
46+
if (!isInitialized) {
47+
_res(getCustomError('Enkrypt not initialized'));
48+
throttledOpenOnboard();
49+
return handleRemainingPromises();
50+
}
51+
4152
const accountsState = new AccountState();
4253
accountsState
4354
.getApprovedAddresses(_payload.options.domain)

0 commit comments

Comments
 (0)
Please sign in to comment.