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

@tonconnect/sdk

Package Overview
Dependencies
Maintainers
3
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tonconnect/sdk - npm Package Compare versions

Comparing version 0.0.22 to 0.0.23

13

lib/provider/bridge/bridge-gateway.js

@@ -17,2 +17,13 @@ "use strict";

const url_1 = require("../../utils/url");
const web_api_1 = require("../../utils/web-api");
if ((0, web_api_1.isNode)()) {
try {
// noinspection JSConstantReassignment
global.EventSource = require('eventsource');
global.fetch = require('node-fetch');
}
catch (err) {
console.error(err);
}
}
class BridgeGateway {

@@ -38,3 +49,3 @@ constructor(storage, bridgeUrl, sessionId, listener, errorsListener) {

}
this.eventSource = new EventSource(url);
this.eventSource = new EventSource(url.toString());
return new Promise((resolve, reject) => {

@@ -41,0 +52,0 @@ this.eventSource.onerror = reject;

2

lib/provider/bridge/bridge-provider.js

@@ -134,3 +134,3 @@ "use strict";

return __awaiter(this, void 0, void 0, function* () {
throw new ton_connect_error_1.TonConnectError(`Bridge error ${e}`);
throw new ton_connect_error_1.TonConnectError(`Bridge error ${JSON.stringify(e)}`);
});

@@ -137,0 +137,0 @@ }

@@ -39,2 +39,3 @@ "use strict";

const bridge_connection_storage_1 = require("../../storage/bridge-connection-storage");
const web_api_1 = require("../../utils/web-api");
class InjectedProvider {

@@ -69,3 +70,3 @@ constructor(injectedWalletKey) {

static isWindowContainsWallet(window, injectedWalletKey) {
return (window &&
return (!!window &&
injectedWalletKey in window &&

@@ -149,2 +150,2 @@ typeof window[injectedWalletKey] === 'object' &&

exports.InjectedProvider = InjectedProvider;
InjectedProvider.window = window;
InjectedProvider.window = (0, web_api_1.getWindow)();
import { IStorage } from "./models/storage.interface";
export declare class DefaultStorage implements IStorage {
private readonly window;
constructor();

@@ -4,0 +5,0 @@ getItem(key: string): Promise<string | null>;

@@ -14,11 +14,14 @@ "use strict";

const localstorage_not_found_error_1 = require("../errors/storage/localstorage-not-found.error");
const web_api_1 = require("../utils/web-api");
class DefaultStorage {
constructor() {
const window = (0, web_api_1.getWindow)();
if (!(window === null || window === void 0 ? void 0 : window.localStorage)) {
throw new localstorage_not_found_error_1.LocalstorageNotFoundError();
}
this.window = window;
}
getItem(key) {
return __awaiter(this, void 0, void 0, function* () {
return Promise.resolve(window.localStorage.getItem(key));
return Promise.resolve(this.window.localStorage.getItem(key));
});

@@ -28,3 +31,3 @@ }

return __awaiter(this, void 0, void 0, function* () {
window.localStorage.removeItem(key);
this.window.localStorage.removeItem(key);
return Promise.resolve();

@@ -34,3 +37,3 @@ });

setItem(key, value) {
window.localStorage.setItem(key, value);
this.window.localStorage.setItem(key, value);
return Promise.resolve();

@@ -37,0 +40,0 @@ }

import { DappMetadata } from "../models";
export declare function getWindow(): Window | undefined;
export declare function getDocument(): Document | undefined;
export declare function isNode(): boolean;
export declare function getWebPageMetadata(): DappMetadata;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getWebPageMetadata = void 0;
exports.getWebPageMetadata = exports.isNode = exports.getDocument = exports.getWindow = void 0;
function getWindow() {
if (typeof window === 'undefined') {
return undefined;
}
return window;
}
exports.getWindow = getWindow;
function getDocument() {
if (typeof document === 'undefined') {
return undefined;
}
return document;
}
exports.getDocument = getDocument;
function isNode() {
return typeof require === 'function' && typeof global === 'object';
}
exports.isNode = isNode;
function getWebPageMetadata() {
var _a, _b;
return {
url: (window === null || window === void 0 ? void 0 : window.location.origin) || '',
url: ((_a = getWindow()) === null || _a === void 0 ? void 0 : _a.location.origin) || '',
icon: getIconUrl(),
name: (document === null || document === void 0 ? void 0 : document.title) || 'Unknown dapp'
name: ((_b = getDocument()) === null || _b === void 0 ? void 0 : _b.title) || 'Unknown dapp'
};

@@ -13,2 +32,6 @@ }

function getIconUrl() {
const document = getDocument();
if (!document) {
return '';
}
const appleTouchIcons = document.querySelectorAll("link[rel='apple-touch-icon']");

@@ -15,0 +38,0 @@ if (appleTouchIcons === null || appleTouchIcons === void 0 ? void 0 : appleTouchIcons.length) {

{
"name": "@tonconnect/sdk",
"version": "0.0.22",
"version": "0.0.23",
"scripts": {

@@ -29,2 +29,4 @@ "build": "npx rimraf lib && ttsc",

"tweetnacl": "^1.0.3",
"eventsource": "^2.0.2",
"node-fetch": "^2.6.7",
"@tonconnect/protocol": "^0.0.11"

@@ -31,0 +33,0 @@ },

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