Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@reown/appkit-common

Package Overview
Dependencies
Maintainers
0
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@reown/appkit-common - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

19

dist/esm/src/utils/CaipNetworksUtil.js

@@ -7,8 +7,25 @@ const RPC_URL_HOST = 'rpc.walletconnect.org';

const url = new URL(rpcUrl);
url.searchParams.set('projectId', projectId);
if (!url.searchParams.has('projectId')) {
url.searchParams.set('projectId', projectId);
}
return url.toString();
}
return rpcUrl;
},
extendCaipNetwork(caipNetwork, { networkImageIds, customNetworkImageUrls, projectId }) {
return {
...caipNetwork,
imageId: networkImageIds[caipNetwork.chainId],
imageUrl: customNetworkImageUrls?.[caipNetwork.chainId],
rpcUrl: CaipNetworksUtil.extendRpcUrlWithProjectId(caipNetwork.rpcUrl, projectId)
};
},
extendCaipNetworks(caipNetworks, { networkImageIds, customNetworkImageUrls, projectId }) {
return caipNetworks.map(caipNetwork => CaipNetworksUtil.extendCaipNetwork(caipNetwork, {
networkImageIds,
customNetworkImageUrls,
projectId
}));
}
};
//# sourceMappingURL=CaipNetworksUtil.js.map

14

dist/esm/src/utils/SafeLocalStorage.js

@@ -6,3 +6,2 @@ export const SafeLocalStorageKeys = {

SOLANA_CAIP_CHAIN: '@appkit/solana_caip_chain',
ACTIVE_CAIP_NETWORK: '@appkit/active_caip_network',
ACTIVE_CAIP_NETWORK_ID: '@appkit/active_caip_network_id',

@@ -18,3 +17,3 @@ CONNECTED_CONNECTOR: '@appkit/connected_connector',

if (isSafe()) {
localStorage.setItem(key, JSON.stringify(value));
localStorage.setItem(key, value);
}

@@ -24,12 +23,3 @@ },

if (isSafe()) {
const value = localStorage.getItem(key);
if (value) {
try {
return JSON.parse(value);
}
catch (e) {
console.warn('Error parsing value from localStorage', key, e);
return undefined;
}
}
return localStorage.getItem(key) || undefined;
}

@@ -36,0 +26,0 @@ return undefined;

@@ -20,3 +20,8 @@ import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest';

describe('SafeLocalStorage safe', () => {
let getItem = vi.fn(() => '{"test":"test"}');
let getItem = vi.fn(value => {
if (value === '@appkit/wallet_id') {
return 'test';
}
return undefined;
});
let setItem = vi.fn();

@@ -34,6 +39,6 @@ let removeItem = vi.fn();

expect(SafeLocalStorage.setItem('@appkit/wallet_id', 'test')).toBe(undefined);
expect(setItem).toHaveBeenCalledWith('@appkit/wallet_id', JSON.stringify('test'));
expect(setItem).toHaveBeenCalledWith('@appkit/wallet_id', 'test');
});
it('should getItem ', () => {
expect(SafeLocalStorage.getItem('@appkit/wallet_id')).toEqual({ test: 'test' });
expect(SafeLocalStorage.getItem('@appkit/wallet_id')).toEqual('test');
expect(getItem).toHaveBeenCalledWith('@appkit/wallet_id');

@@ -45,8 +50,7 @@ });

});
it('getItem should return undefined when value is not valid JSON', () => {
getItem.mockReturnValueOnce('test');
expect(SafeLocalStorage.getItem('@appkit/wallet_id')).toBe(undefined);
expect(getItem).toHaveBeenCalledWith('@appkit/wallet_id');
it('getItem should return undefined if the value not exist', () => {
expect(SafeLocalStorage.getItem('@appkit/connected_connector')).toBe(undefined);
expect(getItem).toHaveBeenCalledWith('@appkit/connected_connector');
});
});
//# sourceMappingURL=SafeLocalStorage.test.js.map

@@ -0,3 +1,12 @@

import type { CaipNetwork } from './TypeUtil.js';
type ExtendCaipNetworkParams = {
networkImageIds: Record<number | string, string>;
customNetworkImageUrls: Record<number | string, string> | undefined;
projectId: string;
};
export declare const CaipNetworksUtil: {
extendRpcUrlWithProjectId(rpcUrl: string, projectId: string): string;
extendCaipNetwork(caipNetwork: CaipNetwork, { networkImageIds, customNetworkImageUrls, projectId }: ExtendCaipNetworkParams): CaipNetwork;
extendCaipNetworks(caipNetworks: CaipNetwork[], { networkImageIds, customNetworkImageUrls, projectId }: ExtendCaipNetworkParams): CaipNetwork[];
};
export {};

@@ -1,2 +0,1 @@

import type { CaipNetwork } from './TypeUtil.js';
export type SafeLocalStorageItems = {

@@ -7,3 +6,2 @@ '@appkit/wallet_id': string;

'@appkit/solana_caip_chain': string;
'@appkit/active_caip_network': CaipNetwork;
'@appkit/active_caip_network_id': string;

@@ -14,6 +12,3 @@ '@appkit/connected_connector': string;

'@appkit/recent_wallets': string;
'@appkit/deeplink_choice': {
href: string;
name: string;
};
'@appkit/deeplink_choice': string;
};

@@ -25,3 +20,2 @@ export declare const SafeLocalStorageKeys: {

readonly SOLANA_CAIP_CHAIN: "@appkit/solana_caip_chain";
readonly ACTIVE_CAIP_NETWORK: "@appkit/active_caip_network";
readonly ACTIVE_CAIP_NETWORK_ID: "@appkit/active_caip_network_id";

@@ -28,0 +22,0 @@ readonly CONNECTED_CONNECTOR: "@appkit/connected_connector";

{
"name": "@reown/appkit-common",
"version": "1.0.2",
"version": "1.0.3",
"type": "module",

@@ -5,0 +5,0 @@ "main": "./dist/esm/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc