@tezos-x/octez.connect-wallet 4.8.2 → 4.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -172,7 +172,7 @@
|
|
|
172
172
|
\***********************************************************************/function(__unused_webpack_module,exports,__webpack_require__){"use strict";eval('{\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, "__esModule", ({ value: true }));\nexports.Client = void 0;\nconst octez_connect_utils_1 = __webpack_require__(/*! @tezos-x/octez.connect-utils */ "./packages/octez.connect-utils/dist/cjs/index.js");\nconst octez_connect_types_1 = __webpack_require__(/*! @tezos-x/octez.connect-types */ "./packages/octez.connect-types/dist/cjs/index.js");\nconst BeaconClient_1 = __webpack_require__(/*! ../beacon-client/BeaconClient */ "./packages/octez.connect-core/dist/cjs/clients/beacon-client/BeaconClient.js");\nconst AccountManager_1 = __webpack_require__(/*! ../../managers/AccountManager */ "./packages/octez.connect-core/dist/cjs/managers/AccountManager.js");\nconst get_sender_id_1 = __webpack_require__(/*! ../../utils/get-sender-id */ "./packages/octez.connect-core/dist/cjs/utils/get-sender-id.js");\nconst Logger_1 = __webpack_require__(/*! ../../utils/Logger */ "./packages/octez.connect-core/dist/cjs/utils/Logger.js");\nconst Serializer_1 = __webpack_require__(/*! ../../Serializer */ "./packages/octez.connect-core/dist/cjs/Serializer.js");\nconst logger = new Logger_1.Logger(\'Client\');\n/**\n * @internalapi\n *\n * This abstract class handles the a big part of the logic that is shared between the dapp and wallet client.\n * For example, it selects and manages the transport and accounts.\n */\nclass Client extends BeaconClient_1.BeaconClient {\n get transport() {\n return this._transport.promise;\n }\n /**\n * Returns the connection status of the Client\n */\n get connectionStatus() {\n var _a, _b;\n return (_b = (_a = this._transport.promiseResult) === null || _a === void 0 ? void 0 : _a.connectionStatus) !== null && _b !== void 0 ? _b : octez_connect_types_1.TransportStatus.NOT_CONNECTED;\n }\n /**\n * Returns whether or not the transaport is ready\n */\n get ready() {\n return this.transport.then(() => undefined);\n }\n constructor(config) {\n var _a;\n super(config);\n /**\n * How many requests can be sent after another\n */\n this.rateLimit = 2;\n /**\n * The time window in seconds in which the "rateLimit" is checked\n */\n this.rateLimitWindowInSeconds = 5;\n /**\n * Stores the times when requests have been made to determine if the rate limit has been reached\n */\n this.requestCounter = [];\n this.transportListeners = new Map();\n this._transport = new octez_connect_utils_1.ExposedPromise();\n this.accountManager = new AccountManager_1.AccountManager(config.storage);\n this.matrixNodes = (_a = config.matrixNodes) !== null && _a !== void 0 ? _a : {};\n this.handleResponse = (message, connectionInfo) => {\n throw new Error(`not overwritten${JSON.stringify(message)} - ${JSON.stringify(connectionInfo)}`);\n };\n }\n cleanup() {\n return __awaiter(this, void 0, void 0, function* () {\n if (!this.transportListeners.size) {\n return;\n }\n if (this._transport.isResolved()) {\n const transport = yield this.transport;\n yield Promise.all(Array.from(this.transportListeners.values()).map((listener) => transport.removeListener(listener)));\n this.transportListeners.clear();\n }\n });\n }\n /**\n * Return all locally known accounts\n */\n getAccounts() {\n return __awaiter(this, void 0, void 0, function* () {\n return this.accountManager.getAccounts();\n });\n }\n /**\n * Return the account by ID\n * @param accountIdentifier The ID of an account\n */\n getAccount(accountIdentifier) {\n return __awaiter(this, void 0, void 0, function* () {\n return this.accountManager.getAccount(accountIdentifier);\n });\n }\n /**\n * Remove the account by ID\n * @param accountIdentifier The ID of an account\n */\n removeAccount(accountIdentifier) {\n return __awaiter(this, void 0, void 0, function* () {\n return this.accountManager.removeAccount(accountIdentifier);\n });\n }\n /**\n * Remove all locally stored accounts\n */\n removeAllAccounts() {\n return __awaiter(this, void 0, void 0, function* () {\n return this.accountManager.removeAllAccounts();\n });\n }\n /**\n * Add a new request (current timestamp) to the pending requests, remove old ones and check if we are above the limit\n */\n addRequestAndCheckIfRateLimited() {\n return __awaiter(this, void 0, void 0, function* () {\n const now = new Date().getTime();\n this.requestCounter = this.requestCounter.filter((date) => date + this.rateLimitWindowInSeconds * 1000 > now);\n this.requestCounter.push(now);\n return this.requestCounter.length > this.rateLimit;\n });\n }\n /**\n * This method initializes the client. It will check if the connection should be established to a\n * browser extension or if the P2P transport should be used.\n *\n * @param transport A transport that can be provided by the user\n */\n init(transport) {\n return __awaiter(this, void 0, void 0, function* () {\n if (this._transport.isResolved()) {\n return (yield this.transport).type;\n }\n yield this.setTransport(transport); // Let users define their own transport\n return transport.type;\n });\n }\n /**\n * Returns the metadata of this DApp\n */\n getOwnAppMetadata() {\n return __awaiter(this, void 0, void 0, function* () {\n return {\n senderId: yield (0, get_sender_id_1.getSenderId)(yield this.beaconId),\n name: this.name,\n icon: this.iconUrl\n };\n });\n }\n /**\n * Return all known peers\n */\n getPeers() {\n return __awaiter(this, void 0, void 0, function* () {\n return (yield this.transport).getPeers();\n });\n }\n /**\n * Add a new peer to the known peers\n * @param peer The new peer to add\n */\n addPeer(peer) {\n return __awaiter(this, void 0, void 0, function* () {\n return (yield this.transport).addPeer(peer);\n });\n }\n destroy() {\n const _super = Object.create(null, {\n destroy: { get: () => super.destroy }\n });\n return __awaiter(this, void 0, void 0, function* () {\n if (this._transport.isResolved()) {\n const transport = yield this.transport;\n yield this.cleanup();\n yield transport.disconnect();\n if (transport.type === octez_connect_types_1.TransportType.WALLETCONNECT) {\n yield transport.doClientCleanup(); // any because I cannot import the type definition\n }\n }\n yield _super.destroy.call(this);\n });\n }\n /**\n * A "setter" for when the transport needs to be changed.\n */\n setTransport(transport) {\n return __awaiter(this, void 0, void 0, function* () {\n if (transport) {\n if (this._transport.isSettled()) {\n // If the promise has already been resolved we need to create a new one.\n this._transport = octez_connect_utils_1.ExposedPromise.resolve(transport);\n }\n else {\n this._transport.resolve(transport);\n }\n }\n else {\n if (this._transport.isSettled()) {\n // If the promise has already been resolved we need to create a new one.\n this._transport = new octez_connect_utils_1.ExposedPromise();\n }\n }\n });\n }\n addListener(transport) {\n return __awaiter(this, void 0, void 0, function* () {\n // in beacon we subscribe to the transport on client init only\n // unsubscribing from the transport is only beneficial when running\n // a single page dApp.\n // However, while running a multiple tabs setup, if one of the dApps disconnects\n // the others wont\'t recover until after a page refresh\n if (this.transportListeners.has(transport.type)) {\n yield transport.removeListener(this.transportListeners.get(transport.type));\n }\n const subscription = (message, connectionInfo) => __awaiter(this, void 0, void 0, function* () {\n if (typeof message === \'string\') {\n const deserializedMessage = (yield new Serializer_1.Serializer().deserialize(message));\n this.handleResponse(deserializedMessage, connectionInfo);\n }\n });\n this.transportListeners.set(transport.type, subscription);\n transport.addListener(subscription).catch((error) => logger.error(\'addListener\', error));\n });\n }\n sendDisconnectToPeer(peer, transport) {\n return __awaiter(this, void 0, void 0, function* () {\n const request = {\n id: yield (0, octez_connect_utils_1.generateGUID)(),\n version: peer.version,\n senderId: yield (0, get_sender_id_1.getSenderId)(yield this.beaconId),\n type: octez_connect_types_1.BeaconMessageType.Disconnect\n };\n const payload = yield new Serializer_1.Serializer().serialize(request);\n const selectedTransport = transport !== null && transport !== void 0 ? transport : (yield this.transport);\n yield selectedTransport.send(payload, peer);\n });\n }\n}\nexports.Client = Client;\n//# sourceMappingURL=Client.js.map\n\n//# sourceURL=webpack://beacon/./packages/octez.connect-core/dist/cjs/clients/client/Client.js?\n}')},"./packages/octez.connect-core/dist/cjs/constants.js":
|
|
173
173
|
/*!***********************************************************!*\
|
|
174
174
|
!*** ./packages/octez.connect-core/dist/cjs/constants.js ***!
|
|
175
|
-
\***********************************************************/(__unused_webpack_module,exports)=>{"use strict";eval("{\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.BACKEND_URL = exports.NOTIFICATION_ORACLE_URL = exports.BEACON_VERSION = exports.SDK_VERSION = void 0;\nexports.SDK_VERSION = '4.8.
|
|
175
|
+
\***********************************************************/(__unused_webpack_module,exports)=>{"use strict";eval("{\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.BACKEND_URL = exports.NOTIFICATION_ORACLE_URL = exports.BEACON_VERSION = exports.SDK_VERSION = void 0;\nexports.SDK_VERSION = '4.8.3';\nexports.BEACON_VERSION = '3';\nexports.NOTIFICATION_ORACLE_URL = 'https://beacon-notification-oracle.dev.gke.papers.tech';\nexports.BACKEND_URL = 'https://beacon-backend.prod.gke.papers.tech';\n//# sourceMappingURL=constants.js.map\n\n//# sourceURL=webpack://beacon/./packages/octez.connect-core/dist/cjs/constants.js?\n}")},"./packages/octez.connect-core/dist/cjs/debug.js":
|
|
176
176
|
/*!*******************************************************!*\
|
|
177
177
|
!*** ./packages/octez.connect-core/dist/cjs/debug.js ***!
|
|
178
178
|
\*******************************************************/(__unused_webpack_module,exports,__webpack_require__)=>{"use strict";eval('{\nObject.defineProperty(exports, "__esModule", ({ value: true }));\nexports.getDebugEnabled = exports.setDebugEnabled = void 0;\nconst MockWindow_1 = __webpack_require__(/*! ./MockWindow */ "./packages/octez.connect-core/dist/cjs/MockWindow.js");\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nlet debug = MockWindow_1.windowRef.beaconSdkDebugEnabled ? true : false;\nif (debug) {\n // eslint-disable-next-line no-console\n console.log(\'[BEACON]: Debug mode is ON (turned on either by the developer or a browser extension)\');\n}\nconst setDebugEnabled = (enabled) => {\n debug = enabled;\n};\nexports.setDebugEnabled = setDebugEnabled;\nconst getDebugEnabled = () => debug;\nexports.getDebugEnabled = getDebugEnabled;\n//# sourceMappingURL=debug.js.map\n\n//# sourceURL=webpack://beacon/./packages/octez.connect-core/dist/cjs/debug.js?\n}')},"./packages/octez.connect-core/dist/cjs/errors/AbortedBeaconError.js":
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tezos-x/octez.connect-wallet",
|
|
3
|
-
"version": "4.8.
|
|
3
|
+
"version": "4.8.3",
|
|
4
4
|
"description": "Use this package in your wallet to instanciate a WalletClient object and communicate to dApps.",
|
|
5
5
|
"author": "Andreas Gassmann <a.gassmann@papers.ch>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"url": "https://github.com/trilitech/octez.connect-sdk/issues"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@tezos-x/octez.connect-core": "4.8.
|
|
38
|
-
"@tezos-x/octez.connect-transport-matrix": "4.8.
|
|
39
|
-
"@tezos-x/octez.connect-transport-postmessage": "4.8.
|
|
37
|
+
"@tezos-x/octez.connect-core": "4.8.3",
|
|
38
|
+
"@tezos-x/octez.connect-transport-matrix": "4.8.3",
|
|
39
|
+
"@tezos-x/octez.connect-transport-postmessage": "4.8.3"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "c3bee29569f7de3fc686944f392c67999027b1a1"
|
|
42
42
|
}
|